From: Shengjiu Wang <shengjiu.wang@nxp.com>
To: shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com,
nicoleotsuka@gmail.com, lgirdwood@gmail.com, broonie@kernel.org,
perex@perex.cz, tiwai@suse.com, linux-sound@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
devicetree@vger.kernel.org, shawnguo@kernel.org,
s.hauer@pengutronix.de, kernel@pengutronix.de,
imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 4/4] ASoC: fsl_sai: Add AUDMIX mode support on i.MX952
Date: Fri, 23 Jan 2026 16:25:01 +0800 [thread overview]
Message-ID: <20260123082501.4050296-5-shengjiu.wang@nxp.com> (raw)
In-Reply-To: <20260123082501.4050296-1-shengjiu.wang@nxp.com>
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.
There are three use cases:
1) SAI -> Codec (No AUDMIX between SAI and Codec)
2) SAI -> Codec (Has AUDMIX, but AUDMIX is bypassed)
3) SAI -> AUDMIX -> Codec (Has AUDMIX and used)
So add 'fsl,sai-amix-mode' property for this feature
fsl,sai-amix-mode = "none": is for case 1)
fsl,sai-amix-mode = "bypass": is for case 2)
fsl,sai-amix-mode = "audmix": is for case 3)
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
include/linux/firmware/imx/sm.h | 2 ++
sound/soc/fsl/fsl_sai.c | 21 +++++++++++++++++++++
sound/soc/fsl/fsl_sai.h | 4 ++++
3 files changed, 27 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..148e09e58dfa 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>
@@ -1425,10 +1426,12 @@ static int fsl_sai_probe(struct platform_device *pdev)
struct fsl_sai *sai;
struct regmap *gpr;
void __iomem *base;
+ const char *str = NULL;
char tmp[8];
int irq, ret, i;
int index;
u32 dmas[4];
+ u32 val;
sai = devm_kzalloc(dev, sizeof(*sai), GFP_KERNEL);
if (!sai)
@@ -1598,6 +1601,24 @@ static int fsl_sai_probe(struct platform_device *pdev)
if (ret < 0 && ret != -ENOSYS)
goto err_pm_get_sync;
+ if (of_device_is_compatible(np, "fsl,imx952-sai") &&
+ !of_property_read_string(np, "fsl,sai-amix-mode", &str)) {
+ if (!strcmp(str, "bypass"))
+ val = FSL_SAI_AMIX_BYPASS;
+ else if (!strcmp(str, "audmix"))
+ val = FSL_SAI_AMIX_AUDMIX;
+ else
+ val = FSL_SAI_AMIX_NONE;
+
+ if (val < FSL_SAI_AMIX_NONE) {
+ 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().
diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h
index 6c917f79c6b0..7605cbaca3d8 100644
--- a/sound/soc/fsl/fsl_sai.h
+++ b/sound/soc/fsl/fsl_sai.h
@@ -230,6 +230,10 @@
#define FSL_SAI_DL_I2S BIT(0)
#define FSL_SAI_DL_PDM BIT(1)
+#define FSL_SAI_AMIX_BYPASS 0
+#define FSL_SAI_AMIX_AUDMIX 1
+#define FSL_SAI_AMIX_NONE 2
+
struct fsl_sai_soc_data {
bool use_imx_pcm;
bool use_edma;
--
2.34.1
next prev parent reply other threads:[~2026-01-23 8:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-23 8:24 [PATCH v3 0/4] ASoC: fsl_audmix: Support the i.MX952 platform Shengjiu Wang
2026-01-23 8:24 ` [PATCH v3 1/4] ASoC: dt-bindings: fsl,audmix: Add support for " Shengjiu Wang
2026-01-23 8:24 ` [PATCH v3 2/4] ASoC: dt-bindings: fsl,sai: Add AUDMIX mode support on i.MX952 Shengjiu Wang
2026-01-23 8:25 ` [PATCH v3 3/4] ASoC: fsl_audmix: Add support for i.MX952 platform Shengjiu Wang
2026-01-23 8:25 ` Shengjiu Wang [this message]
2026-01-28 3:02 ` [PATCH v3 0/4] ASoC: fsl_audmix: Support the " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260123082501.4050296-5-shengjiu.wang@nxp.com \
--to=shengjiu.wang@nxp.com \
--cc=Xiubo.Lee@gmail.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=nicoleotsuka@gmail.com \
--cc=perex@perex.cz \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=shengjiu.wang@gmail.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox