Commit 6796d5a0 authored by Pavel Hofman's avatar Pavel Hofman Committed by Takashi Iwai

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: default avatarPavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 49470306
...@@ -118,9 +118,12 @@ static inline int stdclock_is_spdif_master(struct snd_ice1712 *ice) ...@@ -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; 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) 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,10 +671,15 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, ...@@ -668,10 +671,15 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate,
return -EBUSY; return -EBUSY;
} }
if (!force && is_pro_rate_locked(ice)) { 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); spin_unlock_irqrestore(&ice->reg_lock, flags);
return (rate == ice->cur_rate) ? 0 : -EBUSY; return (rate == ice->cur_rate) ? 0 : -EBUSY;
} }
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); old_rate = ice->get_rate(ice);
if (force || (old_rate != rate)) if (force || (old_rate != rate))
ice->set_rate(ice, rate); ice->set_rate(ice, rate);
...@@ -679,6 +687,7 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, ...@@ -679,6 +687,7 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate,
spin_unlock_irqrestore(&ice->reg_lock, flags); spin_unlock_irqrestore(&ice->reg_lock, flags);
return 0; return 0;
} }
}
ice->cur_rate = rate; ice->cur_rate = rate;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment