]> git.ipfire.org Git - thirdparty/kernel/linux.git/log
thirdparty/kernel/linux.git
4 months agomedia: synopsys: hdmirx: Fix signedness bug in hdmirx_parse_dt()
Dan Carpenter [Fri, 7 Mar 2025 09:30:16 +0000 (12:30 +0300)] 
media: synopsys: hdmirx: Fix signedness bug in hdmirx_parse_dt()

The num_clks is set this way:

hdmirx_dev->num_clks = devm_clk_bulk_get_all(dev, &hdmirx_dev->clks);
        if (hdmirx_dev->num_clks < 1)
                return -ENODEV;

The devm_clk_bulk_get_all() function returns negative error codes so the
hdmirx_dev->num_cks variable needs to be signed for the error handling to
work.

Fixes: 7b59b132ad43 ("media: platform: synopsys: Add support for HDMI input driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: platform: synopsys: hdmirx: Fix 64-bit division for 32-bit targets
Nathan Chancellor [Thu, 6 Mar 2025 21:45:16 +0000 (22:45 +0100)] 
media: platform: synopsys: hdmirx: Fix 64-bit division for 32-bit targets

The build fails for 32-bit targets with:

  arm-linux-gnueabi-ld: drivers/media/platform/synopsys/hdmirx/snps_hdmirx.o: in function `hdmirx_get_timings':
  snps_hdmirx.c:(.text.hdmirx_get_timings+0x46c): undefined reference to `__aeabi_uldivmod'

bt->pixelclock is __u64, which causes the compiler to emit a libcall for
64-bit division. Use the optimized kernel helper, div_u64(), to resolve
this.

Fixes: 7b59b132ad43 ("media: platform: synopsys: Add support for HDMI input driver")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: vim2m: print device name after registering device
Matthew Majewski [Wed, 19 Feb 2025 19:05:01 +0000 (14:05 -0500)] 
media: vim2m: print device name after registering device

Move the v4l2_info() call displaying the video device name after the
device is actually registered.

This fixes a bug where the driver was always displaying "/dev/video0"
since it was reading from the vfd before it was registered.

Fixes: cf7f34777a5b ("media: vim2m: Register video device after setting up internals")
Cc: stable@vger.kernel.org
Signed-off-by: Matthew Majewski <mattwmajewski@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: vivid: Introduce VIDEO_VIVID_OSD
Ricardo Ribalda [Thu, 6 Mar 2025 13:27:31 +0000 (13:27 +0000)] 
media: vivid: Introduce VIDEO_VIVID_OSD

vivid-osd depends on CONFIG_FB, which can be a large dependency. Introduce
CONFIG_VIDEO_VIVID_OSD to control enabling support for testing output
overlay.

Suggested-by: Slawomir Rosek <srosek@google.com>
Co-developed-by: Slawomir Rosek <srosek@google.com>
Signed-off-by: Slawomir Rosek <srosek@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[hverkuil: add newline to squash checkpatch warning]

4 months agomedia: vivid: Move all fb_info references into vivid-osd
Ricardo Ribalda [Thu, 6 Mar 2025 13:27:30 +0000 (13:27 +0000)] 
media: vivid: Move all fb_info references into vivid-osd

Most references to fb_info are already within vivid-osd.c. This patch
moves the remaining references into vivid-osd.c.

We also take this opportunity to make the function names in vivid-osd
more consistent.

This is a preparation patch to make CONFIG_FB optional for vivid.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: platform: synopsys: hdmirx: Optimize struct snps_hdmirx_dev
Dmitry Osipenko [Thu, 6 Mar 2025 08:05:33 +0000 (11:05 +0300)] 
media: platform: synopsys: hdmirx: Optimize struct snps_hdmirx_dev

Move cached EDID that takes 512 bytes to the bottom of struct
snps_hdmirx_dev to improve CPU's cache locality of the struct.

Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: platform: synopsys: hdmirx: Remove unused HDMI audio CODEC relics
Dmitry Osipenko [Thu, 6 Mar 2025 08:05:32 +0000 (11:05 +0300)] 
media: platform: synopsys: hdmirx: Remove unused HDMI audio CODEC relics

HDMI audio CODEC is unsupported in the current version of the driver.
Support may come later. Remove HDMI CODEC bits that were left out
by accident to keep code consistent.

Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: platform: synopsys: hdmirx: Remove duplicated header inclusion
Dmitry Osipenko [Thu, 6 Mar 2025 08:05:31 +0000 (11:05 +0300)] 
media: platform: synopsys: hdmirx: Remove duplicated header inclusion

Remove second v4l2-common.h header inclusion.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202503061231.PHF6hEL2-lkp@intel.com/
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: qcom: Clean up Kconfig dependencies
Robin Murphy [Tue, 16 Aug 2022 13:49:05 +0000 (14:49 +0100)] 
media: qcom: Clean up Kconfig dependencies

Depending on IOMMU_DMA is suspicious, since the low-level DMA ops
internals and MSI helpers is provides are not of interest to general
drivers. In practice it mostly seems to be serving as a dependency on
ARM64 here, so do that properly. The venus driver looks like it won't
actually be useful at runtime without the IOMMU API, so add that too.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: dvb-frontends: tda10048: Make the range of z explicit.
Ricardo Ribalda [Sat, 11 Jan 2025 09:55:14 +0000 (09:55 +0000)] 
media: dvb-frontends: tda10048: Make the range of z explicit.

The datasheet recommends 55MHz frequency sampling, with a max of 69 MHz.
(Kudos to Kosta Stefanov for the calculations).

Replace z with a 32 bit uint, and make the range of the variable
explicit.

Found by cocci:
drivers/media/dvb-frontends/tda10048.c:345:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead.

Reviewed-by: Kosta Stefanov <costa.stephanoff@gmail.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: platform: stm32: Add check for clk_enable()
Jiasheng Jiang [Fri, 22 Nov 2024 20:46:03 +0000 (20:46 +0000)] 
media: platform: stm32: Add check for clk_enable()

Add check for the return value of clk_enable() to gurantee the success.

Fixes: 002e8f0d5927 ("media: stm32-dma2d: STM32 DMA2D driver")
Cc: stable@vger.kernel.org
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: xilinx-tpg: fix double put in xtpg_parse_of()
Dan Carpenter [Mon, 4 Nov 2024 17:16:19 +0000 (20:16 +0300)] 
media: xilinx-tpg: fix double put in xtpg_parse_of()

This loop was recently converted to use for_each_of_graph_port() which
automatically does __cleanup__ on the "port" iterator variable.  Delete
the calls to of_node_put(port) to avoid a double put bug.

Fixes: 393194cdf11e ("media: xilinx-tpg: use new of_graph functions")
Cc: stable@vger.kernel.org
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: siano: Fix error handling in smsdvb_module_init()
Yuan Can [Tue, 22 Oct 2024 06:50:37 +0000 (14:50 +0800)] 
media: siano: Fix error handling in smsdvb_module_init()

The smsdvb_module_init() returns without checking the retval from
smscore_register_hotplug().
If the smscore_register_hotplug() failed, the module failed to install,
leaving the smsdvb_debugfs not unregistered.

Fixes: 3f6b87cff66b ("[media] siano: allow showing the complete statistics via debugfs")
Cc: stable@vger.kernel.org
Signed-off-by: Yuan Can <yuancan@huawei.com>
Acked-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: c8sectpfe: Call of_node_put(i2c_bus) only once in c8sectpfe_probe()
Markus Elfring [Fri, 4 Oct 2024 13:50:15 +0000 (15:50 +0200)] 
media: c8sectpfe: Call of_node_put(i2c_bus) only once in c8sectpfe_probe()

An of_node_put(i2c_bus) call was immediately used after a pointer check
for an of_find_i2c_adapter_by_node() call in this function implementation.
Thus call such a function only once instead directly before the check.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: i2c: tda1997x: Call of_node_put(ep) only once in tda1997x_parse_dt()
Markus Elfring [Thu, 3 Oct 2024 19:38:45 +0000 (21:38 +0200)] 
media: i2c: tda1997x: Call of_node_put(ep) only once in tda1997x_parse_dt()

An of_node_put(ep) call was immediately used after a return value check
for a v4l2_fwnode_endpoint_parse() call in this function implementation.
Thus call such a function only once instead directly before the check.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agodt-bindings: media: mediatek,vcodec: Revise description
Fei Shao [Tue, 1 Oct 2024 11:27:22 +0000 (19:27 +0800)] 
dt-bindings: media: mediatek,vcodec: Revise description

Revise the description of MediaTek video decoder to improve wording, fix
typos, simplify diagram, and extend the pipeline architecture used in
newer MediaTek SoCs (MT8186 and MT8188).

Signed-off-by: Fei Shao <fshao@chromium.org>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agodt-bindings: media: mediatek,jpeg: Relax IOMMU max item count
Fei Shao [Tue, 1 Oct 2024 11:27:21 +0000 (19:27 +0800)] 
dt-bindings: media: mediatek,jpeg: Relax IOMMU max item count

On MediaTek platforms with Multimedia MMU (M4U), a multimedia hardware
can be assigned with a local arbiter (LARB) which has a maximum of 32
ports for MediaTek's IOMMU infrastructure. That means there can be at
most 32 items in the iommus property in theory.

Instead of relaxing the max item count every time a newly introduced
device tree hits the limit, bump the number to 32 as an one-time effort.

On the other hand, all existing and foreseeable JPEG decoder nodes at
this point have at least 2 IOMMUs, so set minItems to 2 accordingly.

Signed-off-by: Fei Shao <fshao@chromium.org>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: v4l2-dv-timings: prevent possible overflow in v4l2_detect_gtf()
Karina Yankevich [Wed, 21 Aug 2024 11:31:34 +0000 (14:31 +0300)] 
media: v4l2-dv-timings: prevent possible overflow in v4l2_detect_gtf()

In v4l2_detect_gtf(), it seems safer to cast the 32-bit image_width
variable to the 64-bit type u64 before multiplying to avoid
a possible overflow. The resulting object code even seems to
look better, at least on x86_64.

Found by Linux Verification Center (linuxtesting.org) with Svace.

[Sergey: rewrote the patch subject/descripition]

Fixes: c9bc9f50753d ("[media] v4l2-dv-timings: fix overflow in gtf timings calculation")
Cc: stable@vger.kernel.org
Signed-off-by: Karina Yankevich <k.yankevich@omp.ru>
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: rockchip: rga: fix rga offset lookup
John Keeping [Sat, 10 Aug 2024 13:02:54 +0000 (14:02 +0100)] 
media: rockchip: rga: fix rga offset lookup

The arguments to rga_lookup_draw_pos() are passed in the wrong order,
rotate mode should be before mirror mode.

Fixes: 558c248f930e6 ("media: rockchip: rga: split src and dst buffer setup")
Cc: stable@vger.kernel.org
Signed-off-by: John Keeping <jkeeping@inmusicbrands.com>
Reviewed-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: rockchip: rga: fix field in OUTPUT buffers
Michael Tretter [Fri, 9 Aug 2024 16:06:30 +0000 (18:06 +0200)] 
media: rockchip: rga: fix field in OUTPUT buffers

Returned buffers shouldn't contain V4L2_FIELD_ANY as field. Set the
field to V4L2_FIELD_NONE, if it isn't set.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agostaging: media: sdis: move open braces to the previous line
Santiago Ruano Rincón [Tue, 30 Jul 2024 21:28:54 +0000 (06:28 +0900)] 
staging: media: sdis: move open braces to the previous line

Fix checkpatch error "ERROR: that open brace { should be on the previous
line" in ia_css_sdis.host.c:253 and :258.

Signed-off-by: Santiago Ruano Rincón <santiagorr@riseup.net>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agostaging: media: sdis: move open brace to a new line
Santiago Ruano Rincón [Tue, 30 Jul 2024 21:28:53 +0000 (06:28 +0900)] 
staging: media: sdis: move open brace to a new line

Fix checkpatch error "ERROR: open brace '{' following function
definitions go on the next line" in sdis_1.0/ia_css_sdis.host.c:239.

Signed-off-by: Santiago Ruano Rincón <santiagorr@riseup.net>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: ccs-pll: Make variables const where appropriate
Laurent Pinchart [Sat, 29 Jun 2024 15:52:05 +0000 (18:52 +0300)] 
media: ccs-pll: Make variables const where appropriate

Many functions operate on data structures that are read only, both in
the implementation and by design. Mark them as const to increase
readability and avoid future mistakes.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: cec: use us_to_ktime() where appropriate
Vitaliy Shevtsov [Wed, 5 Mar 2025 15:11:25 +0000 (20:11 +0500)] 
media: cec: use us_to_ktime() where appropriate

[Why]
There are several ns_to_ktime() calls that require using nanoseconds. It is
better to replace them with us_to_ktime() to make code clear, getting rid
of multiplication by 1000.

Also the timer function code may have an integer wrap-around issue. Since
both tx_custom_low_usecs and tx_custom_high_usecs can be set to up to
9999999 from the user space via cec_pin_error_inj_parse_line(), this may
cause usecs to be overflowed when adap->monitor_pin_cnt is zero and usecs
is multiplied by 1000.

[How]
Take advantage of using an appropriate helper func us_to_ktime() instead of
ns_to_ktime() to improve readability and to make the code clearer. And this
also mitigates possible integer wrap-arounds when usecs value is too large
and it is multiplied by 1000.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Signed-off-by: Vitaliy Shevtsov <v.shevtsov@mt-integration.ru>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: i2c: add lt6911uxe hdmi bridge driver
Dongcheng Yan [Thu, 6 Mar 2025 06:04:27 +0000 (14:04 +0800)] 
media: i2c: add lt6911uxe hdmi bridge driver

Lontium LT9611UXE is a HDMI to MIPI CSI-2 bridge. The device supports
modes up to 4k@60fps, obtains the video information and switches the
current mode once the video signal changes.

Signed-off-by: Dongcheng Yan <dongcheng.yan@intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[hverkuil: fix smatch warning: missing error code 'ret']
[hverkuil: fix coccinelle IRQF_ONESHOT warning]

4 months agomedia: vimc: skip .s_stream() for stopped entities
Nikita Zhandarovich [Sun, 2 Mar 2025 14:58:25 +0000 (17:58 +0300)] 
media: vimc: skip .s_stream() for stopped entities

Syzbot reported [1] a warning prompted by a check in call_s_stream()
that checks whether .s_stream() operation is warranted for unstarted
or stopped subdevs.

Add a simple fix in vimc_streamer_pipeline_terminate() ensuring that
entities skip a call to .s_stream() unless they have been previously
properly started.

[1] Syzbot report:
------------[ cut here ]------------
WARNING: CPU: 0 PID: 5933 at drivers/media/v4l2-core/v4l2-subdev.c:460 call_s_stream+0x2df/0x350 drivers/media/v4l2-core/v4l2-subdev.c:460
Modules linked in:
CPU: 0 UID: 0 PID: 5933 Comm: syz-executor330 Not tainted 6.13.0-rc2-syzkaller-00362-g2d8308bf5b67 #0
...
Call Trace:
 <TASK>
 vimc_streamer_pipeline_terminate+0x218/0x320 drivers/media/test-drivers/vimc/vimc-streamer.c:62
 vimc_streamer_pipeline_init drivers/media/test-drivers/vimc/vimc-streamer.c:101 [inline]
 vimc_streamer_s_stream+0x650/0x9a0 drivers/media/test-drivers/vimc/vimc-streamer.c:203
 vimc_capture_start_streaming+0xa1/0x130 drivers/media/test-drivers/vimc/vimc-capture.c:256
 vb2_start_streaming+0x15f/0x5a0 drivers/media/common/videobuf2/videobuf2-core.c:1789
 vb2_core_streamon+0x2a7/0x450 drivers/media/common/videobuf2/videobuf2-core.c:2348
 vb2_streamon drivers/media/common/videobuf2/videobuf2-v4l2.c:875 [inline]
 vb2_ioctl_streamon+0xf4/0x170 drivers/media/common/videobuf2/videobuf2-v4l2.c:1118
 __video_do_ioctl+0xaf0/0xf00 drivers/media/v4l2-core/v4l2-ioctl.c:3122
 video_usercopy+0x4d2/0x1620 drivers/media/v4l2-core/v4l2-ioctl.c:3463
 v4l2_ioctl+0x1ba/0x250 drivers/media/v4l2-core/v4l2-dev.c:366
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:906 [inline]
 __se_sys_ioctl fs/ioctl.c:892 [inline]
 __x64_sys_ioctl+0x190/0x200 fs/ioctl.c:892
 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:0x7f2b85c01b19
...

Reported-by: syzbot+5bcd7c809d365e14c4df@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=5bcd7c809d365e14c4df
Fixes: adc589d2a208 ("media: vimc: Add vimc-streamer for stream control")
Cc: stable@vger.kernel.org
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: dvb: Fix spelling mistake "ofset" -> "offset"
Colin Ian King [Fri, 28 Feb 2025 08:49:12 +0000 (08:49 +0000)] 
media: dvb: Fix spelling mistake "ofset" -> "offset"

There is a spelling mistake in a dprink message. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: s5p-mfc: Corrected NV12M/NV21M plane-sizes
Aakarsh Jain [Wed, 26 Feb 2025 10:22:51 +0000 (15:52 +0530)] 
media: s5p-mfc: Corrected NV12M/NV21M plane-sizes

There is a possibility of getting page fault if the overall
buffer size is not aligned to 256bytes. Since MFC does read
operation only and it won't corrupt the data values even if
it reads the extra bytes.
Corrected luma and chroma plane sizes for V4L2_PIX_FMT_NV12M
and V4L2_PIX_FMT_NV21M pixel format.

Suggested-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Aakarsh Jain <aakarsh.jain@samsung.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: platform: ti: Remove unused omap3isp_print_status
Dr. David Alan Gilbert [Tue, 25 Feb 2025 01:15:43 +0000 (01:15 +0000)] 
media: platform: ti: Remove unused omap3isp_print_status

omap3isp_print_status() was added in 2011 by
commit 448de7e7850b ("[media] omap3isp: OMAP3 ISP core")
but has remained unused.

Remove it (and it's associated #defines).

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: platform: synopsys: Add support for HDMI input driver
Shreeya Patel [Tue, 4 Mar 2025 08:58:16 +0000 (11:58 +0300)] 
media: platform: synopsys: Add support for HDMI input driver

Add initial support for the Synopsys DesignWare HDMI RX
Controller Driver used by Rockchip RK3588. The driver
supports:
 - HDMI 1.4b and 2.0 modes (HDMI 4k@60Hz)
 - RGB888, YUV422, YUV444 and YCC420 pixel formats
 - CEC
 - EDID configuration

The hardware also has Audio and HDCP capabilities, but these are
not yet supported by the driver.

Co-developed-by: Dingxian Wen <shawn.wen@rock-chips.com>
Signed-off-by: Dingxian Wen <shawn.wen@rock-chips.com>
Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agodt-bindings: media: Document bindings for HDMI RX Controller
Shreeya Patel [Tue, 4 Mar 2025 08:58:15 +0000 (11:58 +0300)] 
dt-bindings: media: Document bindings for HDMI RX Controller

Document bindings for the Synopsys DesignWare HDMI RX Controller.

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agoMAINTAINERS: Add entry for Synopsys DesignWare HDMI RX Driver
Shreeya Patel [Tue, 4 Mar 2025 08:58:14 +0000 (11:58 +0300)] 
MAINTAINERS: Add entry for Synopsys DesignWare HDMI RX Driver

Add an entry for Synopsys DesignWare HDMI Receiver Controller
Driver.

Reviewed-by: Christopher Obbard <chris.obbard@collabora.com>
Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: v4l2-core: use (t,l)/wxh format for rectangle
Hans Verkuil [Mon, 3 Mar 2025 10:31:38 +0000 (11:31 +0100)] 
media: v4l2-core: use (t,l)/wxh format for rectangle

Standardize reporting of rectangles to (t,l)/wxh.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: v4l2-tpg: use (t,l)/wxh format for rectangle
Hans Verkuil [Mon, 3 Mar 2025 10:30:23 +0000 (11:30 +0100)] 
media: v4l2-tpg: use (t,l)/wxh format for rectangle

Standardize reporting of rectangles to (t,l)/wxh.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: radio-wl1273: Rename wl1273_fm_vidioc_s_ctrl
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:15 +0000 (18:58 +0000)] 
media: radio-wl1273: Rename wl1273_fm_vidioc_s_ctrl

Now that vidioc_s_ctrl is gone we want to remove that string from all
the codebase.

Besides, it isn't the correct name of this function anyway. It's clearly a
left-over from the past.

Suggested-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: v4l2-core: Introduce v4l2_query_ext_ctrl_to_v4l2_queryctrl
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:14 +0000 (18:58 +0000)] 
media: v4l2-core: Introduce v4l2_query_ext_ctrl_to_v4l2_queryctrl

We use this logic in a couple of places. Refactor into a function.
No functional change expected from this patch.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: v4l2: Remove vidioc_s_ctrl callback
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:13 +0000 (18:58 +0000)] 
media: v4l2: Remove vidioc_s_ctrl callback

All the drivers either use the control framework or provide a
vidiod_ext_ctrl. We can remove this callback.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: cx231xx: Remove vidioc_s_ctrl callback
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:12 +0000 (18:58 +0000)] 
media: cx231xx: Remove vidioc_s_ctrl callback

The driver has been converted to the control framework in the past:
commit 88b6ffedd901 ("[media] cx231xx-417: convert to the control
framework").

This function is never called, the core will only use the control
framework instead.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Tested-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: v4l2: Remove vidioc_g_ctrl callback
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:11 +0000 (18:58 +0000)] 
media: v4l2: Remove vidioc_g_ctrl callback

All the drivers either use the control framework or provide a
vidioc_g_ext_ctrls callback. We can remove this callback.

Thanks for your service!

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: v4l2: Remove vidioc_queryctrl callback
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:10 +0000 (18:58 +0000)] 
media: v4l2: Remove vidioc_queryctrl callback

All the drivers either use the control framework or provide a
vidioc_query_ext_ctrl. We can remove this callback to reduce the
temptation of new drivers to implement it.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: atomisp: Remove vidioc_g/s callback
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:09 +0000 (18:58 +0000)] 
media: atomisp: Remove vidioc_g/s callback

The v4l2 ioctl framework can implement vidioc_g/s_ctrl with
vidioc_g/s_ext_ctrl() and we provide those.

These are the last references of vidioc_s/g_ctrl in the codebase. We can
attempt to remove them now.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: atomisp: Replace queryctrl with query_ext_ctrl
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:08 +0000 (18:58 +0000)] 
media: atomisp: Replace queryctrl with query_ext_ctrl

The ioctl framework provides an emulator of queryctrl using
query_ext_ctrl.
Replace our implementation of queryctrl to support both.

Now that we are at it:
- Add comment about missing functionality.
- Remove superfluous clear of reserved[0].
- Remove ret var.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: uvcvideo: Remove vidioc_queryctrl
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:07 +0000 (18:58 +0000)] 
media: uvcvideo: Remove vidioc_queryctrl

It can be implemented by the v4l2 ioctl framework using
vidioc_query_ext_ctrl.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[hverkuil: rebased]
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: pvrusb2: Remove g/s_ctrl callbacks
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:06 +0000 (18:58 +0000)] 
media: pvrusb2: Remove g/s_ctrl callbacks

The ioctl helpers can emulate g/s_ctrl with g/s_ext_ctrl. Simplify the
code.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: pvrusb2: Convert queryctrl to query_ext_ctrl
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:05 +0000 (18:58 +0000)] 
media: pvrusb2: Convert queryctrl to query_ext_ctrl

The driver was missing support for query_ext_ctrl. Instead of adding a
new callback for it, replace the current implementation of queryctrl and
let the ioctl framework emulate the old function.

Most of the fields are identical, so the change is pretty simple.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: ioctl: Simulate v4l2_queryctrl with v4l2_query_ext_ctrl
Ricardo Ribalda [Sun, 23 Feb 2025 18:58:04 +0000 (18:58 +0000)] 
media: ioctl: Simulate v4l2_queryctrl with v4l2_query_ext_ctrl

v4l2_queryctrl is a subset of v4l2_query_ext_ctrl. If the driver does
not implement v4l2_queryctrl we can implement it with
v4l2_query_ext_ctrl.

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: cx231xx: set device_caps for 417
Hans Verkuil [Mon, 24 Feb 2025 13:13:24 +0000 (14:13 +0100)] 
media: cx231xx: set device_caps for 417

The video_device for the MPEG encoder did not set device_caps.

Add this, otherwise the video device can't be registered (you get a
WARN_ON instead).

Not seen before since currently 417 support is disabled, but I found
this while experimenting with it.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: cec: core: allow raw msg transmit while configuring
Hans Verkuil [Mon, 17 Feb 2025 14:53:38 +0000 (15:53 +0100)] 
media: cec: core: allow raw msg transmit while configuring

While the CEC adapter is configuring, it is not possible to transmit a
CEC message with the CEC_MSG_FL_RAW flag set as this is blocked at the
ioctl level. Check if this flag is set, and if so, allow the message to
be transmitted. This is useful for debugging if the display has no
physical address (typically because the HPD is pulled low while in
Standby).

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 months agomedia: cx23885: Add analog support for AVerMedia H789-C PCIe card
Plamen Atanasov [Sun, 2 Jun 2024 15:17:13 +0000 (18:17 +0300)] 
media: cx23885: Add analog support for AVerMedia H789-C PCIe card

This card has the following ICs: Hybrid tuner TDA18271, CX23888 PCIe
bridge/demodulator/decoder (and DVB-T demodulator AF9013S, which is
not within the scope of this patch). It has the following inputs: Tuner,
S-Video, Composite (shared with the luma input of S-Video) and Audio L/R
RCA. VID:PID is 1461:e139. When the patch is applied and the cx23885
kernel module is built and loaded, the following dmesg can be seen:

[  749.677298] cx23885: cx23885 driver version 0.0.4 loaded
[  749.677554] cx23885: CORE cx23885[0]: subsystem: 1461:e139, board: AVerMedia H789-C [card=63,autodetected]
[  749.831841] cx25840 8-0044: cx23888 A/V decoder found @ 0x88 (cx23885[0])
[  750.451676] cx25840 8-0044: loaded v4l-cx23885-avcore-01.fw firmware (16382 bytes)
[  750.488064] tuner: 7-0063: Tuner -1 found with type(s) Radio TV.
[  750.488115] tda18271 7-0063: creating new instance
[  750.490153] tda18271: TDA18271HD/C2 detected @ 7-0063
[  750.805043] cx23885: cx23885[0]: registered device video2 [v4l2]
[  750.805151] cx23885: cx23885[0]: registered device vbi2
[  750.808682] cx23885: cx23885[0]: alsa: registered ALSA audio device
[  750.808693] cx23885: cx23885_dev_checkrevision() Hardware revision = 0xd0
[  750.808700] cx23885: cx23885[0]/0: found at 0000:02:00.0, rev: 4, irq: 18, latency: 0, mmio: 0xddc00000

The card has to be defined in cx23885-cards.c (firmware also has to be
loaded) and cx23885.h. Moreover, audio routing is configured in
cx23885-video.c. Analog tuning, composite, s-video and stereo audio
inputs have been successfully tested with PAL B/G.

Signed-off-by: Plamen Atanasov <tigerment@mail.bg>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: rc: reduce useless padding in struct rc_dev etc
Sean Young [Mon, 1 Jul 2024 09:11:49 +0000 (10:11 +0100)] 
media: rc: reduce useless padding in struct rc_dev etc

Reorder the fields in these structs so that we waste less space due to
padding. pahole shows that lirc_fh is 8 bytes smaller, and rc_dev is 32
bytes smaller.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: rcar-csi2: Convert to .{enable|disable}_streams
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:43 +0000 (15:10 +0200)] 
media: rcar-csi2: Convert to .{enable|disable}_streams

Drop the legacy .s_stream and convert to .{enable|disable}_streams.

Signed-off-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>
4 months agomedia: rcar-isp: Convert to .{enable|disable}_streams
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:42 +0000 (15:10 +0200)] 
media: rcar-isp: Convert to .{enable|disable}_streams

Drop the legacy .s_stream and convert to .{enable|disable}_streams.

Signed-off-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>
4 months agomedia: rcar-isp: Convert to subdev state
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:41 +0000 (15:10 +0200)] 
media: rcar-isp: Convert to subdev state

Convert to subdev state. This allows us to drop the internal mutex and
risp_get_pad_format(), and add streams support in the future.

Signed-off-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>
4 months agomedia: rcar-csi2: Use v4l2_subdev_{enable|disable}_streams()
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:40 +0000 (15:10 +0200)] 
media: rcar-csi2: Use v4l2_subdev_{enable|disable}_streams()

Use v4l2_subdev_{enable|disable}_streams() instead of calling s_stream
op directly. This allows the called subdev to drop the legacy s_stream
op.

Signed-off-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>
4 months agomedia: rcar-isp: Use v4l2_subdev_{enable|disable}_streams()
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:39 +0000 (15:10 +0200)] 
media: rcar-isp: Use v4l2_subdev_{enable|disable}_streams()

Use v4l2_subdev_{enable|disable}_streams() instead of calling s_stream
op directly. This allows the called subdev to drop the legacy s_stream
op.

Signed-off-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>
4 months agomedia: rcar-vin: Use v4l2_subdev_{enable|disable}_streams()
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:38 +0000 (15:10 +0200)] 
media: rcar-vin: Use v4l2_subdev_{enable|disable}_streams()

Use v4l2_subdev_{enable|disable}_streams() instead of calling s_stream
op directly. This allows the called subdev to drop the legacy s_stream
op.

Signed-off-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>
4 months agomedia: rcar-csi2: Use v4l2_get_link_freq()
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:37 +0000 (15:10 +0200)] 
media: rcar-csi2: Use v4l2_get_link_freq()

Instead of directly using V4L2_CID_PIXEL_RATE and calculating the mbps
from that, use v4l2_get_link_freq(), which also supports
V4L2_CID_LINK_FREQ.

Signed-off-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>
4 months agomedia: rcar-isp: Add RAW8, RAW10 and RAW12 formats
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:36 +0000 (15:10 +0200)] 
media: rcar-isp: Add RAW8, RAW10 and RAW12 formats

Add RAW8, RAW10 and RAW12 formats.

Signed-off-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>
4 months agomedia: rcar-csi2: Add RAW10 and RAW12 formats
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:35 +0000 (15:10 +0200)] 
media: rcar-csi2: Add RAW10 and RAW12 formats

Add RAW10 and RAW12 formats. We only need to add the entries to the
rcar_csi2_format list.

Signed-off-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>
4 months agomedia: rcar-csi2: Move Y8 entry to a better place
Tomi Valkeinen [Mon, 20 Jan 2025 13:10:34 +0000 (15:10 +0200)] 
media: rcar-csi2: Move Y8 entry to a better place

Move the Y8 entry before Y10, so that the entries are in a bit more
logical order.

Signed-off-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>
4 months agomedia: ov08x40: Log chip ID when identifying the chip
Hans de Goede [Sat, 1 Mar 2025 11:48:30 +0000 (12:48 +0100)] 
media: ov08x40: Log chip ID when identifying the chip

Debug log the chip ID after successfully identifying the chip, this is
useful to see if the identification is done on probe() time or if it is
delayed till the first stream on.

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>
4 months agomedia: ov08x40: Fix value of reset GPIO when requesting it
Hans de Goede [Sat, 1 Mar 2025 11:48:29 +0000 (12:48 +0100)] 
media: ov08x40: Fix value of reset GPIO when requesting it

We should put/leave the sensor in reset when requesting the GPIO, after
requesting it there are 2 possible scenarios and having the GPIO driven
low is no good in either scenario:

1. The sensor was in ACPI D0 before probe() runs, in this case
   ov08x40_power_on() + ov08x40_identify_module() will run immediately
   after requesting the GPIO and ov08x40_power_on() starts with driving
   the GPIO high. So if the GPIO was already high it will very shortly
   be driven low, more of a spike to low then actually properly be driven
   low. Which may leave the sensor in a confused state.

   If we request the GPIO to be high at request time then power_on() will
   driver it high again (no-op) and then sleep for 1-2 ms, so no spike.

2. The sensor was in ACPI D3 / off before probe(), in this case probe()
   leaves the sensor alone. But when the sensor is off its reset line
   should be driven high not low.

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>
4 months agomedia: imx335: Set vblank immediately
Paul Elder [Fri, 28 Feb 2025 09:17:31 +0000 (18:17 +0900)] 
media: imx335: Set vblank immediately

When the vblank v4l2 control is set, it does not get written to the
hardware unless exposure is also changed. Change the behavior such that
the vblank is written immediately when the control is set, as setting
the vblank without changing the exposure is a valid use case (such as
for changing the frame rate).

Signed-off-by: Paul Elder <paul.elder@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>
4 months agomedia: ipu6: Drop unused ipu6_dma_get_sgtable()
Sakari Ailus [Tue, 25 Feb 2025 08:54:14 +0000 (10:54 +0200)] 
media: ipu6: Drop unused ipu6_dma_get_sgtable()

ipu6_dma_get_sgtable() is now unused. Drop it.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: i2c: ov9282: add AEC Manual register definition
Richard Leitner [Tue, 25 Feb 2025 13:08:41 +0000 (14:08 +0100)] 
media: i2c: ov9282: add AEC Manual register definition

Add #define's for the "AEC MANUAL" (0x3503) register and its
values/flags. Use those in the registers single usage within the
`common_regs` struct.

All values are based on the OV9281 datasheet v1.01 (09.18.2015).

Signed-off-by: Richard Leitner <richard.leitner@linux.dev>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: i2c: ov9282: use register definitions
Richard Leitner [Tue, 25 Feb 2025 13:08:40 +0000 (14:08 +0100)] 
media: i2c: ov9282: use register definitions

For better readability use already available register definitions in
hard-coded common and mode register structs.

Signed-off-by: Richard Leitner <richard.leitner@linux.dev>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: vgxy61: Replace nested min() with single min3()
Qasim Ijaz [Tue, 25 Feb 2025 12:59:37 +0000 (12:59 +0000)] 
media: vgxy61: Replace nested min() with single min3()

Use min3() macro instead of nesting min() to simplify the return
statement.

Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: i2c: imx219: Only use higher LLP_MIN for binned resolutions
Jai Luthra [Fri, 21 Feb 2025 10:52:15 +0000 (16:22 +0530)] 
media: i2c: imx219: Only use higher LLP_MIN for binned resolutions

The LLP_MIN of 3560 is only needed to fix artefacts seen with binned
resolutions. As increasing the LLP reduces the highest possible
framerate by ~3%, use the old default minimum of 3448 if we are not
doing 2x2 analog binning.

Also restore the fll_def value for non-binned modes in the modes
definition to restore the default mode framerate to 30fps.

Suggested-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://lore.kernel.org/linux-media/CAPY8ntC1-S6zKtDvmc6EgyxP+j6rTShuG8Dr8PKb9XQr2PeS_w@mail.gmail.com/
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: i2c: imx219: Use subdev state to calculate binning and pixelrate
Jai Luthra [Fri, 21 Feb 2025 10:52:14 +0000 (16:22 +0530)] 
media: i2c: imx219: Use subdev state to calculate binning and pixelrate

The pixel rate and binning calculations need the format and resolution
of the sensor, so pass the v4l2 subdev state directly instead of always
operating on the active state.

Suggested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Link: https://lore.kernel.org/linux-media/sejl7xskif6rlpdsg3jhczjwe5gi6rs53ehbyka6omv2zeg7qq@4iis7i2lla5p/
Reviewed-by: Jacopo Mondi <jacopo.mondi@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>
4 months agomedia: i2c: imx219: Simplify binning mode
Jai Luthra [Fri, 21 Feb 2025 10:52:13 +0000 (16:22 +0530)] 
media: i2c: imx219: Simplify binning mode

The imx219_get_binning() function currently returns two separate pieces
of information, the return value is the binning mode enum, and the bin_h
and bin_v references are updated with whether to perform binning in
horizontal and vertical dimensions.

It is simpler to combine both of these pieces of information, and
directly update the bin_h and bin_v references with the register value
that we will write to the sensor, which includes if the binning is
digital or analog mode, thus allowing us to remove the superfluous
binning mode enum.

This is only a style change for the driver, with no functionality
updated.

Suggested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Link: https://lore.kernel.org/linux-media/ubuuob7mb3o5bxoumrxv4rufutgk3lvdmdery6d3bfc6rytfti@tcchhlechzzp/
Reviewed-by: Jacopo Mondi <jacopo.mondi@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>
4 months agomedia: i2c: imx283: Drop runtime suspend/resume functions
Tarang Raval [Mon, 24 Feb 2025 11:05:54 +0000 (16:35 +0530)] 
media: i2c: imx283: Drop runtime suspend/resume functions

The imx283_runtime_suspend and imx283_runtime_resume functions
simply call imx283_power_off and imx283_power_on, respectively.
Since these functions do not add any additional logic, they are
unnecessary and can be 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>
4 months agomedia: i2c: imx219: remove context around case
Cosmin Tanislav [Thu, 20 Feb 2025 14:06:35 +0000 (16:06 +0200)] 
media: i2c: imx219: remove context around case

There are no longer variable declarations here, the context is useless.

Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: i2c: imx214: Fix uninitialized variable in imx214_set_ctrl()
Dan Carpenter [Tue, 18 Feb 2025 13:05:50 +0000 (16:05 +0300)] 
media: i2c: imx214: Fix uninitialized variable in imx214_set_ctrl()

You can't pass uninitialized "ret" variables to cci_write().  It has to
start as zero.

Fixes: 4f0aeba4f155 ("media: i2c: imx214: Convert to CCI register access helpers")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: omap3isp: Use syscon_regmap_lookup_by_phandle_args
Krzysztof Kozlowski [Sun, 12 Jan 2025 13:46:47 +0000 (14:46 +0100)] 
media: omap3isp: Use syscon_regmap_lookup_by_phandle_args

Use syscon_regmap_lookup_by_phandle_args() which is a wrapper over
syscon_regmap_lookup_by_phandle() combined with getting the syscon
argument.  Except simpler code this annotates within one line that given
phandle has arguments, so grepping for code would be easier.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: omap3isp: Handle ARM dma_iommu_mapping
Robin Murphy [Mon, 28 Oct 2024 17:58:36 +0000 (17:58 +0000)] 
media: omap3isp: Handle ARM dma_iommu_mapping

It's no longer practical for the OMAP IOMMU driver to trick
arm_setup_iommu_dma_ops() into ignoring its presence, so let's use the
same tactic as other IOMMU API users on 32-bit ARM and explicitly kick
the arch code's dma_iommu_mapping out of the way to avoid problems.

Fixes: 4720287c7bf7 ("iommu: Remove struct iommu_ops *iommu from arch_setup_dma_ops()")
Cc: stable@vger.kernel.org
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Sicelo A. Mhlongo <absicsz@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: intel/ipu6: set the dev_parent of video device to pdev
Bingbu Cao [Fri, 14 Feb 2025 10:52:38 +0000 (18:52 +0800)] 
media: intel/ipu6: set the dev_parent of video device to pdev

The bus_info in v4l2_capability of IPU6 isys v4l2_dev is missing.
The driver didn't set the dev_parent of v4l2_dev, its parent is set
to its parent auxdev which is neither platform nor PCI device, thus
media_set_bus_info() will not set the bus_info of v4l2_capability, then
`v4l2-ctl --all` cannot show the bus_info.

This patch fixes it by setting the dev_parent of video_device and v4l2
framework can detect the device type and set the bus_info instead.

Fixes: 3c1dfb5a69cf ("media: intel/ipu6: input system video nodes and buffer queues")
Cc: stable@vger.kernel.org
Signed-off-by: Hidenori Kobayashi <hidenorik@chromium.org>
Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: Drop the uvc_driver structure
Laurent Pinchart [Sun, 23 Feb 2025 15:01:32 +0000 (17:01 +0200)] 
media: uvcvideo: Drop the uvc_driver structure

The uvc_driver structure used to contain more fields, but those got
removed in commit ba2fa99668bb ("[media] uvcvideo: Hardcode the
index/selector relationship for XU controls"). The structure is now just
a wrapper around usb_driver. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: Add quirk for Actions UVC05
Ricardo Ribalda [Tue, 10 Dec 2024 10:48:14 +0000 (10:48 +0000)] 
media: uvcvideo: Add quirk for Actions UVC05

Actions UVC05 is a HDMI to USB dongle that implements the UVC protocol.

When the device suspends, its firmware seems to enter a weird mode when it
does not produce more frames.

Add the device to the quirk list to disable autosuspend.

Bus 001 Device 007: ID 1de1:f105 Actions Microelectronics Co. Display
 capture-UVC05
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 [unknown]
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x1de1 Actions Microelectronics Co.
  idProduct          0xf105 Display capture-UVC05
  bcdDevice            4.09
  iManufacturer           1 Actions Micro
  iProduct                2 Display capture-UVC05
  iSerial                 3 -1005308387
  bNumConfigurations      1

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20241210-uvc-hdmi-suspend-v1-1-01f5dec023ea@chromium.org
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: document UVC v1.5 ROI
Yunke Cao [Mon, 3 Feb 2025 11:55:53 +0000 (11:55 +0000)] 
media: uvcvideo: document UVC v1.5 ROI

Added documentation of V4L2_CID_UVC_REGION_OF_INTEREST_RECT and
V4L2_CID_UVC_REGION_OF_INTEREST_AUTO.

An example of a userspace implementing this feature can be found at:
https://chromium.googlesource.com/chromiumos/platform2/+/refs/heads/release-R121-15699.B/camera/hal/usb/

Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Yunke Cao <yunkec@google.com>
Tested-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-17-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: implement UVC v1.5 ROI
Yunke Cao [Mon, 3 Feb 2025 11:55:52 +0000 (11:55 +0000)] 
media: uvcvideo: implement UVC v1.5 ROI

Implement support for ROI as described in UVC 1.5:
4.2.2.1.20 Digital Region of Interest (ROI) Control

ROI control is implemented using V4L2 control API as
two UVC-specific controls:
V4L2_CID_UVC_REGION_OF_INTEREST_RECT and
V4L2_CID_UVC_REGION_OF_INTEREST_AUTO.

Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Yunke Cao <yunkec@google.com>
Tested-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-16-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[hverkuil: fix control names: "Of" -> "of", "Controls" -> "Ctrls"]

4 months agomedia: uvcvideo: Add sanity check to uvc_ioctl_xu_ctrl_map
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:51 +0000 (11:55 +0000)] 
media: uvcvideo: Add sanity check to uvc_ioctl_xu_ctrl_map

Do not process unknown data types.

Tested-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-15-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: Introduce uvc_mapping_v4l2_size
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:50 +0000 (11:55 +0000)] 
media: uvcvideo: Introduce uvc_mapping_v4l2_size

Centralize the calculation for the v4l2_size of a mapping.

Reviewed-by: Yunke Cao <yunkec@google.com>
Tested-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-14-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: let v4l2_query_v4l2_ctrl() work with v4l2_query_ext_ctrl
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:49 +0000 (11:55 +0000)] 
media: uvcvideo: let v4l2_query_v4l2_ctrl() work with v4l2_query_ext_ctrl

v4l2_query_ext_ctrl contains information that is missing in
v4l2_queryctrl, like elem_size and elems.

With this change we can handle all the element_size information inside
uvc_ctrl.c.

Now that we are at it, remove the memset of the reserved fields, the
v4l2 ioctl handler should do that for us.

There is no functional change expected from this change.

Reviewed-by: Yunke Cao <yunkec@google.com>
Tested-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-13-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: support V4L2_CTRL_WHICH_MIN/MAX_VAL
Yunke Cao [Mon, 3 Feb 2025 11:55:48 +0000 (11:55 +0000)] 
media: uvcvideo: support V4L2_CTRL_WHICH_MIN/MAX_VAL

Add support for V4L2_CTRL_WHICH_MIN/MAX_VAL in uvc driver.
It is needed for the V4L2_CID_UVC_REGION_OF_INTEREST_RECT control.

Signed-off-by: Yunke Cao <yunkec@google.com>
Tested-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-12-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: Factor out query_boundaries from query_ctrl
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:47 +0000 (11:55 +0000)] 
media: uvcvideo: Factor out query_boundaries from query_ctrl

Split the function in two parts. queryctrl_boundaries will be used in
future patches.

No functional change expected from this patch.

Reviewed-by: Yunke Cao <yunkec@google.com>
Tested-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-11-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: add support for compound controls
Yunke Cao [Mon, 3 Feb 2025 11:55:46 +0000 (11:55 +0000)] 
media: uvcvideo: add support for compound controls

This patch adds support for compound controls. This is required to
support controls that cannot be represented with a s64 data, such as the
Region of Interest.

Signed-off-by: Yunke Cao <yunkec@google.com>
Tested-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-10-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: Factor out clamping from uvc_ctrl_set
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:45 +0000 (11:55 +0000)] 
media: uvcvideo: Factor out clamping from uvc_ctrl_set

Move the logic to a separated function. Do not expect any change.
This is a preparation for supporting compound controls.

Reviewed-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-9-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: Support any size for mapping get/set
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:44 +0000 (11:55 +0000)] 
media: uvcvideo: Support any size for mapping get/set

Right now, we only support mappings for v4l2 controls with a max size of
s32. This patch modifies the prototype of get/set so it can support any
size.

This is done to prepare for compound controls.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-8-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: uvc_ioctl_(g|s)_ext_ctrls: handle NoP case
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:43 +0000 (11:55 +0000)] 
media: uvcvideo: uvc_ioctl_(g|s)_ext_ctrls: handle NoP case

If nothing needs to be done. Exit early.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-7-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: refactor uvc_ioctl_g_ext_ctrls
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:42 +0000 (11:55 +0000)] 
media: uvcvideo: refactor uvc_ioctl_g_ext_ctrls

We want to support fetching the min and max values with g_ext_ctrls,
this patch is a preparation for that.

Instead of abusing uvc_query_v4l2_ctrl(), add an extra parameter to
uvc_ctrl_get, so it can support fetching the default value.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-6-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: Handle uvc menu translation inside uvc_set_le_value
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:41 +0000 (11:55 +0000)] 
media: uvcvideo: Handle uvc menu translation inside uvc_set_le_value

Be consistent with uvc_get_le_value() and do the menu translation there.

Note that in this case, the refactor does not provide much... but
consistency is a nice feature.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-5-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: uvcvideo: Handle uvc menu translation inside uvc_get_le_value
Ricardo Ribalda [Mon, 3 Feb 2025 11:55:40 +0000 (11:55 +0000)] 
media: uvcvideo: Handle uvc menu translation inside uvc_get_le_value

map->get() gets a value from an uvc_control in "UVC format" and converts
it to a value that can be consumed by v4l2.

Instead of using a special get function for V4L2_CTRL_TYPE_MENU, we
were converting from uvc_get_le_value in two different places.

Move the conversion to uvc_get_le_value().

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-4-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: vivid: Add a rectangle control
Yunke Cao [Mon, 3 Feb 2025 11:55:39 +0000 (11:55 +0000)] 
media: vivid: Add a rectangle control

This control represents a generic read/write rectangle.
It supports V4L2_CTRL_WHICH_MIN/MAX_VAL.

Signed-off-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-3-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: v4l2-ctrls: add support for V4L2_CTRL_WHICH_MIN/MAX_VAL
Hans Verkuil [Mon, 3 Feb 2025 11:55:38 +0000 (11:55 +0000)] 
media: v4l2-ctrls: add support for V4L2_CTRL_WHICH_MIN/MAX_VAL

Add the capability of retrieving the min and max values of a
compound control.

[Ricardo: Added static to v4l2_ctrl_type_op_(maximum|minimum) proto]
[Ricardo: Fix documentation]

Signed-off-by: Yunke Cao <yunkec@google.com>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-2-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[hverkuil: fix small alignment checkpatch warning]

4 months agomedia: v4l2_ctrl: Add V4L2_CTRL_TYPE_RECT
Yunke Cao [Mon, 3 Feb 2025 11:55:37 +0000 (11:55 +0000)] 
media: v4l2_ctrl: Add V4L2_CTRL_TYPE_RECT

Add p_rect to struct v4l2_ext_control with basic support in
v4l2-ctrls.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-1-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: venus: hfi: add a check to handle OOB in sfr region
Vikash Garodia [Thu, 20 Feb 2025 17:20:11 +0000 (22:50 +0530)] 
media: venus: hfi: add a check to handle OOB in sfr region

sfr->buf_size is in shared memory and can be modified by malicious user.
OOB write is possible when the size is made higher than actual sfr data
buffer. Cap the size to allocated size for such cases.

Cc: stable@vger.kernel.org
Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: venus: hfi: add check to handle incorrect queue size
Vikash Garodia [Thu, 20 Feb 2025 17:20:10 +0000 (22:50 +0530)] 
media: venus: hfi: add check to handle incorrect queue size

qsize represents size of shared queued between driver and video
firmware. Firmware can modify this value to an invalid large value. In
such situation, empty_space will be bigger than the space actually
available. Since new_wr_idx is not checked, so the following code will
result in an OOB write.
...
qsize = qhdr->q_size

if (wr_idx >= rd_idx)
 empty_space = qsize - (wr_idx - rd_idx)
....
if (new_wr_idx < qsize) {
 memcpy(wr_ptr, packet, dwords << 2) --> OOB write

Add check to ensure qsize is within the allocated size while
reading and writing packets into the queue.

Cc: stable@vger.kernel.org
Fixes: d96d3f30c0f2 ("[media] media: venus: hfi: add Venus HFI files")
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: venus: hfi_parser: refactor hfi packet parsing logic
Vikash Garodia [Thu, 20 Feb 2025 17:20:09 +0000 (22:50 +0530)] 
media: venus: hfi_parser: refactor hfi packet parsing logic

words_count denotes the number of words in total payload, while data
points to payload of various property within it. When words_count
reaches last word, data can access memory beyond the total payload. This
can lead to OOB access. With this patch, the utility api for handling
individual properties now returns the size of data consumed. Accordingly
remaining bytes are calculated before parsing the payload, thereby
eliminates the OOB access possibilities.

Cc: stable@vger.kernel.org
Fixes: 1a73374a04e5 ("media: venus: hfi_parser: add common capability parser")
Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: venus: hfi_parser: add check to avoid out of bound access
Vikash Garodia [Thu, 20 Feb 2025 17:20:08 +0000 (22:50 +0530)] 
media: venus: hfi_parser: add check to avoid out of bound access

There is a possibility that init_codecs is invoked multiple times during
manipulated payload from video firmware. In such case, if codecs_count
can get incremented to value more than MAX_CODEC_NUM, there can be OOB
access. Reset the count so that it always starts from beginning.

Cc: stable@vger.kernel.org
Fixes: 1a73374a04e5 ("media: venus: hfi_parser: add common capability parser")
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
4 months agomedia: visl: Fix ERANGE error when setting enum controls
Nicolas Dufresne [Tue, 10 Dec 2024 21:02:53 +0000 (16:02 -0500)] 
media: visl: Fix ERANGE error when setting enum controls

The visl driver supports both frame and slice mode, with and without a
start-code. But, the range and default for these enum controls was not
set, which currently limits the decoder to enums with a value of 0. Fix
this by setting the decoder mode and start code controls for both the
H.264 and HEVC codecs.

Fixes: 0c078e310b6d ("media: visl: add virtual stateless decoder driver")
Cc: stable@vger.kernel.org
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>