OSDN Git Service

uclinux-h8/linux.git
7 years agomedia: ddbridge: support for CineS2 V7(A) and DuoFlex S2 V4 hardware
Daniel Scheller [Mon, 3 Jul 2017 17:21:01 +0000 (13:21 -0400)]
media: ddbridge: support for CineS2 V7(A) and DuoFlex S2 V4 hardware

This adds all required glue code to support - in conjunction with the new
stv0910 and stv6111 demod/tuner drivers and additionally the lnbh25 LNB
controller driver - all current DVB-S/S2 hardware (bridges and flex
modules) from Digital Devices like the DD CineS2 V7 and V7A, current
S2 V4 DuoFlex modules, and probably all upcoming devices based on this
STV0910/STV6111/LNBH25 hardware stack.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: ddbridge: return stv09xx id in port_has_stv0900_aa()
Daniel Scheller [Mon, 3 Jul 2017 17:21:00 +0000 (13:21 -0400)]
media: ddbridge: return stv09xx id in port_has_stv0900_aa()

The returned value is required for further evaluation of the exact
demodulator chip (stv090x or stv0910).

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends: add ST STV6111 DVB-S/S2 tuner frontend driver
Daniel Scheller [Mon, 3 Jul 2017 17:20:59 +0000 (13:20 -0400)]
media: dvb-frontends: add ST STV6111 DVB-S/S2 tuner frontend driver

This adds a frontend driver for the ST STV6111 DVB-S/S2 tuners. Like the
stv0910 demod frontend driver, this driver originates from the Digital
Devices' dddvb vendor driver package as of version 0.9.29, and was cleaned
up aswell. No functionality had to be removed though. Any camel case has
been converted to kernel_case, fixup patch has been proposed upstream.

Permission to reuse and mainline the driver code was formally granted by
Ralph Metzler <rjkm@metzlerbros.de>.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/stv0910: Add missing set_frontend fe-op
Daniel Scheller [Mon, 3 Jul 2017 17:20:58 +0000 (13:20 -0400)]
media: dvb-frontends/stv0910: Add missing set_frontend fe-op

This was missing from the frontend_ops.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/stv0910: Add demod-only signal strength reporting
Daniel Scheller [Mon, 3 Jul 2017 17:20:57 +0000 (13:20 -0400)]
media: dvb-frontends/stv0910: Add demod-only signal strength reporting

Original code at least has some signed/unsigned issues, resulting in
values like 32dBm. Implement signal strength readout to work without
asking the attached tuner, and use a lookup table instead of log calc.
Values reported appear plausible, gathered from feedback from several
testers.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/stv0910: add multistream (ISI) and PLS capabilities
Daniel Scheller [Mon, 3 Jul 2017 17:20:56 +0000 (13:20 -0400)]
media: dvb-frontends/stv0910: add multistream (ISI) and PLS capabilities

Implements stream_id filter and scrambling code setup in start() and also
sets FE_CAN_MULTISTREAM in frontend_ops. This enables the driver to
properly receive and handle multistream transponders, functionality has
been reported working fine by testers with access to such streams, in
conjunction with VDR on the userspace side.

The code snippet originates from the original vendor's dddvb driver
package and has been made working properly with the current in-kernel
DVB core API.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends/stv0910: Fix possible buffer overflow
Daniel Scheller [Mon, 3 Jul 2017 17:20:55 +0000 (13:20 -0400)]
media: dvb-frontends/stv0910: Fix possible buffer overflow

Fixes smatch error:

  drivers/media/dvb-frontends/stv0910.c:715 dvbs2_nbch() error: buffer overflow 'nbch[fectype]' 2 <= 28

Also, fixes the nbch array table by adding the DUMMY_PLF element at the top
to match the enums (table element order was off by one before).

Patch sent upstream aswell.

Cc: Ralph Metzler <rjkm@metzlerbros.de>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dvb-frontends: add ST STV0910 DVB-S/S2 demodulator frontend driver
Daniel Scheller [Mon, 3 Jul 2017 17:20:54 +0000 (13:20 -0400)]
media: dvb-frontends: add ST STV0910 DVB-S/S2 demodulator frontend driver

This adds a multi frontend driver for the ST STV0910 DVB-S/S2 demodulator
frontends. The driver code originates from the Digital Devices' dddvb
vendor driver package as of version 0.9.29, and has been cleaned up from
core API usage which isn't supported yet in the kernel, and additionally
all obvious style issues have been resolved. All camel case and allcaps
have been converted to kernel_case and lowercase. Patches have been sent
to the vendor package maintainers to fix this aswell. Signal statistics
acquisition has been refactored to comply with standards.

Permission to reuse and mainline the driver code was formally granted by
Ralph Metzler <rjkm@metzlerbros.de>.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: platform: video-mux: convert to multiplexer framework
Philipp Zabel [Tue, 18 Jul 2017 13:26:00 +0000 (09:26 -0400)]
media: platform: video-mux: convert to multiplexer framework

Now that the multiplexer framework is merged, drop the temporary
mmio-mux implementation from the video-mux driver and convert it to use
the multiplexer API.

[mchehab@s-opensource.com: fix a merge conflict at Kconfig]
Signed-off-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 agomedia: usbvision-i2c: fix format overflow warning
Arnd Bergmann [Mon, 17 Jul 2017 14:29:58 +0000 (10:29 -0400)]
media: usbvision-i2c: fix format overflow warning

gcc-7 notices that we copy a fixed length string into another
string of the same size, with additional characters:

drivers/media/usb/usbvision/usbvision-i2c.c: In function 'usbvision_i2c_register':
drivers/media/usb/usbvision/usbvision-i2c.c:190:36: error: '%d' directive writing between 1 and 11 bytes into a region of size between 0 and 47 [-Werror=format-overflow=]
  sprintf(usbvision->i2c_adap.name, "%s-%d-%s", i2c_adap_template.name,
                                    ^~~~~~~~~~
drivers/media/usb/usbvision/usbvision-i2c.c:190:2: note: 'sprintf' output between 4 and 76 bytes into a destination of size 48

Using snprintf() makes the code more robust in general, but will still
trigger a possible warning about truncation in the string.
We know this won't happen as the template name is always "usbvision", so
we can easily avoid the warning as well by using this as the format string
directly.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: v4l2-mediabus: Add helper functions
Todor Tomov [Fri, 7 Jul 2017 08:48:47 +0000 (04:48 -0400)]
media: v4l2-mediabus: Add helper functions

Add helper functions for mbus to/from mplane pixel format conversion.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: adv7180: add missing adv7180cp, adv7180st i2c device IDs
Ulrich Hecht [Mon, 3 Jul 2017 08:43:33 +0000 (04:43 -0400)]
media: adv7180: add missing adv7180cp, adv7180st i2c device IDs

Fixes a crash on Renesas R8A7793 Gose board that uses these "compatible"
entries.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: solo6x10: fix detection of TW2864B chips
Anton Sviridenko [Sat, 1 Jul 2017 11:26:01 +0000 (07:26 -0400)]
media: solo6x10: fix detection of TW2864B chips

This patch enables support for non-Bluecherry labeled solo6110
based PCI cards which have 3 x TW2864B chips and one TW2865.
These cards are displayed by lspci -nn as

"Softlogic Co., Ltd. SOLO6110 H.264 Video encoder/decoder [9413:6110]"

Bluecherry cards have 4 x TW2864A. According to datasheet register 0xFF
of TW2864B chips contains value 0x6A or 0x6B depending on revision
which being shifted 3 bits right gives value 0x0d.
Existing version of solo6x10 fails on these cards with

[276582.344942] solo6x10 0000:07:00.0: Probing Softlogic 6110
[276582.402151] solo6x10 0000:07:00.0: Could not initialize any techwell chips
[276582.402781] solo6x10: probe of 0000:07:00.0 failed with error -22

Signed-off-by: Anton Sviridenko <anton@corp.bluecherry.net>
Acked-by: Andrey Utkin <andrey_utkin@fastmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dt-bindings: media: Add r8a7796 DRIF bindings
Ramesh Shanmugasundaram [Fri, 23 Jun 2017 09:25:02 +0000 (05:25 -0400)]
media: dt-bindings: media: Add r8a7796 DRIF bindings

Add r8a7796 DRIF bindings.

Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
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 agomedia: adv748x: get rid of unused var
Mauro Carvalho Chehab [Wed, 19 Jul 2017 20:51:01 +0000 (16:51 -0400)]
media: adv748x: get rid of unused var

drivers/media/i2c/adv748x/adv748x-csi2.c: In function 'adv748x_csi2_init_controls':
drivers/media/i2c/adv748x/adv748x-csi2.c:251:20: warning: variable 'ctrl' set but not used [-Wunused-but-set-variable]
  struct v4l2_ctrl *ctrl;
                    ^~~~

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: MAINTAINERS: Add ADV748x driver
Kieran Bingham [Thu, 6 Jul 2017 11:01:17 +0000 (07:01 -0400)]
media: MAINTAINERS: Add ADV748x driver

The ADV7481 is an integrated video decoder and combined HDMI/MHL
receiver.

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.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@s-opensource.com>
7 years agomedia: i2c: adv748x: add adv748x driver
Kieran Bingham [Thu, 6 Jul 2017 11:01:16 +0000 (07:01 -0400)]
media: i2c: adv748x: add adv748x driver

Provide support for the ADV7481 and ADV7482.

The driver is modelled with 4 subdevices to allow simultaneous streaming
from the AFE (Analog front end) and HDMI inputs though two CSI TX
entities.

The HDMI entity is linked to the TXA CSI bus, whilst the AFE is linked
to the TXB CSI bus.

The driver is based on a prototype by Koji Matsuoka in the Renesas BSP,
and an earlier rework by Niklas Söderlund.

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: adv748x: Add adv7481, adv7482 bindings
Kieran Bingham [Thu, 6 Jul 2017 11:01:15 +0000 (07:01 -0400)]
media: adv748x: Add adv7481, adv7482 bindings

Create device tree bindings documentation for the ADV748x.
The ADV748x supports both the ADV7481 and ADV7482 chips which
provide analogue decoding and HDMI receiving capabilities

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
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 agomedia: staging: atomisp: fixed trivial coding style issue
Shy More [Mon, 17 Jul 2017 04:10:57 +0000 (00:10 -0400)]
media: staging: atomisp: fixed trivial coding style issue

Below was the trival error flagged by checkpatch.pl:
ERROR: space prohibited after that open parenthesis '('

Signed-off-by: Shy More <smklearn@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: fixed trivial coding style warning
Shy More [Sun, 16 Jul 2017 23:35:34 +0000 (19:35 -0400)]
media: staging: atomisp: fixed trivial coding style warning

Below was the trivial wanrning flagged by checkpatch.pl
WARNING: Block comments use * on subsequent lines

Signed-off-by: Shy More <smklearn@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: hmm: Alignment code (rebased)
Philipp Guendisch [Thu, 13 Jul 2017 06:55:43 +0000 (02:55 -0400)]
media: staging: atomisp: hmm: Alignment code (rebased)

This patch fixed code alignment to open paranthesis.
Semantic should not be affected by this patch.

It has been rebased on top of media_tree atomisp branch

Signed-off-by: Philipp Guendisch <philipp.guendisch@fau.de>
Signed-off-by: Chris Baller <chris.baller@gmx.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: hmm: Fixed comment style
Philipp Guendisch [Thu, 13 Jul 2017 06:55:42 +0000 (02:55 -0400)]
media: staging: atomisp: hmm: Fixed comment style

This patch fixed comment style. Semantic should not be affected.
There are also two warnings left about too long lines, which
reduce readability if changed.

Signed-off-by: Philipp Guendisch <philipp.guendisch@fau.de>
Signed-off-by: Chris Baller <chris.baller@gmx.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: Use kvfree() instead of kfree()/vfree()
Amitoj Kaur Chawla [Mon, 10 Jul 2017 19:27:28 +0000 (15:27 -0400)]
media: staging: atomisp: Use kvfree() instead of kfree()/vfree()

Conditionally calling kfree()/vfree() can be replaced by a call to
kvfree() which handles both kmalloced memory and vmalloced memory.
The resulting wrapper function has been replaced with direct calls
to kvfree().

This change was made with the help of the following Coccinelle
semantic patch:
//<smpl>
@@
expression a;
@@
- if(...) { vfree(a); }
- else { kfree(a); }
+ kvfree(a);
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: use kstrdup to replace kmalloc and memcpy
Hari Prasath [Mon, 10 Jul 2017 06:17:00 +0000 (02:17 -0400)]
media: staging: atomisp: use kstrdup to replace kmalloc and memcpy

kstrdup kernel primitive can be used to replace kmalloc followed by
string copy. This was reported by coccinelle tool.

Signed-off-by: Hari Prasath <gehariprasath@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: gc2235: constify acpi_device_id
Arvind Yadav [Thu, 6 Jul 2017 16:43:52 +0000 (12:43 -0400)]
media: staging: atomisp: gc2235: constify acpi_device_id

acpi_device_id are not supposed to change at runtime. All functions
working with acpi_device_id provided by <acpi/acpi_bus.h> work with
const acpi_device_id. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
  10754    1360       4   12118    2f56
drivers/staging/media/atomisp/i2c/gc2235.o

File size After adding 'const':
   text    data     bss     dec     hex filename
  10818    1296       4   12118    2f56
drivers/staging/media/atomisp/i2c/gc2235.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: mt9m114: constify acpi_device_id
Arvind Yadav [Thu, 6 Jul 2017 16:40:45 +0000 (12:40 -0400)]
media: staging: atomisp: mt9m114: constify acpi_device_id

acpi_device_id are not supposed to change at runtime. All functions
working with acpi_device_id provided by <acpi/acpi_bus.h> work with
const acpi_device_id. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
  15148    2640       8   17796    4584
drivers/staging/media/atomisp/i2c/mt9m114.o

File size After adding 'const':
   text    data     bss     dec     hex filename
  15244    2512       8   17764    4564
drivers/staging/media/atomisp/i2c/mt9m114.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: ov5693: constify acpi_device_id
Arvind Yadav [Thu, 6 Jul 2017 16:36:36 +0000 (12:36 -0400)]
media: staging: atomisp: ov5693: constify acpi_device_id

acpi_device_id are not supposed to change at runtime. All functions
working with acpi_device_id provided by <acpi/acpi_bus.h> work with
const acpi_device_id. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
  20729    3264       0   23993    5db9
drivers/staging/media/atomisp/i2c/ov5693/ov5693.o

File size After adding 'const':
   text    data     bss     dec     hex filename
  20793    3200       0   23993    5db9
drivers/staging/media/atomisp/i2c/ov5693/ov5693.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: ov2722: constify acpi_device_id
Arvind Yadav [Thu, 6 Jul 2017 16:30:47 +0000 (12:30 -0400)]
media: staging: atomisp: ov2722: constify acpi_device_id

acpi_device_id are not supposed to change at runtime. All functions
working with acpi_device_id provided by <acpi/acpi_bus.h> work with
const acpi_device_id. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
  14771    1880       0   16651    410b drivers/staging/media/atomisp/i2c/ov2722.o

File size After adding 'const':
   text    data     bss     dec     hex filename
  14835    1816       0   16651    410b drivers/staging/media/atomisp/i2c/ov2722.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: gc0310: constify acpi_device_id
Arvind Yadav [Thu, 6 Jul 2017 16:20:56 +0000 (12:20 -0400)]
media: staging: atomisp: gc0310: constify acpi_device_id

acpi_device_id are not supposed to change at runtime. All functions
working with acpi_device_id provided by <acpi/acpi_bus.h> work with
const acpi_device_id. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
  10297    1888       0   12185    2f99 drivers/staging/media/atomisp/i2c/gc0310.o

File size After adding 'const':
   text    data     bss     dec     hex filename
  10361    1824       0   12185    2f99 drivers/staging/media/atomisp/i2c/gc0310.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: ov8858: constify acpi_device_id
Arvind Yadav [Thu, 6 Jul 2017 16:14:36 +0000 (12:14 -0400)]
media: staging: atomisp: ov8858: constify acpi_device_id

acpi_device_id are not supposed to change at runtime. All functions
working with acpi_device_id provided by <acpi/acpi_bus.h> work with
const acpi_device_id. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
  23804    8448       0   32252    7dfc drivers/staging/media/atomisp/i2c/ov8858.o

File size After adding 'const':
   text    data     bss     dec     hex filename
  23868    8384       0   32252    7dfc drivers/staging/media/atomisp/i2c/ov8858.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: ov2680: constify acpi_device_id
Arvind Yadav [Thu, 6 Jul 2017 16:07:08 +0000 (12:07 -0400)]
media: staging: atomisp: ov2680: constify acpi_device_id

acpi_device_id are not supposed to change at runtime. All functions
working with acpi_device_id provided by <acpi/acpi_bus.h> work with
const acpi_device_id. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
  12466    3120       8   15594    3cea drivers/staging/media/atomisp/i2c/ov2680.o

File size After adding 'const':
   text    data     bss     dec     hex filename
  12530    3056       8   15594    3cea drivers/staging/media/atomisp/i2c/ov2680.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: lm3554: constify acpi_device_id
Arvind Yadav [Thu, 6 Jul 2017 15:56:29 +0000 (11:56 -0400)]
media: staging: atomisp: lm3554: constify acpi_device_id

acpi_device_id are not supposed to change at runtime. All functions
working with acpi_device_id provided by <acpi/acpi_bus.h> work with
const acpi_device_id. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
   5347    1920      24    7291    1c7b drivers/staging/media/atomisp/i2c/lm3554.o

File size After adding 'const':
   text    data     bss     dec     hex filename
   5411    1856      24    7291    1c7b drivers/staging/media/atomisp/i2c/lm3554.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: i2c: ov5693: Fix style a coding style issue
Ivan Menshykov [Wed, 5 Jul 2017 10:07:45 +0000 (06:07 -0400)]
media: staging: atomisp: i2c: ov5693: Fix style a coding style issue

Fix checkpath errors

Signed-off-by: Ivan Menshykov <ivan.menshykov@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: gc2235: fix sparse warning: missing static
Guillermo O. Freschi [Tue, 4 Jul 2017 20:46:43 +0000 (16:46 -0400)]
media: staging: atomisp: gc2235: fix sparse warning: missing static

Several local use structs were missing declarations. Added static
qualifier to clean up Sparse warning.

Signed-off-by: Guillermo O. Freschi <kedrot@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: staging: atomisp: Remove unnecessary return statement in void function
Amitoj Kaur Chawla [Thu, 29 Jun 2017 23:32:50 +0000 (19:32 -0400)]
media: staging: atomisp: Remove unnecessary return statement in void function

Return statement at the end of a void function is useless.

The Coccinelle semantic patch used to make this change is as follows:
//<smpl>
@@
identifier f;
expression e;
@@
void f(...) {
<...
- return
  e;
  ...>
  }
//</smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: i2c: Add Omnivision OV5670 5M sensor support
Chiranjeevi Rapolu [Fri, 14 Jul 2017 01:51:27 +0000 (21:51 -0400)]
media: i2c: Add Omnivision OV5670 5M sensor support

Provides single source pad with up to 2592x1944 pixels at 10-bit raw
bayer format over MIPI CSI2 two lanes at 840Mbps/lane.
The driver supports following features:
- up to  30fps at 5M pixels
- manual exposure
- digital/analog gain
- V-blank/H-blank
- test pattern
- media controller
- runtime pm

[mchehab@s-opensource.com: fix a trivial merge conflict at Makefile]
Signed-off-by: Chiranjeevi Rapolu <chiranjeevi.rapolu@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: MAINTAINERS: Change OV5647 Maintainer
Ramiro Oliveira [Mon, 10 Jul 2017 14:18:03 +0000 (10:18 -0400)]
media: MAINTAINERS: Change OV5647 Maintainer

Signed-off-by: Ramiro Oliveira <roliveir@synopsys.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: smiapp: make various const arrays static
Colin Ian King [Mon, 10 Jul 2017 18:29:47 +0000 (14:29 -0400)]
media: smiapp: make various const arrays static

Don't populate const arrays on the stack but instead make them static.
Makes the object code smaller and saves nearly 550 bytes.

Before:
   text    data     bss     dec     hex filename
   3638     752       0    4390    1126 smiapp-quirk.o

After:
   text    data     bss     dec     hex filename
   2802    1040       0    3842     f02 smiapp-quirk.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: docs-rst: v4l: Fix sink compose selection target documentation
Sakari Ailus [Fri, 7 Jul 2017 14:17:16 +0000 (10:17 -0400)]
media: docs-rst: v4l: Fix sink compose selection target documentation

The rectangle which the sink compose rectangle is related to is documented
to be the source compose bounds rectangle. This is in obvious conflict with
the ground rule of the format propagation (from sink to source). The reason
behind this is that this was always supposed to be the sink compose bounds
rectangle. Fix it.

Fixes: 955f645aea04 ("[media] v4l: Add subdev selections documentation")

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: ov5645: Add control to export CSI2 link frequency
Todor Tomov [Wed, 5 Jul 2017 08:44:49 +0000 (04:44 -0400)]
media: ov5645: Add control to export CSI2 link frequency

Add suport for standard integer menu V4L2_CID_LINK_FREQ control.
The CSI2 link frequency value is specific for each sensor mode so the
sensor mode structure is extended to add this. The control is made
read-only and its value is updated when the sensor mode is changed -
on set_format.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: ov5645: Add control to export pixel clock frequency
Todor Tomov [Wed, 5 Jul 2017 08:44:48 +0000 (04:44 -0400)]
media: ov5645: Add control to export pixel clock frequency

Add suport for standard V4L2_CID_PIXEL_RATE control. The pixel clock
frequency value is specific for each sensor mode so the sensor mode
structure is extended to add this. The control is read-only and its
value is updated when the sensor mode is changed - on set_format.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: ov5645: Set media entity function
Todor Tomov [Wed, 5 Jul 2017 08:44:47 +0000 (04:44 -0400)]
media: ov5645: Set media entity function

Set media entity function to MEDIA_ENT_F_CAM_SENSOR.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: omap3isp: Ignore endpoints with invalid configuration
Sakari Ailus [Tue, 28 Feb 2017 11:53:27 +0000 (06:53 -0500)]
media: omap3isp: Ignore endpoints with invalid configuration

If endpoint has an invalid configuration, ignore it instead of happily
proceeding to use it nonetheless. Ignoring such an endpoint is better than
failing since there could be multiple endpoints, only some of which are
bad.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: omap3isp: Return -EPROBE_DEFER if the required regulators can't be obtained
Pavel Machek [Thu, 2 Mar 2017 12:45:32 +0000 (07:45 -0500)]
media: omap3isp: Return -EPROBE_DEFER if the required regulators can't be obtained

If regulator returns -EPROBE_DEFER, we need to return it too, so that
omap3isp will be re-probed when regulator is ready.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: omap3isp: add CSI1 support
Pavel Machek [Thu, 13 Jul 2017 10:36:59 +0000 (06:36 -0400)]
media: omap3isp: add CSI1 support

CSI-2 PHY power management is only needed for major version 15 of the ISP.
Additionally, set the CCP2 PHY for previous ISP versions as well.

These changes are necessary for CCP2 support.

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 agomedia: omap3isp: Explicitly set the number of CSI-2 lanes used in lane cfg
Sakari Ailus [Thu, 13 Jul 2017 16:11:32 +0000 (12:11 -0400)]
media: omap3isp: Explicitly set the number of CSI-2 lanes used in lane cfg

The omap3isp driver extracts the CSI-2 lane configuration from the V4L2
fwnode endpoint but misses the number of lanes itself. Get this information
and use it in PHY configuration.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: omap3isp: Destroy CSI-2 phy mutexes in error and module removal
Sakari Ailus [Sat, 4 Mar 2017 15:07:08 +0000 (10:07 -0500)]
media: omap3isp: Destroy CSI-2 phy mutexes in error and module removal

The CSI-2 phy driver did initialise mutexes in its init function but there
was no corresponding cleanup function destroying them. Fix that. Also
clean up ISP module initialisation a little.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: omap3isp: Check for valid port in endpoints
Sakari Ailus [Tue, 28 Feb 2017 12:38:44 +0000 (07:38 -0500)]
media: omap3isp: Check for valid port in endpoints

Check that we do have a valid port in an endpoint, return an error if not.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Tested-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: smiapp: add CCP2 support
Pavel Machek [Tue, 14 Feb 2017 22:39:09 +0000 (17:39 -0500)]
media: smiapp: add CCP2 support

Add support for CCP2 connected SMIA sensors as found
on the Nokia N900.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
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 agomedia: v4l: Add support for CSI-1 and CCP2 busses
Sakari Ailus [Wed, 25 Feb 2015 19:39:11 +0000 (14:39 -0500)]
media: v4l: Add support for CSI-1 and CCP2 busses

CCP2 and CSI-1, are older single data lane serial busses.

[mchehab@s-opensource.com: don't use spaces for identation]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: v4l: fwnode: Obtain data bus type from FW
Sakari Ailus [Wed, 25 Feb 2015 19:51:01 +0000 (14:51 -0500)]
media: v4l: fwnode: Obtain data bus type from FW

Just obtain it. It'll actually get used soon with CSI-1/CCP2.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Tested-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: v4l: fwnode: Call CSI2 bus csi2, not csi
Sakari Ailus [Mon, 20 Feb 2017 10:42:09 +0000 (05:42 -0500)]
media: v4l: fwnode: Call CSI2 bus csi2, not csi

The function to parse CSI2 bus parameters was called
v4l2_fwnode_endpoint_parse_csi_bus(), rename it as
v4l2_fwnode_endpoint_parse_csi2_bus() in anticipation of CSI1/CCP2
support.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Tested-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dt: bindings: Add strobe property for CCP2
Sakari Ailus [Wed, 8 Feb 2017 08:23:31 +0000 (03:23 -0500)]
media: dt: bindings: Add strobe property for CCP2

Document the CSI1/CCP2 property strobe. It signifies the clock or
strobe mode.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: dt: bindings: Explicitly specify bus type
Sakari Ailus [Mon, 6 Feb 2017 09:49:57 +0000 (04:49 -0500)]
media: dt: bindings: Explicitly specify bus type

In the vast majority of cases the bus type is known to the driver(s)
since a receiver or transmitter can only support a single one. There
are cases however where different options are possible, or the bus type
cannot be automatically detected.

The existing V4L2 OF support tries to figure out the bus type and
parse the bus parameters based on that. This does not scale too well
as there are multiple serial busses that share common properties.

Some hardware also supports multiple types of busses on the same
interfaces.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: coda: wake up capture queue on encoder stop after output streamoff
Philipp Zabel [Mon, 17 Jul 2017 10:43:15 +0000 (06:43 -0400)]
media: coda: wake up capture queue on encoder stop after output streamoff

If an encoder stop command is issued after the output queue has already
stopped streaming, the qsequence counter has been reset to 0. Always
wake up the capture queue if the output queue is not streaming.

Signed-off-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 agomedia: coda: mark CODA960 firmware versions 2.3.10 and 3.1.1 as supported
Philipp Zabel [Fri, 7 Jul 2017 09:58:31 +0000 (05:58 -0400)]
media: coda: mark CODA960 firmware versions 2.3.10 and 3.1.1 as supported

Firmware versions 2.3.10 revision 40778 and 3.1.1 revision 46072 are
contained in the i.MX firmware download archives provided by NXP at
http://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-3.5.7-1.0.0.bin
and http://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-5.4.bin,
respectively.

Signed-off-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 agomedia: coda: set MPEG-4 encoder class register
Philipp Zabel [Fri, 7 Jul 2017 09:58:30 +0000 (05:58 -0400)]
media: coda: set MPEG-4 encoder class register

Explicitly set MPEG-4 encoder class register instead of relying on the
default value of 0.

Signed-off-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 agomedia: coda: align internal mpeg4 framebuffers to 16x16 macroblocks
Philipp Zabel [Fri, 7 Jul 2017 09:58:29 +0000 (05:58 -0400)]
media: coda: align internal mpeg4 framebuffers to 16x16 macroblocks

This fixes visual artifacts in the first macroblock row of encoded
MPEG-4 video output caused by 8 additional lines of luma data leaking
into the chroma planes of the internal reference framebuffers: the
buffer size is rounded up to a multiple of 16x16 macroblock size, same
as for the h.264 encoder.

Signed-off-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 agomedia: coda: set field of destination buffers
Philipp Zabel [Fri, 7 Jul 2017 09:58:28 +0000 (05:58 -0400)]
media: coda: set field of destination buffers

Set the field of destination buffers properly.

Signed-off-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 agomedia: coda: extend GOP size range
Philipp Zabel [Fri, 7 Jul 2017 09:58:27 +0000 (05:58 -0400)]
media: coda: extend GOP size range

CodaDx6 only accepts GOP sizes up to 60 frames, but CODA960 can handle
up to 99 frames. If we disable automatic I frame generation altogether
by setting GOP size to 0, we can let an application produce arbitrarily
large I frame intervals using the V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME
control.

Signed-off-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 agomedia: coda: do not reassign ctx->tiled_map_type in coda_s_fmt
Philipp Zabel [Fri, 23 Jun 2017 11:57:27 +0000 (07:57 -0400)]
media: coda: do not reassign ctx->tiled_map_type in coda_s_fmt

This smatch warning:

    coda/coda-common.c:706 coda_s_fmt() warn: missing break? reassigning 'ctx->tiled_map_type'

can be silenced by moving the ctx->tiled_map_type assignment into the
breakout condition. That way the field is not reassigned when falling
through to the next switch statement.

Signed-off-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 agomedia: coda: add h264 and mpeg4 profile and level controls
Philipp Zabel [Fri, 23 Jun 2017 09:55:29 +0000 (05:55 -0400)]
media: coda: add h264 and mpeg4 profile and level controls

CODA7541 supports H.264 BP level 3/3.1 and MPEG-4 SP level 5/6.
CODA960 supports H.264 BP level 4.0 and MPEG-4 SP level 5/6.

Implement the necessary profile and level controls to let userspace know
this.

Signed-off-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 agomedia: davinci: vpif_capture: fix potential NULL deref
Kevin Hilman [Tue, 11 Jul 2017 19:07:52 +0000 (15:07 -0400)]
media: davinci: vpif_capture: fix potential NULL deref

Fix potential NULL pointer dereference in the error path of memory
allocation failure.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
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 agomedia: fc001[23]: make const gain table arrays static
Colin Ian King [Tue, 11 Jul 2017 09:43:49 +0000 (05:43 -0400)]
media: fc001[23]: make const gain table arrays static

Don't populate the gain tables on the stack but make them static const.
Makes the object code smaller:

Before:
   text    data     bss     dec     hex filename
   7801    1408       0    9209    23f9 drivers/media/tuners/fc0012.o
   8483     936       0    9419    24cb drivers/media/tuners/fc0013.o

After:
   text    data     bss     dec     hex filename
   7696    1464       0    9160    23c8 drivers/media/tuners/fc0012.o
   8362    1024       0    9386    24aa drivers/media/tuners/fc0013.o

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 agomedia: solo6x10: make const array saa7128_regs_ntsc static
Colin Ian King [Mon, 10 Jul 2017 18:51:03 +0000 (14:51 -0400)]
media: solo6x10: make const array saa7128_regs_ntsc static

Don't populate const array saa7128_regs_ntsc on the stack but insteaed make
it static.  Makes the object code smaller and saves nearly 840 bytes

Before:
   text    data     bss     dec     hex filename
   9218     360       0    9578    256a solo6x10-tw28.o

After:
   text    data     bss     dec     hex filename
   8237     504       0    8741    2225 solo6x10-tw28.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Andrey Utkin <andrey_utkin@fastmail.com>
Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: platform: video-mux: fix Kconfig dependency
Arnd Bergmann [Mon, 10 Jul 2017 08:48:43 +0000 (04:48 -0400)]
media: platform: video-mux: fix Kconfig dependency

When CONFIG_V4L2 is built as a loadable module, the new video mux driver
fails to link as built-in code:

drivers/media/platform/video-mux.o: In function `video_mux_remove':
video-mux.c:(.text+0x24): undefined reference to `v4l2_async_unregister_subdev'
drivers/media/platform/video-mux.o: In function `video_mux_probe':
video-mux.c:(.text+0x800): undefined reference to `v4l2_subdev_init'
video-mux.c:(.text+0xa10): undefined reference to `v4l2_async_register_subdev'

This makes it use the same Kconfig dependency as all the other users of
the VIDEO_V4L2_SUBDEV_API symbol.

Fixes: 68803ad4522f ("[media] platform: add video-multiplexer subdevice driver")

Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: mediatek: constify vb2_ops structure
Gustavo A. R. Silva [Thu, 6 Jul 2017 20:51:27 +0000 (16:51 -0400)]
media: mediatek: constify vb2_ops structure

Check for vb2_ops structures that are only stored in the ops field of a
vb2_queue structure. That field is declared const, so vb2_ops structures
that have this property can be declared as const also.

This issue was detected using Coccinelle and the following semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p = { ... };

@ok@
identifier r.i;
struct vb2_queue e;
position p;
@@
e.ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct vb2_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct vb2_ops i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: mtk-mdp: constify vb2_ops structure
Gustavo A. R. Silva [Thu, 6 Jul 2017 20:46:00 +0000 (16:46 -0400)]
media: mtk-mdp: constify vb2_ops structure

Check for vb2_ops structures that are only stored in the ops field of a
vb2_queue structure. That field is declared const, so vb2_ops structures
that have this property can be declared as const also.

This issue was detected using Coccinelle and the following semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p = { ... };

@ok@
identifier r.i;
struct vb2_queue e;
position p;
@@
e.ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct vb2_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct vb2_ops i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: davinci: vpif_capture: constify vb2_ops structure
Gustavo A. R. Silva [Thu, 6 Jul 2017 20:39:21 +0000 (16:39 -0400)]
media: davinci: vpif_capture: constify vb2_ops structure

Check for vb2_ops structures that are only stored in the ops field of a
vb2_queue structure. That field is declared const, so vb2_ops structures
that have this property can be declared as const also.

This issue was detected using Coccinelle and the following semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p = { ... };

@ok@
identifier r.i;
struct vb2_queue e;
position p;
@@
e.ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct vb2_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct vb2_ops i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: davinci: vpif_display: constify vb2_ops structure
Gustavo A. R. Silva [Thu, 6 Jul 2017 20:35:53 +0000 (16:35 -0400)]
media: davinci: vpif_display: constify vb2_ops structure

Check for vb2_ops structures that are only stored in the ops field of a
vb2_queue structure. That field is declared const, so vb2_ops structures
that have this property can be declared as const also.

This issue was detected using Coccinelle and the following semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p = { ... };

@ok@
identifier r.i;
struct vb2_queue e;
position p;
@@
e.ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct vb2_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct vb2_ops i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: atmel-isc: constify vb2_ops structure
Gustavo A. R. Silva [Thu, 6 Jul 2017 20:30:16 +0000 (16:30 -0400)]
media: atmel-isc: constify vb2_ops structure

Check for vb2_ops structures that are only stored in the ops field of a
vb2_queue structure. That field is declared const, so vb2_ops structures
that have this property can be declared as const also.

This issue was detected using Coccinelle and the following semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p = { ... };

@ok@
identifier r.i;
struct vb2_queue e;
position p;
@@
e.ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct vb2_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct vb2_ops i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: rcar_fdp1: constify vb2_ops structure
Gustavo A. R. Silva [Thu, 6 Jul 2017 20:25:32 +0000 (16:25 -0400)]
media: rcar_fdp1: constify vb2_ops structure

Check for vb2_ops structures that are only stored in the ops field of a
vb2_queue structure. That field is declared const, so vb2_ops structures
that have this property can be declared as const also.

This issue was detected using Coccinelle and the following semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p = { ... };

@ok@
identifier r.i;
struct vb2_queue e;
position p;
@@
e.ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct vb2_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct vb2_ops i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: pxa_camera: constify vb2_ops structure
Gustavo A. R. Silva [Thu, 6 Jul 2017 20:20:00 +0000 (16:20 -0400)]
media: pxa_camera: constify vb2_ops structure

Check for vb2_ops structures that are only stored in the ops field of a
vb2_queue structure. That field is declared const, so vb2_ops structures
that have this property can be declared as const also.

This issue was detected using Coccinelle and the following semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p = { ... };

@ok@
identifier r.i;
struct vb2_queue e;
position p;
@@
e.ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct vb2_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct vb2_ops i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: st-delta: constify vb2_ops structures
Gustavo A. R. Silva [Thu, 6 Jul 2017 20:14:23 +0000 (16:14 -0400)]
media: st-delta: constify vb2_ops structures

Check for vb2_ops structures that are only stored in the ops field of a
vb2_queue structure. That field is declared const, so vb2_ops structures
that have this property can be declared as const also.

This issue was detected using Coccinelle and the following semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p = { ... };

@ok@
identifier r.i;
struct vb2_queue e;
position p;
@@
e.ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct vb2_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct vb2_ops i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Acked-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: stm32-dcmi: constify vb2_ops structure
Gustavo A. R. Silva [Thu, 6 Jul 2017 20:05:17 +0000 (16:05 -0400)]
media: stm32-dcmi: constify vb2_ops structure

Check for vb2_ops structures that are only stored in the ops field of a
vb2_queue structure. That field is declared const, so vb2_ops structures
that have this property can be declared as const also.

This issue was detected using Coccinelle and the following semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p = { ... };

@ok@
identifier r.i;
struct vb2_queue e;
position p;
@@
e.ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct vb2_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct vb2_ops i = { ... };

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Acked-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: tuners: remove unnecessary static in simple_dvb_configure()
Gustavo A. R. Silva [Wed, 5 Jul 2017 18:23:55 +0000 (14:23 -0400)]
media: tuners: remove unnecessary static in simple_dvb_configure()

Remove unnecessary static on local variable t_params.
Such variable is initialized before being used,
on every execution path throughout the function.
The static has no benefit and, removing it reduces
the code size.

This issue was detected using Coccinelle and the following semantic patch:

@bad exists@
position p;
identifier x;
type T;
@@

static T x@p;
...
x = <+...x...+>

@@
identifier x;
expression e;
type T;
position p != bad.p;
@@

-static
 T x@p;
 ... when != x
     when strict
?x = e;

In the following log you can see the difference in the code size. Also,
there is a significant difference in the bss segment. This log is the
output of the size command, before and after the code change:

before:
   text    data     bss     dec     hex filename
  23314    3640     832   27786    6c8a drivers/media/tuners/tuner-simple.o

after:
   text    data     bss     dec     hex filename
  23257    3552     768   27577    6bb9 drivers/media/tuners/tuner-simple.o

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: media/i2c/saa717x: fix spelling mistake: "implementd" -> "implemented"
Colin Ian King [Mon, 3 Jul 2017 09:26:39 +0000 (05:26 -0400)]
media: media/i2c/saa717x: fix spelling mistake: "implementd" -> "implemented"

Trivial fix to spelling mistake in v4l2_dbg debug 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 agomedia: i2c: m5mols: fix spelling mistake: "Machanics" -> "Mechanics"
Colin Ian King [Mon, 3 Jul 2017 09:13:08 +0000 (05:13 -0400)]
media: i2c: m5mols: fix spelling mistake: "Machanics" -> "Mechanics"

Trivial fix to spelling mistake in v4l2_info 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 agomedia: vb2 dma-sg: Constify dma_buf_ops structures
Arvind Yadav [Sat, 1 Jul 2017 12:18:24 +0000 (08:18 -0400)]
media: vb2 dma-sg: Constify dma_buf_ops structures

dma_buf_ops are not supposed to change at runtime. All functions
working with dma_buf_ops provided by <linux/dma-buf.h> work with
const dma_buf_ops. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
   5238     112       4    5354    14ea drivers/media/v4l2-core/videobuf2-dma-sg.o

File size After adding 'const':
   text    data     bss     dec     hex filename
   5358       0       4    5362    14f2 drivers/media/v4l2-core/videobuf2-dma-sg.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: vb2 vmalloc: Constify dma_buf_ops structures
Arvind Yadav [Sat, 1 Jul 2017 11:37:26 +0000 (07:37 -0400)]
media: vb2 vmalloc: Constify dma_buf_ops structures

dma_buf_ops are not supposed to change at runtime. All functions
working with dma_buf_ops provided by <linux/dma-buf.h> work with
const dma_buf_ops. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
   3171     192       0    3363     d23 drivers/media/v4l2-core/videobuf2-vmalloc.o

File size After adding 'const':
   text    data     bss     dec     hex filename
   3291      80       0    3371     d2b drivers/media/v4l2-core/videobuf2-vmalloc.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: vb2 dma-contig: Constify dma_buf_ops structures
Arvind Yadav [Sat, 1 Jul 2017 11:27:13 +0000 (07:27 -0400)]
media: vb2 dma-contig: Constify dma_buf_ops structures

dma_buf_ops are not supposed to change at runtime. All functions
working with dma_buf_ops provided by <linux/dma-buf.h> work with
const dma_buf_ops. So mark the non-const structs as const.

File size before:
   text    data     bss     dec     hex filename
   6035     272       0    6307    18a3 drivers/media/v4l2-core/videobuf2-dma-contig.o

File size After adding 'const':
   text    data     bss     dec     hex filename
   6155     160       0    6315    18ab drivers/media/v4l2-core/videobuf2-dma-contig.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cx23885: add const to v4l2_file_operations structure
Bhumika Goyal [Thu, 29 Jun 2017 08:59:19 +0000 (04:59 -0400)]
media: cx23885: add const to v4l2_file_operations structure

Declare v4l2_file_operations structure as const as it is only stored
in the fops field of video_device structure. This field is of type
const, so declare v4l2_file_operations structures with similar properties
as const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: media/platform: add const to v4l2_file_operations structures
Bhumika Goyal [Thu, 29 Jun 2017 08:51:24 +0000 (04:51 -0400)]
media: media/platform: add const to v4l2_file_operations structures

Declare v4l2_file_operations structures as const as they are only stored
in the fops field of video_device structures. This field is of type
const, so declare v4l2_file_operations structures with similar properties
as const.

Cross compiled bfin_capture.o for blackfin arch. vpbe_display.o file did
not cross compile for arm. Could not find any architecture matching the
configuraion symbol for fsl-viu.c file.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cec-core: fix a Sphinx warning
Mauro Carvalho Chehab [Wed, 19 Jul 2017 18:29:06 +0000 (14:29 -0400)]
media: cec-core: fix a Sphinx warning

/devel/v4l/patchwork/Documentation/media/kapi/cec-core.rst:369: WARNING: Title underline too short.

CEC Notifier framework
-----------------

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: pulse8-cec/rainshadow-cec: make adapter name unique
Hans Verkuil [Sat, 15 Jul 2017 21:47:40 +0000 (18:47 -0300)]
media: pulse8-cec/rainshadow-cec: make adapter name unique

The CEC adapter name used by the pulse8-cec and rainshadow-cec USB device drivers
was a fixed string, but it should be unique if you connect multiple of these devices
to the same computer.

Use dev_name(&serio->dev) instead, which make it unique again.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cec: drop senseless message
Hans Verkuil [Sat, 15 Jul 2017 12:30:37 +0000 (09:30 -0300)]
media: cec: drop senseless message

Especially the '0.10' version number is confusing since CEC_ADAP_G_CAPS
returns a completely different version number.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cec: move cec_register_cec_notifier to cec-notifier.h
Hans Verkuil [Thu, 13 Jul 2017 07:07:23 +0000 (04:07 -0300)]
media: cec: move cec_register_cec_notifier to cec-notifier.h

The cec_register_cec_notifier function was in media/cec.h, but it
has to be in cec-notifier.h.

While we are at it, also document it and add a stub function for when
the notifier is disabled or the CEC core code is unreachable.

Based on an earlier patch from Jose Abreu <Jose.Abreu@synopsys.com>.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: pulse8-cec.rst: add documentation for the pulse8-cec driver
Hans Verkuil [Sun, 16 Jul 2017 08:18:50 +0000 (05:18 -0300)]
media: pulse8-cec.rst: add documentation for the pulse8-cec driver

Document the persistent_config module option.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cec: be smarter about detecting the number of attempts made
Hans Verkuil [Tue, 11 Jul 2017 11:20:18 +0000 (08:20 -0300)]
media: cec: be smarter about detecting the number of attempts made

Some hardware does more than one attempt. So when it calls
cec_transmit_done when an error occurred it will e.g. use an error count
of 2 instead of 1.

The framework always assumed a single attempt, but now it is smarter
and will sum the counters to detect how many attempts were made.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cec-core.rst: include cec-pin.h and cec-notifier.h
Hans Verkuil [Tue, 11 Jul 2017 06:30:43 +0000 (03:30 -0300)]
media: cec-core.rst: include cec-pin.h and cec-notifier.h

Include the CEC pin framework documentation by reading cec-pin.h.
Include the CEC notifier framework documentation by reading cec-notifier.h.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cec-pin: add low-level pin hardware support
Hans Verkuil [Tue, 11 Jul 2017 06:30:42 +0000 (03:30 -0300)]
media: cec-pin: add low-level pin hardware support

Add support for CEC hardware that relies on low-level pin polling or
GPIO interrupts.

One example is the Allwinner SoC. But any GPIO-based CEC implementation can
use this as well.

A GPIO implementation is very suitable as well for debugging: it can use
interrupts to detect state changes and report it. Userspace can then verify
if the bus traffic is correct. This also makes error injection possible.

The disadvantage is that it is hard to get the timings right since linux
isn't a hard realtime system.

In general on an idle system it works quite well, but under load the timer
will miss its mark every so often.

The debugfs file /sys/kernel/debug/cec/cecX/status gives some statistics
with respect to the timer overruns.

When the adapter is unconfigured and the low-level driver supports
interrupts, then the interrupt will be used to detect changes. This should
be quite accurate. But when the adapter is configured a hrtimer has to be
used.

The hrtimer implements a state machine where for each state the code will
read the bus or drive the bus and go on to the next state. It will re-arm
the timer with a delay based on the next state.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cec: add core support for low-level CEC pin monitoring
Hans Verkuil [Tue, 11 Jul 2017 06:30:41 +0000 (03:30 -0300)]
media: cec: add core support for low-level CEC pin monitoring

Add support for the new MONITOR_PIN mode.

Add the cec_pin_event function that the CEC pin code will call to queue pin
change events.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cec: document the new CEC pin capability, events and mode
Hans Verkuil [Tue, 11 Jul 2017 06:30:40 +0000 (03:30 -0300)]
media: cec: document the new CEC pin capability, events and mode

Document CEC_CAP_MONITOR_PIN, CEC_EVENT_PIN_LOW/HIGH,
CEC_EVENT_FL_DROPPED_EVENTS and CEC_MODE_MONITOR_PIN.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cec: rework the cec event handling
Hans Verkuil [Tue, 11 Jul 2017 06:30:39 +0000 (03:30 -0300)]
media: cec: rework the cec event handling

Event handling was always fairly simplistic since there were only
two events. With the addition of pin events this needed to be redesigned.

The state_change and lost_msgs events are now core events with the
guarantee that the last state is always available. The new pin events
are a queue of events (up to 64 for each event) and the oldest event
will be dropped if the application cannot keep up. Lost events are
marked with a new event flag.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: linux/cec.h: add pin monitoring API support
Hans Verkuil [Tue, 11 Jul 2017 06:30:38 +0000 (03:30 -0300)]
media: linux/cec.h: add pin monitoring API support

Add support for low-level CEC pin monitoring. This adds a new monitor
mode, a new capability and two new events.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cec-core.rst: document the adap_free callback
Hans Verkuil [Tue, 11 Jul 2017 06:30:37 +0000 (03:30 -0300)]
media: cec-core.rst: document the adap_free callback

Document what this callback does.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cec: add adap_free op
Hans Verkuil [Tue, 11 Jul 2017 06:30:36 +0000 (03:30 -0300)]
media: cec: add adap_free op

This is needed for CEC adapters that allocate resources that have
to be freed before the cec_adapter is deleted.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cec: add *_ts variants for transmit_done/received_msg
Hans Verkuil [Tue, 11 Jul 2017 06:30:35 +0000 (03:30 -0300)]
media: cec: add *_ts variants for transmit_done/received_msg

Currently the transmit_(attempt_)done and received_msg functions set
the timestamp themselves. For the upcoming low-level pin API we need
to pass this as an argument instead. So make _ts variants that allow
the caller to specify the timestamp.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cec: improve transmit timeout logging
Hans Verkuil [Tue, 11 Jul 2017 06:30:34 +0000 (03:30 -0300)]
media: cec: improve transmit timeout logging

Kernel logging messes up the upcoming low-level CEC monitoring support
which is very time-sensitive. So change the debug level of this message
but keep a counter that is shown in the debugfs status log.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agomedia: cec: only increase the seqnr if CEC_TRANSMIT would return 0
Hans Verkuil [Thu, 6 Jul 2017 14:09:52 +0000 (11:09 -0300)]
media: cec: only increase the seqnr if CEC_TRANSMIT would return 0

The transmit code would increase the sequence number first thing, even though
CEC_TRANSMIT would return an error due to a malformatted cec_msg struct later
on.

While valid behavior, this had the disadvantage of producing holes in the
sequence list that made debugging harder.

Only increase the sequence number when the whole message is validated.
When debugging (i.e. with cec-ctl -M) the sequence numbering is now nicely
increasing by 1 per message.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>