From patchwork Mon Mar 14 08:07:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liam Girdwood X-Patchwork-Id: 8577291 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 16C499F6E1 for ; Mon, 14 Mar 2016 08:12:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 46BF52045A for ; Mon, 14 Mar 2016 08:12:02 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 0D924203FB for ; Mon, 14 Mar 2016 08:12:01 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id D98CC261584; Mon, 14 Mar 2016 09:11:59 +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 5C495265090; Mon, 14 Mar 2016 09:09:25 +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 A6536265090; Mon, 14 Mar 2016 09:09:24 +0100 (CET) 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) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 14 Mar 2016 01:08:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,334,1455004800"; d="scan'208";a="909697429" 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:08 -0700 From: Liam Girdwood To: Date: Mon, 14 Mar 2016 08:07:38 +0000 Message-Id: <1457942858-5652-5-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 widget byte controls 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 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;