All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: sgtl5000: Make device cache only when powered off
@ 2013-06-03  9:22 Mark Brown
  2013-06-05 23:04 ` Fabio Estevam
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2013-06-03  9:22 UTC (permalink / raw)
  To: Fabio Estevam, Liam Girdwood; +Cc: alsa-devel, 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.

Signed-off-by: Mark Brown <broonie@linaro.org>
---
 sound/soc/codecs/sgtl5000.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 1c3b20f..85a32e6 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -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;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: sgtl5000: Make device cache only when powered off
  2013-06-03  9:22 [PATCH] ASoC: sgtl5000: Make device cache only when powered off Mark Brown
@ 2013-06-05 23:04 ` Fabio Estevam
  2013-06-05 23:23   ` Mark Brown
  2013-06-07 22:12   ` Fabio Estevam
  0 siblings, 2 replies; 5+ messages in thread
From: Fabio Estevam @ 2013-06-05 23:04 UTC (permalink / raw)
  To: Mark Brown; +Cc: Fabio Estevam, alsa-devel, Liam Girdwood

Hi Mark,

On Mon, Jun 3, 2013 at 6:22 AM, Mark Brown <broonie@linaro.org> wrote:
> When the regulators have been disabled mark the device as cache only so
> that we don't try to interact with the hardware.
>
> Signed-off-by: Mark Brown <broonie@linaro.org>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: sgtl5000: Make device cache only when powered off
  2013-06-05 23:04 ` Fabio Estevam
@ 2013-06-05 23:23   ` Mark Brown
  2013-06-05 23:26     ` Fabio Estevam
  2013-06-07 22:12   ` Fabio Estevam
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Brown @ 2013-06-05 23:23 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Fabio Estevam, alsa-devel, Liam Girdwood, Mark Brown


[-- Attachment #1.1: Type: text/plain, Size: 765 bytes --]

On Wed, Jun 05, 2013 at 08:04:10PM -0300, Fabio Estevam wrote:
> On Mon, Jun 3, 2013 at 6:22 AM, Mark Brown <broonie@linaro.org> wrote:

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

> > Signed-off-by: Mark Brown <broonie@linaro.org>

> 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.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: sgtl5000: Make device cache only when powered off
  2013-06-05 23:23   ` Mark Brown
@ 2013-06-05 23:26     ` Fabio Estevam
  0 siblings, 0 replies; 5+ messages in thread
From: Fabio Estevam @ 2013-06-05 23:26 UTC (permalink / raw)
  To: Mark Brown; +Cc: Fabio Estevam, alsa-devel, Liam Girdwood, Mark Brown

On Wed, Jun 5, 2013 at 8:23 PM, Mark Brown <broonie@kernel.org> wrote:

> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: sgtl5000: Make device cache only when powered off
  2013-06-05 23:04 ` Fabio Estevam
  2013-06-05 23:23   ` Mark Brown
@ 2013-06-07 22:12   ` Fabio Estevam
  1 sibling, 0 replies; 5+ messages in thread
From: Fabio Estevam @ 2013-06-07 22:12 UTC (permalink / raw)
  To: Mark Brown; +Cc: Fabio Estevam, alsa-devel, Liam Girdwood

Hi Mark,

On Wed, Jun 5, 2013 at 8:04 PM, Fabio Estevam <festevam@gmail.com> wrote:
> Hi Mark,
>
> On Mon, Jun 3, 2013 at 6:22 AM, Mark Brown <broonie@linaro.org> wrote:
>> When the regulators have been disabled mark the device as cache only so
>> that we don't try to interact with the hardware.
>>
>> Signed-off-by: Mark Brown <broonie@linaro.org>
>
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-06-07 22:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-03  9:22 [PATCH] ASoC: sgtl5000: Make device cache only when powered off Mark Brown
2013-06-05 23:04 ` Fabio Estevam
2013-06-05 23:23   ` Mark Brown
2013-06-05 23:26     ` Fabio Estevam
2013-06-07 22:12   ` Fabio Estevam

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.