All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: sgtl5000: Fix driver probe after reset
@ 2013-05-08 17:04 Fabio Estevam
  2013-05-08 20:12 ` Lars-Peter Clausen
  2013-05-09  9:30 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Fabio Estevam @ 2013-05-08 17:04 UTC (permalink / raw)
  To: broonie; +Cc: Fabio Estevam, matt, alsa-devel, eric.nelson, troy.kisky

From: Fabio Estevam <fabio.estevam@freescale.com>

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.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 sound/soc/codecs/sgtl5000.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 327b443..c59fae8 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -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,
-- 
1.7.9.5

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

* Re: [PATCH] ASoC: sgtl5000: Fix driver probe after reset
  2013-05-08 17:04 [PATCH] ASoC: sgtl5000: Fix driver probe after reset Fabio Estevam
@ 2013-05-08 20:12 ` Lars-Peter Clausen
  2013-05-09  9:30 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Lars-Peter Clausen @ 2013-05-08 20:12 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Fabio Estevam, alsa-devel, matt, eric.nelson, troy.kisky, broonie

On 05/08/2013 07:04 PM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> 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.

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.

> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  sound/soc/codecs/sgtl5000.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
> index 327b443..c59fae8 100644
> --- a/sound/soc/codecs/sgtl5000.c
> +++ b/sound/soc/codecs/sgtl5000.c
> @@ -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.

>  };
>  
>  static int sgtl5000_i2c_probe(struct i2c_client *client,

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

* Re: [PATCH] ASoC: sgtl5000: Fix driver probe after reset
  2013-05-08 17:04 [PATCH] ASoC: sgtl5000: Fix driver probe after reset Fabio Estevam
  2013-05-08 20:12 ` Lars-Peter Clausen
@ 2013-05-09  9:30 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2013-05-09  9:30 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Fabio Estevam, matt, alsa-devel, eric.nelson, troy.kisky


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

On Wed, May 08, 2013 at 02:04:06PM -0300, Fabio Estevam wrote:

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

[-- 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] 3+ messages in thread

end of thread, other threads:[~2013-05-09  9:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-08 17:04 [PATCH] ASoC: sgtl5000: Fix driver probe after reset Fabio Estevam
2013-05-08 20:12 ` Lars-Peter Clausen
2013-05-09  9:30 ` 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.