Skip to contentSkip to conversation

ASoC: sgtl5000: Make device cache only when powered off

PATCH In review Mark Brown 3 participants 5 messages Jun 3, 2013 – Jun 7, 2013

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 ASoC: sgtl5000: Make device cache only when powered off

When the regulators have been disabled mark the device as cache only so that we don't try to interact with the hardware.

---
 sound/soc/codecs/sgtl5000.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
sound/soc/codecs/sgtl5000.c +15 -0
index 1c3b20f..85a32e6 100644
@@ -911,10 +911,25 @@ static int sgtl5000_set_bias_level(struct snd_soc_codec *codec,
 			if (ret)
 				return ret;
 			udelay(10);
+
+			regcache_cache_only(sgtl5000->regmap, false);
+
+			ret = regcache_sync(sgtl5000->regmap);
+			if (ret != 0) {
+				dev_err(codec->dev,
+					"Failed to restore cache: %d\n", ret);
+
+				regcache_cache_only(sgtl5000->regmap, true);
+				regulator_bulk_disable(ARRAY_SIZE(sgtl5000->supplies),
+						       sgtl5000->supplies);
+
+				return ret;
+			}
 		}
 
 		break;
 	case SND_SOC_BIAS_OFF:
+		regcache_cache_only(sgtl5000->regmap, true);
 		regulator_bulk_disable(ARRAY_SIZE(sgtl5000->supplies),
 					sgtl5000->supplies);
 		break;
Signature · 1 line
1.7.10.4
maintainer
#1 lore raw

Hi Mark,

Quoted 4 lines · Mark Brown

When the regulators have been disabled mark the device as cache only so that we don't try to interact with the hardware.

I tried to test your patch, but noticed that even without your patch sgtl5000 fails to probe in linux-next 20130605.

It fails when doing a regmap_read of the sgtl5000 ID register.

I will debug this, but in case you have any ideas about recent regmap changes that could lead to this, please let me know.

Regards,

Fabio Estevam

maintainer
#2 lore raw
Quoted 7 lines · Fabio Estevam
Quoted 4 lines · Mark Brown

When the regulators have been disabled mark the device as cache only so that we don't try to interact with the hardware.

Quoted 7 lines

I tried to test your patch, but noticed that even without your patch sgtl5000 fails to probe in linux-next 20130605.

It fails when doing a regmap_read of the sgtl5000 ID register.

I will debug this, but in case you have any ideas about recent regmap changes that could lead to this, please let me know.

Isn't that the thing with not powering on the regulators before doing the ID read? There was some discussion about that earlier.

maintainer
#3 lore raw
Quoted 2 lines · Mark Brown

Isn't that the thing with not powering on the regulators before doing the ID read? There was some discussion about that earlier.

No, the board I am using has the sgtl5000 voltages always applied.

Will try to bisect it.

Thanks,

Fabio Estevam

maintainer
#4 lore raw
In reply to Fabio Estevam

Hi Mark,

Quoted 10 lines · Fabio Estevam

Hi Mark,

Quoted 4 lines · Mark Brown

When the regulators have been disabled mark the device as cache only so that we don't try to interact with the hardware.

I tried to test your patch, but noticed that even without your patch sgtl5000 fails to probe in linux-next 20130605.

Thanks, I managed to test your patch now and it works fine. I needed to turn on the codec clock sooner in the arch/arm/mach-imx/mach-imx6q.c.

Regards,

Fabio Estevam