alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/7] Create a new sound card to access MICFIL based on rpmsg channel
@ 2022-09-30  6:44 Chancel Liu
  2022-09-30  6:44 ` [PATCH v3 1/7] ASoC: dt-bindings: fsl_rpmsg: Add a property to assign the " Chancel Liu
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Chancel Liu @ 2022-09-30  6:44 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, alsa-devel, linux-kernel,
	robh+dt, devicetree, krzysztof.kozlowski+dt, shengjiu.wang,
	Xiubo.Lee, festevam, nicoleotsuka, linuxppc-dev
  Cc: Chancel Liu

At a previous time, we have successfully created a virtual sound card
based on rpmsg. The sound card works under this mechanism Cortex-A core
tells the Cortex-M core the format, rate, channel, .etc configuration
of the PCM parameters and Cortex-M controls real hardware devices such
as SAI and DMA. From the view of Linux side, the sound card is bound to
a rpmsg channel through which it can access SAI.

Here these patches are introduced to create a new virtual sound card to
access MICFIL based on a new created rpmsg channel. It's easy to create
a new rpmsg channel for MICFIL through rpmsg name service announcment.
Also the other ASoC components bound to this rpmsg MICFIL sound card
will be registered with these patches.

If other sound cards using different hardware devices needs to be
created over rpmsg in the future, these patches can be referred.

changes in v3
- Delete the statement referring to linux drivers in dts

changes in v2:
- Rename property in bindings file according to Krzysztof's comments
- Update codes and comments according to Shengjiu's comments

Chancel Liu (7):
  ASoC: dt-bindings: fsl_rpmsg: Add a property to assign the rpmsg
    channel
  ASoC: imx-audio-rpmsg: Create rpmsg channel for MICFIL
  ASoC: imx-pcm-rpmsg: Register different platform drivers
  ASoC: imx-pcm-rpmsg: Multi-channel support for sound card based on
    rpmsg
  ASoC: fsl_rpmsg: Register different ASoC machine devices
  ASoC: fsl_rpmsg: Multi-channel support in CPU DAI driver
  ASoC: imx-rpmsg: Assign platform driver used by machine driver to link
    with

 .../devicetree/bindings/sound/fsl,rpmsg.yaml  | 36 +++++++++++++++++--
 sound/soc/fsl/fsl_rpmsg.c                     |  6 ++--
 sound/soc/fsl/imx-audio-rpmsg.c               |  3 +-
 sound/soc/fsl/imx-pcm-rpmsg.c                 | 10 ++++--
 sound/soc/fsl/imx-rpmsg.c                     |  6 +++-
 5 files changed, 51 insertions(+), 10 deletions(-)

--
2.25.1


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

* [PATCH v3 1/7] ASoC: dt-bindings: fsl_rpmsg: Add a property to assign the rpmsg channel
  2022-09-30  6:44 [PATCH v3 0/7] Create a new sound card to access MICFIL based on rpmsg channel Chancel Liu
@ 2022-09-30  6:44 ` Chancel Liu
  2022-10-03 16:20   ` Rob Herring
  2022-09-30  6:44 ` [PATCH v3 2/7] ASoC: imx-audio-rpmsg: Create rpmsg channel for MICFIL Chancel Liu
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Chancel Liu @ 2022-09-30  6:44 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, alsa-devel, linux-kernel,
	robh+dt, devicetree, krzysztof.kozlowski+dt, shengjiu.wang,
	Xiubo.Lee, festevam, nicoleotsuka, linuxppc-dev
  Cc: Chancel Liu

Add a string property to assign the rpmsg channel this sound card sits
on. This property can be omitted if there is only one sound card and it
sits on "rpmsg-audio-channel".

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
---
 .../devicetree/bindings/sound/fsl,rpmsg.yaml  | 36 +++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml b/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml
index d370c98a62c7..e847611a85f7 100644
--- a/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml
+++ b/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml
@@ -11,8 +11,11 @@ maintainers:
 
 description: |
   fsl_rpmsg is a virtual audio device. Mapping to real hardware devices
-  are SAI, DMA controlled by Cortex M core. What we see from Linux
-  side is a device which provides audio service by rpmsg channel.
+  are SAI, MICFIL, DMA controlled by Cortex M core. What we see from
+  Linux side is a device which provides audio service by rpmsg channel.
+  We can create different sound cards which access different hardwares
+  such as SAI, MICFIL, .etc through building rpmsg channels between
+  Cortex-A and Cortex-M.
 
 properties:
   compatible:
@@ -85,6 +88,16 @@ properties:
       This is a boolean property. If present, the receiving function
       will be enabled.
 
+  fsl,rpmsg-channel-name:
+    $ref: /schemas/types.yaml#/definitions/string
+    description: |
+      A string property to assign rpmsg channel this sound card sits on.
+      This property can be omitted if there is only one sound card and it sits
+      on "rpmsg-audio-channel".
+    enum:
+      - rpmsg-audio-channel
+      - rpmsg-micfil-channel
+
 required:
   - compatible
   - model
@@ -107,3 +120,22 @@ examples:
                  <&clk IMX8MN_AUDIO_PLL2_OUT>;
         clock-names = "ipg", "mclk", "dma", "pll8k", "pll11k";
     };
+
+  - |
+    #include <dt-bindings/clock/imx8mm-clock.h>
+
+    rpmsg_micfil: audio-controller {
+        compatible = "fsl,imx8mm-rpmsg-audio";
+        model = "micfil-audio";
+        fsl,rpmsg-channel-name = "rpmsg-micfil-channel";
+        fsl,enable-lpa;
+        fsl,rpmsg-in;
+        clocks = <&clk IMX8MM_CLK_PDM_IPG>,
+                 <&clk IMX8MM_CLK_PDM_ROOT>,
+                 <&clk IMX8MM_CLK_SDMA3_ROOT>,
+                 <&clk IMX8MM_AUDIO_PLL1_OUT>,
+                 <&clk IMX8MM_AUDIO_PLL2_OUT>;
+        clock-names = "ipg", "mclk", "dma", "pll8k", "pll11k";
+    };
+
+...
-- 
2.25.1


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

* [PATCH v3 2/7] ASoC: imx-audio-rpmsg: Create rpmsg channel for MICFIL
  2022-09-30  6:44 [PATCH v3 0/7] Create a new sound card to access MICFIL based on rpmsg channel Chancel Liu
  2022-09-30  6:44 ` [PATCH v3 1/7] ASoC: dt-bindings: fsl_rpmsg: Add a property to assign the " Chancel Liu
@ 2022-09-30  6:44 ` Chancel Liu
  2022-10-09  6:17   ` Shengjiu Wang
  2022-09-30  6:44 ` [PATCH v3 3/7] ASoC: imx-pcm-rpmsg: Register different platform drivers Chancel Liu
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Chancel Liu @ 2022-09-30  6:44 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, alsa-devel, linux-kernel,
	robh+dt, devicetree, krzysztof.kozlowski+dt, shengjiu.wang,
	Xiubo.Lee, festevam, nicoleotsuka, linuxppc-dev
  Cc: Chancel Liu

Rpmsg channel for MICFIL can also be created through rpmsg name service
announcement. If this driver is probed, Cortex-A can access MICFIL
which is actually controlled by Cortex-M through rpmsg channel for
MICFIL. This driver also helps register ASoC platform device thus use
of PLATFORM_DEVID_AUTO macro in API can automatically create device for
each rpmsg channel.

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

diff --git a/sound/soc/fsl/imx-audio-rpmsg.c b/sound/soc/fsl/imx-audio-rpmsg.c
index 905c3a071300..d5234ac4b09b 100644
--- a/sound/soc/fsl/imx-audio-rpmsg.c
+++ b/sound/soc/fsl/imx-audio-rpmsg.c
@@ -88,7 +88,7 @@ static int imx_audio_rpmsg_probe(struct rpmsg_device *rpdev)
 	/* Register platform driver for rpmsg routine */
 	data->rpmsg_pdev = platform_device_register_data(&rpdev->dev,
 							 IMX_PCM_DRV_NAME,
-							 PLATFORM_DEVID_NONE,
+							 PLATFORM_DEVID_AUTO,
 							 NULL, 0);
 	if (IS_ERR(data->rpmsg_pdev)) {
 		dev_err(&rpdev->dev, "failed to register rpmsg platform.\n");
@@ -110,6 +110,7 @@ static void imx_audio_rpmsg_remove(struct rpmsg_device *rpdev)
 
 static struct rpmsg_device_id imx_audio_rpmsg_id_table[] = {
 	{ .name	= "rpmsg-audio-channel" },
+	{ .name = "rpmsg-micfil-channel" },
 	{ },
 };
 
-- 
2.25.1


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

* [PATCH v3 3/7] ASoC: imx-pcm-rpmsg: Register different platform drivers
  2022-09-30  6:44 [PATCH v3 0/7] Create a new sound card to access MICFIL based on rpmsg channel Chancel Liu
  2022-09-30  6:44 ` [PATCH v3 1/7] ASoC: dt-bindings: fsl_rpmsg: Add a property to assign the " Chancel Liu
  2022-09-30  6:44 ` [PATCH v3 2/7] ASoC: imx-audio-rpmsg: Create rpmsg channel for MICFIL Chancel Liu
@ 2022-09-30  6:44 ` Chancel Liu
  2022-10-09  6:17   ` Shengjiu Wang
  2022-09-30  6:44 ` [PATCH v3 4/7] ASoC: imx-pcm-rpmsg: Multi-channel support for sound card based on rpmsg Chancel Liu
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Chancel Liu @ 2022-09-30  6:44 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, alsa-devel, linux-kernel,
	robh+dt, devicetree, krzysztof.kozlowski+dt, shengjiu.wang,
	Xiubo.Lee, festevam, nicoleotsuka, linuxppc-dev
  Cc: Chancel Liu

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>
---
 sound/soc/fsl/imx-pcm-rpmsg.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sound/soc/fsl/imx-pcm-rpmsg.c b/sound/soc/fsl/imx-pcm-rpmsg.c
index 35049043e532..3157cd5a837e 100644
--- a/sound/soc/fsl/imx-pcm-rpmsg.c
+++ b/sound/soc/fsl/imx-pcm-rpmsg.c
@@ -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


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

* [PATCH v3 4/7] ASoC: imx-pcm-rpmsg: Multi-channel support for sound card based on rpmsg
  2022-09-30  6:44 [PATCH v3 0/7] Create a new sound card to access MICFIL based on rpmsg channel Chancel Liu
                   ` (2 preceding siblings ...)
  2022-09-30  6:44 ` [PATCH v3 3/7] ASoC: imx-pcm-rpmsg: Register different platform drivers Chancel Liu
@ 2022-09-30  6:44 ` Chancel Liu
  2022-10-09  6:18   ` Shengjiu Wang
  2022-09-30  6:44 ` [PATCH v3 5/7] ASoC: fsl_rpmsg: Register different ASoC machine devices Chancel Liu
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Chancel Liu @ 2022-09-30  6:44 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, alsa-devel, linux-kernel,
	robh+dt, devicetree, krzysztof.kozlowski+dt, shengjiu.wang,
	Xiubo.Lee, festevam, nicoleotsuka, linuxppc-dev
  Cc: Chancel Liu

Some sound card based on rpmsg may support multi-channel. The number of
channels can be sent to Cortex-M in rpmsg for process.

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

diff --git a/sound/soc/fsl/imx-pcm-rpmsg.c b/sound/soc/fsl/imx-pcm-rpmsg.c
index 3157cd5a837e..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;
 	}
 
-- 
2.25.1


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

* [PATCH v3 5/7] ASoC: fsl_rpmsg: Register different ASoC machine devices
  2022-09-30  6:44 [PATCH v3 0/7] Create a new sound card to access MICFIL based on rpmsg channel Chancel Liu
                   ` (3 preceding siblings ...)
  2022-09-30  6:44 ` [PATCH v3 4/7] ASoC: imx-pcm-rpmsg: Multi-channel support for sound card based on rpmsg Chancel Liu
@ 2022-09-30  6:44 ` Chancel Liu
  2022-10-09  6:18   ` Shengjiu Wang
  2022-09-30  6:44 ` [PATCH v3 6/7] ASoC: fsl_rpmsg: Multi-channel support in CPU DAI driver Chancel Liu
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Chancel Liu @ 2022-09-30  6:44 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, alsa-devel, linux-kernel,
	robh+dt, devicetree, krzysztof.kozlowski+dt, shengjiu.wang,
	Xiubo.Lee, festevam, nicoleotsuka, linuxppc-dev
  Cc: Chancel Liu

This driver helps register ASoC machine device thus use of
PLATFORM_DEVID_AUTO macro in API can automatically create device for
each sound card based on rpmsg.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
---
 sound/soc/fsl/fsl_rpmsg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/fsl/fsl_rpmsg.c b/sound/soc/fsl/fsl_rpmsg.c
index bf94838bdbef..fde3d5006ce0 100644
--- a/sound/soc/fsl/fsl_rpmsg.c
+++ b/sound/soc/fsl/fsl_rpmsg.c
@@ -235,7 +235,7 @@ static int fsl_rpmsg_probe(struct platform_device *pdev)
 
 	rpmsg->card_pdev = platform_device_register_data(&pdev->dev,
 							 "imx-audio-rpmsg",
-							 PLATFORM_DEVID_NONE,
+							 PLATFORM_DEVID_AUTO,
 							 NULL,
 							 0);
 	if (IS_ERR(rpmsg->card_pdev)) {
-- 
2.25.1


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

* [PATCH v3 6/7] ASoC: fsl_rpmsg: Multi-channel support in CPU DAI driver
  2022-09-30  6:44 [PATCH v3 0/7] Create a new sound card to access MICFIL based on rpmsg channel Chancel Liu
                   ` (4 preceding siblings ...)
  2022-09-30  6:44 ` [PATCH v3 5/7] ASoC: fsl_rpmsg: Register different ASoC machine devices Chancel Liu
@ 2022-09-30  6:44 ` Chancel Liu
  2022-10-09  6:19   ` Shengjiu Wang
  2022-09-30  6:44 ` [PATCH v3 7/7] ASoC: imx-rpmsg: Assign platform driver used by machine driver to link with Chancel Liu
  2022-10-18 11:28 ` [PATCH v3 0/7] Create a new sound card to access MICFIL based on rpmsg channel Mark Brown
  7 siblings, 1 reply; 16+ messages in thread
From: Chancel Liu @ 2022-09-30  6:44 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, alsa-devel, linux-kernel,
	robh+dt, devicetree, krzysztof.kozlowski+dt, shengjiu.wang,
	Xiubo.Lee, festevam, nicoleotsuka, linuxppc-dev
  Cc: Chancel Liu

Some sound card based on rpmsg may support multi-channel. This patch
expands the maximum channels to 32.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
---
 sound/soc/fsl/fsl_rpmsg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/fsl/fsl_rpmsg.c b/sound/soc/fsl/fsl_rpmsg.c
index fde3d5006ce0..46c7868a2653 100644
--- a/sound/soc/fsl/fsl_rpmsg.c
+++ b/sound/soc/fsl/fsl_rpmsg.c
@@ -117,14 +117,14 @@ static struct snd_soc_dai_driver fsl_rpmsg_dai = {
 	.playback = {
 		.stream_name = "CPU-Playback",
 		.channels_min = 2,
-		.channels_max = 2,
+		.channels_max = 32,
 		.rates = SNDRV_PCM_RATE_KNOT,
 		.formats = FSL_RPMSG_FORMATS,
 	},
 	.capture = {
 		.stream_name = "CPU-Capture",
 		.channels_min = 2,
-		.channels_max = 2,
+		.channels_max = 32,
 		.rates = SNDRV_PCM_RATE_KNOT,
 		.formats = FSL_RPMSG_FORMATS,
 	},
-- 
2.25.1


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

* [PATCH v3 7/7] ASoC: imx-rpmsg: Assign platform driver used by machine driver to link with
  2022-09-30  6:44 [PATCH v3 0/7] Create a new sound card to access MICFIL based on rpmsg channel Chancel Liu
                   ` (5 preceding siblings ...)
  2022-09-30  6:44 ` [PATCH v3 6/7] ASoC: fsl_rpmsg: Multi-channel support in CPU DAI driver Chancel Liu
@ 2022-09-30  6:44 ` Chancel Liu
  2022-10-09  6:19   ` Shengjiu Wang
  2022-10-18 11:28 ` [PATCH v3 0/7] Create a new sound card to access MICFIL based on rpmsg channel Mark Brown
  7 siblings, 1 reply; 16+ messages in thread
From: Chancel Liu @ 2022-09-30  6:44 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, alsa-devel, linux-kernel,
	robh+dt, devicetree, krzysztof.kozlowski+dt, shengjiu.wang,
	Xiubo.Lee, festevam, nicoleotsuka, linuxppc-dev
  Cc: Chancel Liu

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(-)

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


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

* Re: [PATCH v3 1/7] ASoC: dt-bindings: fsl_rpmsg: Add a property to assign the rpmsg channel
  2022-09-30  6:44 ` [PATCH v3 1/7] ASoC: dt-bindings: fsl_rpmsg: Add a property to assign the " Chancel Liu
@ 2022-10-03 16:20   ` Rob Herring
  0 siblings, 0 replies; 16+ messages in thread
From: Rob Herring @ 2022-10-03 16:20 UTC (permalink / raw)
  To: Chancel Liu
  Cc: devicetree, alsa-devel, lgirdwood, Xiubo.Lee, shengjiu.wang,
	linuxppc-dev, linux-kernel, robh+dt, tiwai, nicoleotsuka,
	broonie, krzysztof.kozlowski+dt, festevam

On Fri, 30 Sep 2022 14:44:35 +0800, Chancel Liu wrote:
> Add a string property to assign the rpmsg channel this sound card sits
> on. This property can be omitted if there is only one sound card and it
> sits on "rpmsg-audio-channel".
> 
> Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
> ---
>  .../devicetree/bindings/sound/fsl,rpmsg.yaml  | 36 +++++++++++++++++--
>  1 file changed, 34 insertions(+), 2 deletions(-)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH v3 2/7] ASoC: imx-audio-rpmsg: Create rpmsg channel for MICFIL
  2022-09-30  6:44 ` [PATCH v3 2/7] ASoC: imx-audio-rpmsg: Create rpmsg channel for MICFIL Chancel Liu
@ 2022-10-09  6:17   ` Shengjiu Wang
  0 siblings, 0 replies; 16+ messages in thread
From: Shengjiu Wang @ 2022-10-09  6:17 UTC (permalink / raw)
  To: Chancel Liu
  Cc: devicetree, alsa-devel, lgirdwood, linuxppc-dev, Xiubo.Lee,
	linux-kernel, robh+dt, tiwai, nicoleotsuka, broonie,
	krzysztof.kozlowski+dt, festevam

On Fri, Sep 30, 2022 at 2:46 PM Chancel Liu <chancel.liu@nxp.com> wrote:

> Rpmsg channel for MICFIL can also be created through rpmsg name service
> announcement. If this driver is probed, Cortex-A can access MICFIL
> which is actually controlled by Cortex-M through rpmsg channel for
> MICFIL. This driver also helps register ASoC platform device thus use
> of PLATFORM_DEVID_AUTO macro in API can automatically create device for
> each rpmsg channel.
>
> 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-audio-rpmsg.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/fsl/imx-audio-rpmsg.c
> b/sound/soc/fsl/imx-audio-rpmsg.c
> index 905c3a071300..d5234ac4b09b 100644
> --- a/sound/soc/fsl/imx-audio-rpmsg.c
> +++ b/sound/soc/fsl/imx-audio-rpmsg.c
> @@ -88,7 +88,7 @@ static int imx_audio_rpmsg_probe(struct rpmsg_device
> *rpdev)
>         /* Register platform driver for rpmsg routine */
>         data->rpmsg_pdev = platform_device_register_data(&rpdev->dev,
>                                                          IMX_PCM_DRV_NAME,
> -
> PLATFORM_DEVID_NONE,
> +
> PLATFORM_DEVID_AUTO,
>                                                          NULL, 0);
>         if (IS_ERR(data->rpmsg_pdev)) {
>                 dev_err(&rpdev->dev, "failed to register rpmsg
> platform.\n");
> @@ -110,6 +110,7 @@ static void imx_audio_rpmsg_remove(struct rpmsg_device
> *rpdev)
>
>  static struct rpmsg_device_id imx_audio_rpmsg_id_table[] = {
>         { .name = "rpmsg-audio-channel" },
> +       { .name = "rpmsg-micfil-channel" },
>         { },
>  };
>
> --
> 2.25.1
>
>

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

* Re: [PATCH v3 3/7] ASoC: imx-pcm-rpmsg: Register different platform drivers
  2022-09-30  6:44 ` [PATCH v3 3/7] ASoC: imx-pcm-rpmsg: Register different platform drivers Chancel Liu
@ 2022-10-09  6:17   ` Shengjiu Wang
  0 siblings, 0 replies; 16+ messages in thread
From: Shengjiu Wang @ 2022-10-09  6:17 UTC (permalink / raw)
  To: Chancel Liu
  Cc: devicetree, alsa-devel, lgirdwood, linuxppc-dev, Xiubo.Lee,
	linux-kernel, robh+dt, tiwai, nicoleotsuka, broonie,
	krzysztof.kozlowski+dt, festevam

On Fri, Sep 30, 2022 at 2:46 PM Chancel Liu <chancel.liu@nxp.com> wrote:

> 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>

Best regards
Wang Shengjiu

> ---
>  sound/soc/fsl/imx-pcm-rpmsg.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/fsl/imx-pcm-rpmsg.c b/sound/soc/fsl/imx-pcm-rpmsg.c
> index 35049043e532..3157cd5a837e 100644
> --- a/sound/soc/fsl/imx-pcm-rpmsg.c
> +++ b/sound/soc/fsl/imx-pcm-rpmsg.c
> @@ -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
>
>

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

* Re: [PATCH v3 4/7] ASoC: imx-pcm-rpmsg: Multi-channel support for sound card based on rpmsg
  2022-09-30  6:44 ` [PATCH v3 4/7] ASoC: imx-pcm-rpmsg: Multi-channel support for sound card based on rpmsg Chancel Liu
@ 2022-10-09  6:18   ` Shengjiu Wang
  0 siblings, 0 replies; 16+ messages in thread
From: Shengjiu Wang @ 2022-10-09  6:18 UTC (permalink / raw)
  To: Chancel Liu
  Cc: devicetree, alsa-devel, lgirdwood, linuxppc-dev, Xiubo.Lee,
	linux-kernel, robh+dt, tiwai, nicoleotsuka, broonie,
	krzysztof.kozlowski+dt, festevam

On Fri, Sep 30, 2022 at 2:46 PM Chancel Liu <chancel.liu@nxp.com> wrote:

> Some sound card based on rpmsg may support multi-channel. The number of
> channels can be sent to Cortex-M in rpmsg for process.
>
> 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-pcm-rpmsg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/fsl/imx-pcm-rpmsg.c b/sound/soc/fsl/imx-pcm-rpmsg.c
> index 3157cd5a837e..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;
>         }
>
> --
> 2.25.1
>
>

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

* Re: [PATCH v3 5/7] ASoC: fsl_rpmsg: Register different ASoC machine devices
  2022-09-30  6:44 ` [PATCH v3 5/7] ASoC: fsl_rpmsg: Register different ASoC machine devices Chancel Liu
@ 2022-10-09  6:18   ` Shengjiu Wang
  0 siblings, 0 replies; 16+ messages in thread
From: Shengjiu Wang @ 2022-10-09  6:18 UTC (permalink / raw)
  To: Chancel Liu
  Cc: devicetree, alsa-devel, lgirdwood, linuxppc-dev, Xiubo.Lee,
	linux-kernel, robh+dt, tiwai, nicoleotsuka, broonie,
	krzysztof.kozlowski+dt, festevam

On Fri, Sep 30, 2022 at 2:46 PM Chancel Liu <chancel.liu@nxp.com> wrote:

> This driver helps register ASoC machine device thus use of
> PLATFORM_DEVID_AUTO macro in API can automatically create device for
> each sound card based on rpmsg.
>
> Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
>

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

Best regards
Wang Shengjiu

> ---
>  sound/soc/fsl/fsl_rpmsg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/fsl/fsl_rpmsg.c b/sound/soc/fsl/fsl_rpmsg.c
> index bf94838bdbef..fde3d5006ce0 100644
> --- a/sound/soc/fsl/fsl_rpmsg.c
> +++ b/sound/soc/fsl/fsl_rpmsg.c
> @@ -235,7 +235,7 @@ static int fsl_rpmsg_probe(struct platform_device
> *pdev)
>
>         rpmsg->card_pdev = platform_device_register_data(&pdev->dev,
>                                                          "imx-audio-rpmsg",
> -
> PLATFORM_DEVID_NONE,
> +
> PLATFORM_DEVID_AUTO,
>                                                          NULL,
>                                                          0);
>         if (IS_ERR(rpmsg->card_pdev)) {
> --
> 2.25.1
>
>

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

* Re: [PATCH v3 6/7] ASoC: fsl_rpmsg: Multi-channel support in CPU DAI driver
  2022-09-30  6:44 ` [PATCH v3 6/7] ASoC: fsl_rpmsg: Multi-channel support in CPU DAI driver Chancel Liu
@ 2022-10-09  6:19   ` Shengjiu Wang
  0 siblings, 0 replies; 16+ messages in thread
From: Shengjiu Wang @ 2022-10-09  6:19 UTC (permalink / raw)
  To: Chancel Liu
  Cc: devicetree, alsa-devel, lgirdwood, linuxppc-dev, Xiubo.Lee,
	linux-kernel, robh+dt, tiwai, nicoleotsuka, broonie,
	krzysztof.kozlowski+dt, festevam

On Fri, Sep 30, 2022 at 2:46 PM Chancel Liu <chancel.liu@nxp.com> wrote:

> Some sound card based on rpmsg may support multi-channel. This patch
> expands the maximum channels to 32.
>
> Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
>

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

Best regards
Wang Shengjiu

> ---
>  sound/soc/fsl/fsl_rpmsg.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_rpmsg.c b/sound/soc/fsl/fsl_rpmsg.c
> index fde3d5006ce0..46c7868a2653 100644
> --- a/sound/soc/fsl/fsl_rpmsg.c
> +++ b/sound/soc/fsl/fsl_rpmsg.c
> @@ -117,14 +117,14 @@ static struct snd_soc_dai_driver fsl_rpmsg_dai = {
>         .playback = {
>                 .stream_name = "CPU-Playback",
>                 .channels_min = 2,
> -               .channels_max = 2,
> +               .channels_max = 32,
>                 .rates = SNDRV_PCM_RATE_KNOT,
>                 .formats = FSL_RPMSG_FORMATS,
>         },
>         .capture = {
>                 .stream_name = "CPU-Capture",
>                 .channels_min = 2,
> -               .channels_max = 2,
> +               .channels_max = 32,
>                 .rates = SNDRV_PCM_RATE_KNOT,
>                 .formats = FSL_RPMSG_FORMATS,
>         },
> --
> 2.25.1
>
>

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

* Re: [PATCH v3 7/7] ASoC: imx-rpmsg: Assign platform driver used by machine driver to link with
  2022-09-30  6:44 ` [PATCH v3 7/7] ASoC: imx-rpmsg: Assign platform driver used by machine driver to link with Chancel Liu
@ 2022-10-09  6:19   ` Shengjiu Wang
  0 siblings, 0 replies; 16+ messages in thread
From: Shengjiu Wang @ 2022-10-09  6:19 UTC (permalink / raw)
  To: Chancel Liu
  Cc: devicetree, alsa-devel, lgirdwood, linuxppc-dev, Xiubo.Lee,
	linux-kernel, robh+dt, tiwai, nicoleotsuka, broonie,
	krzysztof.kozlowski+dt, festevam

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
>
>

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

* Re: [PATCH v3 0/7] Create a new sound card to access MICFIL based on rpmsg channel
  2022-09-30  6:44 [PATCH v3 0/7] Create a new sound card to access MICFIL based on rpmsg channel Chancel Liu
                   ` (6 preceding siblings ...)
  2022-09-30  6:44 ` [PATCH v3 7/7] ASoC: imx-rpmsg: Assign platform driver used by machine driver to link with Chancel Liu
@ 2022-10-18 11:28 ` Mark Brown
  7 siblings, 0 replies; 16+ messages in thread
From: Mark Brown @ 2022-10-18 11:28 UTC (permalink / raw)
  To: linuxppc-dev, robh+dt, devicetree, Xiubo.Lee, tiwai,
	linux-kernel, shengjiu.wang, krzysztof.kozlowski+dt,
	nicoleotsuka, alsa-devel, lgirdwood, Chancel Liu, festevam,
	perex

On Fri, 30 Sep 2022 14:44:34 +0800, Chancel Liu wrote:
> At a previous time, we have successfully created a virtual sound card
> based on rpmsg. The sound card works under this mechanism Cortex-A core
> tells the Cortex-M core the format, rate, channel, .etc configuration
> of the PCM parameters and Cortex-M controls real hardware devices such
> as SAI and DMA. From the view of Linux side, the sound card is bound to
> a rpmsg channel through which it can access SAI.
> 
> [...]

Applied to

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

Thanks!

[1/7] ASoC: dt-bindings: fsl_rpmsg: Add a property to assign the rpmsg channel
      commit: 3570e6873b1a506bca4b5788d71141944c55132c
[2/7] ASoC: imx-audio-rpmsg: Create rpmsg channel for MICFIL
      commit: f04189e0b85f6bbd10679e71061bf6d1ced5c539
[3/7] ASoC: imx-pcm-rpmsg: Register different platform drivers
      commit: b2c2a947b3412f6edb9a86f5b12d6420958e67ba
[4/7] ASoC: imx-pcm-rpmsg: Multi-channel support for sound card based on rpmsg
      commit: bdc0f6ca1c079ba790e0e227cff6164feae90460
[5/7] ASoC: fsl_rpmsg: Register different ASoC machine devices
      commit: 76a874caeab596972f529968aa0d19d4ba1d2197
[6/7] ASoC: fsl_rpmsg: Multi-channel support in CPU DAI driver
      commit: f26c1bb8a8ebe72748a3bb6f5d75079b642a33e8
[7/7] ASoC: imx-rpmsg: Assign platform driver used by machine driver to link with
      commit: 4b48440ea390bada41928920446928beb3652a76

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] 16+ messages in thread

end of thread, other threads:[~2022-10-18 11:29 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-30  6:44 [PATCH v3 0/7] Create a new sound card to access MICFIL based on rpmsg channel Chancel Liu
2022-09-30  6:44 ` [PATCH v3 1/7] ASoC: dt-bindings: fsl_rpmsg: Add a property to assign the " Chancel Liu
2022-10-03 16:20   ` Rob Herring
2022-09-30  6:44 ` [PATCH v3 2/7] ASoC: imx-audio-rpmsg: Create rpmsg channel for MICFIL Chancel Liu
2022-10-09  6:17   ` Shengjiu Wang
2022-09-30  6:44 ` [PATCH v3 3/7] ASoC: imx-pcm-rpmsg: Register different platform drivers Chancel Liu
2022-10-09  6:17   ` Shengjiu Wang
2022-09-30  6:44 ` [PATCH v3 4/7] ASoC: imx-pcm-rpmsg: Multi-channel support for sound card based on rpmsg Chancel Liu
2022-10-09  6:18   ` Shengjiu Wang
2022-09-30  6:44 ` [PATCH v3 5/7] ASoC: fsl_rpmsg: Register different ASoC machine devices Chancel Liu
2022-10-09  6:18   ` Shengjiu Wang
2022-09-30  6:44 ` [PATCH v3 6/7] ASoC: fsl_rpmsg: Multi-channel support in CPU DAI driver Chancel Liu
2022-10-09  6:19   ` Shengjiu Wang
2022-09-30  6:44 ` [PATCH v3 7/7] ASoC: imx-rpmsg: Assign platform driver used by machine driver to link with Chancel Liu
2022-10-09  6:19   ` Shengjiu Wang
2022-10-18 11:28 ` [PATCH v3 0/7] Create a new sound card to access MICFIL based on rpmsg channel Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).