Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: fsl_mqs: Support accessing registers by scmi interface

On i.MX95, the MQS module in Always-on (AON) domain only can
be accessed by System Controller Management Interface (SCMI)
MISC Protocol. So define a specific regmap_config for the case.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://patch.msgid.link/20241025062935.1071408-1-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Shengjiu Wang and committed by
Mark Brown
101c9023 28f7aa0c

+42
+1
sound/soc/fsl/Kconfig
··· 30 30 tristate "Medium Quality Sound (MQS) module support" 31 31 depends on SND_SOC_FSL_SAI 32 32 select REGMAP_MMIO 33 + select IMX_SCMI_MISC_DRV if IMX_SCMI_MISC_EXT !=n 33 34 help 34 35 Say Y if you want to add Medium Quality Sound (MQS) 35 36 support for the Freescale CPUs.
+41
sound/soc/fsl/fsl_mqs.c
··· 6 6 // Copyright 2019 NXP 7 7 8 8 #include <linux/clk.h> 9 + #include <linux/firmware/imx/sm.h> 9 10 #include <linux/module.h> 10 11 #include <linux/moduleparam.h> 11 12 #include <linux/mfd/syscon.h> ··· 74 73 75 74 #define FSL_MQS_RATES (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000) 76 75 #define FSL_MQS_FORMATS SNDRV_PCM_FMTBIT_S16_LE 76 + 77 + static int fsl_mqs_sm_read(void *context, unsigned int reg, unsigned int *val) 78 + { 79 + struct fsl_mqs *mqs_priv = context; 80 + int num = 1; 81 + 82 + if (IS_ENABLED(CONFIG_IMX_SCMI_MISC_DRV) && 83 + mqs_priv->soc->ctrl_off == reg) 84 + return scmi_imx_misc_ctrl_get(SCMI_IMX_CTRL_MQS1_SETTINGS, &num, val); 85 + 86 + return -EINVAL; 87 + }; 88 + 89 + static int fsl_mqs_sm_write(void *context, unsigned int reg, unsigned int val) 90 + { 91 + struct fsl_mqs *mqs_priv = context; 92 + 93 + if (IS_ENABLED(CONFIG_IMX_SCMI_MISC_DRV) && 94 + mqs_priv->soc->ctrl_off == reg) 95 + return scmi_imx_misc_ctrl_set(SCMI_IMX_CTRL_MQS1_SETTINGS, val); 96 + 97 + return -EINVAL; 98 + }; 77 99 78 100 static int fsl_mqs_hw_params(struct snd_pcm_substream *substream, 79 101 struct snd_pcm_hw_params *params, ··· 212 188 .cache_type = REGCACHE_NONE, 213 189 }; 214 190 191 + static const struct regmap_config fsl_mqs_sm_regmap = { 192 + .reg_bits = 32, 193 + .val_bits = 32, 194 + .reg_read = fsl_mqs_sm_read, 195 + .reg_write = fsl_mqs_sm_write, 196 + }; 197 + 215 198 static int fsl_mqs_probe(struct platform_device *pdev) 216 199 { 217 200 struct device_node *np = pdev->dev.of_node; ··· 248 217 of_node_put(gpr_np); 249 218 if (IS_ERR(mqs_priv->regmap)) { 250 219 dev_err(&pdev->dev, "failed to get gpr regmap\n"); 220 + return PTR_ERR(mqs_priv->regmap); 221 + } 222 + } else if (mqs_priv->soc->type == TYPE_REG_SM) { 223 + mqs_priv->regmap = devm_regmap_init(&pdev->dev, 224 + NULL, 225 + mqs_priv, 226 + &fsl_mqs_sm_regmap); 227 + if (IS_ERR(mqs_priv->regmap)) { 228 + dev_err(&pdev->dev, "failed to init regmap: %ld\n", 229 + PTR_ERR(mqs_priv->regmap)); 251 230 return PTR_ERR(mqs_priv->regmap); 252 231 } 253 232 } else {