summaryrefslogtreecommitdiff
path: root/drivers/media
AgeCommit message (Collapse)Author
2025-06-20media: amphion: Add H264 and HEVC profile and level controlMing Qian
For format H264 and HEVC, the firmware can report the parsed profile idc and level idc to driver, these information may be useful. Implement the H264 and HEVC profile and level control to report them. Signed-off-by: Ming Qian <ming.qian@oss.nxp.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: imx8mq-mipi-csi2: Add support for i.MX8QXPFrank Li
Add support for i.MX8QXP, which has a dedicated control and status register (CSR) space. Enable obtaining the second register space and initializing PHY and link settings accordingly. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://lore.kernel.org/r/20250522-8qxp_camera-v5-10-d4be869fdb7e@nxp.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: imx8mq-mipi-csi2: Add imx8mq_plat_data for different compatible stringsGuoniu.zhou
Introduce `imx8mq_plat_data` along with enable/disable callback operations to facilitate support for new chips. No functional changes. Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://lore.kernel.org/r/20250522-8qxp_camera-v5-9-d4be869fdb7e@nxp.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: imx8-isi: Add support for i.MX8QM and i.MX8QXPRobert Chiras
Add compatibles and platform data for i.MX8QM and i.MX8QXP platforms. i.MX8QM's IER register layout is difference with i.MX8QXP. Signed-off-by: Robert Chiras <robert.chiras@nxp.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://lore.kernel.org/r/20250522-8qxp_camera-v5-7-d4be869fdb7e@nxp.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: nxp: imx8-isi: Use dev_err_probe() to simplify codeFrank Li
Use dev_err_probe() simplify code. No functional changes intended. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://lore.kernel.org/r/20250522-8qxp_camera-v5-6-d4be869fdb7e@nxp.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: nxp: imx8-isi: Remove redundant check for dma_set_mask_and_coherent()Frank Li
dma_set_mask_and_coherent() never return failure when mask bigger than 32bit. See commit f7ae20f2fc4e ("docs: dma: correct dma_set_mask() sample code") So remove return value check for dma_set_mask_and_coherent(). Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://lore.kernel.org/r/20250522-8qxp_camera-v5-5-d4be869fdb7e@nxp.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: nxp: imx8-isi: Use devm_clk_bulk_get_all() to fetch clocksFrank Li
Use devm_clk_bulk_get_all() helper to simplify clock handle code. No functional changes intended. Signed-off-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: https://lore.kernel.org/r/20250522-8qxp_camera-v5-4-d4be869fdb7e@nxp.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: nxp: imx8-isi: Remove unused offset in mxc_isi_reg and use BIT() ↵Frank Li
macro for mask Preserve clarity by removing the unused 'offset' field in struct mxc_isi_reg, as it duplicates information already indicated by the mask and remains unused. Improve readability by replacing hex value masks with the BIT() macro. No functional change. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://lore.kernel.org/r/20250522-8qxp_camera-v5-3-d4be869fdb7e@nxp.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: nxp: imx8-isi: Allow num_sources to be greater than num_sinkFrank Li
Allow num_sources (drvdata: num_channels) to be greater than num_sink (drvdata: num_ports + 1). ISI support stream multiplexing, such as differentiates multiple cameras from a single 2-lane MIPI input, or duplicates input stream into multiple outputs. So num_channels may be greater than num_ports at some platform. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://lore.kernel.org/r/20250522-8qxp_camera-v5-2-d4be869fdb7e@nxp.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: imx-mipi-csis: Use CSI-2 data type macros from mipi-csi2.hLaurent Pinchart
The imx-mipi-csis defines custom macros for the CSI-2 data types, duplicating the centralized macros defines in mipi-csi2.h. Replace them with the latter. Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://lore.kernel.org/r/20250606090533.10711-1-laurent.pinchart@ideasonboard.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: rockchip: rkisp1: Add support for Wide Dynamic RangeJai Luthra
RKISP supports a basic Wide Dynamic Range (WDR) module since the first iteration (v1.0) of the ISP. Add support for enabling and configuring it using extensible parameters. Also, to ease programming, switch to using macro variables for defining the tonemapping curve register addresses. Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Tested-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> Link: https://lore.kernel.org/r/20250610-wdr-latest-v4-1-b69d0ac17ce9@ideasonboard.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: rkisp1: Add RKISP1_CID_SUPPORTED_PARAMS_BLOCKS controlStefan Klug
Add a RKISP1_CID_SUPPORTED_PARAMS_BLOCKS V4L2 control to be able to query the parameters blocks supported by the current kernel on the current hardware from user space. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: https://lore.kernel.org/r/20250523-supported-params-and-wdr-v3-2-7283b8536694@ideasonboard.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: rkisp1: Properly handle result of rkisp1_params_init_vb2_queue()Stefan Klug
Properly handle the return of rkisp1_params_init_vb2_queue(). It is very unlikely that this ever fails without code changes but should be handled anyways. While at it rename the error label for easier extension in the upcoming patch. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: https://lore.kernel.org/r/20250523-supported-params-and-wdr-v3-1-7283b8536694@ideasonboard.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: nxp: imx8-isi: Simplify a couple of error messagesKrzysztof Hałasa
The error messages in the mxc_isi_crossbar_enable_streams() and mxc_isi_crossbar_disable_streams() functions are similar, with a single word difference between them. The word is moved out of the format string to a separate dev_err() argument to try and save memory through string de-duplication. The total savings are however small, as the .data size reduction is partly offset by a .text size increase, with a total saving of 8 bytes in total on an ARM64 platforms. They also come at the cost of making the error message difficult to grep, which outweights the gains. Simplify the error messages to make them grep-able. Signed-off-by: Krzysztof Hałasa <khalasa@piap.pl> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: https://lore.kernel.org/r/m3plgi9pwu.fsf@t19.piap.pl Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: vsp1: Add VSPX supportJacopo Mondi
Add support for VSPX, a specialized version of the VSP2 that transfers data to the ISP. The VSPX is composed of two RPF units to read data from external memory and an IIF instance that performs transfer towards the ISP. The VSPX is supported through a newly introduced vsp1_vspx.c file that exposes two interfaces: vsp1_vspx interface, declared in vsp1_vspx.h for the vsp1 core to initialize and cleanup the VSPX, and a vsp1_isp interface, declared in include/media/vsp1.h for the ISP driver to control the VSPX operations. Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com> Link: https://lore.kernel.org/r/20250617-b4-vspx-v13-1-9f4054c1c9af@ideasonboard.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: vsp1: vsp1_dl: Count display listsJacopo Mondi
To detect leaks of display lists, store in the display list manager the number of allocated display lists when the manager is created and verify that when the display manager is reset the same number of lists is available in the free list. Signed-off-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Link: https://lore.kernel.org/r/20250616-vsp1_dl_list_count-v2-2-7d3f43fb1306@ideasonboard.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: vsp1: vsp1_dl: Detect double list releaseJacopo Mondi
In order to detect invalid usage pattern such as double list_put() calls, add an 'allocated' flag to each display list. Set the flag whenever a list is get() and clear it when the list is put(). Warn if a list not marked as allocated is returned to the pool of available display lists. Signed-off-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Link: https://lore.kernel.org/r/20250616-vsp1_dl_list_count-v2-1-7d3f43fb1306@ideasonboard.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: vsp1: Reset FCP after VSPDKoji Matsuoka
According to the R-Car Gen3 H/W manual v2.40, and R-Car Gen4 H/W manual v1.20, the FCP must be reset after resetting the VSPD, except for the VSPDL. Do so. Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com> Signed-off-by: LUU HOAI <hoai.luu.ub@renesas.com> Signed-off-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Link: https://lore.kernel.org/r/20250616-vspx-reset-v2-2-6cc12ed7e9bb@ideasonboard.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: rcar-fcp: Add rcar_fcp_soft_reset()Jacopo Mondi
Add a function to perform soft reset of the FCP. It is intended to support the correct stop procedure of the VSPX-FCPVX and VSPD-FCPD pairs according to section "62.3.7.3 Reset Operation" of the R-Car Hardware Manual at revision 1.20. Signed-off-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Link: https://lore.kernel.org/r/20250616-vspx-reset-v2-1-6cc12ed7e9bb@ideasonboard.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: rcar-vin: Generate FRAME_SYNC eventsNiklas Söderlund
Enable the VSYNC Rising Edge Detection interrupt and generate a FRAME_SYNC event form it. The interrupt is available on all supported models of the VIN (Gen2, Gen3 and Gen4). Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Link: https://lore.kernel.org/r/20250616185722.980722-4-niklas.soderlund+renesas@ragnatech.se Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: rcar-vin: Check for correct capture interrupt eventNiklas Söderlund
Depending on if the capture session deals with fields or whole frames interrupts can be generated at an end of field, or end of frame event. The interrupt mask is setup to generate an interrupt on one of the two events depending on what is needed when the VIN is started. The end of field bit is set in both cases so controlling the mask that generates an interrupt have been enough to control the two use-cases. Before extending the interrupt handler to deal with other types of interrupt events it is needs to extended to "capture complete" check for correct the use-case in operation. Without this the simplification in the handler can result in corrupted frames when the mask on what type of events can generate an interrupt generated can no longer be assumed to only be an "capture complete" event. Which bit is checked matches which bit is enabled at configuration time as which event can generate an interrupt for "capture complete". There is no functional change. While at it switch to use the BIT() macro to describe the bit positions for the interrupt functions. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Link: https://lore.kernel.org/r/20250616185722.980722-3-niklas.soderlund+renesas@ragnatech.se Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-18media: rcar-vin: Fold interrupt helpers into only callersNiklas Söderlund
The call sites using the interrupt helper functions have all been reworked to only one for each. Fold each of them into the only call sites left. This fixes a possible interrupt loss in case an interrupt occurs between reading VNINTS_REG in rvin_get_interrupt_status() and reading it again in rvin_ack_interrupt(). While at it rename the variable holding the current interrupt status to make the code easier to read. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Link: https://lore.kernel.org/r/20250616185722.980722-2-niklas.soderlund+renesas@ragnatech.se Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: saa7115: Replace open-coded parity calculation with parity8()Kuan-Wei Chiu
Refactor parity calculations to use the standard parity8() helper. This change eliminates redundant implementations. Co-developed-by: Yu-Chun Lin <eleanor15x@gmail.com> Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com> Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com> Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: pci: cx18-av-vbi: Replace open-coded parity calculation with parity8()Kuan-Wei Chiu
Refactor parity calculations to use the standard parity8() helper. This change eliminates redundant implementations. Co-developed-by: Yu-Chun Lin <eleanor15x@gmail.com> Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com> Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com> Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: media/test_drivers: Replace open-coded parity calculation with parity8()Kuan-Wei Chiu
Refactor parity calculations to use the standard parity8() helper. This change eliminates redundant implementations. Co-developed-by: Yu-Chun Lin <eleanor15x@gmail.com> Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com> Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com> Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: raspberrypi: cfe: Fix min_reqbufs_allocationTomi Valkeinen
The driver checks if "vq->max_num_buffers + *nbuffers < 3", but vq->max_num_buffers is (by default) 32, so the check is never true. Nor does the check make sense. The original code in the BSP kernel was "vq->num_buffers + *nbuffers < 3", but got mangled along the way to upstream. The intention was to make sure that at least 3 buffers are allocated. Fix this by removing the bad lines and setting q->min_reqbufs_allocation to three. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: xilinx-vipp: Use for_each_child_of_node_scoped()Jinjie Ruan
Avoids the need for manual cleanup of_node_put() in early exits from the loop. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: c8sectpfe: Use for_each_child_of_node_scoped()Jinjie Ruan
Avoids the need for manual cleanup of_node_put() in early exits from the loop. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: samsung: exynos4-is: Use for_each_available_child_of_node_scoped()Jinjie Ruan
Avoids the need for manual cleanup of_node_put() in early exits from the loop. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: tc358743: Return an appropriate colorspace from tc358743_set_fmtDave Stevenson
When calling tc358743_set_fmt, the code was calling tc358743_get_fmt to choose a valid format. However that sets the colorspace based on information read back from the chip, not the colour format requested. The result was that if you called try or set format for UYVY when the current format was RGB3 then you would get told SRGB, and try RGB3 when current was UYVY and you would get told SMPTE170M. The value programmed in the VI_REP register for the colorspace is always set by this driver, therefore there is no need to read back the value, and never set to REC709. Return the colorspace based on the format set/tried instead. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: tc358743: Check I2C succeeded during probeDave Stevenson
The probe for the TC358743 reads the CHIPID register from the device and compares it to the expected value of 0. If the I2C request fails then that also returns 0, so the driver loads thinking that the device is there. Generally I2C communications are reliable so there is limited need to check the return value on every transfer, therefore only amend the one read during probe to check for I2C errors. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: tc358743: Increase FIFO trigger level to 374Dave Stevenson
The existing fixed value of 16 worked for UYVY 720P60 over 2 lanes at 594MHz, or UYVY 1080P60 over 4 lanes. (RGB888 1080P60 needs 6 lanes at 594MHz). It doesn't allow for lower resolutions to work as the FIFO underflows. 374 is required for 1080P24 or 1080P30 UYVY over 2 lanes @ 972Mbit/s, but >374 means that the FIFO underflows on 1080P50 UYVY over 2 lanes @ 972Mbit/s. Whilst it would be nice to compute it, the required information isn't published by Toshiba. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: tc358743: Add support for 972Mbit/s link freqDave Stevenson
Adds register setups for running the CSI lanes at 972Mbit/s, which allows 1080P50 UYVY down 2 lanes. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17sysfs: treewide: switch back to bin_attribute::read()/write()Thomas Weißschuh
The bin_attribute argument of bin_attribute::read() is now const. This makes the _new() callbacks unnecessary. Switch all users back. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20250530-sysfs-const-bin_attr-final-v3-3-724bfcf05b99@weissschuh.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-06-17media: v4l2-jpeg: Remove unused v4l2_jpeg_parse_* wrappersDr. David Alan Gilbert
The functions: v4l2_jpeg_parse_huffman_tables() v4l2_jpeg_parse_quantization_tables() v4l2_jpeg_parse_scan_header() and v4l2_jpeg_parse_frame_header() were added in 2020 by commit 50733b5b9102 ("media: add v4l2 JPEG helpers") but have remained unused. Remove them. They're all just wrappers around an underlying set of helpers, which are all still called via v4l2_jpeg_parse_header(). Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: platform: ti: Remove unused vpdma_update_dma_addrDr. David Alan Gilbert
vpdma_update_dma_addr() was added in 2016 as part of commit 2f88703a0bfd ("[media] media: ti-vpe: vpdma: Add multi-instance and multi-client support") but has remained unused. Remove it. I did see that there was a VIP driver submitted in 2020 that doesn't seem to have got merged which did use this (and a bunch of other unused functions). Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: amphion: Remove unused functionsDr. David Alan Gilbert
The functions: vpu_color_get_default() vpu_color_check_full_range() vpu_color_check_primaries() vpu_color_check_transfers() vpu_color_check_matrix() have been unused since 2022's commit 1925665ef403 ("media: amphion: remove redundant check of colorspace in venc_s_fmt") The (empty) function vpu_mbox_enable_rx() has been unused since it was added in 2022 by the commit 61cbf1c1fa6d ("media: amphion: implement vpu core communication based on mailbox") Remove them. Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: exynos4-is: fimc-is: Fully open-code compatible for greppingKrzysztof Kozlowski
It is very useful to find driver implementing compatibles with `git grep compatible`, so driver should not use defines for that string, even if this means string will be effectively duplicated. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: rainshadow-cec: fix TOCTOU race condition in rain_interrupt()Gui-Dong Han
In the interrupt handler rain_interrupt(), the buffer full check on rain->buf_len is performed before acquiring rain->buf_lock. This creates a Time-of-Check to Time-of-Use (TOCTOU) race condition, as rain->buf_len is concurrently accessed and modified in the work handler rain_irq_work_handler() under the same lock. Multiple interrupt invocations can race, with each reading buf_len before it becomes full and then proceeding. This can lead to both interrupts attempting to write to the buffer, incrementing buf_len beyond its capacity (DATA_SIZE) and causing a buffer overflow. Fix this bug by moving the spin_lock() to before the buffer full check. This ensures that the check and the subsequent buffer modification are performed atomically, preventing the race condition. An corresponding spin_unlock() is added to the overflow path to correctly release the lock. This possible bug was found by an experimental static analysis tool developed by our team. Fixes: 0f314f6c2e77 ("[media] rainshadow-cec: new RainShadow Tech HDMI CEC driver") Cc: stable@vger.kernel.org Signed-off-by: Gui-Dong Han <hanguidong02@gmail.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: mgb4: Enumerate only the available timingsMartin Tůma
Enumerate only the available (as given by the sysfs setup - our "EDID replacement") timings, not all theoretically possible. This is the video outputs part of the previous inputs patch that somehow got "lost in translation". Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: gspca: Add bounds checking to firmware parserDan Carpenter
This sd_init() function reads the firmware. The firmware data holds a series of records and the function reads each record and sends the data to the device. The request_ihex_firmware() function calls ihex_validate_fw() which ensures that the total length of all the records won't read out of bounds of the fw->data[]. However, a potential issue is if there is a single very large record (larger than PAGE_SIZE) and that would result in memory corruption. Generally we trust the firmware, but it's always better to double check. Fixes: 49b61ec9b5af ("[media] gspca: Add new vicam subdriver") Cc: stable@vger.kernel.org Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: cx18: Replace custom implementation of list_entry_is_head()Andy Shevchenko
Besides list_entry_is_past_end() is the same as list_entry_is_head(), it's implemented in the list namespace. Fix both of the issue by replacing the custom version with list_entry_is_head() calls. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: usb: hdpvr: use I2C core to handle only supported messagesWolfram Sang
The HW can only do write-then-read transactions. This is a common limitation, so we can add an adapter quirk flag to let the I2C core enforce the checks instead of open coding them. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: usb: hdpvr: disable zero-length read messagesWolfram Sang
This driver passes the length of an i2c_msg directly to usb_control_msg(). If the message is now a read and of length 0, it violates the USB protocol and a warning will be printed. Enable the I2C_AQ_NO_ZERO_LEN_READ quirk for this adapter thus forbidding 0-length read messages altogether. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: saa7164: Remove unused functionsDr. David Alan Gilbert
saa7164_cmd_signal() last use was removed in 2009 by commit 39e469ab6dee ("V4L/DVB (12940): SAA7164: IRQ / message timeout related change") saa7164_buffer_display() was added in 2010 by commit add3f580a434 ("[media] saa7164: convert buffering structs to be more generic") but is unused. Remove them. Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: usbtv: Lock resolution while streamingLudwig Disterhof
When an program is streaming (ffplay) and another program (qv4l2) changes the TV standard from NTSC to PAL, the kernel crashes due to trying to copy to unmapped memory. Changing from NTSC to PAL increases the resolution in the usbtv struct, but the video plane buffer isn't adjusted, so it overflows. Fixes: 0e0fe3958fdd13d ("[media] usbtv: Add support for PAL video source") Cc: stable@vger.kernel.org Signed-off-by: Ludwig Disterhof <ludwig@disterhof.eu> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> [hverkuil: call vb2_is_busy instead of vb2_is_streaming]
2025-06-17media: flexcop-i2c: Constify struct i2c_algorithmChristophe JAILLET
'struct i2c_algorithm' is not modified in this driver. Constifying this structure moves some data to a read-only section, so increase overall security, especially when the structure holds some function pointers. On a x86_64, with allmodconfig, as an example: Before: ====== text data bss dec hex filename 6645 216 16 6877 1add drivers/media/common/b2c2/flexcop-i2c.o After: ===== text data bss dec hex filename 6721 160 16 6897 1af1 drivers/media/common/b2c2/flexcop-i2c.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: v4l2-core: Replace the check for firmware registered I2C devicesAndy Shevchenko
Replace the check for firmware registered I²C devices as the firmware node independently on type should be retrieved via dev_fwnode(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: i2c: max9286: use new GPIO line value setter callbacksBartosz Golaszewski
struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-06-17media: i2c: max96717: use new GPIO line value setter callbacksBartosz Golaszewski
struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>