linux-2.6-microblaze.git
4 years agomedia: siano: fix spelling mistake "ENBALE" -> "ENABLE"
Colin Ian King [Sun, 3 Nov 2019 13:07:20 +0000 (14:07 +0100)]
media: siano: fix spelling mistake "ENBALE" -> "ENABLE"

Macros MSG_SMS_ENBALE_TS_INTERFACE_REQ and MSG_SMS_ENBALE_TS_INTERFACE_RES
contain a spelling mistake. Fix these by replacing ENBALE with ENABLE.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: mantis: fix two smatch errors
Hans Verkuil [Sun, 3 Nov 2019 11:23:38 +0000 (12:23 +0100)]
media: mantis: fix two smatch errors

Drop two dprintk's that relied on a non-NULL mantis pointer
when it was in fact a NULL pointer.

Fix those warnings:

drivers/media/pci/mantis/mantis_cards.c:73 mantis_irq_handler() error: we previously assumed 'mantis' could be null (see line 72)
drivers/media/pci/mantis/hopper_cards.c:64 hopper_irq_handler() error: we previously assumed 'mantis' could be null (see line 63)

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: ov6650: fix smatch warning
Hans Verkuil [Sun, 3 Nov 2019 11:23:37 +0000 (12:23 +0100)]
media: ov6650: fix smatch warning

Initialize ret to 0 to fix this smatch error:

drivers/media/i2c/ov6650.c:853 ov6650_video_probe() error: uninitialized symbol 'ret'.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: ti-vpe: fix smatch error
Hans Verkuil [Sun, 3 Nov 2019 11:23:36 +0000 (12:23 +0100)]
media: ti-vpe: fix smatch error

This patch fixes this error:

drivers/media/platform/ti-vpe/vpdma.c:767 dump_dtd() error: '%pad' expects argument of type 'dma_addr_t*', argument 2 has type 'uint*'

dtd->start_addr is a u32, so no need for %pad.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: em28xx: fix two smatch warnings
Hans Verkuil [Sun, 3 Nov 2019 11:23:35 +0000 (12:23 +0100)]
media: em28xx: fix two smatch warnings

Use sizeof instead of ARRAY_SIZE to fix this smatch warning:

drivers/media/usb/em28xx/em28xx-i2c.c:952 em28xx_do_i2c_scan() warn: calling memset(x, y, ARRAY_SIZE());

Do the same for the em28xx_hash_mem() call in the same function.
smatch didn't pick that up, but there too it should use sizeof instead
of ARRAY_SIZE.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: rc/ite-cir: fix smatch warning
Hans Verkuil [Sun, 3 Nov 2019 11:23:34 +0000 (12:23 +0100)]
media: rc/ite-cir: fix smatch warning

Use sizeof instead of ARRAY_SIZE to fix this smatch warning:

drivers/media/rc/ite-cir.c:385 ite_tx_ir() warn: calling memset(x, y, ARRAY_SIZE());

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: mtk-vpu: fix two smatch warnings
Hans Verkuil [Sun, 3 Nov 2019 11:23:33 +0000 (12:23 +0100)]
media: mtk-vpu: fix two smatch warnings

Drop the "id >= 0" test in two conditions to fix these warnings:

drivers/media/platform/mtk-vpu/mtk_vpu.c:276 vpu_ipi_register() warn: always true condition '(id >= 0) => (0-u32max >= 0)'
drivers/media/platform/mtk-vpu/mtk_vpu.c:401 vpu_wdt_reg_handler() warn: always true condition '(id >= 0) => (0-u32max >= 0)'

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: am437x: fix smatch warning
Hans Verkuil [Sun, 3 Nov 2019 11:23:31 +0000 (08:23 -0300)]
media: am437x: fix smatch warning

Fixes this warning:

drivers/media/platform/am437x/am437x-vpfe.c:288 vpfe_ccdc_validate_param() warn: unsigned 'ccdcparam->alaw.gamma_wd' is never less than zero.

by dropping the gamma_wd < VPFE_CCDC_GAMMA_BITS_15_6 check
since VPFE_CCDC_GAMMA_BITS_15_6 is 0.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: vivid: media_device_cleanup was called too early
Hans Verkuil [Sat, 2 Nov 2019 17:35:41 +0000 (14:35 -0300)]
media: vivid: media_device_cleanup was called too early

Running the contrib/test/test-media script in v4l-utils with the vivid argument
will cause this kernel warning:

[  104.748720] videodev: v4l2_release
[  104.748731] ------------[ cut here ]------------
[  104.748750] DEBUG_LOCKS_WARN_ON(lock->magic != lock)
[  104.748790] WARNING: CPU: 6 PID: 1823 at kernel/locking/mutex.c:938 __mutex_lock+0x919/0xc10
[  104.748800] Modules linked in: rc_cec vivid v4l2_tpg videobuf2_dma_contig cec rc_core v4l2_dv_timings videobuf2_vmalloc videobuf2_memops
videobuf2_v4l2 videobuf2_common videodev mc vmw_balloon vmw_vmci button vmwgfx
[  104.748845] CPU: 6 PID: 1823 Comm: sleep Not tainted 5.4.0-rc1-test-no #150
[  104.748853] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/29/2019
[  104.748867] RIP: 0010:__mutex_lock+0x919/0xc10
[  104.748878] Code: 59 83 e8 9a fc 16 ff 44 8b 05 23 61 38 01 45 85 c0 0f 85 ef f7 ff ff 48 c7 c6 a0 1f 87 82 48 c7 c7 a0 1e 87 82 e8 cd bb
f7 fe <0f> 0b e9 d5 f7 ff ff f6 c3 04 0f 84 3b fd ff ff 49 89 df 41 83 e7
[  104.748886] RSP: 0018:ffff88811a357b80 EFLAGS: 00010286
[  104.748895] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
[  104.748902] RDX: 0000000000000003 RSI: 0000000000000004 RDI: ffffed102346af62
[  104.748910] RBP: ffff88811a357cf0 R08: ffffffff81217c91 R09: fffffbfff061c271
[  104.748917] R10: fffffbfff061c270 R11: ffffffff830e1383 R12: ffff8881a46103c0
[  104.748924] R13: 0000000000000000 R14: ffff8881a4614f90 R15: ffff8881a46153d0
[  104.748933] FS:  0000000000000000(0000) GS:ffff8881b6780000(0000) knlGS:0000000000000000
[  104.748940] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  104.748949] CR2: 00007f163fc9ca20 CR3: 0000000003013004 CR4: 00000000001606e0
[  104.749036] Call Trace:
[  104.749051]  ? _raw_spin_unlock+0x1f/0x30
[  104.749067]  ? llist_add_batch+0x33/0x50
[  104.749081]  ? tick_nohz_tick_stopped+0x19/0x30
[  104.749130]  ? v4l2_release.cold+0x6c/0xd6 [videodev]
[  104.749143]  ? mutex_lock_io_nested+0xb80/0xb80
[  104.749153]  ? vprintk_emit+0xf2/0x220
[  104.749191]  ? vivid_req_validate+0x40/0x40 [vivid]
[  104.749201]  ? printk+0xad/0xde
[  104.749211]  ? kmsg_dump_rewind_nolock+0x54/0x54
[  104.749226]  ? locks_remove_file+0x78/0x2b0
[  104.749248]  ? __fsnotify_update_child_dentry_flags.part.0+0x170/0x170
[  104.749281]  ? vivid_req_validate+0x40/0x40 [vivid]
[  104.749321]  ? v4l2_release.cold+0x6c/0xd6 [videodev]
[  104.749361]  v4l2_release.cold+0x6c/0xd6 [videodev]
[  104.749378]  __fput+0x15a/0x390
[  104.749393]  task_work_run+0xb2/0xe0
[  104.749407]  do_exit+0x4d0/0x1200
[  104.749422]  ? do_user_addr_fault+0x367/0x610
[  104.749431]  ? release_task+0x990/0x990
[  104.749449]  ? rwsem_spin_on_owner+0x170/0x170
[  104.749463]  ? vmacache_find+0xb2/0x100
[  104.749476]  do_group_exit+0x85/0x130
[  104.749487]  __x64_sys_exit_group+0x23/0x30
[  104.749500]  do_syscall_64+0x5e/0x1c0
[  104.749511]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  104.749520] RIP: 0033:0x7f163fc5c9d6
[  104.749536] Code: Bad RIP value.
[  104.749543] RSP: 002b:00007ffe6f3bec58 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
[  104.749553] RAX: ffffffffffffffda RBX: 00007f163fd4d760 RCX: 00007f163fc5c9d6
[  104.749560] RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
[  104.749567] RBP: 0000000000000000 R08: 00000000000000e7 R09: ffffffffffffff80
[  104.749574] R10: 00007ffe6f3beb24 R11: 0000000000000246 R12: 00007f163fd4d760
[  104.749581] R13: 0000000000000002 R14: 00007f163fd56428 R15: 0000000000000000
[  104.749597] ---[ end trace 66f20f73fc0daf79 ]---

This is caused by media_device_cleanup() which destroys
v4l2_dev->mdev->req_queue_mutex. But v4l2_release() tries to lock
that mutex after media_device_cleanup() is called.

By moving media_device_cleanup() to the v4l2_device's release function it is
guaranteed that the mutex is valid whenever v4l2_release is called.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: vimc: Make capture devices and subdevices use different link_validates
Nícolas F. R. A. Prado [Wed, 30 Oct 2019 12:30:40 +0000 (09:30 -0300)]
media: vimc: Make capture devices and subdevices use different link_validates

Instead of validating the links to capture devices and subdevices with
the same function, use the default v4l function for links between
subdevices and only use a different function for validating between
capture device and subdevice.
This change should also ease future work to associate multiple mbus
codes for the same pixelformat in vimc_pix_map.

These changes were tested with
v4l2-compliance SHA: 3f806630e2ecbcebe31872b865c5c4b42f111a99, 64 bits
and passed all tests:
Grand Total for vimc device /dev/media0: 451, Succeeded: 451, Failed: 0, Warnings: 0

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@protonmail.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: hi556: Add support for Hi-556 sensor
Shawn Tu [Fri, 1 Nov 2019 10:44:31 +0000 (07:44 -0300)]
media: hi556: Add support for Hi-556 sensor

Add a V4L2 sub-device driver for Hynix Hi-556 image sensor.
This is a camera sensor using the I2C bus for control and the
CSI-2 bus for data.

This driver supports following features:
- manual exposure and analog/digital gain control support
- vblank/hblank control support
- test pattern support
- media controller support
- runtime PM support
- support following resolutions:
  + 2592x1944 at 30FPS
  + 1296x972  at 30FPS

[sakari.ailus@linux.intel.com: Remove MEDIA_CAMERA_SUPPORT from Kconfig dependencies]

Signed-off-by: Shawn Tu <shawnx.tu@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: staging/imx: Use a shorter name for driver
Fabio Estevam [Mon, 28 Oct 2019 17:13:13 +0000 (14:13 -0300)]
media: staging/imx: Use a shorter name for driver

Currently v4l2-compliance tool returns the following output:

Compliance test for imx-media-captu device /dev/video0:

Driver Info:
        Driver name      : imx-media-captu
        Card type        : imx-media-capture
...

The driver name string is limited to 16 characters, so provide
a shorter name so that we can have a better output.

While at it, use the same shorter name for driver and card.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: staging: media: allegro-dvt: remove bool comparison
Cristiane Naves [Sat, 26 Oct 2019 23:16:19 +0000 (20:16 -0300)]
media: staging: media: allegro-dvt: remove bool comparison

Bool tests don't need comparisons. Issue found by coccicheck.

Signed-off-by: Cristiane Naves <cristianenavescardoso09@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: s5p-jpeg: drop unused components from s5p_jpeg_q_data
Philipp Zabel [Thu, 24 Oct 2019 13:35:44 +0000 (10:35 -0300)]
media: s5p-jpeg: drop unused components from s5p_jpeg_q_data

The number of components are only set, and never used.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: dt-bindings: rcar_vin: Document RZ/G1 per-board settings
Geert Uytterhoeven [Thu, 24 Oct 2019 13:14:23 +0000 (10:14 -0300)]
media: dt-bindings: rcar_vin: Document RZ/G1 per-board settings

The R-Car Gen2 per-board settings apply to RZ/G1, too.

Fixes: 1d14a5eaa156b0b3 ("media: dt-bindings: media: rcar_vin: add device tree support for r8a774[35]")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: fdp1: Fix R-Car M3-N naming in debug message
Geert Uytterhoeven [Thu, 24 Oct 2019 13:09:16 +0000 (10:09 -0300)]
media: fdp1: Fix R-Car M3-N naming in debug message

The official name is "R-Car M3-N", not "R-Car M3N".

Fixes: 4e8c120de9268fc2 ("media: fdp1: Support M3N and E3 platforms")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: bt819: Reduce amount of F* words in the world
Andy Shevchenko [Thu, 24 Oct 2019 12:23:04 +0000 (09:23 -0300)]
media: bt819: Reduce amount of F* words in the world

Replace F* word with something less offensive.

[hverkuil: dropped 'Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")' tag since nothing was broken]

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: coda: request to skip kernel mapping for decoded buffers
Lucas Stach [Thu, 24 Oct 2019 10:32:49 +0000 (07:32 -0300)]
media: coda: request to skip kernel mapping for decoded buffers

The kernel driver never touches the decoded buffers with the CPU.
All accesses are either done by hardware DMA masters or userspace
mapping the buffers. This means we don't need a kernel virtual
address mapping for those buffers at all. As those buffers are
usually quite large, we can save a good deal of kernel vmalloc
space by requesting to not have a kernel mapping set up for them.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: coda: fix deadlock between decoder picture run and start command
Philipp Zabel [Thu, 24 Oct 2019 10:32:11 +0000 (07:32 -0300)]
media: coda: fix deadlock between decoder picture run and start command

The BIT decoder picture run temporarily locks the bitstream mutex while
the coda device mutex is locked, to refill the bitstream ring buffer.
Consequently, the decoder start command, which locks both mutexes when
flushing the bitstream ring buffer, must lock the coda device mutex
first as well, to avoid an ABBA deadlock.

Fixes: e7fd95849b3c ("media: coda: flush bitstream ring buffer on decoder restart")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: v4l2-core: fix touch support in v4l_g_fmt
Vandana BN [Tue, 22 Oct 2019 07:51:40 +0000 (04:51 -0300)]
media: v4l2-core: fix touch support in v4l_g_fmt

v4l_s_fmt, for VFL_TYPE_TOUCH, sets unneeded members of
the v4l2_pix_format structure to default values.This was
missing in v4l_g_fmt, which would lead to failures in
v4l2-compliance tests.

Signed-off-by: Vandana BN <bnvandana@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: v4l2-subdev: Don't use __u32 internally
Janusz Krzysztofik [Fri, 18 Oct 2019 15:31:40 +0000 (12:31 -0300)]
media: v4l2-subdev: Don't use __u32 internally

Commit a8fa55078a77 ("media: v4l2-subdev: Verify arguments in
v4l2_subdev_call()") and commit 374d62e7aa50 ("media: v4l2-subdev:
Verify v4l2_subdev_call() pad config argument") introduced a few local
functions, unfortunately with arguments of type __u32, reserved for use
in Linux uAPI.  Use u32 instead.

Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: exynos4-is: Fix recursive locking in isp_video_release()
Seung-Woo Kim [Fri, 18 Oct 2019 10:20:52 +0000 (07:20 -0300)]
media: exynos4-is: Fix recursive locking in isp_video_release()

>From isp_video_release(), &isp->video_lock is held and subsequent
vb2_fop_release() tries to lock vdev->lock which is same with the
previous one. Replace vb2_fop_release() with _vb2_fop_release() to
fix the recursive locking.

Fixes: 1380f5754cb0 ("[media] videobuf2: Add missing lock held on vb2_fop_release")
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: rcar_drif: fix a memory disclosure
Kangjie Lu [Fri, 18 Oct 2019 04:47:00 +0000 (01:47 -0300)]
media: rcar_drif: fix a memory disclosure

"f->fmt.sdr.reserved" is uninitialized. As other peer drivers
like msi2500 and airspy do, the fix initializes it to avoid
memory disclosures.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: staging: media: cedrus: use devm_platform_ioremap_resource() to simplify code
YueHaibing [Wed, 16 Oct 2019 08:56:04 +0000 (05:56 -0300)]
media: staging: media: cedrus: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: rcar-csi2: Enable support for R8A774B1
Biju Das [Tue, 15 Oct 2019 10:57:58 +0000 (07:57 -0300)]
media: rcar-csi2: Enable support for R8A774B1

Add the MIPI CSI-2 driver support for RZ/G2N(R8A774B1) SoC.
The CSI-2 module of RZ/G2N is similar to R-Car M3-N.

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: rcar-vin: Enable support for R8A774B1
Biju Das [Tue, 15 Oct 2019 10:57:57 +0000 (07:57 -0300)]
media: rcar-vin: Enable support for R8A774B1

Add the SoC specific information for RZ/G2N(R8A774B1) SoC.
The VIN module of RZ/G2N is similar to R-Car M3-N.

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: dt-bindings: rcar-csi2: Add R8A774B1 support
Biju Das [Tue, 15 Oct 2019 10:57:56 +0000 (07:57 -0300)]
media: dt-bindings: rcar-csi2: Add R8A774B1 support

Add the compatible string for RZ/G2N (R8A774B1) to the list of supported
SoCs.

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: dt-bindings: rcar-vin: Add R8A774B1 support
Biju Das [Tue, 15 Oct 2019 10:57:55 +0000 (07:57 -0300)]
media: dt-bindings: rcar-vin: Add R8A774B1 support

Document support for the VIN module in the Renesas RZ/G2N (R8A774B1) SoC.

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: rcar-vin: Add support for outputting NV12
Niklas Söderlund [Mon, 14 Oct 2019 00:16:15 +0000 (21:16 -0300)]
media: rcar-vin: Add support for outputting NV12

Most Gen3 boards can output frames in NV12 format, add support for this
with a runtime check that the running hardware supports it.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: rcar-vin: Define which hardware supports NV12
Niklas Söderlund [Mon, 14 Oct 2019 00:16:14 +0000 (21:16 -0300)]
media: rcar-vin: Define which hardware supports NV12

Most but not all Gen3 hardware support outputting NV12, add a flag to
indicate which SoCs do support it.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: rcar-vin: Do not enumerate unsupported pixel formats
Niklas Söderlund [Mon, 14 Oct 2019 00:07:50 +0000 (21:07 -0300)]
media: rcar-vin: Do not enumerate unsupported pixel formats

If a pixel format is not supported by the hardware NULL is returned by
rvin_format_from_pixel() for that fourcc. Verify that the pixel format
is supported using this or skip it when enumerating.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: radio: wl1273: fix interrupt masking on release
Johan Hovold [Thu, 10 Oct 2019 13:13:32 +0000 (10:13 -0300)]
media: radio: wl1273: fix interrupt masking on release

If a process is interrupted while accessing the radio device and the
core lock is contended, release() could return early and fail to update
the interrupt mask.

Note that the return value of the v4l2 release file operation is
ignored.

Fixes: 87d1a50ce451 ("[media] V4L2: WL1273 FM Radio: TI WL1273 FM radio driver")
Cc: stable <stable@vger.kernel.org> # 2.6.38
Cc: Matti Aaltonen <matti.j.aaltonen@nokia.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: bdisp: fix memleak on release
Johan Hovold [Thu, 10 Oct 2019 13:13:31 +0000 (10:13 -0300)]
media: bdisp: fix memleak on release

If a process is interrupted while accessing the video device and the
device lock is contended, release() could return early and fail to free
related resources.

Note that the return value of the v4l2 release file operation is
ignored.

Fixes: 28ffeebbb7bd ("[media] bdisp: 2D blitter driver using v4l2 mem2mem framework")
Cc: stable <stable@vger.kernel.org> # 4.2
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: v4l2-dv-timings: Use DIV_ROUND_CLOSEST directly to make it readable
zhong jiang [Wed, 9 Oct 2019 14:55:25 +0000 (11:55 -0300)]
media: v4l2-dv-timings: Use DIV_ROUND_CLOSEST directly to make it readable

The kernel.h macro DIV_ROUND_CLOSEST performs the computation (x + d/2)/d
but is perhaps more readable.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: vpx3220: make array input_vals static, makes object smaller
Colin Ian King [Sun, 6 Oct 2019 15:04:29 +0000 (12:04 -0300)]
media: vpx3220: make array input_vals static, makes object smaller

Don't populate the array input_vals on the stack but instead make it
static. Makes the object code smaller by 106 bytes.

Before:
   text    data     bss     dec     hex filename
  11744    3536     128   15408    3c30 drivers/media/i2c/vpx3220.o

After:
   text    data     bss     dec     hex filename
  11574    3600     128   15302    3bc6 drivers/media/i2c/vpx3220.o

(gcc version 9.2.1, amd64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: MAINTAINERS: Update MAX2175 & R-Car DRIF driver maintainer email
Chris Paterson [Thu, 26 Sep 2019 10:17:54 +0000 (07:17 -0300)]
media: MAINTAINERS: Update MAX2175 & R-Car DRIF driver maintainer email

Ramesh is now using a new email address. Update the maintainer entry for
the MAX2175 SDR tuner and the Renesas R-Car DRIF drivers.

Signed-off-by: Chris Paterson <chris.paterson2@renesas.com>
Acked-by: Ramesh Shanmugasundaram <rashanmu@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: xilinx: Use the correct style for SPDX License Identifier
Nishad Kamdar [Sat, 7 Sep 2019 14:21:36 +0000 (11:21 -0300)]
media: xilinx: Use the correct style for SPDX License Identifier

This patch corrects the SPDX License Identifier style
in header files related to Video drivers for Xilinx devices.
For C header files Documentation/process/license-rules.rst
mandates C-like comments (opposed to C source files where
C++ style should be used)

Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46.

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: imx7-mipi-csis: make array 'registers' static const, makes object smaller
Colin Ian King [Fri, 6 Sep 2019 15:08:23 +0000 (12:08 -0300)]
media: imx7-mipi-csis: make array 'registers' static const, makes object smaller

Don't populate the array 'registers' on the stack but instead make it
static const. Makes the object code smaller by 10 bytes.

Before:
   text    data     bss     dec     hex filename
  20138    5196     128   25462    6376 staging/media/imx/imx7-mipi-csis.o

After:
   text    data     bss     dec     hex filename
  20032    5292     128   25452    636c staging/media/imx/imx7-mipi-csis.o

(gcc version 9.2.1, amd64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: cx231xx: remove redundant assignment to variable status
Colin Ian King [Tue, 3 Sep 2019 17:06:39 +0000 (14:06 -0300)]
media: cx231xx: remove redundant assignment to variable status

Variable status is being initialized with a value that is never read
and is being re-assigned a later on. The assignment is redundant and
hence can be removed.

Addresses-Coverity: ("Unused value")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: smiapp: unlock on error in smiapp_start_streaming()
Dan Carpenter [Tue, 29 Oct 2019 18:24:01 +0000 (15:24 -0300)]
media: smiapp: unlock on error in smiapp_start_streaming()

We added two new error paths to smiapp_start_streaming(), but we can't
return directly without dropping the "sensor->mutex" lock.

Fixes: f8c4352c1bef ("media: smiapp: Move binning configuration to streaming start")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: staging/intel-ipu3: remove the unnecessary compiler flags
Bingbu Cao [Wed, 23 Oct 2019 03:01:23 +0000 (00:01 -0300)]
media: staging/intel-ipu3: remove the unnecessary compiler flags

Currently, we can build ipu3 driver code without any
warnings with W=1, so the extra compiler flags in Makefile
and the item in TODO file can be removed.

Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: doc-rst: ipu3: clarification on data type conversion of IEFD CU
Bingbu Cao [Wed, 23 Oct 2019 02:59:02 +0000 (23:59 -0300)]
media: doc-rst: ipu3: clarification on data type conversion of IEFD CU

The data type conversion of the IEFD CU inputs in ipu3 uapi
is ambiguities, add some clarification to help user to
understand this conversion.

Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Tomasz Figa <tfiga@chromium.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: doc-rst: add more info for resolution change blocks in ipu3
Bingbu Cao [Tue, 8 Oct 2019 04:21:27 +0000 (01:21 -0300)]
media: doc-rst: add more info for resolution change blocks in ipu3

This patch add more details for the resolution change blocks
It can help the developer to understand the main resolution
change blocks in ImgU.

[sakari.ailus@linux.intel.com: Add new files to MAINTAINERS]

Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
4 years agomedia: sun4i: Add H3 deinterlace driver
Jernej Skrabec [Wed, 23 Oct 2019 22:13:31 +0000 (19:13 -0300)]
media: sun4i: Add H3 deinterlace driver

Allwinner H3 SoC contains deinterlace unit, which has several modes of
operation - bypass, weave, bob and mixed (advanced) mode. I don't know
how mixed mode works, but according to Allwinner it gives best results,
so they use it exclusively. Currently this mode is also hardcoded here.

For each interleaved frame queued, this driver produces 2 deinterlaced
frames. Deinterlaced frames are based on 2 consequtive output buffers,
except for the first 2, where same output buffer is given to peripheral
as current and previous.

There is no documentation for this core, so register layout and fixed
values were taken from BSP driver.

I'm not sure if maximum size of the image unit is capable to process is
governed by size of "flag" buffers, frequency or it really is some HW
limitation. Currently driver can process full HD image in ~15ms (7.5ms
for each capture buffer), which allows to process 1920x1080@60i video
smoothly in real time.

Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
[hverkuil-cisco@xs4all.nl: add static to deinterlace_ioctl_ops]
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: dt-bindings: media: Add Allwinner H3 Deinterlace binding
Jernej Skrabec [Wed, 23 Oct 2019 22:13:30 +0000 (19:13 -0300)]
media: dt-bindings: media: Add Allwinner H3 Deinterlace binding

Allwinner H3 Deinterlace core is used for deinterlacing interlaced video
content. Core can also be found on some later SoCs, like H5 and R40.

Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: vimc: Implement debayer control for mean window size
Arthur Moraes do Lago [Wed, 2 Oct 2019 00:46:33 +0000 (21:46 -0300)]
media: vimc: Implement debayer control for mean window size

Add mean window size parameter for debayer filter as a control in
vimc-debayer.

vimc-debayer was patched to allow changing mean window parameter
of the filter without needing to reload the driver. The parameter
can now be set using a v4l2-ctl control(mean_window_size).

Co-developed-by: Laís Pessine do Carmo <laispc19@gmail.com>
Signed-off-by: Laís Pessine do Carmo <laispc19@gmail.com>
Signed-off-by: Arthur Moraes do Lago <arthurmoraeslago@gmail.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: vimc: move the dev field of each entity to vimc_ent_dev
Dafna Hirschfeld [Wed, 9 Oct 2019 15:53:14 +0000 (12:53 -0300)]
media: vimc: move the dev field of each entity to vimc_ent_dev

Since the 'struct device *dev' field exists in each of the
entity structs, it can be moved to the common struct vimc_ent_devevice.
It is then used to replace 'pr_err' with 'dev_err' in the streamer
code.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: vimc: embed the pads of entities in the entities' structs
Dafna Hirschfeld [Thu, 3 Oct 2019 12:59:42 +0000 (09:59 -0300)]
media: vimc: embed the pads of entities in the entities' structs

since the pads array is of known small size, there is no reason to
allocate it separately. Instead, it is embedded in the entity struct.
This also conforms to the media controller doc:
'Most drivers will embed the pads array in a driver-specific structure,
avoiding dynamic allocation.'

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
[hverkuil-cisco@xs4all.nl: remove unused vimc_pads_init()]
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: vimc: remove unused struct declaration vimc_platform_data
Dafna Hirschfeld [Wed, 9 Oct 2019 19:09:26 +0000 (16:09 -0300)]
media: vimc: remove unused struct declaration vimc_platform_data

the struct vimc_platform_data is not used anymore and can be removed.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: vimc: common: remove unused function 'vimc_pipeline_s_stream'
Dafna Hirschfeld [Tue, 22 Oct 2019 08:46:08 +0000 (05:46 -0300)]
media: vimc: common: remove unused function 'vimc_pipeline_s_stream'

The function 'vimc_pipeline_s_stream' is not used and can be
removed.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: vimc: remove EXPORT_SYMBOL_GPL declarations
Dafna Hirschfeld [Tue, 22 Oct 2019 08:46:07 +0000 (05:46 -0300)]
media: vimc: remove EXPORT_SYMBOL_GPL declarations

vimc is a single kernel module and does not need to
export any symbols therefore there is no need for these
declarations.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: vimc: remove the helper function vimc_ent_sd_unregister
Dafna Hirschfeld [Mon, 7 Oct 2019 13:50:03 +0000 (10:50 -0300)]
media: vimc: remove the helper function vimc_ent_sd_unregister

since this function only calls v4l2_device_unregister_subdev,
it is pointless.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: vimc: move media_entity_cleanup to release callbacks
Dafna Hirschfeld [Mon, 7 Oct 2019 13:50:02 +0000 (10:50 -0300)]
media: vimc: move media_entity_cleanup to release callbacks

according to the docs, this function must be called during
the cleanup phase after unregistering the entity.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: vimc: sen: register subdevice only after initialization
Dafna Hirschfeld [Mon, 7 Oct 2019 13:50:01 +0000 (10:50 -0300)]
media: vimc: sen: register subdevice only after initialization

vimc_sen_add function first registers the subdevice and then
calls tpg_alloc. If tpg_alloc fails it unregisters the subdevice
and then frees vsen, this cause double free since the release
callback that follows subdevice unregistration also frees vsen.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: vimc: cleanup code that assigns entity in entities array
Dafna Hirschfeld [Mon, 7 Oct 2019 13:50:00 +0000 (10:50 -0300)]
media: vimc: cleanup code that assigns entity in entities array

Since the add callback returns NULL on failure and the array
is initialized to NULLs, there is no need for the intermediate
assignment to local var.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: vimc: initialize vim entity pointers to NULL
Dafna Hirschfeld [Mon, 7 Oct 2019 13:49:59 +0000 (10:49 -0300)]
media: vimc: initialize vim entity pointers to NULL

since NULL value for vimc entity pointer indicates
that entity creation failed and this is tested, the
pointers should be initialized to NULL.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: imon: invalid dereference in imon_touch_event
Sean Young [Wed, 16 Oct 2019 17:19:15 +0000 (14:19 -0300)]
media: imon: invalid dereference in imon_touch_event

The touch timer is set up in intf1. If the second interface does not exist,
the timer and touch input device are not setup and we get the following
error, when touch events are reported via intf0.

kernel BUG at kernel/time/timer.c:956!
invalid opcode: 0000 [#1] SMP KASAN
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.0-rc1+ #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:__mod_timer kernel/time/timer.c:956 [inline]
RIP: 0010:__mod_timer kernel/time/timer.c:949 [inline]
RIP: 0010:mod_timer+0x5a2/0xb50 kernel/time/timer.c:1100
Code: 45 10 c7 44 24 14 ff ff ff ff 48 89 44 24 08 48 8d 45 20 48 c7 44 24 18 00 00 00 00 48 89 04 24 e9 5a fc ff ff e8 ae ce 0e 00 <0f> 0b e8 a7 ce 0e 00 4c 89 74 24 20 e9 37 fe ff ff e8 98 ce 0e 00
RSP: 0018:ffff8881db209930 EFLAGS: 00010006
RAX: ffffffff86c2b200 RBX: 00000000ffffa688 RCX: ffffffff83efc583
RDX: 0000000000000100 RSI: ffffffff812f4d82 RDI: ffff8881d2356200
RBP: ffff8881d23561e8 R08: ffffffff86c2b200 R09: ffffed103a46abeb
R10: ffffed103a46abea R11: ffff8881d2355f53 R12: dffffc0000000000
R13: 1ffff1103b64132d R14: ffff8881d2355f50 R15: 0000000000000006
FS:  0000000000000000(0000) GS:ffff8881db200000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f75e2799000 CR3: 00000001d3b07000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <IRQ>
 imon_touch_event drivers/media/rc/imon.c:1348 [inline]
 imon_incoming_packet.isra.0+0x2546/0x2f10 drivers/media/rc/imon.c:1603
 usb_rx_callback_intf0+0x151/0x1e0 drivers/media/rc/imon.c:1734
 __usb_hcd_giveback_urb+0x1f2/0x470 drivers/usb/core/hcd.c:1654
 usb_hcd_giveback_urb+0x368/0x420 drivers/usb/core/hcd.c:1719
 dummy_timer+0x120f/0x2fa2 drivers/usb/gadget/udc/dummy_hcd.c:1965
 call_timer_fn+0x179/0x650 kernel/time/timer.c:1404
 expire_timers kernel/time/timer.c:1449 [inline]
 __run_timers kernel/time/timer.c:1773 [inline]
 __run_timers kernel/time/timer.c:1740 [inline]
 run_timer_softirq+0x5e3/0x1490 kernel/time/timer.c:1786
 __do_softirq+0x221/0x912 kernel/softirq.c:292
 invoke_softirq kernel/softirq.c:373 [inline]
 irq_exit+0x178/0x1a0 kernel/softirq.c:413
 exiting_irq arch/x86/include/asm/apic.h:536 [inline]
 smp_apic_timer_interrupt+0x12f/0x500 arch/x86/kernel/apic/apic.c:1137
 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:830
 </IRQ>
RIP: 0010:default_idle+0x28/0x2e0 arch/x86/kernel/process.c:581
Code: 90 90 41 56 41 55 65 44 8b 2d 44 3a 8f 7a 41 54 55 53 0f 1f 44 00 00 e8 36 ee d0 fb e9 07 00 00 00 0f 00 2d fa dd 4f 00 fb f4 <65> 44 8b 2d 20 3a 8f 7a 0f 1f 44 00 00 5b 5d 41 5c 41 5d 41 5e c3
RSP: 0018:ffffffff86c07da8 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13
RAX: 0000000000000007 RBX: ffffffff86c2b200 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000006 RDI: ffffffff86c2ba4c
RBP: fffffbfff0d85640 R08: ffffffff86c2b200 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 cpuidle_idle_call kernel/sched/idle.c:154 [inline]
 do_idle+0x3b6/0x500 kernel/sched/idle.c:263
 cpu_startup_entry+0x14/0x20 kernel/sched/idle.c:355
 start_kernel+0x82a/0x864 init/main.c:784
 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:241
Modules linked in:

Reported-by: syzbot+f49d12d34f2321cf4df2@syzkaller.appspotmail.com
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: tuners: Use the correct style for SPDX License Identifier
Nishad Kamdar [Sun, 15 Sep 2019 11:14:58 +0000 (08:14 -0300)]
media: tuners: Use the correct style for SPDX License Identifier

This patch corrects the SPDX License Identifier style
in header file related to media Drivers for Analog TV Tuners.
For C header files Documentation/process/license-rules.rst
mandates C-like comments (opposed to C source files where
C++ style should be used)

Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46.

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: smiapp: Rename update_mode as pll_blanking_update
Sakari Ailus [Wed, 2 Oct 2019 10:51:22 +0000 (07:51 -0300)]
media: smiapp: Rename update_mode as pll_blanking_update

Rename the confusingly named smiapp_update_mode() function as
smiapp_pll_blanking_update(). The function is used to calculate new PLL
and blanking configuration after binning or scaling configuration has been
changed.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: smiapp: Register sensor after enabling runtime PM on the device
Sakari Ailus [Fri, 11 Oct 2019 11:16:02 +0000 (08:16 -0300)]
media: smiapp: Register sensor after enabling runtime PM on the device

Earlier it was possible that the parts of the driver that assumed runtime
PM was enabled were being called before runtime PM was enabled in the
driver's probe function. So enable runtime PM before registering the
sub-device.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: smiapp: Use non-binned and binned limits correctly
Sakari Ailus [Tue, 1 Oct 2019 12:00:32 +0000 (09:00 -0300)]
media: smiapp: Use non-binned and binned limits correctly

Use non-binned limits when binning is disabled and binned when they're
enabled.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: smiapp: Don't update sensor configuration during power-on init
Sakari Ailus [Tue, 1 Oct 2019 11:46:51 +0000 (08:46 -0300)]
media: smiapp: Don't update sensor configuration during power-on init

The sensor configuration since it was previously powered off was not
changed, so no need to update the PLL configuration etc. What is necessary
though is to re-apply the configuration to the sensor's registers.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: smiapp: Move binning configuration to streaming start
Sakari Ailus [Tue, 1 Oct 2019 11:34:55 +0000 (08:34 -0300)]
media: smiapp: Move binning configuration to streaming start

Only write the binning configuration at stream start. It has no effect
otherwise.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: smiapp: Don't get binning limits dynamically
Sakari Ailus [Tue, 1 Oct 2019 11:31:38 +0000 (08:31 -0300)]
media: smiapp: Don't get binning limits dynamically

The driver implementation assumed the binning limits could change
dynamically based on the binning configuration. This is not actually the
case; these limits are static and suitable to be used with all binning
configurations but possibly not optimal limit for many of those
configurations.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: smiapp: Destroy sensor's mutex
Sakari Ailus [Thu, 17 Oct 2019 11:17:05 +0000 (08:17 -0300)]
media: smiapp: Destroy sensor's mutex

Destroy the mutex initialised by the driver in probe.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: dt-bindings: smia: Remove documentation of nokia,nvm-size
Sakari Ailus [Tue, 24 Sep 2019 10:03:56 +0000 (07:03 -0300)]
media: dt-bindings: smia: Remove documentation of nokia,nvm-size

The nokia,nvm-size property was used to tell the size of the NVM memory
accessible through the sensor's register interface. However, while the
size isn't directly readable through the sensor's register interface, it
can be detected reading the NVM memory until the selected page is no
longer available.

Thus remove this property.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: smiapp: Support probing NVM size
Sakari Ailus [Tue, 24 Sep 2019 07:31:05 +0000 (04:31 -0300)]
media: smiapp: Support probing NVM size

The interface supports probing for the NVM size but this was not
implemented in the driver. Do that now.

This will also make nokia,nvm-size property redundant.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: smiapp: Don't poll for NVM ready on devices that don't need it
Sakari Ailus [Mon, 23 Sep 2019 13:18:38 +0000 (10:18 -0300)]
media: smiapp: Don't poll for NVM ready on devices that don't need it

Only some devices require polling for NVM ready. Do the polling only on
devices that need it.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: smiapp: Add definitions for data transfer if capability bits
Sakari Ailus [Tue, 24 Sep 2019 07:58:01 +0000 (04:58 -0300)]
media: smiapp: Add definitions for data transfer if capability bits

The data transfer capability register was defined but its bits were not.
Do that now.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: smiapp: Refactor reading NVM page
Sakari Ailus [Mon, 23 Sep 2019 13:15:11 +0000 (10:15 -0300)]
media: smiapp: Refactor reading NVM page

Split out reading a single NVM page into a separate function.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: smiapp: Fix error handling at NVM reading
Sakari Ailus [Mon, 23 Sep 2019 14:25:42 +0000 (11:25 -0300)]
media: smiapp: Fix error handling at NVM reading

If NVM reading failed, the device was left powered on. Fix that.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: smiapp: Use the BIT macro where appropriate, remove useless definition
Sakari Ailus [Mon, 23 Sep 2019 13:05:37 +0000 (10:05 -0300)]
media: smiapp: Use the BIT macro where appropriate, remove useless definition

The BIT macro is a better way to define register bits, for 1 << bit is
risky for 32-bit registers.

Also remove the definition of SMIAPP_DATA_TRANSFER_IF_1_CTRL_RD_EN which
has a value of zero.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: imx7-mipi-csis: Add a check for devm_regulator_get
Chuhong Yuan [Tue, 15 Oct 2019 13:59:15 +0000 (10:59 -0300)]
media: imx7-mipi-csis: Add a check for devm_regulator_get

devm_regulator_get may return an error but mipi_csis_phy_init misses
a check for it.
This may lead to problems when regulator_set_voltage uses the unchecked
pointer.
This patch adds a check for devm_regulator_get to avoid potential risk.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: st-mipid02: add a check for devm_gpiod_get_optional
Chuhong Yuan [Fri, 18 Oct 2019 01:46:56 +0000 (22:46 -0300)]
media: st-mipid02: add a check for devm_gpiod_get_optional

mipid02_probe misses a check for devm_gpiod_get_optional and may miss
the failure.
Add a check to fix the problem.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: i2c: Add IMX290 CMOS image sensor driver
Manivannan Sadhasivam [Fri, 4 Oct 2019 16:05:25 +0000 (13:05 -0300)]
media: i2c: Add IMX290 CMOS image sensor driver

Add driver for Sony IMX290 CMOS image sensor driver. The driver only
supports I2C interface for programming and MIPI CSI-2 for sensor output.

[Sakari Ailus: Rewrapped a few lines over 80 chars a little.]

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: dt-bindings: media: i2c: Add IMX290 CMOS sensor binding
Manivannan Sadhasivam [Fri, 4 Oct 2019 16:05:24 +0000 (13:05 -0300)]
media: dt-bindings: media: i2c: Add IMX290 CMOS sensor binding

Add devicetree binding for IMX290 CMOS image sensor. Let's also
add MAINTAINERS entry for the binding and driver.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: i2c: ov5695: Fix randbuild error
YueHaibing [Sun, 6 Oct 2019 07:38:38 +0000 (04:38 -0300)]
media: i2c: ov5695: Fix randbuild error

If VIDEO_OV5695 is y and V4L2_FWNODE is m, building fails:

drivers/media/i2c/ov5695.o: In function `ov5695_probe':
ov5695.c:(.text+0xf4c): undefined reference to `v4l2_async_register_subdev_sensor_common'

Select V4L2_FWNODE like OV5675 does.

Fixes: 623df5d710fe ("media: i2c: ov5695: Modify the function of async register subdev related devices")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: ad5820: Add support for ad5821 and ad5823
Ricardo Ribalda Delgado [Mon, 7 Oct 2019 13:28:56 +0000 (10:28 -0300)]
media: ad5820: Add support for ad5821 and ad5823

According to the datasheet, both AD5821 and AD5820 share a compatible
register-set:
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5821.pdf

Some camera modules also refer that AD5823 is a replacement of AD5820:
https://download.kamami.com/p564094-OV8865_DS.pdf

Suggested-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Ricardo Ribalda Delgado <ribalda@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: ad5820: DT new compatible devices
Ricardo Ribalda Delgado [Mon, 7 Oct 2019 13:28:55 +0000 (10:28 -0300)]
media: ad5820: DT new compatible devices

Document new compatible devices.

Cc: devicetree@vger.kernel.org
Signed-off-by: Ricardo Ribalda Delgado <ribalda@kernel.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: ad5820: Add support for of-autoload
Ricardo Ribalda Delgado [Mon, 7 Oct 2019 13:28:54 +0000 (10:28 -0300)]
media: ad5820: Add support for of-autoload

Since kernel 4.16, i2c devices with DT compatible tag are modprobed
using their DT modalias.
Without this patch, if this driver is build as module it would never
be autoprobed.

There is no need to mask it with CONFIG_OF to allow ACPI loading, this
also builds find with CONFIG_OF=n.

Signed-off-by: Ricardo Ribalda Delgado <ribalda@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: ad5820: Add support for enable pin
Ricardo Ribalda Delgado [Mon, 7 Oct 2019 13:28:53 +0000 (10:28 -0300)]
media: ad5820: Add support for enable pin

This patch adds support for a programmable enable pin. It can be used in
situations where the ANA-vcc is not configurable (dummy-regulator), or
just to have a more fine control of the power saving.

The use of the enable pin is optional.

Signed-off-by: Ricardo Ribalda Delgado <ribalda@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: ad5820: DT new optional field enable-gpios
Ricardo Ribalda Delgado [Mon, 7 Oct 2019 13:28:52 +0000 (10:28 -0300)]
media: ad5820: DT new optional field enable-gpios

Document new enable-gpio field. It can be used to disable the part
without turning down its regulator.

Cc: devicetree@vger.kernel.org
Signed-off-by: Ricardo Ribalda Delgado <ribalda@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: ad5820: Define entity function
Ricardo Ribalda Delgado [Mon, 7 Oct 2019 13:28:51 +0000 (10:28 -0300)]
media: ad5820: Define entity function

Without this patch, media_device_register_entity throws a warning:

dev_warn(mdev->dev,
 "Entity type for entity %s was not initialized!\n",
 entity->name);

Signed-off-by: Ricardo Ribalda Delgado <ribalda@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: ov5640: Make 2592x1944 mode only available at 15 fps
Benoit Parrot [Wed, 9 Oct 2019 12:35:10 +0000 (09:35 -0300)]
media: ov5640: Make 2592x1944 mode only available at 15 fps

The sensor data sheet clearly state that 2592x1944 only works at 15 fps
make sure we don't try to miss configure the pll out of acceptable
range.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: ov5640: Fix 1920x1080 mode to remove extra enable/disable
Benoit Parrot [Wed, 9 Oct 2019 12:35:09 +0000 (09:35 -0300)]
media: ov5640: Fix 1920x1080 mode to remove extra enable/disable

In the 1920x1080 register array an extra pair of reset ctrl disable
re-enable was causing unwanted init delays.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: ov5640: add PIXEL_RATE control
Benoit Parrot [Wed, 9 Oct 2019 12:35:08 +0000 (09:35 -0300)]
media: ov5640: add PIXEL_RATE control

Add v4l2 controls to report the pixel rates of each mode. This is
needed by some CSI2 receiver in order to perform proper DPHY
configuration.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: lm3646: remove redundant assignment to variable rval
Colin Ian King [Fri, 11 Oct 2019 17:13:54 +0000 (14:13 -0300)]
media: lm3646: remove redundant assignment to variable rval

The variable rval is being initialized with a value that
is never read and is being re-assigned a little later on. The
assignment is redundant and hence can be removed.

Addresses-Coverity: ("Unused value")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: ov6650: Fix arbitrary selection of master clock rate
Janusz Krzysztofik [Sun, 13 Oct 2019 12:50:50 +0000 (09:50 -0300)]
media: ov6650: Fix arbitrary selection of master clock rate

A hardcoded 12 MHz master clock frequency has been assumed since
conversion of the driver from soc_camera sensor to a standalone V4L2
subdevice by commit 23a52386fabe ("media: ov6650: convert to standalone
v4l2 subdevice").  Fix it.

Define a static table of supported master clock rates (fix misnamed
symbol while being at it), then use v4l2_clk_get/set_rate() to obtain
a clock rate matching one of those supported.  On success, apply
respective master clock hardware divisor provided by the matching
element of the table.

[Sakari Ailus: Initialize xclk to NULL.]

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: ov6650: Drop unused .pclk_max field
Janusz Krzysztofik [Sun, 13 Oct 2019 12:50:49 +0000 (09:50 -0300)]
media: ov6650: Drop unused .pclk_max field

This field of the driver private structure is no longer used, drop it.

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: ov6650: Don't reapply pixel clock divisor on format change
Janusz Krzysztofik [Sun, 13 Oct 2019 12:50:48 +0000 (09:50 -0300)]
media: ov6650: Don't reapply pixel clock divisor on format change

As calculation of pixel clock hardware divisor no longer depends on
mbus format specific maximum pixel clock, there is no need to reapply
the divisor on format change.  Drop related code from ov6650_s_fmt()
helper.

Since a master clock hardware divisor, so far applied only together
with the pixel clock divisor in a single operation, will no longer be
applied from ov6650_s_fmt(), apply it, still using a hardcoded value
for now, from  ov6650_prog_dflt() helper so hardware is still
initialised correctly on device probe.

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: ov6650: Simplify clock divisor calculation
Janusz Krzysztofik [Sun, 13 Oct 2019 12:50:47 +0000 (09:50 -0300)]
media: ov6650: Simplify clock divisor calculation

As appears from an analysis of to_clkrc() helper code after its
pclk_limit argument has been dropped, its result no longer depends on
another argument - pclk_max.  Moreover, assuming that a constant value
of FRAME_RATE_MAX is always used as a denominator of the only
significant argument left - a struct v4l2_fract, the result in fact
depends only on the numerator value of that argument.  As a further
consequence, it no longer makes sense to recalculate frame intervals by
converting them forth and back with a GET_CLKRC_DIV(to_clkrc(tpf))
construct.

Drop use of GET_CLKRC_DIV() on results of to_clkrc() where possible -
use the frame interval value directly.  Furthermore, replace the
to_clkrc() helper function with a simple macro and update its users to
always use FRAME_RATE_MAX as frame interval denominator and pass only
its numerator as an argument.

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: ov6650: Drop obsolete .pclk_limit attribute
Janusz Krzysztofik [Sun, 13 Oct 2019 12:50:46 +0000 (09:50 -0300)]
media: ov6650: Drop obsolete .pclk_limit attribute

That attribute used to be obtained from platform data by a soc_camera
host interface and passed to the sensor driver for .s_mbus_fmt() video
operation callback, later reused as .set_fmt() pad operation callback,
to be able to limit frame rate.  The driver stored that value in its
private structure for further use from .g/s_parm(), later converted to
g/s_frame_interval().

On conversion of the driver from soc_camera sensor to a standalone V4L2
subdevice by commit 23a52386fabe ("media: ov6650: convert to standalone
v4l2 subdevice"), that attribute had been replaced by a constant and
hardcoded to an arbitrarily chosen pixel clock limit.  Drop it.  Host
interfaces can limit frame rate if needed by calling
.s_frame_interval().

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: ov6650: Fix stored frame interval not in sync with hardware
Janusz Krzysztofik [Sun, 13 Oct 2019 12:50:45 +0000 (09:50 -0300)]
media: ov6650: Fix stored frame interval not in sync with hardware

The driver stores a frame interval value supposed to be in line with
hardware state in a device private structure.  Since the driver initial
submission, the respective field of the structure has never been
initialised on device probe.  Moreover, if updated from
.s_frame_interval(), a new value is stored before it is applied on
hardware.  If an error occurs during device update, the stored value
may no longer reflect hardware state and consecutive calls to
.g_frame_interval() may return incorrect information.

Assuming a failed update of the device means its actual state hasn't
changed, update the frame interval field of the device private
structure with a new value only after it is successfully applied on
hardware so it always reflects actual hardware state to the extent
possible.  Also, initialise the field with hardware default frame
interval on device probe.

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: cec-gpio: Use CONFIG_PREEMPTION
Sebastian Andrzej Siewior [Tue, 15 Oct 2019 19:18:17 +0000 (16:18 -0300)]
media: cec-gpio: Use CONFIG_PREEMPTION

CONFIG_PREEMPTION is selected by CONFIG_PREEMPT and by CONFIG_PREEMPT_RT.
Both PREEMPT and PREEMPT_RT require the same functionality which today
depends on CONFIG_PREEMPT.

Switch the Kconfig dependency to CONFIG_PREEMPTION.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: Documentation: v4l: fix section depth
Alexandre Courbot [Wed, 16 Oct 2019 09:52:39 +0000 (06:52 -0300)]
media: Documentation: v4l: fix section depth

The request API documentation introduced a new section which should have
been a subsection. Fix this.

Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: imx.rst: Pass the v4l2-ctl configuration
Fabio Estevam [Tue, 15 Oct 2019 16:00:42 +0000 (13:00 -0300)]
media: imx.rst: Pass the v4l2-ctl configuration

Pass the v4l2-ctl configuration for the imx6q-sabreauto PAL
example for completeness and consistency.

Suggested-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Acked-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: imx.rst: Provide instructions for the i.MX6DL sabreauto
Fabio Estevam [Tue, 15 Oct 2019 16:00:41 +0000 (13:00 -0300)]
media: imx.rst: Provide instructions for the i.MX6DL sabreauto

The i.MX6DL sabreauto has different numbering on the I2C bus and
I2C muxes compared to the i.MX6Q as shown in the kernel log below:

[    5.159423] imx-media: ipu1_csi0_mux:5 -> ipu1_csi0:0
[    5.164618] imx-media: ipu1_csi1_mux:5 -> ipu1_csi1:0
[    5.169953] imx-media: adv7180 4-0021:0 -> ipu1_csi0_mux:4

To avoid confusion, add an entry that shows how to setup the links and
configure the pads that are specific to the i.MX6DL sabreauto.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Acked-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: imx.rst: Provide a real example for the output format
Fabio Estevam [Tue, 15 Oct 2019 16:00:40 +0000 (13:00 -0300)]
media: imx.rst: Provide a real example for the output format

In the i.MX6Q sabreauto pipeline example, it is better to provide
a real example for the output format, so do it just like in the
previous lines for consistency.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Acked-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: imx.rst: Specify the sabreauto variant
Fabio Estevam [Tue, 15 Oct 2019 16:00:39 +0000 (13:00 -0300)]
media: imx.rst: Specify the sabreauto variant

Improve the documentation by specifying that the instructions
are related to the i.MX6Q sabreauto variant.

This avoids confusion if someone follows these steps on a i.MX6DL
sabreauto, which has different numbering on the I2C bus and
I2C muxes.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Acked-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4 years agomedia: i2c: adv7842: make array cri static and const, makes object smaller
Christophe JAILLET [Fri, 11 Oct 2019 20:48:29 +0000 (17:48 -0300)]
media: i2c: adv7842: make array cri static and const, makes object smaller

Don't populate the array 'cri' on the stack but instead make it
static and const. Makes the object code smaller by 165 bytes.

Turn the 2nd parameter of 'log_infoframe()' const accordingly.

Before:
   text    data     bss     dec     hex filename
  98533   20024     256  118813   1d01d drivers/media/i2c/adv7842.o

After:
   text    data     bss     dec     hex filename
  98304   20088     256  118648   1cf78 drivers/media/i2c/adv7842.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>