Skip to contentSkip to conversation

ASoC: tlv320dac33: small power handling updates

PATCH Applied Peter Ujfalusi 3 participants 5 messages May 17, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ASoC: tlv320dac33: small power handling updates

Hello,

While testing suspend, it has been noticed, that the driver would try to power off the codec more than once.
Since this case handled in the driver, and results no functional defect we can lower the noise in the kernel log.

Also avoid the root cause of the multiple off calls by filtering BIAS_OFF request when the codec was already OFF.

---
Felipe Balbi (1):
ASoC: tlv320dac33: Use dev_dbg in dac33_hard_power function

Peter Ujfalusi (1):
ASoC: tlv320dac33: Avoid powering off while in BIAS_OFF

 sound/soc/codecs/tlv320dac33.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
#1 lore raw

PATCH 1/2 ASoC: tlv320dac33: Use dev_dbg in dac33_hard_power function

From: Felipe Balbi <[email protected]>

Since the cases when the same power state would be set again handled gracefully, we do not need to use dev_warn.

---
 sound/soc/codecs/tlv320dac33.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/codecs/tlv320dac33.c +1 -1
index 007fe83..ad1795a 100644
@@ -352,7 +352,7 @@ static int dac33_hard_power(struct snd_soc_codec *codec, int power)
 
 	/* Safety check */
 	if (unlikely(power == dac33->chip_power)) {
-		dev_warn(codec->dev, "Trying to set the same power state: %s\n",
+		dev_dbg(codec->dev, "Trying to set the same power state: %s\n",
 			power ? "ON" : "OFF");
 		goto exit;
 	}
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/2 ASoC: tlv320dac33: Avoid powering off while in BIAS_OFF

In reply to Peter Ujfalusi

Avoid calling the dac33_hard_power when the codec was already in BIAS_OFF state.
This could happen in device suspend and module removal time.

---
 sound/soc/codecs/tlv320dac33.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
sound/soc/codecs/tlv320dac33.c +3 -0
index ad1795a..bcf6d93 100644
@@ -589,6 +589,9 @@ static int dac33_set_bias_level(struct snd_soc_codec *codec,
 		}
 		break;
 	case SND_SOC_BIAS_OFF:
+		/* Do not power off, when the codec is already off */
+		if (codec->bias_level == SND_SOC_BIAS_OFF)
+			return 0;
 		ret = dac33_hard_power(codec, 0);
 		if (ret != 0)
 			return ret;
Signature · 1 line
1.7.1
#4 lore raw
In reply to Peter Ujfalusi
Quoted 14 lines · Peter Ujfalusi

Hello,

While testing suspend, it has been noticed, that the driver would try to power off the codec more than once.
Since this case handled in the driver, and results no functional defect we can lower the noise in the kernel log.

Also avoid the root cause of the multiple off calls by filtering BIAS_OFF request when the codec was already OFF.

---
Felipe Balbi (1):
ASoC: tlv320dac33: Use dev_dbg in dac33_hard_power function

Quoted 6 lines

Peter Ujfalusi (1):
ASoC: tlv320dac33: Avoid powering off while in BIAS_OFF

 sound/soc/codecs/tlv320dac33.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Applied.

Thanks

Liam

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk