mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
To: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Cc: Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	alsa-devel@alsa-project.org,
	Support Opensource <support.opensource@diasemi.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [alsa-devel] [PATCH 2/4] ASoC: da7213: Improve driver efficiency with regards to MCLK usage
Date: Mon, 8 Aug 2016 09:43:13 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.02.1608080942500.17128@pmeerw.net> (raw)
In-Reply-To: <0a4cee872d31223fa076c58e4328aad3a11104a8.1470318378.git.Adam.Thomson.Opensource@diasemi.com>


> 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 <Adam.Thomson.Opensource@diasemi.com>

Tested-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>

> ---
>  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)

  reply	other threads:[~2016-08-08  7:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-04 14:35 [PATCH 0/4] ASoC: da7213: Device clocking updates and fixes Adam Thomson
2016-08-04 14:35 ` [PATCH 1/4] ASoC: da7213: Default to 64 BCLKs per WCLK to support all formats Adam Thomson
2016-08-08  7:52   ` [alsa-devel] " Peter Meerwald-Stadler
2016-08-04 14:35 ` [PATCH 2/4] ASoC: da7213: Improve driver efficiency with regards to MCLK usage Adam Thomson
2016-08-08  7:43   ` Peter Meerwald-Stadler [this message]
2016-08-04 14:35 ` [PATCH 3/4] ASoC: da7213: Refactor sysclk(), pll() functions to improve handling Adam Thomson
2016-08-08  7:42   ` [alsa-devel] " Peter Meerwald-Stadler
2016-08-08 10:32     ` Adam Thomson
2016-08-04 14:35 ` [PATCH 4/4] ASoC: da7213: Improve 32KHz mode PLL locking Adam Thomson
2016-08-05  9:04   ` [alsa-devel] " Peter Meerwald-Stadler
2016-08-05 10:30     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.02.1608080942500.17128@pmeerw.net \
    --to=pmeerw@pmeerw.net \
    --cc=Adam.Thomson.Opensource@diasemi.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=support.opensource@diasemi.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®