summaryrefslogtreecommitdiff
path: root/drivers/media/platform
AgeCommit message (Collapse)Author
6 hoursMerge branch 'headers' of git://git.infradead.org/users/willy/pagecache.gitMark Brown
# Conflicts: # net/ceph/osd_client.c
10 hoursMerge branch 'next' of git://linuxtv.org/media-ci/media-pending.gitMark Brown
4 daysmedia: cadence: csi2rx: Support RAW12 bayer formatsJai Luthra
Add support for RAW12 bayer formats in the cadence csi2rx driver. Signed-off-by: Jai Luthra <j-luthra@ti.com> Signed-off-by: Yemike Abhilash Chandra <y-abhilashchandra@ti.com> Reviewed-by: Rishikesh Donadkar <r-donadkar@ti.com> Reviewed-by: Jai Luthra <jai.luthra@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
4 daysmedia: ti: j721e-csi2rx: Support RAW12 bayer formatsJai Luthra
Add support for RAW12 bayer formats in the j721e-csi2rx driver. Signed-off-by: Jai Luthra <j-luthra@ti.com> Signed-off-by: Yemike Abhilash Chandra <y-abhilashchandra@ti.com> Reviewed-by: Rishikesh Donadkar <r-donadkar@ti.com> Reviewed-by: Jai Luthra <jai.luthra@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
4 daysMerge tag 'media/v7.3-2' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media Pull media fixes from Mauro Carvalho Chehab: "Core: - add bounded tile-count helpers for HEVC stateless decoders - validate AV1 tile counts fits in array size - validate HEVC tile counts fits in array size - fix memcmp() size in B1 reference list comparison mediatek: - bound AV1 tile-start copy to fit in array size rockchip: - reject AV1 frames exceeding the tile size - guard VPU981 AV1 divisor and tile buffer hantro and rkvdec: - bound G2 HEVC tile loops and PPS id to the buffer size rppx1: - read the raw pattern from the PRE2 acquisition module - describe the MAIN_POST white balance gains block" * tag 'media/v7.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: media: mediatek: vcodec: bound AV1 tile-start copy to the array capacity media: verisilicon: rockchip: reject AV1 frames exceeding the tile capacity media: verisilicon: rockchip: guard VPU981 AV1 divisor and tile buffer media: verisilicon: hantro: bound G2 HEVC tile loop to the buffer capacity media: rkvdec: bound HEVC tile loops and PPS id to the array capacity media: hevc: add bounded tile-count helpers media: v4l2-ctrls: validate AV1 tile counts media: v4l2-ctrls: validate HEVC tile counts media: v4l2-h264: Fix memcmp() size in B1 reference list comparison media: rppx1: bls: read the raw pattern from the PRE2 acquisition module media: rppx1: describe the MAIN_POST white balance gains block
5 daysmedia: synopsys: hdmirx: Remove redundant dev_err_probe()Amin Gattout
The devm_request_threaded_irq() function now automatically logs detailed error messages on failure. This eliminates the need for driver-specific dev_err_probe() calls that print generic messages. Signed-off-by: Amin Gattout <amin.gattout@gmail.com> Reviewed-by: Igor Paunovic <royalnet026@gmail.com> Acked-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
5 daysmedia: fix repeated words in commentsHemanth Selam
Drop words accidentally written twice, reported by checkpatch.pl as a possible repeated word. Only touches comments, no code changes. Assisted-by: Cursor:claude-opus-5 Signed-off-by: Hemanth Selam <hemanth.selam@gmail.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
5 daysmedia: fix typos in commentsHemanth Selam
Fix typos in comments, reported by scripts/checkpatch.pl using the misspelling list in scripts/spelling.txt. Only touches comments, no code changes. Assisted-by: Cursor:claude-opus-5 Signed-off-by: Hemanth Selam <hemanth.selam@gmail.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
5 daysmedia: nuvoton: npcm-video: Use devm_of_reserved_mem_device_init()Mukesh Ojha
Switch to devm_of_reserved_mem_device_init() so the reserved memory region is released automatically on probe failure or device removal. Remove the four explicit of_reserved_mem_device_release() calls and collapse the now-empty err_release_mem label into err_free. Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
5 daysmedia: aspeed: Use devm_of_reserved_mem_device_init()Mukesh Ojha
Switch to devm_of_reserved_mem_device_init() so the reserved memory region is released automatically on probe failure or device removal. Remove the three explicit of_reserved_mem_device_release() calls and rename the error label from err_release_reserved_mem to err_unprepare_vclk to reflect that it now only unwinds clock state. Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
5 daysmedia: synopsys: hdmirx: Use devm_of_reserved_mem_device_init()Mukesh Ojha
Replace the hand-rolled devm_hdmirx_of_reserved_mem_device_release() devres action with devm_of_reserved_mem_device_init(), which handles the cleanup automatically. This removes both the wrapper function and the devm_add_action_or_reset() call. Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
6 daysmedia: ti: cal: Deprecate non-MC API usageLaurent Pinchart
The MC API was introduced in the CAL driver more than five years ago in commit 38e89e790fe2 ("media: ti-vpe: cal: Implement media controller centric API") as a disabled by default option. Five years later, it's time to give users another nudge to move to the MC API. Deprecate non-MC API usage by printing a warning at probe time, and defaulting to the MC API. The legacy API can still be selected through the mc_api module parameter. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Yemike Abhilash Chandra <y-abhilashchandra@ti.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
6 daysmedia: synopsys: hdmirx: add HDMI audio capture supportIgor Paunovic
The Synopsys DesignWare HDMI RX controller extracts the audio stream embedded in the incoming HDMI signal and feeds it to an on-SoC I2S controller. Expose it as an ALSA capture device by registering the generic hdmi-codec as a child of the controller, so that a simple-audio-card in the device tree can bind the HDMI RX audio DAI. The sample rate is recovered from the ACR N/CTS values together with the measured TMDS character rate. A periodic worker keeps the local audio reference clock locked to the source by nudging it in small ppm steps to hold the audio FIFO fill level near its target, which avoids FIFO under/overflow and the resulting dropped samples. Across system suspend the worker is stopped before the controller clocks are gated. Resume fully resets the controller, wiping the audio configuration, so when a capture stream is active it re-programs the audio path from the last known sample rate and re-arms the worker, whose rate change and FIFO error paths resynchronize once the source delivers audio again. Signed-off-by: Igor Paunovic <royalnet026@gmail.com> Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
6 daysmedia: nuvoton: npcm-video: quiesce VCD IRQ before teardownFan Wu
The VCD IRQ is devm-requested, but npcm_video_remove() frees the video object before devres releases that IRQ. The threaded handler dereferences video->vcd_regmap before checking VIDEO_STREAMING, so an interrupt in that interval can access freed memory. Request the IRQ with IRQF_NO_AUTOEN. Enable it after starting capture and setting VIDEO_STREAMING, and disable it first in stop_streaming(). disable_irq() waits for an in-flight threaded handler to finish, after which stop_streaming() can mask and reset the VCD without a handler re-enabling it. Use vb2_video_unregister_device() during remove. It releases the vb2 queue and calls stop_streaming() for an active stream, ensuring that the IRQ is disabled before the video object is freed. Do not release the queue separately. If streaming is never started, IRQF_NO_AUTOEN keeps the IRQ disabled until devres releases it. This issue was found by an in-house static analysis tool. Fixes: 46c15a4ff1f4 ("media: nuvoton: Add driver for NPCM video capture and encoding engine") Cc: stable@kernel.org Assisted-by: Codex:gpt-5.6 Signed-off-by: Fan Wu <fanwu01@zju.edu.cn> Tested-by: Marvin Lin <kflin@nuvoton.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
6 daysmedia: synopsys: hdmirx: use request_any_context_irq() for 5V detection IRQAlexander Shiyan
Replace devm_request_irq() with devm_request_any_context_irq() for the 5V detection interrupt handler. This allows the kernel to choose the appropriate execution context (hardirq or threaded) depending on the underlying interrupt controller. On some platforms, the interrupt may be nested or require a threaded handler, and using the fixed hardirq version can cause probe failures. Switching to the more flexible function improves driver portability without affecting functionality. Fixes: 7b59b132ad43 ("media: platform: synopsys: Add support for HDMI input driver") Cc: stable@kernel.org Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com> Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: microchip-csi2dc: fix async notifier leak on probe error pathCong Nguyen
csi2dc_of_parse() ends up calling csi2dc_prepare_notifier(), which registers the V4L2 async notifier with v4l2_async_nf_register(). The probe error label csi2dc_probe_cleanup_notifier is reached after csi2dc_of_parse() has already succeeded (e.g. when media entity init, csi2dc_power() or v4l2_async_register_subdev() fail), but it calls only v4l2_async_nf_cleanup() and never v4l2_async_nf_unregister(). The notifier therefore stays chained in the global notifier_list while the enclosing struct csi2dc_device is freed, leading to list corruption and a use-after-free when the list is next walked. Unregister the notifier before cleaning it up on the error path, matching the teardown already done in csi2dc_remove(). Fixes: 2de0b3c0f678 ("media: atmel: introduce microchip csi2dc driver") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4 Signed-off-by: Cong Nguyen <congnt264@gmail.com> Reviewed-by: Eugen Hristev <ehristev@kernel.org> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: stm32: csi: unregister async notifier on cleanupMyeonghun Pak
stm32_csi_parse_dt() registers the async notifier before probe finishes. If a later operation fails, the error path only cleans up the notifier's connections. It does not unregister the notifier, leaving its entry on the global notifier list after the devm-allocated csidev is freed. The remove path has the same problem. A later async operation can then walk the stale notifier entry and access freed memory. Unregister the notifier before cleaning up its resources on both paths. Fixes: dcb0f4c16be5 ("media: stm32: csi: addition of the STM32 CSI driver") Cc: stable@vger.kernel.org Co-developed-by: Ijae Kim <ae878000@gmail.com> Signed-off-by: Ijae Kim <ae878000@gmail.com> Signed-off-by: Myeonghun Pak <mhun512@gmail.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: stm32: csi: correct remote pad retrievalAlain Volmat
The function media_entity_get_fwnode_pad is called in order to retrieve the remote pad, which is the source of the CSI. However this function is expecting the sensor endpoint fwnode and not sensor device fwnode as it is currently given. Correct this by properly relying on the notified matched fwnode data instead of the subdev entity fwnode. Cc: stable@kernel.org Fixes: dcb0f4c16be5 ("media: stm32: csi: addition of the STM32 CSI driver") Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: microchip-isc: don't sleep in the clk .is_enabled callbackBalakrishnan Sambath
isc_clk_is_enabled() calls pm_runtime_resume_and_get() and pm_runtime_put_sync(), which can sleep and are not safe here, as .is_enabled must run in atomic context. clk_disable_unused() calls it so at boot, and CONFIG_DEBUG_ATOMIC_SLEEP reports a "sleeping function called from invalid context" BUG. Use the atomic-safe pm_runtime_get_if_active() and pm_runtime_put() instead. A suspended ISC has its clocks gated, so report the clock disabled when the device is not already active. Fixes: 01192aa1c5c2 ("media: atmel-isc: Enable the clocks during probe") Cc: stable@vger.kernel.org Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com> Reviewed-by: Eugen Hristev <ehristev@kernel.org> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: microchip-isc: fix WB offset and gain register field maskingBalakrishnan Sambath
ISC_WB_O_* and ISC_WB_G_* each pack two 13-bit fields. A negative offset sign-extends and corrupts the adjacent field. Add masks for the two fields and write them with FIELD_PREP(), which masks each value into its field, so sign extension can no longer bleed across. Fixes: 73c1a577b839 ("media: atmel: atmel-isc: reworked white balance feature") Cc: stable@vger.kernel.org Reviewed-by: Eugen Hristev <ehristev@kernel.org> Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: microchip-isc: fix SBGGR10 Bayer patternBalakrishnan Sambath
SBGGR10 was mapped to ISC_BAY_CFG_RGRG instead of ISC_BAY_CFG_BGBG, causing red/blue channel swap. Fixes: 1e8f401474d6 ("media: atmel: atmel-isc: reworked driver and formats") Cc: stable@vger.kernel.org Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com> Reviewed-by: Eugen Hristev <ehristev@kernel.org> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: microchip-isc: fix PM runtime leak in AWB work handlerBalakrishnan Sambath
Early return when streaming stops skips pm_runtime_put_sync(), leaking the reference and preventing runtime suspend. Fixes: 314c96e5203d ("media: atmel: atmel-isc-base: use mutex to lock awb workq from streaming") Cc: stable@vger.kernel.org Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com> Reviewed-by: Eugen Hristev <ehristev@kernel.org> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: microchip-isc: fix ISC_PFG_CFG0_BPS macro name typoBalakrishnan Sambath
The BPS field macros for ISC_PFE_CFG0 were spelled ISC_PFG_CFG0_BPS_* (NINE, TEN, ELEVEN, TWELVE). The register is PFE, not PFG. Rename them to ISC_PFE_CFG0_BPS_* to match the register and the EIGHT and MASK macros. No functional change. Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com> Reviewed-by: Eugen Hristev <ehristev@kernel.org> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: microchip-isc: store the unshifted PFE_CFG0 BPS valueBalakrishnan Sambath
pfe_cfg0_bps held a pre-shifted BPS value (ISC_PFE_CFG0_BPS_EIGHT was 0x4 << 28) ORed straight into the register. The other format selectors like cfa_baycfg store the bare field value and position it at the write, so this one was inconsistent. Store the bare BPS value and apply it with FIELD_PREP() at the PFE_CFG0 write, and fix the pfe_cfg0_bps comment to match. No functional change. Suggested-by: Eugen Hristev <ehristev@kernel.org> Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com> Reviewed-by: Eugen Hristev <ehristev@kernel.org> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: microchip-isc: do not touch WB registers when not streamingBalakrishnan Sambath
isc_s_awb_ctrl() called isc_update_awb_ctrls() unconditionally, writing the white balance registers even when the device is runtime suspended; on many ARM platforms accessing the unclocked registers is an external abort. The write was also done without awb_lock, racing isc_awb_work(), which holds it so the DMA done IRQ cannot latch a half-updated pipeline. Write the registers only while streaming and not stopping, under awb_lock, and update the profile there. The isc->stop check covers the window where isc_stop_streaming() has gated the clocks but vb2 still reports streaming. Otherwise the new values stay cached and isc_configure() programs them at the next stream start. Fixes: 4e52889f48fe ("media: atmel: atmel-isc-base: expose white balance as v4l2 controls") Cc: stable@vger.kernel.org Reviewed-by: Eugen Hristev <ehristev@kernel.org> Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: microchip-isc: disable histogram and flush AWB work on teardownBalakrishnan Sambath
isc_stop_streaming() and the isc_start_streaming() error path dropped the runtime PM reference with the histogram still enabled. A HISDONE firing just before the stop, or a failed isc_update_profile() on the start path, can queue isc_awb_work(), which reads the histogram registers before taking its own PM reference and faults on the unclocked device. Disable the histogram, synchronize the IRQ and flush the work before the device is left unclocked. isc_configure() is the one enabling the histogram and then calling isc_update_profile(), so do the cleanup in its own failure path; isc_stop_streaming() does the same on teardown. synchronize_irq() must come before cancel_work_sync(), so an in-flight handler cannot re-queue awb_work after it is cancelled. Fixes: 93d4a26c3dab ("[media] atmel-isc: add the isc pipeline function") Cc: stable@vger.kernel.org Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com> Reviewed-by: Eugen Hristev <ehristev@kernel.org> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: microchip-isc: synchronize the IRQ before disabling clocks on stopBalakrishnan Sambath
isc_stop_streaming() masks the DMA interrupt and then drops the runtime PM reference, which disables the ISC clocks. microchip_isc_interrupt() may still be executing on another CPU at that point; it reads ISC_INTSR over regmap, and touching the unclocked registers triggers an external abort. Store the IRQ number at probe and call synchronize_irq() after masking the interrupt, before dropping the PM reference. Fixes: 106267444f12 ("[media] atmel-isc: add the Image Sensor Controller code") Cc: stable@vger.kernel.org Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com> Reviewed-by: Eugen Hristev <ehristev@kernel.org> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: microchip-isc: take a reference on the parsed endpointsBalakrishnan Sambath
for_each_endpoint_of_node() drops the reference on the current node as it advances. xisc_parse_dt() and isc_parse_dt() store the node in subdev_entity->epn and release it later with of_node_put(), but never took their own reference, so the stored pointer refers to an already-released node. This underflows the refcount and can use-after-free, reachable through the camera device tree overlay. Take a reference with of_node_get() when storing the node, and drop it in microchip_isc_subdev_cleanup() so the entities the bind loop never reaches on an early exit do not leak it. Fixes: c9aa973884a1 ("media: atmel: atmel-isc: add microchip-xisc driver") Fixes: d6701f13bd07 ("media: atmel: Use v4l2_async_notifier_add_fwnode_remote_subdev") Cc: stable@vger.kernel.org Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com> Reviewed-by: Eugen Hristev <ehristev@kernel.org> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: microchip-isc: fix awb_mutex and lock lifecycleBalakrishnan Sambath
isc->lock and awb_mutex were initialised in isc_async_complete() and destroyed in isc_async_unbind(), tying their lifetime to the subdev bind/unbind cycle instead of the device: - isc_async_unbind() destroyed awb_mutex before cancel_work_sync(), which takes it; - a failed .complete() left them initialised, and isc->lock was destroyed only on the .complete() error path, so the normal unbind path leaked it; - a rebind runs .complete() again and reinitialises a live mutex. Initialise both with devm_mutex_init() at probe so they live for the whole device lifetime and are freed at remove, and drop the init and destroy from the .complete()/.unbind() callbacks. isc_async_complete_err then only returned ret, so drop the label and return directly at each error site. Fixes: 314c96e5203d ("media: atmel: atmel-isc-base: use mutex to lock awb workq from streaming") Cc: stable@vger.kernel.org Reviewed-by: Eugen Hristev <ehristev@kernel.org> Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: stm32: dcmipp: instantiate & link stm32mp25 subdevsAlain Volmat
Add topology of the two pixel pipes (main & aux) of the stm32mp25. Do not make the link from dcmipp_input immutable and enabled by default since not all pipes are always used together so when a pipeline is not being used its link should be disconnected to allow proper pipeline check. Not doing this would most probably lead to pipeline start failure due to incompatible pads configurations on the unused pipe. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: stm32: dcmipp: rename bytecap into captureAlain Volmat
Since the bytecap video driver is now handling all capture (byte & pixel), rename the file and structs *into capture. This is done by: - renaming of dcmipp-bytecap.c into dcmipp-capture.c - replace of dcmipp_bytecap strings into dcmipp_capture Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: stm32: dcmipp: add pixel-pipe support in bytecapAlain Volmat
The dump pipe and pixel pipes capture part (tail of each pipe) is different in that pixel pipes have a pixel packer capable of generating various output format while the on dump pipe no such manipulation is possible. Still, all the buffer handling, format related manipulations are all same hence both dump and pixel pipe capture part are put together to avoid having large duplication of code. This patch adds the pixel pipe capture within bytecap hence name isn't modified and a further commit should rename the file and probably function name to not only highlight byte capture (aka dump pipe). Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: stm32: dcmipp: pixelproc: addition of dcmipp-pixelproc subdevAlain Volmat
Addition of the driver for dcmipp-pixelproc subdev. This subdev is the last one before the capture device at the tail of both main and aux pipelines. It is in charge of: - framerate adjustment - downscale - gamma correction - color conversion - pixel packing Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: stm32: dcmipp: addition of a dcmipp-isp subdevAlain Volmat
The ISP subdev is the first element after input of the main pipeline. Part (static configuration) of this block is done via this subdev while other configuration done on a per-frame basis will be done via a output metadata device attached to this subdev. This subdev handled the following features of the ISP block: - statistic removal (top / bottom of the frame) - decimation - demosaicing - control of frame export to the aux pipeline Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: stm32: dcmipp: add pixel pipes helper functionsAlain Volmat
Pixel pipes are made of an isp subdev (only main pipe) and a postproc subdev. This commit add a helper functions common to those 2 subdevs such as for handling format enumeration, set_selection handling, so that they do not have to be duplicated in the two subdeves. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: stm32: dcmipp: introduce a dcmipp global media_pipelineAlain Volmat
With the introduction of stm32mp25 containing several capture devices, it becomes necessary to share the media_pipeline structure among all capture devices since subdev pads can be shared between several capture devices. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: stm32: dcmipp: configure csi input of all pipes on stm32mp25Alain Volmat
The STM32MP25 has CSI input and 2 additional pixel pipes in addition to the byte pipe. Each pipe can select which data to receive based on CSI VC/DT selection. The multi-stream support of DCMIPP will be added in a future commit, however, to start putting proper control method, the input subset has now 3 SRC pads, one per pipe available. Currently, and until multi-stream support is added, same data is sent to all pipes. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: stm32: dcmipp: correct swap in YUYV data with parallel inputAlain Volmat
When used with parallel input, the DCMIPP is expecting data to come in YUYV order (for all DUMP/MAIN and AUX pipes). Not doing so will lead to bad color generated by the pipes when processing is done. The DUMP pipe is also doing by default a swap since, while it accepts YUYV data, it will by default generate UYVY data. Current implementation is not correct for parallel input since it is performing a cycle swap on the input side and since the dump pipe is also internally doing a swap, the data captured from the dump pipe are correct, while the data captured from the main / aux pipes are not. To correct this, only perform cycle swap when it is necessary, hence changing from YUYV to UYVY for example, and for all parallel YUV MBUS, add the P0PPCR based SWAPYUV to put back the data into the ordering of the input. Keep previous behavior when the SWAPYUV is not available (such as stm32mp13). Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: stm32: dcmipp: move common structures in dcmipp-common.hAlain Volmat
Move the structure dcmipp_pipeline_config into dcmipp-common.h so that all subdeves can have access to the information of capabilities. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: stm32: dcmipp: bytecap: protect CMIER register accessAlain Volmat
CMIER register is common between all pipes and thus needs to be protected from concurrent access. The struct v4l2_device structure, unique to the whole driver embeds a spin_lock which can also be used by the driver itself as explained in its description. Rely on this spin_lock to protect from concurrent access to the CMIER register. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: stm32: dcmipp: make dcmipp_state & cmsr2 read commonAlain Volmat
In preparation of the introduction of the pixel pipes capture devices, move struct dcmipp_state into common header and perform interrupt status register CMSR2 into the core interrupt handler and share the value with each subdevs. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: stm32: dcmipp: share struct dcmipp_device among subdevsAlain Volmat
In preparation of need for sharing of data between subdevices, make the struct dcmipp_device structure part of dcmipp_common.h and share it with subdevs at init time. This allows for simplifying parameters of each subdev init function as well. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: m2m-deinterlace: fix default capture fieldXu Rao
queue_init() initializes default formats for both the source and capture queues. It first sets the source field to V4L2_FIELD_SEQ_TB, but then stores the capture default, V4L2_FIELD_INTERLACED_TB, in the source queue again while initializing the capture queue. This overwrites the valid source default and leaves the capture field at its zero-initialized value, V4L2_FIELD_ANY. vidioc_streamon() accepts only V4L2_FIELD_SEQ_TB or V4L2_FIELD_SEQ_BT on the source queue, and requires the capture queue to use a compatible interlaced or NONE field. Userspace that relies on the default formats can therefore get -EINVAL when starting streaming. Initialize the capture field instead. The bug is usually hidden because mem2mem applications commonly call S_FMT on both queues before streaming; the TRY_FMT paths normalize the fields and S_FMT overwrites q_data[].field. Fixes: 8f0755c06b90 ("[media] media: Add mem2mem deinterlacing driver") Cc: stable@vger.kernel.org Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Xu Rao <raoxu@uniontech.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: marvell: mcam: stop DMA and cancel s_bh_work before freeing DMA buffersFan Wu
In vmalloc mode the frame-completion IRQ queues mcam_frame_work() on cam->s_bh_work, which memcpy()s from the dma_bufs[] that mcam_free_dma_bufs() frees with dma_free_coherent(). mccic_shutdown() frees those buffers without stopping the controller, so while streaming a late frame IRQ can re-arm the work after the buffers are gone, causing a use-after-free. Stop the controller in mccic_shutdown() when streaming is still active (gated on an open fd, which holds a runtime-PM reference, so the device is powered), cancel s_bh_work in mcam_free_dma_bufs(), and move INIT_WORK() into mccic_register() before the device can be published. Fixes: 67a8dbbc4e04 ("[media] marvell-cam: Basic working MMP camera driver") Cc: stable@vger.kernel.org Signed-off-by: Fan Wu <fanwu01@zju.edu.cn> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: marvell: cafe: drop unneeded semicolonJulia Lawall
When a function-like macro expands to an expression, that expression doesn't need a semicolon after it. All uses have been verified to have their own semicolons. This was found using the following Coccinelle semantic patch: @r@ identifier i : script:ocaml() { String.lowercase_ascii i = i }; expression e; @@ *#define i(...) e; Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
7 daysmedia: marvell-cam: fix unmet dependency for VIDEO_MMP_CAMERAJulian Braha
VIDEO_MMP_CAMERA selects I2C_GPIO without ensuring 'GPIOLIB || COMPILE_TEST' is enabled, despite I2C_GPIO depending on it. Let's add the same dependency to VIDEO_MMP_CAMERA. This unmet dependency bug was found by kconfirm, a static analysis tool for Kconfig. Fixes: 67a8dbbc4e04 ("[media] marvell-cam: Basic working MMP camera driver") Cc: stable@vger.kernel.org Signed-off-by: Julian Braha <julianbraha@gmail.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
9 daysmedia: mediatek: vcodec: bound AV1 tile-start copy to the array capacityMichael Bommarito
vdec_av1_slice_setup_tile() copies tile_cols + 1 / tile_rows + 1 entries into mi_col_starts[] / mi_row_starts[] from the bitstream tile_info. Bound the copy to the array capacity. Fixes: 0934d3759615 ("media: mediatek: vcodec: separate decoder and encoder") Assisted-by: Claude:claude-opus-4-8 Cc: stable@vger.kernel.org Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
9 daysmedia: verisilicon: rockchip: reject AV1 frames exceeding the tile capacityMichael Bommarito
rockchip_vpu981_av1_dec_set_tile_info() indexes the tile group entry array by tile1 * tile_cols + tile0, reading up to tile_cols * tile_rows entries, lays out one descriptor per tile in the AV1_MAX_TILES tile_info buffer, and programs the real tile_cols / tile_rows into the hardware. The tile group entry control is a dynamic array sized to the number of entries userspace submitted, independent of tile_cols / tile_rows, so a frame that claims more tiles than entries reads past the array. A frame that claims more than AV1_MAX_TILES tiles also leaves the hardware programmed for more tiles than the descriptor buffer holds. Reject both in prepare_run(): tile_cols * tile_rows must not exceed the submitted entry count or AV1_MAX_TILES. The entry count is read via v4l2_ctrl_find() (ctrl->elems). This mirrors the bound the mediatek AV1 decoder already enforces. Fixes: 727a400686a2 ("media: verisilicon: Add Rockchip AV1 decoder") Assisted-by: Claude:claude-opus-4-8 Cc: stable@vger.kernel.org Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com> Reviewed-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
9 daysmedia: verisilicon: rockchip: guard VPU981 AV1 divisor and tile bufferMichael Bommarito
rockchip_vpu981_av1_dec_set_tile_info() divides context_update_tile_id by tile_info->tile_cols and writes one descriptor per tile into the tile_info DMA buffer, which holds AV1_MAX_TILES entries; tile_cols and tile_rows come from the bitstream. Guard the division against a zero tile_cols by initialising the context-update values to zero and computing them only when tile_cols is non-zero, and stop the descriptor writes once the tile_info buffer is full. The tile geometry written to the hardware registers is left unmodified; the per-dimension and total tile bounds are enforced by the control validation. Fixes: 727a400686a2 ("media: verisilicon: Add Rockchip AV1 decoder") Assisted-by: Claude:claude-opus-4-8 Cc: stable@vger.kernel.org Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com> Reviewed-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
9 daysmedia: verisilicon: hantro: bound G2 HEVC tile loop to the buffer capacityMichael Bommarito
prepare_tile_info_buffer() writes one entry per tile into the tile_sizes DMA buffer, sized for a grid equal to the PPS uAPI array capacity. Use the bounded v4l2_hevc_pps_num_tile_columns() / v4l2_hevc_pps_num_tile_rows() helpers so the loops stay inside the buffer. Fixes: cb5dd5a0fa51 ("media: hantro: Introduce G2/HEVC decoder") Assisted-by: Claude:claude-opus-4-8 Cc: stable@vger.kernel.org Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com> Reviewed-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>