platform/kernel/linux-rpi.git
7 years ago[media] tc358743: Disable HDCP with "manual HDCP authentication" bit
Mats Randgaard [Tue, 6 Dec 2016 10:24:28 +0000 (08:24 -0200)]
[media] tc358743: Disable HDCP with "manual HDCP authentication" bit

Originally Toshiba told us that the only way to disable HDCP was to
set the receiver in repeater mode, that would make the authentication
fail because of missing software support. It has worked fine with all
the sources we and our customers has used, until it was reported
problems with Apple MacBook (Retina, 12-inch, Early 2015)
(https://support.apple.com/kb/SP712?locale=en_US&viewlocale=en_US)
with Apple A1612 USB type-C multiport adapter
(http://www.apple.com/shop/product/MJ1K2AM/A/usb-c-digital-av-multiport-adapter)

Finally Toshiba came up with a hidden bit that is named "Manual HDCP
authentication". In this patch the original "repeater mode" concept is
removed, and the new bit is set instead.

With his patch HDCP is disabled when connected to the Apple MacBook
and all other sources we have tested so far. The Apple MacBook is
constantly trying to authenticate, but fails and continues to transmit
unencrypted video.

Signed-off-by: Mats Randgaard <matrandg@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] tc358743: Do not read number of CSI lanes in use from chip
Mats Randgaard [Tue, 6 Dec 2016 10:24:27 +0000 (08:24 -0200)]
[media] tc358743: Do not read number of CSI lanes in use from chip

The number of CSI lanes that should be used is set to the CSI_CONTROL
register by indirectly writing to the CSI_CONFW register. When the
number of lanes is read back from the CSI_CONTROL register the value
is usually correct, but we have seen that it suddenly is 1 for a short
moment before the correct value is restored again.

Toshiba have not figured out why that happen, but we have found it
safer to store the value in the driver.

Signed-off-by: Mats Randgaard <matrandg@cisco.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: platform: s3c-camif: constify v4l2_subdev_ops structures
Bhumika Goyal [Wed, 14 Dec 2016 11:11:10 +0000 (09:11 -0200)]
[media] media: platform: s3c-camif: constify v4l2_subdev_ops structures

Check for v4l2_subdev_ops structures that are only passed as an
argument to the function v4l2_subdev_init. This argument is of type
const, so v4l2_subdev_ops structures having this property can also  be
declared const.
Done using Coccinelle:

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

@ok1@
identifier r1.i;
position p;
@@
v4l2_subdev_init(...,&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
  17171    1912      20   19103    4a9f
platform/s3c-camif/camif-capture.o

File size after:
   text    data     bss     dec     hex filename
  17235    1848      20   19103    4a9f
platform/s3c-camif/camif-capture.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dib7000p: avoid division by zero
Martin Wache [Tue, 13 Dec 2016 20:21:41 +0000 (18:21 -0200)]
[media] dib7000p: avoid division by zero

dib7000p_read_word() may return zero on i2c errors, resulting in
dib7000p_get_internal_freq() returning zero.
So don't divide by the result of dib7000p_get_internal_freq()
without checking it for zero in dib7000p_set_dds().

On one of my machines the device
ID 2304:0229 Pinnacle Systems, Inc. PCTV Dual DVB-T 2001e
about once a day/every two days gets into a state, where
most (all?) I2C reads return with an error. Tuning during this
state will result in a divide by zero without this patch.
This patch doesn't fix the root cause for the device getting
into a bad state, but it allows me to unload/reload the drivers,
bringing it back into a usable state.

Signed-off-by: Martin Wache <M.Wache@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] drivers: media: i2c: ml86v7667: constify v4l2_subdev_* structures
Bhumika Goyal [Tue, 13 Dec 2016 17:31:45 +0000 (15:31 -0200)]
[media] drivers: media: i2c: ml86v7667: 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 used)

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

@ok1@
identifier r1.i;
position p;
@@
v4l2_i2c_subdev_init(...,&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
   2732     608       8    3348     d14 drivers/media/i2c/ml86v7667.o

File size after:
  text    data     bss     dec     hex filename
   3100     232       8    3340     d0c drivers/media/i2c/ml86v7667.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] drivers: media: i2c: ak881x: constify v4l2_subdev_* structures
Bhumika Goyal [Tue, 13 Dec 2016 17:26:13 +0000 (15:26 -0200)]
[media] drivers: media: i2c: ak881x: 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 used)

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

@ok1@
identifier r1.i;
position p;
struct v4l2_subdev_ops obj;
@@
obj.video=&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_video_ops i;

File size before:
  text    data     bss     dec     hex filename
   1809     872       0    2681     a79 drivers/media/i2c/ak881x.o

File size after:
  text    data     bss     dec     hex filename
   2185     496       0    2681     a79 drivers/media/i2c/ak881x.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: i2c: m5mols: m5mols_core: constify v4l2_subdev_pad_ops structures
Bhumika Goyal [Tue, 13 Dec 2016 11:49:45 +0000 (09:49 -0200)]
[media] media: i2c: m5mols: m5mols_core: constify v4l2_subdev_pad_ops structures

v4l2_subdev_pad_ops structures are stored in the pad field
of the v4l2_subdev_ops structure and this field is of type const.
As the v4l2_subdev_pad_ops structures are never modified, they can be
declared as const.
Done using Coccinelle:

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

@ok1@
identifier r1.i;
position p;
struct v4l2_subdev_ops obj;
@@
obj.pad=&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_pad_ops i;

File size before:
 text    data     bss     dec     hex filename
   7633     512      20    8165    1fe5 media/i2c/m5mols/m5mols_core.o

File size after:
  text    data     bss     dec     hex filename
   7761     384      20    8165    1fe5 media/i2c/m5mols/m5mols_core.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] m5mols: set usleep_range delta greater 0
Nicholas Mc Guire [Tue, 13 Dec 2016 05:34:53 +0000 (03:34 -0200)]
[media] m5mols: set usleep_range delta greater 0

This delay is in non-atomic context and it does not seem to be
time-critical so relax it to allow the timer subsystem to optimize
hrtimers.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: vsp1: Add VIDIOC_EXPBUF support
Laurent Pinchart [Mon, 12 Dec 2016 10:37:42 +0000 (08:37 -0200)]
[media] v4l: vsp1: Add VIDIOC_EXPBUF support

Use the vb2 ioctl handler directly.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] drivers: media: i2c: constify v4l2_subdev_* structures
Bhumika Goyal [Mon, 12 Dec 2016 07:45:32 +0000 (05:45 -0200)]
[media] drivers: media: i2c: 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_video_ops i@p = {...};

@ok1@
identifier r1.i;
position p;
struct v4l2_subdev_ops obj;
@@
obj.video=&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_video_ops i;

File sizes before:
  text    data     bss     dec     hex filename
   7810     736      16    8562    2172 drivers/media/i2c/mt9p031.o
   9652     736      24   10412    28ac drivers/media/i2c/mt9v032.o
   4613     552      20    5185    1441 drivers/media/i2c/noon010pc30.o
   2615     552       8    3175     c67 drivers/media/i2c/s5k6a3.o

File sizes after:
  text    data     bss     dec     hex filename
   8322     232      16    8570    217a drivers/media/i2c/mt9p031.o
  10164     232      24   10420    28b4 drivers/media/i2c/mt9v032.o
   4933     232      20    5185    1441 drivers/media/i2c/noon010pc30.o
   2935     232       8    3175     c67 drivers/media/i2c/s5k6a3.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: platform: xilinx: xilinx-tpg: constify v4l2_subdev_* structures
Bhumika Goyal [Sun, 11 Dec 2016 09:52:32 +0000 (07:52 -0200)]
[media] media: platform: xilinx: xilinx-tpg: 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_video_ops i@p = {...};

@ok1@
identifier r1.i;
position p;
struct v4l2_subdev_ops obj;
@@
obj.video=&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_video_ops i;

File size before:
   text    data     bss     dec     hex filename
   6170    2752     144    9066    236a media/platform/xilinx/xilinx-tpg.o

File size after:
   text    data     bss     dec     hex filename
   6666    2384       8    9058    2362 media/platform/xilinx/xilinx-tpg.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] bt8xx: Delete unnecessary variable initialisations in ca_send_message()
Markus Elfring [Sat, 10 Dec 2016 19:56:04 +0000 (17:56 -0200)]
[media] bt8xx: Delete unnecessary variable initialisations in ca_send_message()

Two local variables will be set to an appropriate value a bit later.
Thus omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] bt8xx: Delete two error messages for a failed memory allocation
Markus Elfring [Sat, 10 Dec 2016 19:50:58 +0000 (17:50 -0200)]
[media] bt8xx: Delete two error messages for a failed memory allocation

Omit extra messages for a memory allocation failure in two functions.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: async: make v4l2 coexist with devicetree nodes in a dt overlay
Javi Merino [Mon, 5 Dec 2016 10:09:56 +0000 (08:09 -0200)]
[media] v4l: async: make v4l2 coexist with devicetree nodes in a dt overlay

In asds configured with V4L2_ASYNC_MATCH_OF, the v4l2 subdev can be
part of a devicetree overlay, for example:

&media_bridge {
...
my_port: port@0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
ep: endpoint@0 {
remote-endpoint = <&camera0>;
};
};
};

/ {
fragment@0 {
target = <&i2c0>;
__overlay__ {
my_cam {
compatible = "foo,bar";
port {
camera0: endpoint {
remote-endpoint = <&my_port>;
...
};
};
};
};
};
};

Each time the overlay is applied, its of_node pointer will be
different.  We are not interested in matching the pointer, what we
want to match is that the path is the one we are expecting.  Change to
use of_node_cmp() so that we continue matching after the overlay has
been removed and reapplied.

Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Javi Merino <javi.merino@kernel.org>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: pci: meye: set error code on failures
Pan Bian [Sun, 4 Dec 2016 05:40:06 +0000 (03:40 -0200)]
[media] media: pci: meye: set error code on failures

The value of return variable ret is 0 on some error paths, for example,
when pci_resource_start() returns a NULL pointer. 0 means no error in
this context, which is contrary to the fact. This patch fixes the bug.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189011

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: platform: sti: return -ENOMEM on errors
Pan Bian [Sat, 3 Dec 2016 12:39:33 +0000 (10:39 -0200)]
[media] media: platform: sti: return -ENOMEM on errors

Function bdisp_debugfs_create() returns 0 even on errors. So its caller
cannot detect the errors. It may be better to return "-ENOMEM" on the
exception paths.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188801

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] mtk-vcodec: use V4L2_DEC_CMD_STOP to implement flush
Tiffany Lin [Fri, 2 Dec 2016 02:38:34 +0000 (00:38 -0200)]
[media] mtk-vcodec: use V4L2_DEC_CMD_STOP to implement flush

Also remove the code using size-0 OUTPUT buffer to flush.

Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Wu-Cheng Li <wuchengli@chromium.org>
Reviewed-by: Kuang-che Wu <kcwu@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lmedm04: make lme2510_powerup a little smaller
Rasmus Villemoes [Wed, 30 Nov 2016 21:39:12 +0000 (19:39 -0200)]
[media] lmedm04: make lme2510_powerup a little smaller

gcc isn't smart enough to realize it can share most of the argument
buildup and the actual function call between the two branches, so help
it a little.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lmedm04: make some string arrays static
Rasmus Villemoes [Wed, 30 Nov 2016 21:39:11 +0000 (19:39 -0200)]
[media] lmedm04: make some string arrays static

It takes more .text to initialize these on the stack than they occupy
in .rodata, so just make them static const.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lmedm04: change some static variables to automatic
Rasmus Villemoes [Wed, 30 Nov 2016 21:39:10 +0000 (19:39 -0200)]
[media] lmedm04: change some static variables to automatic

ibuf and rbuf in lme2510_int_response are always assigned to before they
are read, and their addresses do not escape the function, so they have
no reason to be static.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lmedm04: use %phN for hex dump
Rasmus Villemoes [Wed, 30 Nov 2016 21:39:09 +0000 (19:39 -0200)]
[media] lmedm04: use %phN for hex dump

Using the %ph printf extension for hex dumps like this makes the
generated code quite a bit smaller.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: Protect enable_source and disable_source handler code paths
Shuah Khan [Tue, 29 Nov 2016 23:59:54 +0000 (21:59 -0200)]
[media] media: Protect enable_source and disable_source handler code paths

Drivers might try to access and run enable_source and disable_source
handlers when the driver that implements these handlers is clearing
the handlers during its unregister.

Fix the following race condition:

process 1 process 2

request video streaming unbind au0828
v4l2 checks if tuner is free
... ...

au0828_unregister_media_device()
... ...
(doesn't hold graph_mutex)
mdev->enable_source = NULL;
if (mdev && mdev->enable_source) mdev->disable_source = NULL;
mdev->enable_source()
(enable_source holds graph_mutex)

As shown above enable_source check is done without holding the graph_mutex.
If unbind happens to be in progress, au0828 could clear enable_source and
disable_source handlers leading to null pointer de-reference.

Fix it by protecting enable_source and disable_source set and clear and
protecting enable_source and disable_source handler access and the call
itself.

process 1 process 2

request video streaming unbind au0828
v4l2 checks if tuner is free
... ...

au0828_unregister_media_device()
... ...
(hold graph_mutex while clearing)
mdev->enable_source = NULL;
if (mdev) mdev->disable_source = NULL;
(hold graph_mutex to check and
 call enable_source)
    if (mdev->enable_source)
mdev->enable_source()

If graph_mutex is held to just heck for handler being null and needs to be
released before calling the handler, there will be another window for the
handlers to be cleared. Hence, enable_source and disable_source handlers
no longer hold the graph_mutex and expect callers to hold it to avoid
forcing them release the graph_mutex before calling the handlers.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] tw686x: silent -Wformat-security warning
Nicolas Iooss [Sat, 26 Nov 2016 19:43:50 +0000 (17:43 -0200)]
[media] tw686x: silent -Wformat-security warning

Using sprintf() with a non-literal string makes some compiler complain
when building with -Wformat-security (eg. clang reports "format string
is not a string literal (potentially insecure)").

Here sprintf() format parameter is indirectly a literal string so there
is no security issue.  Nevertheless adding a "%s" format string to
silent the warning helps to detect real bugs in the kernel.

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: ti-vpe: vpdma: fix a timeout loop
Dan Carpenter [Fri, 25 Nov 2016 21:28:34 +0000 (19:28 -0200)]
[media] media: ti-vpe: vpdma: fix a timeout loop

The check assumes that we end on zero but actually we end on -1.  Change
the post-op to a pre-op so that we do end on zero.  Techinically now we
only loop 499 times instead of 500 but that's fine.

Fixes: dc12b124353b ("[media] media: ti-vpe: vpdma: Add abort channel desc and cleanup APIs")

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] Staging: media: platform: davinci: - Fix for memory leak
Shailendra Verma [Fri, 25 Nov 2016 04:52:04 +0000 (02:52 -0200)]
[media] Staging: media: platform: davinci: - Fix for memory leak

Fix to avoid possible memory leak if the decoder initialization got failed.
Free the allocated memory for file handle object before return in case
decoder initialization fails.

Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] b2c2: use IS_REACHABLE() instead of open-coding it
Arnd Bergmann [Thu, 24 Nov 2016 16:25:38 +0000 (14:25 -0200)]
[media] b2c2: use IS_REACHABLE() instead of open-coding it

The FE_SUPPORTED() macro is basically the same as IS_REACHABLE, except
that it causes a warning with gcc-7:

common/b2c2/flexcop-fe-tuner.c:30:1: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
common/b2c2/flexcop-fe-tuner.c:30:1: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
common/b2c2/flexcop-fe-tuner.c:30:1: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]

Using IS_REACHABLE() to define it avoids the warning.

Fixes: 3785bc170f79 ("[media] b2c2: break it into common/pci/usb directories")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ivtv: mark DVB "borrowed" ioctls as deprecated
Mauro Carvalho Chehab [Thu, 24 Nov 2016 11:52:35 +0000 (09:52 -0200)]
[media] ivtv: mark DVB "borrowed" ioctls as deprecated

changeset da8ec560e3b4 ("[media] ivtv: implement new decoder command
ioctls") implemented proper support for mpeg audio and video control
at V4L2 API. Since then, the usage of the the DVB APIs is deprecated.

However, we never actually marked it as deprecated nor provided any
way to disable it. Let's do it now.

This patch prepares for the removal of this bad usage on a couple
of Kernel versions.

Fixes: da8ec560e3b4 ("[media] ivtv: implement new decoder command ioctls")

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] MAINTAINERS: remove hd29l2
Antti Palosaari [Fri, 27 Jan 2017 16:51:32 +0000 (14:51 -0200)]
[media] MAINTAINERS: remove hd29l2

Remove unused demod driver. Device that used it never went public.

If someone later decide to add support for a device using this
chipset, it should be easy enough to retrieve it from git
history.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] mt2060: implement sleep
Antti Palosaari [Fri, 9 Dec 2016 17:11:09 +0000 (15:11 -0200)]
[media] mt2060: implement sleep

I saw from ZyDAS ZD1301 sniffs it sets chip sleeping by using
REG_MISC_CTRL. That has very huge effect for power management, around
0.9W. Sleep is still disabled for all the old hardware just to avoid
possible regression as meaning of register bits are unknown.

I tested it also with some other devices and it seems to be working,
but I still consider it to be too risky to change it default.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] MAINTAINERS: add zd1301 DVB USB interface driver
Antti Palosaari [Mon, 27 Jul 2015 11:10:25 +0000 (08:10 -0300)]
[media] MAINTAINERS: add zd1301 DVB USB interface driver

DVB USB interface driver for ZyDAS ZD1301 chip.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] zd1301: ZyDAS ZD1301 DVB USB interface driver
Antti Palosaari [Thu, 23 Jul 2015 21:53:41 +0000 (18:53 -0300)]
[media] zd1301: ZyDAS ZD1301 DVB USB interface driver

ZyDAS ZD1301 is chip having USB interface and DVB-T demodulator
integrated. This driver is for USB interface part.

Device has USB ID 0ace:13a1. Used tuner is MT2060.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] MAINTAINERS: add zd1301_demod driver
Antti Palosaari [Mon, 27 Jul 2015 11:07:40 +0000 (08:07 -0300)]
[media] MAINTAINERS: add zd1301_demod driver

DVB-T demodulator driver for ZyDAS ZD1301 chip.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] zd1301_demod: ZyDAS ZD1301 DVB-T demodulator driver
Antti Palosaari [Thu, 23 Jul 2015 21:43:06 +0000 (18:43 -0300)]
[media] zd1301_demod: ZyDAS ZD1301 DVB-T demodulator driver

ZyDAS ZD1301 is chip having USB interface and DVB-T demodulator
integrated. This driver is for demodulator part.
Driver is very reduced, just basic demodulator functionality, no
statistics at all. It registers as a platform driver to driver core.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] mt2060: add param to split long i2c writes
Antti Palosaari [Sun, 26 Jul 2015 20:30:07 +0000 (17:30 -0300)]
[media] mt2060: add param to split long i2c writes

Add configuration parameter to split long i2c writes as some I2C
adapters cannot write 10 bytes used as a one go.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] mt2060: add i2c bindings
Antti Palosaari [Sun, 26 Jul 2015 21:45:05 +0000 (18:45 -0300)]
[media] mt2060: add i2c bindings

Add proper i2c driver model bindings.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ivtv: use pr_foo() instead of calling printk() directly
Mauro Carvalho Chehab [Thu, 24 Nov 2016 11:52:34 +0000 (09:52 -0200)]
[media] ivtv: use pr_foo() instead of calling printk() directly

pr_foo() provides a convenient way for printk's, enforcing
that they'll all prepend the error message with the driver's
name.

Use it inside ivtv.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ivtv: prepare to convert to pr_foo()
Mauro Carvalho Chehab [Thu, 24 Nov 2016 11:01:20 +0000 (09:01 -0200)]
[media] ivtv: prepare to convert to pr_foo()

Move the pr_fmt() macro to ivtv_driver.h and ensure that it
will be the first file to be included on all ivtv files.

While here, put the includes inside ivtv-driver.h on
alphabetic order.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] st-hva: hva_dbg_summary() should be static
Mauro Carvalho Chehab [Tue, 31 Jan 2017 14:00:45 +0000 (12:00 -0200)]
[media] st-hva: hva_dbg_summary() should be static

As reported by gcc:

drivers/media/platform/sti/hva/hva-v4l2.c:227:6: warning: no previous prototype for 'hva_dbg_summary' [-Wmissing-prototypes]
 void hva_dbg_summary(struct hva_ctx *ctx)
      ^~~~~~~~~~~~~~~

This function is used only internally, so make it static.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] st-hva: add debug file system
Jean-Christophe Trotin [Tue, 31 Jan 2017 10:37:57 +0000 (08:37 -0200)]
[media] st-hva: add debug file system

This patch creates 4 static debugfs entries to dump:
- the device-related information ("st-hva/device")
- the list of registered encoders ("st-hva/encoders")
- the current values of the hva registers ("st-hva/regs")
- the information about the last closed instance ("st-hva/last")

It also creates dynamically a debugfs entry for each opened instance,
("st-hva/<instance identifier>") to dump:
- the information about the frame (format, resolution)
- the information about the stream (format, profile, level,
  resolution)
- the control parameters (bitrate mode, framerate, GOP size...)
- the potential (system, encoding...) errors
- the performance information about the encoding (HW processing
  duration, average bitrate, average framerate...)
Each time a running instance is closed, its context (including the
debug information) is saved to feed, on demand, the last closed
instance debugfs entry.

Signed-off-by: Yannick Fertre <yannick.fertre@st.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Jean-Christophe Trotin <jean-christophe.trotin@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] st-hva: encoding summary at instance release
Jean-Christophe Trotin [Tue, 31 Jan 2017 10:37:56 +0000 (08:37 -0200)]
[media] st-hva: encoding summary at instance release

This patch adds a short summary about the encoding operation at each
instance closing, for debug purpose (through dev_dbg()):
- information about the frame (format, resolution)
- information about the stream (format, profile, level, resolution)
- number of encoded frames
- potential (system, encoding...) errors

Signed-off-by: Yannick Fertre <yannick.fertre@st.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Jean-Christophe Trotin <jean-christophe.trotin@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ov9650: use msleep() for uncritical long delay
Nicholas Mc Guire [Mon, 16 Jan 2017 13:58:33 +0000 (11:58 -0200)]
[media] ov9650: use msleep() for uncritical long delay

ulseep_range() uses hrtimers and provides no advantage over msleep()
for larger delays. Fix up the 25ms delays here to use msleep() and
reduce the load on the hrtimer subsystem.

Link: http://lkml.org/lkml/2017/1/11/377
Reviwed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: mt9v032: Remove unneeded gpiod NULL check
Laurent Pinchart [Tue, 26 Jan 2016 18:11:51 +0000 (16:11 -0200)]
[media] v4l: mt9v032: Remove unneeded gpiod NULL check

The gpiod API checks for NULL descriptors, there's no need to duplicate
the check in the driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agoRevert "[media] coda/imx-vdoa: constify structs"
Mauro Carvalho Chehab [Tue, 31 Jan 2017 13:50:52 +0000 (11:50 -0200)]
Revert "[media] coda/imx-vdoa: constify structs"

Despite checkpatch comments, it seems that ARM doesn't like
to use constified structs.

As reported by kernel build robot:

 In file included from drivers/media/platform/coda/imx-vdoa.c:22:0:
   drivers/media/platform/coda/imx-vdoa.c: In function 'vdoa_driver_init':
>> include/linux/device.h:1461:20: warning: passing argument 1 of '__platform_driver_register' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     return __register(&(__driver) , ##__VA_ARGS__); \
                       ^
   include/linux/platform_device.h:198:29: note: in definition of macro 'platform_driver_register'
     __platform_driver_register(drv, THIS_MODULE)
                                ^~~
   include/linux/platform_device.h:228:2: note: in expansion of macro 'module_driver'
     module_driver(__platform_driver, platform_driver_register, \
     ^~~~~~~~~~~~~
>> drivers/media/platform/coda/imx-vdoa.c:333:1: note: in expansion of macro 'module_platform_driver'
    module_platform_driver(vdoa_driver);
    ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/platform_device.h:199:12: note: expected 'struct platform_driver *' but argument is of type 'const struct platform_driver *'
    extern int __platform_driver_register(struct platform_driver *,
               ^~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from drivers/media/platform/coda/imx-vdoa.c:18:0:
   drivers/media/platform/coda/imx-vdoa.c: In function 'vdoa_driver_exit':
>> include/linux/device.h:1466:15: warning: passing argument 1 of 'platform_driver_unregister' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     __unregister(&(__driver) , ##__VA_ARGS__); \
                  ^
   include/linux/platform_device.h:228:2: note: in expansion of macro 'module_driver'
     module_driver(__platform_driver, platform_driver_register, \
     ^~~~~~~~~~~~~
>> drivers/media/platform/coda/imx-vdoa.c:333:1: note: in expansion of macro 'module_platform_driver'
    module_platform_driver(vdoa_driver);
    ^~~~~~~~~~~~~~~~~~~~~~
   In file included from drivers/media/platform/coda/imx-vdoa.c:22:0:
   include/linux/platform_device.h:201:13: note: expected 'struct platform_driver *' but argument is of type 'const struct platform_driver *'
    extern void platform_driver_unregister(struct platform_driver *);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~

So, let's just remove it.

This reverts commit 126f52b02e6ec6a25f0b32058a91648304922d4a.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: omap4iss: Clean up file handle in open() and release()
Shailendra Verma [Fri, 25 Nov 2016 04:49:14 +0000 (02:49 -0200)]
[media] v4l: omap4iss: Clean up file handle in open() and release()

Both functions initialize the file handle with v4l2_fh_init() and thus
need to call clean up with v4l2_fh_exit() as appropriate. Fix it.

Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: omap3isp: Clean up file handle in open() and release()
Shailendra Verma [Fri, 25 Nov 2016 04:44:32 +0000 (02:44 -0200)]
[media] v4l: omap3isp: Clean up file handle in open() and release()

Both functions initialize the file handle with v4l2_fh_init() and thus
need to call clean up with v4l2_fh_exit() as appropriate. Fix it.

Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] uvcvideo: Change result code of debugfs_init to void
Jaejoong Kim [Thu, 12 Jan 2017 01:31:21 +0000 (23:31 -0200)]
[media] uvcvideo: Change result code of debugfs_init to void

The device driver should keep going even if debugfs initialization fails.
So, change the return type to void.

Signed-off-by: Jaejoong Kim <climbbb.kim@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] uvcvideo: Fix a wrong macro
Guennadi Liakhovetski [Mon, 12 Dec 2016 11:16:51 +0000 (09:16 -0200)]
[media] uvcvideo: Fix a wrong macro

Don't mix up UVC_BUF_STATE_* and VB2_BUF_STATE_* codes.

Fixes: 6998b6fb4b1c ("[media] uvcvideo: Use videobuf2-vmalloc")

Cc: stable@vger.kernel.org
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] uvcvideo: (cosmetic) Remove a superfluous assignment
Guennadi Liakhovetski [Mon, 12 Dec 2016 11:16:50 +0000 (09:16 -0200)]
[media] uvcvideo: (cosmetic) Remove a superfluous assignment

Remove a superfluous assignment to a local variable at the end of a
function.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] uvcvideo: (cosmetic) Add and use an inline function
Guennadi Liakhovetski [Mon, 12 Dec 2016 11:16:49 +0000 (09:16 -0200)]
[media] uvcvideo: (cosmetic) Add and use an inline function

Add an inline function to obtain a struct uvc_buffer pointer from a
struct vb2_v4l2_buffer one.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9033: estimate cnr from formula
Antti Palosaari [Mon, 19 Dec 2016 03:42:37 +0000 (01:42 -0200)]
[media] af9033: estimate cnr from formula

Use formulas for cnr estimates and get rid of old lut-based estimate.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9035: correct demod i2c addresses
Antti Palosaari [Mon, 7 Nov 2016 04:01:03 +0000 (02:01 -0200)]
[media] af9035: correct demod i2c addresses

Chip uses so called 8-bit i2c addresses, but on bus there is of
course correct 7-bit addresses with rw bit as lsb - verified
with oscilloscope.

Lets still use correct addresses in driver.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] it913x: add chip device ids for binding
Antti Palosaari [Thu, 10 Nov 2016 03:24:50 +0000 (01:24 -0200)]
[media] it913x: add chip device ids for binding

Driver supports 2 different device versions, AX and BX. Use device
IDs to pass chip version information to driver.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9035: register it9133 tuner using platform binding
Antti Palosaari [Mon, 7 Nov 2016 03:14:23 +0000 (01:14 -0200)]
[media] af9035: register it9133 tuner using platform binding

it913x tuner driver is changed to platform model so we need bind it
using platform_device_register_data().

Also remove hacks from I2C adapter where fake tuner driver address
(addr >> 1) were used as those are no longer needed.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] it913x: change driver model from i2c to platform
Antti Palosaari [Mon, 7 Nov 2016 00:00:45 +0000 (22:00 -0200)]
[media] it913x: change driver model from i2c to platform

That tuner is integrated to demodulator and communicates via
demodulators address space. We cannot register both demodulator
and tuner having same address to same I2C bus, so better to change
it platform driver in order to implement I2C adapter correctly.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9033: return regmap for integrated IT913x tuner driver
Antti Palosaari [Mon, 7 Nov 2016 00:14:18 +0000 (22:14 -0200)]
[media] af9033: return regmap for integrated IT913x tuner driver

IT9130 series contains integrated tuner driver, which uses that
demodulator address space. Return regmap in order to allow it913x
driver communication.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9033: style related and minor changes
Antti Palosaari [Sun, 6 Nov 2016 20:55:36 +0000 (18:55 -0200)]
[media] af9033: style related and minor changes

Fix coding style and other small issues.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] af9033: use 64-bit div macro where possible
Antti Palosaari [Sun, 6 Nov 2016 17:27:16 +0000 (15:27 -0200)]
[media] af9033: use 64-bit div macro where possible

Replace Booth's binary division algo with 64-bit multiply and division.
Fix related IF calculations.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
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>