[alsa-devel] [RFC][PATCH] pxa2xx-ac97: switch AC unit to correct state before probing
Hi,
I've stumbled upon a problem with my tosa unit. The bootloader leaves ac97 in some partially enabled state, so when request_irq enables the AC97 irq, I see a unending storm of irq requests. I've come with the following patch (against 2.6.27, if the idea is OK, I'll rebase against 2.6.28-rc).
From: Dmitry Baryshkov dbaryshkov@gmail.com
If AC97 unit is in partially enabled state, early request_irq can trigger IRQ storm or even full hang up. Workaround this by forcibly switching ACLINK off at the start of the probe.
Signed-off-by: Dmitry Baryshkov dbaryshkov@gmail.com --- sound/soc/pxa/pxa2xx-ac97.c | 30 +++++++++++++++++------------- 1 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index d94a495..259c6e1 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c @@ -315,10 +315,6 @@ static int pxa2xx_ac97_probe(struct platform_device *pdev, { int ret;
- ret = request_irq(IRQ_AC97, pxa2xx_ac97_irq, IRQF_DISABLED, "AC97", NULL); - if (ret < 0) - goto err; - pxa_gpio_mode(GPIO31_SYNC_AC97_MD); pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD); pxa_gpio_mode(GPIO28_BITCLK_AC97_MD); @@ -331,28 +327,36 @@ static int pxa2xx_ac97_probe(struct platform_device *pdev, if (IS_ERR(ac97conf_clk)) { ret = PTR_ERR(ac97conf_clk); ac97conf_clk = NULL; - goto err_irq; + goto err_conf; } #endif + GCR = GCR_ACLINK_OFF; + ac97_clk = clk_get(&pdev->dev, "AC97CLK"); if (IS_ERR(ac97_clk)) { ret = PTR_ERR(ac97_clk); ac97_clk = NULL; - goto err_irq; + goto err_clk; } clk_enable(ac97_clk); + + ret = request_irq(IRQ_AC97, pxa2xx_ac97_irq, IRQF_DISABLED, "AC97", NULL); + if (ret < 0) + goto err_irq; + return 0;
- err_irq: +err_irq: GCR |= GCR_ACLINK_OFF; + clk_disable(ac97_clk); + clk_put(ac97_clk); + ac97_clk = NULL; +err_clk: #ifdef CONFIG_PXA27x - if (ac97conf_clk) { - clk_put(ac97conf_clk); - ac97conf_clk = NULL; - } + clk_put(ac97conf_clk); + ac97conf_clk = NULL; +err_conf: #endif - free_irq(IRQ_AC97, NULL); - err: return ret; }
On Mon, Nov 10, 2008 at 10:11:24PM +0300, Dmitry Baryshkov wrote:
AC97 irq, I see a unending storm of irq requests. I've come with the following patch (against 2.6.27, if the idea is OK, I'll rebase against 2.6.28-rc).
That's going to cause the pxa25x to use the full timeout for the reset since it uses the interrupt to detect completion. This should just introduce a delay (which we shouldn't do) and may break something. I'd expect that simply switching pxa25x to polling GSR for completion like everything else does would deal with it but testing would be nice if anyone has a board...
Otherwise it looks OK - we're not using the interrupt for anything else until after we've reset things so it's a sensible solution.
Mark Brown wrote:
On Mon, Nov 10, 2008 at 10:11:24PM +0300, Dmitry Baryshkov wrote:
AC97 irq, I see a unending storm of irq requests. I've come with the following patch (against 2.6.27, if the idea is OK, I'll rebase against 2.6.28-rc).
That's going to cause the pxa25x to use the full timeout for the reset since it uses the interrupt to detect completion. This should just introduce a delay (which we shouldn't do) and may break something. I'd expect that simply switching pxa25x to polling GSR for completion like everything else does would deal with it but testing would be nice if anyone has a board...
I'll check on tosa (pxa255). However I didn't notice any additional delay during startup.
Otherwise it looks OK - we're not using the interrupt for anything else until after we've reset things so it's a sensible solution.
On Tue, Nov 11, 2008 at 02:51:47PM +0300, Dmitry Baryshkov wrote:
Mark Brown wrote:
expect that simply switching pxa25x to polling GSR for completion like everything else does would deal with it but testing would be nice if anyone has a board...
I'll check on tosa (pxa255). However I didn't notice any additional delay during startup.
The timeout is ~1ms so it's not going to be immediately obvious to a human.
participants (2)
-
Dmitry Baryshkov
-
Mark Brown