diff options
Diffstat (limited to 'sound/drivers/vx/vx_core.c')
-rw-r--r-- | sound/drivers/vx/vx_core.c | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c index 83596891cde4..e8cc16993903 100644 --- a/sound/drivers/vx/vx_core.c +++ b/sound/drivers/vx/vx_core.c | |||
@@ -117,7 +117,7 @@ static int vx_reset_chk(struct vx_core *chip) | |||
117 | * | 117 | * |
118 | * returns 0 if successful, or a negative error code. | 118 | * returns 0 if successful, or a negative error code. |
119 | * the error code can be VX-specific, retrieved via vx_get_error(). | 119 | * the error code can be VX-specific, retrieved via vx_get_error(). |
120 | * NB: call with spinlock held! | 120 | * NB: call with mutex held! |
121 | */ | 121 | */ |
122 | static int vx_transfer_end(struct vx_core *chip, int cmd) | 122 | static int vx_transfer_end(struct vx_core *chip, int cmd) |
123 | { | 123 | { |
@@ -155,7 +155,7 @@ static int vx_transfer_end(struct vx_core *chip, int cmd) | |||
155 | * | 155 | * |
156 | * returns 0 if successful, or a negative error code. | 156 | * returns 0 if successful, or a negative error code. |
157 | * the error code can be VX-specific, retrieved via vx_get_error(). | 157 | * the error code can be VX-specific, retrieved via vx_get_error(). |
158 | * NB: call with spinlock held! | 158 | * NB: call with mutex held! |
159 | */ | 159 | */ |
160 | static int vx_read_status(struct vx_core *chip, struct vx_rmh *rmh) | 160 | static int vx_read_status(struct vx_core *chip, struct vx_rmh *rmh) |
161 | { | 161 | { |
@@ -236,7 +236,7 @@ static int vx_read_status(struct vx_core *chip, struct vx_rmh *rmh) | |||
236 | * returns 0 if successful, or a negative error code. | 236 | * returns 0 if successful, or a negative error code. |
237 | * the error code can be VX-specific, retrieved via vx_get_error(). | 237 | * the error code can be VX-specific, retrieved via vx_get_error(). |
238 | * | 238 | * |
239 | * this function doesn't call spinlock at all. | 239 | * this function doesn't call mutex lock at all. |
240 | */ | 240 | */ |
241 | int vx_send_msg_nolock(struct vx_core *chip, struct vx_rmh *rmh) | 241 | int vx_send_msg_nolock(struct vx_core *chip, struct vx_rmh *rmh) |
242 | { | 242 | { |
@@ -337,7 +337,7 @@ int vx_send_msg_nolock(struct vx_core *chip, struct vx_rmh *rmh) | |||
337 | 337 | ||
338 | 338 | ||
339 | /* | 339 | /* |
340 | * vx_send_msg - send a DSP message with spinlock | 340 | * vx_send_msg - send a DSP message with mutex |
341 | * @rmh: the rmh record to send and receive | 341 | * @rmh: the rmh record to send and receive |
342 | * | 342 | * |
343 | * returns 0 if successful, or a negative error code. | 343 | * returns 0 if successful, or a negative error code. |
@@ -345,12 +345,11 @@ int vx_send_msg_nolock(struct vx_core *chip, struct vx_rmh *rmh) | |||
345 | */ | 345 | */ |
346 | int vx_send_msg(struct vx_core *chip, struct vx_rmh *rmh) | 346 | int vx_send_msg(struct vx_core *chip, struct vx_rmh *rmh) |
347 | { | 347 | { |
348 | unsigned long flags; | ||
349 | int err; | 348 | int err; |
350 | 349 | ||
351 | spin_lock_irqsave(&chip->lock, flags); | 350 | mutex_lock(&chip->lock); |
352 | err = vx_send_msg_nolock(chip, rmh); | 351 | err = vx_send_msg_nolock(chip, rmh); |
353 | spin_unlock_irqrestore(&chip->lock, flags); | 352 | mutex_unlock(&chip->lock); |
354 | return err; | 353 | return err; |
355 | } | 354 | } |
356 | 355 | ||
@@ -362,7 +361,7 @@ int vx_send_msg(struct vx_core *chip, struct vx_rmh *rmh) | |||
362 | * returns 0 if successful, or a negative error code. | 361 | * returns 0 if successful, or a negative error code. |
363 | * the error code can be VX-specific, retrieved via vx_get_error(). | 362 | * the error code can be VX-specific, retrieved via vx_get_error(). |
364 | * | 363 | * |
365 | * this function doesn't call spinlock at all. | 364 | * this function doesn't call mutex at all. |
366 | * | 365 | * |
367 | * unlike RMH, no command is sent to DSP. | 366 | * unlike RMH, no command is sent to DSP. |
368 | */ | 367 | */ |
@@ -398,19 +397,18 @@ int vx_send_rih_nolock(struct vx_core *chip, int cmd) | |||
398 | 397 | ||
399 | 398 | ||
400 | /* | 399 | /* |
401 | * vx_send_rih - send an RIH with spinlock | 400 | * vx_send_rih - send an RIH with mutex |
402 | * @cmd: the command to send | 401 | * @cmd: the command to send |
403 | * | 402 | * |
404 | * see vx_send_rih_nolock(). | 403 | * see vx_send_rih_nolock(). |
405 | */ | 404 | */ |
406 | int vx_send_rih(struct vx_core *chip, int cmd) | 405 | int vx_send_rih(struct vx_core *chip, int cmd) |
407 | { | 406 | { |
408 | unsigned long flags; | ||
409 | int err; | 407 | int err; |
410 | 408 | ||
411 | spin_lock_irqsave(&chip->lock, flags); | 409 | mutex_lock(&chip->lock); |
412 | err = vx_send_rih_nolock(chip, cmd); | 410 | err = vx_send_rih_nolock(chip, cmd); |
413 | spin_unlock_irqrestore(&chip->lock, flags); | 411 | mutex_unlock(&chip->lock); |
414 | return err; | 412 | return err; |
415 | } | 413 | } |
416 | 414 | ||
@@ -482,30 +480,30 @@ static int vx_test_irq_src(struct vx_core *chip, unsigned int *ret) | |||
482 | int err; | 480 | int err; |
483 | 481 | ||
484 | vx_init_rmh(&chip->irq_rmh, CMD_TEST_IT); | 482 | vx_init_rmh(&chip->irq_rmh, CMD_TEST_IT); |
485 | spin_lock(&chip->lock); | 483 | mutex_lock(&chip->lock); |
486 | err = vx_send_msg_nolock(chip, &chip->irq_rmh); | 484 | err = vx_send_msg_nolock(chip, &chip->irq_rmh); |
487 | if (err < 0) | 485 | if (err < 0) |
488 | *ret = 0; | 486 | *ret = 0; |
489 | else | 487 | else |
490 | *ret = chip->irq_rmh.Stat[0]; | 488 | *ret = chip->irq_rmh.Stat[0]; |
491 | spin_unlock(&chip->lock); | 489 | mutex_unlock(&chip->lock); |
492 | return err; | 490 | return err; |
493 | } | 491 | } |
494 | 492 | ||
495 | 493 | ||
496 | /* | 494 | /* |
497 | * vx_interrupt - soft irq handler | 495 | * snd_vx_threaded_irq_handler - threaded irq handler |
498 | */ | 496 | */ |
499 | static void vx_interrupt(unsigned long private_data) | 497 | irqreturn_t snd_vx_threaded_irq_handler(int irq, void *dev) |
500 | { | 498 | { |
501 | struct vx_core *chip = (struct vx_core *) private_data; | 499 | struct vx_core *chip = dev; |
502 | unsigned int events; | 500 | unsigned int events; |
503 | 501 | ||
504 | if (chip->chip_status & VX_STAT_IS_STALE) | 502 | if (chip->chip_status & VX_STAT_IS_STALE) |
505 | return; | 503 | return IRQ_HANDLED; |
506 | 504 | ||
507 | if (vx_test_irq_src(chip, &events) < 0) | 505 | if (vx_test_irq_src(chip, &events) < 0) |
508 | return; | 506 | return IRQ_HANDLED; |
509 | 507 | ||
510 | #if 0 | 508 | #if 0 |
511 | if (events & 0x000800) | 509 | if (events & 0x000800) |
@@ -519,7 +517,7 @@ static void vx_interrupt(unsigned long private_data) | |||
519 | */ | 517 | */ |
520 | if (events & FATAL_DSP_ERROR) { | 518 | if (events & FATAL_DSP_ERROR) { |
521 | snd_printk(KERN_ERR "vx_core: fatal DSP error!!\n"); | 519 | snd_printk(KERN_ERR "vx_core: fatal DSP error!!\n"); |
522 | return; | 520 | return IRQ_HANDLED; |
523 | } | 521 | } |
524 | 522 | ||
525 | /* The start on time code conditions are filled (ie the time code | 523 | /* The start on time code conditions are filled (ie the time code |
@@ -534,8 +532,9 @@ static void vx_interrupt(unsigned long private_data) | |||
534 | 532 | ||
535 | /* update the pcm streams */ | 533 | /* update the pcm streams */ |
536 | vx_pcm_update_intr(chip, events); | 534 | vx_pcm_update_intr(chip, events); |
535 | return IRQ_HANDLED; | ||
537 | } | 536 | } |
538 | 537 | EXPORT_SYMBOL(snd_vx_threaded_irq_handler); | |
539 | 538 | ||
540 | /** | 539 | /** |
541 | * snd_vx_irq_handler - interrupt handler | 540 | * snd_vx_irq_handler - interrupt handler |
@@ -548,8 +547,8 @@ irqreturn_t snd_vx_irq_handler(int irq, void *dev) | |||
548 | (chip->chip_status & VX_STAT_IS_STALE)) | 547 | (chip->chip_status & VX_STAT_IS_STALE)) |
549 | return IRQ_NONE; | 548 | return IRQ_NONE; |
550 | if (! vx_test_and_ack(chip)) | 549 | if (! vx_test_and_ack(chip)) |
551 | tasklet_schedule(&chip->tq); | 550 | return IRQ_WAKE_THREAD; |
552 | return IRQ_HANDLED; | 551 | return IRQ_NONE; |
553 | } | 552 | } |
554 | 553 | ||
555 | EXPORT_SYMBOL(snd_vx_irq_handler); | 554 | EXPORT_SYMBOL(snd_vx_irq_handler); |
@@ -790,13 +789,11 @@ struct vx_core *snd_vx_create(struct snd_card *card, struct snd_vx_hardware *hw, | |||
790 | snd_printk(KERN_ERR "vx_core: no memory\n"); | 789 | snd_printk(KERN_ERR "vx_core: no memory\n"); |
791 | return NULL; | 790 | return NULL; |
792 | } | 791 | } |
793 | spin_lock_init(&chip->lock); | 792 | mutex_init(&chip->lock); |
794 | spin_lock_init(&chip->irq_lock); | ||
795 | chip->irq = -1; | 793 | chip->irq = -1; |
796 | chip->hw = hw; | 794 | chip->hw = hw; |
797 | chip->type = hw->type; | 795 | chip->type = hw->type; |
798 | chip->ops = ops; | 796 | chip->ops = ops; |
799 | tasklet_init(&chip->tq, vx_interrupt, (unsigned long)chip); | ||
800 | mutex_init(&chip->mixer_mutex); | 797 | mutex_init(&chip->mixer_mutex); |
801 | 798 | ||
802 | chip->card = card; | 799 | chip->card = card; |