ASoC: Check for exact register match in wm97xx_reset()
Subsystems (3)
PATCH 1/2 ASoC: Check for exact register match in wm97xx_reset()
To provide added robustness in case an AC97 controller reads back all zeros in error cases check for an exact match when testing to see if resets have brought the codec back.
--- sound/soc/codecs/wm9712.c | 4 ++-- sound/soc/codecs/wm9713.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/wm9712.c +2 -2
@@ -589,12 +589,12 @@ static int wm9712_reset(struct snd_soc_codec *codec, int try_warm) {if (try_warm && soc_ac97_ops.warm_reset) { soc_ac97_ops.warm_reset (codec->ac97); -if (!(ac97_read (codec,0 ) &0x8000 )) +if (ac97_read (codec,0 ) ==0x6174 )return 1 ; } soc_ac97_ops.reset (codec->ac97); -if (ac97_read (codec,0 ) &0x8000 ) +if (ac97_read (codec,0 ) !=0x6174 ) goto err;return 0 ;
sound/soc/codecs/wm9713.c +2 -2
@@ -1076,12 +1076,12 @@ int wm9713_reset(struct snd_soc_codec *codec, int try_warm) {if (try_warm && soc_ac97_ops.warm_reset) { soc_ac97_ops.warm_reset (codec->ac97); -if (!(ac97_read (codec,0 ) &0x8000 )) +if (ac97_read (codec,0 ) ==0x6174 )return 1 ; } soc_ac97_ops.reset (codec->ac97); -if (ac97_read (codec,0 ) &0x8000 ) +if (ac97_read (codec,0 ) !=0x6174 )return -EIO ;return 0 ; }
Signature · 1 line
1.5.5.4
PATCH 2/2 ASoC: Don't block system resume
From: Andy Green <[email protected]>
On OpenMoko soc-audio resume is taking 700ms of the whole resume time of 1.3s, dominated by writes to the codec over I2C. This patch shunts the resume guts into a workqueue which then is done asynchronously.
The "card" is locked using the ALSA power state APIs as suggested by Mark Brown.
[Added fix for race with resume to suspend and fixed a couple of nits from checkpatch -- broonie.]
--- include/sound/soc.h | 1 + sound/soc/soc-core.c | 46 +++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 44 insertions(+), 3 deletions(-)
include/sound/soc.h +1 -0
@@ -510,6 +510,7 @@ struct snd_soc_device {struct snd_soc_codec *codec;struct snd_soc_codec_device *codec_dev;struct delayed_work delayed_work; +struct work_struct deferred_resume_work;void *codec_data; };
sound/soc/soc-core.c +43 -3
77 lines not on this page · raw message
Signature · 1 line
1.5.5.4
At Fri, 13 Jun 2008 15:39:12 +0100,
Quoted 17 lines · Mark Brown
To provide added robustness in case an AC97 controller reads back all zeros in error cases check for an exact match when testing to see if resets have brought the codec back.
Signed-off-by Mark Brown <[email protected]>--- sound/soc/codecs/wm9712.c | 4 ++-- sound/soc/codecs/wm9713.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)sound/soc/codecs/wm9712.c +0
-0@@ -589,12 +589,12 @@ static int wm9712_reset(struct snd_soc_codec *codec, int try_warm) {
sound/soc/codecs/wm9712.c static int wm9712_reset(struct snd_soc_codec *codec, int try_warm) · line 597
Quoted 10 lines
sound/soc/codecs/wm9712.c +2
-2if (try_warm && soc_ac97_ops.warm_reset) { soc_ac97_ops.warm_reset (codec->ac97); -if (!(ac97_read (codec,0 ) &0x8000 )) +if (ac97_read (codec,0 ) ==0x6174 )return 1 ; } soc_ac97_ops.reset (codec->ac97); -if (ac97_read (codec,0 ) &0x8000 ) +if (ac97_read (codec,0 ) !=0x6174 )
Can we define this magic value more understandable?
Quoted 9 lines
sound/soc/codecs/wm9712.c +0
-0goto err;return 0 ;sound/soc/codecs/wm9713.c +0
-0@@ -1076,12 +1076,12 @@ int wm9713_reset(struct snd_soc_codec *codec, int try_warm) {
sound/soc/codecs/wm9713.c int wm9713_reset(struct snd_soc_codec *codec, int try_warm) · line 1084
Quoted 10 lines
sound/soc/codecs/wm9713.c +2
-2if (try_warm && soc_ac97_ops.warm_reset) { soc_ac97_ops.warm_reset (codec->ac97); -if (!(ac97_read (codec,0 ) &0x8000 )) +if (ac97_read (codec,0 ) ==0x6174 )return 1 ; } soc_ac97_ops.reset (codec->ac97); -if (ac97_read (codec,0 ) &0x8000 ) +if (ac97_read (codec,0 ) !=0x6174 )
Ditto.
thanks,
Takashi
Quoted 7 lines · Takashi Iwai
sound/soc/codecs/wm9712.c static int wm9712_reset(struct snd_soc_codec *codec, int try_warm) · line 597
Quoted 3 lines · Mark Brown
sound/soc/codecs/wm9712.c +1
-1soc_ac97_ops.reset (codec->ac97); -if (ac97_read (codec,0 ) &0x8000 ) +if (ac97_read (codec,0 ) !=0x6174 )Can we define this magic value more understandable?
It's the default value for the (non-modifiable) register - building it up from a bitmask with semantics isn't particularly meaningful. The only thing I can think is to just reference the register cache default values, I'll resend in a minute or two.