diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2005-05-02 02:53:46 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-05-29 04:05:54 -0400 |
commit | 1149a64fe4916fe6fdc8938043a0dc9a6551ab63 (patch) | |
tree | fc27fcf75435d8fb856e572018fc964382e3deb7 | |
parent | 4dc40a3cc4778ebcb6212bdb71b48690a153be07 (diff) |
[ALSA] usb-audio - use proper interval between synchronization packets
USB generic driver
Add sanity checks when reading the bRefresh value, and actually use it
for the synchronization packets instead of polling at 1000 Hz.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
-rw-r--r-- | sound/usb/usbaudio.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index e759b73942c2..e1a648d7ffff 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -1051,10 +1051,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by | |||
1051 | u->urb->pipe = subs->syncpipe; | 1051 | u->urb->pipe = subs->syncpipe; |
1052 | u->urb->transfer_flags = URB_ISO_ASAP; | 1052 | u->urb->transfer_flags = URB_ISO_ASAP; |
1053 | u->urb->number_of_packets = u->packets; | 1053 | u->urb->number_of_packets = u->packets; |
1054 | if (snd_usb_get_speed(subs->dev) == USB_SPEED_HIGH) | 1054 | u->urb->interval = 1 << subs->syncinterval; |
1055 | u->urb->interval = 8; | ||
1056 | else | ||
1057 | u->urb->interval = 1; | ||
1058 | u->urb->context = u; | 1055 | u->urb->context = u; |
1059 | u->urb->complete = snd_usb_complete_callback(snd_complete_sync_urb); | 1056 | u->urb->complete = snd_usb_complete_callback(snd_complete_sync_urb); |
1060 | } | 1057 | } |
@@ -1272,7 +1269,12 @@ static int set_format(snd_usb_substream_t *subs, struct audioformat *fmt) | |||
1272 | subs->syncpipe = usb_rcvisocpipe(dev, ep); | 1269 | subs->syncpipe = usb_rcvisocpipe(dev, ep); |
1273 | else | 1270 | else |
1274 | subs->syncpipe = usb_sndisocpipe(dev, ep); | 1271 | subs->syncpipe = usb_sndisocpipe(dev, ep); |
1275 | subs->syncinterval = get_endpoint(alts, 1)->bRefresh; | 1272 | if (get_endpoint(alts, 1)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE && |
1273 | get_endpoint(alts, 1)->bRefresh >= 1 && | ||
1274 | get_endpoint(alts, 1)->bRefresh <= 9) | ||
1275 | subs->syncinterval = get_endpoint(alts, 1)->bRefresh; | ||
1276 | else | ||
1277 | subs->syncinterval = 1; | ||
1276 | } | 1278 | } |
1277 | 1279 | ||
1278 | /* always fill max packet size */ | 1280 | /* always fill max packet size */ |