All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
To: broonie@kernel.org
Cc: patches@opensource.wolfsonmicro.com,
	linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org,
	lgirdwood@gmail.com
Subject: [PATCH v7 3/4] ASoC: arizona: Add DVFS handling for sample rate control
Date: Mon,  1 Jun 2015 14:04:50 +0100	[thread overview]
Message-ID: <1433163891-10084-3-git-send-email-rf@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1433163891-10084-1-git-send-email-rf@opensource.wolfsonmicro.com>

The WM8997 and WM5102 codecs need to boost DVFS for higher sample rates.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 sound/soc/codecs/arizona.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 69965ae..f4f3022 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1393,7 +1393,7 @@ static int arizona_hw_params_rate(struct snd_pcm_substream *substream,
 	struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
 	struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1];
 	int base = dai->driver->base;
-	int i, sr_val;
+	int i, sr_val, ret;
 
 	/*
 	 * We will need to be more flexible than this in future,
@@ -1409,6 +1409,23 @@ static int arizona_hw_params_rate(struct snd_pcm_substream *substream,
 	}
 	sr_val = i;
 
+	switch (priv->arizona->type) {
+	case WM5102:
+	case WM8997:
+		if (arizona_sr_vals[sr_val] >= 88200)
+			ret = arizona_dvfs_up(codec, ARIZONA_DVFS_SR1_RQ);
+		else
+			ret = arizona_dvfs_down(codec, ARIZONA_DVFS_SR1_RQ);
+
+		if (ret) {
+			arizona_aif_err(dai, "Failed to change DVFS %d\n", ret);
+			return ret;
+		}
+		break;
+	default:
+		break;
+	}
+
 	switch (dai_priv->clk) {
 	case ARIZONA_CLK_SYSCLK:
 		switch (priv->arizona->type) {
-- 
1.7.2.5

  parent reply	other threads:[~2015-06-01 13:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 13:04 [PATCH v7 1/4] ASoC: arizona: Export functions to control subsystem DVFS Richard Fitzgerald
2015-06-01 13:04 ` Richard Fitzgerald
2015-06-01 13:04 ` [PATCH v7 2/4] ASoC: wm_adsp: Move DVFS control into codec driver Richard Fitzgerald
2015-06-01 13:04 ` Richard Fitzgerald [this message]
2015-06-01 13:04 ` [PATCH v7 4/4] regulator: arizona-ldo1: Do not control DVFS clocking from regulator Richard Fitzgerald
2015-06-01 16:10 ` [PATCH v7 1/4] ASoC: arizona: Export functions to control subsystem DVFS Mark Brown
2015-06-01 16:22   ` Richard Fitzgerald
2015-06-01 16:36     ` Mark Brown
2015-06-01 16:36       ` Mark Brown
2015-06-02 10:32       ` Richard Fitzgerald

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=1433163891-10084-3-git-send-email-rf@opensource.wolfsonmicro.com \
    --to=rf@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.wolfsonmicro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.