diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-05-03 11:06:53 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-05-03 11:06:53 -0400 |
commit | fe4af1b55ed76e3051bbd8abce7d6b3c504272a5 (patch) | |
tree | 2ca1533564dd46d12562fb54f8abf650cd041408 /sound/pci/lola | |
parent | 2db3002029d6c8fbd8ad4ab21f501475cd8c96f9 (diff) |
ALSA: lola - Implement polling_mode like hd-audio
Also protect the call of lola_update_rirb() with spinlock.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/lola')
-rw-r--r-- | sound/pci/lola/lola.c | 12 | ||||
-rw-r--r-- | sound/pci/lola/lola.h | 5 |
2 files changed, 14 insertions, 3 deletions
diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c index 8ee22bee10c9..34b24286d279 100644 --- a/sound/pci/lola/lola.c +++ b/sound/pci/lola/lola.c | |||
@@ -153,8 +153,14 @@ static int rirb_get_response(struct lola *chip, unsigned int *val, | |||
153 | { | 153 | { |
154 | unsigned long timeout; | 154 | unsigned long timeout; |
155 | 155 | ||
156 | again: | ||
156 | timeout = jiffies + msecs_to_jiffies(1000); | 157 | timeout = jiffies + msecs_to_jiffies(1000); |
157 | for (;;) { | 158 | for (;;) { |
159 | if (chip->polling_mode) { | ||
160 | spin_lock_irq(&chip->reg_lock); | ||
161 | lola_update_rirb(chip); | ||
162 | spin_unlock_irq(&chip->reg_lock); | ||
163 | } | ||
158 | if (!chip->rirb.cmds) { | 164 | if (!chip->rirb.cmds) { |
159 | *val = chip->res; | 165 | *val = chip->res; |
160 | if (extval) | 166 | if (extval) |
@@ -175,9 +181,13 @@ static int rirb_get_response(struct lola *chip, unsigned int *val, | |||
175 | break; | 181 | break; |
176 | udelay(20); | 182 | udelay(20); |
177 | cond_resched(); | 183 | cond_resched(); |
178 | lola_update_rirb(chip); | ||
179 | } | 184 | } |
180 | printk(KERN_WARNING SFX "RIRB response error\n"); | 185 | printk(KERN_WARNING SFX "RIRB response error\n"); |
186 | if (!chip->polling_mode) { | ||
187 | printk(KERN_WARNING SFX "switching to polling mode\n"); | ||
188 | chip->polling_mode = 1; | ||
189 | goto again; | ||
190 | } | ||
181 | return -EIO; | 191 | return -EIO; |
182 | } | 192 | } |
183 | 193 | ||
diff --git a/sound/pci/lola/lola.h b/sound/pci/lola/lola.h index 400ab5ef4c6c..d5708e29b16d 100644 --- a/sound/pci/lola/lola.h +++ b/sound/pci/lola/lola.h | |||
@@ -374,8 +374,9 @@ struct lola { | |||
374 | unsigned int sample_rate_max; | 374 | unsigned int sample_rate_max; |
375 | 375 | ||
376 | /* flags */ | 376 | /* flags */ |
377 | unsigned int initialized :1; | 377 | unsigned int initialized:1; |
378 | unsigned int cold_reset :1; | 378 | unsigned int cold_reset:1; |
379 | unsigned int polling_mode:1; | ||
379 | 380 | ||
380 | /* for debugging */ | 381 | /* for debugging */ |
381 | unsigned int debug_res; | 382 | unsigned int debug_res; |