]> git.ipfire.org Git - thirdparty/kernel/linux.git/log
thirdparty/kernel/linux.git
3 months agomedia: solo6x10: Replace deprecated PCI functions
Philipp Stanner [Fri, 4 Apr 2025 13:53:44 +0000 (15:53 +0200)] 
media: solo6x10: Replace deprecated PCI functions

pcim_iomap_table() and pcim_iomap_regions() have been deprecated.
Replace them with pcim_iomap_region().

Signed-off-by: Philipp Stanner <phasta@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: pt3: Replace deprecated PCI functions
Philipp Stanner [Fri, 4 Apr 2025 13:53:42 +0000 (15:53 +0200)] 
media: pt3: Replace deprecated PCI functions

pcim_iomap_table() and pcim_iomap_regions() have been deprecated.
Replace them with pcim_iomap_region().

Signed-off-by: Philipp Stanner <phasta@kernel.org>
Tested-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: cec: extron-da-hd-4k-plus: Fix Wformat-truncation
Hans Verkuil [Tue, 1 Apr 2025 14:17:55 +0000 (14:17 +0000)] 
media: cec: extron-da-hd-4k-plus: Fix Wformat-truncation

Fix gcc8 warning:

drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c:1014:44: warning: 'DCEC' directive output may be truncated writing 4 bytes into a region of size between 0 and 53 [-Wformat-truncation=]

Resizing the 'buf' and 'cmd' arrays fixed the warning.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: atomisp: Fix Wformat-truncation warning
Ricardo Ribalda [Tue, 1 Apr 2025 14:17:54 +0000 (14:17 +0000)] 
media: atomisp: Fix Wformat-truncation warning

Gcc8 is convinced that we do not have enough space in dot_id_input_bin.
Extend the variable 17 bytes which is just used for debugging.

drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:1336:9: warning: '(pipe' directive output may be truncated writing 5 bytes into a region of size between 1 and 74 [-Wformat-truncation=]

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: videobuf2: check constants during build time
Michał Mirosław [Fri, 28 Mar 2025 22:05:27 +0000 (23:05 +0100)] 
media: videobuf2: check constants during build time

There is nothing a driver author can do fix in the driver to make the
global constants match. Since the assertion can be verified at build
time, don't return EINVAL at runtime for it.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: vivid: Add more webcam resolutions
Ricardo Ribalda [Fri, 14 Mar 2025 12:39:41 +0000 (12:39 +0000)] 
media: vivid: Add more webcam resolutions

Add 3 more common resolution for webcams. This is required to increase
the test coverage of unit tests based on vivid.

Co-developed-by: Hidenori Kobayashi <hidenorik@chromium.org>
Signed-off-by: Hidenori Kobayashi <hidenorik@chromium.org>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Tested-by: Hidenori Kobayashi <hidenorik@chromium.org> # v4l2-compliance,
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: vivid: Fix requirement about webcam_intervals
Ricardo Ribalda [Fri, 14 Mar 2025 12:39:40 +0000 (12:39 +0000)] 
media: vivid: Fix requirement about webcam_intervals

Since commit f0b4a2c037c0 ("media: vivid: Extend FPS rates offered by
simulated webcam") we do not require twice as many intervals as sizes. In
fact, now we have 13 intervals and 6 sizes.

Fix the comment.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agodocs: media: mgb4: Improve mgb4 driver documentation
Martin Tůma [Tue, 11 Mar 2025 17:31:41 +0000 (18:31 +0100)] 
docs: media: mgb4: Improve mgb4 driver documentation

Add some basic info about the HW/driver + contact info.

Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: vidtv: Terminating the subsequent process of initialization failure
Edward Adam Davis [Tue, 11 Mar 2025 07:20:14 +0000 (15:20 +0800)] 
media: vidtv: Terminating the subsequent process of initialization failure

syzbot reported a slab-use-after-free Read in vidtv_mux_init. [1]

After PSI initialization fails, the si member is accessed again, resulting
in this uaf.

After si initialization fails, the subsequent process needs to be exited.

[1]
BUG: KASAN: slab-use-after-free in vidtv_mux_pid_ctx_init drivers/media/test-drivers/vidtv/vidtv_mux.c:78 [inline]
BUG: KASAN: slab-use-after-free in vidtv_mux_init+0xac2/0xbe0 drivers/media/test-drivers/vidtv/vidtv_mux.c:524
Read of size 8 at addr ffff88802fa42acc by task syz.2.37/6059

CPU: 0 UID: 0 PID: 6059 Comm: syz.2.37 Not tainted 6.14.0-rc5-syzkaller #0
Hardware name: Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:408 [inline]
print_report+0xc3/0x670 mm/kasan/report.c:521
kasan_report+0xd9/0x110 mm/kasan/report.c:634
vidtv_mux_pid_ctx_init drivers/media/test-drivers/vidtv/vidtv_mux.c:78
vidtv_mux_init+0xac2/0xbe0 drivers/media/test-drivers/vidtv/vidtv_mux.c:524
vidtv_start_streaming drivers/media/test-drivers/vidtv/vidtv_bridge.c:194
vidtv_start_feed drivers/media/test-drivers/vidtv/vidtv_bridge.c:239
dmx_section_feed_start_filtering drivers/media/dvb-core/dvb_demux.c:973
dvb_dmxdev_feed_start drivers/media/dvb-core/dmxdev.c:508 [inline]
dvb_dmxdev_feed_restart.isra.0 drivers/media/dvb-core/dmxdev.c:537
dvb_dmxdev_filter_stop+0x2b4/0x3a0 drivers/media/dvb-core/dmxdev.c:564
dvb_dmxdev_filter_free drivers/media/dvb-core/dmxdev.c:840 [inline]
dvb_demux_release+0x92/0x550 drivers/media/dvb-core/dmxdev.c:1246
__fput+0x3ff/0xb70 fs/file_table.c:464
task_work_run+0x14e/0x250 kernel/task_work.c:227
exit_task_work include/linux/task_work.h:40 [inline]
do_exit+0xad8/0x2d70 kernel/exit.c:938
do_group_exit+0xd3/0x2a0 kernel/exit.c:1087
__do_sys_exit_group kernel/exit.c:1098 [inline]
__se_sys_exit_group kernel/exit.c:1096 [inline]
__x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1096
x64_sys_call+0x151f/0x1720 arch/x86/include/generated/asm/syscalls_64.h:232
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f871d58d169
Code: Unable to access opcode bytes at 0x7f871d58d13f.
RSP: 002b:00007fff4b19a788 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f871d58d169
RDX: 0000000000000064 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 00007fff4b19a7ec R08: 0000000b4b19a87f R09: 00000000000927c0
R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000003
R13: 00000000000927c0 R14: 000000000001d553 R15: 00007fff4b19a840
 </TASK>

Allocated by task 6059:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
 __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394
 kmalloc_noprof include/linux/slab.h:901 [inline]
 kzalloc_noprof include/linux/slab.h:1037 [inline]
 vidtv_psi_pat_table_init drivers/media/test-drivers/vidtv/vidtv_psi.c:970
 vidtv_channel_si_init drivers/media/test-drivers/vidtv/vidtv_channel.c:423
 vidtv_mux_init drivers/media/test-drivers/vidtv/vidtv_mux.c:519
 vidtv_start_streaming drivers/media/test-drivers/vidtv/vidtv_bridge.c:194
 vidtv_start_feed drivers/media/test-drivers/vidtv/vidtv_bridge.c:239
 dmx_section_feed_start_filtering drivers/media/dvb-core/dvb_demux.c:973
 dvb_dmxdev_feed_start drivers/media/dvb-core/dmxdev.c:508 [inline]
 dvb_dmxdev_feed_restart.isra.0 drivers/media/dvb-core/dmxdev.c:537
 dvb_dmxdev_filter_stop+0x2b4/0x3a0 drivers/media/dvb-core/dmxdev.c:564
 dvb_dmxdev_filter_free drivers/media/dvb-core/dmxdev.c:840 [inline]
 dvb_demux_release+0x92/0x550 drivers/media/dvb-core/dmxdev.c:1246
 __fput+0x3ff/0xb70 fs/file_table.c:464
 task_work_run+0x14e/0x250 kernel/task_work.c:227
 exit_task_work include/linux/task_work.h:40 [inline]
 do_exit+0xad8/0x2d70 kernel/exit.c:938
 do_group_exit+0xd3/0x2a0 kernel/exit.c:1087
 __do_sys_exit_group kernel/exit.c:1098 [inline]
 __se_sys_exit_group kernel/exit.c:1096 [inline]
 __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1096
 x64_sys_call arch/x86/include/generated/asm/syscalls_64.h:232
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 6059:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:576
 poison_slab_object mm/kasan/common.c:247 [inline]
 __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264
 kasan_slab_free include/linux/kasan.h:233 [inline]
 slab_free_hook mm/slub.c:2353 [inline]
 slab_free mm/slub.c:4609 [inline]
 kfree+0x2c4/0x4d0 mm/slub.c:4757
 vidtv_channel_si_init drivers/media/test-drivers/vidtv/vidtv_channel.c:499
 vidtv_mux_init drivers/media/test-drivers/vidtv/vidtv_mux.c:519
 vidtv_start_streaming drivers/media/test-drivers/vidtv/vidtv_bridge.c:194
 vidtv_start_feed drivers/media/test-drivers/vidtv/vidtv_bridge.c:239
 dmx_section_feed_start_filtering drivers/media/dvb-core/dvb_demux.c:973
 dvb_dmxdev_feed_start drivers/media/dvb-core/dmxdev.c:508 [inline]
 dvb_dmxdev_feed_restart.isra.0 drivers/media/dvb-core/dmxdev.c:537
 dvb_dmxdev_filter_stop+0x2b4/0x3a0 drivers/media/dvb-core/dmxdev.c:564
 dvb_dmxdev_filter_free drivers/media/dvb-core/dmxdev.c:840 [inline]
 dvb_demux_release+0x92/0x550 drivers/media/dvb-core/dmxdev.c:1246
 __fput+0x3ff/0xb70 fs/file_table.c:464
 task_work_run+0x14e/0x250 kernel/task_work.c:227
 exit_task_work include/linux/task_work.h:40 [inline]
 do_exit+0xad8/0x2d70 kernel/exit.c:938
 do_group_exit+0xd3/0x2a0 kernel/exit.c:1087
 __do_sys_exit_group kernel/exit.c:1098 [inline]
 __se_sys_exit_group kernel/exit.c:1096 [inline]
 __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1096
 x64_sys_call arch/x86/include/generated/asm/syscalls_64.h:232
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Fixes: 3be8037960bc ("media: vidtv: add error checks")
Cc: stable@vger.kernel.org
Reported-by: syzbot+0d33ab192bd50b6c91e6@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=0d33ab192bd50b6c91e6
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: pvrusb2: Remove unused pvr2_std_create_enum
Dr. David Alan Gilbert [Sun, 9 Mar 2025 00:14:31 +0000 (00:14 +0000)] 
media: pvrusb2: Remove unused pvr2_std_create_enum

pvr2_std_create_enum() has been unused since 2012's
commit c0bb609fdc0b ("[media] pvrusb2: Get rid of obsolete code for video
standard enumeration")

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: s5p-mfc: Support for handling RET_ENC_BUFFER_FULL interrupt
Aakarsh Jain [Wed, 5 Mar 2025 05:53:08 +0000 (11:23 +0530)] 
media: s5p-mfc: Support for handling RET_ENC_BUFFER_FULL interrupt

When output encoded buffer size provided by userspace
is insufficient with current encoding parameters, it
leads to RET_ENC_BUFFER_FULL interrupt which was not
handled in IRQ handler.

On handling of RET_ENC_BUFFER_FULL interrupt leads to
NAL_ABORT command from host to risc which in turn leads
to RET_NAL_ABORT interrupt. On receiving RET_NAL_ABORT
driver clears workbit and VB2 queues for cleaner closing
of MFC instance.

When user encounters "Call on DQBUF after unrecoverable
error", userspace should close fd and restart with larger
output encoder buffer size.

Signed-off-by: Aakarsh Jain <aakarsh.jain@samsung.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: vim2m: Add parametized support for multiplanar API
Matthew Majewski [Tue, 4 Mar 2025 19:17:01 +0000 (14:17 -0500)] 
media: vim2m: Add parametized support for multiplanar API

Add support for the mulitiplaner API. The device can now act as
either a multi-planar or a single-planar device depending on a module
parameter, similar to the way vivid behaves.

Multiplanar support was added by implementing the appropate
try/get/set mplane functions, and by modifying the queue_setup() and
buf_prepare() functions to handle multiple planes. Implementation
was inspired by vivid.

Signed-off-by: Matthew Majewski <mattwmajewski@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: vim2m: Simplify try_fmt
Matthew Majewski [Tue, 4 Mar 2025 19:17:00 +0000 (14:17 -0500)] 
media: vim2m: Simplify try_fmt

Clean up vidioc_try_fmt with the following changes:

1. remove unsused vim2m_fmt parameter
2. use clamp() macro to restrain width/height bounds
3. use ALIGN() macro to align width/height
4. use v4l2_fill_pixfmt to set bytesperline/sizeimage

Signed-off-by: Matthew Majewski <mattwmajewski@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: v4l2-common: Add RGBR format info
Matthew Majewski [Tue, 4 Mar 2025 19:16:59 +0000 (14:16 -0500)] 
media: v4l2-common: Add RGBR format info

Add missing RGBR entry in the v4l2_format_info[] table.

RGBR has identical format information to RGBP, as it is a
big endian variant of RGB-5-6-5 pixel encoding according to the
description in videodev2.h.

Signed-off-by: Matthew Majewski <mattwmajewski@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: remove STA2x11 media pci driver
Lukas Bulwahn [Mon, 3 Mar 2025 10:30:22 +0000 (11:30 +0100)] 
media: remove STA2x11 media pci driver

With commit dcbb01fbb7ae ("x86/pci: Remove old STA2x11 support"), the
STA2X11 Video Input Port driver is not needed and cannot be built anymore.

Remove the driver and its reference in media documentation.

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: imx334: switch to {enable,disable}_streams
Tarang Raval [Sat, 29 Mar 2025 05:43:31 +0000 (11:13 +0530)] 
media: i2c: imx334: switch to {enable,disable}_streams

Switch from s_stream to enable_streams and disable_streams callbacks.

Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: imx334: Use subdev state lock for synchronization
Tarang Raval [Sat, 29 Mar 2025 05:43:30 +0000 (11:13 +0530)] 
media: i2c: imx334: Use subdev state lock for synchronization

Replace the custom mutex in the imx334 driver with the V4L2 subdev state
lock for control synchronization. Initialize the subdev with
v4l2_subdev_init_finalize in imx334_probe, adding proper cleanup in error
paths and imx334_remove. This aligns the driver with V4L2 standards.

Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: imx334: Enable runtime PM before sub-device registration
Tarang Raval [Sat, 29 Mar 2025 05:43:29 +0000 (11:13 +0530)] 
media: i2c: imx334: Enable runtime PM before sub-device registration

Runtime PM is fully initialized before calling
v4l2_async_register_subdev_sensor(). Moving the runtime PM initialization
earlier prevents potential access to an uninitialized or powered-down
device.

Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: imx334: Fix runtime PM handling in remove function
Tarang Raval [Sat, 29 Mar 2025 05:43:28 +0000 (11:13 +0530)] 
media: i2c: imx334: Fix runtime PM handling in remove function

pm_runtime_suspended() only checks the current runtime PM status and does
not modify it, making it ineffective in this context. This could result in
improper power management if the device remains active when removed.

This patch fixes the issue by introducing a check with
pm_runtime_status_suspended() to determine if the device is already
suspended. If it is not, it calls imx334_power_off() to power down the
device and then uses pm_runtime_set_suspended() to correctly update the
runtime PM status to suspended.

Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: imx334: Fix power management and control handling
Tarang Raval [Sat, 29 Mar 2025 05:43:27 +0000 (11:13 +0530)] 
media: i2c: imx334: Fix power management and control handling

Some controls may need the sensor to be powered on to update their
values. Currently, only the exposure control does this. To ensure
proper handling, the power-up sequence is moved outside the switch-case.

Additionally, VBLANK control is now processed earlier so its changes
can correctly affect other controls.

Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: imx334: Configure lane mode dynamically
Tarang Raval [Sat, 29 Mar 2025 05:43:26 +0000 (11:13 +0530)] 
media: i2c: imx334: Configure lane mode dynamically

Configure the lane mode dynamically from the streaming
function instead of using a hardcoded value.

Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
[Sakari Ailus: Fix checkpatch.pl issue, lower Dynamically.]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: imx334: Remove redundant register entries
Tarang Raval [Sat, 29 Mar 2025 05:43:25 +0000 (11:13 +0530)] 
media: i2c: imx334: Remove redundant register entries

IMX334_REG_{ADBIT, MDBIT, ADBIT1}: Already written in
imx334_set_framefmt function.

IMX334_REG_THSPREPARE: Unnecessary repeated writes removed.

CCI_REG8(0x3e04): Unnecessary repeated writes removed.

Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: imx334: Convert to CCI register access helpers
Tarang Raval [Sat, 29 Mar 2025 05:43:24 +0000 (11:13 +0530)] 
media: i2c: imx334: Convert to CCI register access helpers

Use the new common CCI register access helpers to replace the private
register access helpers in the imx334 driver. This simplifies the driver
by reducing the amount of code.

Acked-by: Shravan Chippa <Shravan.Chippa@microchip.com>
Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: imx334: Simplify with dev_err_probe()
Tarang Raval [Sat, 29 Mar 2025 05:43:23 +0000 (11:13 +0530)] 
media: i2c: imx334: Simplify with dev_err_probe()

Error handling in probe() can be a bit simpler with dev_err_probe().

also, Added missing newline characters (\n) in error messages.

Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: intel/ipu6: Fix dma mask for non-secure mode
Stanislaw Gruszka [Thu, 10 Apr 2025 09:47:06 +0000 (11:47 +0200)] 
media: intel/ipu6: Fix dma mask for non-secure mode

We use dma_get_mask() of auxdev device for calculate iova pfn limit.
This is always 32 bit mask as we do not initialize the mask (and we can
not do so, since dev->dev_mask is NULL anyways for auxdev).

Since we need 31 bit mask for non-secure mode use mmu_info->aperture_end
which is properly initialized to correct mask for both modes.

Fixes: daabc5c64703 ("media: ipu6: not override the dma_ops of device in driver")
Cc: stable@vger.kernel.org
Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: intel/ipu6: Minor dma_mask clenaup
Stanislaw Gruszka [Thu, 10 Apr 2025 09:52:13 +0000 (11:52 +0200)] 
media: intel/ipu6: Minor dma_mask clenaup

Remove unused dma_mask field and ipu-dma.h includes.

Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ccs: Don't complain about missing "clock-frequency" property
Sakari Ailus [Fri, 11 Oct 2024 10:56:44 +0000 (13:56 +0300)] 
media: ccs: Don't complain about missing "clock-frequency" property

The clock frequency is often available via the clock itself and not read
by the driver from the "clock-frequency" property. Don't complain if the
property doesn't exist.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ccs: Don't complain about lack of quirks
Sakari Ailus [Tue, 15 Oct 2024 10:38:01 +0000 (13:38 +0300)] 
media: ccs: Don't complain about lack of quirks

Generally any deviance from the standard is handled via CCS static data
nowadays and so not having quirks is expected. Don't warn about it.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ccs: Remove I²C write retry hack
Sakari Ailus [Tue, 15 Oct 2024 07:28:42 +0000 (10:28 +0300)] 
media: ccs: Remove I²C write retry hack

The I²C retry hack has been there in order to address transient I²C
register write access issues on a few very old sensors and possibly it has
addressed also first I²C access problems (device not responding until a
certain amount of time has passed) but that is now separately handled. The
retry hack has a good potential for introducing hard to debug problems in
updating sensor settings while streaming. Remove it and instead pass those
rare errors to the user space -- which is also what virtually all other
drivers do.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ccs: Use read_poll_timeout() in reset polling
Sakari Ailus [Tue, 15 Oct 2024 07:07:02 +0000 (10:07 +0300)] 
media: ccs: Use read_poll_timeout() in reset polling

Use read_poll_timeout() in polling the device after a reset, either hard
or soft. While at it, improve the related error message.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ccs: Try a little longer to access the sensor before giving up
Sakari Ailus [Tue, 15 Oct 2024 06:59:52 +0000 (09:59 +0300)] 
media: ccs: Try a little longer to access the sensor before giving up

Some sensors take longer to respond after reset than the spec-required
time. Try up to 1 s for the sensor to become accessible.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: imx219: media: i2c: imx219: Enable runtime PM autosuspend
Tarang Raval [Thu, 6 Mar 2025 05:34:44 +0000 (11:04 +0530)] 
media: i2c: imx219: media: i2c: imx219: Enable runtime PM autosuspend

Use pm_runtime_put_autosuspend() instead of pm_runtime_put()
to allow autosuspend. Set a 1000ms autosuspend delay in
imx219_probe() to improve power efficiency.

Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: imx219: switch to {enable,disable}_streams
Tarang Raval [Thu, 6 Mar 2025 05:34:43 +0000 (11:04 +0530)] 
media: i2c: imx219: switch to {enable,disable}_streams

Switch from s_stream to enable_streams and disable_streams callbacks.

Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: dt-bindings: Convert Analog Devices ad5820 to DT schema
David Heidelberg [Mon, 21 Apr 2025 08:20:15 +0000 (10:20 +0200)] 
media: dt-bindings: Convert Analog Devices ad5820 to DT schema

Convert the Analog Devices ad5820 to DT schema format.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: David Heidelberg <david@ixit.cz>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ov02e10: add OV02E10 image sensor driver
Jingjing Xiong [Mon, 7 Apr 2025 09:13:08 +0000 (10:13 +0100)] 
media: i2c: ov02e10: add OV02E10 image sensor driver

Add in the ov02e10 driver from the Intel IPU6 repository.

Signed-off-by: Jingjing Xiong <jingjing.xiong@intel.com>
Co-developed-by: Hao Yao <hao.yao@intel.com>
Signed-off-by: Hao Yao <hao.yao@intel.com>
Co-developed-by: Jim Lai <jim.lai@intel.com>
Signed-off-by: Jim Lai <jim.lai@intel.com>
Co-developed-by: You-Sheng Yang <vicamo.yang@canonical.com>
Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
Co-developed-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Co-developed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: dt-bindings: Add OmniVision OV02E10
Bryan O'Donoghue [Mon, 7 Apr 2025 09:13:07 +0000 (10:13 +0100)] 
media: dt-bindings: Add OmniVision OV02E10

Add bindings for OVO2E10 a two lane MIPI CSI, two megapixel 1080p RGB
sensor.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: intel/ipu6: Replace deprecated PCI functions
Philipp Stanner [Fri, 4 Apr 2025 13:53:43 +0000 (15:53 +0200)] 
media: intel/ipu6: Replace deprecated PCI functions

pcim_iomap_table() and pcim_iomap_regions() have been deprecated.
Furthermore, the "name" parameter in pcim_iomap_regions() and its
successor, pcim_iomap_region(), should always reflect the driver name,
whereas currently it is the device's name.

Replace the deprecated functions with pcim_iomap_region() and pass the
actual driver name.

Signed-off-by: Philipp Stanner <phasta@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ipu3-cio2: Replace deprecated PCI functions
Philipp Stanner [Fri, 4 Apr 2025 13:53:41 +0000 (15:53 +0200)] 
media: ipu3-cio2: Replace deprecated PCI functions

pcim_iomap_table() and pcim_iomap_regions() have been deprecated.

Replace them with pcim_iomap_region(), and pass the actual driver name
to that function.

Signed-off-by: Philipp Stanner <phasta@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: rcar-csi2: Remove hack to detect NTSC content
Niklas Söderlund [Mon, 10 Feb 2025 17:56:15 +0000 (18:56 +0100)] 
media: rcar-csi2: Remove hack to detect NTSC content

In an effort to emulate support for SEQ_{TB,BT} in the R-Car VIN driver
on data captured from a CVBS input a hack was added to detect NTSC vs
PAL. This is ugly and as support for emulated SEQ_{TB,BT} have been
removed from the VIN driver remove the ugly hack.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Tested-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: rcar-vin: Simplify the shutdown process
Niklas Söderlund [Mon, 10 Feb 2025 17:56:14 +0000 (18:56 +0100)] 
media: rcar-vin: Simplify the shutdown process

When shutting down capture extra care was needed to try and complete a
buffer that was involved in the emulated support for SEQ_{TB,BT}. This
was needed as a buffer might be queued once to the driver, but two times
to the hardware using different offsets.

As support for SEQ_{TB,BT} is now removed this shutdown process can be
greatly simplified. And in addition the state keeping of the VIN device
can be reduced to a single boolean value instead of keeping track of
this SEQ_{TB,BT} stopping dance.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Tested-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: rcar-vin: Remove superfluous starting state
Niklas Söderlund [Mon, 10 Feb 2025 17:56:13 +0000 (18:56 +0100)] 
media: rcar-vin: Remove superfluous starting state

The STARTING state is superfluous and can be replaced with a check of
the sequence counter. The design idea is that the first buffer returned
from the driver have to come from the first hardware buffer slot.
Failing this the first 3 buffers queued to the device can be returned
out-of-order.

But it's much clearer to check the sequence counter to only return the
first buffer if it comes from hardware slot 0 then it is to carry around
an extra state just for this. Remove the unneeded state and replace it
with a simpler check.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Tested-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: rcar-vin: Remove superfluous suspended state
Niklas Söderlund [Mon, 10 Feb 2025 17:56:12 +0000 (18:56 +0100)] 
media: rcar-vin: Remove superfluous suspended state

The VIN state of suspended is superfluous. The logic was that when the
device were suspended and in a RUNNING state the state was set to
SUSPENDED. And when resuming it checked if the state is SUSPENDED and if
so started the device and changed it to RUNNING.

This can be avoided by simply checking if the device is in a RUNNING
state at both suspend and resume callbacks. Remove the unneeded
complexity.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Tested-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: rcar-vin: Remove emulated SEQ_{TB,BT}
Niklas Söderlund [Mon, 10 Feb 2025 17:56:11 +0000 (18:56 +0100)] 
media: rcar-vin: Remove emulated SEQ_{TB,BT}

When the driver was converted from soc_camera software support for
V4L2_FIELD_SEQ_TB and V4L2_FIELD_SEQ_BT were added. This was done by
capturing twice to the same VB2 buffer, but at different offsets.

This turned out to be a bad idea and it never really worked properly in
all situations. As the hardware can't support this mode natively remove
trying to emulate it in software. It's still possible to capture TOP or
BOTTOM fields separately or both ALTERNATING. If user-space wants the
same  fields in the same buffer the same hack to capture twice to the
same buffer can be done.

Removing this error prone emulated support pave ways in future work to
simplify the internal buffer handling and making it less fragile, while
enabling adding support for other features the hardware actually
supports.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Tested-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ti: cal: Add streams support
Tomi Valkeinen [Wed, 26 Mar 2025 11:34:03 +0000 (13:34 +0200)] 
media: ti: cal: Add streams support

Add multiplexed streams support. CAL has 8 DMA-engines and can capture 8
separate streams at the same time. The driver filters the streams based
on CSI-2 virtual channel number and datatype. CAL may have (depending on
the SoC) two CSI-2 RX blocks, which share the 8 DMA-engines, so the
number of capturable streams does not change even if there are two CSI-2
RX blocks.

Add 8 video device nodes, each representing a single DMA-engine, and set
the number of source pads on CSI-2 RX blocks to 8. Each video node can be
connected to any of the source pads on either of the CSI-2 RX instances
using media links. CSI-2 RX block's subdevice internal routing is used
to route the incoming CSI-2 streams to one of the 8 source pads.

Only video data streams are supported at the moment.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ti: cal: Fix wrong goto on error path
Tomi Valkeinen [Wed, 26 Mar 2025 11:34:02 +0000 (13:34 +0200)] 
media: ti: cal: Fix wrong goto on error path

If pm_runtime_resume_and_get() fails, we should unprepare the context,
but currently we skip that as we goto to a later line.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ti: cal: Use printk's fourcc formatting
Tomi Valkeinen [Wed, 26 Mar 2025 11:34:01 +0000 (13:34 +0200)] 
media: ti: cal: Use printk's fourcc formatting

Use printk's fourcc formatting instead of a custom one.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ipu-bridge: add ACPI HID for lt6911uxe bridge
Dongcheng Yan [Wed, 26 Mar 2025 05:24:47 +0000 (13:24 +0800)] 
media: ipu-bridge: add ACPI HID for lt6911uxe bridge

Lontium lt6911uxe is a HDMI to CSI-2 bridge, without a fixed
link frequency.

Signed-off-by: Dongcheng Yan <dongcheng.yan@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ov2740: Move pm-runtime cleanup on probe-errors to proper place
Hans de Goede [Mon, 24 Mar 2025 13:01:09 +0000 (14:01 +0100)] 
media: ov2740: Move pm-runtime cleanup on probe-errors to proper place

When v4l2_subdev_init_finalize() fails no changes have been made to
the runtime-pm device state yet, so the probe_error_media_entity_cleanup
rollback path should not touch the runtime-pm device state.

Instead this should be done from the probe_error_v4l2_subdev_cleanup
rollback path. Note the pm_runtime_xxx() calls are put above
the v4l2_subdev_cleanup() call to have the reverse call order of probe().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
Fixes: 289c25923ecd ("media: ov2740: Use sub-device active state")
Cc: stable@vger.kernel.org
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: intel/ipu6: Remove unused dev field from ipu6_isys_queue
Stanislaw Gruszka [Wed, 19 Mar 2025 12:10:44 +0000 (13:10 +0100)] 
media: intel/ipu6: Remove unused dev field from ipu6_isys_queue

With current code base dev is only written but never read. Remove it
as redundant.

Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: intel/ipu6: Abstract buf ready function
Stanislaw Gruszka [Wed, 19 Mar 2025 12:10:43 +0000 (13:10 +0100)] 
media: intel/ipu6: Abstract buf ready function

Extract values needed by ipu6_queue_buf_ready() function from fw abi
structure. This will allow to reuse same buf ready code when fw abi
change.

Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: intel/ipu6: Use timestamp value directly
Stanislaw Gruszka [Wed, 19 Mar 2025 12:10:42 +0000 (13:10 +0100)] 
media: intel/ipu6: Use timestamp value directly

Remove pointer for fw abi structure when setting frame sequence and
time, use timestamp value from the structure directly.

Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: intel/ipu6: Make two functions static
Stanislaw Gruszka [Wed, 19 Mar 2025 12:10:41 +0000 (13:10 +0100)] 
media: intel/ipu6: Make two functions static

Make function used only in one file static and remove from header file.

Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: intel/ipu6: Add missing new line character in error message
Stanislaw Gruszka [Wed, 19 Mar 2025 12:10:40 +0000 (13:10 +0100)] 
media: intel/ipu6: Add missing new line character in error message

End error message with new line.

Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: intel/ipu6: Remove unused ipu6_isys_subdev_link_validate()
Stanislaw Gruszka [Mon, 17 Mar 2025 14:28:42 +0000 (15:28 +0100)] 
media: intel/ipu6: Remove unused ipu6_isys_subdev_link_validate()

Remove unused declaration.

Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: intel/ipu6: Constify ipu6_buttress_ctrl structure
Stanislaw Gruszka [Thu, 13 Mar 2025 10:17:44 +0000 (11:17 +0100)] 
media: intel/ipu6: Constify ipu6_buttress_ctrl structure

Make ipu6_buttress_ctrl constant since it is not modified any longer.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: intel/ipu6: Remove ipu6_buttress_ctrl started field
Stanislaw Gruszka [Thu, 13 Mar 2025 10:17:43 +0000 (11:17 +0100)] 
media: intel/ipu6: Remove ipu6_buttress_ctrl started field

We assign to ->started field but newer read back, the field can be removed.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: intel/ipu6: Remove unused IPU6_BUS_NAME
Stanislaw Gruszka [Thu, 13 Mar 2025 10:17:42 +0000 (11:17 +0100)] 
media: intel/ipu6: Remove unused IPU6_BUS_NAME

Remove unused define.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ccs-pll: Document the CCS PLL flags
Sakari Ailus [Wed, 16 Apr 2025 11:08:56 +0000 (14:08 +0300)] 
media: ccs-pll: Document the CCS PLL flags

Document the CCS PLL flags with short comments. The CCS spec has more
information on them while the added documentation helps finding the
relevant information in the CCS spec.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ccs-pll: Print PLL calculator flags in the beginning
Sakari Ailus [Wed, 5 Mar 2025 11:30:41 +0000 (13:30 +0200)] 
media: ccs-pll: Print PLL calculator flags in the beginning

Print the PLL calculator flags right away when the PLL calculator is
called. Previously this was done only in a successful case and that didn't
really help solving a problem when one happened.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ccs-pll: Better validate VT PLL branch
Sakari Ailus [Wed, 26 Feb 2025 12:27:58 +0000 (14:27 +0200)] 
media: ccs-pll: Better validate VT PLL branch

Check that the VT PLL dividers are actually found, don't trust they always
are even though they should be.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ccs-pll: Add a flag for even PLL multipliers
Sakari Ailus [Fri, 14 Feb 2025 10:36:18 +0000 (12:36 +0200)] 
media: ccs-pll: Add a flag for even PLL multipliers

Some devices (not entirely CCS compliant) only support even PLL
multipliers. Add support for this through a PLL flag.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ccs-pll: Print missing PLL flags
Sakari Ailus [Wed, 16 Apr 2025 11:18:45 +0000 (14:18 +0300)] 
media: ccs-pll: Print missing PLL flags

Printing the OP_PIX_CLOCK_PER_LANE and NO_OP_CLOCKS CCS PLL flags is
missing, add them now.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ccs-pll: Drop LINK_DECOUPLED flag
Sakari Ailus [Wed, 16 Apr 2025 10:54:00 +0000 (13:54 +0300)] 
media: ccs-pll: Drop LINK_DECOUPLED flag

The LINK_DECOUPLED flag isn't used by the PLL calculator other than
printing it. The number of OP/VT lanes are already printed in any case.
Thus drop the flag as it has no function.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ccs-pll: Print a debug message on too high VT PLL OP clock
Sakari Ailus [Thu, 20 Feb 2025 09:53:20 +0000 (11:53 +0200)] 
media: ccs-pll: Print a debug message on too high VT PLL OP clock

In general the CCS PLL calculator prints debugging information on the
process to ease debugging. This case was not annotated, do that now.

Remove an extra multiplication while at it.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ccs-pll: Correct the upper limit of maximum op_pre_pll_clk_div
Sakari Ailus [Wed, 19 Feb 2025 13:06:11 +0000 (15:06 +0200)] 
media: ccs-pll: Correct the upper limit of maximum op_pre_pll_clk_div

The PLL calculator does a search of the PLL configuration space for all
valid OP pre-PLL clock dividers. The maximum did not take into account the
CCS PLL flag CCS_PLL_FLAG_EXT_IP_PLL_DIVIDER in which case also odd PLL
dividers (other than 1) are valid. Do that now.

Fixes: 4e1e8d240dff ("media: ccs-pll: Add support for extended input PLL clock divider")
Cc: stable@vger.kernel.org
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ccs-pll: Check for too high VT PLL multiplier in dual PLL case
Sakari Ailus [Thu, 20 Feb 2025 08:54:44 +0000 (10:54 +0200)] 
media: ccs-pll: Check for too high VT PLL multiplier in dual PLL case

The check for VT PLL upper limit in dual PLL case was missing. Add it now.

Fixes: 6c7469e46b60 ("media: ccs-pll: Add trivial dual PLL support")
Cc: stable@vger.kernel.org
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ccs-pll: Start VT pre-PLL multiplier search from correct value
Sakari Ailus [Tue, 18 Feb 2025 21:47:13 +0000 (23:47 +0200)] 
media: ccs-pll: Start VT pre-PLL multiplier search from correct value

The ccs_pll_calculate_vt_tree() function does a search over possible VT
PLL configurations to find the "best" one. If the sensor does not support
odd pre-PLL divisors and the minimum value (with constraints) isn't 1,
other odd values could be errorneously searched (and selected) for the
pre-PLL divisor. Fix this.

Fixes: 415ddd993978 ("media: ccs-pll: Split limits and PLL configuration into front and back parts")
Cc: stable@vger.kernel.org
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ccs-pll: Start OP pre-PLL multiplier search from correct value
Sakari Ailus [Tue, 18 Feb 2025 21:43:58 +0000 (23:43 +0200)] 
media: ccs-pll: Start OP pre-PLL multiplier search from correct value

The ccs_pll_calculate() function does a search over possible PLL
configurations to find the "best" one. If the sensor does not support odd
pre-PLL divisors and the minimum value (with constraints) isn't 1, other
odd values could be errorneously searched (and selected) for the pre-PLL
divisor. Fix this.

Fixes: 415ddd993978 ("media: ccs-pll: Split limits and PLL configuration into front and back parts")
Cc: stable@vger.kernel.org
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ov08x40: Extend sleep after reset to 5 ms
Hans de Goede [Tue, 11 Mar 2025 11:48:44 +0000 (12:48 +0100)] 
media: ov08x40: Extend sleep after reset to 5 ms

Some users are reporting that ov08x40_identify_module() fails
to identify the chip reading 0x00 as value for OV08X40_REG_CHIP_ID.

Intel's out of tree IPU6 drivers include some ov08x40 changes
including adding support for the reset GPIO for older kernels and
Intel's patch for this uses 5 ms. Extend the sleep to 5 ms following
Intel's example, this fixes the ov08x40_identify_module() problem.

Link: https://github.com/intel/ipu6-drivers/blob/c09e2198d801e1eb701984d2948373123ba92a56/patch/v6.12/0008-media-ov08x40-Add-support-for-2-4-lanes-support-at-1.patch#L4607
Fixes: df1ae2251a50 ("media: ov08x40: Add OF probe support")
Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: imx334: common reg value correction
Shravan Chippa [Wed, 5 Mar 2025 05:14:40 +0000 (10:44 +0530)] 
media: i2c: imx334: common reg value correction

correcting the CPWAIT_TIME value as per the data sheet
for the link frequency and input clock

Signed-off-by: Shravan Chippa <shravan.chippa@microchip.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: imx334: add modes for 720p and 480p resolutions
Shravan Chippa [Wed, 5 Mar 2025 05:14:42 +0000 (10:44 +0530)] 
media: i2c: imx334: add modes for 720p and 480p resolutions

Added support for 1280x720@30 and 640x480@30 resolutions

Signed-off-by: Shravan Chippa <shravan.chippa@microchip.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: imx334: update mode_3840x2160_regs array
Shravan Chippa [Wed, 5 Mar 2025 05:14:41 +0000 (10:44 +0530)] 
media: i2c: imx334: update mode_3840x2160_regs array

The 3840x2160 mode operates with the imx334 reset values.
If we switch to other modes and then return to the 3840x2160 mode,
it should function correctly. so updated the mode_3840x2160_regs
array with the imx334 reset values.

Signed-off-by: Shravan Chippa <shravan.chippa@microchip.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: imx334: Optimized 4k and 2k mode register arrays
Shravan Chippa [Wed, 5 Mar 2025 05:14:39 +0000 (10:44 +0530)] 
media: i2c: imx334: Optimized 4k and 2k mode register arrays

Optimized the resolution arrays by integrating a common register array.

Adjusted the register array values for 1920x1080@30 and 3840x2160@30
resolutions to align with the common register array values.

Signed-off-by: Shravan Chippa <shravan.chippa@microchip.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: ipu6: Remove workaround for Meteor Lake ES2
Hao Yao [Tue, 11 Mar 2025 08:41:55 +0000 (16:41 +0800)] 
media: ipu6: Remove workaround for Meteor Lake ES2

There was a hardware bug which need IPU6 driver to disable the ATS. This
workaround is not needed anymore as the bug was fixed in hardware level.

Additionally, Arrow Lake has the same IPU6 PCI ID and x86 stepping but
does not have the bug. Removing the Meteor Lake workaround is also
required for the driver to function on Arrow Lake.

Signed-off-by: Hao Yao <hao.yao@intel.com>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Fixes: 25fedc021985 ("media: intel/ipu6: add Intel IPU6 PCI device driver")
Cc: stable@vger.kernel.org
[Sakari Ailus: Added tags and explanation of what is fixed.]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub9xx: Set serializer temperature ramp
Jai Luthra [Mon, 3 Mar 2025 16:02:22 +0000 (21:32 +0530)] 
media: i2c: ds90ub9xx: Set serializer temperature ramp

For continuous PLL lock, it is recommended to extend the temperature
ramp down range of the DS90UB953-Q1 serializer based on the device's
initial temperature [1].

The serializer's die temperature is reported only to the deserializer
through the sensor status registers, and for UB9702, it is recommended
to set the temperature ramp during the link setup sequence, i.e. before
we even probe the ub953 driver.

Add support to the deserializer driver to configure ub953's temperature
ramp.

[1]: Section 7.3.1.1 - https://www.ti.com/lit/gpn/ds90ub953-q1

Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub960: Configure serializer using back-channel
Jai Luthra [Mon, 3 Mar 2025 16:02:21 +0000 (21:32 +0530)] 
media: i2c: ds90ub960: Configure serializer using back-channel

For DS90UB9702-Q1, it is recommended to configure some serializer
settings over the back-channel before the forward-channel is active.

This can only be done if the serializer's I2C address on the FPD-Link
bus is populated in the device tree node.

Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub953: Move reg defines to a header file
Tomi Valkeinen [Mon, 3 Mar 2025 16:02:20 +0000 (21:32 +0530)] 
media: i2c: ds90ub953: Move reg defines to a header file

Move UB953 register defines to a header file. This is done so that the
deserializer driver can access the defines, and do some early
serializer configuration.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: dt-bindings: ti,ds90ub960: Allow setting serializer address
Jai Luthra [Mon, 3 Mar 2025 16:02:19 +0000 (21:32 +0530)] 
media: dt-bindings: ti,ds90ub960: Allow setting serializer address

The serializer's I2C address on the FPD-Link bus is usually communicated
to the deserializer once the forward-channel is established. But in some
cases it might be necessary to program the serializer (over the
back-channel) before the forward-channel is established.

This can be used e.g. to correct serializer configuration which
otherwise would prevent the FC to be enabled. To be able to communicate
to the serializer before the forward-channel is up, the deserializer
driver neds to know the default i2c address of the serializer.

Allow setting the serializer i2c address using the 'reg' property. This
is optional, and usually not needed.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub960: Update UB9702 init sequences
Tomi Valkeinen [Mon, 3 Mar 2025 16:02:18 +0000 (21:32 +0530)] 
media: i2c: ds90ub960: Update UB9702 init sequences

Update ub9702 RX port init sequence according to TI's latest
(non-public) documentation. The sequence is based on a Python script
provided by TI.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub960: Move all RX port init code into ub960_init_rx_ports()
Tomi Valkeinen [Mon, 3 Mar 2025 16:02:17 +0000 (21:32 +0530)] 
media: i2c: ds90ub960: Move all RX port init code into ub960_init_rx_ports()

We have some code in probe() which is related to RX port initialization,
and should be in ub960_init_rx_ports(). Move the code there.

We also move ub960_reset() so that it is accessible from
ub960_init_rx_ports().

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub960: Add RX port iteration support
Tomi Valkeinen [Mon, 3 Mar 2025 16:02:16 +0000 (21:32 +0530)] 
media: i2c: ds90ub960: Add RX port iteration support

The driver does a lot of iteration over the RX ports with for loops. In
most cases the driver will skip unused RX ports. Also, in the future
patches the FPD-Link IV support will be refreshed with TI's latest init
sequences which involves a lot of additional iterations over the RX
ports, often only for FPD-Link IV ports.

To make the iteration simpler and to make it clearer what we're
iterating over (all or only-active, all or only-fpd4), add macros and
support functions for iterating the RX ports. Use the macros in the
driver, replacing the for loops.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub960: Refresh ub960_init_tx_ports_ub9702()
Tomi Valkeinen [Mon, 3 Mar 2025 16:02:15 +0000 (21:32 +0530)] 
media: i2c: ds90ub960: Refresh ub960_init_tx_ports_ub9702()

Refresh the ub960_init_tx_ports_ub9702() using the latest version of the
(non-public) hardware documentation.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub960: Split ub960_init_tx_ports()
Tomi Valkeinen [Mon, 3 Mar 2025 16:02:14 +0000 (21:32 +0530)] 
media: i2c: ds90ub960: Split ub960_init_tx_ports()

Split ub960_init_tx_ports() to a UB960 and a UB9702 versions to make it
easier to update the UB9702 version in the following patch.

No funcional changes.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub960: Add UB9702 specific registers
Tomi Valkeinen [Mon, 3 Mar 2025 16:02:13 +0000 (21:32 +0530)] 
media: i2c: ds90ub960: Add UB9702 specific registers

Add UB9702 specific registers which will be used in the following
patches.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub960: Move UB9702 registers to a separate section
Tomi Valkeinen [Mon, 3 Mar 2025 16:02:12 +0000 (21:32 +0530)] 
media: i2c: ds90ub960: Move UB9702 registers to a separate section

The driver supports both UB960 and UB9702. While devices work in similar
ways and have a lot of identical registers, there are also plenty of
differences.

To clarify the situation a bit, move the UB9702 registers to a separate
section and prefix them with UB9702.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub953: Speed-up I2C watchdog timer
Jai Luthra [Mon, 3 Mar 2025 16:02:11 +0000 (21:32 +0530)] 
media: i2c: ds90ub953: Speed-up I2C watchdog timer

On the I2C bus for remote clients (sensors), by default the watchdog
timer expires in 1s. To allow for a quicker system bring-up time, TI
recommends to speed it up to 50us [1].

[1]: Section 7.3.1.1 - https://www.ti.com/lit/gpn/ds90ub953-q1

Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub913: Add error handling to ub913_log_status()
Tomi Valkeinen [Mon, 3 Mar 2025 16:02:10 +0000 (21:32 +0530)] 
media: i2c: ds90ub913: Add error handling to ub913_log_status()

Add error handling to ub913_log_status().

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub953: Add error handling to ub953_log_status()
Tomi Valkeinen [Mon, 3 Mar 2025 16:02:09 +0000 (21:32 +0530)] 
media: i2c: ds90ub953: Add error handling to ub953_log_status()

Add error handling to ub953_log_status().

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub960: Add error handling to multiple places
Tomi Valkeinen [Mon, 3 Mar 2025 16:02:08 +0000 (21:32 +0530)] 
media: i2c: ds90ub960: Add error handling to multiple places

The driver is missing checks for i2c read/write errors in many places.
Now that we have added the err parameter to the read/write functions in
the previous patch, add error handling to all the missing places.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub9xx: Add err parameter to read/write funcs
Tomi Valkeinen [Mon, 3 Mar 2025 16:02:07 +0000 (21:32 +0530)] 
media: i2c: ds90ub9xx: Add err parameter to read/write funcs

To make future error handling in the drivers easier, add "int *err"
parameter to all the i2c register access functions. It functions the
same was as with e.g. CCI reg write/read helpers.

This was accomplished with the following semantic patch:

  @@
  identifier FUNC =~ "^ub9.._(rxport_|txport_|ind_)?(read|write|update_bits)(16|_ind)?$";
  @@
    FUNC(...
  + , int *err
    ) {
    ...
    int ret;
  +
  + if (err && *err)
  + return *err;

    ...

  + if (ret && err)
  + *err = ret;
  +
    return ret;
    }

  @@
  identifier FUNC =~ "^ub9.._(rxport_|txport_|ind_)?(read|write|update_bits)(16|_ind)?$";
  @@
   FUNC(...
  + , NULL
   )

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub913: Align ub913_read() with other similar functions
Tomi Valkeinen [Mon, 3 Mar 2025 16:02:06 +0000 (21:32 +0530)] 
media: i2c: ds90ub913: Align ub913_read() with other similar functions

Adjust the ub913_read() to have similar form than the other similar
functions in ub9xx drivers. This makes it easier to deal with all the
read/write functions with a semantic patch.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub913: Fix returned fmt from .set_fmt()
Tomi Valkeinen [Mon, 3 Mar 2025 16:02:05 +0000 (21:32 +0530)] 
media: i2c: ds90ub913: Fix returned fmt from .set_fmt()

When setting the sink pad's stream format, set_fmt accidentally changes
the returned format's code to 'outcode', while the purpose is to only
use the 'outcode' for the propagated source stream format.

Fixes: c158d0d4ff15 ("media: i2c: add DS90UB913 driver")
Cc: stable@vger.kernel.org
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: i2c: ds90ub953: Fix error prints
Tomi Valkeinen [Mon, 3 Mar 2025 16:02:04 +0000 (21:32 +0530)] 
media: i2c: ds90ub953: Fix error prints

ub953_read_ind() and ub953_write_ind() have broken error prints, and the
register address is printed incorrectly. Fix the prints.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: dt-bindings: media: i2c: align filenames format with standard
David Heidelberg [Mon, 14 Apr 2025 19:12:29 +0000 (21:12 +0200)] 
media: dt-bindings: media: i2c: align filenames format with standard

Append missing vendor and align with other sony definitions.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: David Heidelberg <david@ixit.cz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: imx-jpeg: Check decoding is ongoing for motion-jpeg
Ming Qian [Mon, 21 Apr 2025 08:12:56 +0000 (16:12 +0800)] 
media: imx-jpeg: Check decoding is ongoing for motion-jpeg

As the first frame in "repeat-mode" is the pattern, the pattern done
interrupt is ignored by the driver. With small resolution bitstreams,
the interrupts might fire too quickly and hardware combine two irqs to
once because irq handle have latency. Thus the driver might miss the
frame decode done interrupt from the first actual frame.

In order to avoid the driver wait for the frame done interrupt that has
been combined to the pattern done interrupt and been ignored, driver
will check the curr_desc and slot_status registers to figure out if the
decoding of actual frame is finished or not.

Firstly we check the curr_desc register,
- if it is still pointing to the pattern descriptor, the second actual
frame is not started, we can wait for its frame-done interrupt.
- if the curr_desc has pointed to the frame descriptor, then we check the
ongoing bit of slot_status register.
- if the ongoing bit is set to 1, the decoding of the actual frame is not
finished, we can wait for its frame-done interrupt.
- if the ongoing bit is set to 0, the decoding of the actual frame is
finished, we can't wait for the second interrupt, but mark it as done.

But there is still a small problem, that the curr_desc and slot_status
registers are not synchronous. curr_desc is updated when the
next_descpt_ptr is loaded, but the ongoing bit of slot_status is set
after the 32 bytes descriptor is loaded, there will be a short time
interval in between, which may cause fake false. Consider read register
is quite slow compared with IP read 32byte from memory, read twice
slot_status can avoid this situation.

Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: imx-jpeg: Change the pattern size to 128x64
Ming Qian [Mon, 21 Apr 2025 08:12:55 +0000 (16:12 +0800)] 
media: imx-jpeg: Change the pattern size to 128x64

In order to decode a motion-jpeg bitstream, which doesn't provide a DHT,
the driver will first decode a pattern jpeg and use the DHT found in the
pattern to decode the first actual frame. This mode is called
"repeat-mode" and it utilizes linked descriptors.

The smallest supported resolution of 64x64 was used for that pattern to
not cause unneeded performance delay. This choice, however, can cause a
corrupted decoded picture of the first frame after the pattern, when the
resolution of that frame is larger than the pattern and is not aligned
to 64.

By altering the pattern size to 128x64, this corruption can be avoided.
That size has been confirmed to be safe by the hardware designers.
Additionally, a DMA buffer needs to be allocated to store the decoded
picture of the pattern image.

Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: imx-jpeg: Cleanup after an allocation error
Ming Qian [Mon, 21 Apr 2025 08:12:54 +0000 (16:12 +0800)] 
media: imx-jpeg: Cleanup after an allocation error

When allocation failures are not cleaned up by the driver, further
allocation errors will be false-positives, which will cause buffers to
remain uninitialized and cause NULL pointer dereferences.
Ensure proper cleanup of failed allocations to prevent these issues.

Fixes: 2db16c6ed72c ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder")
Cc: stable@vger.kernel.org
Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: imx-jpeg: Reset slot data pointers when freed
Ming Qian [Mon, 21 Apr 2025 08:12:53 +0000 (16:12 +0800)] 
media: imx-jpeg: Reset slot data pointers when freed

Ensure that the slot data pointers are reset to NULL and handles are
set to 0 after freeing the coherent memory. This makes he function
mxc_jpeg_alloc_slot_data() and mxc_jpeg_free_slot_data() safe to be
called multiple times.

Fixes: 2db16c6ed72c ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder")
Cc: stable@vger.kernel.org
Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: imx-jpeg: Move mxc_jpeg_free_slot_data() ahead
Ming Qian [Mon, 21 Apr 2025 08:12:52 +0000 (16:12 +0800)] 
media: imx-jpeg: Move mxc_jpeg_free_slot_data() ahead

Move function mxc_jpeg_free_slot_data() above mxc_jpeg_alloc_slot_data()
allowing to call that function during allocation failures.
No functional changes are made.

Fixes: 2db16c6ed72c ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder")
Cc: stable@vger.kernel.org
Signed-off-by: Ming Qian <ming.qian@oss.nxp.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
3 months agomedia: imagination: fix a potential memory leak in e5010_probe()
Haoxiang Li [Wed, 26 Feb 2025 12:49:22 +0000 (20:49 +0800)] 
media: imagination: fix a potential memory leak in e5010_probe()

Add video_device_release() to release the memory allocated by
video_device_alloc() if something goes wrong.

Fixes: a1e294045885 ("media: imagination: Add E5010 JPEG Encoder driver")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>