All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: alsa-devel@alsa-project.org,
	Jassi Brar <jassisinghbrar@gmail.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Seungwhan Youn <sw.youn@samsung.com>
Subject: [PATCH 7/7] ASoC: Automatically manage WM8580 DAC OSR
Date: Fri, 13 Aug 2010 20:35:07 +0100	[thread overview]
Message-ID: <1281728107-25386-7-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20100813193305.GB3778@sirena.org.uk>

The DAC OSR should be selected based on the sample clock ratio.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/codecs/wm8580.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c
index 357f7d5..cb862df 100644
--- a/sound/soc/codecs/wm8580.c
+++ b/sound/soc/codecs/wm8580.c
@@ -94,6 +94,8 @@
 
 #define WM8580_MAX_REGISTER                  0x35
 
+#define WM8580_DACOSR 0x40
+
 /* PLLB4 (register 7h) */
 #define WM8580_PLLB4_MCLKOUTSRC_MASK   0x60
 #define WM8580_PLLB4_MCLKOUTSRC_PLLA   0x20
@@ -481,7 +483,7 @@ static int wm8580_paif_hw_params(struct snd_pcm_substream *substream,
 	struct wm8580_priv *wm8580 = snd_soc_codec_get_drvdata(codec);
 	u16 paifa = 0;
 	u16 paifb = 0;
-	int i, ratio;
+	int i, ratio, osr;
 
 	/* bit size */
 	switch (params_format(params)) {
@@ -518,6 +520,22 @@ static int wm8580_paif_hw_params(struct snd_pcm_substream *substream,
 	dev_dbg(codec->dev, "Running at %dfs with %dHz clock\n",
 		wm8580_sysclk_ratios[i], wm8580->sysclk[dai->driver->id]);
 
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		switch (ratio) {
+		case 128:
+		case 192:
+			osr = WM8580_DACOSR;
+			dev_dbg(codec->dev, "Selecting 64x OSR\n");
+			break;
+		default:
+			osr = 0;
+			dev_dbg(codec->dev, "Selecting 128x OSR\n");
+			break;
+		}
+
+		snd_soc_update_bits(codec, WM8580_PAIF3, WM8580_DACOSR, osr);
+	}
+
 	snd_soc_update_bits(codec, WM8580_PAIF1 + dai->driver->id,
 			    WM8580_AIF_RATE_MASK | WM8580_AIF_BCLKSEL_MASK,
 			    paifa);
-- 
1.7.1

  parent reply	other threads:[~2010-08-13 19:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-13 19:33 [PATCH 0/7] WM8580 updates Mark Brown
2010-08-13 19:35 ` [PATCH 1/7] ASoC: Add a bit of resource unwinding in the S3C IISv4 driver Mark Brown
2010-08-13 19:35 ` [PATCH 2/7] ASoC: Convert WM8580 hw_params to use snd_soc_update_bits() Mark Brown
2010-08-13 19:35 ` [PATCH 3/7] ASoC: Remove unused rate selection bitmasks from WM8580 Mark Brown
2010-08-13 19:35 ` [PATCH 4/7] ASoC: Automatically calculate clock ratio for WM8580 Mark Brown
2010-08-15  9:00   ` Seungwhan Youn
2010-08-15 11:09     ` Mark Brown
2010-08-16  4:36       ` Jassi Brar
2010-08-16 10:20         ` Mark Brown
2010-08-16 12:51           ` Jassi Brar
2010-08-16 15:19             ` Mark Brown
2010-08-16 23:14               ` Jassi Brar
2010-08-17  9:46                 ` Mark Brown
2010-08-31  6:46                   ` Jassi Brar
2010-08-31 10:42                     ` Mark Brown
2010-08-16  4:16   ` Seungwhan Youn
2010-08-16 12:21     ` Mark Brown
2010-08-16 12:47       ` Jassi Brar
2010-08-13 19:35 ` [PATCH 5/7] ASoC: Implement BCLK rate selection " Mark Brown
2010-08-13 19:35 ` [PATCH 6/7] ASoC: Fix inverted WM8580 capture mute control Mark Brown
2010-08-15  4:50   ` Seungwhan Youn
2010-08-15  6:20     ` Seungwhan Youn
2010-08-13 19:35 ` Mark Brown [this message]
2010-08-14  4:09 ` [PATCH 0/7] WM8580 updates Jassi Brar
2010-08-15  9:21   ` Seungwhan Youn
2010-08-15 11:10     ` Mark Brown
2010-08-16  9:44       ` Seungwhan Youn
2010-08-16 14:49         ` Mark Brown
2010-08-19 11:37           ` Seungwhan Youn
2010-08-14 10:45 ` Liam Girdwood

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=1281728107-25386-7-git-send-email-broonie@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=jassisinghbrar@gmail.com \
    --cc=lrg@slimlogic.co.uk \
    --cc=sw.youn@samsung.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.