ALSA: sscape: fix incorrect timeout after microcode upload
A comment states that one should wait up to 5 secs while a waiting loop waits only 5 system ticks. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
199f797873
commit
554b91edec
1 changed files with 12 additions and 12 deletions
|
@ -393,20 +393,20 @@ static int sscape_wait_dma_unsafe(unsigned io_base, enum GA_REG reg, unsigned ti
|
||||||
*/
|
*/
|
||||||
static int obp_startup_ack(struct soundscape *s, unsigned timeout)
|
static int obp_startup_ack(struct soundscape *s, unsigned timeout)
|
||||||
{
|
{
|
||||||
while (timeout != 0) {
|
unsigned long end_time = jiffies + msecs_to_jiffies(timeout);
|
||||||
|
|
||||||
|
do {
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
unsigned char x;
|
unsigned char x;
|
||||||
|
|
||||||
schedule_timeout_uninterruptible(1);
|
|
||||||
|
|
||||||
spin_lock_irqsave(&s->lock, flags);
|
spin_lock_irqsave(&s->lock, flags);
|
||||||
x = inb(HOST_DATA_IO(s->io_base));
|
x = inb(HOST_DATA_IO(s->io_base));
|
||||||
spin_unlock_irqrestore(&s->lock, flags);
|
spin_unlock_irqrestore(&s->lock, flags);
|
||||||
if ((x & 0xfe) == 0xfe)
|
if ((x & 0xfe) == 0xfe)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
--timeout;
|
msleep(10);
|
||||||
} /* while */
|
} while (time_before(jiffies, end_time));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -420,20 +420,20 @@ static int obp_startup_ack(struct soundscape *s, unsigned timeout)
|
||||||
*/
|
*/
|
||||||
static int host_startup_ack(struct soundscape *s, unsigned timeout)
|
static int host_startup_ack(struct soundscape *s, unsigned timeout)
|
||||||
{
|
{
|
||||||
while (timeout != 0) {
|
unsigned long end_time = jiffies + msecs_to_jiffies(timeout);
|
||||||
|
|
||||||
|
do {
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
unsigned char x;
|
unsigned char x;
|
||||||
|
|
||||||
schedule_timeout_uninterruptible(1);
|
|
||||||
|
|
||||||
spin_lock_irqsave(&s->lock, flags);
|
spin_lock_irqsave(&s->lock, flags);
|
||||||
x = inb(HOST_DATA_IO(s->io_base));
|
x = inb(HOST_DATA_IO(s->io_base));
|
||||||
spin_unlock_irqrestore(&s->lock, flags);
|
spin_unlock_irqrestore(&s->lock, flags);
|
||||||
if (x == 0xfe)
|
if (x == 0xfe)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
--timeout;
|
msleep(10);
|
||||||
} /* while */
|
} while (time_before(jiffies, end_time));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -529,10 +529,10 @@ static int upload_dma_data(struct soundscape *s,
|
||||||
* give it 5 seconds (max) ...
|
* give it 5 seconds (max) ...
|
||||||
*/
|
*/
|
||||||
ret = 0;
|
ret = 0;
|
||||||
if (!obp_startup_ack(s, 5)) {
|
if (!obp_startup_ack(s, 5000)) {
|
||||||
snd_printk(KERN_ERR "sscape: No response from on-board processor after upload\n");
|
snd_printk(KERN_ERR "sscape: No response from on-board processor after upload\n");
|
||||||
ret = -EAGAIN;
|
ret = -EAGAIN;
|
||||||
} else if (!host_startup_ack(s, 5)) {
|
} else if (!host_startup_ack(s, 5000)) {
|
||||||
snd_printk(KERN_ERR "sscape: SoundScape failed to initialise\n");
|
snd_printk(KERN_ERR "sscape: SoundScape failed to initialise\n");
|
||||||
ret = -EAGAIN;
|
ret = -EAGAIN;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue