From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752189AbcHHHnP (ORCPT ); Mon, 8 Aug 2016 03:43:15 -0400 Received: from ns.pmeerw.net ([84.19.176.92]:34206 "EHLO pmeerw.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752008AbcHHHnO (ORCPT ); Mon, 8 Aug 2016 03:43:14 -0400 Date: Mon, 8 Aug 2016 09:43:13 +0200 (CEST) From: Peter Meerwald-Stadler To: Adam Thomson cc: Mark Brown , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, Support Opensource , linux-kernel@vger.kernel.org Subject: Re: [alsa-devel] [PATCH 2/4] ASoC: da7213: Improve driver efficiency with regards to MCLK usage In-Reply-To: <0a4cee872d31223fa076c58e4328aad3a11104a8.1470318378.git.Adam.Thomson.Opensource@diasemi.com> Message-ID: References: <0a4cee872d31223fa076c58e4328aad3a11104a8.1470318378.git.Adam.Thomson.Opensource@diasemi.com> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Currently MCLK remains enabled during bias STANDBY state, and this > is not necessary. This patch updates the code to handle enabling > and disabling of MCLK, if provided, when moving between STANDBY > and PREPARE states, therefore saving power when no active streams > present. > > Signed-off-by: Adam Thomson Tested-by: Peter Meerwald-Stadler > --- > sound/soc/codecs/da7213.c | 20 +++++++++++--------- > 1 file changed, 11 insertions(+), 9 deletions(-) > > diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c > index bcf1834..7701f4e 100644 > --- a/sound/soc/codecs/da7213.c > +++ b/sound/soc/codecs/da7213.c > @@ -1454,11 +1454,10 @@ static int da7213_set_bias_level(struct snd_soc_codec *codec, > > switch (level) { > case SND_SOC_BIAS_ON: > - case SND_SOC_BIAS_PREPARE: > break; > - case SND_SOC_BIAS_STANDBY: > - if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { > - /* MCLK */ > + case SND_SOC_BIAS_PREPARE: > + /* Enable MCLK for transition to ON state */ > + if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY) { > if (da7213->mclk) { > ret = clk_prepare_enable(da7213->mclk); > if (ret) { > @@ -1467,21 +1466,24 @@ static int da7213_set_bias_level(struct snd_soc_codec *codec, > return ret; > } > } > - > + } > + break; > + case SND_SOC_BIAS_STANDBY: > + if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { > /* Enable VMID reference & master bias */ > snd_soc_update_bits(codec, DA7213_REFERENCES, > DA7213_VMID_EN | DA7213_BIAS_EN, > DA7213_VMID_EN | DA7213_BIAS_EN); > + } else { > + /* Remove MCLK */ > + if (da7213->mclk) > + clk_disable_unprepare(da7213->mclk); > } > break; > case SND_SOC_BIAS_OFF: > /* Disable VMID reference & master bias */ > snd_soc_update_bits(codec, DA7213_REFERENCES, > DA7213_VMID_EN | DA7213_BIAS_EN, 0); > - > - /* MCLK */ > - if (da7213->mclk) > - clk_disable_unprepare(da7213->mclk); > break; > } > return 0; > -- Peter Meerwald-Stadler +43-664-2444418 (mobile)