diff mbox series

[3/5] ASoC: imx-pcm-rpmsg: Register different platform drivers

Message ID 20220829075144.2405000-4-chancel.liu@nxp.com (mailing list archive)
State Handled Elsewhere
Headers show
Series Create a new sound card to access MICFIL based on rpmsg channel | expand

Commit Message

Chancel Liu Aug. 29, 2022, 7:51 a.m. UTC
This patch can register different ASoC platform drivers in reference
to "fsl,platform" property of the corresponding node in dts. So sound
cards based on different rpmsg channels can link to their respective
platform drivers.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
---
 sound/soc/fsl/imx-pcm-rpmsg.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Shengjiu Wang Aug. 30, 2022, 6:31 a.m. UTC | #1
> 
> This patch can register different ASoC platform drivers in reference to
> "fsl,platform" property of the corresponding node in dts. So sound cards
> based on different rpmsg channels can link to their respective platform
> drivers.
> 
> Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
> ---
>  sound/soc/fsl/imx-pcm-rpmsg.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/fsl/imx-pcm-rpmsg.c b/sound/soc/fsl/imx-pcm-
> rpmsg.c index 35049043e532..2f310994f7ee 100644
> --- a/sound/soc/fsl/imx-pcm-rpmsg.c
> +++ b/sound/soc/fsl/imx-pcm-rpmsg.c
> @@ -178,7 +178,7 @@ static int imx_rpmsg_pcm_hw_params(struct
> snd_soc_component *component,
>  		msg->s_msg.param.channels = RPMSG_CH_STEREO;
>  		break;
>  	default:
> -		ret = -EINVAL;
> +		msg->s_msg.param.channels = params_channels(params);

Please use separate commit for this change, I think the fsl_rpmsg_dai. channels_max
Should be updated also?

Best regards
Wang shengjiug

>  		break;
>  	}
> 
> @@ -684,7 +684,7 @@ static int imx_rpmsg_pcm_probe(struct
> platform_device *pdev)
>  	info->rpdev = container_of(pdev->dev.parent, struct rpmsg_device,
> dev);
>  	info->dev = &pdev->dev;
>  	/* Setup work queue */
> -	info->rpmsg_wq = alloc_ordered_workqueue("rpmsg_audio",
> +	info->rpmsg_wq = alloc_ordered_workqueue(info->rpdev->id.name,
>  						 WQ_HIGHPRI |
>  						 WQ_UNBOUND |
>  						 WQ_FREEZABLE);
> @@ -723,11 +723,15 @@ static int imx_rpmsg_pcm_probe(struct
> platform_device *pdev)
>  	if (ret)
>  		goto fail;
> 
> -	component = snd_soc_lookup_component(&pdev->dev,
> IMX_PCM_DRV_NAME);
> +	component = snd_soc_lookup_component(&pdev->dev, NULL);
>  	if (!component) {
>  		ret = -EINVAL;
>  		goto fail;
>  	}
> +
> +	/* platform component name is used by machine driver to link with
> */
> +	component->name = info->rpdev->id.name;
> +
>  #ifdef CONFIG_DEBUG_FS
>  	component->debugfs_prefix = "rpmsg";
>  #endif
> --
> 2.25.1
diff mbox series

Patch

diff --git a/sound/soc/fsl/imx-pcm-rpmsg.c b/sound/soc/fsl/imx-pcm-rpmsg.c
index 35049043e532..2f310994f7ee 100644
--- a/sound/soc/fsl/imx-pcm-rpmsg.c
+++ b/sound/soc/fsl/imx-pcm-rpmsg.c
@@ -178,7 +178,7 @@  static int imx_rpmsg_pcm_hw_params(struct snd_soc_component *component,
 		msg->s_msg.param.channels = RPMSG_CH_STEREO;
 		break;
 	default:
-		ret = -EINVAL;
+		msg->s_msg.param.channels = params_channels(params);
 		break;
 	}
 
@@ -684,7 +684,7 @@  static int imx_rpmsg_pcm_probe(struct platform_device *pdev)
 	info->rpdev = container_of(pdev->dev.parent, struct rpmsg_device, dev);
 	info->dev = &pdev->dev;
 	/* Setup work queue */
-	info->rpmsg_wq = alloc_ordered_workqueue("rpmsg_audio",
+	info->rpmsg_wq = alloc_ordered_workqueue(info->rpdev->id.name,
 						 WQ_HIGHPRI |
 						 WQ_UNBOUND |
 						 WQ_FREEZABLE);
@@ -723,11 +723,15 @@  static int imx_rpmsg_pcm_probe(struct platform_device *pdev)
 	if (ret)
 		goto fail;
 
-	component = snd_soc_lookup_component(&pdev->dev, IMX_PCM_DRV_NAME);
+	component = snd_soc_lookup_component(&pdev->dev, NULL);
 	if (!component) {
 		ret = -EINVAL;
 		goto fail;
 	}
+
+	/* platform component name is used by machine driver to link with */
+	component->name = info->rpdev->id.name;
+
 #ifdef CONFIG_DEBUG_FS
 	component->debugfs_prefix = "rpmsg";
 #endif