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 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 | 37 ++++++++++++++++++-
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, 52 insertions(+), 10 deletions(-)
--
2.25.1
Add a string property to assign the rpmsg channel this sound card sits
on. It also represents the name of ASoC platform driver. This property
can be omitted if there is only one sound card and it sits on
"rpmsg-audio-channel".
Signed-off-by: Chancel Liu <[email protected]>
---
.../devicetree/bindings/sound/fsl,rpmsg.yaml | 37 ++++++++++++++++++-
1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml b/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml
index d370c98a62c7..3744ae794c00 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,17 @@ 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.
+ It also represents the name of ASoC platform driver. 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 +121,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
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 <[email protected]>
---
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
On Wed, Sep 14, 2022 at 06:51:39PM +0800, Chancel Liu wrote:
> Add a string property to assign the rpmsg channel this sound card sits
> on. It also represents the name of ASoC platform driver. This property
> can be omitted if there is only one sound card and it sits on
> "rpmsg-audio-channel".
>
> Signed-off-by: Chancel Liu <[email protected]>
> ---
> .../devicetree/bindings/sound/fsl,rpmsg.yaml | 37 ++++++++++++++++++-
> 1 file changed, 35 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml b/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml
> index d370c98a62c7..3744ae794c00 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,17 @@ 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.
> + It also represents the name of ASoC platform driver. This property
That's a Linux detail which doesn't belong in DT.
> + 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 +121,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
>
>
> > Add a string property to assign the rpmsg channel this sound card sits
> > on. It also represents the name of ASoC platform driver. This property
> > can be omitted if there is only one sound card and it sits on
> > "rpmsg-audio-channel".
> >
> > Signed-off-by: Chancel Liu <[email protected]>
> > ---
> > .../devicetree/bindings/sound/fsl,rpmsg.yaml | 37 ++++++++++++++++++-
> > 1 file changed, 35 insertions(+), 2 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml
> b/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml
> > index d370c98a62c7..3744ae794c00 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,17 @@ 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.
> > + It also represents the name of ASoC platform driver. This property
>
> That's a Linux detail which doesn't belong in DT.
>
We pass hardware parameters in dts node to set up clocks or other
configurations. These configurations are finally sent to Cortex-M by
rpmsg channel because Cortex-M actually controls real hardware devices.
If there's only one sound card sits on one rpmsg channel we will not
need this property. But if there are several sound cards we need to
specify correct rpmsg channel. Thus hardware configurations can be
properly sent to Cortex-M. From this level to speak, this property is
hardware-related since rpmsg channel represents the real hardware audio
controller.
Here I attach the discussion in version 1 patches for your information:
---
This property aims to tell the ASoC driver which rpmsg channel the
sound card depends on. If there are several sound cards sit on rpmsg,
we should pass correct information in dts node to specify the name of
rpmsg channel. That is why I meant to add this property.
Actually this property is hardware-related. As we discussed before,
this kind of sound card based on rpmsg works under this mechanism
Cortex-A core tells the Cortex-M core configuration of the PCM
parameters then Cortex-M controls real hardware devices. This property
specifying rpmsg channel represents the real hardware audio controller.
---
That's my idea adding this property. Do you have any suggstion?
Regards,
Chancel Liu
> > + 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 +121,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
> >
> >
On 23/09/2022 11:56, Chancel Liu wrote:
>>> Add a string property to assign the rpmsg channel this sound card sits
>>> on. It also represents the name of ASoC platform driver. This property
>>> can be omitted if there is only one sound card and it sits on
>>> "rpmsg-audio-channel".
>>>
>>> Signed-off-by: Chancel Liu <[email protected]>
>>> ---
>>> .../devicetree/bindings/sound/fsl,rpmsg.yaml | 37 ++++++++++++++++++-
>>> 1 file changed, 35 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml
>> b/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml
>>> index d370c98a62c7..3744ae794c00 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,17 @@ 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.
>>> + It also represents the name of ASoC platform driver. This property
>>
>> That's a Linux detail which doesn't belong in DT.
>>
>
> We pass hardware parameters in dts node to set up clocks or other
> configurations. These configurations are finally sent to Cortex-M by
> rpmsg channel because Cortex-M actually controls real hardware devices.
> If there's only one sound card sits on one rpmsg channel we will not
> need this property. But if there are several sound cards we need to
> specify correct rpmsg channel. Thus hardware configurations can be
> properly sent to Cortex-M. From this level to speak, this property is
> hardware-related since rpmsg channel represents the real hardware audio
> controller.
>
> Here I attach the discussion in version 1 patches for your information:
> ---
> This property aims to tell the ASoC driver which rpmsg channel the
> sound card depends on. If there are several sound cards sit on rpmsg,
> we should pass correct information in dts node to specify the name of
> rpmsg channel. That is why I meant to add this property.
>
> Actually this property is hardware-related. As we discussed before,
> this kind of sound card based on rpmsg works under this mechanism
> Cortex-A core tells the Cortex-M core configuration of the PCM
> parameters then Cortex-M controls real hardware devices. This property
> specifying rpmsg channel represents the real hardware audio controller.
> ---
>
> That's my idea adding this property. Do you have any suggstion?
I think you misunderstood the comment. Rob's comment was directly below
a line which he referred to. That line contained a statement referring
to Linux drivers. Anything related to Linux drivers does not belong to DT.
Best regards,
Krzysztof
> >>> Add a string property to assign the rpmsg channel this sound card sits
> >>> on. It also represents the name of ASoC platform driver. This property
> >>> can be omitted if there is only one sound card and it sits on
> >>> "rpmsg-audio-channel".
> >>>
> >>> Signed-off-by: Chancel Liu <[email protected]>
> >>> ---
> >>> .../devicetree/bindings/sound/fsl,rpmsg.yaml | 37
> ++++++++++++++++++-
> >>> 1 file changed, 35 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml
> >> b/Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml
> >>> index d370c98a62c7..3744ae794c00 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,17 @@ 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.
> >>> + It also represents the name of ASoC platform driver. This property
> >>
> >> That's a Linux detail which doesn't belong in DT.
> >>
> >
> > We pass hardware parameters in dts node to set up clocks or other
> > configurations. These configurations are finally sent to Cortex-M by
> > rpmsg channel because Cortex-M actually controls real hardware devices.
> > If there's only one sound card sits on one rpmsg channel we will not
> > need this property. But if there are several sound cards we need to
> > specify correct rpmsg channel. Thus hardware configurations can be
> > properly sent to Cortex-M. From this level to speak, this property is
> > hardware-related since rpmsg channel represents the real hardware audio
> > controller.
> >
> > Here I attach the discussion in version 1 patches for your information:
> > ---
> > This property aims to tell the ASoC driver which rpmsg channel the
> > sound card depends on. If there are several sound cards sit on rpmsg,
> > we should pass correct information in dts node to specify the name of
> > rpmsg channel. That is why I meant to add this property.
> >
> > Actually this property is hardware-related. As we discussed before,
> > this kind of sound card based on rpmsg works under this mechanism
> > Cortex-A core tells the Cortex-M core configuration of the PCM
> > parameters then Cortex-M controls real hardware devices. This property
> > specifying rpmsg channel represents the real hardware audio controller.
> > ---
> >
> > That's my idea adding this property. Do you have any suggstion?
>
> I think you misunderstood the comment. Rob's comment was directly below
> a line which he referred to. That line contained a statement referring
> to Linux drivers. Anything related to Linux drivers does not belong to DT.
>
>
> Best regards,
> Krzysztof
Thanks for explaining the meaning and giving more details. I will
delete the statement referring to linux drivers. Indeed this property
is designed to assign the rpmsg channel name.
Does it look better if I modify the code like this:
+ 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
Regards,
Chancel Liu