diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/usb/endpoint.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index 7a444b5501d9..659950e5b94f 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c | |||
@@ -591,17 +591,16 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep, | |||
591 | ep->stride = frame_bits >> 3; | 591 | ep->stride = frame_bits >> 3; |
592 | ep->silence_value = pcm_format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0; | 592 | ep->silence_value = pcm_format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0; |
593 | 593 | ||
594 | /* calculate max. frequency */ | 594 | /* assume max. frequency is 25% higher than nominal */ |
595 | if (ep->maxpacksize) { | 595 | ep->freqmax = ep->freqn + (ep->freqn >> 2); |
596 | maxsize = ((ep->freqmax + 0xffff) * (frame_bits >> 3)) | ||
597 | >> (16 - ep->datainterval); | ||
598 | /* but wMaxPacketSize might reduce this */ | ||
599 | if (ep->maxpacksize && ep->maxpacksize < maxsize) { | ||
596 | /* whatever fits into a max. size packet */ | 600 | /* whatever fits into a max. size packet */ |
597 | maxsize = ep->maxpacksize; | 601 | maxsize = ep->maxpacksize; |
598 | ep->freqmax = (maxsize / (frame_bits >> 3)) | 602 | ep->freqmax = (maxsize / (frame_bits >> 3)) |
599 | << (16 - ep->datainterval); | 603 | << (16 - ep->datainterval); |
600 | } else { | ||
601 | /* no max. packet size: just take 25% higher than nominal */ | ||
602 | ep->freqmax = ep->freqn + (ep->freqn >> 2); | ||
603 | maxsize = ((ep->freqmax + 0xffff) * (frame_bits >> 3)) | ||
604 | >> (16 - ep->datainterval); | ||
605 | } | 604 | } |
606 | 605 | ||
607 | if (ep->fill_max) | 606 | if (ep->fill_max) |