diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2005-05-13 01:44:13 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-05-29 04:08:50 -0400 |
commit | 50cdbf1519a891bec4ce306c7bae397a0d8e7246 (patch) | |
tree | 17fb772a610e750e3e98e25f930143f1b784ff84 /sound/usb/usbaudio.c | |
parent | 7291548df69ab4e3a87ff6952449d1f05c3a5443 (diff) |
[ALSA] usb-audio - sanity-check sync feedback frequency values
USB generic driver
Check that the synchronization feedback frequency values returned by the
device are more or less near the nominal frequency.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/usb/usbaudio.c')
-rw-r--r-- | sound/usb/usbaudio.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index c360ab9783d5..a6ed0d08337e 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -452,17 +452,11 @@ static int retire_playback_sync_urb(snd_usb_substream_t *subs, | |||
452 | if (urb->iso_frame_desc[0].status == 0 && | 452 | if (urb->iso_frame_desc[0].status == 0 && |
453 | urb->iso_frame_desc[0].actual_length == 3) { | 453 | urb->iso_frame_desc[0].actual_length == 3) { |
454 | f = combine_triple((u8*)urb->transfer_buffer) << 2; | 454 | f = combine_triple((u8*)urb->transfer_buffer) << 2; |
455 | #if 0 | 455 | if (f >= subs->freqn - subs->freqn / 8 && f <= subs->freqmax) { |
456 | if (f < subs->freqn - (subs->freqn>>3) || f > subs->freqmax) { | 456 | spin_lock_irqsave(&subs->lock, flags); |
457 | snd_printd(KERN_WARNING "requested frequency %d (%u,%03uHz) out of range (current nominal %d (%u,%03uHz))\n", | 457 | subs->freqm = f; |
458 | f, f >> 14, (f & ((1 << 14) - 1) * 1000) / ((1 << 14) - 1), | 458 | spin_unlock_irqrestore(&subs->lock, flags); |
459 | subs->freqn, subs->freqn >> 14, (subs->freqn & ((1 << 14) - 1) * 1000) / ((1 << 14) - 1)); | ||
460 | continue; | ||
461 | } | 459 | } |
462 | #endif | ||
463 | spin_lock_irqsave(&subs->lock, flags); | ||
464 | subs->freqm = f; | ||
465 | spin_unlock_irqrestore(&subs->lock, flags); | ||
466 | } | 460 | } |
467 | 461 | ||
468 | return 0; | 462 | return 0; |
@@ -484,9 +478,11 @@ static int retire_playback_sync_urb_hs(snd_usb_substream_t *subs, | |||
484 | if (urb->iso_frame_desc[0].status == 0 && | 478 | if (urb->iso_frame_desc[0].status == 0 && |
485 | urb->iso_frame_desc[0].actual_length == 4) { | 479 | urb->iso_frame_desc[0].actual_length == 4) { |
486 | f = combine_quad((u8*)urb->transfer_buffer) & 0x0fffffff; | 480 | f = combine_quad((u8*)urb->transfer_buffer) & 0x0fffffff; |
487 | spin_lock_irqsave(&subs->lock, flags); | 481 | if (f >= subs->freqn - subs->freqn / 8 && f <= subs->freqmax) { |
488 | subs->freqm = f; | 482 | spin_lock_irqsave(&subs->lock, flags); |
489 | spin_unlock_irqrestore(&subs->lock, flags); | 483 | subs->freqm = f; |
484 | spin_unlock_irqrestore(&subs->lock, flags); | ||
485 | } | ||
490 | } | 486 | } |
491 | 487 | ||
492 | return 0; | 488 | return 0; |