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 <shengjiu.wang@nxp.com>
---
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
Hi Shengjiu,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Shengjiu-Wang/ASoC-dt-bindings-fsl-audmix-Add-support-for-i-MX952-platform/20260116-182050
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link: https://lore.kernel.org/r/20260116101648.377952-3-shengjiu.wang%40nxp.com
patch subject: [PATCH 2/2] ASoC: fsl_audmix: Add support for i.MX952 platform
config: s390-randconfig-r071-20260116 (https://download.01.org/0day-ci/archive/20260117/202601170203.upPyGvI2-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 8.5.0
smatch version: v0.5.0-8985-g2614ff1a
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202601170203.upPyGvI2-lkp@intel.com/
smatch warnings:
sound/soc/fsl/fsl_audmix.c:522 fsl_audmix_probe() warn: missing error code 'ret'
vim +/ret +522 sound/soc/fsl/fsl_audmix.c
be1df61cf06efb Viorel Suman 2019-01-22 465 static int fsl_audmix_probe(struct platform_device *pdev)
be1df61cf06efb Viorel Suman 2019-01-22 466 {
0c44e9e9e61cde Shengjiu Wang 2026-01-16 467 const struct fsl_audmix_soc_data *soc_data;
62be484f7ad844 Viorel Suman 2019-04-10 468 struct device *dev = &pdev->dev;
be1df61cf06efb Viorel Suman 2019-01-22 469 struct fsl_audmix *priv;
be1df61cf06efb Viorel Suman 2019-01-22 470 void __iomem *regs;
be1df61cf06efb Viorel Suman 2019-01-22 471 int ret;
f2a36a78423ee8 Viorel Suman 2019-04-10 472
62be484f7ad844 Viorel Suman 2019-04-10 473 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
be1df61cf06efb Viorel Suman 2019-01-22 474 if (!priv)
be1df61cf06efb Viorel Suman 2019-01-22 475 return -ENOMEM;
be1df61cf06efb Viorel Suman 2019-01-22 476
be1df61cf06efb Viorel Suman 2019-01-22 477 /* Get the addresses */
959bb6b54d7086 YueHaibing 2019-07-27 478 regs = devm_platform_ioremap_resource(pdev, 0);
be1df61cf06efb Viorel Suman 2019-01-22 479 if (IS_ERR(regs))
be1df61cf06efb Viorel Suman 2019-01-22 480 return PTR_ERR(regs);
be1df61cf06efb Viorel Suman 2019-01-22 481
3feaba79d8f701 Shengjiu Wang 2021-03-24 482 priv->regmap = devm_regmap_init_mmio(dev, regs, &fsl_audmix_regmap_config);
be1df61cf06efb Viorel Suman 2019-01-22 483 if (IS_ERR(priv->regmap)) {
62be484f7ad844 Viorel Suman 2019-04-10 484 dev_err(dev, "failed to init regmap\n");
be1df61cf06efb Viorel Suman 2019-01-22 485 return PTR_ERR(priv->regmap);
be1df61cf06efb Viorel Suman 2019-01-22 486 }
be1df61cf06efb Viorel Suman 2019-01-22 487
62be484f7ad844 Viorel Suman 2019-04-10 488 priv->ipg_clk = devm_clk_get(dev, "ipg");
be1df61cf06efb Viorel Suman 2019-01-22 489 if (IS_ERR(priv->ipg_clk)) {
62be484f7ad844 Viorel Suman 2019-04-10 490 dev_err(dev, "failed to get ipg clock\n");
be1df61cf06efb Viorel Suman 2019-01-22 491 return PTR_ERR(priv->ipg_clk);
be1df61cf06efb Viorel Suman 2019-01-22 492 }
be1df61cf06efb Viorel Suman 2019-01-22 493
fe965096c9495d Shengjiu Wang 2019-11-11 494 spin_lock_init(&priv->lock);
be1df61cf06efb Viorel Suman 2019-01-22 495 platform_set_drvdata(pdev, priv);
62be484f7ad844 Viorel Suman 2019-04-10 496 pm_runtime_enable(dev);
be1df61cf06efb Viorel Suman 2019-01-22 497
62be484f7ad844 Viorel Suman 2019-04-10 498 ret = devm_snd_soc_register_component(dev, &fsl_audmix_component,
be1df61cf06efb Viorel Suman 2019-01-22 499 fsl_audmix_dai,
be1df61cf06efb Viorel Suman 2019-01-22 500 ARRAY_SIZE(fsl_audmix_dai));
be1df61cf06efb Viorel Suman 2019-01-22 501 if (ret) {
62be484f7ad844 Viorel Suman 2019-04-10 502 dev_err(dev, "failed to register ASoC DAI\n");
77fffa742285f2 Chuhong Yuan 2019-12-03 503 goto err_disable_pm;
be1df61cf06efb Viorel Suman 2019-01-22 504 }
be1df61cf06efb Viorel Suman 2019-01-22 505
294a60e5e98300 Shengjiu Wang 2025-02-26 506 /*
294a60e5e98300 Shengjiu Wang 2025-02-26 507 * If dais property exist, then register the imx-audmix card driver.
294a60e5e98300 Shengjiu Wang 2025-02-26 508 * otherwise, it should be linked by audio graph card.
294a60e5e98300 Shengjiu Wang 2025-02-26 509 */
294a60e5e98300 Shengjiu Wang 2025-02-26 510 if (of_find_property(pdev->dev.of_node, "dais", NULL)) {
5057d108d69a55 Fabio Estevam 2020-12-02 511 priv->pdev = platform_device_register_data(dev, "imx-audmix", 0, NULL, 0);
be1df61cf06efb Viorel Suman 2019-01-22 512 if (IS_ERR(priv->pdev)) {
be1df61cf06efb Viorel Suman 2019-01-22 513 ret = PTR_ERR(priv->pdev);
5057d108d69a55 Fabio Estevam 2020-12-02 514 dev_err(dev, "failed to register platform: %d\n", ret);
77fffa742285f2 Chuhong Yuan 2019-12-03 515 goto err_disable_pm;
be1df61cf06efb Viorel Suman 2019-01-22 516 }
294a60e5e98300 Shengjiu Wang 2025-02-26 517 }
be1df61cf06efb Viorel Suman 2019-01-22 518
0c44e9e9e61cde Shengjiu Wang 2026-01-16 519 soc_data = of_device_get_match_data(dev);
0c44e9e9e61cde Shengjiu Wang 2026-01-16 520 if (!soc_data) {
0c44e9e9e61cde Shengjiu Wang 2026-01-16 521 dev_err(dev, "failed to match device\n");
0c44e9e9e61cde Shengjiu Wang 2026-01-16 @522 goto err_disable_pm;
missing error code.
0c44e9e9e61cde Shengjiu Wang 2026-01-16 523 }
0c44e9e9e61cde Shengjiu Wang 2026-01-16 524
0c44e9e9e61cde Shengjiu Wang 2026-01-16 525 if (of_property_read_bool(pdev->dev.of_node, "fsl,amix-bypass") &&
0c44e9e9e61cde Shengjiu Wang 2026-01-16 526 soc_data->bypass_index > 0) {
0c44e9e9e61cde Shengjiu Wang 2026-01-16 527 ret = scmi_imx_misc_ctrl_set(soc_data->bypass_index, 0);
0c44e9e9e61cde Shengjiu Wang 2026-01-16 528 if (ret)
0c44e9e9e61cde Shengjiu Wang 2026-01-16 529 goto err_disable_pm;
0c44e9e9e61cde Shengjiu Wang 2026-01-16 530 }
0c44e9e9e61cde Shengjiu Wang 2026-01-16 531
77fffa742285f2 Chuhong Yuan 2019-12-03 532 return 0;
77fffa742285f2 Chuhong Yuan 2019-12-03 533
77fffa742285f2 Chuhong Yuan 2019-12-03 534 err_disable_pm:
77fffa742285f2 Chuhong Yuan 2019-12-03 535 pm_runtime_disable(dev);
be1df61cf06efb Viorel Suman 2019-01-22 536 return ret;
be1df61cf06efb Viorel Suman 2019-01-22 537 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
© 2016 - 2026 Red Hat, Inc.