All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ASoC: fsl_sai: use local device pointer
@ 2022-06-01  9:23 Marco Felsch
  2022-06-01  9:23 ` [PATCH 2/3] ASoC: fsl_sai: convert to dev_err_probe Marco Felsch
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Marco Felsch @ 2022-06-01  9:23 UTC (permalink / raw)
  To: shengjiu.wang, Xiubo.Lee, festevam, nicoleotsuka, lgirdwood, broonie
  Cc: alsa-devel, linuxppc-dev, kernel

Use a local variable to dereference the device pointer once and use the
local variable in further calls. No functional changes.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 sound/soc/fsl/fsl_sai.c | 53 +++++++++++++++++++++--------------------
 1 file changed, 27 insertions(+), 26 deletions(-)

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index fa950dde5310..a7637d602f3c 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -1004,6 +1004,7 @@ static int fsl_sai_runtime_resume(struct device *dev);
 static int fsl_sai_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
+	struct device *dev = &pdev->dev;
 	struct fsl_sai *sai;
 	struct regmap *gpr;
 	struct resource *res;
@@ -1012,12 +1013,12 @@ static int fsl_sai_probe(struct platform_device *pdev)
 	int irq, ret, i;
 	int index;
 
-	sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL);
+	sai = devm_kzalloc(dev, sizeof(*sai), GFP_KERNEL);
 	if (!sai)
 		return -ENOMEM;
 
 	sai->pdev = pdev;
-	sai->soc_data = of_device_get_match_data(&pdev->dev);
+	sai->soc_data = of_device_get_match_data(dev);
 
 	sai->is_lsb_first = of_property_read_bool(np, "lsb-first");
 
@@ -1032,18 +1033,18 @@ static int fsl_sai_probe(struct platform_device *pdev)
 			ARRAY_SIZE(fsl_sai_reg_defaults_ofs8);
 	}
 
-	sai->regmap = devm_regmap_init_mmio(&pdev->dev, base, &fsl_sai_regmap_config);
+	sai->regmap = devm_regmap_init_mmio(dev, base, &fsl_sai_regmap_config);
 	if (IS_ERR(sai->regmap)) {
-		dev_err(&pdev->dev, "regmap init failed\n");
+		dev_err(dev, "regmap init failed\n");
 		return PTR_ERR(sai->regmap);
 	}
 
-	sai->bus_clk = devm_clk_get(&pdev->dev, "bus");
+	sai->bus_clk = devm_clk_get(dev, "bus");
 	/* Compatible with old DTB cases */
 	if (IS_ERR(sai->bus_clk) && PTR_ERR(sai->bus_clk) != -EPROBE_DEFER)
-		sai->bus_clk = devm_clk_get(&pdev->dev, "sai");
+		sai->bus_clk = devm_clk_get(dev, "sai");
 	if (IS_ERR(sai->bus_clk)) {
-		dev_err(&pdev->dev, "failed to get bus clock: %ld\n",
+		dev_err(dev, "failed to get bus clock: %ld\n",
 				PTR_ERR(sai->bus_clk));
 		/* -EPROBE_DEFER */
 		return PTR_ERR(sai->bus_clk);
@@ -1051,9 +1052,9 @@ static int fsl_sai_probe(struct platform_device *pdev)
 
 	for (i = 1; i < FSL_SAI_MCLK_MAX; i++) {
 		sprintf(tmp, "mclk%d", i);
-		sai->mclk_clk[i] = devm_clk_get(&pdev->dev, tmp);
+		sai->mclk_clk[i] = devm_clk_get(dev, tmp);
 		if (IS_ERR(sai->mclk_clk[i])) {
-			dev_err(&pdev->dev, "failed to get mclk%d clock: %ld\n",
+			dev_err(dev, "failed to get mclk%d clock: %ld\n",
 					i + 1, PTR_ERR(sai->mclk_clk[i]));
 			sai->mclk_clk[i] = NULL;
 		}
@@ -1068,10 +1069,10 @@ static int fsl_sai_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
-	ret = devm_request_irq(&pdev->dev, irq, fsl_sai_isr, IRQF_SHARED,
+	ret = devm_request_irq(dev, irq, fsl_sai_isr, IRQF_SHARED,
 			       np->name, sai);
 	if (ret) {
-		dev_err(&pdev->dev, "failed to claim irq %u\n", irq);
+		dev_err(dev, "failed to claim irq %u\n", irq);
 		return ret;
 	}
 
@@ -1088,7 +1089,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
 	if (of_find_property(np, "fsl,sai-synchronous-rx", NULL) &&
 	    of_find_property(np, "fsl,sai-asynchronous", NULL)) {
 		/* error out if both synchronous and asynchronous are present */
-		dev_err(&pdev->dev, "invalid binding for synchronous mode\n");
+		dev_err(dev, "invalid binding for synchronous mode\n");
 		return -EINVAL;
 	}
 
@@ -1109,7 +1110,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
 	    of_device_is_compatible(np, "fsl,imx6ul-sai")) {
 		gpr = syscon_regmap_lookup_by_compatible("fsl,imx6ul-iomuxc-gpr");
 		if (IS_ERR(gpr)) {
-			dev_err(&pdev->dev, "cannot find iomuxc registers\n");
+			dev_err(dev, "cannot find iomuxc registers\n");
 			return PTR_ERR(gpr);
 		}
 
@@ -1127,23 +1128,23 @@ static int fsl_sai_probe(struct platform_device *pdev)
 	sai->dma_params_tx.maxburst = FSL_SAI_MAXBURST_TX;
 
 	platform_set_drvdata(pdev, sai);
-	pm_runtime_enable(&pdev->dev);
-	if (!pm_runtime_enabled(&pdev->dev)) {
-		ret = fsl_sai_runtime_resume(&pdev->dev);
+	pm_runtime_enable(dev);
+	if (!pm_runtime_enabled(dev)) {
+		ret = fsl_sai_runtime_resume(dev);
 		if (ret)
 			goto err_pm_disable;
 	}
 
-	ret = pm_runtime_get_sync(&pdev->dev);
+	ret = pm_runtime_get_sync(dev);
 	if (ret < 0) {
-		pm_runtime_put_noidle(&pdev->dev);
+		pm_runtime_put_noidle(dev);
 		goto err_pm_get_sync;
 	}
 
 	/* Get sai version */
-	ret = fsl_sai_check_version(&pdev->dev);
+	ret = fsl_sai_check_version(dev);
 	if (ret < 0)
-		dev_warn(&pdev->dev, "Error reading SAI version: %d\n", ret);
+		dev_warn(dev, "Error reading SAI version: %d\n", ret);
 
 	/* Select MCLK direction */
 	if (of_find_property(np, "fsl,sai-mclk-direction-output", NULL) &&
@@ -1152,7 +1153,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
 				   FSL_SAI_MCTL_MCLK_EN, FSL_SAI_MCTL_MCLK_EN);
 	}
 
-	ret = pm_runtime_put_sync(&pdev->dev);
+	ret = pm_runtime_put_sync(dev);
 	if (ret < 0)
 		goto err_pm_get_sync;
 
@@ -1165,12 +1166,12 @@ static int fsl_sai_probe(struct platform_device *pdev)
 		if (ret)
 			goto err_pm_get_sync;
 	} else {
-		ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
+		ret = devm_snd_dmaengine_pcm_register(dev, NULL, 0);
 		if (ret)
 			goto err_pm_get_sync;
 	}
 
-	ret = devm_snd_soc_register_component(&pdev->dev, &fsl_component,
+	ret = devm_snd_soc_register_component(dev, &fsl_component,
 					      &sai->cpu_dai_drv, 1);
 	if (ret)
 		goto err_pm_get_sync;
@@ -1178,10 +1179,10 @@ static int fsl_sai_probe(struct platform_device *pdev)
 	return ret;
 
 err_pm_get_sync:
-	if (!pm_runtime_status_suspended(&pdev->dev))
-		fsl_sai_runtime_suspend(&pdev->dev);
+	if (!pm_runtime_status_suspended(dev))
+		fsl_sai_runtime_suspend(dev);
 err_pm_disable:
-	pm_runtime_disable(&pdev->dev);
+	pm_runtime_disable(dev);
 
 	return ret;
 }
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] ASoC: fsl_sai: convert to dev_err_probe
  2022-06-01  9:23 [PATCH 1/3] ASoC: fsl_sai: use local device pointer Marco Felsch
@ 2022-06-01  9:23 ` Marco Felsch
  2022-06-06  2:48     ` Shengjiu Wang
  2022-06-01  9:23 ` [PATCH 3/3] ASoC: fsl_sai: add error message in case of missing imx-pcm-dma support Marco Felsch
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Marco Felsch @ 2022-06-01  9:23 UTC (permalink / raw)
  To: shengjiu.wang, Xiubo.Lee, festevam, nicoleotsuka, lgirdwood, broonie
  Cc: alsa-devel, linuxppc-dev, kernel

Make use of the new macro to get device defered information for free
and to cleanup the code a bit. No functional changes.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 sound/soc/fsl/fsl_sai.c | 33 +++++++++++----------------------
 1 file changed, 11 insertions(+), 22 deletions(-)

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index a7637d602f3c..3e54f1f71c1e 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -1034,21 +1034,15 @@ static int fsl_sai_probe(struct platform_device *pdev)
 	}
 
 	sai->regmap = devm_regmap_init_mmio(dev, base, &fsl_sai_regmap_config);
-	if (IS_ERR(sai->regmap)) {
-		dev_err(dev, "regmap init failed\n");
-		return PTR_ERR(sai->regmap);
-	}
+	if (IS_ERR(sai->regmap))
+		return dev_err_probe(dev, PTR_ERR(sai->regmap), "regmap init failed\n");
 
 	sai->bus_clk = devm_clk_get(dev, "bus");
 	/* Compatible with old DTB cases */
 	if (IS_ERR(sai->bus_clk) && PTR_ERR(sai->bus_clk) != -EPROBE_DEFER)
 		sai->bus_clk = devm_clk_get(dev, "sai");
-	if (IS_ERR(sai->bus_clk)) {
-		dev_err(dev, "failed to get bus clock: %ld\n",
-				PTR_ERR(sai->bus_clk));
-		/* -EPROBE_DEFER */
-		return PTR_ERR(sai->bus_clk);
-	}
+	if (IS_ERR(sai->bus_clk))
+		return dev_err_probe(dev, PTR_ERR(sai->bus_clk), "failed to get bus clock\n");
 
 	for (i = 1; i < FSL_SAI_MCLK_MAX; i++) {
 		sprintf(tmp, "mclk%d", i);
@@ -1067,14 +1061,12 @@ static int fsl_sai_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-		return irq;
+		return dev_err_probe(dev, irq, "failed to get the irq\n");
 
 	ret = devm_request_irq(dev, irq, fsl_sai_isr, IRQF_SHARED,
 			       np->name, sai);
-	if (ret) {
-		dev_err(dev, "failed to claim irq %u\n", irq);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to claim irq %u\n", irq);
 
 	memcpy(&sai->cpu_dai_drv, &fsl_sai_dai_template,
 	       sizeof(fsl_sai_dai_template));
@@ -1089,8 +1081,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
 	if (of_find_property(np, "fsl,sai-synchronous-rx", NULL) &&
 	    of_find_property(np, "fsl,sai-asynchronous", NULL)) {
 		/* error out if both synchronous and asynchronous are present */
-		dev_err(dev, "invalid binding for synchronous mode\n");
-		return -EINVAL;
+		return dev_err_probe(dev, -EINVAL, "invalid binding for synchronous mode\n");
 	}
 
 	if (of_find_property(np, "fsl,sai-synchronous-rx", NULL)) {
@@ -1109,14 +1100,12 @@ static int fsl_sai_probe(struct platform_device *pdev)
 	if (of_find_property(np, "fsl,sai-mclk-direction-output", NULL) &&
 	    of_device_is_compatible(np, "fsl,imx6ul-sai")) {
 		gpr = syscon_regmap_lookup_by_compatible("fsl,imx6ul-iomuxc-gpr");
-		if (IS_ERR(gpr)) {
-			dev_err(dev, "cannot find iomuxc registers\n");
-			return PTR_ERR(gpr);
-		}
+		if (IS_ERR(gpr))
+			return dev_err_probe(dev, PTR_ERR(gpr), "cannot find iomuxc registers\n");
 
 		index = of_alias_get_id(np, "sai");
 		if (index < 0)
-			return index;
+			return dev_err_probe(dev, index, "cannot find sai aliases\n");
 
 		regmap_update_bits(gpr, IOMUXC_GPR1, MCLK_DIR(index),
 				   MCLK_DIR(index));
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] ASoC: fsl_sai: add error message in case of missing imx-pcm-dma support
  2022-06-01  9:23 [PATCH 1/3] ASoC: fsl_sai: use local device pointer Marco Felsch
  2022-06-01  9:23 ` [PATCH 2/3] ASoC: fsl_sai: convert to dev_err_probe Marco Felsch
@ 2022-06-01  9:23 ` Marco Felsch
  2022-06-06  3:20     ` Shengjiu Wang
  2022-06-06  3:18   ` Shengjiu Wang
  2022-06-07 10:46 ` (subset) " Mark Brown
  3 siblings, 1 reply; 10+ messages in thread
From: Marco Felsch @ 2022-06-01  9:23 UTC (permalink / raw)
  To: shengjiu.wang, Xiubo.Lee, festevam, nicoleotsuka, lgirdwood, broonie
  Cc: alsa-devel, linuxppc-dev, kernel

If the imx-pcm-dma is required we need to have the module enabled. For
all NXP/FSL sound cards using the ASoC architecture this is the case but
in case of using the simple-audio-card sound card this isn't the case.

In such case the driver probe fails silently and the card isn't
available. It took a while to find the missing Kconfig. Make this easier
for others by printing a error if this the module isn't available but
required by the HW.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 sound/soc/fsl/fsl_sai.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index 3e54f1f71c1e..2371da814b09 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -1152,8 +1152,11 @@ static int fsl_sai_probe(struct platform_device *pdev)
 	 */
 	if (sai->soc_data->use_imx_pcm) {
 		ret = imx_pcm_dma_init(pdev);
-		if (ret)
+		if (ret) {
+			if (!IS_ENABLED(CONFIG_SND_SOC_IMX_PCM_DMA))
+				dev_err(dev, "Error: You must enable the imx-pcm-dma support!\n");
 			goto err_pm_get_sync;
+		}
 	} else {
 		ret = devm_snd_dmaengine_pcm_register(dev, NULL, 0);
 		if (ret)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] ASoC: fsl_sai: convert to dev_err_probe
  2022-06-01  9:23 ` [PATCH 2/3] ASoC: fsl_sai: convert to dev_err_probe Marco Felsch
@ 2022-06-06  2:48     ` Shengjiu Wang
  0 siblings, 0 replies; 10+ messages in thread
From: Shengjiu Wang @ 2022-06-06  2:48 UTC (permalink / raw)
  To: Marco Felsch
  Cc: alsa-devel, Xiubo Li, linuxppc-dev, Liam Girdwood, Nicolin Chen,
	Mark Brown, Sascha Hauer, Fabio Estevam

On Wed, Jun 1, 2022 at 5:23 PM Marco Felsch <m.felsch@pengutronix.de> wrote:

> Make use of the new macro to get device defered information for free
> and to cleanup the code a bit. No functional changes.
>
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>  sound/soc/fsl/fsl_sai.c | 33 +++++++++++----------------------
>  1 file changed, 11 insertions(+), 22 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
> index a7637d602f3c..3e54f1f71c1e 100644
> --- a/sound/soc/fsl/fsl_sai.c
> +++ b/sound/soc/fsl/fsl_sai.c
> @@ -1034,21 +1034,15 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>         }
>
>         sai->regmap = devm_regmap_init_mmio(dev, base,
> &fsl_sai_regmap_config);
> -       if (IS_ERR(sai->regmap)) {
> -               dev_err(dev, "regmap init failed\n");
> -               return PTR_ERR(sai->regmap);
> -       }
> +       if (IS_ERR(sai->regmap))
> +               return dev_err_probe(dev, PTR_ERR(sai->regmap), "regmap
> init failed\n");
>
>         sai->bus_clk = devm_clk_get(dev, "bus");
>         /* Compatible with old DTB cases */
>         if (IS_ERR(sai->bus_clk) && PTR_ERR(sai->bus_clk) != -EPROBE_DEFER)
>                 sai->bus_clk = devm_clk_get(dev, "sai");
> -       if (IS_ERR(sai->bus_clk)) {
> -               dev_err(dev, "failed to get bus clock: %ld\n",
> -                               PTR_ERR(sai->bus_clk));
> -               /* -EPROBE_DEFER */
> -               return PTR_ERR(sai->bus_clk);
> -       }
> +       if (IS_ERR(sai->bus_clk))
> +               return dev_err_probe(dev, PTR_ERR(sai->bus_clk), "failed
> to get bus clock\n");
>
>         for (i = 1; i < FSL_SAI_MCLK_MAX; i++) {
>                 sprintf(tmp, "mclk%d", i);
> @@ -1067,14 +1061,12 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>
>         irq = platform_get_irq(pdev, 0);
>         if (irq < 0)
> -               return irq;
> +               return dev_err_probe(dev, irq, "failed to get the irq\n");
>

This change is not needed,  platform_get_irq() has done the same operation.

best regards
wang shengjiu

>
>         ret = devm_request_irq(dev, irq, fsl_sai_isr, IRQF_SHARED,
>                                np->name, sai);
> -       if (ret) {
> -               dev_err(dev, "failed to claim irq %u\n", irq);
> -               return ret;
> -       }
> +       if (ret)
> +               return dev_err_probe(dev, ret, "failed to claim irq %u\n",
> irq);
>
>         memcpy(&sai->cpu_dai_drv, &fsl_sai_dai_template,
>                sizeof(fsl_sai_dai_template));
> @@ -1089,8 +1081,7 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>         if (of_find_property(np, "fsl,sai-synchronous-rx", NULL) &&
>             of_find_property(np, "fsl,sai-asynchronous", NULL)) {
>                 /* error out if both synchronous and asynchronous are
> present */
> -               dev_err(dev, "invalid binding for synchronous mode\n");
> -               return -EINVAL;
> +               return dev_err_probe(dev, -EINVAL, "invalid binding for
> synchronous mode\n");
>         }
>
>         if (of_find_property(np, "fsl,sai-synchronous-rx", NULL)) {
> @@ -1109,14 +1100,12 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>         if (of_find_property(np, "fsl,sai-mclk-direction-output", NULL) &&
>             of_device_is_compatible(np, "fsl,imx6ul-sai")) {
>                 gpr =
> syscon_regmap_lookup_by_compatible("fsl,imx6ul-iomuxc-gpr");
> -               if (IS_ERR(gpr)) {
> -                       dev_err(dev, "cannot find iomuxc registers\n");
> -                       return PTR_ERR(gpr);
> -               }
> +               if (IS_ERR(gpr))
> +                       return dev_err_probe(dev, PTR_ERR(gpr), "cannot
> find iomuxc registers\n");
>
>                 index = of_alias_get_id(np, "sai");
>                 if (index < 0)
> -                       return index;
> +                       return dev_err_probe(dev, index, "cannot find sai
> aliases\n");
>
>                 regmap_update_bits(gpr, IOMUXC_GPR1, MCLK_DIR(index),
>                                    MCLK_DIR(index));
> --
> 2.30.2
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] ASoC: fsl_sai: convert to dev_err_probe
@ 2022-06-06  2:48     ` Shengjiu Wang
  0 siblings, 0 replies; 10+ messages in thread
From: Shengjiu Wang @ 2022-06-06  2:48 UTC (permalink / raw)
  To: Marco Felsch
  Cc: alsa-devel, Xiubo Li, linuxppc-dev, Liam Girdwood, Nicolin Chen,
	Mark Brown, Sascha Hauer, Fabio Estevam

[-- Attachment #1: Type: text/plain, Size: 4164 bytes --]

On Wed, Jun 1, 2022 at 5:23 PM Marco Felsch <m.felsch@pengutronix.de> wrote:

> Make use of the new macro to get device defered information for free
> and to cleanup the code a bit. No functional changes.
>
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>  sound/soc/fsl/fsl_sai.c | 33 +++++++++++----------------------
>  1 file changed, 11 insertions(+), 22 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
> index a7637d602f3c..3e54f1f71c1e 100644
> --- a/sound/soc/fsl/fsl_sai.c
> +++ b/sound/soc/fsl/fsl_sai.c
> @@ -1034,21 +1034,15 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>         }
>
>         sai->regmap = devm_regmap_init_mmio(dev, base,
> &fsl_sai_regmap_config);
> -       if (IS_ERR(sai->regmap)) {
> -               dev_err(dev, "regmap init failed\n");
> -               return PTR_ERR(sai->regmap);
> -       }
> +       if (IS_ERR(sai->regmap))
> +               return dev_err_probe(dev, PTR_ERR(sai->regmap), "regmap
> init failed\n");
>
>         sai->bus_clk = devm_clk_get(dev, "bus");
>         /* Compatible with old DTB cases */
>         if (IS_ERR(sai->bus_clk) && PTR_ERR(sai->bus_clk) != -EPROBE_DEFER)
>                 sai->bus_clk = devm_clk_get(dev, "sai");
> -       if (IS_ERR(sai->bus_clk)) {
> -               dev_err(dev, "failed to get bus clock: %ld\n",
> -                               PTR_ERR(sai->bus_clk));
> -               /* -EPROBE_DEFER */
> -               return PTR_ERR(sai->bus_clk);
> -       }
> +       if (IS_ERR(sai->bus_clk))
> +               return dev_err_probe(dev, PTR_ERR(sai->bus_clk), "failed
> to get bus clock\n");
>
>         for (i = 1; i < FSL_SAI_MCLK_MAX; i++) {
>                 sprintf(tmp, "mclk%d", i);
> @@ -1067,14 +1061,12 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>
>         irq = platform_get_irq(pdev, 0);
>         if (irq < 0)
> -               return irq;
> +               return dev_err_probe(dev, irq, "failed to get the irq\n");
>

This change is not needed,  platform_get_irq() has done the same operation.

best regards
wang shengjiu

>
>         ret = devm_request_irq(dev, irq, fsl_sai_isr, IRQF_SHARED,
>                                np->name, sai);
> -       if (ret) {
> -               dev_err(dev, "failed to claim irq %u\n", irq);
> -               return ret;
> -       }
> +       if (ret)
> +               return dev_err_probe(dev, ret, "failed to claim irq %u\n",
> irq);
>
>         memcpy(&sai->cpu_dai_drv, &fsl_sai_dai_template,
>                sizeof(fsl_sai_dai_template));
> @@ -1089,8 +1081,7 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>         if (of_find_property(np, "fsl,sai-synchronous-rx", NULL) &&
>             of_find_property(np, "fsl,sai-asynchronous", NULL)) {
>                 /* error out if both synchronous and asynchronous are
> present */
> -               dev_err(dev, "invalid binding for synchronous mode\n");
> -               return -EINVAL;
> +               return dev_err_probe(dev, -EINVAL, "invalid binding for
> synchronous mode\n");
>         }
>
>         if (of_find_property(np, "fsl,sai-synchronous-rx", NULL)) {
> @@ -1109,14 +1100,12 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>         if (of_find_property(np, "fsl,sai-mclk-direction-output", NULL) &&
>             of_device_is_compatible(np, "fsl,imx6ul-sai")) {
>                 gpr =
> syscon_regmap_lookup_by_compatible("fsl,imx6ul-iomuxc-gpr");
> -               if (IS_ERR(gpr)) {
> -                       dev_err(dev, "cannot find iomuxc registers\n");
> -                       return PTR_ERR(gpr);
> -               }
> +               if (IS_ERR(gpr))
> +                       return dev_err_probe(dev, PTR_ERR(gpr), "cannot
> find iomuxc registers\n");
>
>                 index = of_alias_get_id(np, "sai");
>                 if (index < 0)
> -                       return index;
> +                       return dev_err_probe(dev, index, "cannot find sai
> aliases\n");
>
>                 regmap_update_bits(gpr, IOMUXC_GPR1, MCLK_DIR(index),
>                                    MCLK_DIR(index));
> --
> 2.30.2
>
>

[-- Attachment #2: Type: text/html, Size: 5714 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] ASoC: fsl_sai: use local device pointer
  2022-06-01  9:23 [PATCH 1/3] ASoC: fsl_sai: use local device pointer Marco Felsch
@ 2022-06-06  3:18   ` Shengjiu Wang
  2022-06-01  9:23 ` [PATCH 3/3] ASoC: fsl_sai: add error message in case of missing imx-pcm-dma support Marco Felsch
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Shengjiu Wang @ 2022-06-06  3:18 UTC (permalink / raw)
  To: Marco Felsch
  Cc: alsa-devel, Xiubo Li, linuxppc-dev, Liam Girdwood, Nicolin Chen,
	Mark Brown, Sascha Hauer, Fabio Estevam

On Wed, Jun 1, 2022 at 5:23 PM Marco Felsch <m.felsch@pengutronix.de> wrote:

> Use a local variable to dereference the device pointer once and use the
> local variable in further calls. No functional changes.
>
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
>

Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>

Best regards
Wang shengjiu

> ---
>  sound/soc/fsl/fsl_sai.c | 53 +++++++++++++++++++++--------------------
>  1 file changed, 27 insertions(+), 26 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
> index fa950dde5310..a7637d602f3c 100644
> --- a/sound/soc/fsl/fsl_sai.c
> +++ b/sound/soc/fsl/fsl_sai.c
> @@ -1004,6 +1004,7 @@ static int fsl_sai_runtime_resume(struct device
> *dev);
>  static int fsl_sai_probe(struct platform_device *pdev)
>  {
>         struct device_node *np = pdev->dev.of_node;
> +       struct device *dev = &pdev->dev;
>         struct fsl_sai *sai;
>         struct regmap *gpr;
>         struct resource *res;
> @@ -1012,12 +1013,12 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>         int irq, ret, i;
>         int index;
>
> -       sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL);
> +       sai = devm_kzalloc(dev, sizeof(*sai), GFP_KERNEL);
>         if (!sai)
>                 return -ENOMEM;
>
>         sai->pdev = pdev;
> -       sai->soc_data = of_device_get_match_data(&pdev->dev);
> +       sai->soc_data = of_device_get_match_data(dev);
>
>         sai->is_lsb_first = of_property_read_bool(np, "lsb-first");
>
> @@ -1032,18 +1033,18 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>                         ARRAY_SIZE(fsl_sai_reg_defaults_ofs8);
>         }
>
> -       sai->regmap = devm_regmap_init_mmio(&pdev->dev, base,
> &fsl_sai_regmap_config);
> +       sai->regmap = devm_regmap_init_mmio(dev, base,
> &fsl_sai_regmap_config);
>         if (IS_ERR(sai->regmap)) {
> -               dev_err(&pdev->dev, "regmap init failed\n");
> +               dev_err(dev, "regmap init failed\n");
>                 return PTR_ERR(sai->regmap);
>         }
>
> -       sai->bus_clk = devm_clk_get(&pdev->dev, "bus");
> +       sai->bus_clk = devm_clk_get(dev, "bus");
>         /* Compatible with old DTB cases */
>         if (IS_ERR(sai->bus_clk) && PTR_ERR(sai->bus_clk) != -EPROBE_DEFER)
> -               sai->bus_clk = devm_clk_get(&pdev->dev, "sai");
> +               sai->bus_clk = devm_clk_get(dev, "sai");
>         if (IS_ERR(sai->bus_clk)) {
> -               dev_err(&pdev->dev, "failed to get bus clock: %ld\n",
> +               dev_err(dev, "failed to get bus clock: %ld\n",
>                                 PTR_ERR(sai->bus_clk));
>                 /* -EPROBE_DEFER */
>                 return PTR_ERR(sai->bus_clk);
> @@ -1051,9 +1052,9 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>
>         for (i = 1; i < FSL_SAI_MCLK_MAX; i++) {
>                 sprintf(tmp, "mclk%d", i);
> -               sai->mclk_clk[i] = devm_clk_get(&pdev->dev, tmp);
> +               sai->mclk_clk[i] = devm_clk_get(dev, tmp);
>                 if (IS_ERR(sai->mclk_clk[i])) {
> -                       dev_err(&pdev->dev, "failed to get mclk%d clock:
> %ld\n",
> +                       dev_err(dev, "failed to get mclk%d clock: %ld\n",
>                                         i + 1, PTR_ERR(sai->mclk_clk[i]));
>                         sai->mclk_clk[i] = NULL;
>                 }
> @@ -1068,10 +1069,10 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>         if (irq < 0)
>                 return irq;
>
> -       ret = devm_request_irq(&pdev->dev, irq, fsl_sai_isr, IRQF_SHARED,
> +       ret = devm_request_irq(dev, irq, fsl_sai_isr, IRQF_SHARED,
>                                np->name, sai);
>         if (ret) {
> -               dev_err(&pdev->dev, "failed to claim irq %u\n", irq);
> +               dev_err(dev, "failed to claim irq %u\n", irq);
>                 return ret;
>         }
>
> @@ -1088,7 +1089,7 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>         if (of_find_property(np, "fsl,sai-synchronous-rx", NULL) &&
>             of_find_property(np, "fsl,sai-asynchronous", NULL)) {
>                 /* error out if both synchronous and asynchronous are
> present */
> -               dev_err(&pdev->dev, "invalid binding for synchronous
> mode\n");
> +               dev_err(dev, "invalid binding for synchronous mode\n");
>                 return -EINVAL;
>         }
>
> @@ -1109,7 +1110,7 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>             of_device_is_compatible(np, "fsl,imx6ul-sai")) {
>                 gpr =
> syscon_regmap_lookup_by_compatible("fsl,imx6ul-iomuxc-gpr");
>                 if (IS_ERR(gpr)) {
> -                       dev_err(&pdev->dev, "cannot find iomuxc
> registers\n");
> +                       dev_err(dev, "cannot find iomuxc registers\n");
>                         return PTR_ERR(gpr);
>                 }
>
> @@ -1127,23 +1128,23 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>         sai->dma_params_tx.maxburst = FSL_SAI_MAXBURST_TX;
>
>         platform_set_drvdata(pdev, sai);
> -       pm_runtime_enable(&pdev->dev);
> -       if (!pm_runtime_enabled(&pdev->dev)) {
> -               ret = fsl_sai_runtime_resume(&pdev->dev);
> +       pm_runtime_enable(dev);
> +       if (!pm_runtime_enabled(dev)) {
> +               ret = fsl_sai_runtime_resume(dev);
>                 if (ret)
>                         goto err_pm_disable;
>         }
>
> -       ret = pm_runtime_get_sync(&pdev->dev);
> +       ret = pm_runtime_get_sync(dev);
>         if (ret < 0) {
> -               pm_runtime_put_noidle(&pdev->dev);
> +               pm_runtime_put_noidle(dev);
>                 goto err_pm_get_sync;
>         }
>
>         /* Get sai version */
> -       ret = fsl_sai_check_version(&pdev->dev);
> +       ret = fsl_sai_check_version(dev);
>         if (ret < 0)
> -               dev_warn(&pdev->dev, "Error reading SAI version: %d\n",
> ret);
> +               dev_warn(dev, "Error reading SAI version: %d\n", ret);
>
>         /* Select MCLK direction */
>         if (of_find_property(np, "fsl,sai-mclk-direction-output", NULL) &&
> @@ -1152,7 +1153,7 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>                                    FSL_SAI_MCTL_MCLK_EN,
> FSL_SAI_MCTL_MCLK_EN);
>         }
>
> -       ret = pm_runtime_put_sync(&pdev->dev);
> +       ret = pm_runtime_put_sync(dev);
>         if (ret < 0)
>                 goto err_pm_get_sync;
>
> @@ -1165,12 +1166,12 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>                 if (ret)
>                         goto err_pm_get_sync;
>         } else {
> -               ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
> +               ret = devm_snd_dmaengine_pcm_register(dev, NULL, 0);
>                 if (ret)
>                         goto err_pm_get_sync;
>         }
>
> -       ret = devm_snd_soc_register_component(&pdev->dev, &fsl_component,
> +       ret = devm_snd_soc_register_component(dev, &fsl_component,
>                                               &sai->cpu_dai_drv, 1);
>         if (ret)
>                 goto err_pm_get_sync;
> @@ -1178,10 +1179,10 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>         return ret;
>
>  err_pm_get_sync:
> -       if (!pm_runtime_status_suspended(&pdev->dev))
> -               fsl_sai_runtime_suspend(&pdev->dev);
> +       if (!pm_runtime_status_suspended(dev))
> +               fsl_sai_runtime_suspend(dev);
>  err_pm_disable:
> -       pm_runtime_disable(&pdev->dev);
> +       pm_runtime_disable(dev);
>
>         return ret;
>  }
> --
> 2.30.2
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] ASoC: fsl_sai: use local device pointer
@ 2022-06-06  3:18   ` Shengjiu Wang
  0 siblings, 0 replies; 10+ messages in thread
From: Shengjiu Wang @ 2022-06-06  3:18 UTC (permalink / raw)
  To: Marco Felsch
  Cc: alsa-devel, Xiubo Li, linuxppc-dev, Liam Girdwood, Nicolin Chen,
	Mark Brown, Sascha Hauer, Fabio Estevam

[-- Attachment #1: Type: text/plain, Size: 7716 bytes --]

On Wed, Jun 1, 2022 at 5:23 PM Marco Felsch <m.felsch@pengutronix.de> wrote:

> Use a local variable to dereference the device pointer once and use the
> local variable in further calls. No functional changes.
>
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
>

Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>

Best regards
Wang shengjiu

> ---
>  sound/soc/fsl/fsl_sai.c | 53 +++++++++++++++++++++--------------------
>  1 file changed, 27 insertions(+), 26 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
> index fa950dde5310..a7637d602f3c 100644
> --- a/sound/soc/fsl/fsl_sai.c
> +++ b/sound/soc/fsl/fsl_sai.c
> @@ -1004,6 +1004,7 @@ static int fsl_sai_runtime_resume(struct device
> *dev);
>  static int fsl_sai_probe(struct platform_device *pdev)
>  {
>         struct device_node *np = pdev->dev.of_node;
> +       struct device *dev = &pdev->dev;
>         struct fsl_sai *sai;
>         struct regmap *gpr;
>         struct resource *res;
> @@ -1012,12 +1013,12 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>         int irq, ret, i;
>         int index;
>
> -       sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL);
> +       sai = devm_kzalloc(dev, sizeof(*sai), GFP_KERNEL);
>         if (!sai)
>                 return -ENOMEM;
>
>         sai->pdev = pdev;
> -       sai->soc_data = of_device_get_match_data(&pdev->dev);
> +       sai->soc_data = of_device_get_match_data(dev);
>
>         sai->is_lsb_first = of_property_read_bool(np, "lsb-first");
>
> @@ -1032,18 +1033,18 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>                         ARRAY_SIZE(fsl_sai_reg_defaults_ofs8);
>         }
>
> -       sai->regmap = devm_regmap_init_mmio(&pdev->dev, base,
> &fsl_sai_regmap_config);
> +       sai->regmap = devm_regmap_init_mmio(dev, base,
> &fsl_sai_regmap_config);
>         if (IS_ERR(sai->regmap)) {
> -               dev_err(&pdev->dev, "regmap init failed\n");
> +               dev_err(dev, "regmap init failed\n");
>                 return PTR_ERR(sai->regmap);
>         }
>
> -       sai->bus_clk = devm_clk_get(&pdev->dev, "bus");
> +       sai->bus_clk = devm_clk_get(dev, "bus");
>         /* Compatible with old DTB cases */
>         if (IS_ERR(sai->bus_clk) && PTR_ERR(sai->bus_clk) != -EPROBE_DEFER)
> -               sai->bus_clk = devm_clk_get(&pdev->dev, "sai");
> +               sai->bus_clk = devm_clk_get(dev, "sai");
>         if (IS_ERR(sai->bus_clk)) {
> -               dev_err(&pdev->dev, "failed to get bus clock: %ld\n",
> +               dev_err(dev, "failed to get bus clock: %ld\n",
>                                 PTR_ERR(sai->bus_clk));
>                 /* -EPROBE_DEFER */
>                 return PTR_ERR(sai->bus_clk);
> @@ -1051,9 +1052,9 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>
>         for (i = 1; i < FSL_SAI_MCLK_MAX; i++) {
>                 sprintf(tmp, "mclk%d", i);
> -               sai->mclk_clk[i] = devm_clk_get(&pdev->dev, tmp);
> +               sai->mclk_clk[i] = devm_clk_get(dev, tmp);
>                 if (IS_ERR(sai->mclk_clk[i])) {
> -                       dev_err(&pdev->dev, "failed to get mclk%d clock:
> %ld\n",
> +                       dev_err(dev, "failed to get mclk%d clock: %ld\n",
>                                         i + 1, PTR_ERR(sai->mclk_clk[i]));
>                         sai->mclk_clk[i] = NULL;
>                 }
> @@ -1068,10 +1069,10 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>         if (irq < 0)
>                 return irq;
>
> -       ret = devm_request_irq(&pdev->dev, irq, fsl_sai_isr, IRQF_SHARED,
> +       ret = devm_request_irq(dev, irq, fsl_sai_isr, IRQF_SHARED,
>                                np->name, sai);
>         if (ret) {
> -               dev_err(&pdev->dev, "failed to claim irq %u\n", irq);
> +               dev_err(dev, "failed to claim irq %u\n", irq);
>                 return ret;
>         }
>
> @@ -1088,7 +1089,7 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>         if (of_find_property(np, "fsl,sai-synchronous-rx", NULL) &&
>             of_find_property(np, "fsl,sai-asynchronous", NULL)) {
>                 /* error out if both synchronous and asynchronous are
> present */
> -               dev_err(&pdev->dev, "invalid binding for synchronous
> mode\n");
> +               dev_err(dev, "invalid binding for synchronous mode\n");
>                 return -EINVAL;
>         }
>
> @@ -1109,7 +1110,7 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>             of_device_is_compatible(np, "fsl,imx6ul-sai")) {
>                 gpr =
> syscon_regmap_lookup_by_compatible("fsl,imx6ul-iomuxc-gpr");
>                 if (IS_ERR(gpr)) {
> -                       dev_err(&pdev->dev, "cannot find iomuxc
> registers\n");
> +                       dev_err(dev, "cannot find iomuxc registers\n");
>                         return PTR_ERR(gpr);
>                 }
>
> @@ -1127,23 +1128,23 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>         sai->dma_params_tx.maxburst = FSL_SAI_MAXBURST_TX;
>
>         platform_set_drvdata(pdev, sai);
> -       pm_runtime_enable(&pdev->dev);
> -       if (!pm_runtime_enabled(&pdev->dev)) {
> -               ret = fsl_sai_runtime_resume(&pdev->dev);
> +       pm_runtime_enable(dev);
> +       if (!pm_runtime_enabled(dev)) {
> +               ret = fsl_sai_runtime_resume(dev);
>                 if (ret)
>                         goto err_pm_disable;
>         }
>
> -       ret = pm_runtime_get_sync(&pdev->dev);
> +       ret = pm_runtime_get_sync(dev);
>         if (ret < 0) {
> -               pm_runtime_put_noidle(&pdev->dev);
> +               pm_runtime_put_noidle(dev);
>                 goto err_pm_get_sync;
>         }
>
>         /* Get sai version */
> -       ret = fsl_sai_check_version(&pdev->dev);
> +       ret = fsl_sai_check_version(dev);
>         if (ret < 0)
> -               dev_warn(&pdev->dev, "Error reading SAI version: %d\n",
> ret);
> +               dev_warn(dev, "Error reading SAI version: %d\n", ret);
>
>         /* Select MCLK direction */
>         if (of_find_property(np, "fsl,sai-mclk-direction-output", NULL) &&
> @@ -1152,7 +1153,7 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>                                    FSL_SAI_MCTL_MCLK_EN,
> FSL_SAI_MCTL_MCLK_EN);
>         }
>
> -       ret = pm_runtime_put_sync(&pdev->dev);
> +       ret = pm_runtime_put_sync(dev);
>         if (ret < 0)
>                 goto err_pm_get_sync;
>
> @@ -1165,12 +1166,12 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>                 if (ret)
>                         goto err_pm_get_sync;
>         } else {
> -               ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
> +               ret = devm_snd_dmaengine_pcm_register(dev, NULL, 0);
>                 if (ret)
>                         goto err_pm_get_sync;
>         }
>
> -       ret = devm_snd_soc_register_component(&pdev->dev, &fsl_component,
> +       ret = devm_snd_soc_register_component(dev, &fsl_component,
>                                               &sai->cpu_dai_drv, 1);
>         if (ret)
>                 goto err_pm_get_sync;
> @@ -1178,10 +1179,10 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>         return ret;
>
>  err_pm_get_sync:
> -       if (!pm_runtime_status_suspended(&pdev->dev))
> -               fsl_sai_runtime_suspend(&pdev->dev);
> +       if (!pm_runtime_status_suspended(dev))
> +               fsl_sai_runtime_suspend(dev);
>  err_pm_disable:
> -       pm_runtime_disable(&pdev->dev);
> +       pm_runtime_disable(dev);
>
>         return ret;
>  }
> --
> 2.30.2
>
>

[-- Attachment #2: Type: text/html, Size: 10239 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] ASoC: fsl_sai: add error message in case of missing imx-pcm-dma support
  2022-06-01  9:23 ` [PATCH 3/3] ASoC: fsl_sai: add error message in case of missing imx-pcm-dma support Marco Felsch
@ 2022-06-06  3:20     ` Shengjiu Wang
  0 siblings, 0 replies; 10+ messages in thread
From: Shengjiu Wang @ 2022-06-06  3:20 UTC (permalink / raw)
  To: Marco Felsch
  Cc: alsa-devel, Xiubo Li, linuxppc-dev, Liam Girdwood, Nicolin Chen,
	Mark Brown, Sascha Hauer, Fabio Estevam

On Wed, Jun 1, 2022 at 5:23 PM Marco Felsch <m.felsch@pengutronix.de> wrote:

> If the imx-pcm-dma is required we need to have the module enabled. For
> all NXP/FSL sound cards using the ASoC architecture this is the case but
> in case of using the simple-audio-card sound card this isn't the case.
>
> In such case the driver probe fails silently and the card isn't
> available. It took a while to find the missing Kconfig. Make this easier
> for others by printing a error if this the module isn't available but
> required by the HW.
>
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
>

Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>

Best regards
Wang Shengjiu

> ---
>  sound/soc/fsl/fsl_sai.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
> index 3e54f1f71c1e..2371da814b09 100644
> --- a/sound/soc/fsl/fsl_sai.c
> +++ b/sound/soc/fsl/fsl_sai.c
> @@ -1152,8 +1152,11 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>          */
>         if (sai->soc_data->use_imx_pcm) {
>                 ret = imx_pcm_dma_init(pdev);
> -               if (ret)
> +               if (ret) {
> +                       if (!IS_ENABLED(CONFIG_SND_SOC_IMX_PCM_DMA))
> +                               dev_err(dev, "Error: You must enable the
> imx-pcm-dma support!\n");
>                         goto err_pm_get_sync;
> +               }
>         } else {
>                 ret = devm_snd_dmaengine_pcm_register(dev, NULL, 0);
>                 if (ret)
> --
> 2.30.2
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] ASoC: fsl_sai: add error message in case of missing imx-pcm-dma support
@ 2022-06-06  3:20     ` Shengjiu Wang
  0 siblings, 0 replies; 10+ messages in thread
From: Shengjiu Wang @ 2022-06-06  3:20 UTC (permalink / raw)
  To: Marco Felsch
  Cc: alsa-devel, Xiubo Li, linuxppc-dev, Liam Girdwood, Nicolin Chen,
	Mark Brown, Sascha Hauer, Fabio Estevam

[-- Attachment #1: Type: text/plain, Size: 1563 bytes --]

On Wed, Jun 1, 2022 at 5:23 PM Marco Felsch <m.felsch@pengutronix.de> wrote:

> If the imx-pcm-dma is required we need to have the module enabled. For
> all NXP/FSL sound cards using the ASoC architecture this is the case but
> in case of using the simple-audio-card sound card this isn't the case.
>
> In such case the driver probe fails silently and the card isn't
> available. It took a while to find the missing Kconfig. Make this easier
> for others by printing a error if this the module isn't available but
> required by the HW.
>
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
>

Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>

Best regards
Wang Shengjiu

> ---
>  sound/soc/fsl/fsl_sai.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
> index 3e54f1f71c1e..2371da814b09 100644
> --- a/sound/soc/fsl/fsl_sai.c
> +++ b/sound/soc/fsl/fsl_sai.c
> @@ -1152,8 +1152,11 @@ static int fsl_sai_probe(struct platform_device
> *pdev)
>          */
>         if (sai->soc_data->use_imx_pcm) {
>                 ret = imx_pcm_dma_init(pdev);
> -               if (ret)
> +               if (ret) {
> +                       if (!IS_ENABLED(CONFIG_SND_SOC_IMX_PCM_DMA))
> +                               dev_err(dev, "Error: You must enable the
> imx-pcm-dma support!\n");
>                         goto err_pm_get_sync;
> +               }
>         } else {
>                 ret = devm_snd_dmaengine_pcm_register(dev, NULL, 0);
>                 if (ret)
> --
> 2.30.2
>
>

[-- Attachment #2: Type: text/html, Size: 2414 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (subset) [PATCH 1/3] ASoC: fsl_sai: use local device pointer
  2022-06-01  9:23 [PATCH 1/3] ASoC: fsl_sai: use local device pointer Marco Felsch
                   ` (2 preceding siblings ...)
  2022-06-06  3:18   ` Shengjiu Wang
@ 2022-06-07 10:46 ` Mark Brown
  3 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2022-06-07 10:46 UTC (permalink / raw)
  To: festevam, nicoleotsuka, Xiubo.Lee, m.felsch, lgirdwood, shengjiu.wang
  Cc: alsa-devel, linuxppc-dev, kernel

On Wed, 1 Jun 2022 11:23:40 +0200, Marco Felsch wrote:
> Use a local variable to dereference the device pointer once and use the
> local variable in further calls. No functional changes.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/3] ASoC: fsl_sai: use local device pointer
      commit: f53f50ee21d46094a8c48970e95e38a4deaa128e
[3/3] ASoC: fsl_sai: add error message in case of missing imx-pcm-dma support
      commit: 22205521770ee740f64a3ec90301f50e34738cfd

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-06-07 10:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01  9:23 [PATCH 1/3] ASoC: fsl_sai: use local device pointer Marco Felsch
2022-06-01  9:23 ` [PATCH 2/3] ASoC: fsl_sai: convert to dev_err_probe Marco Felsch
2022-06-06  2:48   ` Shengjiu Wang
2022-06-06  2:48     ` Shengjiu Wang
2022-06-01  9:23 ` [PATCH 3/3] ASoC: fsl_sai: add error message in case of missing imx-pcm-dma support Marco Felsch
2022-06-06  3:20   ` Shengjiu Wang
2022-06-06  3:20     ` Shengjiu Wang
2022-06-06  3:18 ` [PATCH 1/3] ASoC: fsl_sai: use local device pointer Shengjiu Wang
2022-06-06  3:18   ` Shengjiu Wang
2022-06-07 10:46 ` (subset) " Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.