diff options
-rw-r--r-- | sound/usb/usbaudio.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 8298c462c291..9e38d3d1322a 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -97,7 +97,7 @@ MODULE_PARM_DESC(async_unlink, "Use async unlink mode."); | |||
97 | 97 | ||
98 | #define MAX_PACKS 10 | 98 | #define MAX_PACKS 10 |
99 | #define MAX_PACKS_HS (MAX_PACKS * 8) /* in high speed mode */ | 99 | #define MAX_PACKS_HS (MAX_PACKS * 8) /* in high speed mode */ |
100 | #define MAX_URBS 5 /* max. 20ms long packets */ | 100 | #define MAX_URBS 8 |
101 | #define SYNC_URBS 4 /* always four urbs for sync */ | 101 | #define SYNC_URBS 4 /* always four urbs for sync */ |
102 | #define MIN_PACKS_URB 1 /* minimum 1 packet per urb */ | 102 | #define MIN_PACKS_URB 1 /* minimum 1 packet per urb */ |
103 | 103 | ||
@@ -920,10 +920,12 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by | |||
920 | else | 920 | else |
921 | subs->curpacksize = maxsize; | 921 | subs->curpacksize = maxsize; |
922 | 922 | ||
923 | if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL) | 923 | if (is_playback) |
924 | urb_packs = nrpacks; | 924 | urb_packs = nrpacks; |
925 | else | 925 | else |
926 | urb_packs = (nrpacks * 8) >> subs->datainterval; | 926 | urb_packs = 1; |
927 | if (snd_usb_get_speed(subs->dev) == USB_SPEED_HIGH) | ||
928 | urb_packs = (urb_packs * 8) >> subs->datainterval; | ||
927 | 929 | ||
928 | /* allocate a temporary buffer for playback */ | 930 | /* allocate a temporary buffer for playback */ |
929 | if (is_playback) { | 931 | if (is_playback) { |
@@ -935,9 +937,13 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by | |||
935 | } | 937 | } |
936 | 938 | ||
937 | /* decide how many packets to be used */ | 939 | /* decide how many packets to be used */ |
938 | total_packs = (period_bytes + maxsize - 1) / maxsize; | 940 | if (is_playback) { |
939 | if (total_packs < 2 * MIN_PACKS_URB) | 941 | total_packs = (period_bytes + maxsize - 1) / maxsize; |
940 | total_packs = 2 * MIN_PACKS_URB; | 942 | if (total_packs < 2 * MIN_PACKS_URB) |
943 | total_packs = 2 * MIN_PACKS_URB; | ||
944 | } else { | ||
945 | total_packs = MAX_URBS * urb_packs; | ||
946 | } | ||
941 | subs->nurbs = (total_packs + urb_packs - 1) / urb_packs; | 947 | subs->nurbs = (total_packs + urb_packs - 1) / urb_packs; |
942 | if (subs->nurbs > MAX_URBS) { | 948 | if (subs->nurbs > MAX_URBS) { |
943 | /* too much... */ | 949 | /* too much... */ |