Skip to content

Commit

Permalink
ALSA: lola - Implement polling_mode like hd-audio
Browse files Browse the repository at this point in the history
Also protect the call of lola_update_rirb() with spinlock.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
tiwai committed May 3, 2011
1 parent 2db3002 commit fe4af1b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
12 changes: 11 additions & 1 deletion sound/pci/lola/lola.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,14 @@ static int rirb_get_response(struct lola *chip, unsigned int *val,
{
unsigned long timeout;

again:
timeout = jiffies + msecs_to_jiffies(1000);
for (;;) {
if (chip->polling_mode) {
spin_lock_irq(&chip->reg_lock);
lola_update_rirb(chip);
spin_unlock_irq(&chip->reg_lock);
}
if (!chip->rirb.cmds) {
*val = chip->res;
if (extval)
Expand All @@ -175,9 +181,13 @@ static int rirb_get_response(struct lola *chip, unsigned int *val,
break;
udelay(20);
cond_resched();
lola_update_rirb(chip);
}
printk(KERN_WARNING SFX "RIRB response error\n");
if (!chip->polling_mode) {
printk(KERN_WARNING SFX "switching to polling mode\n");
chip->polling_mode = 1;
goto again;
}
return -EIO;
}

Expand Down
5 changes: 3 additions & 2 deletions sound/pci/lola/lola.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,9 @@ struct lola {
unsigned int sample_rate_max;

/* flags */
unsigned int initialized :1;
unsigned int cold_reset :1;
unsigned int initialized:1;
unsigned int cold_reset:1;
unsigned int polling_mode:1;

/* for debugging */
unsigned int debug_res;
Expand Down

0 comments on commit fe4af1b

Please sign in to comment.