Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1114175imm; Wed, 1 Aug 2018 10:24:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfYbEAHE0qqq8GlriqkhEI0w+wIhX3AUxKzw7Eh2Cv8Ej0cgtBkKfPGU+jgYy86r9fy8f4g X-Received: by 2002:a17:902:6b4c:: with SMTP id g12-v6mr25137908plt.159.1533144283993; Wed, 01 Aug 2018 10:24:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144283; cv=none; d=google.com; s=arc-20160816; b=haY3y7bDfsxqPx2r1c+jpzRGKKpJfY5tSTZt5zgohqHci+BY7CVtGV2OgfPH6vvqha knEoAGJ4h2KcTXyG3tAavnV973wcJcGQeXyYymtsHEDYcVBb39GBTKH1zbM7Qw+vN/xL WhyUmbmQsRI14MOEJg3hqBQt1RrdHVu/TBotUb2jgMjBhjy4P56rC9eT3iHgISPXSUYf lOLgv1EIMgHSEIRhp+6jttHepJxba1hfwFG8rxFWjZHsYKfG3ClBwG93aLTGhDr6qchi 4hcIjBSpk+9z+nmC/CY5uYf5MnTrbpUK5BaXgzP18yhubGlka/jl8z3jXc1+nL150vPx sgkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=dmeZAZnASHMijhbEcnUTXZnRUpczih3nxykQAYOzUvU=; b=lSOxRqZZLfsztjXEtbBCVVKXTY+LOGFQqMLm3h0Mgs2cASrIutOpFFPA4LpNmzIexs X3GR7GQzO0Jm8QgBwAzNe22IgoqhgecZZzm/NFscz0m8i0XmJA2Stl/hG2M3QI57LRUm lakWXoptaCdQ/VUSeokD86y2KlRkrxUkV34UZKdF3SGp7SpnNMlIch12ixKiNSR78lsI jGg76jSHkWac1XsUTRbUEMX5GZhWVo+v0qfoPdrJ+lQGJzhVc17Ufmk5y0CVMXl5ec+D 075F/esEYhE3D1GyNzr+Wcpj8vwIn3yjoEOdVBSc4ZkS5lOJv4jF58mixCY4w7ZXEsbz 5FNw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6-v6si17180319pfy.140.2018.08.01.10.24.29; Wed, 01 Aug 2018 10:24:43 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406245AbeHATJH (ORCPT + 99 others); Wed, 1 Aug 2018 15:09:07 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50692 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406225AbeHATJG (ORCPT ); Wed, 1 Aug 2018 15:09:06 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9734ACC9; Wed, 1 Aug 2018 17:22:23 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kirill Marinushkin , Pierre-Louis Bossart , Jaroslav Kysela , Takashi Iwai , Mark Brown , Pan Xiuli , Liam Girdwood , alsa-devel@alsa-project.org, Sasha Levin Subject: [PATCH 4.14 211/246] ASoC: topology: Add missing clock gating parameter when parsing hw_configs Date: Wed, 1 Aug 2018 18:52:01 +0200 Message-Id: <20180801165021.801227747@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kirill Marinushkin [ Upstream commit 933e1c4a667103c4d10ebdc9505a0a6abd8c3fbd ] 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 Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- include/uapi/sound/asoc.h | 7 ++++++- sound/soc/soc-topology.c | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) --- 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 */ --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1997,6 +1997,13 @@ static void set_link_hw_format(struct sn 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;