From patchwork Mon Mar 14 08:07:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liam Girdwood X-Patchwork-Id: 8577271 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C01DEC0553 for ; Mon, 14 Mar 2016 08:09:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CC09B2045A for ; Mon, 14 Mar 2016 08:09:33 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 6F172203FB for ; Mon, 14 Mar 2016 08:09:32 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6459B2651C9; Mon, 14 Mar 2016 09:09:31 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 50C7A2614D4; Mon, 14 Mar 2016 09:08:11 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id B041E261AD0; Mon, 14 Mar 2016 09:08:10 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by alsa0.perex.cz (Postfix) with ESMTP id 590772614BB for ; Mon, 14 Mar 2016 09:08:04 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 14 Mar 2016 01:08:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,334,1455004800"; d="scan'208";a="909697348" Received: from sbianti-mobl.mp.intel.com (HELO loki.ger.corp.intel.com) ([10.252.24.40]) by orsmga001.jf.intel.com with ESMTP; 14 Mar 2016 01:08:02 -0700 From: Liam Girdwood To: Date: Mon, 14 Mar 2016 08:07:36 +0000 Message-Id: <1457942858-5652-3-git-send-email-liam.r.girdwood@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1457942858-5652-1-git-send-email-liam.r.girdwood@linux.intel.com> References: <1457942858-5652-1-git-send-email-liam.r.girdwood@linux.intel.com> Cc: Takashi Iwai , Liam Girdwood Subject: [alsa-devel] [PATCH] topology: add support for pasring external ops in conf files X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);