One of SAI interfaces is connected to AUDMIX in the i.MX952 chip, but
AUDMIX can be bypassed or not bypassed on the i.MX952 platform.

so add 'fsl,sai-amix-mode' property for this feature, with this
property present,then SAI driver will try to config the setting,
fsl,sai-amix-mode = <0> is bypass mode, fsl,sai-amix-mode = <1> is
the AUDMIX mode.

Signed-off-by: Shengjiu Wang <[email protected]>
---
 include/linux/firmware/imx/sm.h |  2 ++
 sound/soc/fsl/fsl_sai.c         | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/include/linux/firmware/imx/sm.h b/include/linux/firmware/imx/sm.h
index a33b45027356..ba5d93bd6158 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_sai.c b/sound/soc/fsl/fsl_sai.c
index 2fa14fbdfe1a..9facb7c5ee0d 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -7,6 +7,7 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/dmaengine.h>
+#include <linux/firmware/imx/sm.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/pinctrl/consumer.h>
@@ -1429,6 +1430,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
        int irq, ret, i;
        int index;
        u32 dmas[4];
+       u32 val;
 
        sai = devm_kzalloc(dev, sizeof(*sai), GFP_KERNEL);
        if (!sai)
@@ -1598,6 +1600,21 @@ static int fsl_sai_probe(struct platform_device *pdev)
        if (ret < 0 && ret != -ENOSYS)
                goto err_pm_get_sync;
 
+       if (of_property_present(np, "fsl,sai-amix-mode") &&
+           of_device_is_compatible(np, "fsl,imx952-sai")) {
+               ret = of_property_read_u32(np, "fsl,sai-amix-mode", &val);
+               if (ret || val > 1) {
+                       dev_err_probe(dev, ret, "Invalid audmix mode\n");
+                       goto err_pm_get_sync;
+               }
+
+               ret = scmi_imx_misc_ctrl_set(SCMI_IMX952_CTRL_BYPASS_AUDMIX, 
val);
+               if (ret) {
+                       dev_err_probe(dev, ret, "Error setting audmix mode\n");
+                       goto err_pm_get_sync;
+               }
+       }
+
        /*
         * Register platform component before registering cpu dai for there
         * is not defer probe for platform component in 
snd_soc_add_pcm_runtime().
-- 
2.34.1


Reply via email to