diff mbox series

[v3,7/7] ASoC: imx-rpmsg: Assign platform driver used by machine driver to link with

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

Commit Message

Chancel Liu Sept. 30, 2022, 6:44 a.m. UTC
Each ASoC platform driver is named by rpmsg channel. ASoC machine
driver can parse "fsl,rpmsg-channel-name" property to figure out which
ASoC platform driver it should link with.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
---
 sound/soc/fsl/imx-rpmsg.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Shengjiu Wang Oct. 9, 2022, 6:19 a.m. UTC | #1
On Fri, Sep 30, 2022 at 2:46 PM Chancel Liu <chancel.liu@nxp.com> wrote:

> Each ASoC platform driver is named by rpmsg channel. ASoC machine
> driver can parse "fsl,rpmsg-channel-name" property to figure out which
> ASoC platform driver it should link with.
>
> Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
>

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

Best regards
Wang Shengjiu

> ---
>  sound/soc/fsl/imx-rpmsg.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/fsl/imx-rpmsg.c b/sound/soc/fsl/imx-rpmsg.c
> index 2e117311e582..57684064c9da 100644
> --- a/sound/soc/fsl/imx-rpmsg.c
> +++ b/sound/soc/fsl/imx-rpmsg.c
> @@ -36,6 +36,7 @@ static int imx_rpmsg_probe(struct platform_device *pdev)
>         struct platform_device *rpmsg_pdev = to_platform_device(dev);
>         struct device_node *np = rpmsg_pdev->dev.of_node;
>         struct of_phandle_args args;
> +       const char *platform_name;
>         struct imx_rpmsg *data;
>         int ret = 0;
>
> @@ -81,7 +82,10 @@ static int imx_rpmsg_probe(struct platform_device *pdev)
>         }
>
>         data->dai.cpus->dai_name = dev_name(&rpmsg_pdev->dev);
> -       data->dai.platforms->name = IMX_PCM_DRV_NAME;
> +       if (!of_property_read_string(np, "fsl,rpmsg-channel-name",
> &platform_name))
> +               data->dai.platforms->name = platform_name;
> +       else
> +               data->dai.platforms->name = "rpmsg-audio-channel";
>         data->dai.playback_only = true;
>         data->dai.capture_only = true;
>         data->card.num_links = 1;
> --
> 2.25.1
>
>
diff mbox series

Patch

diff --git a/sound/soc/fsl/imx-rpmsg.c b/sound/soc/fsl/imx-rpmsg.c
index 2e117311e582..57684064c9da 100644
--- a/sound/soc/fsl/imx-rpmsg.c
+++ b/sound/soc/fsl/imx-rpmsg.c
@@ -36,6 +36,7 @@  static int imx_rpmsg_probe(struct platform_device *pdev)
 	struct platform_device *rpmsg_pdev = to_platform_device(dev);
 	struct device_node *np = rpmsg_pdev->dev.of_node;
 	struct of_phandle_args args;
+	const char *platform_name;
 	struct imx_rpmsg *data;
 	int ret = 0;
 
@@ -81,7 +82,10 @@  static int imx_rpmsg_probe(struct platform_device *pdev)
 	}
 
 	data->dai.cpus->dai_name = dev_name(&rpmsg_pdev->dev);
-	data->dai.platforms->name = IMX_PCM_DRV_NAME;
+	if (!of_property_read_string(np, "fsl,rpmsg-channel-name", &platform_name))
+		data->dai.platforms->name = platform_name;
+	else
+		data->dai.platforms->name = "rpmsg-audio-channel";
 	data->dai.playback_only = true;
 	data->dai.capture_only = true;
 	data->card.num_links = 1;