Add compatible string to support AUDMIX on i.MX952 The audmix module can be bypassed so that SAI signals go directly to external pin, which makes the SAI function independent with AUDMIX. Add struct fsl_audmix_soc_data for this soc difference.
Signed-off-by: Shengjiu Wang <[email protected]> --- include/linux/firmware/imx/sm.h | 2 ++ sound/soc/fsl/fsl_audmix.c | 28 ++++++++++++++++++++++++++++ sound/soc/fsl/fsl_audmix.h | 5 +++++ 3 files changed, 35 insertions(+) diff --git a/include/linux/firmware/imx/sm.h b/include/linux/firmware/imx/sm.h index a33b45027356..1e3e0fb1ef81 100644 --- a/include/linux/firmware/imx/sm.h +++ b/include/linux/firmware/imx/sm.h @@ -26,6 +26,8 @@ #define SCMI_IMX94_CTRL_SAI3_MCLK 5U /*!< WAKE SAI3 MCLK */ #define SCMI_IMX94_CTRL_SAI4_MCLK 6U /*!< WAKE SAI4 MCLK */ +#define SCMI_IMX952_CTRL_BYPASS_AUDMIX 8U /* WAKE AUDMIX */ + #if IS_ENABLED(CONFIG_IMX_SCMI_MISC_DRV) int scmi_imx_misc_ctrl_get(u32 id, u32 *num, u32 *val); int scmi_imx_misc_ctrl_set(u32 id, u32 val); diff --git a/sound/soc/fsl/fsl_audmix.c b/sound/soc/fsl/fsl_audmix.c index 7981d598ba13..f2187b45eeec 100644 --- a/sound/soc/fsl/fsl_audmix.c +++ b/sound/soc/fsl/fsl_audmix.c @@ -6,6 +6,7 @@ */ #include <linux/clk.h> +#include <linux/firmware/imx/sm.h> #include <linux/module.h> #include <linux/of_platform.h> #include <linux/pm_runtime.h> @@ -440,9 +441,22 @@ static const struct regmap_config fsl_audmix_regmap_config = { .cache_type = REGCACHE_FLAT, }; +static const struct fsl_audmix_soc_data fsl_audmix_imx8qm_data = { + .bypass_index = -1, +}; + +static const struct fsl_audmix_soc_data fsl_audmix_imx952_data = { + .bypass_index = SCMI_IMX952_CTRL_BYPASS_AUDMIX, +}; + static const struct of_device_id fsl_audmix_ids[] = { { .compatible = "fsl,imx8qm-audmix", + .data = &fsl_audmix_imx8qm_data, + }, + { + .compatible = "fsl,imx952-audmix", + .data = &fsl_audmix_imx952_data, }, { /* sentinel */ } }; @@ -450,6 +464,7 @@ MODULE_DEVICE_TABLE(of, fsl_audmix_ids); static int fsl_audmix_probe(struct platform_device *pdev) { + const struct fsl_audmix_soc_data *soc_data; struct device *dev = &pdev->dev; struct fsl_audmix *priv; void __iomem *regs; @@ -501,6 +516,19 @@ static int fsl_audmix_probe(struct platform_device *pdev) } } + soc_data = of_device_get_match_data(dev); + if (!soc_data) { + dev_err(dev, "failed to match device\n"); + goto err_disable_pm; + } + + if (of_property_read_bool(pdev->dev.of_node, "fsl,amix-bypass") && + soc_data->bypass_index > 0) { + ret = scmi_imx_misc_ctrl_set(soc_data->bypass_index, 0); + if (ret) + goto err_disable_pm; + } + return 0; err_disable_pm: diff --git a/sound/soc/fsl/fsl_audmix.h b/sound/soc/fsl/fsl_audmix.h index 479f05695d53..ad40a959873b 100644 --- a/sound/soc/fsl/fsl_audmix.h +++ b/sound/soc/fsl/fsl_audmix.h @@ -92,6 +92,11 @@ #define FSL_AUDMIX_ATSTP_STPCTR_MASK 0x3FFFF #define FSL_AUDMIX_MAX_DAIS 2 + +struct fsl_audmix_soc_data { + int bypass_index; +}; + struct fsl_audmix { struct platform_device *pdev; struct regmap *regmap; -- 2.34.1
