All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: Takashi Iwai <tiwai@suse.de>,
	Liam Girdwood <liam.r.girdwood@linux.intel.com>
Subject: [PATCH] topology: add support for pasring external ops in conf files
Date: Mon, 14 Mar 2016 08:07:36 +0000	[thread overview]
Message-ID: <1457942858-5652-3-git-send-email-liam.r.girdwood@linux.intel.com> (raw)
In-Reply-To: <1457942858-5652-1-git-send-email-liam.r.girdwood@linux.intel.com>

Parsing external ops was missing from the conf files but was in the
C API. Fix this now by making sure we also check for external ops.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
---
 src/topology/ctl.c        |  8 ++++++++
 src/topology/ops.c        | 38 ++++++++++++++++++++++++++++++++++++++
 src/topology/tplg_local.h |  2 ++
 3 files changed, 48 insertions(+)

diff --git a/src/topology/ctl.c b/src/topology/ctl.c
index a8ac398..23c196a 100644
--- a/src/topology/ctl.c
+++ b/src/topology/ctl.c
@@ -393,6 +393,14 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg,
 				return err;
 			continue;
 		}
+
+		if (strcmp(id, "extops") == 0) {
+			err = tplg_parse_compound(tplg, n, tplg_parse_ext_ops,
+				be);
+			if (err < 0)
+				return err;
+			continue;
+		}
 	}
 
 	return 0;
diff --git a/src/topology/ops.c b/src/topology/ops.c
index 243d8c5..1b5c1e2 100644
--- a/src/topology/ops.c
+++ b/src/topology/ops.c
@@ -82,3 +82,41 @@ int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
 
 	return 0;
 }
+
+/* Parse External Control operations. Ops can come from standard names above or
+ * bespoke driver controls with numbers >= 256
+ */
+int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
+	snd_config_t *cfg, void *private)
+{
+	snd_config_iterator_t i, next;
+	snd_config_t *n;
+	struct snd_soc_tplg_bytes_control *be = private;
+	const char *id, *value;
+
+	tplg_dbg("\tExt Ops\n");
+
+	snd_config_for_each(i, next, cfg) {
+
+		n = snd_config_iterator_entry(i);
+
+		/* get id */
+		if (snd_config_get_id(n, &id) < 0)
+			continue;
+
+		/* get value - try strings then ints */
+		if (snd_config_get_string(n, &value) < 0)
+			continue;
+
+		if (strcmp(id, "info") == 0)
+			be->ext_ops.info = lookup_ops(value);
+		else if (strcmp(id, "put") == 0)
+			be->ext_ops.put = lookup_ops(value);
+		else if (strcmp(id, "get") == 0)
+			be->ext_ops.get = lookup_ops(value);
+
+		tplg_dbg("\t\t%s = %s\n", id, value);
+	}
+
+	return 0;
+}
diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h
index e66d7f4..84050af 100644
--- a/src/topology/tplg_local.h
+++ b/src/topology/tplg_local.h
@@ -208,6 +208,8 @@ int tplg_parse_channel(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
 
 int tplg_parse_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
 	snd_config_t *cfg, void *private);
+int tplg_parse_ext_ops(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
+	snd_config_t *cfg, void *private);
 
 struct tplg_elem *lookup_pcm_dai_stream(struct list_head *base,
 	const char* id);
-- 
2.5.0

  parent reply	other threads:[~2016-03-14  8:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-14  8:07 [PATCH] topology: fix debug output to print correct "max" value Liam Girdwood
2016-03-14  8:07 ` [PATCH] topology: Add ops to bytes control Liam Girdwood
2016-03-14 15:58   ` Takashi Iwai
2016-03-14  8:07 ` Liam Girdwood [this message]
2016-03-14 15:58   ` [PATCH] topology: add support for pasring external ops in conf files Takashi Iwai
2016-03-14  8:07 ` [PATCH] topology: add support for CTL access flags to config file Liam Girdwood
2016-03-14 15:58   ` Takashi Iwai
2016-03-14  8:07 ` [PATCH] topology: Add support for widget byte controls Liam Girdwood
2016-03-14 15:58   ` Takashi Iwai
2016-03-14 15:56 ` [PATCH] topology: fix debug output to print correct "max" value Takashi Iwai

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=1457942858-5652-3-git-send-email-liam.r.girdwood@linux.intel.com \
    --to=liam.r.girdwood@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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.