All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: ak4642: Enable cache usage to fix crashes on resume
@ 2016-05-18 17:49 Mark Brown
  2016-05-18 18:05 ` Geert Uytterhoeven
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Mark Brown @ 2016-05-18 17:49 UTC (permalink / raw)
  To: Peter Ujfalusi, Geert Uytterhoeven; +Cc: alsa-devel, Mark Brown, stable

The ak4642 driver is using a regmap cache sync to restore the
configuration of the chip on resume but (as Peter observed) does not
actually define a register cache which means that the resume is never
going to work and we trigger asserts in regmap.  Fix this by enabling
caching.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reported-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
---
 sound/soc/codecs/ak4642.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
index 1ee8506c06c7..4d8b9e49e8d6 100644
--- a/sound/soc/codecs/ak4642.c
+++ b/sound/soc/codecs/ak4642.c
@@ -560,6 +560,7 @@ static const struct regmap_config ak4642_regmap = {
 	.max_register		= FIL1_3,
 	.reg_defaults		= ak4642_reg,
 	.num_reg_defaults	= NUM_AK4642_REG_DEFAULTS,
+	.cache_type		= REGCACHE_RBTREE,
 };
 
 static const struct regmap_config ak4643_regmap = {
@@ -568,6 +569,7 @@ static const struct regmap_config ak4643_regmap = {
 	.max_register		= SPK_MS,
 	.reg_defaults		= ak4643_reg,
 	.num_reg_defaults	= ARRAY_SIZE(ak4643_reg),
+	.cache_type		= REGCACHE_RBTREE,
 };
 
 static const struct regmap_config ak4648_regmap = {
@@ -576,6 +578,7 @@ static const struct regmap_config ak4648_regmap = {
 	.max_register		= EQ_FBEQE,
 	.reg_defaults		= ak4648_reg,
 	.num_reg_defaults	= ARRAY_SIZE(ak4648_reg),
+	.cache_type		= REGCACHE_RBTREE,
 };
 
 static const struct ak4642_drvdata ak4642_drvdata = {
-- 
2.8.1


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

* Re: [PATCH] ASoC: ak4642: Enable cache usage to fix crashes on resume
  2016-05-18 17:49 [PATCH] ASoC: ak4642: Enable cache usage to fix crashes on resume Mark Brown
@ 2016-05-18 18:05 ` Geert Uytterhoeven
  2016-05-18 18:13   ` Mark Brown
  2016-05-19  6:33   ` Peter Ujfalusi
  2 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2016-05-18 18:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: Peter Ujfalusi, ALSA Development Mailing List, stable

Hi Mark,

On Wed, May 18, 2016 at 7:49 PM, Mark Brown <broonie@kernel.org> wrote:
> The ak4642 driver is using a regmap cache sync to restore the
> configuration of the chip on resume but (as Peter observed) does not
> actually define a register cache which means that the resume is never
> going to work and we trigger asserts in regmap.  Fix this by enabling
> caching.
>
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Reported-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> Cc: stable@vger.kernel.org

Thanks, this gets rid of the

        kernel BUG at drivers/base/regmap/regcache.c:347!

I was seeing.

Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Applied "ASoC: ak4642: Enable cache usage to fix crashes on resume" to the asoc tree
  2016-05-18 17:49 [PATCH] ASoC: ak4642: Enable cache usage to fix crashes on resume Mark Brown
@ 2016-05-18 18:13   ` Mark Brown
  2016-05-18 18:13   ` Mark Brown
  2016-05-19  6:33   ` Peter Ujfalusi
  2 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2016-05-18 18:13 UTC (permalink / raw)
  To: Mark Brown
  Cc: Geert Uytterhoeven, Peter Ujfalusi, Geert Uytterhoeven, stable,
	Peter Ujfalusi, Geert Uytterhoeven, alsa-devel, stable

The patch

   ASoC: ak4642: Enable cache usage to fix crashes on resume

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From d3030d11961a8c103cf07aed59905276ddfc06c2 Mon Sep 17 00:00:00 2001
From: Mark Brown <broonie@kernel.org>
Date: Wed, 18 May 2016 18:30:39 +0100
Subject: [PATCH] ASoC: ak4642: Enable cache usage to fix crashes on resume

The ak4642 driver is using a regmap cache sync to restore the
configuration of the chip on resume but (as Peter observed) does not
actually define a register cache which means that the resume is never
going to work and we trigger asserts in regmap.  Fix this by enabling
caching.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reported-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
---
 sound/soc/codecs/ak4642.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
index 1ee8506c06c7..4d8b9e49e8d6 100644
--- a/sound/soc/codecs/ak4642.c
+++ b/sound/soc/codecs/ak4642.c
@@ -560,6 +560,7 @@ static const struct regmap_config ak4642_regmap = {
 	.max_register		= FIL1_3,
 	.reg_defaults		= ak4642_reg,
 	.num_reg_defaults	= NUM_AK4642_REG_DEFAULTS,
+	.cache_type		= REGCACHE_RBTREE,
 };
 
 static const struct regmap_config ak4643_regmap = {
@@ -568,6 +569,7 @@ static const struct regmap_config ak4643_regmap = {
 	.max_register		= SPK_MS,
 	.reg_defaults		= ak4643_reg,
 	.num_reg_defaults	= ARRAY_SIZE(ak4643_reg),
+	.cache_type		= REGCACHE_RBTREE,
 };
 
 static const struct regmap_config ak4648_regmap = {
@@ -576,6 +578,7 @@ static const struct regmap_config ak4648_regmap = {
 	.max_register		= EQ_FBEQE,
 	.reg_defaults		= ak4648_reg,
 	.num_reg_defaults	= ARRAY_SIZE(ak4648_reg),
+	.cache_type		= REGCACHE_RBTREE,
 };
 
 static const struct ak4642_drvdata ak4642_drvdata = {
-- 
2.8.1


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

* Applied "ASoC: ak4642: Enable cache usage to fix crashes on resume" to the asoc tree
@ 2016-05-18 18:13   ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2016-05-18 18:13 UTC (permalink / raw)
  To: Mark Brown; +Cc: Geert Uytterhoeven, Peter Ujfalusi, Geert Uytterhoeven, stable

The patch

   ASoC: ak4642: Enable cache usage to fix crashes on resume

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From d3030d11961a8c103cf07aed59905276ddfc06c2 Mon Sep 17 00:00:00 2001
From: Mark Brown <broonie@kernel.org>
Date: Wed, 18 May 2016 18:30:39 +0100
Subject: [PATCH] ASoC: ak4642: Enable cache usage to fix crashes on resume

The ak4642 driver is using a regmap cache sync to restore the
configuration of the chip on resume but (as Peter observed) does not
actually define a register cache which means that the resume is never
going to work and we trigger asserts in regmap.  Fix this by enabling
caching.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reported-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
---
 sound/soc/codecs/ak4642.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
index 1ee8506c06c7..4d8b9e49e8d6 100644
--- a/sound/soc/codecs/ak4642.c
+++ b/sound/soc/codecs/ak4642.c
@@ -560,6 +560,7 @@ static const struct regmap_config ak4642_regmap = {
 	.max_register		= FIL1_3,
 	.reg_defaults		= ak4642_reg,
 	.num_reg_defaults	= NUM_AK4642_REG_DEFAULTS,
+	.cache_type		= REGCACHE_RBTREE,
 };
 
 static const struct regmap_config ak4643_regmap = {
@@ -568,6 +569,7 @@ static const struct regmap_config ak4643_regmap = {
 	.max_register		= SPK_MS,
 	.reg_defaults		= ak4643_reg,
 	.num_reg_defaults	= ARRAY_SIZE(ak4643_reg),
+	.cache_type		= REGCACHE_RBTREE,
 };
 
 static const struct regmap_config ak4648_regmap = {
@@ -576,6 +578,7 @@ static const struct regmap_config ak4648_regmap = {
 	.max_register		= EQ_FBEQE,
 	.reg_defaults		= ak4648_reg,
 	.num_reg_defaults	= ARRAY_SIZE(ak4648_reg),
+	.cache_type		= REGCACHE_RBTREE,
 };
 
 static const struct ak4642_drvdata ak4642_drvdata = {
-- 
2.8.1

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

* Re: [PATCH] ASoC: ak4642: Enable cache usage to fix crashes on resume
  2016-05-18 17:49 [PATCH] ASoC: ak4642: Enable cache usage to fix crashes on resume Mark Brown
@ 2016-05-19  6:33   ` Peter Ujfalusi
  2016-05-18 18:13   ` Mark Brown
  2016-05-19  6:33   ` Peter Ujfalusi
  2 siblings, 0 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2016-05-19  6:33 UTC (permalink / raw)
  To: Mark Brown, Geert Uytterhoeven; +Cc: alsa-devel, stable

On 05/18/16 20:49, Mark Brown wrote:
> The ak4642 driver is using a regmap cache sync to restore the
> configuration of the chip on resume but (as Peter observed) does not
> actually define a register cache which means that the resume is never
> going to work and we trigger asserts in regmap.  Fix this by enabling
> caching.

Should the ak4642 implement the suspend callback and:

static int ak4642_suspend(struct snd_soc_codec *codec)
{
	struct regmap *regmap = dev_get_regmap(codec->dev, NULL);

	regcache_cache_only(regmap, true);
	regcache_mark_dirty(regmap);
	return 0;
}

static int ak4642_resume(struct snd_soc_codec *codec)
{
	struct regmap *regmap = dev_get_regmap(codec->dev, NULL);

	regcache_cache_only(regmap, false);
	regcache_sync(regmap);
	return 0;
}

I know it is highly unlikely that anything is going to be written to the chip
while the board is suspended. Probably the suspend and changing the cache only
is not needed, but in this way things look a bit more complete?

> 
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Reported-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> Cc: stable@vger.kernel.org
> ---
>  sound/soc/codecs/ak4642.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
> index 1ee8506c06c7..4d8b9e49e8d6 100644
> --- a/sound/soc/codecs/ak4642.c
> +++ b/sound/soc/codecs/ak4642.c
> @@ -560,6 +560,7 @@ static const struct regmap_config ak4642_regmap = {
>  	.max_register		= FIL1_3,
>  	.reg_defaults		= ak4642_reg,
>  	.num_reg_defaults	= NUM_AK4642_REG_DEFAULTS,
> +	.cache_type		= REGCACHE_RBTREE,
>  };
>  
>  static const struct regmap_config ak4643_regmap = {
> @@ -568,6 +569,7 @@ static const struct regmap_config ak4643_regmap = {
>  	.max_register		= SPK_MS,
>  	.reg_defaults		= ak4643_reg,
>  	.num_reg_defaults	= ARRAY_SIZE(ak4643_reg),
> +	.cache_type		= REGCACHE_RBTREE,
>  };
>  
>  static const struct regmap_config ak4648_regmap = {
> @@ -576,6 +578,7 @@ static const struct regmap_config ak4648_regmap = {
>  	.max_register		= EQ_FBEQE,
>  	.reg_defaults		= ak4648_reg,
>  	.num_reg_defaults	= ARRAY_SIZE(ak4648_reg),
> +	.cache_type		= REGCACHE_RBTREE,
>  };
>  
>  static const struct ak4642_drvdata ak4642_drvdata = {
> 


-- 
P�ter

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

* Re: [PATCH] ASoC: ak4642: Enable cache usage to fix crashes on resume
@ 2016-05-19  6:33   ` Peter Ujfalusi
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2016-05-19  6:33 UTC (permalink / raw)
  To: Mark Brown, Geert Uytterhoeven; +Cc: alsa-devel, stable

On 05/18/16 20:49, Mark Brown wrote:
> The ak4642 driver is using a regmap cache sync to restore the
> configuration of the chip on resume but (as Peter observed) does not
> actually define a register cache which means that the resume is never
> going to work and we trigger asserts in regmap.  Fix this by enabling
> caching.

Should the ak4642 implement the suspend callback and:

static int ak4642_suspend(struct snd_soc_codec *codec)
{
	struct regmap *regmap = dev_get_regmap(codec->dev, NULL);

	regcache_cache_only(regmap, true);
	regcache_mark_dirty(regmap);
	return 0;
}

static int ak4642_resume(struct snd_soc_codec *codec)
{
	struct regmap *regmap = dev_get_regmap(codec->dev, NULL);

	regcache_cache_only(regmap, false);
	regcache_sync(regmap);
	return 0;
}

I know it is highly unlikely that anything is going to be written to the chip
while the board is suspended. Probably the suspend and changing the cache only
is not needed, but in this way things look a bit more complete?

> 
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Reported-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> Cc: stable@vger.kernel.org
> ---
>  sound/soc/codecs/ak4642.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
> index 1ee8506c06c7..4d8b9e49e8d6 100644
> --- a/sound/soc/codecs/ak4642.c
> +++ b/sound/soc/codecs/ak4642.c
> @@ -560,6 +560,7 @@ static const struct regmap_config ak4642_regmap = {
>  	.max_register		= FIL1_3,
>  	.reg_defaults		= ak4642_reg,
>  	.num_reg_defaults	= NUM_AK4642_REG_DEFAULTS,
> +	.cache_type		= REGCACHE_RBTREE,
>  };
>  
>  static const struct regmap_config ak4643_regmap = {
> @@ -568,6 +569,7 @@ static const struct regmap_config ak4643_regmap = {
>  	.max_register		= SPK_MS,
>  	.reg_defaults		= ak4643_reg,
>  	.num_reg_defaults	= ARRAY_SIZE(ak4643_reg),
> +	.cache_type		= REGCACHE_RBTREE,
>  };
>  
>  static const struct regmap_config ak4648_regmap = {
> @@ -576,6 +578,7 @@ static const struct regmap_config ak4648_regmap = {
>  	.max_register		= EQ_FBEQE,
>  	.reg_defaults		= ak4648_reg,
>  	.num_reg_defaults	= ARRAY_SIZE(ak4648_reg),
> +	.cache_type		= REGCACHE_RBTREE,
>  };
>  
>  static const struct ak4642_drvdata ak4642_drvdata = {
> 


-- 
Péter

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

* Re: [PATCH] ASoC: ak4642: Enable cache usage to fix crashes on resume
  2016-05-19  6:33   ` Peter Ujfalusi
  (?)
@ 2016-05-19 10:10   ` Mark Brown
  -1 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2016-05-19 10:10 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: Geert Uytterhoeven, alsa-devel, stable

[-- Attachment #1: Type: text/plain, Size: 606 bytes --]

On Thu, May 19, 2016 at 09:33:15AM +0300, Peter Ujfalusi wrote:

> Should the ak4642 implement the suspend callback and:

> static int ak4642_suspend(struct snd_soc_codec *codec)
> {
> 	struct regmap *regmap = dev_get_regmap(codec->dev, NULL);
> 
> 	regcache_cache_only(regmap, true);

> I know it is highly unlikely that anything is going to be written to the chip
> while the board is suspended. Probably the suspend and changing the cache only
> is not needed, but in this way things look a bit more complete?

Yes, that's more idiomatic - it also allows better sharing with runtime
PM.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

end of thread, other threads:[~2016-05-19 10:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-18 17:49 [PATCH] ASoC: ak4642: Enable cache usage to fix crashes on resume Mark Brown
2016-05-18 18:05 ` Geert Uytterhoeven
2016-05-18 18:13 ` Applied "ASoC: ak4642: Enable cache usage to fix crashes on resume" to the asoc tree Mark Brown
2016-05-18 18:13   ` Mark Brown
2016-05-19  6:33 ` [PATCH] ASoC: ak4642: Enable cache usage to fix crashes on resume Peter Ujfalusi
2016-05-19  6:33   ` Peter Ujfalusi
2016-05-19 10:10   ` Mark Brown

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.