Alsa-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Tony Lindgren <tony@atomide.com>
Cc: alsa-devel@alsa-project.org, linux-omap@vger.kernel.org,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Aaro Koskinen <aaro.koskinen@iki.fi>,
	linux-kernel@vger.kernel.org, Merlijn Wajer <merlijn@wizzup.org>,
	Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Pavel Machek <pavel@ucw.cz>,
	Sebastian Reichel <sre@kernel.org>,
	"Arthur D ." <spinal.by@gmail.com>,
	Jarkko Nikula <jarkko.nikula@bitmer.com>
Subject: Re: [alsa-devel] [PATCH] ASoC: ti: Allocate dais dynamically for TDM and audio graph card
Date: Mon, 17 Feb 2020 14:09:54 +0200
Message-ID: <d9a43fcb-ed0f-5cd5-7e22-58924d571d17@ti.com> (raw)
In-Reply-To: <20200214170322.GZ64767@atomide.com>

Hi Tony,

On 14/02/2020 19.03, Tony Lindgren wrote:
> * Peter Ujfalusi <peter.ujfalusi@ti.com> [200214 12:42]:
>> Hi Tony,
>>
>> On 12/02/2020 16.35, Tony Lindgren wrote:
>>> * Peter Ujfalusi <peter.ujfalusi@ti.com> [200212 08:02]:
>>>>
>>>>
>>>> On 11/02/2020 19.16, Tony Lindgren wrote:
>>>>> We can have multiple connections on a single McBSP instance configured
>>>>> with audio graph card when using TDM (Time Division Multiplexing). Let's
>>>>> allow that by configuring dais dynamically.
>>>>
>>>> It is still one DAI...
>>>> If you have multiple codec connected to the same I2S lines, but the
>>>> codecs communicate within different time slots, you still have one DAI
>>>> on the CPU side, but multiple codecs (codec DAIs) with different TDM slot.
>>>
>>> OK so subject should say "dodec DAIs" then I guess?
>>>
>>>>> See Documentation/devicetree/bindings/sound/audio-graph-card.txt and
>>>>> Documentation/devicetree/bindings/graph.txt for more details for
>>>>> multiple endpoints.
>>>>
>>>> See the example for 'Multi DAI with DPCM' in audio-graph-card.txt
>>>> The PCM3168a have 2 DAIs: playback and capture, but you can have
>>>> multiple endpoints within a DAI.
>>>
>>> Yes this should follow the audio-graph-card.txt example. We end up with
>>> mcbsp3 dts node as below on droid4:
>>>
>>> &mcbsp3 {
>>>         #sound-dai-cells = <0>;
>>>         pinctrl-names = "default";
>>>         pinctrl-0 = <&mcbsp3_pins>;
>>>         status = "okay";
>>>
>>>         ports {
>>>                 mcbsp3_port: port@0 {
>>>                         #address-cells = <1>;
>>>                         #size-cells = <0>;
>>>
>>>                         cpu_dai3: endpoint@0 {
>>>                                 reg = <0>;
>>>                                 dai-format = "dsp_a";
>>>                                 frame-master = <&cpcap_audio_codec1>;
>>>                                 bitclock-master = <&cpcap_audio_codec1>;
>>>                                 remote-endpoint = <&cpcap_audio_codec1>;
>>>                         };
>>>
>>>                         cpu_dai_mdm: endpoint@1 {
>>>                                 reg = <1>;
>>>                                 dai-format = "dsp_a";
>>>                                 frame-master = <&cpcap_audio_codec1>;
>>>                                 bitclock-master = <&cpcap_audio_codec1>;
>>>                                 remote-endpoint = <&mot_mdm6600_audio_codec0>;
>>>                         };
>>>                 };
>>>         };
>>> };
>>
>> According to
>> Documentation/devicetree/bindings/sound/audio-graph-card.txt
>> it should be something like this:
>> &mcbsp3 {
>>         #sound-dai-cells = <0>;
>>         pinctrl-names = "default";
>>         pinctrl-0 = <&mcbsp3_pins>;
>>         status = "okay";
>>
>>         ports {
>> 		#address-cells = <1>;
>> 		#size-cells = <0>;
>>                 port@0 {
>> 			reg = <0>;
>>
>> 			cpu_dai3: endpoint@0 {
>> 				dai-format = "dsp_a";
>> 				frame-master = <&cpcap_audio_codec1>;
>> 				bitclock-master = <&cpcap_audio_codec1>;
>> 				remote-endpoint = <&cpcap_audio_codec1>;
>> 			};
>>
>> 			cpu_dai_mdm: endpoint@1 {
>> 				dai-format = "dsp_a";
>> 				frame-master = <&cpcap_audio_codec1>;
>> 				bitclock-master = <&cpcap_audio_codec1>;
>> 				remote-endpoint = <&mot_mdm6600_audio_codec0>;
>> 			};
>> 		};
>> 	};
>> };
> 
> Hmms so I only spot reg use at different level changing above. Well
> that's not according to Documentation/devicetree/bindings/graph.txt,
> the reg numbering is per endpoint.
> 
> Sounds like the we have the example not following graph.txt in
> Documentation/devicetree/bindings/sound/audio-graph-card.txt while
> the code is now behaving as in graph.txt.
> 
>> If you span out dummy DAIs got dai1+ then how you will get anything
>> working via endpoint1+?
>> There will be no ops for McBSP, so it is not going to do anything...
> 
> Eventually it could have ops though. For things like capture of the tdm
> slot data for recording audio call for example, I don't know how that's
> supposed to work though. I guess mcbsp could be the clock master too,
> and for those cases it would have ops.
> 
> But right now in droid4 voice call case mcbsp is just the i2s transport,
> and everything happens betwee the modem and the cpcap pmic.

Iow you don't need McBSP DAI at all. If you would have added the dummy
codec to McBSP !3 and use that, it would work in a same way, or to DMIC
or McPDM...

The McBSP ops are NULL for the dummy dai, so McBSP is turned off.

> 
>>> That is pretty much the same as the 'Multi DAI with DPCM' example, with
>>> dne dai, and multiple endpoints. I think we still have just one port
>>> for one i2s transport on the mcbsp :)
>>>
>>> Does the above look as what you would expect based on the binding?
>>
>> The audio-graph-card.txt example shows pcm3168a which have two DAIs,
>> one for playback and one for capture.
>>
>> I guess Morimoto-san can explain if he carries out of tree patches to
>> get the described setup working on top of mainline...
>>
>> But, no, based on the documentation I don't ;)
> 
> Sounds like audio-graph-card.txt is just out of sync with graph.txt
> as we do have several working examples?
> 
>>>>> I've tested this with droid4 where cpcap pmic and modem voice are both
>>>>> both wired to mcbsp3. I've also tested this on droid4 both with and
>>>>> without the pending modem audio codec driver that is waiting for n_gsm
>>>>> serdev dependencies to clear.
>>>>
>>>> What this patch you effectively just creating dummy-dais on top of the
>>>> real McBSP DAI.
>>>
>>> Yes I think this is needed for snd-soc-audio-graph-card, and this allows
>>> configuring whatever is needed for the i2s slot. But maybe you have some
>>> better way of doing it in mind?
>>>
>>>> You also rename the DAIs, which might break ams-delta.
>>>
>>> Oops, that's not good. So should we just keep the old naming if there's
>>> only one endpoint?
>>
>> That's an option, yes, if we really need extra dummy McBSP DAIs at all,
>> again, let's hear from Morimoto-san or Mark.
> 
> Well it would not necessarily be a dummy mcbsp dai in all cases it seems
> to me. But yeah nothing for the second dai to do right now for droid4
> voice call as it's all between the modem and the pmic.
> 
>>>> We still have legacy support in
>>>> omap-twl4030.c
>>>> omap3pandora.c
>>>> osk5912.c
>>>> rx51.c
>>>>
>>>> which will break with the renamed DAI. On the other hand I think the
>>>> legacy support can be dropped from them.
>>>
>>> I'm not sure what all that would take.
>>
>> For some it should not be a big deal as they only boot in DT mode.
>> /me adds this to the TODO list.
> 
> OK
> 
>>>> I know it was discussed, but can not find the mail:
>>>> Can you brief again on the audio connection?
>>>
>>> Below is a link to a mailing list thread where Sebastian describes
>>> the audio connection:
>>>
>>> https://lkml.org/lkml/2018/3/28/881
>>
>> Thanks!
>>  
>>>> Do you have branch with working code?
>>>
>>> Yeah I have slightly older set of the patches in my droid4-pending-v5.5
>>> kernel.org git branch with voice calls working.
>>
>> I think I should put my droid4 out and try to get it working...
>> Do you have a link for dummies to follow to get started? ;)
> 
> Probably the easiest one to use right now is the Maemo-leste devuan based
> test image using v5.5 kernel + modem and audio patches:
> 
> https://leste.maemo.org/Motorola_Droid_4
> 
> Just use a decent speed micro-sd card rated "a1" for example.

Cool. Now I can dual boot the droid4 :D
I needed to rewrite the /etc/shadow to get a known root password so I
can log in.

Wifi is up, so in theory I can scp kernel/dtb to /boot/boot/ and update
the /boot/boot/boot.cfg to boot my kernel, right?

> Regards,
> 
> Tony
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply index

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-11 17:16 Tony Lindgren
2020-02-12  8:02 ` Peter Ujfalusi
2020-02-12 14:35   ` Tony Lindgren
2020-02-14  0:34     ` Sebastian Reichel
2020-02-14  1:34       ` Tony Lindgren
2020-02-14 13:04         ` Sebastian Reichel
2020-02-14 17:09           ` Tony Lindgren
2020-02-18 14:04             ` Sebastian Reichel
2020-02-18 14:19               ` Tony Lindgren
2020-02-18 16:35                 ` Sebastian Reichel
2020-02-14 12:41     ` [alsa-devel] " Peter Ujfalusi
2020-02-14 12:49       ` Mark Brown
2020-02-14 17:05         ` Tony Lindgren
2020-02-14 20:05           ` Mark Brown
2020-02-14 17:03       ` Tony Lindgren
2020-02-17  1:38         ` Kuninori Morimoto
2020-02-17  5:25           ` Kuninori Morimoto
2020-02-17 12:09         ` Peter Ujfalusi [this message]
2020-02-17 23:10           ` Tony Lindgren
2020-02-17 23:36             ` Tony Lindgren
2020-02-18 15:26               ` Peter Ujfalusi
2020-02-18 15:34                 ` Tony Lindgren
2020-02-18 12:43             ` Peter Ujfalusi
2020-02-18 15:28               ` Tony Lindgren
2020-02-20 14:07                 ` Peter Ujfalusi
2020-02-20 20:13                   ` Tony Lindgren
2020-02-21 14:07                     ` Peter Ujfalusi
2020-02-18 21:16               ` Sebastian Reichel
2020-02-20 14:15                 ` Peter Ujfalusi
2020-02-20 20:15                   ` Tony Lindgren
2020-02-21 13:20                     ` Peter Ujfalusi
2020-02-21 18:08                       ` Tony Lindgren
2020-02-20 20:47                   ` Sebastian Reichel

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=d9a43fcb-ed0f-5cd5-7e22-58924d571d17@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jarkko.nikula@bitmer.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=merlijn@wizzup.org \
    --cc=pavel@ucw.cz \
    --cc=spinal.by@gmail.com \
    --cc=sre@kernel.org \
    --cc=tiwai@suse.com \
    --cc=tony@atomide.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

Alsa-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/alsa-devel/0 alsa-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 alsa-devel alsa-devel/ https://lore.kernel.org/alsa-devel \
		alsa-devel@alsa-project.org
	public-inbox-index alsa-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.alsa-project.alsa-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git