Re: [PATCH v2] ASoC: pcm3168a: Add option to force clock consumer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Mon, 9 Dec 2024 01:58:59 +0000
Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx> wrote:

> Hi Stephen
> 
> > > You should use one of the audio-graph-card bindings for anything
> > > new.  
> 
> Using audio-graph-card is good idea, but all
> simple_card/audio-graph-card/audio-graph-card2 are using same logic
> around here. So, you will have same issue on audio-graph-card too.
> 
> > > > Basically, simple_card appears to set the CPU as producer if you
> > > > don't specify a producer. I am not sure whether this is a bug.
> > > >   
> > > 
> > > Well, if nothing is configured it's got to pick a default?  
> 
> If my understand was correct, your issue can be solved...
> 
> 	dailink_out_master: simple-audio-card,dai-link@0 {
> 		...
> =>		pcm3168_playback: codec {  
> 			...
> 		};
> 	};
> 	dailink_in_slave: simple-audio-card,dai-link@1 {
> =>		bitclock-master = <&pcm3168_playback>;
> =>		frame-master    = <&pcm3168_playback>;  
> 		...
> 	};
> 
> asoc_simple_parse_daifmt() is just checking where the node was codec
> node or not. So, if bitclock-master/frame-master were produced, but
> was not codec, both CPU/Codec can be consumer ?
> 
> # Clock producer/consumer settings is very confusable, because it was
> # Codec base, and has flip, etc...
> 
> Thank you for your help !!
> 
> Best regards
> ---
> Kuninori Morimoto

Hi Morimoto-san,

This is one of the things I tried initially, but I wasn't sure if it
was a valid configuration. 

I just tried it again with debug enabled (see dt_snippet.txt) and I get
the attached (see dbgout.txt) in dmesg.

It is trying to set the CPU end as producer. I think it's because
asoc_simple_parse_daifmt() checks whether the bit/frame phandles passed
match the codec phandle - since it doesn't (it's a different codec),
it sets the DAI link as "consumer mode" (i.e. clocks come from CPU).
Therefore, the CPU side gets configured as producer.

I am using the  version from 6.12.3 as that is the latest I can
build.

Regards
Stephen






[  688.239375] asoc-simple-card soc@107c000000:sound: link 2, dais 4, ccnf 0
[  688.239394] asoc-simple-card soc@107c000000:sound: link_of (/soc@107c000000/sound/simple-audio-card,dai-link@1)
[  688.267041] asoc-simple-card soc@107c000000:sound: link 2, dais 4, ccnf 0
[  688.267057] asoc-simple-card soc@107c000000:sound: link_of (/soc@107c000000/sound/simple-audio-card,dai-link@1)
[  688.267103] asoc-simple-card soc@107c000000:sound: link_of (/soc@107c000000/sound/simple-audio-card,dai-link@0)
[  688.267128] asoc-simple-card soc@107c000000:sound: Card Name: i2smulti
[  688.267131] asoc-simple-card soc@107c000000:sound: DAI0
[  688.267133] asoc-simple-card soc@107c000000:sound: cpu num = 1
[  688.267136] asoc-simple-card soc@107c000000:sound: cpu slots = 2
[  688.267138] asoc-simple-card soc@107c000000:sound: cpu slot width = 32
[  688.267141] asoc-simple-card soc@107c000000:sound: cpu sysclk = 50000000Hz
[  688.267143] asoc-simple-card soc@107c000000:sound: cpu direction = IN
[  688.267145] asoc-simple-card soc@107c000000:sound: codec num = 1
[  688.267147] asoc-simple-card soc@107c000000:sound: codec slots = 2
[  688.267149] asoc-simple-card soc@107c000000:sound: codec slot width = 32
[  688.267151] asoc-simple-card soc@107c000000:sound: codec sysclk = 24576000Hz
[  688.267153] asoc-simple-card soc@107c000000:sound: codec direction = IN
[  688.267155] asoc-simple-card soc@107c000000:sound: dai name = 1f000a4000.i2s-pcm3168a-adc
[  688.267157] asoc-simple-card soc@107c000000:sound: dai format = 4001
[  688.267160] asoc-simple-card soc@107c000000:sound: DAI1
[  688.267162] asoc-simple-card soc@107c000000:sound: cpu num = 1
[  688.267164] asoc-simple-card soc@107c000000:sound: cpu slots = 2
[  688.267166] asoc-simple-card soc@107c000000:sound: cpu slot width = 32
[  688.267168] asoc-simple-card soc@107c000000:sound: cpu sysclk = 50000000Hz
[  688.267170] asoc-simple-card soc@107c000000:sound: cpu direction = IN
[  688.267172] asoc-simple-card soc@107c000000:sound: codec num = 1
[  688.267174] asoc-simple-card soc@107c000000:sound: codec slots = 2
[  688.267175] asoc-simple-card soc@107c000000:sound: codec slot width = 32
[  688.267177] asoc-simple-card soc@107c000000:sound: codec sysclk = 24576000Hz
[  688.267179] asoc-simple-card soc@107c000000:sound: codec direction = IN
[  688.267181] asoc-simple-card soc@107c000000:sound: dai name = 1f000a4000.i2s-pcm3168a-dac
[  688.267183] asoc-simple-card soc@107c000000:sound: dai format = 1001
[  688.267424] designware-i2s 1f000a4000.i2s: ASoC: error at snd_soc_dai_set_fmt on 1f000a4000.i2s: -22
[  688.267596] asoc-simple-card soc@107c000000:sound: probe with driver asoc-simple-card failed with error -22
    fragment@2 {
        target = <&sound>;
        __overlay__ {
            compatible = "simple-audio-card";
            #address-cells = <1>;
            #size-cells = <0>;
            i2s-controller = <&i2s_clk_consumer>;
            status="okay";

            simple-audio-card,name = "i2smulti";
            simple-audio-card,format = "i2s";

            dailink_out_master: simple-audio-card,dai-link@0 {
                reg = <0>;
                format = "i2s";
                bitclock-master = <&pcm3168_playback>;
                frame-master = <&pcm3168_playback>;
                cpu  {
                    sound-dai = <&i2s_clk_consumer>;
                    dai-tdm-slot-num = <2>;
                    dai-tdm-slot-width = <32>;
                };
                pcm3168_playback: codec {
                    sound-dai = <&pcm3168a 0>;
                    dai-tdm-slot-num = <2>;
                    dai-tdm-slot-width = <32>;
                };
            };
            dailink_in_slave: simple-audio-card,dai-link@1 {
                reg = <1>;
                format = "i2s";
                bitclock-master = <&pcm3168_playback>;
                frame-master = <&pcm3168_playback>;
                cpu  {
                    sound-dai = <&i2s_clk_consumer>;
                    dai-tdm-slot-num = <2>;
                    dai-tdm-slot-width = <32>;
                };
                pcm3168_capture: codec {
                    sound-dai = <&pcm3168a 1>;
                    dai-tdm-slot-num = <2>;
                    dai-tdm-slot-width = <32>;
                };
             };
        };
    };


[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux