All of lore.kernel.org
 help / color / mirror / Atom feed
From: Piotr Maziarz <piotrx.maziarz@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: cezary.rojewski@intel.com, amadeuszx.slawinski@intel.com
Subject: [PATCH v3 04/10] topology: decode: Add enum control texts as separate element
Date: Tue, 14 Jul 2020 13:25:05 +0200	[thread overview]
Message-ID: <1594725911-14308-5-git-send-email-piotrx.maziarz@linux.intel.com> (raw)
In-Reply-To: <1594725911-14308-1-git-send-email-piotrx.maziarz@linux.intel.com>

Texts are separate sections that should referenced by enum control.

Signed-off-by: Piotr Maziarz <piotrx.maziarz@linux.intel.com>
---
 src/topology/ctl.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/topology/ctl.c b/src/topology/ctl.c
index 02e482e..1f39846 100644
--- a/src/topology/ctl.c
+++ b/src/topology/ctl.c
@@ -1088,11 +1088,19 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl,
 	}
 
 	if (enum_ctl->texts != NULL) {
+		struct tplg_elem *texts = tplg_elem_new_common(tplg, NULL,
+						enum_ctl->hdr.name, SND_TPLG_TYPE_TEXT);
+
+		texts->texts->num_items = num_items;
 		for (i = 0; i < num_items; i++) {
-			if (enum_ctl->texts[i] != NULL)
-				snd_strlcpy(ec->texts[i], enum_ctl->texts[i],
-					    SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
+			if (!enum_ctl->texts[i])
+				continue;
+			snd_strlcpy(ec->texts[i], enum_ctl->texts[i],
+				    SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
+			snd_strlcpy(texts->texts->items[i], enum_ctl->texts[i],
+				    SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
 		}
+		tplg_ref_add(elem, SND_TPLG_TYPE_TEXT, enum_ctl->hdr.name);
 	}
 
 	if (enum_ctl->values != NULL) {
-- 
2.7.4


  parent reply	other threads:[~2020-07-14 12:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14 11:25 [PATCH v3 00/10] topology: decode: Various fixes Piotr Maziarz
2020-07-14 11:25 ` [PATCH v3 01/10] topology: decode: Fix channel map memory allocation Piotr Maziarz
2020-07-14 11:25 ` [PATCH v3 02/10] topology: decode: Fix infinite loop in decoding enum control Piotr Maziarz
2020-07-14 11:25 ` [PATCH v3 03/10] topology: decode: Remove decoding values for " Piotr Maziarz
2020-07-14 11:25 ` Piotr Maziarz [this message]
2020-07-14 11:25 ` [PATCH v3 05/10] topology: decode: Fix printing texts section Piotr Maziarz
2020-07-14 11:25 ` [PATCH v3 06/10] topology: decode: Change declaration of enum decoding function Piotr Maziarz
2020-07-14 11:25 ` [PATCH v3 07/10] topology: decode: Fix decoding PCM formats and rates Piotr Maziarz
2020-07-14 15:40   ` Pierre-Louis Bossart
2020-07-15  9:37     ` Piotr Maziarz
2020-07-15 14:37       ` Pierre-Louis Bossart
2020-07-15 16:18         ` Cezary Rojewski
2020-07-14 11:25 ` [PATCH v3 08/10] topology: decode: Print sig_bits field in PCM capabilities section Piotr Maziarz
2020-07-14 11:25 ` [PATCH v3 09/10] topology: decode: Add DAI name printing Piotr Maziarz
2020-07-14 11:25 ` [PATCH v3 10/10] topology: Make buffer for saving dynamic size Piotr Maziarz
2020-07-15 14:47 ` [PATCH v3 00/10] topology: decode: Various fixes Pierre-Louis Bossart
2020-07-15 16:20 ` Cezary Rojewski

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=1594725911-14308-5-git-send-email-piotrx.maziarz@linux.intel.com \
    --to=piotrx.maziarz@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@intel.com \
    --cc=cezary.rojewski@intel.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.