alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [alsa-devel] Question about FE & BE DPCM
@ 2019-10-11 21:05 Daniel Baluta
  2019-10-11 21:56 ` Sridharan, Ranjani
  2019-10-15  1:15 ` Kuninori Morimoto
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Baluta @ 2019-10-11 21:05 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Sridharan, Ranjani

Hi Morimoto-san,

I'm really confused on what exactly is Front End and Back End.

Is FE a DAI or a DAI link or part of a DAI link?

In simple-card.c there is simple_dai_link_of_dpcm function:

struct snd_soc_dai_link_component *codecs = dai_link->codecs;

»       /* BE is dummy */
»       »       codecs->of_node»»       = NULL;
»       »       codecs->dai_name»       = "snd-soc-dummy-dai";
»       »       codecs->name»   »       = "snd-soc-dummy";

»       »       /* FE settings */
»       »       dai_link->dynamic»      »       = 1;
»       »       dai_link->dpcm_merged_format»   = 1;

So, from here it looks like BE/FE are components being part of the same link.

Another thing is:

asoc_simple_canonicalize_platform function where it does say:

»        * DPCM BE can be no platform.
»        * Alloced memory will be waste, but not leak.
»        */
»       if (!dai_link->platforms->of_node)
»       »       dai_link->num_platforms = 0;

But I do want to create a BE with a platform. So, should I try to
revert the following
patch:

commit 794fcee8da3c0c8a01b08ecad1c181cb0a622868
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Wed Jul 10 17:01:12 2019 +0900

    ASoC: simple-card-utils: care no Platform for DPCM

    commit 34614739988ad ("ASoC: soc-core: support dai_link with
    platforms_num != 1") supports multi Platform, and
    commit 9f3eb91753451 ("ASoC: simple-card-utils: consider CPU-Platform
    possibility") removed no Platform from simple-card.

    Multi Platform is now checking both Platform name/of_node are NULL case.
    But in normal case, DPCM be doesn't have Platform.



Basically, what I want to do is: after the DAI link is created to call:
snd_soc_fixup_dai_links_platform_name function to set a proper name
for BE platform.

The problem is that above mentioned patch sets dai_link->num_platforms = 0;
so even the name is set the platform component is not probed.

thanks,
Daniel.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [alsa-devel] Question about FE & BE DPCM
  2019-10-11 21:05 [alsa-devel] Question about FE & BE DPCM Daniel Baluta
@ 2019-10-11 21:56 ` Sridharan, Ranjani
  2019-10-12  9:20   ` Daniel Baluta
  2019-10-15  1:15 ` Kuninori Morimoto
  1 sibling, 1 reply; 5+ messages in thread
From: Sridharan, Ranjani @ 2019-10-11 21:56 UTC (permalink / raw)
  To: Daniel Baluta; +Cc: Linux-ALSA, Kuninori Morimoto

On Fri, Oct 11, 2019 at 2:05 PM Daniel Baluta <daniel.baluta@gmail.com>
wrote:

> Hi Morimoto-san,
>
> I'm really confused on what exactly is Front End and Back End.
>
> Is FE a DAI or a DAI link or part of a DAI link?
>
> In simple-card.c there is simple_dai_link_of_dpcm function:
>
> struct snd_soc_dai_link_component *codecs = dai_link->codecs;
>
> »       /* BE is dummy */
> »       »       codecs->of_node»»       = NULL;
> »       »       codecs->dai_name»       = "snd-soc-dummy-dai";
> »       »       codecs->name»   »       = "snd-soc-dummy";
>
> »       »       /* FE settings */
> »       »       dai_link->dynamic»      »       = 1;
> »       »       dai_link->dpcm_merged_format»   = 1;
>
> So, from here it looks like BE/FE are components being part of the same
> link.
>
> Another thing is:
>
> asoc_simple_canonicalize_platform function where it does say:
>
> »        * DPCM BE can be no platform.
> »        * Alloced memory will be waste, but not leak.
> »        */
> »       if (!dai_link->platforms->of_node)
> »       »       dai_link->num_platforms = 0;
>
> But I do want to create a BE with a platform. So, should I try to
> revert the following
> patch:
>
> commit 794fcee8da3c0c8a01b08ecad1c181cb0a622868
> Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Date:   Wed Jul 10 17:01:12 2019 +0900
>
>     ASoC: simple-card-utils: care no Platform for DPCM
>
>     commit 34614739988ad ("ASoC: soc-core: support dai_link with
>     platforms_num != 1") supports multi Platform, and
>     commit 9f3eb91753451 ("ASoC: simple-card-utils: consider CPU-Platform
>     possibility") removed no Platform from simple-card.
>
>     Multi Platform is now checking both Platform name/of_node are NULL
> case.
>     But in normal case, DPCM be doesn't have Platform.
>
>
>
> Basically, what I want to do is: after the DAI link is created to call:
> snd_soc_fixup_dai_links_platform_name function to set a proper name
> for BE platform.
>
> The problem is that above mentioned patch sets dai_link->num_platforms = 0;
> so even the name is set the platform component is not probed.


Hi Daniel,
Have you looked into how SOF does it at the time the dai_link elem in
topology is parsed?
https://github.com/thesofproject/linux/blob/5edcfdf3907354de7a260a451ba611f22c5e6a07/sound/soc/sof/topology.c#L2926

Is this what you are asking about?

Thanks,
Ranjani

>
> thanks,
> Daniel.
>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [alsa-devel] Question about FE & BE DPCM
  2019-10-11 21:56 ` Sridharan, Ranjani
@ 2019-10-12  9:20   ` Daniel Baluta
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Baluta @ 2019-10-12  9:20 UTC (permalink / raw)
  To: Sridharan, Ranjani; +Cc: Linux-ALSA, Kuninori Morimoto

On Sat, Oct 12, 2019 at 12:57 AM Sridharan, Ranjani
<ranjani.sridharan@intel.com> wrote:
>
>
>
> On Fri, Oct 11, 2019 at 2:05 PM Daniel Baluta <daniel.baluta@gmail.com> wrote:
>>
>> Hi Morimoto-san,
>>
>> I'm really confused on what exactly is Front End and Back End.
>>
>> Is FE a DAI or a DAI link or part of a DAI link?
>>
>> In simple-card.c there is simple_dai_link_of_dpcm function:
>>
>> struct snd_soc_dai_link_component *codecs = dai_link->codecs;
>>
>> »       /* BE is dummy */
>> »       »       codecs->of_node»»       = NULL;
>> »       »       codecs->dai_name»       = "snd-soc-dummy-dai";
>> »       »       codecs->name»   »       = "snd-soc-dummy";
>>
>> »       »       /* FE settings */
>> »       »       dai_link->dynamic»      »       = 1;
>> »       »       dai_link->dpcm_merged_format»   = 1;
>>
>> So, from here it looks like BE/FE are components being part of the same link.
>>
>> Another thing is:
>>
>> asoc_simple_canonicalize_platform function where it does say:
>>
>> »        * DPCM BE can be no platform.
>> »        * Alloced memory will be waste, but not leak.
>> »        */
>> »       if (!dai_link->platforms->of_node)
>> »       »       dai_link->num_platforms = 0;
>>
>> But I do want to create a BE with a platform. So, should I try to
>> revert the following
>> patch:
>>
>> commit 794fcee8da3c0c8a01b08ecad1c181cb0a622868
>> Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>> Date:   Wed Jul 10 17:01:12 2019 +0900
>>
>>     ASoC: simple-card-utils: care no Platform for DPCM
>>
>>     commit 34614739988ad ("ASoC: soc-core: support dai_link with
>>     platforms_num != 1") supports multi Platform, and
>>     commit 9f3eb91753451 ("ASoC: simple-card-utils: consider CPU-Platform
>>     possibility") removed no Platform from simple-card.
>>
>>     Multi Platform is now checking both Platform name/of_node are NULL case.
>>     But in normal case, DPCM be doesn't have Platform.
>>
>>
>>
>> Basically, what I want to do is: after the DAI link is created to call:
>> snd_soc_fixup_dai_links_platform_name function to set a proper name
>> for BE platform.
>>
>> The problem is that above mentioned patch sets dai_link->num_platforms = 0;
>> so even the name is set the platform component is not probed.
>
>
> Hi Daniel,
> Have you looked into how SOF does it at the time the dai_link elem in topology is parsed?
> https://github.com/thesofproject/linux/blob/5edcfdf3907354de7a260a451ba611f22c5e6a07/sound/soc/sof/topology.c#L2926
>
> Is this what you are asking about?

Hi Ranjani,

Not really. Due to this patch:

Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Wed Jul 10 17:01:12 2019 +0900

    ASoC: simple-card-utils: care no Platform for DPCM

I cannot probe platform component created by SOF.

Even if I set the correct name for BE's platform name because the
above patch sets
 dai_link->num_platforms = 0 the platform component won't be probed.
So, the topology won't be loaded.

I don't understand the full story here. There are these 3 patches:

(3) 794fcee8da3c ASoC: simple-card-utils: care no Platform for DPCM
(2) 9f3eb9175345 ASoC: simple-card-utils: consider CPU-Platform possibility
(1) 6f0437445735 ASoC: simple-card-utils: don't select unnecessary Platform

which I think they are doing as follows:

(1) Allows a DAI link to have no platform component attached.
(2) There is an usecase where Platform can't be NULL. So, if
platform->of_node is NULL
then is set to platforms->of_node = cpus->of_node.
(3) Now, the problem with patch (2) is when also cpus->of_node is
NULL. In this case
platforms->of_node becomes NULL. And the platforms is
left unspecified (because platforms->name is also NULL). So, I think
(3) is just an
workaround by setting link->num_platforms the function soc_bind_dai_link will
actually skip iterating over platforms.

My suggestion is that asoc_simple_canonicalize_platform should also
check if platform has a name
and in that case to skip zeroing dai_link->num_platforms.

Will send an RFC.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [alsa-devel] Question about FE & BE DPCM
  2019-10-11 21:05 [alsa-devel] Question about FE & BE DPCM Daniel Baluta
  2019-10-11 21:56 ` Sridharan, Ranjani
@ 2019-10-15  1:15 ` Kuninori Morimoto
  2019-11-01 21:41   ` Daniel Baluta
  1 sibling, 1 reply; 5+ messages in thread
From: Kuninori Morimoto @ 2019-10-15  1:15 UTC (permalink / raw)
  To: Daniel Baluta; +Cc: Linux-ALSA, Sridharan, Ranjani


Hi Daniel

> »       /* BE is dummy */
> »       »       codecs->of_node»»       = NULL;
> »       »       codecs->dai_name»       = "snd-soc-dummy-dai";
> »       »       codecs->name»   »       = "snd-soc-dummy";
> 
> »       »       /* FE settings */
> »       »       dai_link->dynamic»      »       = 1;
> »       »       dai_link->dpcm_merged_format»   = 1;

Ahh, indeed... it is wrong comment.
It should be /* Codec is dummy */ here.
I will post fixup patch, soon.

Current simple-card is assuming

	FE: CPU-dummy
	BE: dummy-Codec

> asoc_simple_canonicalize_platform function where it does say:
> 
> »        * DPCM BE can be no platform.
> »        * Alloced memory will be waste, but not leak.
> »        */
> »       if (!dai_link->platforms->of_node)
> »       »       dai_link->num_platforms = 0;
> 
> But I do want to create a BE with a platform. So, should I try to
> revert the following

I see.
I'm not using but someone added asoc_simple_parse_platform().
Maybe it can help you (?), but it is not called/used under DPCM case.
If you can support it under DPCM, asoc_simple_canonicalize_platform()
is no longer your issue ?

Thank you for your help !!
Best regards
---
Kuninori Morimoto
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [alsa-devel] Question about FE & BE DPCM
  2019-10-15  1:15 ` Kuninori Morimoto
@ 2019-11-01 21:41   ` Daniel Baluta
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Baluta @ 2019-11-01 21:41 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Sridharan, Ranjani

On Tue, Oct 15, 2019 at 4:15 AM Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
>
>
> Hi Daniel
>
> > »       /* BE is dummy */
> > »       »       codecs->of_node»»       = NULL;
> > »       »       codecs->dai_name»       = "snd-soc-dummy-dai";
> > »       »       codecs->name»   »       = "snd-soc-dummy";
> >
> > »       »       /* FE settings */
> > »       »       dai_link->dynamic»      »       = 1;
> > »       »       dai_link->dpcm_merged_format»   = 1;
>
> Ahh, indeed... it is wrong comment.
> It should be /* Codec is dummy */ here.
> I will post fixup patch, soon.
>
> Current simple-card is assuming
>
>         FE: CPU-dummy
>         BE: dummy-Codec
>
> > asoc_simple_canonicalize_platform function where it does say:
> >
> > »        * DPCM BE can be no platform.
> > »        * Alloced memory will be waste, but not leak.
> > »        */
> > »       if (!dai_link->platforms->of_node)
> > »       »       dai_link->num_platforms = 0;
> >
> > But I do want to create a BE with a platform. So, should I try to
> > revert the following
>
> I see.
> I'm not using but someone added asoc_simple_parse_platform().
> Maybe it can help you (?), but it is not called/used under DPCM case.
> If you can support it under DPCM, asoc_simple_canonicalize_platform()
> is no longer your issue ?

Yes, this would definitely help. Now I'm trying to figure out an acceptable
way to create just one link with:

FE: CPU-dummy
BE: dummy-Codec

Or even better just one:

BE: dummy-Codec.

Both audio-graph-card.c and simple-card.c deal with DPCM only with
this conditions:

»       »       »       /*
»       »       »        * It is DPCM
»       »       »        * if Codec port has many endpoints,
»       »       »        * or has convert-xxx property
»       »       »        */

or

»       »       »       if (dpcm_selectable &&
»       »       »           (num > 2 ||
»       »       »            adata.convert_rate || adata.convert_channels))
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-11-01 21:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-11 21:05 [alsa-devel] Question about FE & BE DPCM Daniel Baluta
2019-10-11 21:56 ` Sridharan, Ranjani
2019-10-12  9:20   ` Daniel Baluta
2019-10-15  1:15 ` Kuninori Morimoto
2019-11-01 21:41   ` Daniel Baluta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).