Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Hofman <pavel.hofman@ivitera.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 5/6] adding support for multiple external clock types
Date: Tue, 15 Sep 2009 15:09:08 +0200	[thread overview]
Message-ID: <4AAF91F4.2050501@ivitera.com> (raw)
In-Reply-To: <s5hmy4wbgc6.wl%tiwai@suse.de>

Takashi Iwai wrote:
> At Tue, 15 Sep 2009 00:45:02 +0200,
> pavel.hofman@ivitera.com wrote:
>> From: Pavel Hofman <pavel.hofman@ivitera.com>
>>
>>
>> Signed-off-by: Pavel Hofman <pavel.hofman@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?

The original code comes from times when the sole use of
is_pro_rate_locked in snd_vt1724_set_pro_rate was simple:

if (!force && is_pro_rate_locked(ice))
	return 0;

I.e. if the RATE_LOCK control is activated, no change in rate was allowed.

Later in
http://git.alsa-project.org/?p=alsa-kmirror.git;a=commitdiff;h=f1abd41e000348151d02d9ece830a0039fac3bbe
the code was changed to

if (!force && is_pro_rate_locked(ice)) {
		return (rate == ice->cur_rate) ? 0 : -EBUSY;

The extra check rate == ice->cur_rate does not make sense for
external-clock modes and sometimes I experienced EBUSY when testing the
external-clock functionality.


> 
>> @@ -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.

Sorry, I will move it.

> 
>> @@ -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
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2009-09-15 13:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-14 22:44 [PATCH 1/6] AK4114 - fix output selector bits, fix spelling pavel.hofman
2009-09-14 22:44 ` [PATCH 2/6] ak4620 support, moving the proc codec regs entry to ak4xxx-adda, pavel.hofman
2009-09-14 22:45   ` [PATCH 3/6] ak4113 support pavel.hofman
2009-09-14 22:45     ` [PATCH 4/6] Adding GPIO routines for mask and direction pavel.hofman
2009-09-14 22:45       ` [PATCH 5/6] adding support for multiple external clock types pavel.hofman
2009-09-14 22:45         ` [PATCH 6/6] Infrasonic Quartet support pavel.hofman
2009-09-15 11:36           ` Takashi Iwai
2009-09-15 11:24         ` [PATCH 5/6] adding support for multiple external clock types Takashi Iwai
2009-09-15 13:09           ` Pavel Hofman [this message]
2009-09-15 13:29             ` Takashi Iwai
2009-09-15 11:19       ` [PATCH 4/6] Adding GPIO routines for mask and direction Takashi Iwai
2009-09-15 11:55         ` Pavel Hofman
2009-09-15 11:15     ` [PATCH 3/6] ak4113 support Takashi Iwai
2009-09-15 11:54       ` Pavel Hofman
2009-09-15 11:12   ` [PATCH 2/6] ak4620 support, moving the proc codec regs entry to ak4xxx-adda, Takashi Iwai
2009-09-15 11:07 ` [PATCH 1/6] AK4114 - fix output selector bits, fix spelling Takashi Iwai
2009-09-15 11:51   ` Pavel Hofman
2009-09-15 12:31     ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AAF91F4.2050501@ivitera.com \
    --to=pavel.hofman@ivitera.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox