wm8994: avoid to enable dcs done irq before init completion dcs_done
Subsystems (3)
PATCH 1/1 wm8994: avoid to enable dcs done irq before init completion dcs_done
From: wang, biao <[email protected]>
Date: Wed, 20 Nov 2013 17:53:28 +0800
Subject: [PATCH] wm8994: avoid to enable dcs done irq before init completion dcs_done
once code return from request_threaded_irq, irq was setup enabled by default, but completion var dcs_done not got initialized yet, if then a dcs done irq was raised, system will got hung as the sync mechanism is invalid now.
so this patch try not enable irq when request it until we got things ready.
--- sound/soc/codecs/wm8994.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
sound/soc/codecs/wm8994.c +5 -0
@@ -3981,6 +3981,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)struct wm8994 *control =dev_get_drvdata (codec->dev->parent);struct wm8994_priv *wm8994 =snd_soc_codec_get_drvdata (codec);struct snd_soc_dapm_context *dapm = &codec->dapm; +unsigned int dcs_done_irq;unsigned int reg;int ret, i;
@@ -4077,6 +4078,9 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)wm8994_request_irq (wm8994->wm8994,WM8994_IRQ_TEMP_SHUT , wm8994_temp_shut,"Thermal shutdown" , codec); + dcs_done_irq =regmap_irq_get_virq (wm8994->wm8994->irq_data, +WM8994_IRQ_DCS_DONE ); +irq_set_status_flags (dcs_done_irq,IRQ_NOAUTOEN ); ret =wm8994_request_irq (wm8994->wm8994,WM8994_IRQ_DCS_DONE , wm_hubs_dcs_done,"DC servo done" , &wm8994->hubs);
@@ -4313,6 +4317,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) }wm_hubs_add_analogue_routes (codec,0 ,0 ); +enable_irq (dcs_done_irq);snd_soc_dapm_add_routes (dapm, intercon,ARRAY_SIZE (intercon));switch (control->type) {
Signature · 1 line
1.7.0.4
Mark Brown
maintainerQuoted 3 lines · wangbiao
From: wang, biao <[email protected]>
Date: Wed, 20 Nov 2013 17:53:28 +0800
Subject: [PATCH] wm8994: avoid to enable dcs done irq before init completiondcs_done
Please don't include things like this in the body of your mail unless you are overriding things in the header, submit things in the format documented in SubmittingPatches. This will avoid confusing tools used to handle patches.
Please also try to send your mail to only relevant people, the CC list above is very broad. Many kernel developers get a lot of mail so it's good to be sure that you know why everyone on the CC list is there.
Quoted 7 lines
once code return from
request_threaded_irq, irq was setup enabled by default, but completion vardcs_donenot got initialized yet, if then a dcs done irq was raised, system will got hung as the sync mechanism is invalid now.so this patch try not enable irq when request it until we got things ready.
I would expect to see a patch such as this moving either the interrupt request or (more likely) the completion init. However that's not what this patch does. Why is this? The most obvious thing here would be to move the initialisation of the completion to the start of the probe() function.
PATCH v2 1/1 wm8994: move dcs done irq request to the end of initialization of completion
In reply to wangbiaoonce code return from request_threaded_irq, irq was setup enabled by default, but completion var dcs_done not got initialized yet, if then a dcs done irq was raised, system will got hung as the sync mechanism is invalid now.
so this patch move dcs done irq request to the end of initialization of completion.
--- sound/soc/codecs/wm8994.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-)
sound/soc/codecs/wm8994.c +5 -6
@@ -4077,12 +4077,6 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)wm8994_request_irq (wm8994->wm8994,WM8994_IRQ_TEMP_SHUT , wm8994_temp_shut,"Thermal shutdown" , codec); - ret =wm8994_request_irq (wm8994->wm8994,WM8994_IRQ_DCS_DONE , - wm_hubs_dcs_done,"DC servo done" , - &wm8994->hubs); -if (ret ==0 ) - wm8994->hubs.dcs_done_irq = true; -switch (control->type) {case WM8994 :if (wm8994->micdet_irq) {
@@ -4313,6 +4307,11 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) }wm_hubs_add_analogue_routes (codec,0 ,0 ); + ret =wm8994_request_irq (wm8994->wm8994,WM8994_IRQ_DCS_DONE , + wm_hubs_dcs_done,"DC servo done" , + &wm8994->hubs); +if (ret ==0 ) + wm8994->hubs.dcs_done_irq = true;snd_soc_dapm_add_routes (dapm, intercon,ARRAY_SIZE (intercon));switch (control->type) {
Signature · 1 line
1.7.0.4
Re: [PATCH V2] wm8994: move dcs done irq request to the end of initialization of completion
Quoted 4 lines · wangbiao
once code return from
request_threaded_irq, irq was setup enabled by default, but completion vardcs_donenot got initialized yet, if then a dcs done irq was raised, system will got hung as the sync mechanism is invalid now.
Applied, thnaks.