Received: by 10.213.65.68 with SMTP id h4csp299941imn; Tue, 3 Apr 2018 21:23:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+oYDAi1mBT+FXVBucXFHc6NJrIlDN0St3c2nwuT1PQTBK1FsgWo04zxFTZ80TAlzWo2FHK X-Received: by 10.98.93.20 with SMTP id r20mr12638187pfb.53.1522815784550; Tue, 03 Apr 2018 21:23:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522815784; cv=none; d=google.com; s=arc-20160816; b=WjjyuASFbpzE2YXqpzSgxcP+BaEc/6ZT1gH82M2FpdvLIF2FUZVzEa6UKBiJDIkqkG IYWxhQL24GEIk+M16J9Y4b5HXeBHr67XCc1bzJizupA9vUwZL1NCkhDDsp1MbLIq/rEa +zm7igyVeTDs/25tzm+osrj0ZLQA6iG+R2obCR/S/GMastGGHGBLgc1R5RQ5rF5CZott 5M61wq1LwdEeuA1kSNiDCKy+wB7ENmW6LXv/8CB1KkPGqNczlxMFFSOV1RzH6RId6gmo sjER2ZpyptayN/gQpfvF7QYURY/pOzuubSqK6/ML4higwmBL0qDmLBWb9E6E12iS3ILc dDWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=GBeoubRVPJw57j9kcdrJziBlzJqGUCrTYb8GNNGNuAQ=; b=NXA67iIFqDUwajGIYZ1NtTec4mn8P+PwaK117KNw+HCZcxSfynYmYf+l4Ne658Q6Ik NkjscTJRMHP/2sTOPdc5t95/b0saCC1Ac5G/EqLs9x/8wFNm0AE6giqahaMZ0YReVZ/y DFQsyJixVLWhdbgsPHjDCikuym8YMSopywPyEfwUL6w4jTERbVCYF8uvB3cDCSXyqp2b I3KGHPra/Yviqbb7TDGFmpnkeYFlpkHErBTR5Bca3grQQga9yRgGxa6UTN17IvxGZdxq Cq002Ys0n8fbRbqsib2k7w2SOMLpVKZRl0PcgqQpP5nmndR5S8tHIxYynaRDlHd/Xf6l yk0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Guh0lLiq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1si3009891pgv.736.2018.04.03.21.22.18; Tue, 03 Apr 2018 21:23:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Guh0lLiq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751743AbeDDET3 (ORCPT + 99 others); Wed, 4 Apr 2018 00:19:29 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:53578 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751559AbeDDET1 (ORCPT ); Wed, 4 Apr 2018 00:19:27 -0400 Received: by mail-wm0-f66.google.com with SMTP id p9so37335970wmc.3 for ; Tue, 03 Apr 2018 21:19:26 -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=GBeoubRVPJw57j9kcdrJziBlzJqGUCrTYb8GNNGNuAQ=; b=Guh0lLiq04TRUb/cN0CorRNhe5FdW2EbQ/eFnsvsWab3FOT8s5cqVK/ghELIOvkRu9 FbYq4lOV9ik/DLqNr1ottMjV1gLv234MkWMuQKMfn3DbwsP/5G7HxjLlM6SCZTKDo6az 7vtGRYtcOaoRiixNnZyMGgCSSrpGOVj3UOT7dgxxpXG50rd1SXbX1bLY47mWcAd4NSCl lrAst6v67G8NnAqjcTjhAeibp9b4VD01g3HHYxsiUd2B3yTZtrF3HWSecuKUa7KbKken jjyHgzQ8s6Vt5gomzpfsNL+VS8xIfsUgn9e3LiiDtQomtopGJiIOwVUnH9b5cn5rEVEA tneQ== 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=GBeoubRVPJw57j9kcdrJziBlzJqGUCrTYb8GNNGNuAQ=; b=iKQKVkDD1ho+sc2+SfARMHravtNWoPY30hDjs9S4jVEHt+DuJxHDtXLHcrGH4AwPnd GqNzVNtWrW3z8olW5OVYfNbWLZgBVkWCYACy/cXG0Wi09b+x3LW36d1nszn1cadbMw3m Fvf5XyrduZI+RSPowLKlrcB16lPbTWRbH9fTb7QlFrFxsPttKavlDZgSSiOJTozWkWR1 C5V2NGcow54tPb65oMosinHCs8vsoCATYsDe2oUAS3QVb+F+azfd+1URrnCKHQP6gTsP R2t5z9r0bk31rRiI+9c3is3bcsONY6PZEkm3a3/mVYjengSqiU/hHODhWqkjo9WZvSQ7 iVTg== X-Gm-Message-State: AElRT7HTI9hbV++T4rJy1nGLpKXdX5tUNXOyTKiIps0InDbZA5Dl3u0j UCfaQZ63Q4QUD1MNRS4iHTY= X-Received: by 10.80.166.211 with SMTP id f19mr19178081edc.266.1522815566389; Tue, 03 Apr 2018 21:19:26 -0700 (PDT) Received: from gentoo0.localdomain (x4dba7eb4.dyn.telefonica.de. [77.186.126.180]) by smtp.gmail.com with ESMTPSA id g24sm2866647edj.87.2018.04.03.21.19.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Apr 2018 21:19:25 -0700 (PDT) From: Kirill Marinushkin To: Mark Brown Cc: Pierre-Louis Bossart , Jaroslav Kysela , Takashi Iwai , Pan Xiuli , Liam Girdwood , linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, Kirill Marinushkin Subject: [PATCH v4 2/3] ASoC: topology: Add missing clock gating parameter when parsing hw_configs Date: Wed, 4 Apr 2018 06:19:38 +0200 Message-Id: <20180404041939.23317-3-k.marinushkin@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180404041939.23317-1-k.marinushkin@gmail.com> References: <20180404041939.23317-1-k.marinushkin@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clock gating parameter is a part of `dai_fmt`. It is supported by `alsa-lib` when creating a topology binary file, but ignored by kernel when loading this topology file. After applying this commit, the clock gating parameter is not ignored any more. This solution is backwards compatible. The existing behaviour is not broken, because by default the parameter value is 0 and is ignored. snd_soc_tplg_hw_config.clock_gated = 0 => no effect snd_soc_tplg_hw_config.clock_gated = 1 => SND_SOC_DAIFMT_GATED snd_soc_tplg_hw_config.clock_gated = 2 => SND_SOC_DAIFMT_CONT For example, the following config, based on alsa-lib/src/conf/topology/broadwell/broadwell.conf, is now supported: ~~~~ SectionHWConfig."CodecHWConfig" { id "1" format "I2S" # physical audio format. pm_gate_clocks "true" # clock can be gated } SectionLink."Codec" { # used for binding to the physical link id "0" hw_configs [ "CodecHWConfig" ] default_hw_conf_id "1" } ~~~~ Signed-off-by: Kirill Marinushkin Reviewed-by: Pierre-Louis Bossart Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: Mark Brown Cc: Pan Xiuli Cc: Liam Girdwood Cc: linux-kernel@vger.kernel.org Cc: alsa-devel@alsa-project.org --- include/uapi/sound/asoc.h | 7 ++++++- sound/soc/soc-topology.c | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/uapi/sound/asoc.h b/include/uapi/sound/asoc.h index f0e5e21efa54..f3c4b46e39d8 100644 --- a/include/uapi/sound/asoc.h +++ b/include/uapi/sound/asoc.h @@ -139,6 +139,11 @@ #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) +/* DAI clock gating */ +#define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED 0 +#define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1 +#define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2 + /* DAI physical PCM data formats. * Add new formats to the end of the list. */ @@ -324,7 +329,7 @@ struct snd_soc_tplg_hw_config { __le32 size; /* in bytes of this structure */ __le32 id; /* unique ID - - used to match */ __le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */ - __u8 clock_gated; /* 1 if clock can be gated to save power */ + __u8 clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */ __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */ __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */ __u8 bclk_master; /* SND_SOC_TPLG_BCLK_ value */ diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index c5bdc673b195..04f834e6a6b5 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1981,6 +1981,13 @@ static void set_link_hw_format(struct snd_soc_dai_link *link, link->dai_fmt = hw_config->fmt & SND_SOC_DAIFMT_FORMAT_MASK; + /* clock gating */ + if (hw_config->clock_gated == SND_SOC_TPLG_DAI_CLK_GATE_GATED) + link->dai_fmt |= SND_SOC_DAIFMT_GATED; + else if (hw_config->clock_gated == + SND_SOC_TPLG_DAI_CLK_GATE_CONT) + link->dai_fmt |= SND_SOC_DAIFMT_CONT; + /* clock signal polarity */ invert_bclk = hw_config->invert_bclk; invert_fsync = hw_config->invert_fsync; -- 2.13.6