Mauro Carvalho Chehab [Mon, 11 Dec 2017 16:37:26 +0000 (11:37 -0500)]
media: dvb-core: allow users to enable DVB net ULE debug
This debug option is there for a long time, but it is only
enabled by editing the source code. Due to that, a breakage
inside its code was only noticed years after a change at
the ULE handling logic.
Make it a Kconfig parameter, as it makes easier for
advanced users to enable, and allow test if the compilation
won't be broken in the future.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Mon, 11 Dec 2017 16:37:24 +0000 (11:37 -0500)]
media: dvb_net: ensure that dvb_net_ule_handle is fully initialized
commit
efb9ab67255f ("[media] dvb_net: prepare to split a very
complex function") changed the ULE handling logic, simplifying it.
However, it forgot to keep the initialization for .priv and to
zero .ule_hist fields.
The lack of .priv cause crashes if dvb_net_ule() is called, as
the function assuems that .priv field to be initialized.
With regards to .ule_hist, the current logic is broken and don't
even compile if ULE_DEBUG. Fix it by making the debug vars static
again, and be sure to pass iov parameter to dvb_net_ule_check_crc().
Fixes:
efb9ab67255f ("[media] dvb_net: prepare to split a very complex function")
Suggested-by: Ron Economos <w6rz@comcast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Andi Shyti [Tue, 12 Dec 2017 07:47:20 +0000 (02:47 -0500)]
media: ir-spi: add SPDX identifier
Replace the original license statement with the SPDX identifier.
Update also the copyright owner adding myself as co-owner of the
copyright.
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Wed, 13 Dec 2017 21:30:22 +0000 (16:30 -0500)]
media: lirc: release lock before sleep
There is no reason to hold the lock while we wait for the IR to transmit.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Wed, 13 Dec 2017 21:17:44 +0000 (16:17 -0500)]
media: lirc: no need to recalculate duration
This is code existed for when drivers would send less than the whole
buffer; no driver does this any more, so this is redundant. Drivers
should return -EINVAL if they cannot send the entire buffer.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Wed, 13 Dec 2017 21:09:21 +0000 (16:09 -0500)]
media: lirc: do not pass ERR_PTR to kfree
If memdup_user() fails, txbuf will be an error pointer and passed
to kfree.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Mon, 11 Dec 2017 22:21:28 +0000 (17:21 -0500)]
media: rc: iguanair: simplify tx loop
The TX loop is more complex than it should. Simplify it.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Mon, 11 Dec 2017 22:12:09 +0000 (17:12 -0500)]
media: lirc: when transmitting scancodes, block until transmit is done
The semantics for lirc IR transmit with raw IR is that the write call
should block until the IR is transmitted. Some drivers have no idea
when this actually is (e.g. mceusb), so there is a wait.
This is useful for userspace, as it might want to send a IR button press,
a gap of a predefined number of milliseconds, and then send a repeat
message.
It turns out that for transmitting scancodes this feature is even more
useful, as user space has no idea how long the IR is. So, maintain
the existing semantics for IR scancode transmit.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Sun, 3 Dec 2017 13:55:24 +0000 (08:55 -0500)]
media: rc: bang in ir_do_keyup
rc_keydown() can be called from interrupt context, by e.g. an rc scancode
driver. Since commit
b2c96ba352b5 ("media: cec: move cec autorepeat
handling to rc-core"), the del_timer_sync() call is not happy about
being called in interrupt connect. del_timer() will suffice.
WARNING: CPU: 0 PID: 0 at kernel/time/timer.c:1285 del_timer_sync+0x1d/0x40
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 4.15.0-rc1+ #1
Hardware name: /DG45ID, BIOS IDG4510H.86A.0135.2011.0225.1100 02/25/2011
task:
ffffffffa3e10480 task.stack:
ffffffffa3e00000
RIP: 0010:del_timer_sync+0x1d/0x40
RSP: 0018:
ffff8b396bc03db0 EFLAGS:
00010046
RAX:
0000000080010000 RBX:
ffff8b394d70e410 RCX:
0000000000000073
RDX:
0000000000000001 RSI:
0000000000000001 RDI:
ffff8b394d70e410
RBP:
0000000000000001 R08:
ffffffffc0616000 R09:
ffff8b396bfa3000
R10:
0000000000000000 R11:
0000000000000390 R12:
ffff8b394f003800
R13:
0000000000000000 R14:
ffff8b3771c19630 R15:
0000000000000000
FS:
0000000000000000(0000) GS:
ffff8b396bc00000(0000) knlGS:
0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0:
0000000080050033
CR2:
00007f1944469000 CR3:
00000001ebe09000 CR4:
00000000000006f0
Call Trace:
<IRQ>
ir_do_keyup.part.5+0x22/0x90 [rc_core]
rc_keyup+0x37/0x50 [rc_core]
usb_rx_callback_intf0+0x79/0x90 [imon]
__usb_hcd_giveback_urb+0x90/0x130
uhci_giveback_urb+0xab/0x250
uhci_scan_schedule.part.34+0x806/0xb00
uhci_irq+0xab/0x150
usb_hcd_irq+0x22/0x30
__handle_irq_event_percpu+0x3a/0x180
handle_irq_event_percpu+0x30/0x70
handle_irq_event+0x27/0x50
handle_fasteoi_irq+0x6b/0x110
handle_irq+0xa5/0x100
do_IRQ+0x41/0xc0
common_interrupt+0x96/0x96
</IRQ>
RIP: 0010:cpuidle_enter_state+0x9a/0x2d0
RSP: 0018:
ffffffffa3e03e88 EFLAGS:
00000246 ORIG_RAX:
ffffffffffffffda
RAX:
ffff8b396bc1a000 RBX:
00000010da7bcd63 RCX:
00000010da7bccf6
RDX:
00000010da7bcd63 RSI:
00000010da7bcd63 RDI:
0000000000000000
RBP:
ffff8b394f587400 R08:
0000000000000000 R09:
0000000000000002
R10:
ffffffffa3e03e48 R11:
0000000000000390 R12:
0000000000000003
R13:
ffffffffa3ebf018 R14:
0000000000000000 R15:
00000010da7ba772
? cpuidle_enter_state+0x8d/0x2d0
do_idle+0x17b/0x1d0
cpu_startup_entry+0x6f/0x80
start_kernel+0x4a7/0x4c7
secondary_startup_64+0xa5/0xb0
Code: e7 5b 5d 41 5c e9 84 88 05 00 0f 1f 40 00 66 66 66 66 90 65 8b 05 e4 6f ef 5c a9 00 00 0f 00 53 48 89 fb 74 16 f6 47 22 20 75 10 <0f> ff 48 89 df e8 89 f1 ff ff 85 c0 79 0e f3 90 48 89 df e8 7b
Fixes:
b2c96ba352b5 ("media: cec: move cec autorepeat handling to rc-core")
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Sat, 2 Dec 2017 12:47:16 +0000 (07:47 -0500)]
media: imon: remove unused function tv2int
Since commit
9c7fd60e951d ("media: rc: Replace timeval with ktime_t in
imon.c"), the function tv2int() is no longer used. Remove it.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Sat, 2 Dec 2017 11:10:34 +0000 (06:10 -0500)]
media: imon: auto-config ffdc 26 device
Another device with the 0xffdc device id, this one with 0x26 in the
config byte. Its an iMON Inside + iMON IR. It does respond to rc-6,
but seems to produce random garbage rather than a scancode.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Mon, 18 Dec 2017 20:15:53 +0000 (15:15 -0500)]
media: fix SPDX comment on some header files
The agreed format is to use /* */ comments inside header
files. Unfortunately, I ended by using // on a few ones.
Reported-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Flavio Ceolin [Wed, 6 Dec 2017 16:37:45 +0000 (11:37 -0500)]
media: s5p-jpeg: Fix off-by-one problem
s5p_jpeg_runtime_resume() does not call clk_disable_unprepare()
for jpeg->clocks[0] when one of the clk_prepare_enable() fails.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Simon Shields [Mon, 27 Nov 2017 13:12:41 +0000 (08:12 -0500)]
media: exynos4-is: Check pipe is valid before calling subdev
If the subdev is not yet present (probably because the subdev
module has not yet been loaded), the pipe will be NULL. Make sure
that this is not the case before attempting to call the op.
Signed-off-by: Simon Shields <simon@lineageos.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Marek Szyprowski [Wed, 4 Oct 2017 06:38:25 +0000 (02:38 -0400)]
media: exynos4-is: Remove dependency on obsolete SoC support
Support for Exynos4212 SoCs has been removed by commit
bca9085e0ae9
("ARM: dts: exynos: remove Exynos4212 support (dead code)"), so there
is no need to keep remaining dead code related to this SoC version.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Shuah Khan [Sat, 4 Nov 2017 02:01:58 +0000 (22:01 -0400)]
media: s5p-mfc: Fix lock contention - request_firmware() once
Driver calls request_firmware() whenever the device is opened for the
first time. As the device gets opened and closed, dev->num_inst == 1
is true several times. This is not necessary since the firmware is saved
in the fw_buf. s5p_mfc_load_firmware() copies the buffer returned by
the request_firmware() to dev->fw_buf.
fw_buf sticks around until it gets released from s5p_mfc_remove(), hence
there is no need to keep requesting firmware and copying it to fw_buf.
This might have been overlooked when changes are made to free fw_buf from
the device release interface s5p_mfc_release().
Fix s5p_mfc_load_firmware() to call request_firmware() once and keep state.
Change _probe() to load firmware once fw_buf has been allocated.
s5p_mfc_open() and it continues to call s5p_mfc_load_firmware() and init
hardware which is the step where firmware is written to the device.
This addresses the mfc_mutex contention due to repeated request_firmware()
calls from open() in the following circular locking warning:
[ 552.194115] qtdemux0:sink/2710 is trying to acquire lock:
[ 552.199488] (&dev->mfc_mutex){+.+.}, at: [<
bf145544>] s5p_mfc_mmap+0x28/0xd4 [s5p_mfc]
[ 552.207459]
but task is already holding lock:
[ 552.213264] (&mm->mmap_sem){++++}, at: [<
c01df2e4>] vm_mmap_pgoff+0x44/0xb8
[ 552.220284]
which lock already depends on the new lock.
[ 552.228429]
the existing dependency chain (in reverse order) is:
[ 552.235881]
-> #2 (&mm->mmap_sem){++++}:
[ 552.241259] __might_fault+0x80/0xb0
[ 552.245331] filldir64+0xc0/0x2f8
[ 552.249144] call_filldir+0xb0/0x14c
[ 552.253214] ext4_readdir+0x768/0x90c
[ 552.257374] iterate_dir+0x74/0x168
[ 552.261360] SyS_getdents64+0x7c/0x1a0
[ 552.265608] ret_fast_syscall+0x0/0x28
[ 552.269850]
-> #1 (&type->i_mutex_dir_key#2){++++}:
[ 552.276180] down_read+0x48/0x90
[ 552.279904] lookup_slow+0x74/0x178
[ 552.283889] walk_component+0x1a4/0x2e4
[ 552.288222] link_path_walk+0x174/0x4a0
[ 552.292555] path_openat+0x68/0x944
[ 552.296541] do_filp_open+0x60/0xc4
[ 552.300528] file_open_name+0xe4/0x114
[ 552.304772] filp_open+0x28/0x48
[ 552.308499] kernel_read_file_from_path+0x30/0x78
[ 552.313700] _request_firmware+0x3ec/0x78c
[ 552.318291] request_firmware+0x3c/0x54
[ 552.322642] s5p_mfc_load_firmware+0x54/0x150 [s5p_mfc]
[ 552.328358] s5p_mfc_open+0x4e4/0x550 [s5p_mfc]
[ 552.333394] v4l2_open+0xa0/0x104 [videodev]
[ 552.338137] chrdev_open+0xa4/0x18c
[ 552.342121] do_dentry_open+0x208/0x310
[ 552.346454] path_openat+0x28c/0x944
[ 552.350526] do_filp_open+0x60/0xc4
[ 552.354512] do_sys_open+0x118/0x1c8
[ 552.358586] ret_fast_syscall+0x0/0x28
[ 552.362830]
-> #0 (&dev->mfc_mutex){+.+.}:
-> #0 (&dev->mfc_mutex){+.+.}:
[ 552.368379] lock_acquire+0x6c/0x88
[ 552.372364] __mutex_lock+0x68/0xa34
[ 552.376437] mutex_lock_interruptible_nested+0x1c/0x24
[ 552.382086] s5p_mfc_mmap+0x28/0xd4 [s5p_mfc]
[ 552.386939] v4l2_mmap+0x54/0x88 [videodev]
[ 552.391601] mmap_region+0x3a8/0x638
[ 552.395673] do_mmap+0x330/0x3a4
[ 552.399400] vm_mmap_pgoff+0x90/0xb8
[ 552.403472] SyS_mmap_pgoff+0x90/0xc0
[ 552.407632] ret_fast_syscall+0x0/0x28
[ 552.411876]
other info that might help us debug this:
[ 552.419848] Chain exists of:
&dev->mfc_mutex --> &type->i_mutex_dir_key#2 --> &mm->mmap_sem
[ 552.431200] Possible unsafe locking scenario:
[ 552.437092] CPU0 CPU1
[ 552.441598] ---- ----
[ 552.446104] lock(&mm->mmap_sem);
[ 552.449484] lock(&type->i_mutex_dir_key#2);
[ 552.456329] lock(&mm->mmap_sem);
[ 552.462222] lock(&dev->mfc_mutex);
[ 552.465775]
*** DEADLOCK ***
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Shuah Khan [Sat, 4 Nov 2017 02:01:57 +0000 (22:01 -0400)]
media: s5p-mfc: Remove firmware buf null check in s5p_mfc_load_firmware()
s5p_mfc_load_firmware() will not get called if fw_buf.virt allocation
fails. The allocation happens very early on in the probe routine and
probe fails if allocation fails.
There is no need to check if it is null in s5p_mfc_load_firmware().
Remove the check.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Marek Szyprowski [Tue, 31 Oct 2017 16:45:44 +0000 (12:45 -0400)]
media: exynos4-is: Drop obsolete capabilities
Setting both V4L2_CAP_VIDEO_CAPTURE_MPLANE and V4L2_CAP_VIDEO_OUTPUT_MPLANE
for mem2mem video nodes is obsolete since commit
f0476a83d61a ("[media]
V4L: Add capability flags for memory-to-memory devices"). It was enough
time to adapt all users to the new flags, so drop the legacy caps for now
to match other mem2mem drivers.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Marek Szyprowski [Tue, 31 Oct 2017 16:45:43 +0000 (12:45 -0400)]
media: exynos-gsc: Drop obsolete capabilities
Setting both V4L2_CAP_VIDEO_CAPTURE_MPLANE and V4L2_CAP_VIDEO_OUTPUT_MPLANE
for mem2mem video nodes is obsolete since commit
f0476a83d61a ("[media]
V4L: Add capability flags for memory-to-memory devices"). It was enough
time to adapt all users to the new flags, so drop the legacy caps for now
to match other mem2mem drivers.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Arnd Bergmann [Fri, 15 Sep 2017 19:54:34 +0000 (15:54 -0400)]
media: exynos4-is: properly initialize frame format
We copy the subdev frame format from a partially initialized
structure, which is not entirely well-defined. Older compilers
like gcc-4.4 can copy uninitialized stack data here and warn
about it:
drivers/media/platform/exynos4-is/fimc-isp.c: In function 'fimc_isp_subdev_open':
drivers/media/platform/exynos4-is/fimc-isp.c:379: error: 'fmt.reserved[10u]' may be used uninitialized in this function
drivers/media/platform/exynos4-is/fimc-isp.c:379: error: 'fmt.reserved[9u]' may be used uninitialized in this function
...
drivers/media/platform/exynos4-is/fimc-isp.c:379: error: 'fmt.reserved[0u]' may be used uninitialized in this function
drivers/media/platform/exynos4-is/fimc-isp.c:379: error: 'fmt.xfer_func' may be used uninitialized in this function
On newer compilers, only the initialized fields get copied, but
we should not rely on that, so this changes the code to zero-out
the remaining fields first.
Fixes:
9a761e436843 ("[media] exynos4-is: Add Exynos4x12 FIMC-IS driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sylwester Nawrocki [Tue, 21 Nov 2017 16:43:44 +0000 (11:43 -0500)]
media: s5p-mfc: Fix encoder menu controls initialization
This patch fixes the menu_skip_mask field initialization and
addresses a following issue found by the SVACE static analysis:
* NO_EFFECT.SELF: assignment to self in expression 'cfg.menu_skip_mask = cfg.menu_skip_mask'
No effect at drivers/media/platform/s5p-mfc/s5p_mfc_enc.c:2083
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Jia-Ju Bai [Tue, 12 Dec 2017 13:47:38 +0000 (08:47 -0500)]
media: bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_save_request
The driver may sleep under a spinlock.
The function call path is:
bdisp_device_run (acquire the spinlock)
bdisp_hw_update
bdisp_hw_save_request
devm_kzalloc(GFP_KERNEL) --> may sleep
To fix it, GFP_KERNEL is replaced with GFP_ATOMIC.
This bug is found by my static analysis tool(DSAC) and checked by my code review.
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Stanimir Varbanov [Tue, 29 Aug 2017 11:26:03 +0000 (07:26 -0400)]
media: vb2: unify calling of set_page_dirty_lock
Currently videobuf2-dma-sg checks for dma direction for
every single page and videobuf2-dc lacks any dma direction
checks and calls set_page_dirty_lock unconditionally.
Thus unify and align the invocations of set_page_dirty_lock
for videobuf2-dc, videobuf2-sg memory allocators with
videobuf2-vmalloc, i.e. the pattern used in vmalloc has been
copied to dc and dma-sg.
Suggested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Wed, 13 Dec 2017 23:44:42 +0000 (18:44 -0500)]
media: pvrusb2: correctly return V4L2_PIX_FMT_MPEG in enum_fmt
The pvrusb2 code appears to have a some old workaround code for xawtv that causes a
WARN() due to an unrecognized pixelformat 0 in v4l2_ioctl.c.
Since all other MPEG drivers fill this in correctly, it is a safe assumption that
this particular problem no longer exists.
While I'm at it, clean up the code a bit.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Philipp Zabel [Fri, 8 Dec 2017 14:01:28 +0000 (09:01 -0500)]
media: vb2: clear V4L2_BUF_FLAG_LAST when filling vb2_buffer
V4L2_BUF_FLAG_LAST is a signal from the driver to userspace for buffers
on the capture queue. When userspace queues back a capture buffer with
the flag set, we should clear it.
Otherwise, if userspace restarts streaming after EOS, without
reallocating the buffers, mem2mem devices will erroneously signal EOS
prematurely, as soon as the already flagged buffer is dequeued.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Philipp Zabel [Thu, 7 Dec 2017 14:59:51 +0000 (09:59 -0500)]
media: coda: use correct offset for mpeg4 decoder mvcol buffer
The mvcol buffer needs to be placed behind the chroma plane(s) when
decoding MPEG-4, same as for the h.264 decoder. Use the real offset
with the required rounding.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Philipp Zabel [Thu, 7 Dec 2017 14:59:50 +0000 (09:59 -0500)]
media: coda: allocate space for mpeg4 decoder mvcol buffer
The MPEG-4 decoder mvcol buffer was registered, but its size not added
to a frame buffer allocation. This could cause the decoder to write past
the end of the allocated buffer for large frame sizes.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Philipp Zabel [Thu, 7 Dec 2017 14:59:49 +0000 (09:59 -0500)]
media: coda: round up frame sizes to multiples of 16 for MPEG-4 decoder
We need internal frames to be rounded up to full macroblocks for MPEG-4
decoding as well.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Philipp Zabel [Thu, 7 Dec 2017 11:11:11 +0000 (06:11 -0500)]
media: coda: fix capture TRY_FMT for YUYV with non-MB-aligned widths
Since bytesperline always fulfills VDOA width requirements, detile the
whole buffer instead of limiting to visible width. This stops TRY_FMT
from returning -EINVAL for YUYV capture buffers that are not a multiple
of 16 wide.
An alternative would be to always round up width to stride, as we report
the valid image rectange via G_SELECTION (V4L2_SEL_TGT_COMPOSE_DEFAULT),
but that would require all applications to handle the compose default
rectangle properly.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Lucas Stach [Thu, 7 Dec 2017 11:09:46 +0000 (06:09 -0500)]
media: coda: set min_buffers_needed
The current driver implementation expects at least one buffer on
all queues to start streaming. Properly signal this to the vb2
core, to avoid confusion when streamon is racing with qbuf.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Flavio Ceolin [Wed, 6 Dec 2017 16:38:50 +0000 (11:38 -0500)]
media: pxa_camera: disable and unprepare the clock source on error
pxa_camera_probe() was not calling pxa_camera_deactivate(),
responsible to call clk_disable_unprepare(), on the failure path. This
was leading to unbalancing source clock.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Jacopo Mondi [Wed, 15 Nov 2017 17:59:12 +0000 (12:59 -0500)]
media: v4l: sh_mobile_ceu: Return buffers on streamoff()
videobuf2 core reports an error when not all buffers have been returned
to the framework:
drivers/media/v4l2-core/videobuf2-core.c:1651
WARN_ON(atomic_read(&q->owned_by_drv_count))
Fix this returning all buffers currently in capture queue.
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Mon, 9 Oct 2017 09:31:49 +0000 (05:31 -0400)]
media: vb2-core: fix descriptions for VB2-only functions
When we split VB2 into an independent streaming module and
a V4L2 one, some vb2-core functions started to have a wrong
description: they're meant to be used only by the API-specific
parts of VB2, like vb2-v4l2, as the functions that V4L2 drivers
should use are all under videobuf2-v4l2.h.
Correct their descriptions.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Thu, 5 Oct 2017 20:32:30 +0000 (16:32 -0400)]
media: v4l2-subdev: convert frame description to enum
As kernel-doc doesn't support documenting #define values,
and using enum makes easier to identify where the values
are used, convert V4L2_MBUS_FRAME_DESC_FL_* to enum, and
use BIT() macro.
While here, fix the description at v4l2_mbus_frame_desc_entry,
in order to match what's described for
V4L2_MBUS_FRAME_DESC_FL_LEN_MAX.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Thu, 5 Oct 2017 20:17:27 +0000 (16:17 -0400)]
media: v4l2-subdev: better document IO pin configuration flags
Convert V4L2_SUBDEV_IO_PIN_* to enums, use BIT() and document
via kernel-doc.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Fri, 6 Oct 2017 13:54:05 +0000 (09:54 -0400)]
media: v4l2-subdev: fix a typo
ownner -> owner
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Mon, 9 Oct 2017 10:20:48 +0000 (06:20 -0400)]
media: v4l2-tpg: use __u16 instead of int for struct tpg_rbg_color16
Despite the struct says "color16", it was actually using 32 bits
for each color. Fix it.
Suggested-by: Hans Verkuil <hverkuil@xs4all.nl>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Mon, 9 Oct 2017 10:10:28 +0000 (06:10 -0400)]
media: v4l2-tpg.h: rename color structs
The color structs right now are just "color" and "color16".
That may lead into conflicts, and don't define precisely what
they meant. As those are used by two drivers (vivid and vimc),
this is even on a somewhat public header!
So rename them to:
color -> tpg_rbg_color8
color16 -> tpg_rbg_color16
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Mon, 9 Oct 2017 10:02:25 +0000 (06:02 -0400)]
media: v4l2-tpg*.h: move headers to include/media/tpg and merge them
The v4l2-tpg*.h headers are meant to be used only internally by
vivid and vimc. There's no sense keeping them together with the
V4L2 kAPI headers. Also, one header includes the other as they're
meant to be used together. So, merge them.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Mon, 9 Oct 2017 09:36:52 +0000 (05:36 -0400)]
media: vb2: add cross references at memops and v4l2 kernel-doc markups
Add cross-references where needed and add periods at the end of
each kernel-doc paragraph, in order to make it coherent with other
VB2 descriptions.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Sat, 7 Oct 2017 09:05:03 +0000 (05:05 -0400)]
media: vb2-core: document remaining functions
There are several VB2 core functions that aren't documented.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Fri, 6 Oct 2017 16:22:43 +0000 (12:22 -0400)]
media: vb2-core: Improve kernel-doc markups
There are several issues on the current markups:
- lack of cross-references;
- wrong cross-references;
- lack of a period of the end of several phrases;
- Some descriptions can be enhanced.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Fri, 6 Oct 2017 16:20:52 +0000 (12:20 -0400)]
media: vb2-core: use bitops for bits
Use the existing macros to identify vb2_io_modes bits.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Fri, 6 Oct 2017 13:50:28 +0000 (09:50 -0400)]
media: v4l2-subdev: fix description of tuner.s_radio ops
The description there is completely broken and it mentions
an ioctl that doesn't exist.
Fix it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Thu, 5 Oct 2017 19:14:50 +0000 (15:14 -0400)]
media: v4l2-subdev: create cross-references for ioctls
When generating Sphinx output, create cross-references for the
callbacks for each ioctl.
While here, fix a few wrong names for ioctls.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Thu, 5 Oct 2017 18:05:25 +0000 (14:05 -0400)]
media: v4l2-dev: document video_device flags
Convert #defines to enums and add kernel-doc markups for V4L2
video_device flags.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Thu, 5 Oct 2017 17:52:19 +0000 (13:52 -0400)]
media: v4l2-dev: document VFL_DIR_* direction defines
The V4L_DIR_* direction flags document the direction for a
V4L2 device node. Convert them to enum and document.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Thu, 5 Oct 2017 13:56:39 +0000 (09:56 -0400)]
media: get rid of i2c-addr.h
In the past, the same I2C address were used on multiple places.
After I2C rebinding changes, this is no longer needed. So, we
can just get rid of this header, placing the I2C address where
they belong, e. g. either at bttv driver or at tvtuner.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Thu, 5 Oct 2017 13:49:26 +0000 (09:49 -0400)]
media: i2c-addr.h: get rid of now unused defines
Some of the previously used I2C addresses there aren't used
anymore. So, get rid of them.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Thu, 28 Sep 2017 22:39:32 +0000 (18:39 -0400)]
media: v4l2-dev: convert VFL_TYPE_* into an enum
Using enums makes easier to document, as it can use kernel-doc
markups. It also allows cross-referencing, with increases the
kAPI readability.
Please notice that now cx88_querycap() has to have a default for
the VFL type, as there are more types than supported by the driver.
Acked-By: Mike Isely <isely@pobox.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Thu, 28 Sep 2017 13:51:42 +0000 (09:51 -0400)]
media: v4l2-mediabus: use BIT() macro for flags
Instead of using (1 << n) for bits, use the BIT() macro,
as it makes a difference from documentation point of view.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Thu, 28 Sep 2017 13:41:48 +0000 (09:41 -0400)]
media: v4l2-flash-led-class.h: add kernel-doc to two helper funcs
There are two helper functions at v4l2-flash-led-class.h
that aren't documented.
Document them.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Thu, 28 Sep 2017 13:34:54 +0000 (09:34 -0400)]
media: v4l2-dev.h: add kernel-doc to two macros
There are two macros at v4l2-dev.h that aren't documented.
Document them, for completeness.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Fri, 22 Sep 2017 17:35:45 +0000 (13:35 -0400)]
media: v4l2-event.rst: improve events description
Both v4l2-event.rst and v4l2-event.h have an overview of
events, but there are some inconsistencies there:
- at v4l2-event, the event's ring buffer is called kevent. Its
name is, instead, v4l2_kevent;
- Some things are mentioned on both places (with different words),
others are either on one of the files.
In order to cleanup this mess, put everything at v4l2-event.rst
and improve it to be a little more coherent and to have cross
references.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Wed, 27 Sep 2017 19:54:43 +0000 (15:54 -0400)]
media: media-entity.h: add kernel-doc markups for nested structs
Now that nested structs are parsed by kernel-doc, add markups
to them.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Wed, 27 Sep 2017 19:49:45 +0000 (15:49 -0400)]
media: videobuf2-core: improve kernel-doc markups
Now that nested structs are supported, change the
documentation to use it. While here, add cross-references
where pertinent and use monotonic fonts where pertinent,
using the right markup tags.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Wed, 27 Sep 2017 16:25:21 +0000 (12:25 -0400)]
media: v4l2-ctrls: document nested members of structs
There are a few nested members at v4l2-ctrls.h. Now that
kernel-doc supports, document them.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Wed, 27 Sep 2017 13:51:06 +0000 (09:51 -0400)]
media: v4l2-fwnode.h: better describe bus union at fwnode endpoint struct
Better document the bus union at struct v4l2_fwnode_endpoint.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Sun, 24 Sep 2017 09:24:58 +0000 (05:24 -0400)]
media: rc-core.h: minor adjustments at rc_driver_type doc
The description of this enum doesn't match what it
actually represents. Adjust it.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Sat, 23 Sep 2017 10:49:50 +0000 (06:49 -0400)]
media: rc-core.rst: add an introduction for RC core
The RC core does several assumptions, but those aren't documented
anywhere, with could make harder for ones that want to understand
what's there.
So, add an introduction explaining the basic concepts of RC and
how they're related to the RC core implementation.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Fri, 22 Sep 2017 16:52:43 +0000 (12:52 -0400)]
media: v4l2-dv-timings.h: convert comment into kernel-doc markup
The can_reduce_fps() is already documented, but it is not
using the kernel-doc markup. Convert it, in order to generate
documentation from it.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Fri, 22 Sep 2017 13:03:54 +0000 (09:03 -0400)]
media: v4l2-common.h: document helper functions
There are several helper functions that aren't documented.
Document them.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Fri, 22 Sep 2017 13:49:27 +0000 (09:49 -0400)]
media: v4l2-common: get rid of struct v4l2_discrete_probe
This struct is there just two store two arguments of
v4l2_find_nearest_format(). The other two arguments are passed
as parameter.
IMHO, there isn't much sense on doing that, and that will just
add one more struct to document ;)
So, let's get rid of the struct, passing the parameters directly.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Thu, 21 Sep 2017 14:04:30 +0000 (10:04 -0400)]
media: v4l2-common: get rid of v4l2_routing dead struct
This struct is not used anymore. Get rid of it and update
the documentation about what should still be converted.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Thu, 21 Sep 2017 13:36:54 +0000 (09:36 -0400)]
media: tuner-types: add kernel-doc markups for struct tunertype
This struct is lacking documentation. Add it.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Wed, 27 Sep 2017 13:22:01 +0000 (09:22 -0400)]
media: frontend: describe nested structs
There are some nested structs on this header, with aren't
properly document them.
This should solve some warnings after the addition of
a patche at kernel-doc adding support for nested structs/unions.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Wed, 27 Sep 2017 13:04:04 +0000 (09:04 -0400)]
media: dvb_demux: describe nested structs
There are some nested structs on this header, with aren't
properly document them.
This should solve some warnings after the addition of
a patche at kernel-doc adding support for nested structs/unions.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Tue, 26 Sep 2017 20:46:16 +0000 (16:46 -0400)]
media: dmxdev: describe nested structs
There are some nested structs on this header, with aren't
properly document them.
This should solve some warnings after the addition of
a patche at kernel-doc adding support for nested structs/unions.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Steve Longerbeam [Fri, 15 Dec 2017 01:04:47 +0000 (20:04 -0500)]
media: staging/imx: update TODO
Update TODO file:
- Remove TODO info about the OV564x driver, while this still needs
to be done (add a OV5642 driver or merge with OV5640 driver), it
is not relevant here.
- Update TODO about methods for retrieving CSI bus config.
- Add some TODO's about OF graph parsing restrictions.
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Steve Longerbeam [Fri, 15 Dec 2017 01:04:46 +0000 (20:04 -0500)]
media: staging/imx: reorder function prototypes
Re-order some of the function prototypes in imx-media.h to
group them correctly by source file. No functional changes.
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Steve Longerbeam [Fri, 15 Dec 2017 01:04:45 +0000 (20:04 -0500)]
media: staging/imx: convert static vdev lists to list_head
Although not technically necessary because imx-media has only a
maximum of 8 video devices, and once setup the video device lists
are static, in anticipation of moving control ineritance to
v4l2-core, make the vdev lists more generic by converting to
dynamic list_head's.
After doing that, 'struct imx_media_pad' is now just a list_head
of video devices reachable from a pad. Allocate an array of list_head's,
one list_head for each pad, and attach that array to sd->host_priv.
An entry in the pad lists is of type 'struct imx_media_pad_vdev', and
points to a video device from the master list.
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Steve Longerbeam [Fri, 15 Dec 2017 01:04:44 +0000 (20:04 -0500)]
media: staging/imx: remove static subdev arrays
For more complex OF graphs, there will be more async subdevices
registered. Remove the static subdev[IMX_MEDIA_MAX_SUBDEVS] array,
so that imx-media places no limits on the number of async subdevs
that can be added and registered.
There were two uses for 'struct imx_media_subdev'. First was to act
as the async subdev list to be passed to v4l2_async_notifier_register().
Second was to aid in inheriting subdev controls to the capture devices,
and this is done by creating a list of capture devices that can be reached
from a subdev's source pad. So 'struct imx_media_subdev' also contained
a static array of 'struct imx_media_pad' for placing the capture device
lists at each pad.
'struct imx_media_subdev' has been completely removed. Instead, at async
completion, allocate an array of 'struct imx_media_pad' and attach it to
the subdev's host_priv pointer, in order to support subdev controls
inheritance.
Likewise, remove static async_ptrs[IMX_MEDIA_MAX_SUBDEVS] array.
Instead, allocate a 'struct imx_media_async_subdev' when forming
the async list, and add it to an asd_list list_head in
imx_media_add_async_subdev(). At async completion, allocate the
asd pointer list and pull the asd's off asd_list for
v4l2_async_notifier_register().
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Steve Longerbeam [Fri, 15 Dec 2017 01:04:43 +0000 (20:04 -0500)]
media: staging/imx: pass fwnode handle to find/add async subdev
Pass the subdev's fwnode_handle to imx_media_find_async_subdev() and
imx_media_add_async_subdev(), instead of a device_node.
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Steve Longerbeam [Fri, 15 Dec 2017 01:04:42 +0000 (20:04 -0500)]
media: staging/imx: remove devname string from imx_media_subdev
A separate string for the device name, for DEVNAME async match, was
never needed. Just assign the asd device name to the passed platform
device name pointer in imx_media_add_async_subdev().
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Steve Longerbeam [Fri, 15 Dec 2017 01:04:41 +0000 (20:04 -0500)]
media: staging/imx: of: allow for recursing downstream
Calling of_parse_subdev() recursively to a downstream path that has
already been followed is ok, it just means that call will return
immediately since the subdevice was already added to the async list.
With that there is no need to determine whether a subdevice's port
is a sink or source, so 'num_{sink|src}_pads' is no longer used and
is removed.
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Steve Longerbeam [Fri, 15 Dec 2017 01:04:40 +0000 (20:04 -0500)]
media: staging/imx: remove static media link arrays
Remove the static list of media links that were formed at probe time.
These links can instead be created after all registered async subdevices
have been bound in imx_media_probe_complete().
The media links between subdevices that exist in the device tree, can
be created post-async completion by using v4l2_fwnode_parse_link() for
each endpoint node of that subdevice. Note this approach assumes
device-tree ports are equivalent to media pads (pad index equals
port id), and that device-tree endpoints are equivalent to media
links between pads.
Because links are no longer parsed by imx_media_of_parse(), its sole
function is now only to add subdevices that it encounters by walking
the OF graph to the async list, so the function has been renamed
imx_media_add_of_subdevs().
Similarly, the media links between the IPU-internal subdevice pads (the
CSI source pads, and all pads between the vdic, ic-prp, ic-prpenc, and
ic-prpvf subdevices), can be created post-async completion by looping
through the subdevice's media pads and using the const internal_subdev
table.
Because links are no longer parsed by imx_media_add_internal_subdevs(),
this function no longer needs an array of CSI subdevs to form links
from.
In summary, the following functions, which were used to form a list
of media links at probe time, are removed:
imx_media_add_pad_link()
add_internal_links()
of_add_pad_link()
replaced by these functions, called at probe time, which only populate
the async subdev list:
imx_media_add_of_subdevs()
imx_media_add_internal_subdevs()
and these functions, called at async completion, which create the
media links:
imx_media_create_of_links()
imx_media_create_csi_of_links()
imx_media_create_internal_links()
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Steve Longerbeam [Fri, 15 Dec 2017 01:04:39 +0000 (20:04 -0500)]
media: staging/imx: get CSI bus type from nearest upstream entity
The imx-media driver currently supports a device tree graph of
limited complexity. This patch is a first step in allowing imx-media
to work with more general OF graphs.
The CSI subdevice assumes the originating upstream subdevice (the
"sensor") is connected directly to either the CSI mux or the MIPI
CSI-2 receiver. But for more complex graphs, the sensor can be distant,
with possible bridge entities in between. Thus the sensor's bus type
could be quite different from what is entering the CSI. For example
a distant sensor could have a parallel interface, but the stream
entering the i.MX is MIPI CSI-2.
To remove this assumption, get the entering bus config from the entity
that is directly upstream from either the CSI mux, or the CSI-2 receiver.
If the CSI-2 receiver is not in the enabled pipeline, the bus type to the
CSI is parallel, otherwise the CSI is receiving MIPI CSI-2.
Note that we can't use the direct upstream source connected to CSI
(which is either the CSI mux or the CSI-2 receiver) to determine
bus type. The bus entering the CSI from the CSI-2 receiver is a 32-bit
parallel bus containing the demultiplexed MIPI CSI-2 virtual channels.
But the CSI and its IDMAC channels must be configured based on whether
it is receiving data from the CSI-2 receiver or from the CSI mux's
parallel interface pins.
The function csi_get_upstream_endpoint() is used to find this
endpoint. It makes use of a new utility function
imx_media_find_upstream_pad(), that if given a grp_id of 0, will
return the closest upstream pad from start_entity.
With these changes, imx_media_find_sensor() is no longer used and
is removed. As a result there is also no longer a need to identify
any sensor or set the sensor subdev's group id as a method to search
for it. So IMX_MEDIA_GRP_ID_SENSOR is removed. Also the video-mux group
id IMX_MEDIA_GRP_ID_VIDMUX was never used so that is removed as well.
The remaining IMX_MEDIA_GRP_ID_* definitions are entities internal
to the i.MX.
Another use of imx_media_find_sensor() in the CSI was to call the
sensor's g_skip_frames op to determine if a delay was needed before
enabling the CSI at stream on. If necessary this will have to be
re-addressed at a later time.
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Arnd Bergmann [Thu, 30 Nov 2017 16:55:46 +0000 (11:55 -0500)]
media: dvb-frontends: fix i2c access helpers for KASAN
A typical code fragment was copied across many dvb-frontend drivers and
causes large stack frames when built with with CONFIG_KASAN on gcc-5/6/7:
drivers/media/dvb-frontends/cxd2841er.c:3225:1: error: the frame size of 3992 bytes is larger than 3072 bytes [-Werror=frame-larger-than=]
drivers/media/dvb-frontends/cxd2841er.c:3404:1: error: the frame size of 3136 bytes is larger than 3072 bytes [-Werror=frame-larger-than=]
drivers/media/dvb-frontends/stv0367.c:3143:1: error: the frame size of 4016 bytes is larger than 3072 bytes [-Werror=frame-larger-than=]
drivers/media/dvb-frontends/stv090x.c:3430:1: error: the frame size of 5312 bytes is larger than 3072 bytes [-Werror=frame-larger-than=]
drivers/media/dvb-frontends/stv090x.c:4248:1: error: the frame size of 4872 bytes is larger than 3072 bytes [-Werror=frame-larger-than=]
gcc-8 now solves this by consolidating the stack slots for the argument
variables, but on older compilers we can get the same behavior by taking
the pointer of a local variable rather than the inline function argument.
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715
Cc: stable@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Arnd Bergmann [Thu, 30 Nov 2017 11:08:05 +0000 (06:08 -0500)]
media: r820t: fix r820t_write_reg for KASAN
With CONFIG_KASAN, we get an overly long stack frame due to inlining
the register access functions:
drivers/media/tuners/r820t.c: In function 'generic_set_freq.isra.7':
drivers/media/tuners/r820t.c:1334:1: error: the frame size of 2880 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
This is caused by a gcc bug that has now been fixed in gcc-8.
To work around the problem, we can pass the register data
through a local variable that older gcc versions can optimize
out as well.
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Wed, 13 Dec 2017 10:19:03 +0000 (05:19 -0500)]
media: pxa_camera: rename the soc_camera_ prefix to pxa_camera_
Rename soc_camera to pxa_camera as this has no longer anything to do with the old
soc_camera driver/framework. It's confusing when grepping on soc_camera.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Wed, 13 Dec 2017 09:54:04 +0000 (04:54 -0500)]
media: vidioc-g-dv-timings.rst: fix typo (frontporch -> backporch)
The description of V4L2_DV_FL_HALF_LINE mixed up frontporch with backporch.
It's the backporch that has different sizes for interlaced formats, the frontporch
remains constant.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Tue, 12 Dec 2017 18:46:57 +0000 (13:46 -0500)]
media: staging/cxd2099: cosmetics: improve strings
Prefix dev_*() I2C address prints with 0x, change CXD2099 to CXD2099AR,
change the MODULE_DESCRIPTION to a proper one and have a better (and
shorter) description for the buffermode modparam.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Tue, 12 Dec 2017 18:46:56 +0000 (13:46 -0500)]
media: staging/cxd2099: fix debug message severity
Debug messages should go to KERN_DEBUG, thus change the slot_shutdown()
notice from dev_info() to dev_dbg().
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Tue, 12 Dec 2017 18:46:55 +0000 (13:46 -0500)]
media: staging/cxd2099: fix remaining checkpatch-strict issues
Fix up all remaining cosmetic issues as reported by checkpatch.pl.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Ron Economos [Tue, 12 Dec 2017 00:51:53 +0000 (19:51 -0500)]
media: [RESEND] media: dvb-frontends: Add delay to Si2168 restart
On faster CPUs a delay is required after the resume command and the restart command. Without the delay, the restart command often returns -EREMOTEIO and the Si2168 does not restart.
Note that this patch fixes the same issue as https://patchwork.linuxtv.org/patch/44304/, but I believe my udelay() fix addresses the actual problem.
Signed-off-by: Ron Economos <w6rz@comcast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Mon, 11 Dec 2017 20:12:49 +0000 (15:12 -0500)]
media: ddbridge: stv09xx: detach frontends on lnb failure
While the failure handling in dvb_input_attach() has been improved lately
so any tuner failure won't result in demod driver modules with a
usecount > 0 anymore (thus requiring rmmod -f), there's still an issue
with stv090x and stv0910 based tuner modules, in that LNB driver attach
failures leave an attached demod frontend driver behind which have a
usecount of > 0 in this failure case, due to them not being detached/
released. Fix this by detaching the demod frontends if the LNB driver
fails.
Richard tested and verified the changes with STV0910 hardware, thus adding
his Tested-by.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <rascobie@slingshot.co.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Arnd Bergmann [Mon, 11 Dec 2017 12:06:04 +0000 (07:06 -0500)]
media: tuners: tda8290: reduce stack usage with kasan
With CONFIG_KASAN enabled, we get a relatively large stack frame in one function
drivers/media/tuners/tda8290.c: In function 'tda8290_set_params':
drivers/media/tuners/tda8290.c:310:1: warning: the frame size of 1520 bytes is larger than 1024 bytes [-Wframe-larger-than=]
With CONFIG_KASAN_EXTRA this goes up to
drivers/media/tuners/tda8290.c: In function 'tda8290_set_params':
drivers/media/tuners/tda8290.c:310:1: error: the frame size of 3200 bytes is larger than 3072 bytes [-Werror=frame-larger-than=]
We can significantly reduce this by marking local arrays as 'static const', and
this should result in better compiled code for everyone.
[mchehab@s-opensource.com: fix a trivial merge conflict]
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Thu, 30 Nov 2017 13:00:45 +0000 (08:00 -0500)]
media: RC docs: add enum rc_proto description at the docs
This is part of the uAPI. Add it to the documentation again,
and fix cross-references.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Sean Young <sean@mess.org>
Sean Young [Thu, 23 Nov 2017 22:37:10 +0000 (17:37 -0500)]
media: cec: move cec autorepeat handling to rc-core
CEC autorepeat is different than other protocols. Autorepeat is triggered
by the first repeated user control pressed CEC message, rather than a
fixed REP_DELAY.
This change also does away with the KEY_UP event directly after the first
KEY_DOWN event, which was used to stop autorepeat from starting.
See commit
a9a249a2c997 ("media: cec: fix remote control passthrough")
for the original change.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Tue, 21 Nov 2017 20:51:39 +0000 (15:51 -0500)]
media: imon: auto-config ffdc 30 device
Another device with the 0xffdc device id, this one with 0x30 in the
config byte. Its an iMON VFD + iMON IR (it does not understand rc6).
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Arvind Yadav [Thu, 16 Nov 2017 04:37:51 +0000 (23:37 -0500)]
media: winbond-cir: Fix pnp_irq's error checking for wbcir_probe
The pnp_irq() function returns -1 if an error occurs.
pnp_irq() error checking for zero is not correct.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Chunyan Zhang [Mon, 6 Nov 2017 14:06:10 +0000 (09:06 -0500)]
media: rc: Replace timeval with ktime_t in imon.c
This patch changes the 32-bit time type (timeval) to the 64-bit one
(ktime_t), since 32-bit time types will break in the year 2038.
I use ktime_t instead of all uses of timeval in imon.c
This patch also changes do_gettimeofday() to ktime_get() accordingly,
since ktime_get returns a ktime_t, but do_gettimeofday returns a
struct timeval, and the other reason is that ktime_get() uses
the monotonic clock.
Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Sat, 4 Nov 2017 12:30:45 +0000 (08:30 -0400)]
media: lirc: improve locking
Once rc_unregister_device() has been called, no driver function
should be called.
This prevents some nasty race conditions with an ioctl calls
driver functions when the driver specific data has been freed.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Thu, 2 Nov 2017 21:21:13 +0000 (17:21 -0400)]
media: lirc: allow lirc device to be opened more than once
This makes it possible for lircd to read from a lirc chardev, and not
keep it busy.
Note that this changes the default for timeout reports to on. lircd
already enables timeout reports when it opens a lirc device, leaving
them on until the next reboot.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Thu, 2 Nov 2017 20:44:21 +0000 (16:44 -0400)]
media: rc: include <uapi/linux/lirc.h> rather than <media/lirc.h>
This removes the need for include/media/lirc.h, which just includes
the uapi file.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Thu, 2 Nov 2017 20:39:16 +0000 (16:39 -0400)]
media: rc: move ir-lirc-codec.c contents into lirc_dev.c
Since removing the lirc kapi, ir-lirc-codec.c only contains lirc fops
so the file name is no longer correct. By moving its content into
lirc_dev.c the ugly extern struct lirc_fops is not longer needed,
and everything lirc related is in one file.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Sun, 8 Oct 2017 16:12:16 +0000 (12:12 -0400)]
kfifo: DECLARE_KIFO_PTR(fifo, u64) does not work on arm 32 bit
If you try to store u64 in a kfifo (or a struct with u64 members),
then the buf member of __STRUCT_KFIFO_PTR will cause 4 bytes
padding due to alignment (note that struct __kfifo is 20 bytes
on 32 bit).
That in turn causes the __is_kfifo_ptr() to fail, which is caught
by kfifo_alloc(), which now returns EINVAL.
So, ensure that __is_kfifo_ptr() compares to the right structure.
Signed-off-by: Sean Young <sean@mess.org>
Acked-by: Stefani Seibold <stefani@seibold.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Sun, 24 Sep 2017 16:43:24 +0000 (12:43 -0400)]
media: lirc: scancode rc devices should have a lirc device too
Now that the lirc interface supports scancodes, RC scancode devices
can also have a lirc device. The only receiving feature they will have
enabled is LIRC_CAN_REC_SCANCODE.
Note that CEC devices have no lirc device, since they can be controlled
from their /dev/cecN chardev.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Sat, 25 Feb 2017 11:51:34 +0000 (06:51 -0500)]
media: lirc: document LIRC_MODE_SCANCODE
Lirc supports a new mode which requires documentation.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Sat, 30 Sep 2017 11:13:37 +0000 (07:13 -0400)]
media: lirc: ensure lirc device receives nec repeats
The lirc device should get lirc repeats whether there is a keymap
match or not.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>