]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
8 years ago[media] media: rc: move check whether a protocol is enabled to the core
Heiner Kallweit [Mon, 16 Nov 2015 19:52:50 +0000 (17:52 -0200)]
[media] media: rc: move check whether a protocol is enabled to the core

Checking whether a protocol is enabled and calling the related decoder
functions should be done by the rc core, not the protocol handlers.

Properly handle lirc considering that no protocol bit is set for lirc.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: rc: load decoder modules on-demand
Heiner Kallweit [Mon, 16 Nov 2015 19:52:26 +0000 (17:52 -0200)]
[media] media: rc: load decoder modules on-demand

Remove code for unconditional decoder module loading (except lirc).

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: rc: constify struct proto_names
Heiner Kallweit [Mon, 16 Nov 2015 19:52:17 +0000 (17:52 -0200)]
[media] media: rc: constify struct proto_names

Declare struct proto_names and its member name as const.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: rc: preparation for on-demand decoder module loading
Heiner Kallweit [Mon, 16 Nov 2015 19:52:08 +0000 (17:52 -0200)]
[media] media: rc: preparation for on-demand decoder module loading

Prepare on-demand decoder module loading by adding a module_name member
to struct proto_names and introducing the related load function.

After this patch of the series the decoder modules are still loaded
unconditionally.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: rc: fix decoder module unloading
Heiner Kallweit [Mon, 16 Nov 2015 19:51:56 +0000 (17:51 -0200)]
[media] media: rc: fix decoder module unloading

Currently, if a decoder module is unloadad, the respective protocol
is still shown as enabled (if it was enabled before).
Fix this by resetting the respective protocol bits if a decoder
module is unloaded.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] usbvision: fix crash on detecting device with invalid configuration
Vladis Dronov [Mon, 16 Nov 2015 17:55:11 +0000 (15:55 -0200)]
[media] usbvision: fix crash on detecting device with invalid configuration

The usbvision driver crashes when a specially crafted usb device with invalid
number of interfaces or endpoints is detected. This fix adds checks that the
device has proper configuration expected by the driver.

Reported-by: Ralf Spenneberg <ralf@spenneberg.net>
Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] Add support for dvb usb stick Hauppauge WinTV-soloHD
Arno Bauernöppel [Sun, 15 Nov 2015 21:24:10 +0000 (19:24 -0200)]
[media] Add support for dvb usb stick Hauppauge WinTV-soloHD

This patch adds support for the DVB-T/C/T2 usb stick WinTV-soloHD from
Hauppauge. It adds the usb ID 2040:0264 Hauppauge to the cards of the
driver em28xx.

I successfully tested DVB-T/C and the IR remote control with the
firmware dvb-demod-si2168-b40-01.fw.

Signed-off-by: Arno Bauernoeppel <arno@aziraphale.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] lirc_imon: do not leave imon_probe() with mutex held
Alexey Khoroshilov [Sat, 14 Nov 2015 18:17:56 +0000 (16:17 -0200)]
[media] lirc_imon: do not leave imon_probe() with mutex held

Commit af8a819a2513 ("[media] lirc_imon: simplify error handling code")
lost mutex_unlock(&context->ctx_lock), so imon_probe() exits with
the context->ctx_lock mutex acquired.

The patch adds mutex_unlock(&context->ctx_lock) back.

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

Fixes: af8a819a2513 ("[media] lirc_imon: simplify error handling code")
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] si2165: fix checkpatch issues
Matthias Schwarzott [Fri, 13 Nov 2015 22:54:56 +0000 (20:54 -0200)]
[media] si2165: fix checkpatch issues

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] cx231xx_dvb: use demod_i2c for demod attach
Matthias Schwarzott [Fri, 13 Nov 2015 22:54:55 +0000 (20:54 -0200)]
[media] cx231xx_dvb: use demod_i2c for demod attach

Tested:
* CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx
* CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx

Not Tested:
* CX231XX_BOARD_HAUPPAUGE_EXETER
* CX231XX_BOARD_HAUPPAUGE_955Q

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] ttusb-dec: constify ttusbdecfe_config structure
Julia Lawall [Fri, 13 Nov 2015 14:55:18 +0000 (12:55 -0200)]
[media] ttusb-dec: constify ttusbdecfe_config structure

The ttusbdecfe_config structure is never modified, so declare it
as const.

Other references to this structure type were already declared as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] drivers/media/usb/dvb-usb-v2: constify mxl111sf_demod_config structure
Julia Lawall [Fri, 13 Nov 2015 12:24:39 +0000 (10:24 -0200)]
[media] drivers/media/usb/dvb-usb-v2: constify mxl111sf_demod_config structure

The mxl111sf_demod_config structure is never modified, so declare it
as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] tv tuner max2165 driver: extend frequency range
Walter Cheuk [Fri, 13 Nov 2015 03:28:44 +0000 (01:28 -0200)]
[media] tv tuner max2165 driver: extend frequency range

Extend the frequency range to cover Hong Kong's digital TV broadcasting;
RTHK TV uses 802MHz and is not covered now. Tested on my TV tuner card
"MyGica X8558 Pro".

Signed-off-by: Walter Cheuk <wwycheuk@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: omap_vout: Don't free buffers if they haven't been allocated
Laurent Pinchart [Tue, 10 Nov 2015 10:20:19 +0000 (08:20 -0200)]
[media] v4l: omap_vout: Don't free buffers if they haven't been allocated

The VRFB buffers are freed when the device is closed even if they
haven't been allocated by a call to VIDIOC_REQBUFS, resulting in a
crash. Fix it by not trying to free buffers that are not allocated.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: omap4iss: Make module stop timeout print a warning message
Laurent Pinchart [Mon, 9 Nov 2015 22:01:56 +0000 (20:01 -0200)]
[media] media: omap4iss: Make module stop timeout print a warning message

Module stop timeouts are serious enough that they deserve a proper
warning message, not a debug message that will go unnoticed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: omap4iss: csi2: Fix IRQ handling when stopping module
Laurent Pinchart [Mon, 9 Nov 2015 22:01:57 +0000 (20:01 -0200)]
[media] media: omap4iss: csi2: Fix IRQ handling when stopping module

When stopping the CSI2 receiver the s_stream handler will wait for the
IRQ handler to notice the stop request. The receiver, automatically
disabled by the hardware after each frame, is then not reenabled by the
IRQ handler as it returns immediately.

As the IRQ handler check is performed before handling the context IRQ,
the context IRQ source isn't cleared, and the CSI2 IRQ is then fired
again immediately. The IRQ handler then fails to notice that the module
is being stopped, processes the IRQ normally and reenables the CSI2
hardware.

The problem goes unnoticed at stream stop time, but depending on the IRQ
and s_stream scheduling timings, the CSI2 receiver can end up being
hanged and will not produce any interrupt the next time it gets enabled,
despite being soft-reset then.

Fix this by checking for module stop after clearing the context IRQ
source.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] omap4iss: Fix overlapping luma/chroma planes
Nate Weibley [Mon, 9 Nov 2015 21:51:47 +0000 (19:51 -0200)]
[media] omap4iss: Fix overlapping luma/chroma planes

The chroma data base address for NV12 formatted data should begin offset
rows*bytes_per_row from the base address for luminance data. We were OBO
causing a stripe of green pixels at the bottom of the frame.

Signed-off-by: Nate Weibley <nweibley@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] uvcvideo: Enable UVC 1.5 device detection
Laurent Pinchart [Mon, 9 Nov 2015 17:33:58 +0000 (15:33 -0200)]
[media] uvcvideo: Enable UVC 1.5 device detection

UVC 1.5 devices report a bInterfaceProtocol value set to 1 in their
interface descriptors. The uvcvideo driver only matches on
bInterfaceProtocol 0, preventing those devices from being detected.

More changes to the driver are needed for full UVC 1.5 compatibility.
However, at least the UVC 1.5 Microsoft Surface Pro 3 cameras have been
reported to work out of the box with the driver with an updated match
table.

Enable UVC 1.5 support in the match table to support the devices that
can work with the current driver implementation. Devices that can't will
fail, but that's hardly a regression as they're currently not detected
at all anyway.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] c8sectpfe: Combine three checks into a single if block
Markus Elfring [Thu, 5 Nov 2015 18:23:50 +0000 (16:23 -0200)]
[media] c8sectpfe: Combine three checks into a single if block

The variable "tsin" was checked three times in a loop iteration of the
c8sectpfe_tuner_unregister_frontend() function.
This implementation detail could be improved by the combination of the
involved statements into a single if block so that this variable will be
checked only once there.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] c8sectpfe: Delete unnecessary checks before two function calls
Markus Elfring [Thu, 5 Nov 2015 17:55:19 +0000 (15:55 -0200)]
[media] c8sectpfe: Delete unnecessary checks before two function calls

The functions i2c_put_adapter() and module_put() test whether their
argument is NULL and then return immediately.
Thus the tests around their calls are not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: rc-core: simplify logging in rc_register_device
Heiner Kallweit [Thu, 29 Oct 2015 21:39:06 +0000 (19:39 -0200)]
[media] media: rc-core: simplify logging in rc_register_device

Simplify the logging.

I had some doubts about using the elvis operator as it's GNU extension.
However GNU extensions are explicitely allowed and this operator is
used at several places in the kernel code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: rc: nuvoton-cir: replace nvt_pr with dev_ functions
Heiner Kallweit [Thu, 29 Oct 2015 21:23:01 +0000 (19:23 -0200)]
[media] media: rc: nuvoton-cir: replace nvt_pr with dev_ functions

Replace nvt_pr with the respective dev_ functions thus slightly
simplifying the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: rc: nuvoton-cir: switch chip detection message to info level
Heiner Kallweit [Thu, 29 Oct 2015 21:23:22 +0000 (19:23 -0200)]
[media] media: rc: nuvoton-cir: switch chip detection message to info level

Switch the info about the detected chip type from debug to info level
as it might be useful not only for debugging purposes.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: rc: nuvoton-cir: simplify debug code
Heiner Kallweit [Thu, 29 Oct 2015 21:22:41 +0000 (19:22 -0200)]
[media] media: rc: nuvoton-cir: simplify debug code

Instead of explicitely checking debug use nvt_dbg like in other parts
of the driver thus simplifying the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: rc: nuvoton-cir: add support for the NCT6779D
Heiner Kallweit [Thu, 29 Oct 2015 21:22:23 +0000 (19:22 -0200)]
[media] media: rc: nuvoton-cir: add support for the NCT6779D

Add support for the NCT6779D. It's found e.g. on the Zotac CI321 mini-pc
and I successfully tested it on this device.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: rc: nuvoton-cir: make nvt_hw_detect void
Heiner Kallweit [Thu, 29 Oct 2015 21:22:00 +0000 (19:22 -0200)]
[media] media: rc: nuvoton-cir: make nvt_hw_detect void

nvt_hw_detect always returns 0, therefore make it return void.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: rc: nuvoton-cir: improve chip detection
Heiner Kallweit [Thu, 29 Oct 2015 21:21:38 +0000 (19:21 -0200)]
[media] media: rc: nuvoton-cir: improve chip detection

Make the chip detection code more similar to the one used for the
same chips in watchdog/w83627hf_wdt.c and hwmon/w83627ehf.c.

Apart from better maintainability we gain
- unified naming of chips (e.g. 677C -> NCT6776F)
- driver works with all revisions of the chips
  (least 4 bits of id are masked)

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: rc: nuvoton-cir: switch resource handling to devm functions
Heiner Kallweit [Thu, 29 Oct 2015 21:19:36 +0000 (19:19 -0200)]
[media] media: rc: nuvoton-cir: switch resource handling to devm functions

Switch to managed resource handling using the devm_ functions.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: rc: nuvoton-cir: remove unneeded lock
Heiner Kallweit [Thu, 29 Oct 2015 21:19:19 +0000 (19:19 -0200)]
[media] media: rc: nuvoton-cir: remove unneeded lock

chip_major / chip_minor are accessed sequentially in probe only.
Therefore no lock is needed.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: rc: nuvoton-cir: remove unneeded IRQ_RETVAL usage
Heiner Kallweit [Thu, 29 Oct 2015 21:18:45 +0000 (19:18 -0200)]
[media] media: rc: nuvoton-cir: remove unneeded IRQ_RETVAL usage

Using IRQ_RETVAL is unneeded here. IRQ_NONE / IRQ_HANDLED can be
returned directly.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: rc: ir-sharp-decoder: add support for Denon variant of the protocol
Heiner Kallweit [Thu, 29 Oct 2015 19:28:08 +0000 (17:28 -0200)]
[media] media: rc: ir-sharp-decoder: add support for Denon variant of the protocol

Denon also uses the Sharp protocol, however with different check bits.

It would have been also possible to add this as a separate protocol
but this may not be worth the effort.

Successfully tested with a Denon RC-1002 remote control.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] rc-core: Remove 'struct timeval' usage
Tina Ruchandani [Thu, 29 Oct 2015 07:16:57 +0000 (05:16 -0200)]
[media] rc-core: Remove 'struct timeval' usage

streamzap uses 'struct timeval' to store the start time of a signal for
gap tracking. struct timeval uses a 32-bit seconds representation which
will overflow in year 2038 and beyond. Replace struct timeval with ktime_t
which uses a 64-bit seconds representation and is 2038 safe. This patch
uses ktime_get_real() preserving the use of wall-clock time in the
original code.

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] em28xx: add Terratec Cinergy T XS (MT2060)
Alberto Mardegan [Tue, 27 Oct 2015 19:24:14 +0000 (17:24 -0200)]
[media] em28xx: add Terratec Cinergy T XS (MT2060)

The Terratec Cinergy T XS is a DVB-T receiver with no analog TV tuner.
This patch adds support for the cards carrying the mt2060 tuner; it's
unclear whether there are cards sold under the same name which use a
different tuner.
As long as there are no reports of such cards, and indeed as long as
there are no working drivers for them, we assume that the USB device
[0ccd:0043] is carrying the mt2060 tuner.

Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: xilinx-vipp: add missing of_node_put
Julia Lawall [Sun, 25 Oct 2015 13:57:04 +0000 (11:57 -0200)]
[media] v4l: xilinx-vipp: add missing of_node_put

for_each_child_of_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
@@

 for_each_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
(
   return child;
|
+  of_node_put(child);
?  return ...;
)
   ...
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: xilinx-tpg: add missing of_node_put
Julia Lawall [Sun, 25 Oct 2015 13:57:05 +0000 (11:57 -0200)]
[media] v4l: xilinx-tpg: add missing of_node_put

for_each_child_of_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
@@

 for_each_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
(
   return child;
|
+  of_node_put(child);
?  return ...;
)
   ...
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] as102: fix potential double free in as102_fw_upload()
Christian Engelmayer [Fri, 23 Oct 2015 21:26:18 +0000 (19:26 -0200)]
[media] as102: fix potential double free in as102_fw_upload()

In case the request to locate the firmware file part 2 fails, the error
path releases the already freed firmware memory location again. Thus
reset the firmware pointer to NULL after releasing firmware file part 1.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] rc: allow rc modules to be loaded if rc-main is not a module
Russell King [Thu, 15 Oct 2015 16:15:24 +0000 (13:15 -0300)]
[media] rc: allow rc modules to be loaded if rc-main is not a module

rc-main mistakenly uses #ifdef MODULE to determine whether it should
load the rc keymap modules.  This symbol is only defined if rc-main
is being built as a module itself, and bears no relation to whether
the rc keymaps are modules.

Fix this to use CONFIG_MODULES instead.

Fixes: 631493ecacd8 ("[media] rc-core: merge rc-map.c into rc-main.c")
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] si2157: return -EINVAL if firmware blob is too big
Laura Abbott [Mon, 5 Oct 2015 22:33:29 +0000 (19:33 -0300)]
[media] si2157: return -EINVAL if firmware blob is too big

A previous patch added a check if the firmware is too big, but it didn't
set the return error code with the right value.

[mchehab@osg.samsung.com: I ended by applying a v1 of Laura's patch, without
 the proper return code. This patch contains the difference between v2 and v1 of
 the Laura's "si2157: Bounds check firmware" patch]
Cc: stable@kernel.org
Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
Reviewed-by: Olli Salonen <olli.salonen@iki.fi>
Tested-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] staging: omap4iss: Compiling V4L2 framework and I2C as modules is fine
Sakari Ailus [Thu, 15 Oct 2015 23:21:13 +0000 (20:21 -0300)]
[media] staging: omap4iss: Compiling V4L2 framework and I2C as modules is fine

Don't require V4L2 framework and I2C being linked to the kernel directly.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] include/uapi/linux/dvb/video.h: remove stdint.h include
Mikko Rapeli [Thu, 15 Oct 2015 05:56:47 +0000 (02:56 -0300)]
[media] include/uapi/linux/dvb/video.h: remove stdint.h include

Kernel headers should use linux/types.h instead.

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] mxl111sf: missing return values validation
Insu Yun [Thu, 15 Oct 2015 20:22:45 +0000 (17:22 -0300)]
[media] mxl111sf: missing return values validation

Return values of mxl111sf_enable_usb_output and mxl1x1sf_top_master_ctrl
are not validated.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] rcar_vin: Remove obsolete platform data support
Geert Uytterhoeven [Wed, 7 Oct 2015 10:39:36 +0000 (07:39 -0300)]
[media] rcar_vin: Remove obsolete platform data support

Since commit 3d7608e4c169af03 ("ARM: shmobile: bockw: remove legacy
board file and config"), Renesas R-Car SoCs are only supported in
generic DT-only ARM multi-platform builds.  The driver doesn't need to
use platform data anymore, hence remove platform data configuration.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] move media platform data to linux/platform_data/media
Mauro Carvalho Chehab [Tue, 17 Nov 2015 09:11:13 +0000 (07:11 -0200)]
[media] move media platform data to linux/platform_data/media

Now that media has its own subdirectory inside platform_data,
let's move the headers that are already there to such subdir.

After moving those files, the references were adjusted using this
script:

    MAIN_DIR="linux/platform_data/"
    PREV_DIR="linux/platform_data/"
    DIRS="media/"

    echo "Checking affected files" >&2
    for i in $DIRS; do
for j in $(find include/$MAIN_DIR/$i -type f -name '*.h'); do
 n=`basename $j`
git grep -l $n
done
    done|sort|uniq >files && (
echo "Handling files..." >&2;
echo "for i in \$(cat files|grep -v Documentation); do cat \$i | \\";
(
cd include/$MAIN_DIR;
for j in $DIRS; do
for i in $(ls $j); do
echo "perl -ne 's,(include [\\\"\\<])$PREV_DIR($i)([\\\"\\>]),\1$MAIN_DIR$j\2\3,; print \$_' |\\";
done;
done;
echo "cat > a && mv a \$i; done";
);
echo "Handling documentation..." >&2;
echo "for i in MAINTAINERS \$(cat files); do cat \$i | \\";
(
cd include/$MAIN_DIR;
for j in $DIRS; do
for i in $(ls $j); do
echo "  perl -ne 's,include/$PREV_DIR($i)\b,include/$MAIN_DIR$j\1,; print \$_' |\\";
done;
done;
echo "cat > a && mv a \$i; done"
);
    ) >script && . ./script

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] V4L2: platform: rcar_jpu: switch off clock on release later
Mikhail Ulyanov [Thu, 1 Oct 2015 12:03:32 +0000 (09:03 -0300)]
[media] V4L2: platform: rcar_jpu: switch off clock on release later

Give JPU peripheral chance to finish current job.
Don't switch off clock until context release.

Signed-off-by: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] V4L2: platform: rcar_jpu: remove redundant code
Mikhail Ulyanov [Thu, 1 Oct 2015 12:03:31 +0000 (09:03 -0300)]
[media] V4L2: platform: rcar_jpu: remove redundant code

Remove redundant code. Following code line do what we want.

[mchehab@osg.samsung.com: fix conflict with VB2 split patches that renamed some structs]
Signed-off-by: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years agoDocBook: only copy stuff to media_api if media xml is generated
Mauro Carvalho Chehab [Thu, 19 Nov 2015 09:41:40 +0000 (07:41 -0200)]
DocBook: only copy stuff to media_api if media xml is generated

It is possible to use:
make DOCBOOKS=device-drivers.xml htmldocs

To produce just a few docbooks. In such case, the media docs
won't be built, causing the makefile target to return an error.

While this is ok for human eyes, if the above is used on an script,
it would cause troubles.

Fix it by only creating/filling the media_api directory if the
media_api.xml is found at DOCBOOKS.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] rc: gpio-ir-recv: add timeout on idle
Eric Nelson [Wed, 23 Sep 2015 14:07:08 +0000 (11:07 -0300)]
[media] rc: gpio-ir-recv: add timeout on idle

Many decoders require a trailing space (period without IR illumination)
to be delivered before completing a decode.

Since the gpio-ir-recv driver only delivers events on gpio transitions,
a single IR symbol (caused by a quick touch on an IR remote) will not
be properly decoded without the use of a timer to flush the tail end
state of the IR receiver.

This patch initializes and uses a timer and the timeout field of rcdev
to complete the stream and allow decode.

The timeout can be overridden through the use of the LIRC_SET_REC_TIMEOUT
ioctl.

Signed-off-by: Eric Nelson <eric@nelint.com>
Acked-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] rc-core: define a default timeout for drivers
Eric Nelson [Sat, 3 Oct 2015 15:18:50 +0000 (08:18 -0700)]
[media] rc-core: define a default timeout for drivers

A default timeout value of 125 ms should work for all decoders.

Declare a constant to help standardize its' use.

Signed-off-by: Eric Nelson <eric@nelint.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: st-rc: remove misuse of IRQF_NO_SUSPEND flag
Sudeep Holla [Mon, 21 Sep 2015 15:47:10 +0000 (12:47 -0300)]
[media] media: st-rc: remove misuse of IRQF_NO_SUSPEND flag

The device is set as wakeup capable using proper wakeup API but the
driver misuses IRQF_NO_SUSPEND to set the interrupt as wakeup source
which is incorrect.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with
enable_irq_wake instead.

Cc: Srinivas Kandagatla <srinivas.kandagatla@gmail.com>
Cc: Maxime Coquelin <maxime.coquelin@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: kernel@stlinux.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] s5c73m3-spi: fix compilation breakage when compiled as Module
Mauro Carvalho Chehab [Wed, 18 Nov 2015 18:46:33 +0000 (16:46 -0200)]
[media] s5c73m3-spi: fix compilation breakage when compiled as Module

commit f934a94bb566a629b7e0be52d087a686145d1f14 ('s5c73m3: Export OF
module alias information') broke compilation when compiled as module:

In file included from drivers/media/i2c/s5c73m3/s5c73m3-spi.c:22:0:
drivers/media/i2c/s5c73m3/s5c73m3-spi.c:40:40: error: expected ')' before ';' token
 MODULE_DEVICE_TABLE(of, s5c73m3_spi_ids;);
                                        ^

Fix it by removing the extra ';'

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] c8sectpfe: Update DT binding doc with some minor fixes
Peter Griffin [Thu, 3 Sep 2015 17:59:53 +0000 (14:59 -0300)]
[media] c8sectpfe: Update DT binding doc with some minor fixes

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] c8sectpfe: Update binding to reset-gpios
Peter Griffin [Thu, 3 Sep 2015 17:59:52 +0000 (14:59 -0300)]
[media] c8sectpfe: Update binding to reset-gpios

reset-gpios is more clear than rst-gpio.

This change has been done as one atomic commit but it
does breaks compatability with older dtbs.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] ARM: DT: STi: STiH407: Add c8sectpfe LinuxDVB DT node
Peter Griffin [Thu, 3 Sep 2015 17:59:50 +0000 (14:59 -0300)]
[media] ARM: DT: STi: STiH407: Add c8sectpfe LinuxDVB DT node

This patch adds in the required DT node for the c8sectpfe
Linux DVB demux driver which allows the tsin channels
to be used on an upstream kernel.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] ARM: DT: STi: stihxxx-b2120: Add pulse-width properties to ssc2 & ssc3
Peter Griffin [Thu, 3 Sep 2015 17:59:49 +0000 (14:59 -0300)]
[media] ARM: DT: STi: stihxxx-b2120: Add pulse-width properties to ssc2 & ssc3

Adding these properties makes the I2C bus to the demodulators much
more reliable, and we no longer suffer from I2C errors when tuning.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: dvb-core: Don't force CAN_INVERSION_AUTO in oneshot mode
Malcolm Priestley [Mon, 31 Aug 2015 09:13:45 +0000 (06:13 -0300)]
[media] media: dvb-core: Don't force CAN_INVERSION_AUTO in oneshot mode

When in FE_TUNE_MODE_ONESHOT the frontend must report
the actual capabilities so user can take appropriate
action.

With frontends that can't do auto inversion this is done
by dvb-core automatically so CAN_INVERSION_AUTO is valid.

However, when in FE_TUNE_MODE_ONESHOT this is not true.

So only set FE_CAN_INVERSION_AUTO in modes other than
FE_TUNE_MODE_ONESHOT

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] s5c73m3: Export OF module alias information
Javier Martinez Canillas [Thu, 20 Aug 2015 07:07:21 +0000 (04:07 -0300)]
[media] s5c73m3: Export OF module alias information

The SPI core always reports the MODALIAS uevent as "spi:<modalias>"
regardless of the mechanism that was used to register the device
(i.e: OF or board code) and the table that is used later to match
the driver with the device (i.e: SPI id table or OF match table).

So drivers needs to export the SPI id table and this be built into
the module or udev won't have the necessary information to autoload
the needed driver module when the device is added.

But this means that OF-only drivers needs to have both OF and SPI id
tables that have to be kept in sync and also the dev node compatible
manufacturer prefix is stripped when reporting the MODALIAS. Which can
lead to issues if two vendors use the same SPI device name for example.

To avoid the above, the SPI core behavior may be changed in the future
to not require an SPI device table for OF-only drivers and report the
OF module alias. So, it's better to also export the OF table even when
is unused now to prevent breaking module loading when the core changes.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] ddbridge: fix wait_event_timeout return handling
Nicholas Mc Guire [Wed, 10 Jun 2015 07:40:02 +0000 (04:40 -0300)]
[media] ddbridge: fix wait_event_timeout return handling

API conformance testing for completions with coccinelle spatches are being
used to locate API usage inconsistencies:
./drivers/media/pci/ddbridge/ddbridge-core.c:89
        incorrect check for negative return

Return type of wait_event_timeout is signed long not int and the
return type is >=0 always thus the negative check is unnecessary..
As stat is used here exclusively its type is simply changed and the
negative return check dropped.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] i2c: constify v4l2_ctrl_ops structures
Julia Lawall [Fri, 13 Nov 2015 22:05:17 +0000 (20:05 -0200)]
[media] i2c: constify v4l2_ctrl_ops structures

These v4l2_ctrl_ops structures are never modified, like all the other
v4l2_ctrl_ops structures, so declare them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] atmel-isi: support RGB565 output when sensor output YUV formats
Josh Wu [Tue, 3 Nov 2015 05:45:12 +0000 (03:45 -0200)]
[media] atmel-isi: support RGB565 output when sensor output YUV formats

This patch enable Atmel ISI preview path to convert the YUV to RGB format.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
[g.liakhovetski@gmx.de: removed superfluous parentheses]
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] atmel-isi: setup YCC_SWAP correctly when using preview path
Josh Wu [Tue, 3 Nov 2015 05:45:11 +0000 (03:45 -0200)]
[media] atmel-isi: setup YCC_SWAP correctly when using preview path

The preview path only can convert UYVY format to RGB data.

To make preview path work correctly, we need to set up YCC_SWAP
according to sensor output and convert them to UYVY.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] atmel-isi: add code to setup correct resolution for preview path
Josh Wu [Tue, 3 Nov 2015 05:45:10 +0000 (03:45 -0200)]
[media] atmel-isi: add code to setup correct resolution for preview path

Not like codec path, preview path can do downsampling, so we should setup
a extra preview width, height for it.

This patch add preview resolution setup without down sampling. So currently
preview path will output same size as sensor output size.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] atmel-isi: prepare for the support of preview path
Josh Wu [Tue, 3 Nov 2015 05:45:09 +0000 (03:45 -0200)]
[media] atmel-isi: prepare for the support of preview path

Atmel ISI support a preview path which can output RGB data.

So this patch introduces a bool variable to choose which path is
enabled currently. And also we need setup corresponding path registers.

By default the preview path is disabled. We only use Codec path.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] atmel-isi: correct yuv swap according to different sensor outputs
Josh Wu [Tue, 3 Nov 2015 05:45:08 +0000 (03:45 -0200)]
[media] atmel-isi: correct yuv swap according to different sensor outputs

we need to configure the YCC_SWAP bits in ISI_CFG2 according to current
sensor output and Atmel ISI output format.

Current there are two cases Atmel ISI supported:
  1. Atmel ISI outputs YUYV format.
     This case we need to setup YCC_SWAP according to sensor output
     format.
  2. Atmel ISI output a pass-through formats, which means no swap.
     Just setup YCC_SWAP as default with no swap.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-clk: v4l2_clk_get() also need to find the of_fullname clock
Josh Wu [Wed, 28 Oct 2015 09:48:55 +0000 (07:48 -0200)]
[media] v4l2-clk: v4l2_clk_get() also need to find the of_fullname clock

The soc-camera host will be probed and register a v4l2_clk, but if at
that moment, the i2c device is not available, then the registered
v4l2_clk name is an OF string not a I2C string.

So when i2c sensor probes and calls v4l2_clk_get(), it only searches a
clock with I2C string, like "1-0030".

This patch will search the clock with OF string name if no clock with
I2C string name could be found.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-clk: add new definition: V4L2_CLK_NAME_SIZE
Josh Wu [Wed, 28 Oct 2015 09:48:54 +0000 (07:48 -0200)]
[media] v4l2-clk: add new definition: V4L2_CLK_NAME_SIZE

Make all v4l2-clk's clock name use V4L2_CLK_NAME_SIZE definition.

In future, if the string is increased we just need to change the
V4L2_CLK_NAME_SIZE once.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-clk: add new macro for v4l2_clk_name_of()
Josh Wu [Wed, 28 Oct 2015 09:48:53 +0000 (07:48 -0200)]
[media] v4l2-clk: add new macro for v4l2_clk_name_of()

This macro is used to generate an OF string for a v4l2 clock.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] soc_camera: get the clock name by using macro: v4l2_clk_name_i2c()
Josh Wu [Wed, 28 Oct 2015 09:48:52 +0000 (07:48 -0200)]
[media] soc_camera: get the clock name by using macro: v4l2_clk_name_i2c()

Since v4l2_clk_name_i2c() is defined, reuse it.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] vivid: add support for reduced frame rate in video capture
Prashant Laddha [Tue, 22 Sep 2015 14:27:31 +0000 (11:27 -0300)]
[media] vivid: add support for reduced frame rate in video capture

With this patch, vivid capture thread can now generate a video with
frame rate reduced by a factor of 1000 / 1001. This option can be
selected using a control Reduced Framerate from gui.

Signed-off-by: Prashant Laddha <prladdha@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] vivid-capture: add control for reduced frame rate
Prashant Laddha [Tue, 22 Sep 2015 14:27:30 +0000 (11:27 -0300)]
[media] vivid-capture: add control for reduced frame rate

A boolean control Reduced Framerate is added to vivid controls for
controlling the reduced fps option for vivid capture from gui.

Signed-off-by: Prashant Laddha <prladdha@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] vivid: add support for reduced fps in video out
Prashant Laddha [Tue, 22 Sep 2015 14:27:29 +0000 (11:27 -0300)]
[media] vivid: add support for reduced fps in video out

If reduced fps flag is set then check if other necessary conditions
are true for the given bt timing. If yes, then reduce the frame rate.
For vivid transmitter, timeperframe_vid_out controls the frame rate.
Adjusting the timeperframe_vid_out by scaling down pixel clock by
factor of 1000 / 1001.

Signed-off-by: Prashant Laddha <prladdha@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-dv-timings: add condition checks for reduced fps
Prashant Laddha [Tue, 22 Sep 2015 14:27:28 +0000 (11:27 -0300)]
[media] v4l2-dv-timings: add condition checks for reduced fps

Added a helper function to check necessary conditions required for
reduced fps. The reduced fps is supported for CVT and CEA861 timings.
CVT supports reduced fps only if reduced blanking v2 (indicated by
vsync = 8) is true. Whereas CEA861 supports reduced fps if
V4L2_DV_FL_CAN_REDUCE_FPS flag is true.

Signed-off-by: Prashant Laddha <prladdha@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-device: Don't unregister ACPI/Device Tree based devices
Tommi Franttila [Thu, 12 Nov 2015 09:01:07 +0000 (07:01 -0200)]
[media] v4l2-device: Don't unregister ACPI/Device Tree based devices

When a V4L2 sub-device backed by a DT or ACPI based device was removed,
the device was unregistered as well which certainly was not intentional,
as the client device would not be re-created by simply reinstating the
V4L2 sub-device (indeed the device would have to be there first!).

Skip unregistering the device in case it has non-NULL of_node or fwnode.

Signed-off-by: Tommi Franttila <tommi.franttila@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: adv7180: increase delay after reset to 5ms
Ulrich Hecht [Tue, 10 Nov 2015 13:39:00 +0000 (11:39 -0200)]
[media] media: adv7180: increase delay after reset to 5ms

Initialization of the ADV7180 chip fails on the Renesas R8A7790-based
Lager board about 50% of the time.  This patch resolves the issue by
increasing the minimum delay after reset from 2 ms to 5 ms, following the
recommendation in the ADV7180 datasheet:

"Executing a software reset takes approximately 2 ms. However, it is
recommended to wait 5 ms before any further I2C writes are performed."

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] usbvision fix overflow of interfaces array
Oliver Neukum [Tue, 27 Oct 2015 11:51:34 +0000 (09:51 -0200)]
[media] usbvision fix overflow of interfaces array

This fixes the crash reported in:
http://seclists.org/bugtraq/2015/Oct/35
The interface number needs a sanity check.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Cc: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] sh-vou: clarify videobuf2 dependency
Arnd Bergmann [Fri, 16 Oct 2015 00:35:40 +0000 (21:35 -0300)]
[media] sh-vou: clarify videobuf2 dependency

The sh-vou driver has been converted from videobuf to videobuf2, but
the Kconfig file still lists VIDEOBUF_DMA_CONTIG as a dependency.
Consequently we can build the driver without VIDEOBUF2_DMA_CONTIG
and get a link error:

drivers/built-in.o: In function `sh_vou_probe':
vf610-ocotp.c:(.text+0x2dbf5c): undefined reference to `vb2_dma_contig_init_ctx'
vf610-ocotp.c:(.text+0x2dc0b4): undefined reference to `vb2_dma_contig_cleanup_ctx'
vf610-ocotp.c:(.text+0x2dc144): undefined reference to `vb2_dma_contig_memops'
drivers/built-in.o: In function `sh_vou_remove':
vf610-ocotp.c:(.text+0x2dc190): undefined reference to `vb2_dma_contig_cleanup_ctx'

This changes the dependency to VIDEOBUF2_DMA_CONTIG instead.

Fixes: 57af3ad59d95 ("[media] sh-vou: convert to vb2")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: fix waitqueue_active without memory barrier in cpia2 driver
Kosuke Tatsukawa [Fri, 9 Oct 2015 00:35:40 +0000 (21:35 -0300)]
[media] media: fix waitqueue_active without memory barrier in cpia2 driver

cpia2_usb_disconnect() seems to be missing a memory barrier which might
cause the waker to not notice the waiter and miss sending a wake_up as
in the following figure.

cpia2_usb_disconnect sync
------------------------------------------------------------------------
mutex_unlock(&cam->v4l2_lock);
if (waitqueue_active(&cam->wq_stream))
/* The CPU might reorder the test for
   the waitqueue up here, before
   prior writes complete */
/* wait_event_interruptible */
 /* __wait_event_interruptible */
  /* ___wait_event */
  long __int = prepare_to_wait_event(
    &wq, &__wait, state);
  if (!cam->streaming ||
    frame->status == FRAME_READY)
cam->curbuff->status = FRAME_READY;
cam->curbuff->length = 0;
  schedule()
------------------------------------------------------------------------

The attached patch removes the call to waitqueue_active() leaving just
wake_up() behind.  This fixes the problem because the call to
spin_lock_irqsave() in wake_up() will be an ACQUIRE operation.

I found this issue when I was looking through the linux source code
for places calling waitqueue_active() before wake_up*(), but without
preceding memory barriers, after sending a patch to fix a similar
issue in drivers/tty/n_tty.c  (Details about the original issue can be
found here: https://lkml.org/lkml/2015/9/28/849).

Signed-off-by: Kosuke Tatsukawa <tatsu@ab.jp.nec.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] gspca: ov534/topro: prevent a division by 0
Antonio Ospite [Fri, 2 Oct 2015 20:33:13 +0000 (17:33 -0300)]
[media] gspca: ov534/topro: prevent a division by 0

v4l2-compliance sends a zeroed struct v4l2_streamparm in
v4l2-test-formats.cpp::testParmType(), and this results in a division by
0 in some gspca subdrivers:

  divide error: 0000 [#1] SMP
  Modules linked in: gspca_ov534 gspca_main ...
  CPU: 0 PID: 17201 Comm: v4l2-compliance Not tainted 4.3.0-rc2-ao2 #1
  Hardware name: System manufacturer System Product Name/M2N-E SLI, BIOS
    ASUS M2N-E SLI ACPI BIOS Revision 1301 09/16/2010
  task: ffff8800818306c0 ti: ffff880095c4c000 task.ti: ffff880095c4c000
  RIP: 0010:[<ffffffffa079bd62>]  [<ffffffffa079bd62>] sd_set_streamparm+0x12/0x60 [gspca_ov534]
  RSP: 0018:ffff880095c4fce8  EFLAGS: 00010296
  RAX: 0000000000000000 RBX: ffff8800c9522000 RCX: ffffffffa077a140
  RDX: 0000000000000000 RSI: ffff880095e0c100 RDI: ffff8800c9522000
  RBP: ffff880095e0c100 R08: ffffffffa077a100 R09: 00000000000000cc
  R10: ffff880067ec7740 R11: 0000000000000016 R12: ffffffffa07bb400
  R13: 0000000000000000 R14: ffff880081b6a800 R15: 0000000000000000
  FS:  00007fda0de78740(0000) GS:ffff88012fc00000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 00000000014630f8 CR3: 00000000cf349000 CR4: 00000000000006f0
  Stack:
   ffffffffa07a6431 ffff8800c9522000 ffffffffa077656e 00000000c0cc5616
   ffff8800c9522000 ffffffffa07a5e20 ffff880095e0c100 0000000000000000
   ffff880067ec7740 ffffffffa077a140 ffff880067ec7740 0000000000000016
  Call Trace:
   [<ffffffffa07a6431>] ? v4l_s_parm+0x21/0x50 [videodev]
   [<ffffffffa077656e>] ? vidioc_s_parm+0x4e/0x60 [gspca_main]
   [<ffffffffa07a5e20>] ? __video_do_ioctl+0x280/0x2f0 [videodev]
   [<ffffffffa07a5ba0>] ? video_ioctl2+0x20/0x20 [videodev]
   [<ffffffffa07a59b9>] ? video_usercopy+0x319/0x4e0 [videodev]
   [<ffffffff81182dc1>] ? page_add_new_anon_rmap+0x71/0xa0
   [<ffffffff811afb92>] ? mem_cgroup_commit_charge+0x52/0x90
   [<ffffffff81179b18>] ? handle_mm_fault+0xc18/0x1680
   [<ffffffffa07a15cc>] ? v4l2_ioctl+0xac/0xd0 [videodev]
   [<ffffffff811c846f>] ? do_vfs_ioctl+0x28f/0x480
   [<ffffffff811c86d4>] ? SyS_ioctl+0x74/0x80
   [<ffffffff8154a8b6>] ? entry_SYSCALL_64_fastpath+0x16/0x75
  Code: c7 93 d9 79 a0 5b 5d e9 f1 f3 9a e0 0f 1f 00 66 2e 0f 1f 84 00
    00 00 00 00 66 66 66 66 90 53 31 d2 48 89 fb 48 83 ec 08 8b 46 10 <f7>
    76 0c 80 bf ac 0c 00 00 00 88 87 4e 0e 00 00 74 09 80 bf 4f
  RIP  [<ffffffffa079bd62>] sd_set_streamparm+0x12/0x60 [gspca_ov534]
   RSP <ffff880095c4fce8>
  ---[ end trace 279710c2c6c72080 ]---

Following what the doc says about a zeroed timeperframe (see
http://www.linuxtv.org/downloads/v4l-dvb-apis/vidioc-g-parm.html):

  ...
  To reset manually applications can just set this field to zero.

fix the issue by resetting the frame rate to a default value in case of
an unusable timeperframe.

The fix is done in the subdrivers instead of gspca.c because only the
subdrivers have notion of a default frame rate to reset the camera to.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Cc: stable@vger.kernel.org
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] cx231xx: fix bulk transfer mode
Terry Heo [Tue, 22 Sep 2015 08:18:05 +0000 (05:18 -0300)]
[media] cx231xx: fix bulk transfer mode

The current cx231xx driver doesn't work with bulk transfer mode.
This patch makes it possible to use bulk transfer mode.

Signed-off-by: Terry Heo <terryheo@google.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] radio-shark2: constify radio_tea5777_ops structures
Julia Lawall [Fri, 13 Nov 2015 11:38:32 +0000 (09:38 -0200)]
[media] radio-shark2: constify radio_tea5777_ops structures

The radio_tea5777_ops structure is never modified, so declare it as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: videobuf2: fix compare_const_fl.cocci warnings
Julia Lawall [Fri, 13 Nov 2015 10:46:00 +0000 (08:46 -0200)]
[media] media: videobuf2: fix compare_const_fl.cocci warnings

Move constants to the right of binary operators.

Generated by: scripts/coccinelle/misc/compare_const_fl.cocci

CC: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] Docbook: media: Document changes on struct v4l2_ext_controls
Ricardo Ribalda [Thu, 29 Oct 2015 10:10:32 +0000 (08:10 -0200)]
[media] Docbook: media: Document changes on struct v4l2_ext_controls

Vidioc-g-ext-ctrls can now be used to get the default value of the
controls.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media/usb/pvrusb2: Support for V4L2_CTRL_WHICH_DEF_VAL
Ricardo Ribalda [Thu, 29 Oct 2015 10:10:31 +0000 (08:10 -0200)]
[media] media/usb/pvrusb2: Support for V4L2_CTRL_WHICH_DEF_VAL

This driver does not use the control infrastructure.
Add support for the new field which on structure
 v4l2_ext_controls

Acked-by: Mike Isely <isely@pobox.com>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] usb/uvc: Support for V4L2_CTRL_WHICH_DEF_VAL
Ricardo Ribalda [Thu, 29 Oct 2015 10:10:30 +0000 (08:10 -0200)]
[media] usb/uvc: Support for V4L2_CTRL_WHICH_DEF_VAL

This driver does not use the control infrastructure.
Add support for the new field which on structure
 v4l2_ext_controls

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media/v4l2-core: struct struct v4l2_ext_controls param which
Ricardo Ribalda [Thu, 29 Oct 2015 10:10:29 +0000 (08:10 -0200)]
[media] media/v4l2-core: struct struct v4l2_ext_controls param which

Support for new field which on v4l2_ext_controls, used to get the
default value of one or more controls.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media/core: Replace ctrl_class with which
Ricardo Ribalda [Thu, 29 Oct 2015 10:10:28 +0000 (08:10 -0200)]
[media] media/core: Replace ctrl_class with which

Replace the obsolete field ctrl_class with "which".

Make sure it not used in future modules by commenting out the field with
ifndef __KERNEL_ .

The field cannot be simply removed because that would be change on the
kenel API to the userspace (and we don't like that).

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] videodev2.h: Extend struct v4l2_ext_controls
Ricardo Ribalda [Thu, 29 Oct 2015 10:10:27 +0000 (08:10 -0200)]
[media] videodev2.h: Extend struct v4l2_ext_controls

So it can be used to get the default value of a control.

Without this change it is not possible to get the
default value of array controls.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] adv7511: fix incorrect bit offset
Hans Verkuil [Thu, 12 Nov 2015 15:30:39 +0000 (13:30 -0200)]
[media] adv7511: fix incorrect bit offset

The quantization bits are in bits 7-6, not 7-4, so shift by 6 instead of 4.

This bug is caused by a typo in the adv7511 datasheet.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-dv-timings: Compare horizontal blanking
Mats Randgaard [Thu, 12 Nov 2015 12:34:55 +0000 (10:34 -0200)]
[media] v4l2-dv-timings: Compare horizontal blanking

hsync and hbackporch must also be compared

Signed-off-by: Mats Randgaard <matrandg@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-core/v4l2-ctrls: Filter NOOP CH_RANGE events
Ricardo Ribalda [Wed, 11 Nov 2015 11:58:34 +0000 (09:58 -0200)]
[media] v4l2-core/v4l2-ctrls: Filter NOOP CH_RANGE events

If modify_range is called but no range is changed, do not send the
CH_RANGE event.

Reported-by: Dimitrios Katsaros <patcherwork@gmail.com>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] av7110: potential divide by zero
Dan Carpenter [Tue, 10 Nov 2015 22:23:53 +0000 (20:23 -0200)]
[media] av7110: potential divide by zero

"len" comes from dvb_video_ioctl() and there is a possibility that it is
zero.  We do a divide by len later in the function so that's not ok.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] av7110: don't allow negative volumes
Dan Carpenter [Tue, 10 Nov 2015 22:22:49 +0000 (20:22 -0200)]
[media] av7110: don't allow negative volumes

The issue here is that we there is a static checker warning because we
have a user controlled volume setting and we cap the upper bound but we
allow negative numbers.  Negative volumes don't make sense, so let's
make these variables unsigned.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] vb2: fix a regression in poll() behavior for output,streams
Hans Verkuil [Thu, 29 Oct 2015 05:02:06 +0000 (03:02 -0200)]
[media] vb2: fix a regression in poll() behavior for output,streams

In the 3.17 kernel the poll() behavior changed for output streams:
as long as not all buffers were queued up poll() would return that
userspace can write. This is fine for the write() call, but when
using stream I/O this changed the behavior since the expectation
was that it would wait for buffers to become available for dequeuing.

This patch only enables the check whether you can queue buffers
for file I/O only, and skips it for stream I/O.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: <stable@vger.kernel.org> # for v3.17 and up
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] vivid: fix compliance error
Hans Verkuil [Thu, 29 Oct 2015 04:59:37 +0000 (02:59 -0200)]
[media] vivid: fix compliance error

If vivid is loaded with the no_error_inj=1 option, then v4l2-compliance will
fail for the video and vbi output nodes because the vivid control class has no
controls.

Don't add the control class for video and vbi output if no_error_inj is true.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] go7007: fix broken test
Hans Verkuil [Thu, 22 Oct 2015 08:56:21 +0000 (06:56 -0200)]
[media] go7007: fix broken test

The wrong flags field was tested for the GO7007_BOARD_HAS_AUDIO flag: that
flag is in board->main_info.flags, not in board->flags.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] DocBook media: s/input stream/capture stream/
Hans Verkuil [Thu, 22 Oct 2015 08:46:53 +0000 (06:46 -0200)]
[media] DocBook media: s/input stream/capture stream/

The term "input stream" is confusing since it is not clear whether this is an
input stream from the point of view of the application or from the point of
view of the hardware. So replace it with the more standard term "capture stream".

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] staging: media: davinci_vpfe: fix ipipe_mode type
Andrzej Hajda [Mon, 21 Sep 2015 13:33:57 +0000 (10:33 -0300)]
[media] staging: media: davinci_vpfe: fix ipipe_mode type

The variable can take negative values.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2038576

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] staging: media: davinci_vpfe: Fix over 80 characters coding style issue
Junsu Shin [Mon, 10 Aug 2015 21:40:59 +0000 (18:40 -0300)]
[media] staging: media: davinci_vpfe: Fix over 80 characters coding style issue

This is a patch to the dm365_ipipe.c that fixes over 80 characters
warning detected.

Signed-off-by: Junsu Shin <jjunes0@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] staging/davinci/vpfe/dm365: add missing dependencies
Arnd Bergmann [Wed, 28 Jan 2015 21:17:43 +0000 (19:17 -0200)]
[media] staging/davinci/vpfe/dm365: add missing dependencies

This driver can only be built when VIDEO_V4L2_SUBDEV_API
and VIDEO_DAVINCI_VPBE_DISPLAY are also provided by the
kernel.

drivers/staging/media/davinci_vpfe/dm365_isif.c: In function '__isif_get_format':
drivers/staging/media/davinci_vpfe/dm365_isif.c:1410:3: error: implicit declaration of function 'v4l2_subdev_get_try_format' [-Werror=implicit-function-declaration]
   return v4l2_subdev_get_try_format(fh, pad);
   ^

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] staging: media: davinci_vpfe: drop condition with no effect
Nicholas Mc Guire [Mon, 26 Jan 2015 07:27:05 +0000 (05:27 -0200)]
[media] staging: media: davinci_vpfe: drop condition with no effect

As the if and else branch body are identical the condition has no effect and
can be dropped.

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c: use correct structure...
Julia Lawall [Tue, 29 Jul 2014 15:16:43 +0000 (12:16 -0300)]
[media] drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c: use correct structure type name in sizeof

Correct typo in the name of the type given to sizeof.  Because it is the
size of a pointer that is wanted, the typo has no impact on compilation or
execution.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).  The
semantic patch used can be found in message 0 of this patch series.

[Replace sizeof(type) by sizeof(variable)]]

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>