Skip to contentSkip to conversation

ASoC: sgtl5000: Fix driver probe after reset

PATCH Superseded Fabio Estevam 3 participants 3 messages May 8, 2013 – May 9, 2013

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Fabio Estevam

author maintainer
#0 lore raw

PATCH 1/1 ASoC: sgtl5000: Fix driver probe after reset

From: Fabio Estevam <[email protected]>

sgtl5000 codec does not have a reset line, nor a reset command in software.

After a 'reboot' command in Linux or after pressing the system's reset button the sgtl5000 driver fails to probe:

sgtl5000 0-000a: Device with ID register ffff is not a sgtl5000 sgtl5000 0-000a: ASoC: failed to probe CODEC -19 imx-sgtl5000 sound.12: ASoC: failed to instantiate card -19 imx-sgtl5000 sound.12: snd_soc_register_card failed (-19)

As the sgtl5000 codec did not go through a real reset, we cannot rely on the reg_defaults array, since these are only valid after a clean power-on reset.

To fix this issue, use 'reg_defaults_raw' which tells the regcache driver to actually read the codec registers and then fill the cache.

---
 sound/soc/codecs/sgtl5000.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/sgtl5000.c +2 -2
index 327b443..c59fae8 100644
@@ -1470,8 +1470,8 @@ static const struct regmap_config sgtl5000_regmap = {
 	.readable_reg = sgtl5000_readable,
 
 	.cache_type = REGCACHE_RBTREE,
-	.reg_defaults = sgtl5000_reg_defaults,
-	.num_reg_defaults = ARRAY_SIZE(sgtl5000_reg_defaults),
+	.reg_defaults_raw = sgtl5000_reg_defaults,
+	.num_reg_defaults_raw = ARRAY_SIZE(sgtl5000_reg_defaults),
 };
 
 static int sgtl5000_i2c_probe(struct i2c_client *client,
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 12 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

sgtl5000 codec does not have a reset line, nor a reset command in software.

After a 'reboot' command in Linux or after pressing the system's reset button the sgtl5000 driver fails to probe:

sgtl5000 0-000a: Device with ID register ffff is not a sgtl5000 sgtl5000 0-000a: ASoC: failed to probe CODEC -19 imx-sgtl5000 sound.12: ASoC: failed to instantiate card -19 imx-sgtl5000 sound.12: snd_soc_register_card failed (-19)

Quoted 5 lines

As the sgtl5000 codec did not go through a real reset, we cannot rely on the reg_defaults array, since these are only valid after a clean power-on reset.

To fix this issue, use 'reg_defaults_raw' which tells the regcache driver to actually read the codec registers and then fill the cache.

No, that's not what it does. It will only fill the cache from the hardware, if reg_defaults_raw is NULL and num_reg_defaults_raw is not 0.

Quoted 11 lines
---
 sound/soc/codecs/sgtl5000.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/sgtl5000.c +0 -0
index 327b443..c59fae8 100644

sound/soc/codecs/sgtl5000.c static const struct regmap_config sgtl5000_regmap = { · line 1474

Quoted 7 lines
sound/soc/codecs/sgtl5000.c +2 -2
@@ -1470,8 +1470,8 @@ static const struct regmap_config sgtl5000_regmap = {
 	.readable_reg = sgtl5000_readable,
 
 	.cache_type = REGCACHE_RBTREE,
-	.reg_defaults = sgtl5000_reg_defaults,
-	.num_reg_defaults = ARRAY_SIZE(sgtl5000_reg_defaults),
+	.reg_defaults_raw = sgtl5000_reg_defaults,
+	.num_reg_defaults_raw = ARRAY_SIZE(sgtl5000_reg_defaults),

This shouldn't even compile without generating a warning.

Quoted 3 lines
sound/soc/codecs/sgtl5000.c +0 -0
 };
 
 static int sgtl5000_i2c_probe(struct i2c_client *client,
maintainer
#2 lore raw
In reply to Fabio Estevam
Quoted 5 lines · Fabio Estevam

As the sgtl5000 codec did not go through a real reset, we cannot rely on the reg_defaults array, since these are only valid after a clean power-on reset.

To fix this issue, use 'reg_defaults_raw' which tells the regcache driver to actually read the codec registers and then fill the cache.

No, this isn't what raw defaults are for - they're for cases where the power on defaults can be changed (eg, by setting pins on the board). If we do this cases where we rely on defaults actually being chip defaults can get broken.