[alsa-devel] [PATCH] Convert non-SoC PXA2xx AC97 driver to clock API

Russell King - ARM Linux linux at arm.linux.org.uk
Thu Feb 21 16:27:41 CET 2008


On Tue, Feb 19, 2008 at 04:04:18PM +0000, Mark Brown wrote:
> @@ -335,8 +340,21 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
>  #ifdef CONFIG_PXA27x
>  	/* Use GPIO 113 as AC97 Reset on Bulverde */
>  	pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
> +	ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK");
> +	if (IS_ERR(ac97conf_clk)) {
> +		ac97conf_clk = NULL;
> +		ret = -ENODEV;

Same comments as previous patch.

> +		goto err;
> +	}
>  #endif
> -	pxa_set_cken(CKEN_AC97, 1);
> +
> +	ac97_clk = clk_get(&dev->dev, "AC97CLK");
> +	if (IS_ERR(ac97_clk)) {
> +		ac97_clk = NULL;
> +		ret = -ENODEV;

Ditto.

> +		goto err;
> +	}
> +	clk_enable(ac97_clk);
>  
>  	ret = snd_ac97_bus(card, 0, &pxa2xx_ac97_ops, NULL, &ac97_bus);
>  	if (ret)
> @@ -361,11 +379,20 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
>   err:
>  	if (card)
>  		snd_card_free(card);
> -	if (CKEN & (1 << CKEN_AC97)) {
> +	if (ac97_clk) {
>  		GCR |= GCR_ACLINK_OFF;
>  		free_irq(IRQ_AC97, NULL);
> -		pxa_set_cken(CKEN_AC97, 0);
> +		clk_disable(ac97_clk);
> +		clk_put(ac97_clk);
> +		ac97_clk = NULL;
> +	}
> +#ifdef CONFIG_PXA27x
> +	if (ac97conf_clk) {
> +		clk_disable(ac97conf_clk);

This might disable the clock more times than its been enabled, particularly
if the getting of ac97_clk fails.



More information about the Alsa-devel mailing list