From patchwork Mon Apr 16 18:26:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Marinushkin X-Patchwork-Id: 10343681 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 D6B2C6039A for ; Mon, 16 Apr 2018 18:26:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C798B2855E for ; Mon, 16 Apr 2018 18:26:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC0A227FB3; Mon, 16 Apr 2018 18:26:49 +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=-2.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID 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 E8E962855E for ; Mon, 16 Apr 2018 18:26:48 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 8460B2675DC; Mon, 16 Apr 2018 20:26:37 +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 3E82226760A; Mon, 16 Apr 2018 20:26:35 +0200 (CEST) Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by alsa0.perex.cz (Postfix) with ESMTP id 70C9F267608 for ; Mon, 16 Apr 2018 20:26:33 +0200 (CEST) Received: by mail-wr0-f194.google.com with SMTP id h3so16045242wrh.5 for ; Mon, 16 Apr 2018 11:26:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cIQe8r1RjG+eRTUKKk7SsCufTdJPHkSngq5j6SJMkcI=; b=uUBJrHNB0H7c2lmu5+J4IwqaJ56aT3CsG05b0fzGjfqFHTfTaUqW6hxGgVqtj2rinO M5Epgswwx5kWI03EPfheAiVgFSSpc0DS7LDQTnk2UXVu812DjNsfJAP3Dcjg+cbKJzv2 K+WsNbD8Z35q6lMFMmdfRKJDi397li12VqW0/xsSYqT49ymS6rdvgzwYqeDJ54dJeOU2 E2QghLGJaHKIx16sgYjDUX5xqrNkLrw0VXPDTl3Q5zhbr8Tjy/JYoOOCi9QNO7pstxZ0 qlpXSmXQ4u/GK7FvtBtCu3e73tDRVgFWLaPGnMdUCQhgRq3Gy+OalPytv0Qhmd/e5qT6 5Bzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cIQe8r1RjG+eRTUKKk7SsCufTdJPHkSngq5j6SJMkcI=; b=nbmZHYwKxqqwuOQCuo7gcNOzzjD0lPpbSl7/SfW0RW4uCUao/aN1b6P249ehAoN0UT mL4zGTHCZ5ZBW6y7tHhgOeFBm4e9eFquBw5D0/cQ89sr5UuWo8lEbS88Lwq+vCDhz/+5 PNfgNy8QFBr5Tlz+GeBHWKhZtv0z5m0BsQdCgi3Z72Gun8OUzKkd2zuMtkas0sfFv2GK 4Rs7ET8VzKmbNOUtapm2zrrzcZ5O9rpkQlJquhJA7mGLRpz6et2RZ7ib8PCGGfTFcCQa fqdl/NFk8AdCIasF4lE5SlFs7ehRlkHdfgX5/mq38L/2m0Z4UE7XvzwAXZviM6PYxZMC 8HiQ== X-Gm-Message-State: ALQs6tCS9jC+8i+H5ZAztY+zLjM30xS9xKm73QWCvAU61OVWRAp7MbdU bmftf6xm4D2uL93AT0WXAlE= X-Google-Smtp-Source: AIpwx48F/o1Wx2Rqhp8VTWsTdv0noOuFqUPPb0b3VibffVknsZzFFx/Yz+X5Cd62+Dr6Kq+5x0d7Kg== X-Received: by 10.223.182.133 with SMTP id j5mr4053446wre.10.1523903192871; Mon, 16 Apr 2018 11:26:32 -0700 (PDT) Received: from gentoo0.localdomain (x4e33bf85.dyn.telefonica.de. [78.51.191.133]) by smtp.gmail.com with ESMTPSA id f84sm10819060wmh.44.2018.04.16.11.26.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Apr 2018 11:26:32 -0700 (PDT) From: Kirill Marinushkin To: Takashi Iwai Date: Mon, 16 Apr 2018 20:26:40 +0200 Message-Id: <20180416182641.30312-4-k.marinushkin@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180416182641.30312-1-k.marinushkin@gmail.com> References: <20180416182641.30312-1-k.marinushkin@gmail.com> Cc: alsa-devel@alsa-project.org, Pan Xiuli , Pierre-Louis Bossart , Liam Girdwood , Mark Brown , Kirill Marinushkin Subject: [alsa-devel] [PATCH alsa-lib v4 3/4] ASoC: topology: Add definitions for mclk_direction values 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 Current comment makes not clear the direction of mclk. Previously, similar description caused a misunderstanding for bclk_master and fsync_master. This commit solves the potential confusion the same way it is solved for bclk_master and fsync_master. Signed-off-by: Kirill Marinushkin Acked-by: Pierre-Louis Bossart Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: Mark Brown Cc: Pan Xiuli Cc: Liam Girdwood Cc: alsa-devel@alsa-project.org --- include/sound/asoc.h | 6 +++++- include/topology.h | 2 +- src/topology/pcm.c | 15 +++++++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/include/sound/asoc.h b/include/sound/asoc.h index 297e837c..bb8aec78 100644 --- a/include/sound/asoc.h +++ b/include/sound/asoc.h @@ -140,6 +140,10 @@ #define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1 #define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2 +/* DAI mclk_direction */ +#define SND_SOC_TPLG_MCLK_CO 0 /* for codec, mclk is output */ +#define SND_SOC_TPLG_MCLK_CI 1 /* for codec, mclk is input */ + /* DAI physical PCM data formats. * Add new formats to the end of the list. */ @@ -330,7 +334,7 @@ struct snd_soc_tplg_hw_config { __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */ __u8 bclk_master; /* SND_SOC_TPLG_BCLK_ value */ __u8 fsync_master; /* SND_SOC_TPLG_FSYNC_ value */ - __u8 mclk_direction; /* 0 for input, 1 for output */ + __u8 mclk_direction; /* SND_SOC_TPLG_MCLK_ value */ __le16 reserved; /* for 32bit alignment */ __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */ __le32 bclk_rate; /* BCLK freqency in Hz */ diff --git a/include/topology.h b/include/topology.h index 3793115c..27da7308 100644 --- a/include/topology.h +++ b/include/topology.h @@ -1002,7 +1002,7 @@ struct snd_tplg_hw_config_template { unsigned char invert_fsync; /* 1 for inverted frame clock, 0 for normal */ unsigned char bclk_master; /* SND_SOC_TPLG_BCLK_ value */ unsigned char fsync_master; /* SND_SOC_TPLG_FSYNC_ value */ - unsigned char mclk_direction; /* 0 for input, 1 for output */ + unsigned char mclk_direction; /* SND_SOC_TPLG_MCLK_ value */ unsigned short reserved; /* for 32bit alignment */ unsigned int mclk_rate; /* MCLK or SYSCLK freqency in Hz */ unsigned int bclk_rate; /* BCLK freqency in Hz */ diff --git a/src/topology/pcm.c b/src/topology/pcm.c index b53f6b03..2ce1651b 100644 --- a/src/topology/pcm.c +++ b/src/topology/pcm.c @@ -1223,8 +1223,19 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, if (snd_config_get_string(n, &val) < 0) return -EINVAL; - if (!strcmp(val, "master")) - hw_cfg->mclk_direction = true; + if (!strcmp(val, "master")) { + /* For backwards capability, + * "master" == "for codec, mclk is input" + */ + SNDERR("warning: deprecated mclk value '%s'\n", + val); + + hw_cfg->mclk_direction = SND_SOC_TPLG_MCLK_CI; + } else if (!strcmp(val, "codec_mclk_in")) { + hw_cfg->mclk_direction = SND_SOC_TPLG_MCLK_CI; + } else if (!strcmp(val, "codec_mclk_out")) { + hw_cfg->mclk_direction = SND_SOC_TPLG_MCLK_CO; + } continue; }