From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Subject: [PATCH v4 4/9] ASoC: simple-card-utils: enable "label" on asoc_simple_card_parse_card_name Date: Mon, 13 Mar 2017 05:53:12 +0000 Message-ID: <87zigphgjq.wl%kuninori.morimoto.gx@renesas.com> References: <8760jdivfm.wl%kuninori.morimoto.gx@renesas.com> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <8760jdivfm.wl%kuninori.morimoto.gx@renesas.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Mark Brown , Rob Herring Cc: Linux-DT , Linux-ALSA , Simon List-Id: devicetree@vger.kernel.org From: Kuninori Morimoto Current asoc_simple_card_parse_card_name() detect [prefix]name, but in generally, we uses "label" for user visible names. This patch expand it to [prefix]label. This patch also update simple-xx-card.txt which is using this feature Signed-off-by: Kuninori Morimoto --- v3 -> v4 - new patch to expand name/labal .../devicetree/bindings/sound/simple-card.txt | 1 + .../devicetree/bindings/sound/simple-scu-card.txt | 1 + sound/soc/generic/simple-card-utils.c | 18 ++++++++++++++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt index c7a9393..f34a810 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.txt +++ b/Documentation/devicetree/bindings/sound/simple-card.txt @@ -8,6 +8,7 @@ Required properties: Optional properties: +- simple-audio-card,label : see simple-audio-card,name - simple-audio-card,name : User specified audio sound card name, one string property. - simple-audio-card,widgets : Please refer to widgets.txt. diff --git a/Documentation/devicetree/bindings/sound/simple-scu-card.txt b/Documentation/devicetree/bindings/sound/simple-scu-card.txt index d6fe47e..01eb56e 100644 --- a/Documentation/devicetree/bindings/sound/simple-scu-card.txt +++ b/Documentation/devicetree/bindings/sound/simple-scu-card.txt @@ -9,6 +9,7 @@ Required properties: Optional properties: +- simple-audio-card,label : see simple-audio-card,name - simple-audio-card,name : User specified audio sound card name, one string property. - simple-audio-card,cpu : CPU sub-node diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 4924575..4dfd9a2 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -82,14 +82,24 @@ int asoc_simple_card_parse_card_name(struct snd_soc_card *card, char *prefix) { char prop[128]; + char *names[] = { + "label", "name" + }; + int i; int ret; - snprintf(prop, sizeof(prop), "%sname", prefix); + if (!prefix) + prefix = ""; /* Parse the card name from DT */ - ret = snd_soc_of_parse_card_name(card, prop); - if (ret < 0) - return ret; + for (i = 0; i < ARRAY_SIZE(names); i++) { + snprintf(prop, sizeof(prop), "%s%s", prefix, names[i]); + ret = snd_soc_of_parse_card_name(card, prop); + if (ret < 0) + return ret; + if (card->name) + break; + } if (!card->name && card->dai_link) card->name = card->dai_link->name; -- 1.9.1