From patchwork Tue Jun 6 14:42:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liam Girdwood X-Patchwork-Id: 9768999 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7D2D160364 for ; Tue, 6 Jun 2017 14:43:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B718223B2 for ; Tue, 6 Jun 2017 14:43:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60174284A8; Tue, 6 Jun 2017 14:43:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D5272849E for ; Tue, 6 Jun 2017 14:43:53 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 30EAB266EB6; Tue, 6 Jun 2017 16:43:34 +0200 (CEST) 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 6D668266EB1; Tue, 6 Jun 2017 16:43:31 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by alsa0.perex.cz (Postfix) with ESMTP id 42DAE266EAF for ; Tue, 6 Jun 2017 16:43:28 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jun 2017 07:43:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,306,1493708400"; d="scan'208";a="96174418" Received: from tlandman-mobl.ger.corp.intel.com (HELO loki.ger.corp.intel.com) ([10.252.15.29]) by orsmga002.jf.intel.com with ESMTP; 06 Jun 2017 07:43:17 -0700 From: Liam Girdwood To: Takashi Iwai Date: Tue, 6 Jun 2017 15:42:57 +0100 Message-Id: <1496760178-6028-2-git-send-email-liam.r.girdwood@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1496760178-6028-1-git-send-email-liam.r.girdwood@linux.intel.com> References: <1496760178-6028-1-git-send-email-liam.r.girdwood@linux.intel.com> Cc: Liam Girdwood , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 2/3] topology: Add support for missing fields in parser. 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 The parser is missing some fields for certain objects that are part of the ABI. This patch adds the missing fields to the parser. Signed-off-by: Liam Girdwood --- src/topology/pcm.c | 183 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) diff --git a/src/topology/pcm.c b/src/topology/pcm.c index daef20e4..0f4deb4f 100644 --- a/src/topology/pcm.c +++ b/src/topology/pcm.c @@ -383,6 +383,49 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, tplg_dbg("\t\t%s: %d\n", id, sc->channels_max); continue; } + + if (strcmp(id, "periods_min") == 0) { + sc->periods_min = atoi(val); + tplg_dbg("\t\t%s: %d\n", id, sc->periods_min); + continue; + } + + if (strcmp(id, "periods_max") == 0) { + sc->periods_max = atoi(val); + tplg_dbg("\t\t%s: %d\n", id, sc->periods_max); + continue; + } + + if (strcmp(id, "period_size_min") == 0) { + sc->period_size_min = atoi(val); + tplg_dbg("\t\t%s: %d\n", id, sc->period_size_min); + continue; + } + + if (strcmp(id, "period_size_max") == 0) { + sc->period_size_max = atoi(val); + tplg_dbg("\t\t%s: %d\n", id, sc->period_size_max); + continue; + } + + if (strcmp(id, "buffer_size_min") == 0) { + sc->buffer_size_min = atoi(val); + tplg_dbg("\t\t%s: %d\n", id, sc->buffer_size_min); + continue; + } + + if (strcmp(id, "buffer_size_max") == 0) { + sc->buffer_size_max = atoi(val); + tplg_dbg("\t\t%s: %d\n", id, sc->buffer_size_max); + continue; + } + + if (strcmp(id, "sig_bits") == 0) { + sc->sig_bits = atoi(val); + tplg_dbg("\t\t%s: %d\n", id, sc->sig_bits); + continue; + } + } return 0; @@ -572,6 +615,17 @@ int tplg_parse_pcm(snd_tplg_t *tplg, continue; } + if (strcmp(id, "compress") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + if (strcmp(val, "true") == 0) + pcm->compress = 1; + + tplg_dbg("\t%s: %s\n", id, val); + continue; + } + if (strcmp(id, "dai") == 0) { err = tplg_parse_compound(tplg, n, tplg_parse_fe_dai, elem); @@ -655,6 +709,26 @@ int tplg_parse_dai(snd_tplg_t *tplg, continue; } + if (strcmp(id, "playback") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + dai->playback = atoi(val); + tplg_dbg("\t%s: %d\n", id, dai->playback); + continue; + } + + + if (strcmp(id, "capture") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + dai->capture = atoi(val); + tplg_dbg("\t%s: %d\n", id, dai->capture); + continue; + } + + /* stream capabilities */ if (strcmp(id, "pcm") == 0) { err = tplg_parse_compound(tplg, n, @@ -997,6 +1071,23 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, continue; } + if (strcmp(id, "bclk_freq") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->bclk_rate = atoi(val); + continue; + } + + if (strcmp(id, "bclk_invert") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + if (!strcmp(val, "true")) + hw_cfg->invert_bclk = true; + continue; + } + if (strcmp(id, "fsync") == 0) { if (snd_config_get_string(n, &val) < 0) return -EINVAL; @@ -1005,6 +1096,98 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, hw_cfg->fsync_master = true; continue; } + + if (strcmp(id, "fsync_invert") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + if (!strcmp(val, "true")) + hw_cfg->invert_fsync = true; + continue; + } + + if (strcmp(id, "fsync_freq") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->fsync_rate = atoi(val); + continue; + } + + if (strcmp(id, "mclk_freq") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->mclk_rate = atoi(val); + continue; + } + + if (strcmp(id, "mclk") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + if (!strcmp(val, "master")) + hw_cfg->mclk_direction = true; + continue; + } + + if (strcmp(id, "pm_gate_clocks") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + if (!strcmp(val, "true")) + hw_cfg->clock_gated = true; + continue; + } + + if (strcmp(id, "tdm_slots") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->tdm_slots = atoi(val); + continue; + } + + if (strcmp(id, "tdm_slot_width") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->tdm_slot_width = atoi(val); + continue; + } + + if (strcmp(id, "tx_slots") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->tx_slots = atoi(val); + continue; + } + + if (strcmp(id, "rx_slots") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->rx_slots = atoi(val); + continue; + } + + if (strcmp(id, "tx_channels") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->tx_channels = atoi(val); + continue; + } + + if (strcmp(id, "rx_channels") == 0) { + if (snd_config_get_string(n, &val) < 0) + return -EINVAL; + + hw_cfg->rx_channels = atoi(val); + continue; + } + } return 0;