alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Zapolskiy <vzapolskiy@gmail.com>
To: alsa-devel@alsa-project.org
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Vladimir Zapolskiy <vzapolskiy@gmail.com>,
	Liam Girdwood <lrg@slimlogic.co.uk>
Subject: [PATCH 2/2] ASoC: uda134x: fix bias level setup on initialization and runtime
Date: Thu, 24 Jun 2010 15:17:08 +0400	[thread overview]
Message-ID: <1277378228-29658-2-git-send-email-vzapolskiy@gmail.com> (raw)
In-Reply-To: <1277378228-29658-1-git-send-email-vzapolskiy@gmail.com>

For UDA1341 codec power control is managed in STATUS1 register, and
for all other codecs in DATA011 register.

On initialization ADC/DAC are enabled only for UDA1341, that's why
bias_level shall be set to off, otherwise dapm is misinformed about
bias_level on startup.

Signed-off-by: Vladimir Zapolskiy <vzapolskiy@gmail.com>
---
 sound/soc/codecs/uda134x.c |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c
index e770029..0e9a945 100644
--- a/sound/soc/codecs/uda134x.c
+++ b/sound/soc/codecs/uda134x.c
@@ -353,8 +353,13 @@ static int uda134x_set_bias_level(struct snd_soc_codec *codec,
 	switch (level) {
 	case SND_SOC_BIAS_ON:
 		/* ADC, DAC on */
-		reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
-		uda134x_write(codec, UDA134X_STATUS1, reg | 0x03);
+		if (pd->model == UDA134X_UDA1341) {
+			reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
+			uda134x_write(codec, UDA134X_STATUS1, reg | 0x03);
+		} else {
+			reg = uda134x_read_reg_cache(codec, UDA134X_DATA011);
+			uda134x_write(codec, UDA134X_DATA011, reg | 0x03);
+		}
 		break;
 	case SND_SOC_BIAS_PREPARE:
 		/* power on */
@@ -367,8 +372,13 @@ static int uda134x_set_bias_level(struct snd_soc_codec *codec,
 		break;
 	case SND_SOC_BIAS_STANDBY:
 		/* ADC, DAC power off */
-		reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
-		uda134x_write(codec, UDA134X_STATUS1, reg & ~(0x03));
+		if (pd->model == UDA134X_UDA1341) {
+			reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
+			uda134x_write(codec, UDA134X_STATUS1, reg & ~(0x03));
+		} else {
+			reg = uda134x_read_reg_cache(codec, UDA134X_DATA011);
+			uda134x_write(codec, UDA134X_DATA011, reg & ~(0x03));
+		}
 		break;
 	case SND_SOC_BIAS_OFF:
 		/* power off */
@@ -531,9 +541,7 @@ static int uda134x_soc_probe(struct platform_device *pdev)
 	codec->num_dai = 1;
 	codec->read = uda134x_read_reg_cache;
 	codec->write = uda134x_write;
-#ifdef POWER_OFF_ON_STANDBY
-	codec->set_bias_level = uda134x_set_bias_level;
-#endif
+
 	INIT_LIST_HEAD(&codec->dapm_widgets);
 	INIT_LIST_HEAD(&codec->dapm_paths);
 
@@ -544,6 +552,13 @@ static int uda134x_soc_probe(struct platform_device *pdev)
 
 	uda134x_reset(codec);
 
+#ifdef POWER_OFF_ON_STANDBY
+	codec->set_bias_level = uda134x_set_bias_level;
+	uda134x_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
+#else
+	uda134x_set_bias_level(codec, SND_SOC_BIAS_ON);
+#endif
+
 	/* register pcms */
 	ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
 	if (ret < 0) {
-- 
1.7.0.4

  reply	other threads:[~2010-06-24 11:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-24 11:17 [PATCH 1/2] ASoC: uda134x: add DATA011 register found in codecs family Vladimir Zapolskiy
2010-06-24 11:17 ` Vladimir Zapolskiy [this message]
2010-06-24 11:34   ` [PATCH 2/2] ASoC: uda134x: fix bias level setup on initialization and runtime Mark Brown
2010-06-24 13:21     ` Vladimir Zapolskiy
2010-06-24 13:19   ` [PATCH 2/2 v2] ASoC: uda134x: correct bias level setup for codecs family Vladimir Zapolskiy
2010-06-24 19:44     ` Vladimir Zapolskiy
2010-06-28  5:38     ` Vladimir Zapolskiy
2010-06-30 12:58       ` Mark Brown
2010-06-30 13:10         ` Vladimir Zapolskiy
2010-06-30 14:08           ` Mark Brown
2010-06-30 14:59             ` Vladimir Zapolskiy

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=1277378228-29658-2-git-send-email-vzapolskiy@gmail.com \
    --to=vzapolskiy@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=lrg@slimlogic.co.uk \
    /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;
as well as URLs for NNTP newsgroup(s).