Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Stephen Gordon <gordoste@iinet.net.au>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Mark Brown <broonie@kernel.org>,
	Shenghao Ding <shenghao-ding@ti.com>, Kevin Lu <kevin-lu@ti.com>,
	Baojun Xu <baojun.xu@ti.com>, Liam Girdwood <lgirdwood@gmail.com>,
	linux-sound@vger.kernel.org
Subject: Re: [PATCH v2] ASoC: pcm3168a: Add option to force clock consumer
Date: Mon, 9 Dec 2024 23:12:58 +1100	[thread overview]
Message-ID: <20241209231258.22f3902f@rpi5> (raw)
In-Reply-To: <878qspobvg.wl-kuninori.morimoto.gx@renesas.com>

[-- Attachment #1: Type: text/plain, Size: 1994 bytes --]

On Mon, 9 Dec 2024 01:58:59 +0000
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> 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







[-- Attachment #2: dbgout.txt --]
[-- Type: text/plain, Size: 2692 bytes --]

[  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

[-- Attachment #3: dt_snippet.txt --]
[-- Type: text/plain, Size: 1626 bytes --]

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


  reply	other threads:[~2024-12-09 12:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03 12:01 [PATCH] ASoC: pcm3168a: Add option to force clock consumer Stephen Gordon
2024-12-06 11:54 ` [PATCH v2] " Stephen Gordon
2024-12-06 12:07   ` Mark Brown
2024-12-06 12:22   ` Mark Brown
2024-12-06 13:16     ` Stephen Gordon
2024-12-06 14:13       ` Mark Brown
2024-12-07  1:52         ` Stephen Gordon
2024-12-09  1:58           ` Kuninori Morimoto
2024-12-09 12:12             ` Stephen Gordon [this message]
2024-12-10  2:40               ` Kuninori Morimoto
2024-12-12  1:54                 ` Stephen Gordon
2024-12-13  5:10                   ` Kuninori Morimoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241209231258.22f3902f@rpi5 \
    --to=gordoste@iinet.net.au \
    --cc=baojun.xu@ti.com \
    --cc=broonie@kernel.org \
    --cc=kevin-lu@ti.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=shenghao-ding@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox