]> git.alsa-project.org Git - alsa-lib.git/commitdiff
topology: add support for pasring external ops in conf files
authorLiam Girdwood <liam.r.girdwood@linux.intel.com>
Mon, 14 Mar 2016 08:07:36 +0000 (08:07 +0000)
committerTakashi Iwai <tiwai@suse.de>
Mon, 14 Mar 2016 15:56:44 +0000 (16:56 +0100)
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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/topology/ctl.c
src/topology/ops.c
src/topology/tplg_local.h

index a8ac398250c07b90597581b9f4385c8daeefde54..23c196a35764d59ced9b3aae0d9ee2ab5eb23fb9 100644 (file)
@@ -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;
index 243d8c5e2bbcc290cad361cc4c2968fc69d2e1e6..1b5c1e2b6072ab959fb04d5e8bb3873b647b88cf 100644 (file)
@@ -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;
+}
index 5d0cb910d5cbea5f240ef5f68a9d49ea28a2b59b..4915b1a57a62899962ec1def19678822844be849 100644 (file)
@@ -206,6 +206,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);