upstream: [media] em28xx-audio: don't hardcode audio URB calculus
authorMauro Carvalho Chehab <m.chehab@samsung.com>
Fri, 10 Jan 2014 08:53:24 +0000 (05:53 -0300)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:54:27 +0000 (11:54 +0900)
commitd81c3b6ed50a68c3a01c81685219aca5a9e88374
tree338cd9b3b4b39d4b06a8581a4edc3c25900ab1ba
parent6531e78686b8ad05bb979ded7b105a2c6def0fb0
upstream: [media] em28xx-audio: don't hardcode audio URB calculus

The current code hardcodes the number of audio URBs, the number
of packets per URB and the maximum URB size.

This is not a good idea, as it:

- wastes more bandwidth than necessary, by using a very
  large number of packets;

- those constants are bound to an specific scenario, with
  a bandwidth of 48 kHz;

- don't take the maximum endpoint size into account;

- with urb->interval = 1 on xHCI, those constraints cause a "funny"
  setup: URBs with 64 packets inside, with only 24 bytes total. E. g.
  a complete waste of space.

Change the code to do dynamic URB audio calculus and allocation.

For now, use the same constraints as used before this patch, to
avoid regressions.

A good scenario (tested) seems to use those defines, instead:

#define EM28XX_MAX_AUDIO_BUFS          8
#define EM28XX_MIN_AUDIO_PACKETS       2

But let's not do such change here, letting the optimization to
happen on latter patches, after more tests.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/usb/em28xx/em28xx-audio.c
drivers/media/usb/em28xx/em28xx.h