diff options
author | Pavel Hofman <pavel.hofman@ivitera.com> | 2009-09-17 00:25:39 +0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-09-21 17:47:08 +0400 |
commit | 6796d5a05f4d3caad17d2586b3e5776fda50ef82 (patch) | |
tree | a360f3984b47e8d262d0f5b20cfa2744342f6627 /sound/pci/ice1712 | |
parent | 494703062b6e6ef5e72364aafc9bcbc172d53dea (diff) | |
download | linux-6796d5a05f4d3caad17d2586b3e5776fda50ef82.tar.xz |
ALSA: ice1724 - pro-rate-locking makes sense only for internal clock mode
* pro-rate-locking applies to internal clock mode only
* required rate and current rate are compared for internal clock mode only
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ice1712')
-rw-r--r-- | sound/pci/ice1712/ice1724.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 2213beec009a..514e15385f7a 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -118,9 +118,12 @@ static inline int stdclock_is_spdif_master(struct snd_ice1712 *ice) return (inb(ICEMT1724(ice, RATE)) & VT1724_SPDIF_MASTER) ? 1 : 0; } +/* + * locking rate makes sense only for internal clock mode + */ 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; } /* @@ -668,16 +671,22 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, return -EBUSY; } if (!force && is_pro_rate_locked(ice)) { + /* comparing required and current rate - makes sense for + * internal clock only */ spin_unlock_irqrestore(&ice->reg_lock, flags); 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; + } } ice->cur_rate = rate; |