[media] em28xx: use usb_alloc_coherent() for audio

Instead of allocating transfer buffers with kmalloc() use
usb_alloc_coherent().

This patch should make it work also with ARM CPUs.

Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] em28xx-audio: allocate URBs at device driver init

Instead of allocating/deallocating URBs and transfer buffers
every time stream is started/stopped, just do it once.

That reduces the memory allocation pressure and makes the
code that start/stop streaming a way simpler.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] tuner-xc2028: Don't try to sleep twice

Only send a power down command for the device if it is not already
in power down state. That prevents a timeout when trying to talk
with the device.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] tuner-xc2028: Don't read status if device is powered down

That removes those timeout errors:

[ 3675.930940] xc2028 19-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[ 3676.060487] xc2028 19-0061: divisor= 00 00 8d d0 (freq=567.250)
[ 3676.349449] xc2028 19-0061: Putting xc2028/3028 into poweroff mode.
[ 3698.247645] xc2028 19-0061: xc2028_get_reg 0002 called
[ 3698.253276] em2860 #0: I2C transfer timeout on writing to addr 0xc2
[ 3698.253301] xc2028 19-0061: i2c input error: rc = -121 (should be 2)
[ 3698.253327] xc2028 19-0061: xc2028_signal called
[ 3698.253339] xc2028 19-0061: xc2028_get_reg 0002 called
[ 3698.259283] em2860 #0: I2C transfer timeout on writing to addr 0xc2
[ 3698.259312] xc2028 19-0061: i2c input error: rc = -121 (should be 2)

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] em28xx: properly implement AC97 wait code

Instead of assuming that msleep() is precise, use a jiffies
based code to wait for AC97 to be available.

Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] em28xx: convert i2c wait completion logic to use jiffies

The I2C wait completion/timeout logic currently assumes that
msleep(5) will wait exaclty 5 ms. This is not true at all,
as it depends on CONFIG_HZ.

Convert it to use jiffies, in order to not wait for more time
than needed.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] em28xx: rename I2C timeout to EM28XX_I2C_XFER_TIMEOUT

This macro is used by all em28xx devices, and not just em2800.

Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
[media] em28xx: use a better value for I2C timeouts

In the lack of a better spec, let's assume the timeout
values compatible with SMBus spec:
	http://smbus.org/specs/smbus110.pdf

at chapter 8 - Electrical Characteristics of SMBus devices

Ok, SMBus is a subset of I2C, and not all devices will be
following it, but the timeout value before this patch was not
even following the spec.

So, while we don't have a better guess for it, use 35 + 1
ms as the timeout.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
saa716x: Initial commit based on http://powarman.dyndns.org/hgwebdir.cgi/v4l-dvb-saa716x/
saa716x: Fix to build FF cards in newer kernels
saa716x: Small i2c fixes. i2x_xfer functions needs to return error after retrying 3 times. Decreased i2c data hold time: the falling edge of sda was too close to the rising edge of the next clock.
tas2101: Initial commit. Added to Makefile and Kconfig. Added i2c read and write functions.
tas2101: Added dvb attach function and dvb ops
tas2101: Added frontend release. Minor fixes.
saa716x_budget: Added TBS6982SE. Card is now attaching.
tas2101: Added init frontend function
tas2101: Added a few placeholder functions.
tas2101: Added lnb voltage control
tas2101: Added tone and burst control functions
tas2101: Added frontend status.