pxa2xx-ac97: switch AC unit to correct state before probing
Subsystems (3)
RFC PATCH 1/1 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 <[email protected]>
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.
--- sound/soc/pxa/pxa2xx-ac97.c | 30 +++++++++++++++++------------- 1 files changed, 17 insertions(+), 13 deletions(-)
sound/soc/pxa/pxa2xx-ac97.c +17 -13
@@ -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; }
Signature · 6 lines
1.5.6.5 -- With best wishes Dmitry
Quoted 3 lines · Dmitry Baryshkov
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.
Quoted 6 lines · Mark Brown
Quoted 3 lines · Dmitry Baryshkov
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).
Quoted 6 lines
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.
Quoted 3 lines
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.
Signature · 2 lines
With best wishes Dmitry
Quoted 8 lines · Dmitry Baryshkov
Quoted 3 lines · Mark Brown
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.