[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240408184041.3jcav5tabxiblpn4@CAB-WSD-L081021>
Date: Mon, 8 Apr 2024 21:40:41 +0300
From: Dmitry Rokosov <ddrokosov@...utedevices.com>
To: Jerome Brunet <jbrunet@...libre.com>
CC: <neil.armstrong@...aro.org>, <lgirdwood@...il.com>, <broonie@...nel.org>,
<conor+dt@...nel.org>, <robh+dt@...nel.org>,
<krzysztof.kozlowski+dt@...aro.org>, <perex@...ex.cz>, <tiwai@...e.com>,
<khilman@...libre.com>, <martin.blumenstingl@...glemail.com>,
<kernel@...utedevices.com>, <rockosov@...il.com>,
<linux-amlogic@...ts.infradead.org>, <alsa-devel@...a-project.org>,
<linux-sound@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v1 2/2] ASoC: meson: implement link-name optional
property in meson card utils
On Mon, Apr 08, 2024 at 08:15:54PM +0200, Jerome Brunet wrote:
>
> On Mon 08 Apr 2024 at 19:49, Dmitry Rokosov <ddrokosov@...utedevices.com> wrote:
>
> > The 'link-name' property presents an optional DT feature that empowers
> > users to customize the name associated with the DAI link and PCM stream.
> > This functionality reflects the approach often employed in Qualcomm
> > audio cards, providing enhanced flexibility in DAI naming conventions
> > for improved system integration and userspace experience.
> >
> > It allows userspace program to easy determine PCM stream purpose, e.g.:
> > ~ # cat /proc/asound/pcm
> > 00-00: speaker (*) : : playback 1
> > 00-01: mics (*) : : capture 1
> > 00-02: loopback (*) : : capture 1
>
> The example above is exactly what you should not do with link names, at
> least with the amlogic audio system.
>
> Userspace pcm, otherwise known as DPCM frontend, are merely that:
> frontends. What they do is entirely defined by the routing defined by
> the userspace (amixer and friends)
>
> So naming the interface in DT (the FW describing the HW) after what the
> the userspace SW could possibly set later on is wrong.
>
> Bottom line: I have mixed feeling about this change. It could allow all
> sort of bad names to be set.
>
> The only way it could make sense HW wise is if the only allowed names
> where (fr|to)ddr_[abcd], which could help maps the interface and the
> kcontrol.
>
> Such restriction should be documented in the binding doc.
>
The link-name is an optional parameter. Yes, you are right, it can be
routed in a way that it no longer functions as a speaker in most cases.
However, if you plan to use your board's dt for common purposes, you
should not change the common names for DAI links. But if you know that
you have a static setup for speakers, microphones, loopback, or other
references (you 100% know it, because you are HW developer of this
board), why not help the user understand the PCM device assignment in
the easiest way?
Ultimately, it is the responsibility of the DT board developer to define
specific DAIs and name them based on their own knowledge about HW and
understanding of the board's usage purposes.
> >
> > The previous naming approach using auto-generated fe or be strings
> > continues to be utilized as a fallback.
> >
> > Signed-off-by: Dmitry Rokosov <ddrokosov@...utedevices.com>
> > ---
> > sound/soc/meson/meson-card-utils.c | 12 ++++++++----
> > 1 file changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-card-utils.c
> > index ed6c7e2f609c..7bae72905a9b 100644
> > --- a/sound/soc/meson/meson-card-utils.c
> > +++ b/sound/soc/meson/meson-card-utils.c
> > @@ -94,10 +94,14 @@ static int meson_card_set_link_name(struct snd_soc_card *card,
> > struct device_node *node,
> > const char *prefix)
> > {
> > - char *name = devm_kasprintf(card->dev, GFP_KERNEL, "%s.%s",
> > - prefix, node->full_name);
> > - if (!name)
> > - return -ENOMEM;
> > + const char *name;
> > +
> > + if (of_property_read_string(node, "link-name", &name)) {
> > + name = devm_kasprintf(card->dev, GFP_KERNEL, "%s.%s",
> > + prefix, node->full_name);
> > + if (!name)
> > + return -ENOMEM;
> > + }
> >
> > link->name = name;
> > link->stream_name = name;
>
>
> --
> Jerome
--
Thank you,
Dmitry
Powered by blists - more mailing lists