[alsa-devel] [PATCH] Convert ASoC pxa2xx-ac97 driver to use the clock API
Russell King - ARM Linux
linux at arm.linux.org.uk
Thu Feb 21 16:26:13 CET 2008
On Tue, Feb 19, 2008 at 04:04:17PM +0000, Mark Brown wrote:
> @@ -294,16 +299,37 @@ static int pxa2xx_ac97_probe(struct platform_device *pdev)
> #ifdef CONFIG_PXA27x
> /* Use GPIO 113 as AC97 Reset on Bulverde */
> pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
> +
> + ac97conf_clk = clk_get(&pdev->dev, "AC97CONFCLK");
> + if (IS_ERR(ac97conf_clk)) {
> + ac97conf_clk = NULL;
> + ret = -ENODEV;
ret = PTR_ERR(ac97conf_clk);
Always propagate error codes.
> + goto err_irq;
> + }
> #endif
> - pxa_set_cken(CKEN_AC97, 1);
> + ac97_clk = clk_get(&pdev->dev, "AC97CLK");
> + if (IS_ERR(ac97_clk)) {
> + ac97_clk = NULL;
> + ret = -ENODEV;
Ditto.
> + goto err_irq;
> + }
> return 0;
>
> - err:
> - if (CKEN & (1 << CKEN_AC97)) {
> - GCR |= GCR_ACLINK_OFF;
> - free_irq(IRQ_AC97, NULL);
> - pxa_set_cken(CKEN_AC97, 0);
> + err_irq:
> + GCR |= GCR_ACLINK_OFF;
> + if (ac97_clk) {
> + clk_disable(ac97_clk);
> + clk_put(ac97_clk);
> + ac97_clk = NULL;
> }
Under what circumstance will we get here with a non-NULL ac97_clk?
More information about the Alsa-devel
mailing list