Commit Graph

470030 Commits

Author SHA1 Message Date
Olli Salonen 5b5560842a [media] af9035: Add support for IT930x USB bridge
Add support for IT930x USB bridge and IT9303 reference design.

It is a DVB-T/T2/C tuner with the following components:
- IT9303 USB bridge
- Si2168-B40 demodulator
- Si2147-A30 tuner

The IT9303 requires firmware that can be downloaded here:
http://trsqr.net/olli/linux/firmwares/it930x/

The Si2168-B40 requires firmware, but the one that is used by PCTV 292e can be used.
http://palosaari.fi/linux/v4l-dvb/firmware/Si2168/Si2168-B40/

The Si2147-A30 tuner does not require firmware loading.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 21:49:42 -03:00
Olli Salonen 5dcf5bf6d9 [media] af9035: Add possibility to define which I2C adapter to use
Some I2C tuner drivers require that the I2C device of the tuner is added
to the I2C adapter of the demodulator (Si2168+Si2157 for example). Add
possibility to tell af9035_add_i2c_dev which I2C adapter should be used.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 21:47:28 -03:00
Olli Salonen 2944226622 [media] cx23855: add support for DVBSky T9580 DVB-C/T2/S2 tuner
DVBSky T9580 is a dual tuner card with one DVB-T2/C tuner and one DVB-S2 tuner. It contains the following components:

- PCIe bridge: Conexant CX23885
- Demod for terrestrial/cable: Silicon Labs Si2168-A30
- Tuner for terrestrial/cable: Silicon Labs Si2158-A20
- Demod for sat: Montage DS3103
- Tuner for sat: Montage TS2022

This patch depends on Max Nibble's patch for m88ds3103 (see patchwork 25312: https://patchwork.linuxtv.org/patch/25312/ ).

3 firmwares are needed:
- Si2168-A30 demod and Si2158-A20 tuner: same as TechnoTrend CT2-4400, https://www.mail-archive.com/linux-media@vger.kernel.org/msg76944.html
- Montage DS3103 demod: same as PCTV 461e, Antti has it on his LinuxTV project page: http://palosaari.fi/linux/v4l-dvb/firmware/M88DS3103/

IR receiver is not supported.

Values in cx23885_gpio_setup, cx23885_card_setup and dvbsky_t9580_set_voltage as well as the EEPROM read function are taken from the manufacturer provided semi-open source driver. The drivers in question are Linux GPL'd media tree drivers for cx23885 modified by Max Nibble (nibble.max@gmail.com) with proprietary tuner/demod drivers. Max is aware of this patch and has approved my use of the values in this patch.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 21:33:16 -03:00
Olli Salonen 5cd3b6b40d [media] cx23855: add frontend set voltage function into state
Setting the LNB voltage requires setting some GPIOs on the cx23885 with some boards before calling the actual set_voltage function in the demod driver. Add a function pointer into state for that case.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Acked-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 21:30:43 -03:00
Olli Salonen b0b12e63f9 [media] cx23885: add i2c client handling into dvb_unregister and state
Prepare cx23885 driver for handling I2C client that is needed for certain demodulators and tuners (for example Si2168 and Si2157). I2C client for tuner and demod stored in state and unregistering of the I2C devices added into dvb_unregister.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 21:30:24 -03:00
Mauro Carvalho Chehab 49310ed0ab [media] pt3: make pt3_pm_ops() static
drivers/media/pci/pt3/pt3.c:862:1: warning: symbol 'pt3_pm_ops' was not declared. Should it be static?

Cc: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 18:47:17 -03:00
Mauro Carvalho Chehab 70dc536337 [media] tc90522: declare tc90522_functionality as static
drivers/media/dvb-frontends/tc90522.c:706:5: warning: symbol 'tc90522_functionality' was not declared. Should it be static?
drivers/media/dvb-frontends/tc90522.c:706:5: warning: no previous prototype for 'tc90522_functionality' [-Wmissing-prototypes]
 u32 tc90522_functionality(struct i2c_adapter *adap)
     ^

Cc: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 17:04:01 -03:00
Akihiro Tsukada f5a98f37a5 [media] pt3: add support for Earthsoft PT3 ISDB-S/T receiver card
This patch adds support for PT3 PCIe cards.
PT3 has an FPGA PCIe bridge chip, a TC90522 demod chip and
a VA4M6JC2103 tuner module which contains two QM1D1C0042 chips for ISDB-S
and two MxL301RF's for ISDB-T.
It can receive and deliver 4 (2x ISDB-S, 2x ISDB-T) streams simultaneously,
and a kthread is used per stream to poll incoming data,
because PT3 does not have interrupts.

As an antenna input for each delivery system is split in the tuner module
and shared between the corresponding two tuner chips,
LNB/LNA controls that the FPGA chip provides are (naturally) shared as well.
The tuner chips also share the power line in the tuner module,
which is controlled on/off by a GPIO pin of the demod chip.

As with the demod chip and the ISDB-T tuner chip,
the init sequences/register settings for those chips are not disclosed
and stored in a private memory of the FPGA,
PT3 driver executes the init of those chips on behalf of their drivers.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 17:04:01 -03:00
Akihiro Tsukada f5d82a75e6 [media] tc90522: add driver for Toshiba TC90522 quad demodulator
This patch adds driver for tc90522 demodulator chips.
The chip contains 4 demod modules that run in parallel and are independently
controllable via separate I2C addresses.
Two of the modules are for ISDB-T and the rest for ISDB-S.
It is used in earthsoft pt3 cards.

Note that this driver does not init the chip,
because the initilization sequence / register setting is not disclosed.
Thus, the driver assumes that the chips are initilized externally
by its parent board driver before fe->ops->init() are called.
Earthsoft PT3 PCIe card, for example, contains the init sequence
in its private memory and provides a command to trigger the sequence.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 17:04:00 -03:00
Akihiro Tsukada 7608f575b8 [media] qm1d1c0042: add driver for Sharp QM1D1C0042 ISDB-S tuner
This patch adds driver for qm1d1c0042 tuner chips.
It is used as an ISDB-S tuner in earthsoft pt3 cards.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 17:04:00 -03:00
Akihiro Tsukada aff0c42a78 [media] mxl301rf: add driver for MaxLinear MxL301RF OFDM tuner
This patch adds driver for mxl301rf OFDM tuner chips.
It is used as an ISDB-T tuner in earthsoft pt3 cards.

Note that this driver does not initilize the chip,
because the initilization sequence / register setting is not disclosed.
Thus, the driver assumes that the chips are initilized externally
by its parent board driver before tuner_ops->init() are called,
like in PT3 driver where the bridge chip contains the init sequence
in its private memory and provides a command to trigger the sequence.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 17:03:59 -03:00
Joe Perches 0f531e7356 [media] tda18271-common: Convert _tda_printk to return void
No caller or macro uses the return value so make it void.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 17:03:59 -03:00
Srinivas Kandagatla da8e77f5e9 [media] media: st-rc: Remove .owner field for driver
There is no need to init .owner field.

Based on the patch from Peter Griffin <peter.griffin@linaro.org>
"mmc: remove .owner field for drivers using module_platform_driver"

This patch removes the superflous .owner field for drivers which
use the module_platform_driver API, as this is overriden in
platform_driver_register anyway."

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 17:03:58 -03:00
Srinivas Kandagatla cdd9a6316b [media] media: st-rc: move pm ops setup out of conditional compilation
This patch moves setting of pm_ops out of the CONFIG_PM_SLEEP condition.
Setting pm ops under CONFIG_PM_SLEEP does not make any sense.
This patch also remove unnecessary also remove CONFIG_PM condition for pm
member in st_rc_driver structure.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 17:03:58 -03:00
Srinivas Kandagatla 89d7ce5a0f [media] media: st-rc: move to using reset_control_get_optional
This patch fixes a compilation error while building with the
random kernel configuration.

drivers/media/rc/st_rc.c: In function 'st_rc_probe':
drivers/media/rc/st_rc.c:281:2: error: implicit declaration of
function 'reset_control_get' [-Werror=implicit-function-declaration]
  rc_dev->rstc = reset_control_get(dev, NULL);

drivers/media/rc/st_rc.c:281:15: warning: assignment makes pointer
from integer without a cast [enabled by default]
  rc_dev->rstc = reset_control_get(dev, NULL);

Reported-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 17:03:57 -03:00
Guoxiong Yan a84fcdaa90 [media] rc: Introduce hix5hd2 IR transmitter driver
IR transmitter driver for Hisilicon hix5hd2 soc

By default all protocols are disabled.
For example nec decoder can be enabled by either
1. ir-keytable -p nec
2. echo nec > /sys/class/rc/rc0/protocols
See see Documentation/ABI/testing/sysfs-class-rc

[mchehab@osg.samsung.com: Add a fixup for the driver to compile on
 archs that don't provide writel_relaxed() macro]
Signed-off-by: Guoxiong Yan <yanguoxiong@huawei.com>
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 17:03:57 -03:00
Guoxiong Yan 1a3920e86e [media] rc: Add DT bindings for hix5hd2
Signed-off-by: Guoxiong Yan <yanguoxiong@huawei.com>
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:51 -03:00
nibble.max 67cbf633c8 [media] rc: add a map for DVBSky devices.
This is a RC5 remote controller map for DVBSky S860/960 devices.

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:50 -03:00
nibble.max af64fb3fa4 [media] dvbsky: new driver to support DVBSky S860/S960 devices
Support for DVBSky dvb-s2 usb: add dvb-usb-v2 driver for DVBSky dvb-s2
box, no ci support yet.

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:50 -03:00
nibble.max 8db3e5df4b [media] rc: add dvbsky rc keymap macro
This RC will be used by DVBSky driver, added on the next patch.

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:49 -03:00
Shuah Khan 27ccd694bb [media] media: tuner xc5000 - try to avoid firmware load in resume path
xc5000 doesn't load firmware at attach time instead loads it
when it needs to set and change configuration from its init,
frequency, digital and analog mode set interffaces. As a result,
when system is suspended before firmware is loaded, firmware
load can be avoided during resume. Loading formware in this
scenario results in slowpath warnings during resume as it won't
be in the suspend firmware cache.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:49 -03:00
Shuah Khan 5264a522a5 [media] media: tuner xc5000 - release firmwware from xc5000_release()
xc5000 releases firmware right after loading it. Change it to
save the firmware and release it from xc5000_release(). This
helps avoid fecthing firmware when forced firmware load requests
come in to change analog tv frequence and when firmware needs to
be reloaded after suspend and resume.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:48 -03:00
Mauro Carvalho Chehab 8eb988f1be [media] saa7134: Remove unused status var
drivers/media/pci/saa7134/saa7134-go7007.c: In function ‘saa7134_go7007_interface_reset’:
drivers/media/pci/saa7134/saa7134-go7007.c:147:6: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
2014-09-23 16:13:48 -03:00
Mauro Carvalho Chehab 23ea6ec078 [media] saa7134: Remove some casting warnings
drivers/media/pci/saa7134/saa7134-go7007.c:247:17: warning: incorrect type in argument 1 (different base types)
drivers/media/pci/saa7134/saa7134-go7007.c:247:17:    expected unsigned int [unsigned] val
drivers/media/pci/saa7134/saa7134-go7007.c:247:17:    got restricted __le32 [usertype] <noident>
drivers/media/pci/saa7134/saa7134-go7007.c:252:17: warning: incorrect type in argument 1 (different base types)
drivers/media/pci/saa7134/saa7134-go7007.c:252:17:    expected unsigned int [unsigned] val
drivers/media/pci/saa7134/saa7134-go7007.c:252:17:    got restricted __le32 [usertype] <noident>
drivers/media/pci/saa7134/saa7134-go7007.c:299:9: warning: incorrect type in argument 1 (different base types)
drivers/media/pci/saa7134/saa7134-go7007.c:299:9:    expected unsigned int [unsigned] val
drivers/media/pci/saa7134/saa7134-go7007.c:299:9:    got restricted __le32 [usertype] <noident>
drivers/media/pci/saa7134/saa7134-go7007.c:300:9: warning: incorrect type in argument 1 (different base types)
drivers/media/pci/saa7134/saa7134-go7007.c:300:9:    expected unsigned int [unsigned] val
drivers/media/pci/saa7134/saa7134-go7007.c:300:9:    got restricted __le32 [usertype] <noident>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:47 -03:00
Mauro Carvalho Chehab aff440fa61 [media] saa7134: Fix compilation breakage when go7007 is not selected
All error/warnings:

   drivers/built-in.o: In function `saa7134_go7007_fini':
>> saa7134-go7007.c:(.text+0x3b628b): undefined reference to `go7007_snd_remove'
   drivers/built-in.o: In function `saa7134_go7007_interface_reset':
>> saa7134-go7007.c:(.text+0x3b659a): undefined reference to `go7007_read_interrupt'
   drivers/built-in.o: In function `saa7134_go7007_init':
>> saa7134-go7007.c:(.text+0x3b65fa): undefined reference to `go7007_alloc'
>> saa7134-go7007.c:(.text+0x3b66ed): undefined reference to `go7007_boot_encoder'
>> saa7134-go7007.c:(.text+0x3b66fe): undefined reference to `go7007_register_encoder'
   drivers/built-in.o: In function `saa7134_go7007_irq_ts_done':
>> saa7134-go7007.c:(.text+0x3b6c2a): undefined reference to `go7007_parse_video_stream'
>> saa7134-go7007.c:(.text+0x3b6c86): undefined reference to `go7007_parse_video_stream'

This happens when:
 - VIDEO_SAA7134 is either 'm' or 'y'
 - VIDEO_GO7007 is not selected.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:47 -03:00
Hans Verkuil 452015de2e [media] saa7134: add saa7134-go7007
This patch adds support to saa7134 for 'WIS Voyager or compatible' PCI boards
such as the Sensoray model 614 with which this patch was tested. It is a
saa7134-based PCI board with a go7007 MPEG encoder. This was a patch when the
go7007 was still in staging and was not applied when go7007 was moved to
drivers/media since it needed more work.

That work is now done and this last piece of go7007 support can now go in.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:46 -03:00
Hans Verkuil 033d008821 [media] saa7134: also capture the WSS signal for 50 Hz VBI capture
The saa7134 driver missed capturing line 23 of the VBI area for the
50 Hz formats. Include that line in the VBI capture.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:46 -03:00
Hans Verkuil 017ab36a8b [media] v4l2-ioctl.c: fix inverted condition
v4l_print_ext_controls() would print the 'size' if it was 0 and
'value' if size was non-zero, but it should have been the other
way around.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:45 -03:00
Dan Carpenter 692f637522 [media] davinci: remove an unneeded check
We don't need to check "ret", we know it's zero.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:45 -03:00
Dan Carpenter 271430efb2 [media] as102: remove some unneeded checks
We know "ret" is zero so we don't need to test for it.  It upsets the
static checkers when we test stuff but we know the answer.

drivers/media/usb/as102/as102_usb_drv.c:164 as102_send_ep1() warn: we tested 'ret' before and it was 'false'
drivers/media/usb/as102/as102_usb_drv.c:189 as102_read_ep2() warn: we tested 'ret' before and it was 'false'

Also, we don't need to initialize "ret".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:44 -03:00
Amber Thrall 146af9cb80 [media] Media: USB: usbtv: Fixed all coding style issues in usbtv source files
Fixed various coding styles, ignoring coding style error on line 5 for all files containing a link that is longer than 80 characters long.

Signed-off-by: Amber Thrall <amber.rose.thrall@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:44 -03:00
Alexey Khoroshilov e87cb47089 [media] imon: fix usbdev leaks
imon_probe() does three usb_get_dev(), but there is no any
usb_put_dev() in the driver.

The patch adds usb_put_dev() to error paths, to imon_disconnect()
and to imon_probe() as far as usbdev is not saved anywhere.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:43 -03:00
Maciej Matraszek 3bacc10cd4 [media] v4l2-common: fix overflow in v4l_bound_align_image()
Fix clamp_align() used in v4l_bound_align_image() to prevent overflow
when passed large value like UINT32_MAX.

 In the current implementation:
    clamp_align(UINT32_MAX, 8, 8192, 3)

returns 8, because in line:

    x = (x + (1 << (align - 1))) & mask;

x overflows to (-1 + 4) & 0x7 = 3, while expected value is 8192.

v4l_bound_align_image() is heavily used in VIDIOC_S_FMT and
VIDIOC_SUBDEV_S_FMT ioctls handlers, and documentation of the latter
explicitly states that:

"The modified format should be as close as possible to the original
request."
  -- http://linuxtv.org/downloads/v4l-dvb-apis/vidioc-subdev-g-fmt.html

Thus one would expect, that passing UINT32_MAX as format width and
height will result in setting maximum possible resolution for the
device. Particularly, when the driver doesn't support
VIDIOC_ENUM_FRAMESIZES ioctl, which is common in the codebase.

Fixes changeset: b0d3159be9

Signed-off-by: Maciej Matraszek <m.matraszek@samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:43 -03:00
Frank Schaefer 43c3ea312c [media] em28xx: remove dead code line from em28xx_audio_setup()
Setting the value of the chip config register to EM28XX_CHIPCFG_AC97 in
case of a read error is a leftover from the past which is no longer
needed.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:42 -03:00
Frank Schaefer 920f1e4a52 [media] em28xx: get rid of field has_audio in struct em28xx_audio_mode
Field has_audio in struct em28xx_audio_mode is used together with value
EM28XX_NO_AC97 of field ac97 to determine the internal type of audio
(none/i2s/ac97). This makes the code difficult to understand:

  !audio_mode.has_audio && audio_mode.ac97 == EM28XX_NO_AC97 => no audio
  !audio_mode.has_audio && audio_mode.ac97 != EM28XX_NO_AC97 => BUG
  audio_mode.has_audio  && audio_mode.ac97 == EM28XX_NO_AC97 => AC97 audio
  audio_mode.has_audio  && audio_mode.ac97 != EM28XX_NO_AC97 => I2S audio

Simplify the whole thing by introducing an enum em28xx_int_audio_type
which describes the internal audio type (none, ac97, i2s) and is hooked
directly to the device struct. Then get rid of field has_audio in struct
em28xx_audio_mode.

A follow-up patch will then remove struct em28xx_ac97_mode and finally
the whole struct em28xx_audio_mode.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:42 -03:00
Frank Schaefer c5874208ff [media] em28xx: simplify usb audio class handling
As far as we know devices can either have audio class or vendor class
usb interfaces but not both at the same time. Even if both interface
types could be provided by devices at the same time, the current code is
totally broken for that case.

So clean up and simplify the usb audio class handling by replacing
fields "has_audio_class" (device has usb audio class compliant
interface) and "has_alsa_audio" (device has vendor audio interface) in
struct em28xx with a single enum em28xx_usb_audio_type.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:41 -03:00
Frank Schaefer 60a24ba03c [media] em28xx: remove some unnecessary fields from struct em28xx_audio_mode
Fields "ac97_feat", "ac97_vendor_id" and "i2s_samplerates" of struct
em28xx_audio_mode are used nowhere, except in function
em28xx_audio_setup(). So get rid of them and use local variables
instead.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:41 -03:00
Laurent Pinchart 072f1a489e [media] v4l: videobuf2: Fix typos in comments
The buffer flags are incorrectly referred to as V4L2_BUF_FLAGS_* instead
of V4L2_BUF_FLAG_* in comments. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:40 -03:00
Olli Salonen d87a50586d [media] si2157: Add support for Si2147-A30 tuner
This patch adds support for Si2147-A30 tuner. Fairly trivial, no firmware needed for this tuner. However, command 14 00 02 07 01 00 seems to be mandatory. On Si2157 and Si2158 the value 0x0100 is the default value, so this patch does not impact the existing tuners/devices. On Si2147 the default is 0x0000 and I can't get a lock with that value.

While here, fix the return length of the previous set command to 4 bytes.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Acked-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:39 -03:00
Dan Carpenter 7ac95cf59d [media] firewire: firedtv-avc: fix more potential buffer overflow
"program_info_length" is user controlled and can go up to 4095.  The
operand[] array has 509 bytes so we need to add a limit here to prevent
buffer overflows.

The " - 4" in the limit check is because we have 4 bytes more data to
add after the memcpy().

[mchehab@osg.samsung.com: as I merged the version 1 of the patch, I needed
 to rebase to apply just the differences between v1 and v2]
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:39 -03:00
Dan Carpenter cf3b576d52 [media] dvb: si21xx: buffer overflow in si21_writeregs()
"len" is user controlled and can be up to 255.  Anything more than 59
will cause a buffer overflow so we need to add a test for that.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:38 -03:00
Alexey Khoroshilov e947d9ad8a [media] mceusb: fix usbdev leak
mceusb_init_rc_dev() does usb_get_dev(), but there is no any
usb_put_dev() in the driver.

The patch tries to straighten logic. It moves usb_get_dev()
directly to mceusb_dev_probe() and adds usb_put_dev() to an error path
and to mceusb_dev_disconnect().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:38 -03:00
Dan Carpenter 3011e5e592 [media] firewire: firedtv-avc: potential buffer overflow
"program_info_length" is user controlled and can go up to 4095.  The
operand[] array has 509 bytes so we need to add a limit here to prevent
buffer overflows.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:37 -03:00
Dan Carpenter f2e323ec96 [media] ttusb-dec: buffer overflow in ioctl
We need to add a limit check here so we don't overflow the buffer.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:37 -03:00
Andy Shevchenko 9380e112f7 [media] hdpvr: reduce memory footprint when debugging
There is no need to use hex_dump_to_buffer() since we have a kernel helper to
dump up to 64 bytes just via printk().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:36 -03:00
Dan Carpenter 3232e04df7 [media] staging: lirc: freeing ERR_PTRs
We call kfree(data_buf) in the error handling and that will oops if this
is an error pointer.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:36 -03:00
Frank Schaefer fb91bde9d3 [media] em28xx: check if a device has audio earlier"
GIT_AUTHOR_DATE=1409603039
This reverts

commit b99f0aadd3
Author: Mauro Carvalho Chehab <m.chehab@samsung.com>

    [media] em28xx: check if a device has audio earlier

    Better to split chipset detection from the audio setup. So, move the
    detection code to em28xx_init_dev().

It broke analog audio of the Hauppauge winTV HVR 900 and very likely many other
em28xx devices.

Background:
The local variable has_audio in em28xx_usb_probe() describes if the currently
probed _usb_interface_ has an audio endpoint, while dev->audio_mode.has_audio
means that the _device_ as a whole provides analog audio.
Hence it is wrong to set dev->audio_mode.has_audio = has_audio in em28xx_usb_probe().
As result, audio support is no longer detected and configured on devices which
have the audio endpoint on a separate interface, because em28xx_audio_setup()
bails out immediately at the beginning.

Revert the faulty commit to restore the old audio detection procedure, which checks
the chip configuration register to determine if the device has analog audio.

Cc: <stable@vger.kernel.org>	# 3.14 to 3.16
Reported-by: Oravecz Csaba <oravecz@nytud.mta.hu>
Tested-by: Oravecz Csaba <oravecz@nytud.mta.hu>
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:35 -03:00
Matthias Schwarzott 66756611c1 [media] mceusb: add support for more cx231xx devices
Add support for the si2161-based cx231xx devices:
	[2040:b138] Hauppauge WinTV HVR-900-H (model 111xxx)
	[2040:b139] Hauppauge WinTV HVR-901-H (model 1114xx)

They're similar to the already supported:
	[2040:b130] Hauppauge WinTV 930C-HD (model 1113xx)

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:35 -03:00
Matthias Schwarzott 8618ac4d01 [media] cx231xx: Add support for Hauppauge WinTV-HVR-901H (1114xx)
Add support for:
	[2040:b139] Hauppauge WinTV HVR-901H (1114xx)

According to the inf file, the hardware is similar to [2040:b131] Hauppauge WinTV 930C-HD (model 1114xx)
The only difference is the demod Si2161 instead of Si2165 (but both are
supported by the si2165 driver).

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:34 -03:00
Matthias Schwarzott 57cbf3efc8 [media] cx231xx: Add support for Hauppauge WinTV-HVR-900H (111xxx)
Add support for:
	[2040:b138] Hauppauge WinTV HVR-900H (111xxx)

The hardware is similar to [2040:b130] Hauppauge WinTV 930C-HD (model 1113xx)
The only difference is the demod Si2161 instead of Si2165 (but both are
supported by the si2165 driver).

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:34 -03:00