* [PATCH 0/3] ASoC: ak4613/wm8940: Regmap cache fixes
@ 2016-06-16 12:34 Geert Uytterhoeven
2016-06-16 12:34 ` [PATCH 1/3] ASoC: ak4613: Enable cache usage to fix crashes on resume Geert Uytterhoeven
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2016-06-16 12:34 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown
Cc: Peter Ujfalusi, Kuninori Morimoto, patches, linux-renesas-soc,
alsa-devel, Geert Uytterhoeven
Hi Liam, Mark,
This series contains 3 fixes for regmap cache handling in the ak4613 and
wm8940 drivers. All fixes are based on recent similar fixes for the
ak4642 driver.
The first patch fixes a crash I've seen on r8a7795/Salvator-X.
The last patch is completely untested. The issue was discovered using
'git grep -Lw cache_type -- $(git grep -lw regcache_sync -- $(git grep
-lw regmap_config))''
Thanks!
Geert Uytterhoeven (3):
ASoC: ak4613: Enable cache usage to fix crashes on resume
ASoC: ak4613: Implement suspend callback
ASoC: wm8940: Enable cache usage to fix crashes on resume
sound/soc/codecs/ak4613.c | 13 ++++++++++++-
sound/soc/codecs/wm8940.c | 1 +
2 files changed, 13 insertions(+), 1 deletion(-)
--
1.9.1
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] 8+ messages in thread* [PATCH 1/3] ASoC: ak4613: Enable cache usage to fix crashes on resume 2016-06-16 12:34 [PATCH 0/3] ASoC: ak4613/wm8940: Regmap cache fixes Geert Uytterhoeven @ 2016-06-16 12:34 ` Geert Uytterhoeven 2016-06-17 11:43 ` Applied "ASoC: ak4613: Enable cache usage to fix crashes on resume" to the asoc tree Mark Brown 2016-06-16 12:34 ` [PATCH 2/3] ASoC: ak4613: Implement suspend callback Geert Uytterhoeven 2016-06-16 12:34 ` [PATCH 3/3] ASoC: wm8940: Enable cache usage to fix crashes on resume Geert Uytterhoeven 2 siblings, 1 reply; 8+ messages in thread From: Geert Uytterhoeven @ 2016-06-16 12:34 UTC (permalink / raw) To: Liam Girdwood, Mark Brown Cc: Peter Ujfalusi, Kuninori Morimoto, patches, linux-renesas-soc, alsa-devel, Geert Uytterhoeven During system resume: kernel BUG at drivers/base/regmap/regcache.c:347! ... PC is at regcache_sync+0x1c/0x128 LR is at ak4613_resume+0x28/0x34 The ak4613 driver is using a regmap cache sync to restore the configuration of the chip on resume but 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. Based on commit d3030d11961a8c10 ("ASoC: ak4642: Enable cache usage to fix crashes on resume") by Mark Brown <broonie@kernel.org>. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> --- sound/soc/codecs/ak4613.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c index 33d2f2e10e2419d8..5013d2ba0c10a968 100644 --- a/sound/soc/codecs/ak4613.c +++ b/sound/soc/codecs/ak4613.c @@ -146,6 +146,7 @@ static const struct regmap_config ak4613_regmap_cfg = { .max_register = 0x16, .reg_defaults = ak4613_reg, .num_reg_defaults = ARRAY_SIZE(ak4613_reg), + .cache_type = REGCACHE_RBTREE, }; static const struct of_device_id ak4613_of_match[] = { -- 1.9.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Applied "ASoC: ak4613: Enable cache usage to fix crashes on resume" to the asoc tree 2016-06-16 12:34 ` [PATCH 1/3] ASoC: ak4613: Enable cache usage to fix crashes on resume Geert Uytterhoeven @ 2016-06-17 11:43 ` Mark Brown 0 siblings, 0 replies; 8+ messages in thread From: Mark Brown @ 2016-06-17 11:43 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Mark Brown, Liam Girdwood, Mark Brown, linux-renesas-soc, alsa-devel, Kuninori Morimoto, patches, Peter Ujfalusi The patch ASoC: ak4613: 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 dcd2d1f78664fdc75eadaaf65257834e24383d01 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven <geert+renesas@glider.be> Date: Thu, 16 Jun 2016 14:34:30 +0200 Subject: [PATCH] ASoC: ak4613: Enable cache usage to fix crashes on resume During system resume: kernel BUG at drivers/base/regmap/regcache.c:347! ... PC is at regcache_sync+0x1c/0x128 LR is at ak4613_resume+0x28/0x34 The ak4613 driver is using a regmap cache sync to restore the configuration of the chip on resume but 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. Based on commit d3030d11961a8c10 ("ASoC: ak4642: Enable cache usage to fix crashes on resume") by Mark Brown <broonie@kernel.org>. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Mark Brown <broonie@kernel.org> --- sound/soc/codecs/ak4613.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c index 33d2f2e10e24..5013d2ba0c10 100644 --- a/sound/soc/codecs/ak4613.c +++ b/sound/soc/codecs/ak4613.c @@ -146,6 +146,7 @@ static const struct regmap_config ak4613_regmap_cfg = { .max_register = 0x16, .reg_defaults = ak4613_reg, .num_reg_defaults = ARRAY_SIZE(ak4613_reg), + .cache_type = REGCACHE_RBTREE, }; static const struct of_device_id ak4613_of_match[] = { -- 2.8.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] ASoC: ak4613: Implement suspend callback 2016-06-16 12:34 [PATCH 0/3] ASoC: ak4613/wm8940: Regmap cache fixes Geert Uytterhoeven 2016-06-16 12:34 ` [PATCH 1/3] ASoC: ak4613: Enable cache usage to fix crashes on resume Geert Uytterhoeven @ 2016-06-16 12:34 ` Geert Uytterhoeven 2016-06-17 11:43 ` Applied "ASoC: ak4613: Implement suspend callback" to the asoc tree Mark Brown 2016-06-16 12:34 ` [PATCH 3/3] ASoC: wm8940: Enable cache usage to fix crashes on resume Geert Uytterhoeven 2 siblings, 1 reply; 8+ messages in thread From: Geert Uytterhoeven @ 2016-06-16 12:34 UTC (permalink / raw) To: Liam Girdwood, Mark Brown Cc: Peter Ujfalusi, Kuninori Morimoto, patches, linux-renesas-soc, alsa-devel, Geert Uytterhoeven Add the suspend callback to accompany the existing resume operation. With the suspend/resume callbacks the regmap (regcache) state handling can follow the recommended sequence. Based on commit a2ebd58627e9aa48 ("ASoC: ak4642: Implement suspend callback") by Peter Ujfalusi <peter.ujfalusi@ti.com>. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> --- sound/soc/codecs/ak4613.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c index 5013d2ba0c10a968..97798d250f08689e 100644 --- a/sound/soc/codecs/ak4613.c +++ b/sound/soc/codecs/ak4613.c @@ -437,15 +437,25 @@ static struct snd_soc_dai_driver ak4613_dai = { .symmetric_rates = 1, }; -static int ak4613_resume(struct snd_soc_codec *codec) +static int ak4613_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 ak4613_resume(struct snd_soc_codec *codec) +{ + struct regmap *regmap = dev_get_regmap(codec->dev, NULL); + + regcache_cache_only(regmap, false); return regcache_sync(regmap); } static struct snd_soc_codec_driver soc_codec_dev_ak4613 = { + .suspend = ak4613_suspend, .resume = ak4613_resume, .set_bias_level = ak4613_set_bias_level, .controls = ak4613_snd_controls, -- 1.9.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Applied "ASoC: ak4613: Implement suspend callback" to the asoc tree 2016-06-16 12:34 ` [PATCH 2/3] ASoC: ak4613: Implement suspend callback Geert Uytterhoeven @ 2016-06-17 11:43 ` Mark Brown 0 siblings, 0 replies; 8+ messages in thread From: Mark Brown @ 2016-06-17 11:43 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Mark Brown, Liam Girdwood, Mark Brown, linux-renesas-soc, alsa-devel, Kuninori Morimoto, patches, Peter Ujfalusi The patch ASoC: ak4613: Implement suspend callback 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 f9ae17ba97e0fd134f7c0108c70e708313a07063 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven <geert+renesas@glider.be> Date: Thu, 16 Jun 2016 14:34:31 +0200 Subject: [PATCH] ASoC: ak4613: Implement suspend callback Add the suspend callback to accompany the existing resume operation. With the suspend/resume callbacks the regmap (regcache) state handling can follow the recommended sequence. Based on commit a2ebd58627e9aa48 ("ASoC: ak4642: Implement suspend callback") by Peter Ujfalusi <peter.ujfalusi@ti.com>. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Mark Brown <broonie@kernel.org> --- sound/soc/codecs/ak4613.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c index 5013d2ba0c10..97798d250f08 100644 --- a/sound/soc/codecs/ak4613.c +++ b/sound/soc/codecs/ak4613.c @@ -437,15 +437,25 @@ static struct snd_soc_dai_driver ak4613_dai = { .symmetric_rates = 1, }; -static int ak4613_resume(struct snd_soc_codec *codec) +static int ak4613_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 ak4613_resume(struct snd_soc_codec *codec) +{ + struct regmap *regmap = dev_get_regmap(codec->dev, NULL); + + regcache_cache_only(regmap, false); return regcache_sync(regmap); } static struct snd_soc_codec_driver soc_codec_dev_ak4613 = { + .suspend = ak4613_suspend, .resume = ak4613_resume, .set_bias_level = ak4613_set_bias_level, .controls = ak4613_snd_controls, -- 2.8.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] ASoC: wm8940: Enable cache usage to fix crashes on resume 2016-06-16 12:34 [PATCH 0/3] ASoC: ak4613/wm8940: Regmap cache fixes Geert Uytterhoeven 2016-06-16 12:34 ` [PATCH 1/3] ASoC: ak4613: Enable cache usage to fix crashes on resume Geert Uytterhoeven 2016-06-16 12:34 ` [PATCH 2/3] ASoC: ak4613: Implement suspend callback Geert Uytterhoeven @ 2016-06-16 12:34 ` Geert Uytterhoeven 2016-06-16 15:16 ` Charles Keepax 2016-06-17 11:43 ` Applied "ASoC: wm8940: Enable cache usage to fix crashes on resume" to the asoc tree Mark Brown 2 siblings, 2 replies; 8+ messages in thread From: Geert Uytterhoeven @ 2016-06-16 12:34 UTC (permalink / raw) To: Liam Girdwood, Mark Brown Cc: Peter Ujfalusi, Kuninori Morimoto, patches, linux-renesas-soc, alsa-devel, Geert Uytterhoeven The wm8940 driver is using a regmap cache sync to restore the configuration of the chip when switching from OFF to STANDBY, but does not actually define a register cache which means that the restore is never going to work and we trigger asserts in regmap. Fix this by enabling caching. Based on commit d3030d11961a8c10 ("ASoC: ak4642: Enable cache usage to fix crashes on resume") by Mark Brown <broonie@kernel.org>. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> --- Untested. --- sound/soc/codecs/wm8940.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index f6f9395ea38ef88b..1c600819f7689b45 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c @@ -743,6 +743,7 @@ static const struct regmap_config wm8940_regmap = { .max_register = WM8940_MONOMIX, .reg_defaults = wm8940_reg_defaults, .num_reg_defaults = ARRAY_SIZE(wm8940_reg_defaults), + .cache_type = REGCACHE_RBTREE, .readable_reg = wm8940_readable_register, .volatile_reg = wm8940_volatile_register, -- 1.9.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] ASoC: wm8940: Enable cache usage to fix crashes on resume 2016-06-16 12:34 ` [PATCH 3/3] ASoC: wm8940: Enable cache usage to fix crashes on resume Geert Uytterhoeven @ 2016-06-16 15:16 ` Charles Keepax 2016-06-17 11:43 ` Applied "ASoC: wm8940: Enable cache usage to fix crashes on resume" to the asoc tree Mark Brown 1 sibling, 0 replies; 8+ messages in thread From: Charles Keepax @ 2016-06-16 15:16 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Liam Girdwood, Mark Brown, Peter Ujfalusi, Kuninori Morimoto, patches, linux-renesas-soc, alsa-devel On Thu, Jun 16, 2016 at 02:34:32PM +0200, Geert Uytterhoeven wrote: > The wm8940 driver is using a regmap cache sync to restore the > configuration of the chip when switching from OFF to STANDBY, but does > not actually define a register cache which means that the restore is > never going to work and we trigger asserts in regmap. Fix this by > enabling caching. > > Based on commit d3030d11961a8c10 ("ASoC: ak4642: Enable cache usage to > fix crashes on resume") by Mark Brown <broonie@kernel.org>. > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > --- Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Thanks, Charles ^ permalink raw reply [flat|nested] 8+ messages in thread
* Applied "ASoC: wm8940: Enable cache usage to fix crashes on resume" to the asoc tree 2016-06-16 12:34 ` [PATCH 3/3] ASoC: wm8940: Enable cache usage to fix crashes on resume Geert Uytterhoeven 2016-06-16 15:16 ` Charles Keepax @ 2016-06-17 11:43 ` Mark Brown 1 sibling, 0 replies; 8+ messages in thread From: Mark Brown @ 2016-06-17 11:43 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Charles Keepax, Mark Brown, Liam Girdwood, Mark Brown, linux-renesas-soc, alsa-devel, Kuninori Morimoto, patches, Peter Ujfalusi The patch ASoC: wm8940: 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 50c7a0ef2d97e56c7ce2f1ea5fe1d8e25aadc1bb Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven <geert+renesas@glider.be> Date: Thu, 16 Jun 2016 14:34:32 +0200 Subject: [PATCH] ASoC: wm8940: Enable cache usage to fix crashes on resume The wm8940 driver is using a regmap cache sync to restore the configuration of the chip when switching from OFF to STANDBY, but does not actually define a register cache which means that the restore is never going to work and we trigger asserts in regmap. Fix this by enabling caching. Based on commit d3030d11961a8c10 ("ASoC: ak4642: Enable cache usage to fix crashes on resume") by Mark Brown <broonie@kernel.org>. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org> --- sound/soc/codecs/wm8940.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index f6f9395ea38e..1c600819f768 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c @@ -743,6 +743,7 @@ static const struct regmap_config wm8940_regmap = { .max_register = WM8940_MONOMIX, .reg_defaults = wm8940_reg_defaults, .num_reg_defaults = ARRAY_SIZE(wm8940_reg_defaults), + .cache_type = REGCACHE_RBTREE, .readable_reg = wm8940_readable_register, .volatile_reg = wm8940_volatile_register, -- 2.8.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-06-17 11:43 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-06-16 12:34 [PATCH 0/3] ASoC: ak4613/wm8940: Regmap cache fixes Geert Uytterhoeven 2016-06-16 12:34 ` [PATCH 1/3] ASoC: ak4613: Enable cache usage to fix crashes on resume Geert Uytterhoeven 2016-06-17 11:43 ` Applied "ASoC: ak4613: Enable cache usage to fix crashes on resume" to the asoc tree Mark Brown 2016-06-16 12:34 ` [PATCH 2/3] ASoC: ak4613: Implement suspend callback Geert Uytterhoeven 2016-06-17 11:43 ` Applied "ASoC: ak4613: Implement suspend callback" to the asoc tree Mark Brown 2016-06-16 12:34 ` [PATCH 3/3] ASoC: wm8940: Enable cache usage to fix crashes on resume Geert Uytterhoeven 2016-06-16 15:16 ` Charles Keepax 2016-06-17 11:43 ` Applied "ASoC: wm8940: Enable cache usage to fix crashes on resume" to the asoc tree Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox