ASoC: wm8994: fix the codec state machine
Subsystems (3)
PATCH 1/2 ASoC: wm8994: fix the codec state machine
few places the mic_detecting is not updated correctly when state changes, causing jack detection to go wrong
--- sound/soc/codecs/wm8994.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
sound/soc/codecs/wm8994.c +3 -1
@@ -3547,6 +3547,7 @@ static void wm8958_mic_id(void *data, u16 status)snd_soc_jack_report (wm8994->micdet[0 ].jack,0 , wm8994->btn_mask |SND_JACK_HEADSET ); + wm8994->mic_detecting = true;return ; }
@@ -3672,7 +3673,7 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data)snd_soc_update_bits (codec,WM1811_JACKDET_CTRL ,WM1811_JACKDET_DB ,WM1811_JACKDET_DB ); - wm8994->mic_detecting = false; + wm8994->mic_detecting = true; wm8994->jack_mic = false;snd_soc_update_bits (codec,WM8958_MIC_DETECT_1 ,WM8958_MICD_ENA ,0 );
@@ -3696,6 +3697,7 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data)/* Since we only report deltas force an update, ensures we * avoid bootstrapping issues with the core. */ snd_soc_jack_report (wm8994->micdet[0 ].jack,0 ,0 ); + wm8994->mic_detecting = true;pm_runtime_put (codec->dev);return IRQ_HANDLED ;
Signature · 1 line
1.7.0.4
PATCH 2/2 ASoC: wm8958: check for return value before using as array index
return maybe EINVAL and needs to be checked
--- sound/soc/codecs/wm8994.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
sound/soc/codecs/wm8994.c +4 -0
@@ -384,6 +384,8 @@ static int wm8994_get_drc_enum(struct snd_kcontrol *kcontrol,struct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec);int drc =wm8994_get_drc (kcontrol->id.name); +if (drc <0 ) +return drc; ucontrol->value.enumerated.item[0 ] = wm8994->drc_cfg[drc];return 0 ;
@@ -489,6 +491,8 @@ static int wm8994_get_retune_mobile_enum(struct snd_kcontrol *kcontrol,struct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec);int block =wm8994_get_retune_mobile_block (kcontrol->id.name); +if (block <0 ) +return block; ucontrol->value.enumerated.item[0 ] = wm8994->retune_mobile_cfg[block];return 0 ;
Signature · 1 line
1.7.0.4
Mark Brown
maintainerRe: [PATCH 2/2] ASoC: wm8958: check for return value before using as array index
Quoted 1 line · Vinod Koul
return maybe EINVAL and needs to be checked
This is already applied...
Please also remember to CC maintainers on patches
Mark Brown
maintainerQuoted 2 lines · Vinod Koul
few places the
mic_detectingis not updated correctly when state changes, causing jack detection to go wrong
This doesn't apply against current code.
sound/soc/codecs/wm8994.c static irqreturn_t wm1811_jackdet_irq(int irq, void *data) · line 3700
Quoted 5 lines
sound/soc/codecs/wm8994.c +1
-0@@ -3696,6 +3697,7 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data)/* Since we only report deltas force an update, ensures we * avoid bootstrapping issues with the core. */ snd_soc_jack_report (wm8994->micdet[0 ].jack,0 ,0 ); + wm8994->mic_detecting = true;
This doesn't look right, as the comment says the report there isn't a real report it's just a kick to the core. We only want to start looking for a mic if something changed to make that a good idea or on init.