ASoC: imx-pcm-rpmsg: Register different platform drivers
authorChancel Liu <chancel.liu@nxp.com>
Fri, 30 Sep 2022 06:44:37 +0000 (14:44 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 17 Oct 2022 11:48:14 +0000 (12:48 +0100)
This patch can register different ASoC platform drivers if there are
several rpmsg channels. Thus sound cards based on different rpmsg
channels can link to their respective platform drivers. Besides, the
name of driver is equal to the name of rpmsg channel.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20220930064441.2548505-4-chancel.liu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/imx-pcm-rpmsg.c

index 35049043e532283ab7fc5f75c20537f8601fd31f..3157cd5a837e337522cc27f0cd27ed89b210405f 100644 (file)
@@ -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