Commit graph

648059 commits

Author SHA1 Message Date
Sean Young
44750606b9 [media] mce_kbd: add missing keys from UK layout
The UK layout of the Microsoft Remote Keyboard has two missing keys:
the hash key, and the messenger key which is sent using rc6 mce.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 14:23:37 -02:00
Sean Young
32002f725f [media] lirc: cannot read from tx-only device
Bail out early, otherwise we follow a null pointer.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 14:23:36 -02:00
Martin Blumenstingl
7a6628b5c3 [media] Documentation: devicetree: add the RC map name of the geekbox remote
Keep the list up to date with include/media/rc-map.h

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 14:23:35 -02:00
Martin Blumenstingl
031d3e18f3 [media] Documentation: devicetree: meson-ir: "linux,rc-map-name" is supported
The driver already parses the "linux,rc-map-name" property. Add this
information to the documentation so .dts maintainers don't have to look
it up in the source-code.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 14:23:35 -02:00
Wei Yongjun
d46e0a8bdb [media] gp8psk: make local symbol gp8psk_fe_ops static
Fixes the following sparse warning:

drivers/media/usb/dvb-usb/gp8psk.c:281:28: warning:
 symbol 'gp8psk_fe_ops' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 14:23:34 -02:00
Wei Yongjun
634b2b5c65 [media] tm6000: fix typo in parameter description
Fix typo in parameter description.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 14:23:29 -02:00
Kevin Cheng
1586342e42 [media] em28xx: support for Hauppauge WinTV-dualHD 01595 ATSC/QAM
Hauppauge WinTV-dualHD model 01595 is a USB 2.0 dual ATSC/QAM tuner with
the following components:

USB bridge: Empia em28274
Demodulator: 2x LG LGDT3306a at addresses 0xb2 and 0x1c
Tuner: 2x Silicon Labs si2157 at addresses 0xc0 and 0xc4

This patch enables only the first tuner.

Signed-off-by: Kevin Cheng <kcheng@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 13:46:42 -02:00
Kevin Cheng
4f75189024 [media] lgdt3306a: support i2c mux for use by em28xx
Adds an i2c mux to the lgdt3306a demodulator.  This was done to support
the Hauppauge WinTV-dualHD 01595 USB TV tuner (em28xx), which utilizes two
si2157 tuners behind gate control.

Signed-off-by: Kevin Cheng <kcheng@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 13:45:48 -02:00
Davidlohr Bueso
3f70608872 [media] media/usbvision: remove ctrl_urb_wq
While the wakeup path seems to be set up, this waitqueue is actually
never used as no-one enqueues themselves on the list. As such, wakeups
are meaningless without waiters, so lets just get rid of the whole
thing.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 13:40:20 -02:00
Baruch Siach
1059b687d0 [media] v4l2-subdev.h: fix v4l2_subdev_pad_config documentation
The fields of v4l2_subdev_pad_config are not pointers.

Fixes: 21c29de1d0 ("[media] v4l2-subdev.h: Improve documentation")

Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 12:00:37 -02:00
Nicolas Iooss
4c171636bc [media] v4l: rcar_fdp1: use %4.4s to format a 4-byte string
Using %4s to format f->fmt.pix_mp.pixelformat in fdp1_try_fmt() and
fdp1_s_fmt() may lead to more characters being printed (when the byte
following field pixelformat is not zero).

Add ".4" to the format specifier to limit the number of printed
characters to four. The resulting format specifier "%4.4s" is also used
by other media drivers to print pixelformat value.

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Reviewed-by: Kieran Bingham <kieran@bingham.xyz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 11:50:40 -02:00
Niels Ole Salscheider
d615128a7e [media] cx23885: attach md88ds3103 driver via i2c_client for DVBSky S952
With this patch we use the new style to attach the frontend.

Signed-off-by: Niels Ole Salscheider <niels_ole@salscheider-online.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 11:48:55 -02:00
Cao jin
081d0d8c23 [media] ngene: drop ngene_link_reset()
In AER recovery, pci_error_handlers.link_reset() is never called,
drop it now.

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 11:35:59 -02:00
devendra sharma
e90bbacd8c [media] media: dvb: dmx: fixed coding style issues of spacing
Fixed coding style issues of spacing

Signed-off-by: Devendra Sharma <devendra.sharma9091@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 11:35:10 -02:00
Mauro Carvalho Chehab
504fc0286d [media] stk1160: make some functions static
As warned by gcc:

drivers/media/usb/stk1160/stk1160-ac97.c:117:5: warning: no previous prototype for 'stk1160_has_audio' [-Wmissing-prototypes]
 int stk1160_has_audio(struct stk1160 *dev)
     ^~~~~~~~~~~~~~~~~
drivers/media/usb/stk1160/stk1160-ac97.c:125:5: warning: no previous prototype for 'stk1160_has_ac97' [-Wmissing-prototypes]
 int stk1160_has_ac97(struct stk1160 *dev)
     ^~~~~~~~~~~~~~~~

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 11:30:37 -02:00
Marcel Hasler
9a4825edbc [media] stk1160: Wait for completion of transfers to and from AC97 codec
The STK1160 needs some time to transfer data to and from the AC97 codec.
The transfer completion is indicated by command read/write bits in the
chip's audio control register. The driver should poll these bits and
wait until they have been cleared by hardware before trying to retrieve
the results of a read operation or setting a new write command.

[mchehab@s-opensource.com: make checkpatch happier]
Signed-off-by: Marcel Hasler <mahasler@gmail.com>
Acked-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 11:29:24 -02:00
Marcel Hasler
1dc7df4d3d [media] stk1160: Check whether to use AC97 codec
Some STK1160-based devices use the chip's internal 8-bit ADC. This is
configured through a strap pin. The value of this and other pins can be
read through the POSVA register. If the internal ADC is used, or if
audio is disabled altogether, there's no point trying to setup the AC97
codec.

Signed-off-by: Marcel Hasler <mahasler@gmail.com>
Acked-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 11:26:32 -02:00
Marcel Hasler
e36e6b5f26 [media] stk1160: Remove stk1160-mixer and setup internal AC97 codec automatically
Exposing all the channels of the device's internal AC97 codec to
userspace is unnecessary and confusing. Instead the driver should setup
the codec with proper values. This patch removes the mixer and sets up
the codec using optimal values, i.e. the same values set by the Windows
driver. This also makes the device work out-of-the-box, without the need
for the user to reconfigure the device every time it's plugged in.

Signed-off-by: Marcel Hasler <mahasler@gmail.com>
Acked-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 11:25:51 -02:00
Hans Verkuil
814e92b8ca [media] v4l2-ctrls.c: add NULL check
Check that the control whose events we want to delete is still there.

Normally this will always be the case, but I am not 100% certain if
there aren't any corner cases when a device is forcibly unbound.

In any case, this will satisfy static checkers and simply make it more
robust.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Shaobo <shaobo@cs.utah.edu>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 11:24:48 -02:00
Matej Hulín
75d1b1379f [media] media: radio-cadet, initialize timer with setup_timer
Stop accessing timer struct members directly and use the setup_timer
helper intended for that use. It makes the code cleaner and will allow
for easier change of the timer struct internals.

Signed-off-by: Matej Hulín <mito.hulin@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-03 11:23:51 -02:00
Colin Ian King
ca80fbcd4c [media] saa7164: "first image" should be "second image" in error message
The error message when the second image is not available is incorrect,
replace "first image" with "second image".

Fixes CoverityScan CID#1077508 ("Copy-paste error")

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>
2017-02-03 11:19:07 -02:00
Colin Ian King
c099b73a29 [media] gspca_stv06xx: remove redundant check for err < 0
The comparison of err < 0 is redundant as err has been previously
been assigned to 0 and has not changed.  Remove the redundant check.

Fixes CoverityScan CID#703363 ("Logically dead code")

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>
2017-02-03 11:18:33 -02:00
Mats Randgaard
676c002af6 [media] tc358743: ctrl_detect_tx_5v should always be updated
The control for +5V Power detection must also be updated when the EDID is
not present.

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>
2017-02-03 11:16:25 -02:00
Mats Randgaard
0a1f085061 [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>
2017-02-03 11:16:02 -02:00
Mats Randgaard
59e34ba82a [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>
2017-02-03 11:14:40 -02:00
Bhumika Goyal
10106c13f4 [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>
2017-02-03 10:58:00 -02:00
Martin Wache
5332b62637 [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>
2017-02-03 10:54:20 -02:00
Bhumika Goyal
5610ced4f1 [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>
2017-02-03 09:34:43 -02:00
Bhumika Goyal
4d7aa5e991 [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>
2017-02-03 09:33:55 -02:00
Bhumika Goyal
646c3ae9d9 [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>
2017-02-03 09:28:32 -02:00
Nicholas Mc Guire
964481ad0e [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>
2017-02-03 09:26:52 -02:00
Laurent Pinchart
5a66e2f60e [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>
2017-02-03 09:24:13 -02:00
Bhumika Goyal
7c137c601b [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>
2017-02-03 09:23:19 -02:00
Bhumika Goyal
cebb31c8b5 [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>
2017-02-03 09:21:50 -02:00
Markus Elfring
8726650a1a [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>
2017-02-03 09:20:11 -02:00
Markus Elfring
6e531f104c [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>
2017-02-03 09:19:41 -02:00
Javi Merino
d2180e0cf7 [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>
2017-02-03 08:05:16 -02:00
Pan Bian
2ce899423c [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>
2017-02-03 08:01:30 -02:00
Pan Bian
d54a90c4c1 [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>
2017-02-03 07:58:37 -02:00
Tiffany Lin
4865fffa83 [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>
2017-02-03 07:49:24 -02:00
Rasmus Villemoes
974eadf1fc [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>
2017-02-03 07:39:38 -02:00
Rasmus Villemoes
bfe17178a8 [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>
2017-02-03 07:39:37 -02:00
Rasmus Villemoes
75759e31e6 [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>
2017-02-03 07:39:36 -02:00
Rasmus Villemoes
3a3402d318 [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>
2017-02-03 07:39:36 -02:00
Shuah Khan
90cd366bc6 [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>
2017-02-03 07:39:35 -02:00
Nicolas Iooss
92fbeb40b1 [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>
2017-02-03 07:20:19 -02:00
Dan Carpenter
062c5fff31 [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: dc12b12435 ("[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>
2017-02-03 07:18:34 -02:00
Shailendra Verma
d39e74fdcd [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>
2017-02-03 07:14:28 -02:00
Arnd Bergmann
30f895a9e1 [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: 3785bc170f ("[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>
2017-02-03 07:12:59 -02:00
Mauro Carvalho Chehab
6689638025 [media] ivtv: mark DVB "borrowed" ioctls as deprecated
changeset da8ec560e3 ("[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: da8ec560e3 ("[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>
2017-02-03 07:08:24 -02:00