platform/kernel/linux-3.10.git
10 years agoupstream: [media] s5k5baf: Fix checkpatch error
Sachin Kamat [Tue, 24 Dec 2013 11:42:04 +0000 (08:42 -0300)]
upstream: [media] s5k5baf: Fix checkpatch error

Fixes the following error:
ERROR: return is not a function, parentheses are not required
FILE: drivers/media/i2c/s5k5baf.c:1353:

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] saa6588: after calling CMD_CLOSE, CMD_POLL is broken
Hans Verkuil [Sat, 14 Dec 2013 11:28:34 +0000 (08:28 -0300)]
upstream: [media] saa6588: after calling CMD_CLOSE, CMD_POLL is broken

CMD_CLOSE sets data_available_for_read to 1, which is necessary to do the
wakeup call, but it is never reset to 0.

Because of this calling CMD_POLL afterwards will always return that data is
available, even if there isn't any.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] ths8200: fix compilation with GCC < 4.4.6
Gianluca Gennari [Fri, 30 Aug 2013 11:29:25 +0000 (08:29 -0300)]
upstream: [media] ths8200: fix compilation with GCC < 4.4.6

Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] ad9389b: fix compilation with GCC < 4.4.6
Gianluca Gennari [Fri, 30 Aug 2013 11:29:24 +0000 (08:29 -0300)]
upstream: [media] ad9389b: fix compilation with GCC < 4.4.6

Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] adv7511: fix compilation with GCC < 4.4.6
Gianluca Gennari [Fri, 30 Aug 2013 11:29:23 +0000 (08:29 -0300)]
upstream: [media] adv7511: fix compilation with GCC < 4.4.6

Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] media: i2c: tvp7002: add OF support
Lad, Prabhakar [Sun, 11 Aug 2013 05:25:21 +0000 (02:25 -0300)]
upstream: [media] media: i2c: tvp7002: add OF support

add OF support for the tvp7002 driver.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] tvp514x: s_routing should just change routing, not try to detect...
Hans Verkuil [Thu, 20 Sep 2012 12:06:33 +0000 (09:06 -0300)]
upstream: [media] tvp514x: s_routing should just change routing, not try to detect a signal

The s_routing function should not try to detect a signal. It is a really
bad idea to try to detect a valid video signal and return an error if
you can't. Changing input should do just that and nothing more.
Also don't power on the ADCs on s_routing, instead do that on querystd.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Tested-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
10 years agoupstream: [media] lm3560: prevent memory leak in case of pdata absence
Andy Shevchenko [Wed, 12 Feb 2014 09:02:07 +0000 (06:02 -0300)]
upstream: [media] lm3560: prevent memory leak in case of pdata absence

If we have no pdata defined and driver fails to register we leak memory.
Converting to devm_kzalloc prevents this to happen.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] lm3560: keep style for the comments
Andy Shevchenko [Wed, 12 Feb 2014 09:02:06 +0000 (06:02 -0300)]
upstream: [media] lm3560: keep style for the comments

Let's keep the style for all comments in the code, namely using small letters
whenever it's possible.

There is no functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] lm3560: remove FSF address from the license
Andy Shevchenko [Wed, 12 Feb 2014 09:02:05 +0000 (06:02 -0300)]
upstream: [media] lm3560: remove FSF address from the license

There is no need to keep the FSF address inside each file. Moreover, it might
change in future which will make this one obsolete.

There is no functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] media: i2c: lm3560: use correct clientdata in lm3560_remove()
Wei Yongjun [Sat, 9 Nov 2013 00:24:18 +0000 (21:24 -0300)]
upstream: [media] media: i2c: lm3560: use correct clientdata in lm3560_remove()

We had set the i2c clientdata to &flash->subdev_led[LM3560_LED1]
after call lm3560_subdev_init(flash, LM3560_LED1, "lm3560-led1"),
but the container_of() in lm3560_remove() return the wrong pointer
to flash.(should be container_of(subdev, struct lm3560_flash,
subdev_led[LM3560_LED_MAX-1])
This patch fix to set i2c clientdata to flash so we can get flash
from clientdata directly.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] media: i2c: lm3560: fix missing unlock on error in lm3560_set_ctrl()
Wei Yongjun [Thu, 7 Nov 2013 12:44:42 +0000 (09:44 -0300)]
upstream: [media] media: i2c: lm3560: fix missing unlock on error in lm3560_set_ctrl()

Add the missing unlock before return from function lm3560_set_ctrl()
in the error handling case.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] media: i2c: lm3560: fix missing unlock on error, fault handling
Daniel Jeong [Fri, 6 Dec 2013 05:43:27 +0000 (02:43 -0300)]
upstream: [media] media: i2c: lm3560: fix missing unlock on error, fault handling

Correct reference of reading values. (rval -> reg_val)
Add the missing unlock before return from function lm3560_get_ctrl()
to avoid deadlock.
Thank you Dan Carpenter & Sakari.

Signed-off-by: Daniel Jeong <gshark.jeong@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] media: i2c: add driver for dual LED Flash, lm3560
Daniel Jeong [Wed, 16 Oct 2013 07:12:19 +0000 (04:12 -0300)]
upstream: [media] media: i2c: add driver for dual LED Flash, lm3560

Adds the driver for the LM3560, dual LED Flash The LM3560 has two 1A
constant current driver for high current white LEDs.

It is controlled via an I2C compatible interface(up to 400kHz).

Each flash brightness, torch  brightness and enable/disable can be
controlled independantly, but flash timeout and operation mode are shared.

Signed-off-by: Daniel Jeong <gshark.jeong@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] media: soc_camera: rcar_vin: Add support for 10-bit YUV cameras
Phil Edworthy [Tue, 25 Feb 2014 09:10:27 +0000 (06:10 -0300)]
upstream: [media] media: soc_camera: rcar_vin: Add support for 10-bit YUV cameras

Add support for MBUS YUV10 BT656 and BT601 formats at rcar driver.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] vivi: fix ENUM_FRAMEINTERVALS implementation
Hans Verkuil [Tue, 25 Feb 2014 10:15:54 +0000 (07:15 -0300)]
upstream: [media] vivi: fix ENUM_FRAMEINTERVALS implementation

This function never checked if width and height are correct. Add such
a check so the v4l2-compliance tool returns OK again for vivi.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] vivi: correctly cleanup after a start_streaming failure
Hans Verkuil [Fri, 21 Feb 2014 08:34:49 +0000 (05:34 -0300)]
upstream: [media] vivi: correctly cleanup after a start_streaming failure

If start_streaming fails then any queued buffers must be given back
to the vb2 core.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] vivi: fix sequence counting
Hans Verkuil [Mon, 10 Feb 2014 11:08:45 +0000 (08:08 -0300)]
upstream: [media] vivi: fix sequence counting

The sequence counting was not reset to 0 between each streaming run,
and it was increased only every other frame. This is incorrect behavior:
the confusion is with FIELD_ALTERNATE systems where each field is transmitted
separately and only when both fields have been received is the frame
sequence number increased.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] vb2: only call start_streaming if sufficient buffers are queued
Hans Verkuil [Mon, 24 Feb 2014 16:51:03 +0000 (13:51 -0300)]
upstream: [media] vb2: only call start_streaming if sufficient buffers are queued

In commit 02f142ecd24aaf891324ffba8527284c1731b561 support was added to
start_streaming to return -ENOBUFS if insufficient buffers were queued
for the DMA engine to start. The vb2 core would attempt calling
start_streaming again if another buffer would be queued up.

Later analysis uncovered problems with the queue management if start_streaming
would return an error: the buffers are enqueued to the driver before the
start_streaming op is called, so after an error they are never returned to
the vb2 core. The solution for this is to let the driver return them to
the vb2 core in case of an error while starting the DMA engine. However,
in the case of -ENOBUFS that would be weird: it is not a real error, it
just says that more buffers are needed. Requiring start_streaming to give
them back only to have them requeued again the next time the application
calls QBUF is inefficient.

This patch changes this mechanism: it adds a 'min_buffers_needed' field
to vb2_queue that drivers can set with the minimum number of buffers
required to start the DMA engine. The start_streaming op is only called
if enough buffers are queued. The -ENOBUFS handling has been dropped in
favor of this new method.

Drivers are expected to return buffers back to vb2 core with state QUEUED
if start_streaming would return an error. The vb2 core checks for this
and produces a warning if that didn't happen and it will forcefully
reclaim such buffers to ensure that the internal vb2 core state remains
consistent and all buffer-related resources have been correctly freed
and all op calls have been balanced.

__reqbufs() has been updated to check that at least min_buffers_needed
buffers could be allocated. If fewer buffers were allocated then __reqbufs
will free what was allocated and return -ENOMEM. Based on a suggestion from
Pawel Osciak.

__create_bufs() doesn't do that check, since the use of __create_bufs
assumes some advance scenario where the user might want more control.
Instead streamon will check if enough buffers were allocated to prevent
streaming with fewer than the minimum required number of buffers.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] v4l: Copy timestamp source flags to destination on m2m devices
Sakari Ailus [Sat, 8 Feb 2014 17:21:35 +0000 (14:21 -0300)]
upstream: [media] v4l: Copy timestamp source flags to destination on m2m devices

Copy the flags containing the timestamp source from source buffer flags to
the destination buffer flags on memory-to-memory devices. This is analogous
to copying the timestamp field from source to destination.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] exynos-gsc, m2m-deinterlace, mx2_emmaprp: Copy v4l2_buffer data...
Sakari Ailus [Sat, 8 Feb 2014 16:37:59 +0000 (13:37 -0300)]
upstream: [media] exynos-gsc, m2m-deinterlace, mx2_emmaprp: Copy v4l2_buffer data from src to dst

The timestamp and timecode fields were copied from destination to source,
not the other way around as they should. Fix it.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] uvcvideo: Tell the user space we're using start-of-exposure timestamps
Sakari Ailus [Mon, 10 Feb 2014 22:26:44 +0000 (19:26 -0300)]
upstream: [media] uvcvideo: Tell the user space we're using start-of-exposure timestamps

The UVC device provided timestamps are taken from the clock once the
exposure of the frame has begun, not when the reception of the frame would
have been finished as almost anywhere else. Show this to the user space by
using V4L2_BUF_FLAG_TSTAMP_SRC_SOE buffer flag.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] v4l: Add timestamp source flags, mask and document them
Sakari Ailus [Sun, 25 Aug 2013 20:57:03 +0000 (17:57 -0300)]
upstream: [media] v4l: Add timestamp source flags, mask and document them

Some devices do not produce timestamps that correspond to the end of the
frame. The user space should be informed on the matter. This patch achieves
that by adding buffer flags (and a mask) for timestamp sources since more
possible timestamping points are expected than just two.

A three-bit mask is defined (V4L2_BUF_FLAG_TSTAMP_SRC_MASK) and two of the
eight possible values is are defined V4L2_BUF_FLAG_TSTAMP_SRC_EOF for end of
frame (value zero) V4L2_BUF_FLAG_TSTAMP_SRC_SOE for start of exposure (next
value).

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Kamil Debski <k.debski@samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] v4l: Rename vb2_queue.timestamp_type as timestamp_flags
Sakari Ailus [Tue, 25 Feb 2014 22:12:19 +0000 (19:12 -0300)]
upstream: [media] v4l: Rename vb2_queue.timestamp_type as timestamp_flags

The timestamp_type field used to contain only the timestamp type. Soon it
will be used for timestamp source flags as well. Rename the field
accordingly.

[m.chehab@samsung.com: do the change also to drivers/staging/media and at s2255]
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Conflicts:
drivers/media/platform/mem2mem_testdev.c
drivers/media/platform/s5p-g2d/g2d.c
drivers/staging/media/msi3101/sdr-msi3101.c

10 years agoupstream: [media] rtl28xxu: silence error log about disabled rtl2832_sdr module
Antti Palosaari [Wed, 9 Apr 2014 21:08:37 +0000 (18:08 -0300)]
upstream: [media] rtl28xxu: silence error log about disabled rtl2832_sdr module

It printed a little bit too heavy looking error log "DVB: Unable to
find symbol rtl2832_sdr_attach()" when staging module was disabled.
Silence that error by introducing own version of dvb_attach() macro
without the error logging.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] rtl28xxu: do not hard depend on staging SDR module
Antti Palosaari [Wed, 9 Apr 2014 15:42:35 +0000 (12:42 -0300)]
upstream: [media] rtl28xxu: do not hard depend on staging SDR module

RTL2832 SDR extension module is currently on staging. SDR module
headers were included from staging causing direct dependency staging
directory. As a solution, add needed headers to main driver.
Motivation of that change comes from Luis / driver backports project.

Reported-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Cc: backports@vger.kernel.org
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] rtl28xxu: remove duplicate ID 0458:707f Genius TVGo DVB-T03
Antti Palosaari [Wed, 26 Mar 2014 22:20:30 +0000 (19:20 -0300)]
upstream: [media] rtl28xxu: remove duplicate ID 0458:707f Genius TVGo DVB-T03

That ID was added twice mistakenly.
1st commit ac298ccdde4fe9b0a966e548a232ff4e8a6b8a31
2nd commit 1c1b8734094551eb4075cf68cf76892498c0da61

Revert commit 1c1b8734094551eb4075cf68cf76892498c0da61

Reported-by: Jan Vcelak <jv@fcelda.cz>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] af9033: Don't export functions for the hardware filter
Mauro Carvalho Chehab [Fri, 14 Mar 2014 17:29:06 +0000 (14:29 -0300)]
upstream: [media] af9033: Don't export functions for the hardware filter

Exporting functions for hardware filter is a bad idea, as it
breaks compilation if:
CONFIG_DVB_USB_AF9035=y
CONFIG_DVB_AF9033=m

Because the PID filter function calls would be hardcoded at
af9035.

The same doesn't happen with af9033_attach() because the
dvb_attach() doesn't hardcode it. Instead, it dynamically
links it at runtime.

However, calling dvb_attach() multiple times is problematic,
as it increments module kref.

So, the better is to pass one parameter for the af9033 module
to fill the hardware filters, and then use it inside af9035.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] af9035: use af9033 PID filters
Antti Palosaari [Thu, 13 Feb 2014 18:53:05 +0000 (15:53 -0300)]
upstream: [media] af9035: use af9033 PID filters

PID filters are property of af9033 demod. Use PID filters from af9033
driver as it provides those now.

Allow possible dual mode on USB 1.1 mode too as bandwidth could be
just enough when filters are used on both frontends.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] rtl28xxu: use muxed RTL2832 I2C adapters for E4000 and RTL2832_SDR
Antti Palosaari [Sat, 8 Feb 2014 07:03:57 +0000 (04:03 -0300)]
upstream: [media] rtl28xxu: use muxed RTL2832 I2C adapters for E4000 and RTL2832_SDR

RTL2832 driver provides muxed I2C adapters for tuner bus I2C gate
control. Pass those adapters to rtl2832_sdr and e4000 modules in order
to get rid of proprietary DVB .i2c_gate_ctrl() callback use.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] rtl28xxu: fix switch-case style issue
Antti Palosaari [Tue, 4 Feb 2014 02:07:21 +0000 (23:07 -0300)]
upstream: [media] rtl28xxu: fix switch-case style issue

Use break, not return, for every case.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] rtl28xxu: attach SDR extension module
Antti Palosaari [Tue, 10 Sep 2013 03:13:57 +0000 (00:13 -0300)]
upstream: [media] rtl28xxu: attach SDR extension module

With that extension module it supports SDR.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] rtl28xxu: add USB ID for Genius TVGo DVB-T03
Jan Vcelak [Wed, 26 Feb 2014 00:30:45 +0000 (21:30 -0300)]
upstream: [media] rtl28xxu: add USB ID for Genius TVGo DVB-T03

0458:707f KYE Systems Corp. (Mouse Systems) TVGo DVB-T03 [RTL2832]

The USB dongle uses RTL2832U demodulator and FC0012 tuner.

Signed-off-by: Jan Vcelak <jv@fcelda.cz>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] rtl2832_sdr: do not use dynamic stack allocation
Antti Palosaari [Fri, 14 Mar 2014 19:20:40 +0000 (16:20 -0300)]
upstream: [media] rtl2832_sdr: do not use dynamic stack allocation

Do not use dynamic stack allocation.

>> drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c:181:1:
warning: 'rtl2832_sdr_wr' uses dynamic stack allocation [enabled by default]

Reported-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] rtl2832_sdr: clamp bandwidth to nearest legal value in automode
Antti Palosaari [Mon, 10 Mar 2014 17:28:45 +0000 (14:28 -0300)]
upstream: [media] rtl2832_sdr: clamp bandwidth to nearest legal value in automode

Clamp bandwidth to nearest legal value in automode in order to pass
v4l2-compliance test.

Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] rtl2832_sdr: fixing v4l2-compliance issues
Hans Verkuil [Wed, 5 Mar 2014 23:21:38 +0000 (20:21 -0300)]
upstream: [media] rtl2832_sdr: fixing v4l2-compliance issues

Fix rtl2832_sdr driver v4l2-compliance issues.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] rtl2832_sdr: expose e4000 controls to user
Antti Palosaari [Tue, 11 Feb 2014 01:15:01 +0000 (22:15 -0300)]
upstream: [media] rtl2832_sdr: expose e4000 controls to user

E4000 tuner driver provides now some controls. Expose those to
userland.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] rtl2832_sdr: Realtek RTL2832 SDR driver module
Antti Palosaari [Tue, 10 Sep 2013 03:07:56 +0000 (00:07 -0300)]
upstream: [media] rtl2832_sdr: Realtek RTL2832 SDR driver module

Implement SDR driver for Realtek RTL2832U chip as a DVB extension
module. SDR module is attached by DVB USB RTL28XXU driver as a DVB
SEC (satellite equipment controller) module. Abusing unused SEC here
has no harm as that is DVB-T only frontend.

SDR functionality is provided by RTL2832 DVB-T demodulator. I suspect
it is originally planned for DAB and FM, but it could be abused general
SDR, due to modern silicon tuners that has wide frequency range and a
lot of configurable parameters (filters, gains, ...).

http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/44461

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Conflicts:
drivers/staging/media/Makefile

10 years agoupstream: [media] DocBook: Software Defined Radio Interface
Antti Palosaari [Fri, 20 Dec 2013 04:50:38 +0000 (01:50 -0300)]
upstream: [media] DocBook: Software Defined Radio Interface

Document V4L2 SDR interface.

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] v4l: do not allow modulator ioctls for non-radio devices
Hans Verkuil [Fri, 20 Dec 2013 05:32:21 +0000 (02:32 -0300)]
upstream: [media] v4l: do not allow modulator ioctls for non-radio devices

Modulator ioctls could be enabled mistakenly for non-radio devices.
Currently those ioctls are only valid for radio. Fix it.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] v4l: enable some IOCTLs for SDR receiver
Antti Palosaari [Thu, 12 Dec 2013 16:44:14 +0000 (13:44 -0300)]
upstream: [media] v4l: enable some IOCTLs for SDR receiver

Enable stream format (FMT) IOCTLs for SDR use. These are used for negotiate
used data stream format.

Reorganise some some IOCTL selection logic.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] omap3isp: Fix warning caused by bad subdev events operations prototypes
Laurent Pinchart [Fri, 12 Oct 2012 14:20:10 +0000 (11:20 -0300)]
upstream: [media] omap3isp: Fix warning caused by bad subdev events operations prototypes

Remove the const keyword from the V4L2 subdev events operations to match
the V4L2 API.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
10 years agoupstream: [media] v4l: define own IOCTL ops for SDR FMT
Antti Palosaari [Sat, 14 Dec 2013 16:10:20 +0000 (13:10 -0300)]
upstream: [media] v4l: define own IOCTL ops for SDR FMT

Use own format ops for SDR data:
vidioc_enum_fmt_sdr_cap
vidioc_g_fmt_sdr_cap
vidioc_s_fmt_sdr_cap
vidioc_try_fmt_sdr_cap

Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: Kconfig: Remove useless "default N" lines
Paul Bolle [Tue, 11 Feb 2014 12:38:47 +0000 (13:38 +0100)]
upstream: Kconfig: Remove useless "default N" lines

A number of Kconfig entries default to (uppercase) "N". It was clearly
intended to use "default n". But since (lowercase) "n" is the default
anyway, these lines might as well be removed.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Conflicts:
drivers/misc/mic/Kconfig
drivers/staging/rtl8188eu/Kconfig
drivers/usb/host/Kconfig

10 years agoupstream: [media] media: rc: add sysfs scancode filtering interface
James Hogan [Fri, 17 Jan 2014 13:58:49 +0000 (10:58 -0300)]
upstream: [media] media: rc: add sysfs scancode filtering interface

Add and document a generic sysfs based scancode filtering interface for
making use of IR data matching hardware to filter out uninteresting
scancodes. Two filters exist, one for normal operation and one for
filtering scancodes which are permitted to wake the system from suspend.

The following files are added to /sys/class/rc/rc?/:
 - filter: normal scancode filter value
 - filter_mask: normal scancode filter mask
 - wakeup_filter: wakeup scancode filter value
 - wakeup_filter_mask: wakeup scancode filter mask

A new s_filter() driver callback is added which must arrange for the
specified filter to be applied at the right time. Drivers can convert
the scancode filter into a raw IR data filter, which can be applied
immediately or later (for wake up filters).

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
Cc: linux-media@vger.kernel.org
Cc: Rob Landley <rob@landley.net>
Cc: linux-doc@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Conflicts:
Documentation/ABI/testing/sysfs-class-rc

10 years agoupstream: [media] DocBook media: add revision entry for 3.15
Hans Verkuil [Mon, 3 Feb 2014 10:29:03 +0000 (07:29 -0300)]
upstream: [media] DocBook media: add revision entry for 3.15

[m.chehab@samsung.com: removed "Opening and Closing Devices" from the
 list of changes, as the patch with such change weren't applied]

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] usbtv: fix compiler error due to missing module.h
Hans Verkuil [Tue, 4 Feb 2014 09:00:52 +0000 (06:00 -0300)]
upstream: [media] usbtv: fix compiler error due to missing module.h

usbtv-video.c needs module.h. So move the module.h include from usbtv-core.c to usbtv.h,
that way both core.c and video.c have it.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] usbtv: split core and video implementation
Federico Simoncelli [Tue, 7 Jan 2014 22:13:21 +0000 (19:13 -0300)]
upstream: [media] usbtv: split core and video implementation

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Reviewed-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] v4l2-subdev: Allow 32-bit compat ioctls
Hans Verkuil [Mon, 10 Feb 2014 11:08:44 +0000 (08:08 -0300)]
upstream: [media] v4l2-subdev: Allow 32-bit compat ioctls

Add support for 32-bit ioctls with v4l-subdev device nodes.

Rather than keep adding new ioctls to the list in v4l2-compat-ioctl32.c, just check
if the ioctl is a non-private V4L2 ioctl and if so, call the conversion code.

We keep forgetting to add new ioctls, so this is a more robust solution.

In addition extend the subdev API with support for a compat32 function to
convert custom v4l-subdev ioctls.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Conflicts:
drivers/media/v4l2-core/v4l2-compat-ioctl32.c

10 years agoupstream: [media] v4l: Check pad arguments for [gs]_frame_interval
Sakari Ailus [Mon, 22 Apr 2013 13:24:51 +0000 (10:24 -0300)]
upstream: [media] v4l: Check pad arguments for [gs]_frame_interval

VIDIOC_SUBDEV_[GS]_FRAME_INTERVAL IOCTLs argument structs contain the pad
field but the validity check was missing. There should be no implications
security-wise from this since no driver currently uses the pad field in the
struct.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] vb2: if bytesused is 0, then fill with output buffer length
Hans Verkuil [Mon, 7 Apr 2014 11:57:48 +0000 (08:57 -0300)]
upstream: [media] vb2: if bytesused is 0, then fill with output buffer length

The application should really always fill in bytesused for output
buffers, unfortunately the vb2 framework never checked for that.

So for single planar formats replace a bytesused of 0 by the length
of the buffer, and for multiplanar format do the same if bytesused is
0 for ALL planes.

This seems to be what the user really intended if v4l2_buffer was
just memset to 0.

I'm afraid that just checking for this and returning an error would
break too many applications. Quite a few drivers never check for bytesused
at all and just use the buffer length instead.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] vb2: fix handling of data_offset and v4l2_plane.reserved[]
Hans Verkuil [Mon, 7 Apr 2014 11:44:56 +0000 (08:44 -0300)]
upstream: [media] vb2: fix handling of data_offset and v4l2_plane.reserved[]

The videobuf2-core did not zero the 'planes' array in __qbuf_userptr()
and __qbuf_dmabuf(). That's now memset to 0. Without this the reserved
array in struct v4l2_plane would be non-zero, causing v4l2-compliance
errors.

More serious is the fact that data_offset was not handled correctly:

- for capture devices it was never zeroed, which meant that it was
  uninitialized. Unless the driver sets it it was a completely random
  number. With the memset above this is now fixed.

- __qbuf_dmabuf had a completely incorrect length check that included
  data_offset.

- in __fill_vb2_buffer in the DMABUF case the data_offset field was
  unconditionally copied from v4l2_buffer to v4l2_plane when this
  should only happen in the output case.

- in the single-planar case data_offset was never correctly set to 0.
  The single-planar API doesn't support data_offset, so setting it
  to 0 is the right thing to do. This too is now solved by the memset.

All these issues were found with v4l2-compliance.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] v4l2-dv-timings.c: add the new 4K timings to the list
Hans Verkuil [Tue, 8 Apr 2014 08:01:52 +0000 (05:01 -0300)]
upstream: [media] v4l2-dv-timings.c: add the new 4K timings to the list

Add the new CEA-861-F and DMT 4K timings to the list of predefined
timings.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] v4l2-dv-timings: add module name, description, license
Hans Verkuil [Tue, 4 Mar 2014 07:51:50 +0000 (04:51 -0300)]
upstream: [media] v4l2-dv-timings: add module name, description, license

I completely forgot to add them when I made this module. Loading this module
without it will taint the kernel, which is not intended.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: stable@vger.kernel.org # for v3.12 and up
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] v4l: of: Support empty port nodes
Laurent Pinchart [Mon, 10 Mar 2014 23:15:12 +0000 (20:15 -0300)]
upstream: [media] v4l: of: Support empty port nodes

Empty port nodes are allowed but currently unsupported as the
v4l2_of_get_next_endpoint() function assumes that all port nodes have at
least an endpoint. Fix this.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] vb2: properly clean up PREPARED and QUEUED buffers
Hans Verkuil [Fri, 28 Feb 2014 15:49:18 +0000 (12:49 -0300)]
upstream: [media] vb2: properly clean up PREPARED and QUEUED buffers

If __reqbufs was called then existing buffers are freed. However, if that
happens without ever having started STREAMON, but if buffers have been queued,
then the buf_finish op is never called.

Add a call to __vb2_queue_cancel in __reqbufs so that these buffers are
cleaned up there as well.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] v4l: add new tuner types for SDR
Antti Palosaari [Wed, 11 Dec 2013 23:24:02 +0000 (20:24 -0300)]
upstream: [media] v4l: add new tuner types for SDR

Define tuner types V4L2_TUNER_ADC and V4L2_TUNER_RF for SDR usage.

ADC is used for setting sampling rate (sampling frequency) to SDR
device.

Another tuner type, named as V4L2_TUNER_RF, is possible RF tuner.
Is is used to down-convert RF frequency to range ADC could sample.
Having RF tuner is optional, whilst in practice it is almost always
there.

Also add checks to VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY and
VIDIOC_ENUM_FREQ_BANDS only allow these two tuner types when device
type is SDR (VFL_TYPE_SDR). For VIDIOC_G_FREQUENCY we do not check
tuner type, instead override type with V4L2_TUNER_ADC in every
case (requested by Hans in order to keep functionality in line with
existing tuners and existing API does not specify it).

Prohibit VIDIOC_S_HW_FREQ_SEEK explicitly when device type is SDR,
as device cannot do hardware seek without a hardware demodulator.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] v4l: add device type for Software Defined Radio
Antti Palosaari [Wed, 11 Dec 2013 23:03:07 +0000 (20:03 -0300)]
upstream: [media] v4l: add device type for Software Defined Radio

Add new V4L device type VFL_TYPE_SDR for Software Defined Radio.
It is registered as /dev/swradio0 (/dev/sdr0 was already reserved).

Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] v4l2-dv-timings: mention missing 'reduced blanking V2'
Hans Verkuil [Fri, 31 Jan 2014 13:32:16 +0000 (10:32 -0300)]
upstream: [media] v4l2-dv-timings: mention missing 'reduced blanking V2'

The VESA standard added a version 2 of the reduced blanking formula.
Note in the comment that this is not yet supported by the v4l2_detect_cvt
function. Obviously this should be implemented eventually, but for now add
this as a reminder.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] v4l2-dv-timings: fix GTF calculation
Martin Bugge [Thu, 23 Jan 2014 09:40:00 +0000 (06:40 -0300)]
upstream: [media] v4l2-dv-timings: fix GTF calculation

Round off image width to nearest 8 (GTF_CELL_GRAN)

A source sending a GTF (Generalized Timing Formula) format have no means of
signalling image width. The assumed aspect ratio may result in an odd image
width but according to the standard image width should be in multiple of 8.

Cc: Mats Randgaard <matrandg@cisco.com>
Signed-off-by: Martin Bugge <marbugge@cisco.com>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] Revert "[media] videobuf_vm_{open,close} race fixes"
Hans Verkuil [Fri, 3 Jan 2014 11:10:49 +0000 (08:10 -0300)]
upstream: [media] Revert "[media] videobuf_vm_{open,close} race fixes"

This reverts commit a242f426108c284049a69710f871cc9f11b13e61.

That commit actually caused deadlocks, rather then fixing them.

If ext_lock is set to NULL (otherwise videobuf_queue_lock doesn't do
anything), then you get this deadlock:

The driver's mmap function calls videobuf_mmap_mapper which calls
videobuf_queue_lock on q. videobuf_mmap_mapper calls  __videobuf_mmap_mapper,
__videobuf_mmap_mapper calls videobuf_vm_open and videobuf_vm_open
calls videobuf_queue_lock on q (introduced by above patch): deadlocked.

This affects drivers using dma-contig and dma-vmalloc. Only dma-sg is
not affected since it doesn't call videobuf_vm_open from __videobuf_mmap_mapper.

Most drivers these days have a non-NULL ext_lock. Those that still use
NULL there are all fairly obscure drivers, which is why this hasn't been
seen earlier.

Since everything worked perfectly fine for many years I prefer to just
revert this patch rather than trying to fix it. videobuf is quite fragile
and I rather not touch it too much. Work is (slowly) progressing to move
everything over to vb2 or at the very least use non-NULL ext_lock in
videobuf.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: <stable@vger.kernel.org> # for v3.11 and up
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Reported-by: Pete Eberlein <pete@sensoray.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] media: v4l2-dev: fix video device index assignment
Marek Szyprowski [Tue, 3 Dec 2013 13:14:29 +0000 (10:14 -0300)]
upstream: [media] media: v4l2-dev: fix video device index assignment

The side effect of commit 1056e4388b045 ("v4l2-dev: Fix race condition on
__video_register_device") is the increased number of index value assigned
on video_device registration. Before that commit video_devices were
numbered from 0, after it, the indexes starts from 1, because get_index()
always count the device, which is being registered. Some device drivers
rely on video_device index number for internal purposes, i.e. s5p-mfc
driver stopped working after that patch. This patch restores the old method
of numbering the video_device indexes.

Cc: stable@vger.kernel.org # for v3.12
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Ricardo Ribalda <ricardo.ribalda@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: media: core: Don't use i2c_client->driver
Lars-Peter Clausen [Sun, 29 Sep 2013 08:51:01 +0000 (10:51 +0200)]
upstream: media: core: Don't use i2c_client->driver

The 'driver' field of the i2c_client struct is redundant and is going to be
removed. The results of the expressions 'client->driver.driver->field' and
'client->dev.driver->field' are identical, so replace all occurrences of the
former with the later.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
10 years agoupstream: [media] v4l2-dv-timings: add callback to handle exceptions
Hans Verkuil [Mon, 19 Aug 2013 14:21:50 +0000 (11:21 -0300)]
upstream: [media] v4l2-dv-timings: add callback to handle exceptions

In most cases the v4l2_bt_timings_cap struct has all the information
necessary to determine valid timings, but occasionally there are exceptions.
Add a callback function to be able to test for those exceptions.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] v4l2-dv-timings: rename v4l2_dv_valid_timings to v4l2_valid_dv_timings
Hans Verkuil [Mon, 19 Aug 2013 13:23:33 +0000 (10:23 -0300)]
upstream: [media] v4l2-dv-timings: rename v4l2_dv_valid_timings to v4l2_valid_dv_timings

All other functions follow the v4l2_<foo>_dv_timings pattern, do the same for
this function.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] v4l2-dv-timings: export the timings list
Hans Verkuil [Mon, 19 Aug 2013 13:19:54 +0000 (10:19 -0300)]
upstream: [media] v4l2-dv-timings: export the timings list

Some drivers need to be able to access the full list of timings.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] v4l2-dev: Fix race condition on __video_register_device
Ricardo Ribalda [Tue, 13 Aug 2013 14:04:06 +0000 (11:04 -0300)]
upstream: [media] v4l2-dev: Fix race condition on __video_register_device

When 2 devices are registered at the same time, in Part 2 both will get
the same minor number, making Part6 crash, because it cannot create a
create a device with a duplicated minor:
[    7.157648] ------------[ cut here ]------------
[    7.157666] WARNING: at fs/sysfs/dir.c:530 sysfs_add_one+0xbd/0xe0()
[    7.157669] sysfs: cannot create duplicate filename '/dev/char/81:1'
[    7.157672] Modules linked in: qtec_xform(+) qt5023_video(+) videobuf2_vmalloc videobuf2_dma_sg videobuf2_memops videobuf2_core gpio_xilinx(+) qtec_white qtec_cmosis(+) qtec_pcie qt5023
[    7.157694] CPU: 0 PID: 120 Comm: systemd-udevd Not tainted 3.10.0-qtec-standard #8
[    7.157698] Hardware name: QTechnology QT5022/QT5022, BIOS PM_2.1.0.309 X64 05/23/2013
[    7.157702]  0000000000000009 ffff8801788358e8 ffffffff8176c487 ffff880178835928
[    7.157707]  ffffffff8106f6f0 ffff880175759770 00000000ffffffef ffff880175759930
[    7.157712]  ffff8801788359e8 ffff880178bff000 ffff880175759930 ffff880178835988
[    7.157718] Call Trace:
[    7.157728]  [<ffffffff8176c487>] dump_stack+0x19/0x1b
[    7.157735]  [<ffffffff8106f6f0>] warn_slowpath_common+0x70/0xa0
[    7.157740]  [<ffffffff8106f7d6>] warn_slowpath_fmt+0x46/0x50
[    7.157746]  [<ffffffff81324b35>] ? strlcat+0x65/0x90
[    7.157750]  [<ffffffff811d516d>] sysfs_add_one+0xbd/0xe0
[    7.157755]  [<ffffffff811d5c6b>] sysfs_do_create_link_sd+0xdb/0x200
[    7.157760]  [<ffffffff811d5db1>] sysfs_create_link+0x21/0x40
[    7.157765]  [<ffffffff813e277b>] device_add+0x21b/0x6d0
[    7.157772]  [<ffffffff813f2985>] ? pm_runtime_init+0xe5/0xf0
[    7.157776]  [<ffffffff813e2c4e>] device_register+0x1e/0x30
[    7.157782]  [<ffffffff8153e8c3>] __video_register_device+0x313/0x610
[    7.157791]  [<ffffffffa00957c5>] qtec_xform_probe+0x465/0x7a4 [qtec_xform]
[    7.157797]  [<ffffffff813e7b13>] platform_drv_probe+0x43/0x80
[    7.157802]  [<ffffffff813e531a>] ? driver_sysfs_add+0x7a/0xb0
[    7.157807]  [<ffffffff813e584b>] driver_probe_device+0x8b/0x3a0
[    7.157812]  [<ffffffff813e5c0b>] __driver_attach+0xab/0xb0
[    7.157816]  [<ffffffff813e5b60>] ? driver_probe_device+0x3a0/0x3a0
[    7.157820]  [<ffffffff813e37fd>] bus_for_each_dev+0x5d/0xa0
[    7.157825]  [<ffffffff813e529e>] driver_attach+0x1e/0x20
[    7.157829]  [<ffffffff813e4d3e>] bus_add_driver+0x10e/0x280
[    7.157833]  [<ffffffffa0099000>] ? 0xffffffffa0098fff
[    7.157837]  [<ffffffffa0099000>] ? 0xffffffffa0098fff
[    7.157842]  [<ffffffff813e6317>] driver_register+0x77/0x170
[    7.157848]  [<ffffffff81151bcc>] ? __vunmap+0x9c/0x110
[    7.157852]  [<ffffffffa0099000>] ? 0xffffffffa0098fff
[    7.157857]  [<ffffffff813e7236>] platform_driver_register+0x46/0x50
[    7.157863]  [<ffffffffa0099010>] qtec_xform_plat_driver_init+0x10/0x12 [qtec_xform]
[    7.157869]  [<ffffffff810002ea>] do_one_initcall+0xea/0x1a0
[    7.157875]  [<ffffffff810cf1f1>] load_module+0x1a91/0x2630
[    7.157880]  [<ffffffff8133bee0>] ? ddebug_proc_show+0xe0/0xe0
[    7.157887]  [<ffffffff817760f2>] ? page_fault+0x22/0x30
[    7.157892]  [<ffffffff810cfe7a>] SyS_init_module+0xea/0x140
[    7.157898]  [<ffffffff8177e5b9>] tracesys+0xd0/0xd5
[    7.157902] ---[ end trace 660cc3a65a4bf01b ]---
[    7.157939] __video_register_device: device_register failed

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] v4l2-device: check if already unregistered
Hans Verkuil [Wed, 12 Jun 2013 09:04:04 +0000 (06:04 -0300)]
upstream: [media] v4l2-device: check if already unregistered

It was possible to unregister an already unregistered v4l2_device struct.
Add a check whether that already happened and just return if that was
the case.
Also refuse to register a v4l2_device if both the dev and name fields are
empty. A warning was already produced in that case, but since the name field
is now used to detect whether or not the v4l2_device was already unregistered
this particular combination should be rejected.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
10 years agoupstream: [media] videobuf_vm_{open,close} race fixes
Al Viro [Thu, 9 May 2013 18:03:33 +0000 (15:03 -0300)]
upstream: [media] videobuf_vm_{open,close} race fixes

just use videobuf_queue_lock(map->q) to protect map->count; vm_area_operations
->open() and ->close() are called just under vma->vm_mm->mmap_sem, which
doesn't help the drivers at all, since clonal VMAs are normally in different
address spaces...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
10 years agoupstream: [media] v4l: Helper function for obtaining timestamps
Sakari Ailus [Sat, 15 Sep 2012 10:51:47 +0000 (07:51 -0300)]
upstream: [media] v4l: Helper function for obtaining timestamps

v4l2_get_timestamp() produces a monotonic timestamp but unlike
ktime_get_ts(), it uses struct timeval instead of struct timespec, saving
the drivers the conversion job when getting timestamps for v4l2_buffer's
timestamp field.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
10 years agoupstream: [media] media: v4l2-ctrl: add a helper function to add standard control...
Lad, Prabhakar [Tue, 18 Sep 2012 18:54:38 +0000 (15:54 -0300)]
upstream: [media] media: v4l2-ctrl: add a helper function to add standard control with driver specific menu

Add helper function v4l2_ctrl_new_std_menu_items(), which adds
a standard menu control, with driver specific menu.

Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
10 years agoupstream: [media] v4l2: make vidioc_(un)subscribe_event const
Hans Verkuil [Tue, 4 Sep 2012 14:46:09 +0000 (11:46 -0300)]
upstream: [media] v4l2: make vidioc_(un)subscribe_event const

Write-only ioctls should have a const argument in the ioctl op.
Do this conversion for vidioc_(un)subscribe_event.
Adding const for write-only ioctls was decided during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
10 years agoupstream: [media] drxk_hard: Remove most 80-cols checkpatch warnings
Mauro Carvalho Chehab [Sun, 28 Apr 2013 14:47:51 +0000 (11:47 -0300)]
upstream: [media] drxk_hard: Remove most 80-cols checkpatch warnings

X-Patchwork-Delegate: mchehab@redhat.com
There are a few cases where breaking the code into separate
lines make it worse to read. However, on several places,
breaking it to make checkpatch.pl happier is OK and improves
code readability.
So, break longer lines where that won't cause harm.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Conflicts:
drivers/media/dvb-frontends/drxk_hard.c

10 years agoupstream: [media] si2168: add copyright and license
Antti Palosaari [Tue, 15 Apr 2014 00:55:12 +0000 (21:55 -0300)]
upstream: [media] si2168: add copyright and license

Add copyright and license for each file.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] si2168: add support for DVB-C (annex A version)
Antti Palosaari [Sat, 12 Apr 2014 04:58:32 +0000 (01:58 -0300)]
upstream: [media] si2168: add support for DVB-C (annex A version)

Add support for DVB-C (annex A version).

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] si2168: add support for DVB-T2
Antti Palosaari [Fri, 11 Apr 2014 23:35:27 +0000 (20:35 -0300)]
upstream: [media] si2168: add support for DVB-T2

Add support for DVB-T2.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] lgdt3305: include sleep functionality in lgdt3304_ops
Shuah Khan [Fri, 21 Mar 2014 02:05:50 +0000 (23:05 -0300)]
upstream: [media] lgdt3305: include sleep functionality in lgdt3304_ops

Add sleep ops to lgdt3304_ops to invoke lgdt3305_sleep() to be called
from dvb_frontend_suspend(). lgdt3305_soft_reset() is called for both
3304 and 3305 devices. soft_reset and sleep touch LGDT3305_GEN_CTRL_3
on 3304 and 3305 devices. Hence, adding sleep to lgdt3304_ops will help
suspend 3304 properly from dvb_frontend_suspend().

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx-j: use customise option correctly
Paul Bolle [Sat, 5 Apr 2014 15:20:02 +0000 (12:20 -0300)]
upstream: [media] drx-j: use customise option correctly

The Kconfig entry for "Micronas DRX-J demodulator" defaults to modular
if DVB_FE_CUSTOMISE is set. But that Kconfig symbol was replaced with
MEDIA_SUBDRV_AUTOSELECT as of v3.7. So use the new symbol. And negate
the logic, because MEDIA_SUBDRV_AUTOSELECT's logic is the opposite of
the former logic.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] af9033: implement PID filter
Antti Palosaari [Thu, 13 Feb 2014 18:40:59 +0000 (15:40 -0300)]
upstream: [media] af9033: implement PID filter

Implement PID filter and export it via symbol.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] m88ds3103: remove dead code
Antti Palosaari [Sat, 1 Feb 2014 14:57:50 +0000 (11:57 -0300)]
upstream: [media] m88ds3103: remove dead code

Coverity CID 1166050: Dead default in switch (DEADCODE)

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx39xyj: fix 64 bit division on 32 bit arch
Gianluca Gennari [Tue, 11 Mar 2014 13:41:47 +0000 (10:41 -0300)]
upstream: [media] drx39xyj: fix 64 bit division on 32 bit arch

Fix this linker warning:
WARNING: "__divdi3" [media_build/v4l/drx39xyj.ko] undefined!

[m.chehab@samsung.com: add include for asm/div64.h]
Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: drx-j: Fix post-BER calculus on QAM modulation
Mauro Carvalho Chehab [Tue, 11 Mar 2014 10:43:54 +0000 (07:43 -0300)]
upstream: drx-j: Fix post-BER calculus on QAM modulation

There are two troubles there:
1) the bit error measure were not accumulating;
2) it was missing the bit count.

Fix them.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: drx-j: use ber_count var
Mauro Carvalho Chehab [Tue, 11 Mar 2014 10:34:44 +0000 (07:34 -0300)]
upstream: drx-j: use ber_count var

drivers/media/dvb-frontends/drx39xyj/drxj.c: In function 'ctrl_get_qam_sig_quality':
drivers/media/dvb-frontends/drx39xyj/drxj.c:9468:6: warning: variable 'ber_cnt' set but not used [-Wunused-but-set-variable]
  u32 ber_cnt = 0; /* BER count */
      ^

By reading the comment, it is said that BER should be calculated as:
qam_pre_rs_ber = frac_times1e6( ber_cnt, rs_bit_cnt );

Also, it makes sense to take the mantissa into account, so fix the
code to do what's commented.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx-j: enable DVBv5 stats
Mauro Carvalho Chehab [Mon, 10 Mar 2014 11:22:34 +0000 (08:22 -0300)]
upstream: [media] drx-j: enable DVBv5 stats

Now that everything is set, let's enable DVBv5 stats, for
applications that support it.

DVBv3 apps will still work.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx-j: Fix detection of no signal
Mauro Carvalho Chehab [Mon, 10 Mar 2014 11:18:31 +0000 (08:18 -0300)]
upstream: [media] drx-j: Fix detection of no signal

When the signal is 7, it means that no signal was received.

Value experimentally measured.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx-j: properly handle bit counts on stats
Mauro Carvalho Chehab [Mon, 10 Mar 2014 11:08:53 +0000 (08:08 -0300)]
upstream: [media] drx-j: properly handle bit counts on stats

Instead of just assuming that the min resolution is 1E-6,
pass both bit error and bit counts for userspace to calculate
BER. The same applies for PER, for 8VSB. It is not clear how
to get the packet count for QAM. So, for now, don't expose PER
for QAM.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx-j: Prepare to use DVBv5 stats
Mauro Carvalho Chehab [Sun, 9 Mar 2014 20:46:01 +0000 (17:46 -0300)]
upstream: [media] drx-j: Prepare to use DVBv5 stats

Convert the stats internally to use DVBv5. For now, it will keep
showing everything via DVBv3 API only, as the .len value were
not initialized.

That allows testing if the new stats code didn't break anything.

A latter patch will add the final bits for the DVBv5 stats to
fully work.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx-j: re-add get_sig_strength()
Mauro Carvalho Chehab [Sun, 9 Mar 2014 20:37:27 +0000 (17:37 -0300)]
upstream: [media] drx-j: re-add get_sig_strength()

We'll need to use this function. Restore it from the
git history.

This function will be used on the next patch.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx-j: Don't use "state" for DVB lock state
Mauro Carvalho Chehab [Sun, 9 Mar 2014 20:30:48 +0000 (17:30 -0300)]
upstream: [media] drx-j: Don't use "state" for DVB lock state

State is already used on other places for the state struct.
Don't use it here, to avoid troubles with latter patches.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx-j: get rid of some unused vars
Mauro Carvalho Chehab [Sun, 9 Mar 2014 13:47:01 +0000 (10:47 -0300)]
upstream: [media] drx-j: get rid of some unused vars

As reported when compiled with W=1:

drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘ctrl_set_channel’:
drivers/media/dvb-frontends/drx39xyj/drxj.c:10340:26: warning: variable ‘common_attr’ set but not used [-Wunused-but-set-variable]
  struct drx_common_attr *common_attr = NULL;
                          ^
drivers/media/dvb-frontends/drx39xyj/drxj.c:10336:6: warning: variable ‘intermediate_freq’ set but not used [-Wunused-but-set-variable]
  s32 intermediate_freq = 0;

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx-j: propagate returned error from request_firmware()
Mauro Carvalho Chehab [Sun, 9 Mar 2014 13:36:24 +0000 (10:36 -0300)]
upstream: [media] drx-j: propagate returned error from request_firmware()

Fix a smatch warning:
drivers/media/dvb-frontends/drx39xyj/drxj.c:11711 drx_ctrl_u_code() info: why not propagate 'rc' from request_firmware() instead of (-2)?

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx-j: Fix usage of drxj_close()
Mauro Carvalho Chehab [Sun, 9 Mar 2014 13:33:54 +0000 (10:33 -0300)]
upstream: [media] drx-j: Fix usage of drxj_close()

This function is currently not used. However, it was meant to
be called at device release. So, add it there.

While here, remove the bad check, as reported by Dan, as
smatch warning:
drivers/media/dvb-frontends/drx39xyj/drxj.c:20041 drxj_close() warn: variable dereferenced before check 'demod' (see line 20036)

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx-j: remove external symbols
Mauro Carvalho Chehab [Sun, 9 Mar 2014 13:33:19 +0000 (10:33 -0300)]
upstream: [media] drx-j: remove external symbols

This driver doesn't export any external symbol, except for
the attach() method.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx-j: get rid of dead code
Mauro Carvalho Chehab [Sun, 9 Mar 2014 10:34:51 +0000 (07:34 -0300)]
upstream: [media] drx-j: get rid of dead code

There are large chunks of code at drx-j that aren't used. Most
of them are due to analog TV support. Well, just enabling them
won't make analog support work, as devices with DRX and analog
support requires an extra chip (avf4910).

We don't have drivers for it, nor the current device that uses
this frontend has support for analog TV.

So, let's just get rid of this code. If latter needed, this
patch can easily be reverted from git history.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx-j: don't use mc_info before checking if its not NULL
Mauro Carvalho Chehab [Sun, 9 Mar 2014 13:10:19 +0000 (10:10 -0300)]
upstream: [media] drx-j: don't use mc_info before checking if its not NULL

smatch warning:
drivers/media/dvb-frontends/drx39xyj/drxj.c:20803 drx_ctrl_u_code() warn: variable dereferenced before check 'mc_info' (see line 20800)

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx39xxj.h: Fix undefined reference to attach function
Mauro Carvalho Chehab [Sun, 9 Mar 2014 12:46:39 +0000 (09:46 -0300)]
upstream: [media] drx39xxj.h: Fix undefined reference to attach function

As reported by the kbuild test robot <fengguang.wu@intel.com>:

drivers/built-in.o: In function `em28xx_dvb_init':
    em28xx-dvb.c:(.text+0x876f2c): undefined reference to `drx39xxj_attach'

That happens when CONFIG_VIDEO_EM28XX_DVB is selected, and neither
CONFIG_MEDIA_SUBDRV_AUTOSELECT or DVB_DRX39XYJ is selected.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx-j: Fix dubious usage of "&" instead of "&&"
Mauro Carvalho Chehab [Sun, 9 Mar 2014 12:36:59 +0000 (09:36 -0300)]
upstream: [media] drx-j: Fix dubious usage of "&" instead of "&&"

Fixes the following warnings:
drivers/media/dvb-frontends/drx39xyj/drxj.c:16764:68: warning: dubious: x & !y
drivers/media/dvb-frontends/drx39xyj/drxj.c:16778:68: warning: dubious: x & !y
drivers/media/dvb-frontends/drx39xyj/drxj.c:16797:68: warning: dubious: x & !y

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx-j: Don't use 0 as NULL
Mauro Carvalho Chehab [Sun, 9 Mar 2014 12:32:58 +0000 (09:32 -0300)]
upstream: [media] drx-j: Don't use 0 as NULL

Fixes the following warnings:
drivers/media/dvb-frontends/drx39xyj/drxj.c:1679:65: warning: Using plain integer as NULL pointer
drivers/media/dvb-frontends/drx39xyj/drxj.c:1679:71: warning: Using plain integer as NULL pointer
drivers/media/dvb-frontends/drx39xyj/drxj.c:1681:52: warning: Using plain integer as NULL pointer
drivers/media/dvb-frontends/drx39xyj/drxj.c:1681:58: warning: Using plain integer as NULL pointer

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx-j: drxj_default_aud_data_g can be static
Fengguang Wu [Sun, 9 Mar 2014 12:08:30 +0000 (09:08 -0300)]
upstream: [media] drx-j: drxj_default_aud_data_g can be static

Fix sparse warning:
drivers/media/dvb-frontends/drx39xyj/drxj.c:1039:16: sparse: symbol 'drxj_default_aud_data_g' was not declared. Should it be static?

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
10 years agoupstream: [media] drx-j: set it to serial mode by default
Mauro Carvalho Chehab [Mon, 3 Mar 2014 09:13:17 +0000 (06:13 -0300)]
upstream: [media] drx-j: set it to serial mode by default

Currently, there's just one device using this frontend: PCTV 80e,
and it works on serial mode.

Change the default here to serial mode. If we add more devices,
then this option should be set via config structure.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>