[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240314232201.2102178-24-jan.dakinevich@salutedevices.com>
Date: Fri, 15 Mar 2024 02:21:59 +0300
From: Jan Dakinevich <jan.dakinevich@...utedevices.com>
To: Jan Dakinevich <jan.dakinevich@...utedevices.com>, Neil Armstrong
<neil.armstrong@...aro.org>, Jerome Brunet <jbrunet@...libre.com>, Michael
Turquette <mturquette@...libre.com>, Stephen Boyd <sboyd@...nel.org>, Rob
Herring <robh@...nel.org>, Krzysztof Kozlowski
<krzysztof.kozlowski+dt@...aro.org>, Conor Dooley <conor+dt@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>, Kevin Hilman <khilman@...libre.com>,
Martin Blumenstingl <martin.blumenstingl@...glemail.com>, Liam Girdwood
<lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>, Linus Walleij
<linus.walleij@...aro.org>, Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai
<tiwai@...e.com>, <linux-amlogic@...ts.infradead.org>,
<linux-clk@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
<alsa-devel@...a-project.org>, <linux-sound@...r.kernel.org>,
<linux-gpio@...r.kernel.org>
CC: Dmitry Rokosov <ddrokosov@...utedevices.com>, <kernel@...utedevices.com>
Subject: [PATCH 23/25] ASoC: meson: implement link-name optional property in meson card utils
From: Dmitry Rokosov <ddrokosov@...utedevices.com>
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 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;
--
2.34.1
Powered by blists - more mailing lists