platform/kernel/linux-exynos.git
7 years ago[media] af9033: convert to regmap api
Antti Palosaari [Sun, 6 Nov 2016 04:20:29 +0000 (02:20 -0200)]
[media] af9033: convert to regmap api

Use regmap to cover I2C register operations.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9035: read and store whole eeprom
Antti Palosaari [Fri, 4 Nov 2016 22:43:49 +0000 (20:43 -0200)]
[media] af9035: read and store whole eeprom

Read eeprom content to chip state and read values there when needed.
Also debug dump eeprom content.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] si2168: implement ucb statistics
Antti Palosaari [Fri, 9 Dec 2016 13:11:32 +0000 (11:11 -0200)]
[media] si2168: implement ucb statistics

Implement DVBv5 UCB. Only uncorrected blocks are currently counted.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] si2168: implement ber statistics
Antti Palosaari [Fri, 9 Dec 2016 00:19:19 +0000 (22:19 -0200)]
[media] si2168: implement ber statistics

Implement DVBv5 BER.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] mark myself as mainainer for camera on N900
Pavel Machek [Tue, 27 Dec 2016 20:59:23 +0000 (18:59 -0200)]
[media] mark myself as mainainer for camera on N900

Mark and Sakari as maintainers for Nokia N900 camera pieces.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: Driver for Toshiba et8ek8 5MP sensor
Pavel Machek [Thu, 22 Dec 2016 10:01:04 +0000 (08:01 -0200)]
[media] media: Driver for Toshiba et8ek8 5MP sensor

Add driver for et8ek8 sensor, found in Nokia N900 main camera. Can be
used for taking photos in 2.5MP resolution with fcam-dev.

Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: et8ek8: add device tree binding documentation
Pavel Machek [Mon, 14 Nov 2016 18:30:40 +0000 (16:30 -0200)]
[media] media: et8ek8: add device tree binding documentation

Add device tree binding documentation for toshiba et8ek8 sensor.

Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] exynos4-is: constify v4l2_subdev_* structures
Bhumika Goyal [Mon, 12 Dec 2016 18:03:57 +0000 (16:03 -0200)]
[media] exynos4-is: constify v4l2_subdev_* structures

v4l2_subdev_{core/pad/video}_ops structures are stored in the
fields of the v4l2_subdev_ops structure which are of type const.
Also, v4l2_subdev_ops structure is passed to a function
having its argument of type const. As these structures are never
modified, so declare them as const.
Done using Coccinelle:(one of the scripts used)

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct v4l2_subdev_ops i@p = {...};

@ok1@
identifier r1.i;
position p;
expression e1;
@@
v4l2_subdev_init(e1,&i@p)

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct v4l2_subdev_ops i;

File size before:
   text    data     bss     dec     hex filename
  16830    1064       0   17894    45e6 platform/exynos4-is/fimc-capture.o
   7787     704      20    8511    213f platform/exynos4-is/mipi-csis.o

File size after:
   text    data     bss     dec     hex filename
  17022     880       0   17902    45ee platform/exynos4-is/fimc-capture.o
   8299     192      20    8511    213f platform/exynos4-is/mipi-csis.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] exynos4-is: fimc-is: Unmap region obtained by of_iomap()
Arvind Yadav [Tue, 6 Dec 2016 07:42:51 +0000 (05:42 -0200)]
[media] exynos4-is: fimc-is: Unmap region obtained by of_iomap()

Free memory mapping, if fimc_is_probe is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] exynos-gsc: Fix unbalanced pm_runtime_enable() error
Javier Martinez Canillas [Thu, 19 Jan 2017 22:36:19 +0000 (20:36 -0200)]
[media] exynos-gsc: Fix unbalanced pm_runtime_enable() error

Commit a006c04e6218 ("[media] exynos-gsc: Fixup clock management at
->remove()") changed the driver's .remove function logic to fist do
a pm_runtime_get_sync() to make sure the device is powered before
attempting to gate the gsc clock.

But the commit also removed a pm_runtime_disable() call that leads
to an unbalanced pm_runtime_enable() error if the driver is removed
and re-probed:

exynos-gsc 13e00000.video-scaler: Unbalanced pm_runtime_enable!
exynos-gsc 13e10000.video-scaler: Unbalanced pm_runtime_enable!

Fixes: a006c04e6218 ("[media] exynos-gsc: Fixup clock management at ->remove()")

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] exynos-gsc: Clean up file handle in open() error path
Shailendra Verma [Fri, 2 Dec 2016 04:45:27 +0000 (02:45 -0200)]
[media] exynos-gsc: Clean up file handle in open() error path

The file handle is not yet added in the vfd list. So no need
to call v4l2_fh_del(&ctx->fh) if it fails to create controls.

Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] exynos4-is: Clean up file handle in open() error path
Shailendra Verma [Fri, 2 Dec 2016 04:43:05 +0000 (02:43 -0200)]
[media] exynos4-is: Clean up file handle in open() error path

The file handle is not yet added in the vfd list. So no need
to call v4l2_fh_del(&ctx->fh) if it fails to create controls.

Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cxd2820r: fix gpio null pointer dereference
Antti Palosaari [Mon, 16 Jan 2017 21:27:41 +0000 (19:27 -0200)]
[media] cxd2820r: fix gpio null pointer dereference

Setting GPIOs during probe causes null pointer deference when
GPIOLIB was not selected by Kconfig. Initialize driver private
field before calling set gpios.

It is regressing bug since 4.9.

Fixes: 07fdf7d9f19f ("[media] cxd2820r: add I2C driver bindings")

Reported-by: Chris Rankin <rankincj@gmail.com>
Tested-by: Chris Rankin <rankincj@gmail.com>
Tested-by: Håkan Lennestål <hakan.lennestal@gmail.com>
Cc: <stable@vger.kernel.org> # v4.9+
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] coda: support YUYV output if VDOA is used
Michael Tretter [Fri, 20 Jan 2017 14:00:25 +0000 (12:00 -0200)]
[media] coda: support YUYV output if VDOA is used

The VDOA is able to transform the NV12 custom macroblock tiled format of
the CODA to YUYV format. If and only if the VDOA is available, the
driver can also provide YUYV support.

While the driver is configured to produce YUYV output, the CODA must be
configured to produce NV12 macroblock tiled frames and the VDOA must
transform the intermediate result into the final YUYV output.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] coda: use VDOA for un-tiling custom macroblock format
Michael Tretter [Fri, 20 Jan 2017 14:00:24 +0000 (12:00 -0200)]
[media] coda: use VDOA for un-tiling custom macroblock format

If the CODA driver is configured to produce NV12 output and the VDOA is
available, the VDOA can be used to transform the custom macroblock tiled
format to a raster-ordered format for scanout.

In this case, set the output format of the CODA to the custom macroblock
tiled format, disable the rotator, and use the VDOA to write to the v4l2
buffer. The VDOA is synchronized with the CODA to always un-tile the
frame that the CODA finished in the previous run.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] coda: fix frame index to returned error
Michael Tretter [Fri, 20 Jan 2017 14:00:23 +0000 (12:00 -0200)]
[media] coda: fix frame index to returned error

display_idx refers to the frame that will be returned in the next round.
The currently processed frame is ctx->display_idx and errors should be
reported for this frame.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] coda: add debug output about tiling
Philipp Zabel [Fri, 20 Jan 2017 14:00:22 +0000 (12:00 -0200)]
[media] coda: add debug output about tiling

In order to make the VDOA work correctly, the CODA must produce frames
in tiled format. Print this information in the debug output.

Also print the color format in fourcc instead of the numeric value.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] coda: correctly set capture compose rectangle
Philipp Zabel [Fri, 20 Jan 2017 14:00:21 +0000 (12:00 -0200)]
[media] coda: correctly set capture compose rectangle

Correctly store the rectangle of valid video data in the destination
q_data before rounding up to macroblock size. This fixes the output
of VIDIOC_G_SELECTION for the capture side compose rectangle.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] coda/imx-vdoa: constify structs
Mauro Carvalho Chehab [Tue, 31 Jan 2017 10:13:43 +0000 (08:13 -0200)]
[media] coda/imx-vdoa: constify structs

As warned by checkpatch:

WARNING: struct of_device_id should normally be const
#318: FILE: drivers/media/platform/coda/imx-vdoa.c:318:
+static struct of_device_id vdoa_dt_ids[] = {

So, constify structs.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] coda: add i.MX6 VDOA driver
Philipp Zabel [Fri, 20 Jan 2017 14:00:20 +0000 (12:00 -0200)]
[media] coda: add i.MX6 VDOA driver

The i.MX6 Video Data Order Adapter's (VDOA) sole purpose is to convert
from a custom macroblock tiled format produced by the CODA960 decoder
into linear formats that can be used for scanout.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dt-bindings: Add a binding for Video Data Order Adapter
Philipp Zabel [Fri, 20 Jan 2017 14:00:19 +0000 (12:00 -0200)]
[media] dt-bindings: Add a binding for Video Data Order Adapter

Add a DT binding documentation for the Video Data Order Adapter (VDOA)
of the Freescale i.MX6 SoC.

Also, add the compatible property and correct clock to the device tree
to match the documentation.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] pvrusb2-io: Add some spaces for better code readability
Markus Elfring [Thu, 22 Dec 2016 19:25:39 +0000 (17:25 -0200)]
[media] pvrusb2-io: Add some spaces for better code readability

Use space characters at some source code places according to
the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] pvrusb2-io: Use kmalloc_array() in pvr2_stream_buffer_count()
Markus Elfring [Thu, 22 Dec 2016 18:26:52 +0000 (16:26 -0200)]
[media] pvrusb2-io: Use kmalloc_array() in pvr2_stream_buffer_count()

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] davinci: VPIF: add basic support for DT init
Kevin Hilman [Wed, 7 Dec 2016 18:30:25 +0000 (16:30 -0200)]
[media] davinci: VPIF: add basic support for DT init

Add basic support for initialization via DT

Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dt-bindings: add TI VPIF documentation
Kevin Hilman [Wed, 7 Dec 2016 18:30:24 +0000 (16:30 -0200)]
[media] dt-bindings: add TI VPIF documentation

Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] davinci: vpif_capture: fix start/stop streaming locking
Kevin Hilman [Wed, 7 Dec 2016 18:30:23 +0000 (16:30 -0200)]
[media] davinci: vpif_capture: fix start/stop streaming locking

Video capture subdevs may be over I2C and may sleep during xfer, so we
cannot do IRQ-disabled locking when calling the subdev.

The IRQ-disabled locking is meant to protect the DMA queue list
throughout the rest of the driver, so update the locking in
[start|stop]_streaming to protect just this list, and update the irqlock
comment to reflect what it actually protects.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] davinci: vpif_capture: remove hard-coded I2C adapter id
Kevin Hilman [Wed, 7 Dec 2016 18:30:22 +0000 (16:30 -0200)]
[media] davinci: vpif_capture: remove hard-coded I2C adapter id

Remove hard-coded I2C adapter in favor of getting the
ID from platform_data.

Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] davinci: VPIF: fix module loading, init errors
Kevin Hilman [Sat, 17 Dec 2016 00:47:54 +0000 (22:47 -0200)]
[media] davinci: VPIF: fix module loading, init errors

Fix problems with automatic module loading by adding MODULE_ALIAS.  Also
fix various load-time errors cause by incorrect or not present
platform_data.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: fix dm1105.c build error
Randy Dunlap [Sun, 8 Jan 2017 01:08:49 +0000 (23:08 -0200)]
[media] media: fix dm1105.c build error

Fix dm1105 build error when CONFIG_I2C_ALGOBIT=m and
CONFIG_DVB_DM1105=y.

drivers/built-in.o: In function `dm1105_probe':
dm1105.c:(.text+0x2836e7): undefined reference to `i2c_bit_add_bus'

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Javier Martinez Canillas <javier@osg.samsung.com>
Cc: stable@vger.kernel.org # applies to 4.0 (maybe even 3.x)
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: s5c73m3: fix negation operator
Andrzej Hajda [Thu, 5 Jan 2017 12:34:07 +0000 (10:34 -0200)]
[media] v4l: s5c73m3: fix negation operator

Bool values should be negated using logical operators. Using bitwise operators
results in unexpected and possibly incorrect results.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] Add maintainers for camera on N900
Pavel Machek [Tue, 27 Dec 2016 20:59:23 +0000 (18:59 -0200)]
[media] Add maintainers for camera on N900

Mark me and Sakari as maintainers for Nokia N900 camera pieces.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l2-async: Use kmalloc_array() in v4l2_async_notifier_unregister()
Markus Elfring [Mon, 26 Dec 2016 17:14:33 +0000 (15:14 -0200)]
[media] v4l2-async: Use kmalloc_array() in v4l2_async_notifier_unregister()

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: usb: cpia2: Use kmemdup instead of kmalloc and memcpy
Shyam Saini [Fri, 23 Dec 2016 19:34:36 +0000 (17:34 -0200)]
[media] media: usb: cpia2: Use kmemdup instead of kmalloc and memcpy

When some other buffer is immediately copied into allocated region.
Replace calls to kmalloc followed by a memcpy with a direct
call to kmemdup.

Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] pvrusb2: Clean up file handle in open() error path
Santosh Kumar Singh [Mon, 19 Dec 2016 17:20:37 +0000 (15:20 -0200)]
[media] pvrusb2: Clean up file handle in open() error path

Fix to avoid possible exit file handle in error paths.

Signed-off-by: Santosh Kumar Singh <kumar.san1093@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ivtv: Clean up file handle in open() error path
Santosh Kumar Singh [Mon, 19 Dec 2016 17:12:07 +0000 (15:12 -0200)]
[media] ivtv: Clean up file handle in open() error path

Fix to avoid possible exit file handle in error paths.

Signed-off-by: Santosh Kumar Singh <kumar.san1093@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] tm6000: Clean up file handle in open() error path
Santosh Kumar Singh [Mon, 19 Dec 2016 17:10:58 +0000 (15:10 -0200)]
[media] tm6000: Clean up file handle in open() error path

Fix to avoid possible memory leak and exit file handle
in error paths.

Signed-off-by: Santosh Kumar Singh <kumar.san1093@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] zoran: Clean up file handle in open() error path
Santosh Kumar Singh [Mon, 19 Dec 2016 16:47:44 +0000 (14:47 -0200)]
[media] zoran: Clean up file handle in open() error path

Fix to avoid possible memory leak and exit file handle
in error paths.

Signed-off-by: Santosh Kumar Singh <kumar.san1093@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] vim2m: Clean up file handle in open() error path
Santosh Kumar Singh [Mon, 19 Dec 2016 16:12:46 +0000 (14:12 -0200)]
[media] vim2m: Clean up file handle in open() error path

Fix to avoid possible memory leak and exit file handle
in error paths.

Signed-off-by: Santosh Kumar Singh <kumar.san1093@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] solo6x10: use designated initializers
Kees Cook [Sat, 17 Dec 2016 01:05:36 +0000 (23:05 -0200)]
[media] solo6x10: use designated initializers

Prepare to mark sensitive kernel structures for randomization by making
sure they're using designated initializers. These were identified during
allyesconfig builds of x86, arm, and arm64, with most initializer fixes
extracted from grsecurity.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] mtk-vcodec: use designated initializers
Kees Cook [Sat, 17 Dec 2016 01:00:31 +0000 (23:00 -0200)]
[media] mtk-vcodec: use designated initializers

Prepare to mark sensitive kernel structures for randomization by making
sure they're using designated initializers. These were identified during
allyesconfig builds of x86, arm, and arm64, with most initializer fixes
extracted from grsecurity.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] bt8xx: fix memory leak
Sudip Mukherjee [Fri, 16 Dec 2016 21:31:49 +0000 (19:31 -0200)]
[media] bt8xx: fix memory leak

If dvb_attach() fails then we were just printing an error message and
exiting but the memory allocated to state was not released.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lirc: fix null dereference for tx-only devices
Sean Young [Fri, 20 Jan 2017 12:10:11 +0000 (10:10 -0200)]
[media] lirc: fix null dereference for tx-only devices

tx-only RC devices do not have a receive buffer.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lirc: LIRC_GET_MIN_TIMEOUT should be in range
Sean Young [Thu, 19 Jan 2017 21:44:00 +0000 (19:44 -0200)]
[media] lirc: LIRC_GET_MIN_TIMEOUT should be in range

LIRC_SET_REC_TIMEOUT can fail if the value returned by
LIRC_GET_MIN_TIMEOUT is set due to rounding errors.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: remove excessive spaces from error message
Sean Young [Thu, 19 Jan 2017 21:33:49 +0000 (19:33 -0200)]
[media] rc: remove excessive spaces from error message

The current message has some wanted spaces on it:
rc_core: Loaded IR protocol module ir-jvc-decoder,                      but protocol jvc still not available

Merge it into a single line.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lirc: fix transmit-only read features
Sean Young [Thu, 19 Jan 2017 21:27:17 +0000 (19:27 -0200)]
[media] lirc: fix transmit-only read features

An RC device which is transmit-only shouldn't have the
LIRC_CAN_REC_MODE2 feature.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc/keymaps: add a keytable for the GeekBox remote control
Martin Blumenstingl [Fri, 13 Jan 2017 14:22:12 +0000 (12:22 -0200)]
[media] rc/keymaps: add a keytable for the GeekBox remote control

The GeekBox ships with a 12 button remote control which seems to use the
NEC protocol. The button keycodes were captured with the "ir-keytable"
tool (ir-keytable -p $PROTOCOL -t; human_button_pusher).

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] Documentation: devicetree: Add document bindings for mtk-cir
Sean Wang [Fri, 13 Jan 2017 07:35:38 +0000 (05:35 -0200)]
[media] Documentation: devicetree: Add document bindings for mtk-cir

This patch adds documentation for devicetree bindings for
consumer Mediatek IR controller.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] Documentation: devicetree: move shared property used by rc into a common...
Sean Wang [Fri, 13 Jan 2017 07:35:37 +0000 (05:35 -0200)]
[media] Documentation: devicetree: move shared property used by rc into a common place

Most IR drivers uses the same label to identify the
scancode/key table they used by multiple bindings and lack
explanation well. So move the shared property into a common
place and give better explanation.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: add driver for IR remote receiver on MT7623 SoC
Sean Wang [Fri, 13 Jan 2017 07:35:39 +0000 (05:35 -0200)]
[media] rc: add driver for IR remote receiver on MT7623 SoC

This patch adds driver for IR controller on MT7623 SoC.
and should also work on similar Mediatek SoC. Currently
testing successfully on NEC and SONY remote controller
only but it should work on others (lirc, rc-5 and rc-6).

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rx51: broken build
Sean Young [Mon, 30 Jan 2017 19:58:19 +0000 (17:58 -0200)]
[media] rx51: broken build

As reported by kernel build test:

   In file included from arch/arm/mach-omap2/pdata-quirks.c:15:0:
>> arch/arm/mach-omap2/pdata-quirks.c:536:49: error: 'rx51_lirc_data' undeclared here (not in a function)
     OF_DEV_AUXDATA("nokia,n900-ir", 0, "n900-ir", &rx51_lirc_data),
                                                    ^
   include/linux/of_platform.h:52:21: note: in definition of macro 'OF_DEV_AUXDATA'
       .platform_data = _pdata }
                        ^~~~~~

Since "a92def1 [media] ir-rx51: port to rc-core" the build fails on
some arm configurations.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging/media/s5p-cec/exynos_hdmi_cecctrl.c Fixed blank line before closing...
Scott Matheina [Sun, 8 Jan 2017 23:00:39 +0000 (21:00 -0200)]
[media] staging/media/s5p-cec/exynos_hdmi_cecctrl.c Fixed blank line before closing brace '}'

Fixed checkpatch check blank line before closing brace '}'

Signed-off-by: Scott Matheina <scott@matheina.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging/s5p-cec: fixed alignment should match open parenthesis
Scott Matheina [Sun, 8 Jan 2017 23:00:38 +0000 (21:00 -0200)]
[media] staging/s5p-cec: fixed alignment should match open parenthesis

Fixed Checkpatch check "Alignment should match open parenthesis"

Signed-off-by: Scott Matheina <scott@matheina.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] adv7170: drop redundant ret local
Baruch Siach [Tue, 3 Jan 2017 20:22:43 +0000 (18:22 -0200)]
[media] adv7170: drop redundant ret local

Simplifies return value logic of adv7170_set_fmt().

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ov2659: remove NOP assignment
Baruch Siach [Tue, 3 Jan 2017 20:06:56 +0000 (18:06 -0200)]
[media] ov2659: remove NOP assignment

The loop over the ov2659_formats[] array just a few lines above
verifies that mf->code matches the selected array entry.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] gp8psk: fix spelling mistake: "firmare" -> "firmware"
Colin Ian King [Fri, 30 Dec 2016 14:46:19 +0000 (12:46 -0200)]
[media] gp8psk: fix spelling mistake: "firmare" -> "firmware"

trivial fix to spelling mistake in err message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] b2c2: fix spelling mistake: "Contunuity" -> "Continuity"
Colin Ian King [Thu, 29 Dec 2016 17:23:15 +0000 (15:23 -0200)]
[media] b2c2: fix spelling mistake: "Contunuity" -> "Continuity"

trivial fix to spelling mistake in deb_chk message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cobalt: fix spelling mistake: "Celcius" -> "Celsius"
Colin Ian King [Wed, 28 Dec 2016 21:45:58 +0000 (19:45 -0200)]
[media] cobalt: fix spelling mistake: "Celcius" -> "Celsius"

trivial fix to spelling mistake in cobalt_info message. Anders Celsius
was the Swedish astronomer.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends: fix spelling mistake on cx24123_pll_calcutate
Colin Ian King [Wed, 28 Dec 2016 21:35:48 +0000 (19:35 -0200)]
[media] dvb-frontends: fix spelling mistake on cx24123_pll_calcutate

trivial fix to spelling mistake of function name in err message,
should be cx24123_pll_calculate instead of cx24123_pll_calcutate.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] am437x-vpfe: always assign bpp variable
Nicolas Iooss [Tue, 27 Dec 2016 18:02:36 +0000 (16:02 -0200)]
[media] am437x-vpfe: always assign bpp variable

In vpfe_s_fmt(), when the sensor format and the requested format were
the same, bpp was assigned to vpfe->bpp without being initialized first.

Grab the bpp value that is currently used by using __vpfe_get_format()
instead of its wrapper, vpfe_try_fmt().

This use of uninitialized variable has been found by compiling the
kernel with clang.

Fixes: 417d2e507edc ("[media] media: platform: add VPFE capture driver
support for AM437X")

Cc: stable@vger.kernel.org
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] gen-errors.rst: document EIO
Hans Verkuil [Fri, 16 Dec 2016 09:22:08 +0000 (07:22 -0200)]
[media] gen-errors.rst: document EIO

Document the EIO error since this can happen anywhere anytime and applications
should be aware of this.

Also fix typo: exaustive -> exhaustive

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] vivid: Enable 4k resolution for webcam capture device
Soren Brinkmann [Fri, 16 Dec 2016 01:17:57 +0000 (23:17 -0200)]
[media] vivid: Enable 4k resolution for webcam capture device

Add 3840x2160 as valid resolution for the webcam capture input and
adjust the webcam intervals accordingly.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: s5p-cec: Remove references to non-existent PLAT_S5P symbol
Corentin Labbe [Thu, 15 Dec 2016 14:03:24 +0000 (12:03 -0200)]
[media] media: s5p-cec: Remove references to non-existent PLAT_S5P symbol

Commit d78c16ccde96 ("ARM: SAMSUNG: Remove remaining legacy code")
removed the Kconfig symbol PLAT_S5P.
This patch remove the last occurrence of this symbol.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: s5p-cec: Remove unneeded linux/miscdevice.h include
Corentin Labbe [Thu, 15 Dec 2016 14:03:23 +0000 (12:03 -0200)]
[media] media: s5p-cec: Remove unneeded linux/miscdevice.h include

s5p-cec: does not use any miscdevice so this patch remove this
unnecessary inclusion.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] adv7604: Initialize drive strength to default when using DT
Lars-Peter Clausen [Tue, 29 Nov 2016 11:23:48 +0000 (09:23 -0200)]
[media] adv7604: Initialize drive strength to default when using DT

The adv7604 driver platform data contains fields for configuring the drive
strength of the output pins. When probing the driver through DT these
fields are not explicitly initialized, which means they are left at 0. This
is a reserved setting for the drive strength configuration though and can
cause signal integrity issues.

Whether these signal integrity issues are visible depends on the PCB
specifics (e.g. the higher the load capacitance for the output the more
visible the issue). But it has been observed on existing solutions at high
pixel clock rates.

Initialize the drive strength settings to the power-on-reset value of the
device when probing through devicetree to avoid this issue.

Fixes: 0e158be0162b ("adv7604: Add DT support")

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: platform: soc_camera_platform : constify v4l2_subdev_* structures
Bhumika Goyal [Mon, 12 Dec 2016 08:09:53 +0000 (06:09 -0200)]
[media] media: platform: soc_camera_platform : constify v4l2_subdev_* structures

v4l2_subdev_{core/video}_ops structures are stored in the
fields of the v4l2_subdev_ops structure which are of type const.
Also, v4l2_subdev_ops structure is passed to a function
having its argument of type const. As these structures are never
modified, so declare them as const.
Done using Coccinelle:(One of the scripts)

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct v4l2_subdev_core_ops i@p = {...};

@ok1@
identifier r1.i;
position p;
struct v4l2_subdev_ops obj;
@@
obj.core=&i@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct v4l2_subdev_core_ops i;

File size before:
    text   data     bss     dec     hex filename
    858     576       0    1434     59a soc_camera/soc_camera_platform.o

File size after:
  text    data     bss     dec     hex filename
   1234     192       0    1426     592 soc_camera/soc_camera_platform.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] soc-camera: Fix a return value in case of error
Christophe JAILLET [Fri, 18 Nov 2016 17:49:15 +0000 (15:49 -0200)]
[media] soc-camera: Fix a return value in case of error

If 'ov9640_reg_read()' does not return 0, then 'val' is left unmodified.
As it is not initialized either, the return value can be anything.

It is likely that returning the error code was expected here.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: lirc_imon: port remaining usb ids to imon and remove
Sean Young [Tue, 20 Dec 2016 14:18:06 +0000 (12:18 -0200)]
[media] staging: lirc_imon: port remaining usb ids to imon and remove

The staging lirc_imon driver contains 4 usb ids. Two of those have a VFD
and two don't. The VFD code is exactly the same in the mainline imon
driver, so that part is easily ported.

The staging driver produces raw IR rather than scancodes for the four
devices, so I've ported the raw IR code from staging to mainline imon.

Now that mainline imon can handle these four devices, lirc_imon is no
longer needed.

Compile tested only.

Signed-off-by: Sean Young <sean@mess.org>
Cc: Venky Raju <dev@venky.ws>
Cc: Jarod Wilson <jarod@redhat.com>
Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: lirc_bt829: remove
Sean Young [Mon, 19 Dec 2016 22:20:03 +0000 (20:20 -0200)]
[media] staging: lirc_bt829: remove

This driver is for an old mach64 VT board, which also has a framebuffer
driver (atyfb) and userspace mach64 X driver.

It was merged in 2010 and noone has attempted to port it to rc-core,
which would be necessary to get it out of staging.

I have not been able to track down the hardware either.

Signed-off-by: Sean Young <sean@mess.org>
Cc: Jarod Wilson <jarod@redhat.com>
Cc: Leonid Froenchenko <lfroen@galileo.co.il>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: lirc_parallel: remove
Sean Young [Mon, 19 Dec 2016 22:10:41 +0000 (20:10 -0200)]
[media] staging: lirc_parallel: remove

The lirc_parallel driver was merged in 2010 and noone has attempted
to do the work necessary to get it out of staging (i.e. port it to
rc-core). I have not been able to find one of these devices, and
a machine with a parallel port is pretty rare too.

Signed-off-by: Sean Young <sean@mess.org>
Cc: Jarod Wilson <jarod@redhat.com>
Cc: Christoph Bartelmus <lirc@bartelmus.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: lirc_sir: port to rc-core
Sean Young [Mon, 19 Dec 2016 22:07:08 +0000 (20:07 -0200)]
[media] staging: lirc_sir: port to rc-core

Before this driver can be moved out of staging, it should be ported
to rc-core. I've tried to make the minimum changes possible without
upsetting checkpatch.

Compile tested only.

Signed-off-by: Sean Young <sean@mess.org>
Cc: Jarod Wilson <jarod@redhat.com>
Cc: Christoph Bartelmus <lirc@bartelmus.de>
Cc: Milan Pikula <www@fornax.sk>
Cc: Frank Przybylski <mail@frankprzybylski.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ir-rx51: port to rc-core
Sean Young [Mon, 19 Dec 2016 20:48:29 +0000 (18:48 -0200)]
[media] ir-rx51: port to rc-core

This driver was written using lirc since rc-core did not support
transmitter-only hardware at that time. Now that it does, port
this driver.

Compile tested only.

Signed-off-by: Sean Young <sean@mess.org>
Cc: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Cc: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: add support for IR LEDs driven through SPI
Andi Shyti [Fri, 16 Dec 2016 06:12:18 +0000 (04:12 -0200)]
[media] rc: add support for IR LEDs driven through SPI

The ir-spi is a simple device driver which supports the
connection between an IR LED and the MOSI line of an SPI device.

The driver, indeed, uses the SPI framework to stream the raw data
provided by userspace through an rc character device. The chardev
is handled by the LIRC framework and its functionality basically
provides:

 - write: the driver gets a pulse/space signal and translates it
   to a binary signal that will be streamed to the IR led through
   the SPI framework.
 - set frequency: sets the frequency whith which the data should
   be sent. This is handle with ioctl with the
   LIRC_SET_SEND_CARRIER flag (as per lirc documentation)
 - set duty cycle: this is also handled with ioctl with the
   LIRC_SET_SEND_DUTY_CYCLE flag. The driver handles duty cycles
   of 50%, 60%, 70%, 75%, 80% and 90%, calculated on 16bit data.

The character device is created under /dev/lircX name, where X is
and ID assigned by the LIRC framework.

Example of usage:

        fd = open("/dev/lirc0", O_RDWR);
        if (fd < 0)
                return -1;

        val = 608000;
        ret = ioctl(fd, LIRC_SET_SEND_CARRIER, &val);
        if (ret < 0)
                return -1;

val = 60;
        ret = ioctl(fd, LIRC_SET_SEND_DUTY_CYCLE, &val);
        if (ret < 0)
                return -1;

        n = write(fd, buffer, BUF_LEN);
        if (n < 0 || n != BUF_LEN)
                ret = -1;

        close(fd);

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] Documentation: bindings: add documentation for ir-spi device driver
Andi Shyti [Sun, 18 Dec 2016 11:11:37 +0000 (09:11 -0200)]
[media] Documentation: bindings: add documentation for ir-spi device driver

Document the ir-spi driver's binding which is a IR led driven
through the SPI line.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc-ir-raw: do not generate any receiving thread for raw transmitters
Andi Shyti [Fri, 16 Dec 2016 06:12:16 +0000 (04:12 -0200)]
[media] rc-ir-raw: do not generate any receiving thread for raw transmitters

Raw IR transmitters do not need any thread listening for
occurring events. Check the driver type before running the
thread.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc-core: add support for IR raw transmitters
Andi Shyti [Fri, 16 Dec 2016 06:12:15 +0000 (04:12 -0200)]
[media] rc-core: add support for IR raw transmitters

IR raw transmitter driver type is specified in the enum
rc_driver_type as RC_DRIVER_IR_RAW_TX which includes all those
devices that transmit raw stream of bit to a receiver.

The data are provided by userspace applications, therefore they
don't need any input device allocation, but still they need to be
registered as raw devices.

Suggested-by: Sean Young <sean@mess.org>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc-main: split setup and unregister functions
Andi Shyti [Fri, 16 Dec 2016 06:12:14 +0000 (04:12 -0200)]
[media] rc-main: split setup and unregister functions

Move the input device allocation, map and protocol handling to
different functions.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc-main: assign driver type during allocation
Andi Shyti [Fri, 16 Dec 2016 08:50:58 +0000 (06:50 -0200)]
[media] rc-main: assign driver type during allocation

The driver type can be assigned immediately when an RC device
requests to the framework to allocate the device.

This is an 'enum rc_driver_type' data type and specifies whether
the device is a raw receiver or scancode receiver. The type will
be given as parameter to the rc_allocate_device device.

Change accordingly all the drivers calling rc_allocate_device()
so that the device type is specified during the rc device
allocation. Whenever the device type is not specified, it will be
set as RC_DRIVER_SCANCODE which was the default '0' value.

Suggested-by: Sean Young <sean@mess.org>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: nuvoton-cir: Add support wakeup via sysfs filter callback
Antti Seppälä [Tue, 31 Mar 2015 17:48:12 +0000 (14:48 -0300)]
[media] rc: nuvoton-cir: Add support wakeup via sysfs filter callback

Nuvoton-cir utilizes the encoding capabilities of rc-core to convert
scancodes from user space to pulse/space format understood by the
underlying hardware.

Converted samples are then written to the wakeup fifo along with other
necessary configuration to enable wake up functionality.

Signed-off-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: James Hogan <james@albanarts.com>
Signed-off-by: Sean Young <sean@mess.org>
Cc: Jarod Wilson <jarod@redhat.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: rc-loopback: Add loopback of filter scancodes
James Hogan [Tue, 31 Mar 2015 17:48:11 +0000 (14:48 -0300)]
[media] rc: rc-loopback: Add loopback of filter scancodes

Add the s_wakeup_filter callback to the rc-loopback driver, which instead
of setting the filter just feeds the scancode back through the input
device so that it can be verified.

Signed-off-by: James Hogan <james@albanarts.com>
Signed-off-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Cc: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: rc-core: Add support for encode_wakeup drivers
James Hogan [Tue, 31 Mar 2015 17:48:10 +0000 (14:48 -0300)]
[media] rc: rc-core: Add support for encode_wakeup drivers

Add support in rc-core for drivers which implement the wakeup scancode
filter by encoding the scancode using the raw IR encoders. This is by
way of rc_dev::encode_wakeup which should be set to true and
rc_dev::allowed_wakeup_protocols should be set to the raw IR encoders.

We also do not permit the mask to be set as we cannot generate IR
which would match that.

Signed-off-by: James Hogan <james@albanarts.com>
Signed-off-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Cc: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: ir-sony-decoder: Add encode capability
Sean Young [Tue, 6 Dec 2016 20:33:57 +0000 (18:33 -0200)]
[media] rc: ir-sony-decoder: Add encode capability

Add the capability to encode Sony scancodes as raw events. Sony uses
pulse length rather than pulse distance.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: ir-sharp-decoder: Add encode capability
Sean Young [Tue, 6 Dec 2016 20:11:30 +0000 (18:11 -0200)]
[media] rc: ir-sharp-decoder: Add encode capability

Add the capability to encode Sharp scancodes as raw events.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: ir-sanyo-decoder: Add encode capability
Sean Young [Tue, 6 Dec 2016 20:01:05 +0000 (18:01 -0200)]
[media] rc: ir-sanyo-decoder: Add encode capability

Add the capability to encode Sanyo scancodes as raw events.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: ir-jvc-decoder: Add encode capability
Sean Young [Tue, 6 Dec 2016 19:01:03 +0000 (17:01 -0200)]
[media] rc: ir-jvc-decoder: Add encode capability

Add the capability to encode JVC scancodes as raw events.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: ir-nec-decoder: Add encode capability
James Hogan [Fri, 14 Mar 2014 23:04:14 +0000 (20:04 -0300)]
[media] rc: ir-nec-decoder: Add encode capability

Add the capability to encode NEC scancodes as raw events. The
scancode_to_raw is pretty much taken from the img-ir NEC filter()
callback, and modulation uses the pulse distance helper added in a
previous commit.

Signed-off-by: James Hogan <james@albanarts.com>
Signed-off-by: Sean Young <sean@mess.org>
Cc: Antti Seppälä <a.seppala@gmail.com>
Cc: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: ir-rc6-decoder: Add encode capability
Antti Seppälä [Tue, 31 Mar 2015 17:48:09 +0000 (14:48 -0300)]
[media] rc: ir-rc6-decoder: Add encode capability

Add the capability to encode RC-6 and RC-6A scancodes as raw events.

The Manchester modulation helper is used several times with various
timings so that RC-6 header preamble, the header, header trailing bit
and the data itself can be modulated correctly.

Signed-off-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Cc: James Hogan <james@albanarts.com>
Cc: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: ir-rc5-decoder: Add encode capability
James Hogan [Tue, 31 Mar 2015 17:48:08 +0000 (14:48 -0300)]
[media] rc: ir-rc5-decoder: Add encode capability

Add the capability to encode RC-5, RC-5X and RC-5-SZ scancodes as raw
events.

The Manchester modulation helper is used, and for RC-5X it is used twice
with two sets of timings, the first with a short trailer space for the
space in the middle, and the second with no leader so that it can
continue the space.

The encoding in RC-5-SZ first inserts a pulse and then simply utilizes
the generic Manchester encoder available in rc-core.

Signed-off-by: James Hogan <james@albanarts.com>
Signed-off-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Cc: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: rc-ir-raw: Add pulse-distance modulation helper
James Hogan [Fri, 14 Mar 2014 23:04:12 +0000 (20:04 -0300)]
[media] rc: rc-ir-raw: Add pulse-distance modulation helper

Add IR encoding helper for pulse-distance modulation as used by the NEC
protocol.

Signed-off-by: James Hogan <james@albanarts.com>
Signed-off-by: Sean Young <sean@mess.org>
Cc: Antti Seppälä <a.seppala@gmail.com>
Cc: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: rc-ir-raw: Add Manchester encoder (phase encoder) helper
Antti Seppälä [Tue, 31 Mar 2015 17:48:07 +0000 (14:48 -0300)]
[media] rc: rc-ir-raw: Add Manchester encoder (phase encoder) helper

Adding a simple Manchester encoder to rc-core.
Manchester coding is used by at least RC-5 and RC-6 protocols and their
variants.

Signed-off-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: James Hogan <james@albanarts.com>
Signed-off-by: Sean Young <sean@mess.org>
Cc: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: rc-ir-raw: Add scancode encoder callback
James Hogan [Tue, 31 Mar 2015 17:48:06 +0000 (14:48 -0300)]
[media] rc: rc-ir-raw: Add scancode encoder callback

Add a callback to raw ir handlers for encoding and modulating a scancode
to a set of raw events. This could be used for transmit, or for
converting a wakeup scancode to a form that is more suitable for raw
hardware wake up filters.

Signed-off-by: James Hogan <james@albanarts.com>
Signed-off-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Cc: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: raw IR drivers cannot handle cec, unknown or other
Sean Young [Sat, 3 Dec 2016 10:55:56 +0000 (08:55 -0200)]
[media] rc: raw IR drivers cannot handle cec, unknown or other

unknown and other are for IR protocols for which we have no decoder,
so the raw IR drivers have no chance of generating them. cec is not
an IR protocol.

Signed-off-by: Sean Young <sean@mess.org>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] winbond-cir: use sysfs wakeup filter
Sean Young [Sat, 3 Dec 2016 10:29:45 +0000 (08:29 -0200)]
[media] winbond-cir: use sysfs wakeup filter

Now that we can select the exact variant of the protocol for wakeup
filter, the winbond-cir can use the wakeup filter rather than module
parameters.

Signed-off-by: Sean Young <sean@mess.org>
Cc: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: unify nec32 protocol scancode format
Sean Young [Thu, 15 Dec 2016 09:37:48 +0000 (07:37 -0200)]
[media] rc: unify nec32 protocol scancode format

There are two different encodings used for nec32:
 - The ir-nec-decoder.c decoder treats it as 32 bit msb first.
 - The img-ir decoder/encoder, winbond wakeup, dib0700, ir-ctl userspace,
   treat nec32 analogous to necx and nec: 4 bytes, each lsb first. So this
   format reverses the 4 bytes.

There are arguments to be had for both formats, but we should not use
different formats in different parts of the kernel. Selecting the second
format introduces the least code churn. It does mean that the TiVo keymap
needs updating.

This change was submitted before as "18bc174 [media] media: rc: change
32bit NEC scancode format", which was reverted because it was unclear
what scancode rc drivers produce. There are now more examples of drivers
which produce nec32 in lsb format.

The TiVo keymap is verified against the Nero Liquid TiVo remote. The
keymap is not for the Tivo DVR remote, which uses rc-5.

Signed-off-by: Sean Young <sean@mess.org>
Cc: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: Add scancode validation
Sean Young [Mon, 5 Dec 2016 21:24:59 +0000 (19:24 -0200)]
[media] rc: Add scancode validation

We need to valdiate that scancodes are valid for their protocol; an
incorrect necx scancode could actually be a nec scancode, for example.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: change wakeup_protocols to list all protocol variants
Sean Young [Mon, 5 Dec 2016 19:08:35 +0000 (17:08 -0200)]
[media] rc: change wakeup_protocols to list all protocol variants

For IR wakeup, a driver has to program the hardware to wakeup at a
specific IR sequence, so it makes no sense to allow multiple wakeup
protocols to be selected. In the same manner the sysfs interface only
allows one scancode to be provided.

In addition, we need to know the specific variant of the protocol.

In short, these changes are made to the wakeup_protocols sysfs entry:
 - list all the protocol variants rather than the protocol groups,
   e.g. "nec nec-x nec-32" rather than just "nec".
 - only allow one protocol variant to be selected rather than multiple
 - wakeup_filter can only be set once a protocol has been selected in
   wakeup_protocols.

This is an API change, however the only user of this API is the img-ir,
but the wakeup code was never merged to mainline, so it was never used.

Signed-off-by: Sean Young <sean@mess.org>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Sifan Naeem <sifan.naeem@imgtec.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc5x: document that this is the 20 bit variant
Sean Young [Fri, 2 Dec 2016 17:16:14 +0000 (15:16 -0200)]
[media] rc5x: document that this is the 20 bit variant

There are many variants of extended rc5. This implements the 20 bit
version.

Signed-off-by: Sean Young <sean@mess.org>
Cc: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc5x: 6th command bit is S2 bit
Sean Young [Fri, 2 Dec 2016 17:16:13 +0000 (15:16 -0200)]
[media] rc5x: 6th command bit is S2 bit

The 2nd stop bit in rc5 is reused as an inverted 6th command bit in
20 bits rc5x. Currently the rc5x decoder sets the 6th command bit as
an inverted duplicate of the lowest system bit; as a result we do
not have all the command bits.

Note that there are no rc5x keymaps present.

Signed-off-by: Sean Young <sean@mess.org>
Cc: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: allow software timeout to be set
Sean Young [Fri, 2 Dec 2016 17:16:12 +0000 (15:16 -0200)]
[media] rc: allow software timeout to be set

Both the iguanair and the technotrend usb ir do not do any timeout
handling in hardware, so timeout is entirely done in
ir_raw_event_store_with_filter(). Any sensible timeout value will
do, so allow it to be set using LIRC_SET_REC_TIMEOUT.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] serial_ir: generate timeout
Sean Young [Fri, 2 Dec 2016 17:16:11 +0000 (15:16 -0200)]
[media] serial_ir: generate timeout

No timeout is generated by serial_ir since the port only generates
interrupts on edges. Some IR protocols like rc6 and rc5 need a trailing
space or timeout so they know there are no more bits coming.

Without it, the current key will only be reported once some more IR
occurs.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] em28xx: IR protocol not reported correctly
Sean Young [Fri, 2 Dec 2016 17:16:10 +0000 (15:16 -0200)]
[media] em28xx: IR protocol not reported correctly

Report the correct NEC variant.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>