[alsa-devel] [PATCH 5/6] adding support for multiple external clock types

Takashi Iwai tiwai at suse.de
Tue Sep 15 13:24:57 CEST 2009


At Tue, 15 Sep 2009 00:45:02 +0200,
pavel.hofman at ivitera.com wrote:
> 
> From: Pavel Hofman <pavel.hofman at ivitera.com>
> 
> 
> Signed-off-by: Pavel Hofman <pavel.hofman at ivitera.com>
> 
> diff --git a/pci/ice1712/ice1712.h b/pci/ice1712/ice1712.h
> --- a/pci/ice1712/ice1724.c
> +++ b/pci/ice1712/ice1724.c
> @@ -120,7 +122,7 @@ static inline int stdclock_is_spdif_master(struct snd_ice1712 *ice)
>  
>  static inline int is_pro_rate_locked(struct snd_ice1712 *ice)
>  {
> -	return ice->is_spdif_master(ice) || PRO_RATE_LOCKED;
> +	return (!ice->is_spdif_master(ice)) && PRO_RATE_LOCKED;

What is the reason of this change of logic?

> @@ -210,6 +212,16 @@ static void snd_vt1724_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data)
>  		outb((data >> 16) & 0xff, ICEREG1724(ice, GPIO_WRITE_MASK_22));
>  	inw(ICEREG1724(ice, GPIO_WRITE_MASK)); /* dummy read for pci-posting */
>  }
> +static unsigned int snd_vt1724_get_gpio_mask(struct snd_ice1712 *ice)
> +{
> +	unsigned int mask;
> +	if (!ice->vt1720)
> +		mask = (unsigned int)inb(ICEREG1724(ice, GPIO_WRITE_MASK_22));
> +	else
> +		mask = 0;
> +	mask = (mask << 16) | inw(ICEREG1724(ice, GPIO_WRITE_MASK));
> +	return mask;
> +}

Put this into the previous patch.

> @@ -661,12 +673,16 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate,
>  		return (rate == ice->cur_rate) ? 0 : -EBUSY;
>  	}
>  
> -	old_rate = ice->get_rate(ice);
> -	if (force || (old_rate != rate))
> -		ice->set_rate(ice, rate);
> -	else if (rate == ice->cur_rate) {
> -		spin_unlock_irqrestore(&ice->reg_lock, flags);
> -		return 0;
> +	if (force || !ice->is_spdif_master(ice)) {
> +		/* force means the rate was switched by ucontrol, otherwise
> +		 * setting clock rate for internal clock mode */
> +		old_rate = ice->get_rate(ice);
> +		if (force || (old_rate != rate))
> +			ice->set_rate(ice, rate);
> +		else if (rate == ice->cur_rate) {
> +			spin_unlock_irqrestore(&ice->reg_lock, flags);
> +			return 0;
> +		}

This should be related with the change above...


thanks,

Takashi


More information about the Alsa-devel mailing list