Simple-card without codec for testing purpose
diff mbox

Message ID 5652E348.8080002@invoxia.com
State New
Headers show

Commit Message

Arnaud Mouiche Nov. 23, 2015, 9:58 a.m. UTC
To answer to myself:
- there are some "virtual" codecs available : "bt-sco", 
"linux,spdif-dit" and "linux,spdif-dir". but none of them is fully generic.
- a "snd-soc-dummy-dai" codec is implemented in soc-utils.c. yet, no 
device-tree bindings are available, except if a patch like the following 
one is applied

      .remove = snd_soc_dummy_remove,



Once done, here is a DTS example for imx6sl:

&audmux {
     ssi3 {
         fsl,audmux-port = <6>;
         fsl,port-config = <
#ifdef SSI_TEST_MASTER
             0x00000000
#else
             (IMX_AUDMUX_V2_PTCR_TFSDIR |
             IMX_AUDMUX_V2_PTCR_TFSEL(4) |
             IMX_AUDMUX_V2_PTCR_TCLKDIR |
             IMX_AUDMUX_V2_PTCR_TCSEL(4))
#endif
             IMX_AUDMUX_V2_PDCR_RXDSEL(4)
         >;
     };

     port5 {
         fsl,audmux-port = <4>;
         fsl,port-config = <
#ifdef SSI_TEST_MASTER
             (IMX_AUDMUX_V2_PTCR_TFSDIR |
             IMX_AUDMUX_V2_PTCR_TFSEL(6) |
             IMX_AUDMUX_V2_PTCR_TCLKDIR |
             IMX_AUDMUX_V2_PTCR_TCSEL(6))
#else
             0x00000000
#endif
             IMX_AUDMUX_V2_PDCR_RXDSEL(6)
         >;
     };
};


&ssi3 {
     status = "okay";

     // select the a clock parent suitable for 48000 Hz sampling rate
     assigned-clocks = <&clks IMX6SL_CLK_SSI3_SEL>, <&clks IMX6SL_CLK_SSI3>;
     assigned-clock-parents = <&clks IMX6SL_CLK_PLL4_AUDIO_DIV>;
     assigned-clock-rates = <0>, <49152000>;
};

/ {
     codec_test: codec_test {
         compatible = "linux,snd-soc-dummy";
         #sound-dai-cells = <0>;
     };


     sound@2 {
         compatible = "simple-audio-card";
         simple-audio-card,name = "test";
         simple-audio-card,format="dsp_a";

#ifdef SSI_TEST_MASTER
         simple-audio-card,frame-master = <&sound2_ssi>;
         simple-audio-card,bitclock-master = <&sound2_ssi>;
#else
         simple-audio-card,frame-master = <&codec_test>;
         simple-audio-card,bitclock-master = <&codec_test>;
#endif
             sound2_ssi: simple-audio-card,cpu {
                 sound-dai = <&ssi3>;
                 system-clock-frequency = <1536000>;
                 dai-tdm-slot-num = <2>;
                 dai-tdm-slot-width = <16>;
             };
             sound2codec: simple-audio-card,codec {
                 sound-dai = <&codec_test>;
             };
     };

};




Le 20/11/2015 02:24, Caleb Crome a écrit :
> I've been wondering about that too. I don't know how to do it easily.
>
> -Caleb
>
>
> On Thu, Nov 19, 2015 at 9:26 AM, arnaud.mouiche@invoxia.com
> <arnaud.mouiche@invoxia.com> wrote:
>> Hello,
>>
>> I'm starting debugging / testing all the fsl_ssi issues (see Caleb's
>> previous post).
>>
>> First step I just need to setup a DTS entry for  "simple-card" + fake codec
>> to generate arbitrary PCM bus output (1 to 16 channels, various TDM, various
>> sampling rate and format and master/slave role)
>> I will then plug my logical analyser, or do some loopback, or plug a FPGA to
>> generate/check some patterns.
>>
>> Is there such "fake codec" somewhere.  Indeed, something that look like the
>> bt-sco codec, but without rate/format/channel limitations ?
>> Or does the "simple-card" even needs one ?
>>
>> Regards,
>> Arnaud

Comments

Caleb Crome Nov. 24, 2015, 3:38 p.m. UTC | #1
Great, I'll integrate this into my testing setup so I don't need an
external codec.

BTW, I have a github fork at
https://github.com/ccrome/linux-caleb-dev/tree/linux-mx6-working-branch,
which has my patches in it.  Some patches are generic SSI related
stuff, and others are specific hacks (like in the tms320aic3x.c file)
for my hardware.  I'll separate those out at some point to I have a
clean set of patches that may be applied.

-Caleb


On Mon, Nov 23, 2015 at 1:58 AM, arnaud.mouiche@invoxia.com
<arnaud.mouiche@invoxia.com> wrote:
>
> To answer to myself:
> - there are some "virtual" codecs available : "bt-sco", "linux,spdif-dit" and "linux,spdif-dir". but none of them is fully generic.
> - a "snd-soc-dummy-dai" codec is implemented in soc-utils.c. yet, no device-tree bindings are available, except if a patch like the following one is applied
>
> --- a/sound/soc/soc-utils.c
> +++ b/sound/soc/soc-utils.c
> @@ -19,6 +19,7 @@
>  #include <sound/pcm.h>
>  #include <sound/pcm_params.h>
>  #include <sound/soc.h>
> +#include <linux/module.h>
>
>  int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots)
>  {
> @@ -151,9 +152,18 @@ static int snd_soc_dummy_remove(struct platform_device *pdev)
>      return 0;
>  }
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id soc_dummy_ids[] = {
> +    { .compatible = "linux,snd-soc-dummy", },
> +    { }
> +};
> +MODULE_DEVICE_TABLE(of, soc_dummy_ids);
> +#endif
> +
>  static struct platform_driver soc_dummy_driver = {
>      .driver = {
>          .name = "snd-soc-dummy",
> +        .of_match_table = of_match_ptr(soc_dummy_ids),
>      },
>      .probe = snd_soc_dummy_probe,
>      .remove = snd_soc_dummy_remove,
>
>
>
> Once done, here is a DTS example for imx6sl:
>
> &audmux {
>     ssi3 {
>         fsl,audmux-port = <6>;
>         fsl,port-config = <
> #ifdef SSI_TEST_MASTER
>             0x00000000
> #else
>             (IMX_AUDMUX_V2_PTCR_TFSDIR |
>             IMX_AUDMUX_V2_PTCR_TFSEL(4) |
>             IMX_AUDMUX_V2_PTCR_TCLKDIR |
>             IMX_AUDMUX_V2_PTCR_TCSEL(4))
> #endif
>             IMX_AUDMUX_V2_PDCR_RXDSEL(4)
>         >;
>     };
>
>     port5 {
>         fsl,audmux-port = <4>;
>         fsl,port-config = <
> #ifdef SSI_TEST_MASTER
>             (IMX_AUDMUX_V2_PTCR_TFSDIR |
>             IMX_AUDMUX_V2_PTCR_TFSEL(6) |
>             IMX_AUDMUX_V2_PTCR_TCLKDIR |
>             IMX_AUDMUX_V2_PTCR_TCSEL(6))
> #else
>             0x00000000
> #endif
>             IMX_AUDMUX_V2_PDCR_RXDSEL(6)
>         >;
>     };
> };
>
>
> &ssi3 {
>     status = "okay";
>
>     // select the a clock parent suitable for 48000 Hz sampling rate
>     assigned-clocks = <&clks IMX6SL_CLK_SSI3_SEL>, <&clks IMX6SL_CLK_SSI3>;
>     assigned-clock-parents = <&clks IMX6SL_CLK_PLL4_AUDIO_DIV>;
>     assigned-clock-rates = <0>, <49152000>;
> };
>
> / {
>     codec_test: codec_test {
>         compatible = "linux,snd-soc-dummy";
>         #sound-dai-cells = <0>;
>     };
>
>
>     sound@2 {
>         compatible = "simple-audio-card";
>         simple-audio-card,name = "test";
>         simple-audio-card,format="dsp_a";
>
> #ifdef SSI_TEST_MASTER
>         simple-audio-card,frame-master = <&sound2_ssi>;
>         simple-audio-card,bitclock-master = <&sound2_ssi>;
> #else
>         simple-audio-card,frame-master = <&codec_test>;
>         simple-audio-card,bitclock-master = <&codec_test>;
> #endif
>             sound2_ssi: simple-audio-card,cpu {
>                 sound-dai = <&ssi3>;
>                 system-clock-frequency = <1536000>;
>                 dai-tdm-slot-num = <2>;
>                 dai-tdm-slot-width = <16>;
>             };
>             sound2codec: simple-audio-card,codec {
>                 sound-dai = <&codec_test>;
>             };
>     };
>
> };
>
>
>
>
>
> Le 20/11/2015 02:24, Caleb Crome a écrit :
>>
>> I've been wondering about that too. I don't know how to do it easily.
>>
>> -Caleb
>>
>>
>> On Thu, Nov 19, 2015 at 9:26 AM, arnaud.mouiche@invoxia.com
>> <arnaud.mouiche@invoxia.com> wrote:
>>>
>>> Hello,
>>>
>>> I'm starting debugging / testing all the fsl_ssi issues (see Caleb's
>>> previous post).
>>>
>>> First step I just need to setup a DTS entry for  "simple-card" + fake codec
>>> to generate arbitrary PCM bus output (1 to 16 channels, various TDM, various
>>> sampling rate and format and master/slave role)
>>> I will then plug my logical analyser, or do some loopback, or plug a FPGA to
>>> generate/check some patterns.
>>>
>>> Is there such "fake codec" somewhere.  Indeed, something that look like the
>>> bt-sco codec, but without rate/format/channel limitations ?
>>> Or does the "simple-card" even needs one ?
>>>
>>> Regards,
>>> Arnaud
>
>

Patch
diff mbox

--- a/sound/soc/soc-utils.c
+++ b/sound/soc/soc-utils.c
@@ -19,6 +19,7 @@ 
  #include <sound/pcm.h>
  #include <sound/pcm_params.h>
  #include <sound/soc.h>
+#include <linux/module.h>

  int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots)
  {
@@ -151,9 +152,18 @@  static int snd_soc_dummy_remove(struct 
platform_device *pdev)
      return 0;
  }

+#ifdef CONFIG_OF
+static const struct of_device_id soc_dummy_ids[] = {
+    { .compatible = "linux,snd-soc-dummy", },
+    { }
+};
+MODULE_DEVICE_TABLE(of, soc_dummy_ids);
+#endif
+
  static struct platform_driver soc_dummy_driver = {
      .driver = {
          .name = "snd-soc-dummy",
+        .of_match_table = of_match_ptr(soc_dummy_ids),
      },
      .probe = snd_soc_dummy_probe,