From: Liam Girdwood Subject: [PATCH] topology: Add support for widget byte controls Date: Mon, 14 Mar 2016 08:07:38 +0000 Message-ID: <1457942858-5652-5-git-send-email-liam.r.girdwood@linux.intel.com> References: <1457942858-5652-1-git-send-email-liam.r.girdwood@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by alsa0.perex.cz (Postfix) with ESMTP id 351F7261A96 for ; Mon, 14 Mar 2016 09:08:09 +0100 (CET) In-Reply-To: <1457942858-5652-1-git-send-email-liam.r.girdwood@linux.intel.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: alsa-devel@alsa-project.org Cc: Takashi Iwai , Liam Girdwood List-Id: alsa-devel@alsa-project.org Add support for DAPM widgets to include bytes controls. Signed-off-by: Liam Girdwood --- src/topology/dapm.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/topology/dapm.c b/src/topology/dapm.c index 14969ee..278d605 100644 --- a/src/topology/dapm.c +++ b/src/topology/dapm.c @@ -103,6 +103,28 @@ static int tplg_parse_dapm_enums(snd_config_t *cfg, struct tplg_elem *elem) return 0; } +static int tplg_parse_dapm_bytes(snd_config_t *cfg, struct tplg_elem *elem) +{ + snd_config_iterator_t i, next; + snd_config_t *n; + const char *value = NULL; + + tplg_dbg(" DAPM Bytes Controls: %s\n", elem->id); + + snd_config_for_each(i, next, cfg) { + n = snd_config_iterator_entry(i); + + /* get value */ + if (snd_config_get_string(n, &value) < 0) + continue; + + tplg_ref_add(elem, SND_TPLG_TYPE_BYTES, value); + tplg_dbg("\t\t %s\n", value); + } + + return 0; +} + /* move referenced controls to the widget */ static int copy_dapm_control(struct tplg_elem *elem, struct tplg_elem *ref) { @@ -567,6 +589,14 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg, continue; } + if (strcmp(id, "bytes") == 0) { + err = tplg_parse_dapm_bytes(n, elem); + if (err < 0) + return err; + + continue; + } + if (strcmp(id, "data") == 0) { if (snd_config_get_string(n, &val) < 0) return -EINVAL; -- 2.5.0