diff options
-rw-r--r-- | sound/pci/ice1712/ice1712.c | 2 | ||||
-rw-r--r-- | sound/pci/ice1712/ice1724.c | 60 | ||||
-rw-r--r-- | sound/pci/ice1712/juli.c | 5 | ||||
-rw-r--r-- | sound/pci/ice1712/prodigy192.c | 13 |
4 files changed, 54 insertions, 26 deletions
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index bab1c700f497..3dd63f1cda53 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c | |||
@@ -458,7 +458,7 @@ static irqreturn_t snd_ice1712_interrupt(int irq, void *dev_id) | |||
458 | u16 pbkstatus; | 458 | u16 pbkstatus; |
459 | struct snd_pcm_substream *substream; | 459 | struct snd_pcm_substream *substream; |
460 | pbkstatus = inw(ICEDS(ice, INTSTAT)); | 460 | pbkstatus = inw(ICEDS(ice, INTSTAT)); |
461 | /* printk("pbkstatus = 0x%x\n", pbkstatus); */ | 461 | /* printk(KERN_DEBUG "pbkstatus = 0x%x\n", pbkstatus); */ |
462 | for (idx = 0; idx < 6; idx++) { | 462 | for (idx = 0; idx < 6; idx++) { |
463 | if ((pbkstatus & (3 << (idx * 2))) == 0) | 463 | if ((pbkstatus & (3 << (idx * 2))) == 0) |
464 | continue; | 464 | continue; |
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 7ff36d3f0f44..128510e77a78 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -241,6 +241,8 @@ get_rawmidi_substream(struct snd_ice1712 *ice, unsigned int stream) | |||
241 | struct snd_rawmidi_substream, list); | 241 | struct snd_rawmidi_substream, list); |
242 | } | 242 | } |
243 | 243 | ||
244 | static void enable_midi_irq(struct snd_ice1712 *ice, u8 flag, int enable); | ||
245 | |||
244 | static void vt1724_midi_write(struct snd_ice1712 *ice) | 246 | static void vt1724_midi_write(struct snd_ice1712 *ice) |
245 | { | 247 | { |
246 | struct snd_rawmidi_substream *s; | 248 | struct snd_rawmidi_substream *s; |
@@ -254,6 +256,11 @@ static void vt1724_midi_write(struct snd_ice1712 *ice) | |||
254 | for (i = 0; i < count; ++i) | 256 | for (i = 0; i < count; ++i) |
255 | outb(buffer[i], ICEREG1724(ice, MPU_DATA)); | 257 | outb(buffer[i], ICEREG1724(ice, MPU_DATA)); |
256 | } | 258 | } |
259 | /* mask irq when all bytes have been transmitted. | ||
260 | * enabled again in output_trigger when the new data comes in. | ||
261 | */ | ||
262 | enable_midi_irq(ice, VT1724_IRQ_MPU_TX, | ||
263 | !snd_rawmidi_transmit_empty(s)); | ||
257 | } | 264 | } |
258 | 265 | ||
259 | static void vt1724_midi_read(struct snd_ice1712 *ice) | 266 | static void vt1724_midi_read(struct snd_ice1712 *ice) |
@@ -272,31 +279,34 @@ static void vt1724_midi_read(struct snd_ice1712 *ice) | |||
272 | } | 279 | } |
273 | } | 280 | } |
274 | 281 | ||
275 | static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream, | 282 | /* call with ice->reg_lock */ |
276 | u8 flag, int enable) | 283 | static void enable_midi_irq(struct snd_ice1712 *ice, u8 flag, int enable) |
277 | { | 284 | { |
278 | struct snd_ice1712 *ice = substream->rmidi->private_data; | 285 | u8 mask = inb(ICEREG1724(ice, IRQMASK)); |
279 | u8 mask; | ||
280 | |||
281 | spin_lock_irq(&ice->reg_lock); | ||
282 | mask = inb(ICEREG1724(ice, IRQMASK)); | ||
283 | if (enable) | 286 | if (enable) |
284 | mask &= ~flag; | 287 | mask &= ~flag; |
285 | else | 288 | else |
286 | mask |= flag; | 289 | mask |= flag; |
287 | outb(mask, ICEREG1724(ice, IRQMASK)); | 290 | outb(mask, ICEREG1724(ice, IRQMASK)); |
291 | } | ||
292 | |||
293 | static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream, | ||
294 | u8 flag, int enable) | ||
295 | { | ||
296 | struct snd_ice1712 *ice = substream->rmidi->private_data; | ||
297 | |||
298 | spin_lock_irq(&ice->reg_lock); | ||
299 | enable_midi_irq(ice, flag, enable); | ||
288 | spin_unlock_irq(&ice->reg_lock); | 300 | spin_unlock_irq(&ice->reg_lock); |
289 | } | 301 | } |
290 | 302 | ||
291 | static int vt1724_midi_output_open(struct snd_rawmidi_substream *s) | 303 | static int vt1724_midi_output_open(struct snd_rawmidi_substream *s) |
292 | { | 304 | { |
293 | vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 1); | ||
294 | return 0; | 305 | return 0; |
295 | } | 306 | } |
296 | 307 | ||
297 | static int vt1724_midi_output_close(struct snd_rawmidi_substream *s) | 308 | static int vt1724_midi_output_close(struct snd_rawmidi_substream *s) |
298 | { | 309 | { |
299 | vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); | ||
300 | return 0; | 310 | return 0; |
301 | } | 311 | } |
302 | 312 | ||
@@ -311,6 +321,7 @@ static void vt1724_midi_output_trigger(struct snd_rawmidi_substream *s, int up) | |||
311 | vt1724_midi_write(ice); | 321 | vt1724_midi_write(ice); |
312 | } else { | 322 | } else { |
313 | ice->midi_output = 0; | 323 | ice->midi_output = 0; |
324 | enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0); | ||
314 | } | 325 | } |
315 | spin_unlock_irqrestore(&ice->reg_lock, flags); | 326 | spin_unlock_irqrestore(&ice->reg_lock, flags); |
316 | } | 327 | } |
@@ -320,6 +331,7 @@ static void vt1724_midi_output_drain(struct snd_rawmidi_substream *s) | |||
320 | struct snd_ice1712 *ice = s->rmidi->private_data; | 331 | struct snd_ice1712 *ice = s->rmidi->private_data; |
321 | unsigned long timeout; | 332 | unsigned long timeout; |
322 | 333 | ||
334 | vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); | ||
323 | /* 32 bytes should be transmitted in less than about 12 ms */ | 335 | /* 32 bytes should be transmitted in less than about 12 ms */ |
324 | timeout = jiffies + msecs_to_jiffies(15); | 336 | timeout = jiffies + msecs_to_jiffies(15); |
325 | do { | 337 | do { |
@@ -389,24 +401,24 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) | |||
389 | status &= status_mask; | 401 | status &= status_mask; |
390 | if (status == 0) | 402 | if (status == 0) |
391 | break; | 403 | break; |
404 | spin_lock(&ice->reg_lock); | ||
392 | if (++timeout > 10) { | 405 | if (++timeout > 10) { |
393 | status = inb(ICEREG1724(ice, IRQSTAT)); | 406 | status = inb(ICEREG1724(ice, IRQSTAT)); |
394 | printk(KERN_ERR "ice1724: Too long irq loop, " | 407 | printk(KERN_ERR "ice1724: Too long irq loop, " |
395 | "status = 0x%x\n", status); | 408 | "status = 0x%x\n", status); |
396 | if (status & VT1724_IRQ_MPU_TX) { | 409 | if (status & VT1724_IRQ_MPU_TX) { |
397 | printk(KERN_ERR "ice1724: Disabling MPU_TX\n"); | 410 | printk(KERN_ERR "ice1724: Disabling MPU_TX\n"); |
398 | outb(inb(ICEREG1724(ice, IRQMASK)) | | 411 | enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0); |
399 | VT1724_IRQ_MPU_TX, | ||
400 | ICEREG1724(ice, IRQMASK)); | ||
401 | } | 412 | } |
413 | spin_unlock(&ice->reg_lock); | ||
402 | break; | 414 | break; |
403 | } | 415 | } |
404 | handled = 1; | 416 | handled = 1; |
405 | if (status & VT1724_IRQ_MPU_TX) { | 417 | if (status & VT1724_IRQ_MPU_TX) { |
406 | spin_lock(&ice->reg_lock); | ||
407 | if (ice->midi_output) | 418 | if (ice->midi_output) |
408 | vt1724_midi_write(ice); | 419 | vt1724_midi_write(ice); |
409 | spin_unlock(&ice->reg_lock); | 420 | else |
421 | enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0); | ||
410 | /* Due to mysterical reasons, MPU_TX is always | 422 | /* Due to mysterical reasons, MPU_TX is always |
411 | * generated (and can't be cleared) when a PCM | 423 | * generated (and can't be cleared) when a PCM |
412 | * playback is going. So let's ignore at the | 424 | * playback is going. So let's ignore at the |
@@ -415,15 +427,14 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) | |||
415 | status_mask &= ~VT1724_IRQ_MPU_TX; | 427 | status_mask &= ~VT1724_IRQ_MPU_TX; |
416 | } | 428 | } |
417 | if (status & VT1724_IRQ_MPU_RX) { | 429 | if (status & VT1724_IRQ_MPU_RX) { |
418 | spin_lock(&ice->reg_lock); | ||
419 | if (ice->midi_input) | 430 | if (ice->midi_input) |
420 | vt1724_midi_read(ice); | 431 | vt1724_midi_read(ice); |
421 | else | 432 | else |
422 | vt1724_midi_clear_rx(ice); | 433 | vt1724_midi_clear_rx(ice); |
423 | spin_unlock(&ice->reg_lock); | ||
424 | } | 434 | } |
425 | /* ack MPU irq */ | 435 | /* ack MPU irq */ |
426 | outb(status, ICEREG1724(ice, IRQSTAT)); | 436 | outb(status, ICEREG1724(ice, IRQSTAT)); |
437 | spin_unlock(&ice->reg_lock); | ||
427 | if (status & VT1724_IRQ_MTPCM) { | 438 | if (status & VT1724_IRQ_MTPCM) { |
428 | /* | 439 | /* |
429 | * Multi-track PCM | 440 | * Multi-track PCM |
@@ -745,7 +756,14 @@ static int snd_vt1724_playback_pro_prepare(struct snd_pcm_substream *substream) | |||
745 | 756 | ||
746 | spin_unlock_irq(&ice->reg_lock); | 757 | spin_unlock_irq(&ice->reg_lock); |
747 | 758 | ||
748 | /* printk("pro prepare: ch = %d, addr = 0x%x, buffer = 0x%x, period = 0x%x\n", substream->runtime->channels, (unsigned int)substream->runtime->dma_addr, snd_pcm_lib_buffer_bytes(substream), snd_pcm_lib_period_bytes(substream)); */ | 759 | /* |
760 | printk(KERN_DEBUG "pro prepare: ch = %d, addr = 0x%x, " | ||
761 | "buffer = 0x%x, period = 0x%x\n", | ||
762 | substream->runtime->channels, | ||
763 | (unsigned int)substream->runtime->dma_addr, | ||
764 | snd_pcm_lib_buffer_bytes(substream), | ||
765 | snd_pcm_lib_period_bytes(substream)); | ||
766 | */ | ||
749 | return 0; | 767 | return 0; |
750 | } | 768 | } |
751 | 769 | ||
@@ -2122,7 +2140,9 @@ unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice, | |||
2122 | wait_i2c_busy(ice); | 2140 | wait_i2c_busy(ice); |
2123 | val = inb(ICEREG1724(ice, I2C_DATA)); | 2141 | val = inb(ICEREG1724(ice, I2C_DATA)); |
2124 | mutex_unlock(&ice->i2c_mutex); | 2142 | mutex_unlock(&ice->i2c_mutex); |
2125 | /* printk("i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val); */ | 2143 | /* |
2144 | printk(KERN_DEBUG "i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val); | ||
2145 | */ | ||
2126 | return val; | 2146 | return val; |
2127 | } | 2147 | } |
2128 | 2148 | ||
@@ -2131,7 +2151,9 @@ void snd_vt1724_write_i2c(struct snd_ice1712 *ice, | |||
2131 | { | 2151 | { |
2132 | mutex_lock(&ice->i2c_mutex); | 2152 | mutex_lock(&ice->i2c_mutex); |
2133 | wait_i2c_busy(ice); | 2153 | wait_i2c_busy(ice); |
2134 | /* printk("i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data); */ | 2154 | /* |
2155 | printk(KERN_DEBUG "i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data); | ||
2156 | */ | ||
2135 | outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR)); | 2157 | outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR)); |
2136 | outb(data, ICEREG1724(ice, I2C_DATA)); | 2158 | outb(data, ICEREG1724(ice, I2C_DATA)); |
2137 | outb(dev | VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR)); | 2159 | outb(dev | VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR)); |
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c index c51659b9caf6..fd948bfd9aef 100644 --- a/sound/pci/ice1712/juli.c +++ b/sound/pci/ice1712/juli.c | |||
@@ -345,8 +345,9 @@ static int juli_mute_put(struct snd_kcontrol *kcontrol, | |||
345 | new_gpio = old_gpio & | 345 | new_gpio = old_gpio & |
346 | ~((unsigned int) kcontrol->private_value); | 346 | ~((unsigned int) kcontrol->private_value); |
347 | } | 347 | } |
348 | /* printk("JULI - mute/unmute: control_value: 0x%x, old_gpio: 0x%x, \ | 348 | /* printk(KERN_DEBUG |
349 | new_gpio 0x%x\n", | 349 | "JULI - mute/unmute: control_value: 0x%x, old_gpio: 0x%x, " |
350 | "new_gpio 0x%x\n", | ||
350 | (unsigned int)ucontrol->value.integer.value[0], old_gpio, | 351 | (unsigned int)ucontrol->value.integer.value[0], old_gpio, |
351 | new_gpio); */ | 352 | new_gpio); */ |
352 | if (old_gpio != new_gpio) { | 353 | if (old_gpio != new_gpio) { |
diff --git a/sound/pci/ice1712/prodigy192.c b/sound/pci/ice1712/prodigy192.c index 48d3679292a7..2a8e5cd8f2d8 100644 --- a/sound/pci/ice1712/prodigy192.c +++ b/sound/pci/ice1712/prodigy192.c | |||
@@ -133,8 +133,10 @@ static int stac9460_dac_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
133 | idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + STAC946X_LF_VOLUME; | 133 | idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + STAC946X_LF_VOLUME; |
134 | /* due to possible conflicts with stac9460_set_rate_val, mutexing */ | 134 | /* due to possible conflicts with stac9460_set_rate_val, mutexing */ |
135 | mutex_lock(&spec->mute_mutex); | 135 | mutex_lock(&spec->mute_mutex); |
136 | /*printk("Mute put: reg 0x%02x, ctrl value: 0x%02x\n", idx, | 136 | /* |
137 | ucontrol->value.integer.value[0]);*/ | 137 | printk(KERN_DEBUG "Mute put: reg 0x%02x, ctrl value: 0x%02x\n", idx, |
138 | ucontrol->value.integer.value[0]); | ||
139 | */ | ||
138 | change = stac9460_dac_mute(ice, idx, ucontrol->value.integer.value[0]); | 140 | change = stac9460_dac_mute(ice, idx, ucontrol->value.integer.value[0]); |
139 | mutex_unlock(&spec->mute_mutex); | 141 | mutex_unlock(&spec->mute_mutex); |
140 | return change; | 142 | return change; |
@@ -185,7 +187,10 @@ static int stac9460_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el | |||
185 | change = (ovol != nvol); | 187 | change = (ovol != nvol); |
186 | if (change) { | 188 | if (change) { |
187 | ovol = (0x7f - nvol) | (tmp & 0x80); | 189 | ovol = (0x7f - nvol) | (tmp & 0x80); |
188 | /*printk("DAC Volume: reg 0x%02x: 0x%02x\n", idx, ovol);*/ | 190 | /* |
191 | printk(KERN_DEBUG "DAC Volume: reg 0x%02x: 0x%02x\n", | ||
192 | idx, ovol); | ||
193 | */ | ||
189 | stac9460_put(ice, idx, (0x7f - nvol) | (tmp & 0x80)); | 194 | stac9460_put(ice, idx, (0x7f - nvol) | (tmp & 0x80)); |
190 | } | 195 | } |
191 | return change; | 196 | return change; |
@@ -344,7 +349,7 @@ static void stac9460_set_rate_val(struct snd_ice1712 *ice, unsigned int rate) | |||
344 | for (idx = 0; idx < 7 ; ++idx) | 349 | for (idx = 0; idx < 7 ; ++idx) |
345 | changed[idx] = stac9460_dac_mute(ice, | 350 | changed[idx] = stac9460_dac_mute(ice, |
346 | STAC946X_MASTER_VOLUME + idx, 0); | 351 | STAC946X_MASTER_VOLUME + idx, 0); |
347 | /*printk("Rate change: %d, new MC: 0x%02x\n", rate, new);*/ | 352 | /*printk(KERN_DEBUG "Rate change: %d, new MC: 0x%02x\n", rate, new);*/ |
348 | stac9460_put(ice, STAC946X_MASTER_CLOCKING, new); | 353 | stac9460_put(ice, STAC946X_MASTER_CLOCKING, new); |
349 | udelay(10); | 354 | udelay(10); |
350 | /* unmuting - only originally unmuted dacs - | 355 | /* unmuting - only originally unmuted dacs - |