Skip to contentSkip to conversation

ALSA: ASoC: cs4270: enable regulators at probe time

PATCH In review Daniel Mack 4 participants 6 messages Jan 29, 2010 – Feb 9, 2010

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

PATCH 1/1 ALSA: ASoC: cs4270: enable regulators at probe time

Enable the bulk regulators at probe time so we can safely disable them again when going to suspend without confusing the reference counter.

Cc Timur Tabi <[email protected]>
Cc Liam Girdwood <[email protected]>
Cc Mark Brown <[email protected]>
---
 sound/soc/codecs/cs4270.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
sound/soc/codecs/cs4270.c +10 -0
index 8b54575..70c5edb 100644
@@ -617,8 +617,17 @@ static int cs4270_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto error_free_pcms;
 
+	ret = regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies),
+				    cs4270->supplies);
+	if (ret < 0)
+		goto error_free_regulators;
+
 	return 0;
 
+error_free_regulators:
+		regulator_bulk_free(ARRAY_SIZE(cs4270->supplies),
+				    cs4270->supplies);
+
 error_free_pcms:
 	snd_soc_free_pcms(socdev);
 
@@ -638,6 +647,7 @@ static int cs4270_remove(struct platform_device *pdev)
 	struct cs4270_private *cs4270 = codec->private_data;
 
 	snd_soc_free_pcms(socdev);
+	regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), cs4270->supplies);
 	regulator_bulk_free(ARRAY_SIZE(cs4270->supplies), cs4270->supplies);
 
 	return 0;
Signature · 1 line
1.6.3.3
#1 lore raw

sound/soc/codecs/cs4270.c static int cs4270_probe(struct platform_device *pdev) · line 629

Quoted 3 lines · Daniel Mack
sound/soc/codecs/cs4270.c +3 -0
+error_free_regulators:
+		regulator_bulk_free(ARRAY_SIZE(cs4270->supplies),
+				    cs4270->supplies);

I think this is indented too much.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#2 lore raw

PATCH 1/1 ALSA: ASoC: cs4270: enable regulators at probe time

Enable the bulk regulators at probe time so we can safely disable them again when going to suspend without confusing the reference counter.

Cc Timur Tabi <[email protected]>
Cc Liam Girdwood <[email protected]>
Cc Mark Brown <[email protected]>
---
 sound/soc/codecs/cs4270.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
sound/soc/codecs/cs4270.c +10 -0
index 8b54575..63cb669 100644
@@ -617,8 +617,17 @@ static int cs4270_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto error_free_pcms;
 
+	ret = regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies),
+				    cs4270->supplies);
+	if (ret < 0)
+		goto error_free_regulators;
+
 	return 0;
 
+error_free_regulators:
+	regulator_bulk_free(ARRAY_SIZE(cs4270->supplies),
+			    cs4270->supplies);
+
 error_free_pcms:
 	snd_soc_free_pcms(socdev);
 
@@ -638,6 +647,7 @@ static int cs4270_remove(struct platform_device *pdev)
 	struct cs4270_private *cs4270 = codec->private_data;
 
 	snd_soc_free_pcms(socdev);
+	regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), cs4270->supplies);
 	regulator_bulk_free(ARRAY_SIZE(cs4270->supplies), cs4270->supplies);
 
 	return 0;
Signature · 1 line
1.6.3.3
Acked-by on v1 1/1
#3 lore raw
Quoted 11 lines · Daniel Mack

Enable the bulk regulators at probe time so we can safely disable them again when going to suspend without confusing the reference counter.

Cc Timur Tabi <[email protected]>
Cc Liam Girdwood <[email protected]>
Cc Mark Brown <[email protected]>
---
 sound/soc/codecs/cs4270.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
#4 lore raw
In reply to Daniel Mack
Quoted 7 lines · Daniel Mack

Enable the bulk regulators at probe time so we can safely disable them again when going to suspend without confusing the reference counter.

Cc Timur Tabi <[email protected]>
Cc Liam Girdwood <[email protected]>
Cc Mark Brown <[email protected]>

I don't have any way to test this, but it looks okay. Mark, feel free to apply if you're okay with it.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale