GitHub/moto-9609/android_kernel_motorola_exynos9610.git
7 years ago[media] coda/imx-vdoa: constify structs
Mauro Carvalho Chehab [Tue, 31 Jan 2017 10:14:56 +0000 (08:14 -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] st-delta: debug: trace stream/frame information & summary
Hugues Fruchet [Thu, 2 Feb 2017 14:59:53 +0000 (12:59 -0200)]
[media] st-delta: debug: trace stream/frame information & summary

Adds some trace points showing input compressed stream or
output decoded frame information.
Adds an unconditional trace point when streaming starts showing
the compressed stream and the decoded frame information.
Adds an unconditional trace point at instance closure summarizing
into a single line the decoding process (stream information, decoded
and output frames number, potential errors observed).

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] st-delta: add mjpeg support
Hugues Fruchet [Thu, 2 Feb 2017 14:59:52 +0000 (12:59 -0200)]
[media] st-delta: add mjpeg support

Adds support of DELTA MJPEG video decoder back-end,
implemented by calling JPEG_DECODER_HW0 firmware
using RPMSG IPC communication layer.

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] st-delta: EOS (End Of Stream) support
Hugues Fruchet [Thu, 2 Feb 2017 14:59:51 +0000 (12:59 -0200)]
[media] st-delta: EOS (End Of Stream) support

EOS (End Of Stream) support allows user to get
all the potential decoded frames remaining in decoder
pipeline after having reached the end of video bitstream.
To do so, user calls VIDIOC_DECODER_CMD(V4L2_DEC_CMD_STOP)
which will drain the decoder and get the drained frames
that are then returned to user.
User is informed of EOS completion in two ways:
 - dequeue of an empty frame flagged to V4L2_BUF_FLAG_LAST
 - reception of a V4L2_EVENT_EOS event.
If, unfortunately, no buffer is available on CAPTURE queue
to return the empty frame, EOS is delayed till user queue
one CAPTURE buffer.

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] st-delta: rpmsg ipc support
Hugues Fruchet [Thu, 2 Feb 2017 14:59:50 +0000 (12:59 -0200)]
[media] st-delta: rpmsg ipc support

IPC (Inter Process Communication) support for communication with
DELTA coprocessor firmware using rpmsg kernel framework.
Based on 4 services open/set_stream/decode/close and their associated
rpmsg messages.
The messages structures are duplicated on both host and firmware
side and are packed (use only of 32 bits size fields in messages
structures to ensure packing).
Each service is synchronous; service returns only when firmware
acknowledges the associated command message.
Due to significant parameters size exchanged from host to copro,
parameters are not inserted in rpmsg messages. Instead, parameters are
stored in physical memory shared between host and coprocessor.
Memory is non-cacheable, so no special operation is required
to ensure memory coherency on host and on coprocessor side.
Multi-instance support and re-entrance are ensured using host_hdl and
copro_hdl in message header exchanged between both host and coprocessor.
This avoids to manage tables on both sides to get back the running context
of each instance.

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] st-delta: add memory allocator helper functions
Hugues Fruchet [Thu, 2 Feb 2017 14:59:49 +0000 (12:59 -0200)]
[media] st-delta: add memory allocator helper functions

Helper functions used by decoder back-ends to allocate
physically contiguous memory required by hardware video
decoder.

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] st-delta: STiH4xx multi-format video decoder v4l2 driver
Hugues Fruchet [Thu, 2 Feb 2017 14:59:48 +0000 (12:59 -0200)]
[media] st-delta: STiH4xx multi-format video decoder v4l2 driver

This V4L2 driver enables DELTA multi-format video decoder
of STMicroelectronics STiH4xx SoC series.

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] MAINTAINERS: add st-delta driver
Hugues Fruchet [Thu, 2 Feb 2017 14:59:47 +0000 (12:59 -0200)]
[media] MAINTAINERS: add st-delta driver

Add entry for the STMicroelectronics DELTA driver.

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ARM: multi_v7_defconfig: enable STMicroelectronics DELTA Support
Hugues Fruchet [Thu, 2 Feb 2017 14:59:46 +0000 (12:59 -0200)]
[media] ARM: multi_v7_defconfig: enable STMicroelectronics DELTA Support

Enables support of STMicroelectronics STiH4xx SoC series
DELTA multi-format video decoder V4L2 driver.

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ARM: dts: STiH407-family: add DELTA dt node
Hugues Fruchet [Thu, 2 Feb 2017 14:59:45 +0000 (12:59 -0200)]
[media] ARM: dts: STiH407-family: add DELTA dt node

This patch adds DT node for STMicroelectronics
DELTA V4L2 video decoder

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] Documentation: DT: add bindings for ST DELTA
Hugues Fruchet [Thu, 2 Feb 2017 14:59:44 +0000 (12:59 -0200)]
[media] Documentation: DT: add bindings for ST DELTA

This patch adds DT binding documentation for STMicroelectronics
DELTA V4L2 video decoder.

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cx231xx: Fix I2C on Internal Master 3 Bus
Oleh Kravchenko [Sun, 29 Jan 2017 18:07:31 +0000 (16:07 -0200)]
[media] cx231xx: Fix I2C on Internal Master 3 Bus

Internal Master 3 Bus can send and receive only 4 bytes per time.

Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cx231xx: Initial support Evromedia USB Full Hybrid Full HD
Oleh Kravchenko [Sun, 29 Jan 2017 18:03:51 +0000 (16:03 -0200)]
[media] cx231xx: Initial support Evromedia USB Full Hybrid Full HD

This patch provide only digital support.
The device is based on Si2168 30-demodulator,
Si2158-20 tuner and CX23102-11Z chipset;
USB id: 1b80:d3b2.

Status:
- DVB-T2 works fine;
- Composite and SVideo works fine;
- Analog not implemented.

Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l2-async: failing functions shouldn't have side effects
Tuukka Toivonen [Fri, 27 Jan 2017 10:32:56 +0000 (08:32 -0200)]
[media] v4l2-async: failing functions shouldn't have side effects

v4l2-async had several functions doing some operations and then
not undoing the operations in a failure situation. For example,
v4l2_async_test_notify() moved a subdev into notifier's done list
even if registering the subdev (v4l2_device_register_subdev) failed.
If the subdev was allocated and v4l2_async_register_subdev() called
from the driver's probe() function, as usually, the probe()
function freed the allocated subdev and returned a failure.
Nevertheless, the subdev was still left into the notifier's done
list, causing an access to already freed memory when the notifier
was later unregistered.

A hand-edited call trace leaving freed subdevs into the notifier:

v4l2_async_register_notifier(notifier, asd)
cameradrv_probe
 sd = devm_kzalloc()
 v4l2_async_register_subdev(sd)
  v4l2_async_test_notify(notifier, sd, asd)
   list_move(sd, &notifier->done)
   v4l2_device_register_subdev(notifier->v4l2_dev, sd)
    cameradrv_registered(sd) -> fails
->v4l2_async_register_subdev returns failure
->cameradrv_probe returns failure
->devres frees the allocated sd
->sd was freed but it still remains in the notifier's list.

This patch fixes this and several other cases where a failing
function could leave nodes into a linked list while the caller
might free the node due to a failure.

Signed-off-by: Tuukka Toivonen <tuukka.toivonen@intel.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] mantis_dvb: fix some error codes in mantis_dvb_init()
Dan Carpenter [Fri, 27 Jan 2017 08:06:22 +0000 (06:06 -0200)]
[media] mantis_dvb: fix some error codes in mantis_dvb_init()

We should be returning negative error codes here or it leads to a crash.
This also silences a static checker warning.

drivers/media/pci/mantis/mantis_cards.c:250 mantis_pci_probe()
warn: 'mantis->dmxdev.dvbdev->fops' double freed

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] exynos-gsc: Avoid spamming the log on VIDIOC_TRY_FMT
Javier Martinez Canillas [Tue, 24 Jan 2017 21:42:26 +0000 (19:42 -0200)]
[media] exynos-gsc: Avoid spamming the log on VIDIOC_TRY_FMT

There isn't an ioctl to enum the supported field orders, so a user-space
application can call VIDIOC_TRY_FMT using different field orders to know
if one is supported. For example, GStreamer does this so during playback
dozens of the following messages appear in the kernel log buffer:

[ 442.143393] Not supported field order(4)

Instead of printing this as an error, just keep it as debug information.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-usb: don't use stack for firmware load
Mauro Carvalho Chehab [Tue, 24 Jan 2017 10:13:11 +0000 (08:13 -0200)]
[media] dvb-usb: don't use stack for firmware load

As reported by Marc Duponcheel <marc@offline.be>, firmware load on
dvb-usb is using the stack, with is not allowed anymore on default
Kernel configurations:

[ 1025.958836] dvb-usb: found a 'WideView WT-220U PenType Receiver (based on ZL353)' in cold state, will try to load a firmware
[ 1025.958853] dvb-usb: downloading firmware from file 'dvb-usb-wt220u-zl0353-01.fw'
[ 1025.958855] dvb-usb: could not stop the USB controller CPU.
[ 1025.958856] dvb-usb: error while transferring firmware (transferred size: -11, block size: 3)
[ 1025.958856] dvb-usb: firmware download failed at 8 with -22
[ 1025.958867] usbcore: registered new interface driver dvb_usb_dtt200u

[    2.789902] dvb-usb: downloading firmware from file 'dvb-usb-wt220u-zl0353-01.fw'
[    2.789905] ------------[ cut here ]------------
[    2.789911] WARNING: CPU: 3 PID: 2196 at drivers/usb/core/hcd.c:1584 usb_hcd_map_urb_for_dma+0x430/0x560 [usbcore]
[    2.789912] transfer buffer not dma capable
[    2.789912] Modules linked in: btusb dvb_usb_dtt200u(+) dvb_usb_af9035(+) btrtl btbcm dvb_usb dvb_usb_v2 btintel dvb_core bluetooth rc_core rfkill x86_pkg_temp_thermal intel_powerclamp coretemp crc32_pclmul aesni_intel aes_x86_64 glue_helper lrw gf128mul ablk_helper cryptd drm_kms_helper syscopyarea sysfillrect pcspkr i2c_i801 sysimgblt fb_sys_fops drm i2c_smbus i2c_core r8169 lpc_ich mfd_core mii thermal fan rtc_cmos video button acpi_cpufreq processor snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core snd_pcm snd_timer snd crc32c_intel ahci libahci libata xhci_pci ehci_pci xhci_hcd ehci_hcd usbcore usb_common dm_mirror dm_region_hash dm_log dm_mod
[    2.789936] CPU: 3 PID: 2196 Comm: systemd-udevd Not tainted 4.9.0-gentoo #1
[    2.789937] Hardware name: ASUS All Series/H81I-PLUS, BIOS 0401 07/23/2013
[    2.789938]  ffffc9000339b690 ffffffff812bd397 ffffc9000339b6e0 0000000000000000
[    2.789939]  ffffc9000339b6d0 ffffffff81055c86 000006300339b6a0 ffff880116c0c000
[    2.789941]  0000000000000000 0000000000000000 0000000000000001 ffff880116c08000
[    2.789942] Call Trace:
[    2.789945]  [<ffffffff812bd397>] dump_stack+0x4d/0x66
[    2.789947]  [<ffffffff81055c86>] __warn+0xc6/0xe0
[    2.789948]  [<ffffffff81055cea>] warn_slowpath_fmt+0x4a/0x50
[    2.789952]  [<ffffffffa006d460>] usb_hcd_map_urb_for_dma+0x430/0x560 [usbcore]
[    2.789954]  [<ffffffff814ed5a8>] ? io_schedule_timeout+0xd8/0x110
[    2.789956]  [<ffffffffa006e09c>] usb_hcd_submit_urb+0x9c/0x980 [usbcore]
[    2.789958]  [<ffffffff812d0ebf>] ? copy_page_to_iter+0x14f/0x2b0
[    2.789960]  [<ffffffff81126818>] ? pagecache_get_page+0x28/0x240
[    2.789962]  [<ffffffff8118c2a0>] ? touch_atime+0x20/0xa0
[    2.789964]  [<ffffffffa006f7c4>] usb_submit_urb+0x2c4/0x520 [usbcore]
[    2.789967]  [<ffffffffa006feca>] usb_start_wait_urb+0x5a/0xe0 [usbcore]
[    2.789969]  [<ffffffffa007000c>] usb_control_msg+0xbc/0xf0 [usbcore]
[    2.789970]  [<ffffffffa067903d>] usb_cypress_writemem+0x3d/0x40 [dvb_usb]
[    2.789972]  [<ffffffffa06791cf>] usb_cypress_load_firmware+0x4f/0x130 [dvb_usb]
[    2.789973]  [<ffffffff8109dbbe>] ? console_unlock+0x2fe/0x5d0
[    2.789974]  [<ffffffff8109e10c>] ? vprintk_emit+0x27c/0x410
[    2.789975]  [<ffffffff8109e40a>] ? vprintk_default+0x1a/0x20
[    2.789976]  [<ffffffff81124d76>] ? printk+0x43/0x4b
[    2.789977]  [<ffffffffa0679310>] dvb_usb_download_firmware+0x60/0xd0 [dvb_usb]
[    2.789979]  [<ffffffffa0679898>] dvb_usb_device_init+0x3d8/0x610 [dvb_usb]
[    2.789981]  [<ffffffffa069e302>] dtt200u_usb_probe+0x92/0xd0 [dvb_usb_dtt200u]
[    2.789984]  [<ffffffffa007420c>] usb_probe_interface+0xfc/0x270 [usbcore]
[    2.789985]  [<ffffffff8138bf95>] driver_probe_device+0x215/0x2d0
[    2.789986]  [<ffffffff8138c0e6>] __driver_attach+0x96/0xa0
[    2.789987]  [<ffffffff8138c050>] ? driver_probe_device+0x2d0/0x2d0
[    2.789988]  [<ffffffff81389ffb>] bus_for_each_dev+0x5b/0x90
[    2.789989]  [<ffffffff8138b7b9>] driver_attach+0x19/0x20
[    2.789990]  [<ffffffff8138b33c>] bus_add_driver+0x11c/0x220
[    2.789991]  [<ffffffff8138c91b>] driver_register+0x5b/0xd0
[    2.789994]  [<ffffffffa0072f6c>] usb_register_driver+0x7c/0x130 [usbcore]
[    2.789994]  [<ffffffffa06a5000>] ? 0xffffffffa06a5000
[    2.789996]  [<ffffffffa06a501e>] dtt200u_usb_driver_init+0x1e/0x20 [dvb_usb_dtt200u]
[    2.789997]  [<ffffffff81000408>] do_one_initcall+0x38/0x140
[    2.789998]  [<ffffffff8116001c>] ? __vunmap+0x7c/0xc0
[    2.789999]  [<ffffffff81124fb0>] ? do_init_module+0x22/0x1d2
[    2.790000]  [<ffffffff81124fe8>] do_init_module+0x5a/0x1d2
[    2.790002]  [<ffffffff810c96b1>] load_module+0x1e11/0x2580
[    2.790003]  [<ffffffff810c68b0>] ? show_taint+0x30/0x30
[    2.790004]  [<ffffffff81177250>] ? kernel_read_file+0x100/0x190
[    2.790005]  [<ffffffff810c9ffa>] SyS_finit_module+0xba/0xc0
[    2.790007]  [<ffffffff814f13e0>] entry_SYSCALL_64_fastpath+0x13/0x94
[    2.790008] ---[ end trace c78a74e78baec6fc ]---

So, allocate the structure dynamically.

Cc: stable@vger.kernel.org # Kernel 4.9+
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] exynos4-is: Add missing 'of_node_put'
Christophe JAILLET [Mon, 23 Jan 2017 21:16:56 +0000 (19:16 -0200)]
[media] exynos4-is: Add missing 'of_node_put'

It is likely that a "of_node_put(ep)" is missing here.
There is one in the previous error handling code, and one a few lines
below in the normal case as well.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: dvb-frontends: constify vb2_ops structure
Bhumika Goyal [Sat, 21 Jan 2017 09:45:31 +0000 (07:45 -0200)]
[media] media: dvb-frontends: constify vb2_ops structure

Declare vb2_ops structure as const as it is only stored in
the ops field of a vb2_queue structure. This field is of type
const, so vb2_ops structures having same properties can be made
const too.
Done using Coccinelle:

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

@ok1@
identifier r1.i;
position p;
struct sta2x11_vip vip;
struct vb2_queue q;
@@
(
vip.vb_vidq.ops=&i@p
|
q.ops=&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 vb2_ops i;

File size details of media/dvb-frontends/rtl2832_sdr.o file remains the
same before and after applying the patch.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: pci: constify vb2_ops structure
Bhumika Goyal [Sat, 21 Jan 2017 09:37:25 +0000 (07:37 -0200)]
[media] media: pci: constify vb2_ops structure

Declare vb2_ops structure as const as it is only stored in
the ops field of a vb2_queue structure. This field is of type
const, so vb2_ops structures having same properties can be made
const too.
Done using Coccinelle:

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

@ok1@
identifier r1.i;
position p;
struct sta2x11_vip vip;
struct vb2_queue q;
@@
(
vip.vb_vidq.ops=&i@p
|
q.ops=&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 vb2_ops i;

File size before:
   text    data     bss     dec     hex filename
   8448     440       0    8888    22b8 media/pci/sta2x11/sta2x11_vip.o

File size after:
   text    data     bss     dec     hex filename
   8552     352       0    8904    22c8 media/pci/sta2x11/sta2x11_vip.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: subdev: Clean up properly in subdev devnode registration error path
Laurent Pinchart [Sun, 15 Jan 2017 19:05:30 +0000 (17:05 -0200)]
[media] v4l: subdev: Clean up properly in subdev devnode registration error path

Set the subdev devnode pointer right after registration to ensure that
later errors won't skip the subdev when unregistering all devnodes.

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 ago[media] coda: add Freescale firmware compatibility location
Baruch Siach [Sun, 15 Jan 2017 10:33:53 +0000 (08:33 -0200)]
[media] coda: add Freescale firmware compatibility location

The Freescale provided imx-vpu looks for firmware files under /lib/firmware/vpu
by default. Make coda look there for firmware files to ease the update path.

Cc: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] mce_kbd: add missing keys from UK layout
Sean Young [Thu, 2 Feb 2017 16:20:36 +0000 (14:20 -0200)]
[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>
7 years ago[media] lirc: cannot read from tx-only device
Sean Young [Wed, 1 Feb 2017 22:08:56 +0000 (20:08 -0200)]
[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>
7 years ago[media] Documentation: devicetree: add the RC map name of the geekbox remote
Martin Blumenstingl [Tue, 31 Jan 2017 21:13:42 +0000 (19:13 -0200)]
[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>
7 years ago[media] Documentation: devicetree: meson-ir: "linux,rc-map-name" is supported
Martin Blumenstingl [Tue, 31 Jan 2017 21:21:12 +0000 (19:21 -0200)]
[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>
7 years ago[media] gp8psk: make local symbol gp8psk_fe_ops static
Wei Yongjun [Thu, 12 Jan 2017 15:32:29 +0000 (13:32 -0200)]
[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>
7 years ago[media] tm6000: fix typo in parameter description
Wei Yongjun [Thu, 12 Jan 2017 14:30:47 +0000 (12:30 -0200)]
[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>
7 years ago[media] em28xx: support for Hauppauge WinTV-dualHD 01595 ATSC/QAM
Kevin Cheng [Tue, 10 Jan 2017 03:14:29 +0000 (01:14 -0200)]
[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>
7 years ago[media] lgdt3306a: support i2c mux for use by em28xx
Kevin Cheng [Tue, 10 Jan 2017 03:14:18 +0000 (01:14 -0200)]
[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>
7 years ago[media] media/usbvision: remove ctrl_urb_wq
Davidlohr Bueso [Mon, 9 Jan 2017 15:41:34 +0000 (13:41 -0200)]
[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>
7 years ago[media] v4l2-subdev.h: fix v4l2_subdev_pad_config documentation
Baruch Siach [Wed, 4 Jan 2017 13:47:17 +0000 (11:47 -0200)]
[media] v4l2-subdev.h: fix v4l2_subdev_pad_config documentation

The fields of v4l2_subdev_pad_config are not pointers.

Fixes: 21c29de1d09 ("[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>
7 years ago[media] v4l: rcar_fdp1: use %4.4s to format a 4-byte string
Nicolas Iooss [Mon, 26 Dec 2016 13:31:39 +0000 (11:31 -0200)]
[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>
7 years ago[media] cx23885: attach md88ds3103 driver via i2c_client for DVBSky S952
Niels Ole Salscheider [Sun, 25 Dec 2016 15:38:20 +0000 (13:38 -0200)]
[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>
7 years ago[media] ngene: drop ngene_link_reset()
Cao jin [Mon, 19 Dec 2016 06:49:53 +0000 (04:49 -0200)]
[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>
7 years ago[media] media: dvb: dmx: fixed coding style issues of spacing
devendra sharma [Sun, 18 Dec 2016 13:52:55 +0000 (11:52 -0200)]
[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>
7 years ago[media] stk1160: make some functions static
Mauro Carvalho Chehab [Fri, 3 Feb 2017 13:30:37 +0000 (11:30 -0200)]
[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>
7 years ago[media] stk1160: Wait for completion of transfers to and from AC97 codec
Marcel Hasler [Thu, 15 Dec 2016 22:14:03 +0000 (20:14 -0200)]
[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>
7 years ago[media] stk1160: Check whether to use AC97 codec
Marcel Hasler [Thu, 15 Dec 2016 22:13:34 +0000 (20:13 -0200)]
[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>
7 years ago[media] stk1160: Remove stk1160-mixer and setup internal AC97 codec automatically
Marcel Hasler [Thu, 15 Dec 2016 22:17:26 +0000 (20:17 -0200)]
[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>
7 years ago[media] v4l2-ctrls.c: add NULL check
Hans Verkuil [Wed, 25 Jan 2017 07:38:07 +0000 (05:38 -0200)]
[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>
7 years ago[media] media: radio-cadet, initialize timer with setup_timer
Matej Hulín [Mon, 23 Jan 2017 09:12:30 +0000 (07:12 -0200)]
[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>
7 years ago[media] saa7164: "first image" should be "second image" in error message
Colin Ian King [Wed, 18 Jan 2017 15:10:57 +0000 (13:10 -0200)]
[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>
7 years ago[media] gspca_stv06xx: remove redundant check for err < 0
Colin Ian King [Wed, 11 Jan 2017 16:24:33 +0000 (14:24 -0200)]
[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>
7 years ago[media] tc358743: ctrl_detect_tx_5v should always be updated
Mats Randgaard [Tue, 6 Dec 2016 10:24:29 +0000 (08:24 -0200)]
[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>
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>