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: # drivers/gpu/drm/amd/amdkfd/kfd_migrate.c # net/ceph/osd_client.c
8 hoursMerge branch 'next' of git://linuxtv.org/media-ci/media-pending.gitMark Brown
20 hoursmedia: nxp: imx8-isi: don't use GFP_DMA when calling dma_alloc_coherent()Baoquan He
dma_alloc_coherent() allocates the DMA buffer with the device's addressing limitation in mind; the DMA core picks the zone from the device's coherent DMA mask and ignores GFP_DMA passed by the caller. Remove the redundant GFP_DMA flag. Link: https://lore.kernel.org/20260903111836.1777265-12-hebaoquan@kylinos.cn Signed-off-by: Baoquan He <hebaoquan@kylinos.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Frank Li <Frank.Li@nxp.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Harry Yoo <harry@kernel.org>
20 hoursmedia: imx7-media-csi: don't use GFP_DMA when calling dma_alloc_coherent()Baoquan He
dma_alloc_coherent() allocates the DMA buffer with the device's addressing limitation in mind; the DMA core picks the zone from the device's coherent DMA mask and ignores GFP_DMA passed by the caller. Remove the redundant GFP_DMA flag. Link: https://lore.kernel.org/20260903111836.1777265-11-hebaoquan@kylinos.cn Signed-off-by: Baoquan He <hebaoquan@kylinos.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Frank Li <Frank.Li@nxp.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Harry Yoo <harry@kernel.org>
11 daysmedia: hantro: disable runtime PM before hardware teardownTharit Tangkijwanichakul
Removing the Hantro driver may trigger an SError on RK3588: SError Interrupt on CPU6, code 0x00000000be000011 -- SError ... do_serror+0x5c/0x74 el1h_64_error_handler+0x34/0x50 el1h_64_error+0x6c/0x70 regmap_mmio_read32le+0x10/0x20 (P) _regmap_bus_reg_read+0x6c/0xb4 _regmap_read+0x60/0xdc regmap_read+0x4c/0x80 rockchip_pd_power+0xe4/0x600 rockchip_pd_power_off+0x1c/0x60 _genpd_power_off+0x98/0x198 genpd_power_off.part.0+0x178/0x288 genpd_runtime_suspend+0x210/0x300 __rpm_callback+0x48/0x1e0 rpm_callback+0x74/0x80 rpm_suspend+0x10c/0x580 rpm_idle+0x134/0x1b8 update_autosuspend+0x30/0xc4 __pm_runtime_use_autosuspend+0x48/0x64 hantro_remove+0x8c/0xa8 [hantro_vpu] ... hantro_remove() currently asserts the device resets before disabling runtime PM. Calling pm_runtime_dont_use_autosuspend() causes an idle device to be runtime-suspended immediately. At that point the Hantro hardware has already been torn down, while the generic power-domain genpd code still performs the power-off sequence. genpd regmap_mmio_read causes panic subsequently because the reset lines were asserted. Disable runtime PM before asserting the reset lines so that no runtime-PM transition can race with hardware teardown. Apply the same ordering to the probe error paths as well. Fixes: ea71631b7129 ("media: hantro: add support for reset lines") Cc: stable@vger.kernel.org Signed-off-by: Tharit Tangkijwanichakul <tharitt97@gmail.com> Reviewed-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: amphion: fix runtime PM imbalance on probe failureJiawen Liu
vpu_core_probe() enables runtime PM before calling pm_runtime_resume_and_get(). If pm_runtime_resume_and_get() fails, it has already dropped the runtime PM usage counter that it acquired before trying to resume the device. Calling pm_runtime_put_noidle() again on this error path drops the counter one extra time. Remove the extra put and keep the existing cleanup that marks the device suspended before disabling runtime PM. Fixes: 9f599f351e86ac ("media: amphion: add vpu core driver") Cc: stable@vger.kernel.org Signed-off-by: Jiawen Liu <1298662399@qq.com> Reviewed-by: Ming Qian <ming.qian@nxp.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: s5p-mfc: use timer_shutdown_sync() for the self-rearming watchdogFan Wu
The MFC watchdog timer (s5p_mfc_watchdog) is self-rearming: every callback re-arms itself with add_timer() and, on a timeout, schedules watchdog_work. s5p_mfc_remove() tears this down with timer_delete_sync() followed by flush_work(). timer_delete_sync() dequeues the timer and waits for a callback that is already running, but it does not prevent a subsequent re-arm. Because the watchdog callback re-arms via add_timer(), this is the wrong shutdown primitive: once the wait returns nothing guarantees a just-queued re-arm will not fire later, dereferencing dev (clock on/off, deinit_hw, load_firmware, init_hw) after video_unregister_device(), DMA teardown and s5p_mfc_final_pm() have run, a potential use-after-free. Use timer_shutdown_sync(), which puts the timer into a shutdown state so that any add_timer()/mod_timer() from the callback becomes a no-op and no later firing is possible. Switch flush_work() to cancel_work_sync() so any watchdog_work that was already queued before the timer was stopped is cancelled rather than allowed to run to completion against the torn-down device. This issue was found by an in-house static analysis tool. No runtime reproducer is available. Fixes: af9357467810 ("[media] MFC: Add MFC 5.1 V4L2 driver") Cc: stable@vger.kernel.org Cc: Andrzej Hajda <andrzej.hajda@intel.com> Assisted-by: Codex:gpt-5.6 Signed-off-by: Fan Wu <fanwu01@zju.edu.cn> Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: hantro: use DEFINE_RUNTIME_DEV_PM_OPSTharit Tangkijwanichakul
The runtime suspend and resume callbacks are currently guarded by CONFIG_PM. Removing the guard directly would leave the callbacks unused when CONFIG_PM is disabled. Define the PM operations with DEFINE_RUNTIME_DEV_PM_OPS() and use pm_ptr() when assigning them to the platform driver. This keeps the PM callbacks available when needed while avoiding unused-function warnings for CONFIG_PM=n builds. Signed-off-by: Tharit Tangkijwanichakul <tharitt97@gmail.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: hantro: release runtime resources when device_run failsTharit Tangkijwanichakul
device_run() acquires a runtime PM reference and enables the VPU clocks before invoking the codec-specific run callback. If clk_bulk_enable() fails, the runtime PM reference is left held. If the codec-specific run callback fails, both the enabled clocks and the runtime PM reference are left held. Make the clocks part of the device's runtime PM state by enabling them from the runtime-resume callback and disabling them from the runtime-suspend callback. Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver") Cc: stable@vger.kernel.org Signed-off-by: Tharit Tangkijwanichakul <tharitt97@gmail.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: hantro: Harden MPEG-2 control access against NULLTharit Tangkijwanichakul
The MPEG-2 sequence and picture controls are validated before a job is queued, so hantro_get_ctrl() is not expected to return NULL in hantro_g1_mpeg2_dec_run(). The controls are nonetheless dereferenced unconditionally. Harden the invariant by checking the sequence and picture controls with WARN_ON(). Found by code inspection. Fixes: f329e21e9dad ("media: uapi: mpeg2: Split sequence and picture parameters") Cc: stable@vger.kernel.org Signed-off-by: Tharit Tangkijwanichakul <tharitt97@gmail.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: mediatek: jpeg: retry HW selection after successful waitPengpeng Hou
wait_event_interruptible_timeout() returns a positive value when its condition becomes true before the timeout. mtk_jpegdec_worker() treats every nonzero result as a failure, so a normal decoder wakeup finishes the mem2mem job as though no hardware became available. Handle interrupted waits and exhausted timeout retries separately, and retry hardware selection after a successful wakeup. Increment the retry count only for actual timeouts. The encoder uses wait_event_interruptible(), whose successful return is zero, so its existing check is correct; leave that separate no-timeout policy unchanged. Fixes: dedc21500334 ("media: mtk-jpegdec: add jpeg decode worker interface") Cc: stable@vger.kernel.org Assisted-by: Codex:gpt-5 Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: verisilicon: rockchip: Fix leaks in initMichail Tatas
If one of the dma_alloc_coherent in the init function fails then the previously allocated ones leak. Fix by freeing them in the error path. Fixes: 727a400686a2 ("media: verisilicon: Add Rockchip AV1 decoder") Cc: stable@vger.kernel.org Signed-off-by: Michail Tatas <michail.tatas@gmail.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: mediatek: jpeg: Avoid context access after job finishKazuki Hanai
v4l2_m2m_job_finish() publishes job completion and wakes waiters before it returns. A concurrent file release can therefore finish v4l2_m2m_ctx_release() and free the context while the single-core IRQ handler continues with its tail. Both handlers only need the device for the matching runtime PM put. Use the IRQ-owned jpeg pointer instead of dereferencing ctx after completion has been published. This preserves the get/put pairing and removes the post-completion context access. Fixes: 45f13a57d813 ("media: platform: Add jpeg enc feature") Fixes: 5827e4b14ee7 ("media: platform: Improve power on and power off flow") Cc: stable@vger.kernel.org Assisted-by: Codex:gpt-5 Signed-off-by: Kazuki Hanai <hnkz.64@gmail.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: mtk-vpu: rename IPI_MAX to IPI_VPU_MAXGUO Ren (XuanTie)
The last enumerator of this driver's firmware IPI id list is a bound for the VPU mailbox protocol, not a generic host IPI limit. Follow the existing naming in this header: IPI_VPU_INIT already carries a VPU prefix, so the terminator should match. The same convention is used by the SCP IPI enum, which ends with a prefixed SCP_IPI_MAX rather than a bare IPI_MAX. Rename IPI_MAX to IPI_VPU_MAX and update the descriptor table bounds and range checks. No functional change. Link: https://lore.kernel.org/linux-riscv/20260908222349.GA2324870@ax162 Cc: Nathan Chancellor <nathan@kernel.org> Signed-off-by: GUO Ren (XuanTie) <guoren@kernel.org> Reviewed-by: Radu Rendec <radu@rendec.net> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: rockchip: rga: Switch to modern PM_OPSDiederik de Haas
A new set of modern PM_OPS macros got defined in commit 1a3c7bb08826 ("PM: core: Add new *_PM_OPS macros, deprecate old ones") Switch to those new macros so that the PM callbacks are always seen by the compiler, but discarded if not used. This lets us drop the __maybe_unused annotation from the callback functions. Signed-off-by: Diederik de Haas <diederik@cknow-tech.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: rkvdec: Switch to modern PM_OPSDiederik de Haas
A new set of modern PM_OPS macros got defined in commit 1a3c7bb08826 ("PM: core: Add new *_PM_OPS macros, deprecate old ones") Switch to those new macros so that the PM callbacks are always seen by the compiler, but discarded if not used. This lets us drop the check for CONFIG_PM. Signed-off-by: Diederik de Haas <diederik@cknow-tech.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: mediatek: vpu: release reserved memory on removeGuangshuo Li
mtk_vpu_probe() may assign a reserved memory region to the VPU device with of_reserved_mem_device_init(). The probe failure path releases the assignment with of_reserved_mem_device_release(), but the normal remove path does not perform the corresponding cleanup. As a result, removing the VPU driver after a successful probe can leave the reserved memory assignment associated with the device after its lifetime has ended. Release the reserved memory assignment after freeing the VPU external firmware memory, matching the cleanup performed by the probe failure path. This issue was found by manual code inspection. Fixes: 3003a180ef6b ("[media] VPU: mediatek: support Mediatek VPU") Cc: stable@vger.kernel.org Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: mediatek: vcodec: destroy core workqueue on removeGuangshuo Li
The decoder probe allocates core_workqueue for architectures with a LAT processor. The probe failure paths destroy the workqueues, but the remove() function only destroys decode_workqueue. As a result, removing a decoder on LAT architectures leaves core_workqueue allocated after the device lifetime has ended. Destroy core_workqueue during remove for latency-based decoder architectures, matching the cleanup performed by the probe failure paths. This issue was found by manual code inspection. Fixes: 365e4ba01df4 ("media: mtk-vcodec: Add work queue for core hardware decode") Cc: stable@vger.kernel.org Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: rkvdec: do not destroy borrowed SRAM poolGuangshuo Li
rkvdec_probe() obtains a provider-owned SRAM pool with of_gen_pool_get(), but its error path incorrectly destroys the borrowed pool with gen_pool_destroy(). of_gen_pool_get() returns a pool managed by the SRAM provider. The pool is not created or owned by the rkvdec driver and is destroyed by the provider when its own managed resources are released. Destroying it when rkvdec_v4l2_init() fails can invalidate the pool while the provider and other consumers still reference it, and can also result in the provider attempting to destroy it again later. Remove the incorrect gen_pool_destroy() call from the probe failure path. This issue was found by manual code inspection. Fixes: e5640dbb991c ("media: rkvdec: Add RCB and SRAM support") Cc: stable@vger.kernel.org Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com> Reviewed-by: Detlev Casanova <detlev.casanova@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: mtk-jpeg: Fix runtime PM leak in mtk_jpegenc_worker()Wentao Liang
pm_runtime_get_sync() leaves the device's runtime PM usage count incremented even when it fails, and a failed clk_prepare_enable() drops the reference as well. mtk_jpegenc_worker() jumps to enc_end in both cases, which does not call pm_runtime_put(), so the reference taken by the successful resume is leaked. Use pm_runtime_resume_and_get() for the resume failure and release the reference explicitly when the clock cannot be enabled, as mtk_jpegdec_worker() already does. Fixes: 5fb1c2361e56 ("mtk-jpegenc: add jpeg encode worker interface") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: mtk-jpeg: Fix runtime PM leak in mtk_jpegdec_worker()Wentao Liang
pm_runtime_get_sync() leaves the device's runtime PM usage count incremented even when it fails. mtk_jpegdec_worker() jumps to dec_end on that failure, which does not call pm_runtime_put(), so the reference taken by the failed resume is leaked. Use pm_runtime_resume_and_get() instead, which drops the reference again when resuming the device fails. Fixes: dedc21500334 ("media: mtk-jpegdec: add jpeg decode worker interface") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: platform: mtk-mdp3: Fix device reference leak in mdp_comp_init()Wentao Liang
mdp_comp_init() takes a reference to the component platform device with of_find_device_by_node(), but the error path taken when the clock array cannot be allocated and the one taken for a component without a GCE EOF event return without dropping it. The caller frees the mdp_comp in those cases, so the reference is leaked. Release the reference on both error paths. Fixes: c4320f9721fd ("media: platform: mtk-mdp3: dynamically allocate component clocks") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: m2m-deinterlace: replace direct ->device_prep*() calls with standard ↵Frank Li
DMA engine API DMA engine consumers must not call the channel's device_prep_*() function pointers directly. Use the standard dmaengine wrapper APIs instead. Assisted-by: LLM Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: rkvdec: Remove redundant dev_err()Diederik de Haas
The devm_request_threaded_irq() function already logs detailed error messages on failure automatically since commit 55b48e23f5c4 ("genirq/devres: Add error handling in devm_request_*_irq()") So remove the now-redundant driver-specific dev_err() calls. Signed-off-by: Diederik de Haas <diederik@cknow-tech.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: mediatek: vpu: free IRQ before destroying watchdog workqueueFan Wu
mtk_vpu_remove() destroys the watchdog workqueue while the interrupt handler requested with devm_request_irq() is still registered: the devres core frees the interrupt only after remove() has returned. If the VPU watchdog fires in that window, vpu_irq_handler() queues vpu->wdt.ws on the already destroyed vpu->wdt.wq. Fix this by calling devm_free_irq() before destroy_workqueue(), which releases the interrupt and waits for a running handler, so no new work can be queued while the workqueue is drained and freed. This issue was found by an in-house static analysis tool. Fixes: 3003a180ef6b ("[media] VPU: mediatek: support Mediatek VPU") Cc: stable@vger.kernel.org Co-developed-by: Song Li <songl@zju.edu.cn> Signed-off-by: Song Li <songl@zju.edu.cn> Signed-off-by: Fan Wu <fanwu01@zju.edu.cn> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: amphion: prevent unbind while video instances are openMyeonghun Pak
An open video instance holds a plain pointer to its devm-allocated core. Unbinding the core or its parent through sysfs can release that memory while the instance remains open. A later ioctl or close then uses the stale pointer. The video file operations pin the module, but sysfs unbind bypasses that protection. Suppress manual bind and unbind for both platform drivers, and warn if core removal ever encounters a live instance. Fixes: 9f599f351e86 ("media: amphion: add vpu core 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> Reviewed-by: Ming Qian <ming.qian@oss.nxp.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: amphion: drain message work before releasing core stateMyeonghun Pak
vpu_core_unregister() frees core->msg_buffer before cancelling the message workers, although core->msg_fifo still uses the buffer as its backing storage. A queued worker can read it after it has been freed. Drain the core and instance message work first, then release core->vpu and the FIFO buffer. This follows the ordering in vpu_core_suspend(). Fixes: 9f599f351e86 ("media: amphion: add vpu core 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> Reviewed-by: Ming Qian <ming.qian@oss.nxp.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: rockchip: rga: fix rotation on rev0 hardwareJohn Keeping
On RK3288 where the RGA reports version zero [1], rotating a buffer gives corrupt output where one edge will be truncated. This is a result of some adjustment done specifically for hardware revision zero. But it seems this is not necessary and there is no evidence for why this adjustment should be applied on these hardware revisions. Comparing the TRMs between RK3288 with revision zero and RK3588 with revision 3.2 there is evidence of new features supported by later hardware, but nothing indicating any difference in behaviour for rotation which is supported by all hardware revisions. The logic here looks wrong anyway, since it's bizarre that minor revision zero would need the adjustment for _all_ major revisions. This was added with the initial version of the driver in commit f7e7b48e6d796 ("[media] rockchip/rga: v4l2 m2m support") so there is no detail in the Git history to indicate why this special-case might be needed. [1] Comparing with the vendor code, it seems this is actually 1.3 with the hardware reporting zero more by coincidence than design since the version register is not defined for RK3288. Fixes: f7e7b48e6d796 ("[media] rockchip/rga: v4l2 m2m support") Cc: stable@vger.kernel.org Signed-off-by: John Keeping <jkeeping@inmusicbrands.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: mediatek: jpeg: add compatible for MT8189 SoCJianhua Lin
Compared to the previous generation ICs, the MT8189 uses a 34-bit IOVA address space (16GB) and requires a single clock configuration. Therefore, add new compatible strings ("mediatek,mt8189-jpgenc" and "mediatek,mt8189-jpgdec") along with their specific driver data to support the JPEG encoder and decoder of the MT8189 SoC. Signed-off-by: Jianhua Lin <jianhua.lin@mediatek.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: chips-media: wave5: Check decoder qbuf runtime resumeGuangshuo Li
wave5_vpu_dec_buf_queue_dst() resumes the VPU before it may clear a decoder display flag. This is needed because clearing the display flag accesses VPU registers. However, the return value from pm_runtime_resume_and_get() is ignored. If the resume fails, pm_runtime_resume_and_get() returns without holding a runtime PM usage reference. The unconditional pm_runtime_put_autosuspend() at the end of the function then drops an unmatched reference. The failed resume path can also continue into wave5_vpu_dec_clr_disp_flag() while the device is still suspended. Check the return value. If the resume fails, complete the queued buffer with an error and return without touching the hardware or dropping an unmatched runtime PM reference. Fixes: cbb9c0d50e47 ("media: chips-media: wave5: Fix SError of kernel panic when closed") Cc: stable@vger.kernel.org Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: chips-media: wave5: Balance runtime PM on encoder close errorsLinmao Li
wave5_vpu_enc_close() resumes the device before taking the hardware lock. Its three error paths call pm_runtime_resume_and_get() again instead of dropping that reference. Each failure therefore increments the runtime PM usage count twice and can prevent the device from suspending afterward. Replace the extra resume calls with pm_runtime_put_sync() to balance the reference acquired on entry, matching the successful close path. This aligns wave5_vpu_enc_close() with wave5_vpu_dec_close(), which already releases the reference on its error paths. Fixes: 2092b3833487 ("media: chips-media: wave5: Support runtime suspend/resume") Cc: stable@vger.kernel.org Signed-off-by: Linmao Li <lilinmao@kylinos.cn> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: chips-media: wave5: Handle polling IRQ thread failureLinmao Li
When falling back to polling mode, wave5_vpu_probe() does not check the return value of kthread_run(). On failure, dev->irq_thread holds an error pointer instead of a valid task pointer. Both the probe error path and the remove path only check dev->irq_thread against NULL before calling kthread_stop() on it, so an error pointer passes the check and kthread_stop() crashes on it. Check the kthread_run() result, clear dev->irq_thread and unwind the probe on failure. Fixes: e66ff2b08e4e ("media: chips-media: wave5: Fix Null reference while testing fluster") Cc: stable@vger.kernel.org Signed-off-by: Linmao Li <lilinmao@kylinos.cn> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: rockchip: rga: quiesce IRQ before releasing m2m stateFan Wu
rga_remove() releases the m2m state before the IRQ is freed. The IRQ is devm-managed and is only released once rga_remove() returns, so rga_isr() can still run while the m2m device state is being torn down. Store the IRQ number in struct rockchip_rga, unregister the video device first, and free the IRQ before releasing the m2m state so the handler cannot run against the freed state. Fixes: f7e7b48e6d79 ("[media] rockchip/rga: v4l2 m2m support") Cc: stable@vger.kernel.org Signed-off-by: Fan Wu <fanwu01@zju.edu.cn> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: sti: delta: use unaligned accessors for MJPEG SOF fieldsRunyu Xiao
delta_mjpeg_read_header() scans a compressed MJPEG access unit byte by byte and passes the bytes after an SOF marker to delta_mjpeg_read_sof(). The SOF parser then reads 16-bit big-endian fields directly from that byte stream. The SOF payload is not an aligned object. The marker scan can find the payload at any byte position, and the SOF layout also puts frame_height and frame_width after a one-byte sample_precision field. Those fields therefore sit at odd offsets within the payload even when the payload base happens to be 2-byte aligned. Avoid casting the byte stream to __be16 pointers and use get_unaligned_be16() for the SOF length, height, and width fields. This issue was detected by our static analysis tool and confirmed by manual audit. A focused UBSAN alignment validation of the same typed load shape reported a misaligned __be16 access in delta_mjpeg_read_sof(). Fixes: 433ff5b4a29b ("[media] st-delta: add mjpeg support") Cc: stable@vger.kernel.org Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
11 daysmedia: imagination: Fix value clamping in calculate_qp_tablesThorsten Blum
The local variable 'val' was never clamped to 1 or 255 because the return value of clamp() was not used. Fix this by assigning the clamped value back to 'val'. Cc: stable@vger.kernel.org Fixes: a1e294045885 ("media: imagination: Add E5010 JPEG Encoder driver") Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: Jai Luthra <jai.luthra@ideasonboard.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
13 daysmedia: rockchip: rkcif: add support for rk3576 vicap mipi captureAmin Gattout
The RK3576 Video Capture (VICAP) unit features a Digital Video Port (DVP) and five MIPI CSI-2 capture interfaces. Compared to the RK3588 variant, the MIPI register blocks are laid out differently (there is no block at offset 0x200), the ID_CTRL0 bit layout has changed, and the VC/DT filter has moved from ID_CTRL0 to ID_CTRL1. The capture size, which the other variants configure in ID_CTRL1, lives in the ID_SET_SIZE register. On the RK3576 the pixel clock of each MIPI port enters the VICAP through a dedicated CRU gate (CLK_VICAP_I0CLK to CLK_VICAP_I4CLK), so the variant claims these five clocks in addition to aclk, hclk and dclk. Signed-off-by: Amin Gattout <amin.gattout@gmail.com> Reviewed-by: Michael Riesch <michael.riesch@collabora.com> Reviewed-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
13 daysmedia: rockchip: rkcif: add a callback for the MIPI ID_CTRL1 registerAmin Gattout
The contents of the MIPI ID_CTRL1 register differ between variants. The RK3568 and RK3588 hold the capture size there, while the RK3576 uses it for the virtual channel and data type filter. Let each variant provide a callback that builds the register value, in preparation for the RK3576 support. Variants that do not provide one keep writing the capture size, so their behavior is unchanged. Signed-off-by: Amin Gattout <amin.gattout@gmail.com> Reviewed-by: Michael Riesch <michael.riesch@collabora.com> Reviewed-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
13 daysmedia: rockchip: rkcif: add a register index for the MIPI capture sizeAmin Gattout
The RK3568 and RK3588 variants configure the MIPI capture size in the ID_CTRL1 register. The RK3576 has a dedicated ID_SET_SIZE register instead. Add a register index for the capture size and write it through that index, in preparation for the RK3576 support. The RK3568 and RK3588 mark the index as unsupported, so the write is a no operation for them and their behavior is unchanged. Signed-off-by: Amin Gattout <amin.gattout@gmail.com> Reviewed-by: Michael Riesch <michael.riesch@collabora.com> Reviewed-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
13 daysmedia: iris: fix 64-bit division in iris_set_slice_count()Sasha Levin
32-bit ARM builds fail at modpost: ERROR: modpost: drivers/media/platform/qcom/iris/qcom-iris.ko: symbol '__aeabi_ldivmod' undefined! The maximum average slice size in MAX_BYTES mode is derived from the BITRATE capability, whose value is an s64, so both the division by the frame rate and the DIV_ROUND_UP() by the number of slices are 64-bit divisions. 32-bit ARM has no instruction for these and the compiler emits calls to __aeabi_ldivmod(), which the kernel does not provide. The bitrate is always positive, so use div_u64() for the division by the frame rate and DIV_ROUND_UP_ULL() for the rounding. Include <linux/math64.h> for div_u64() instead of relying on it being pulled in indirectly. Reported-by: kernelci.org bot <bot@kernelci.org> Closes: https://d.kernelci.org/i/maestro:4935f1aae20e7f957e60f8fde09c4e6d153c7909 Fixes: 5f21cd9a4ae4 ("media: iris: add support for multi_slice in iris encoder") Assisted-by: LLM Signed-off-by: Sasha Levin <sashal@kernel.org> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Bryan O'Donoghue <bod@kernel.org> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
2026-10-01media: rcar-vin: Implement `VIDIOC_ENUM_FRMSIZES`Barnabás Pőcze
Currently there is no way for applications to query the available frame sizes, so implement `VIDIOC_ENUM_FRMSIZES` based on what is allowed in `rvin_format_align()`. Signed-off-by: Barnabás Pőcze <barnabas.pocze+renesas@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2026-10-01media: rcar-isp: ispcore: Fix inconsistent step sizesBarnabás Pőcze
`risp_io_{input,capture}_enum_framesizes()` sets the horizonal and vertical step size to 2. However, `risp_io_{input,capture}_try_format()` passes 2 to `v4l_bound_align_image()`, which corresponds to a step size of 2^2 = 4. So move these constants into macros to avoid the repetition, and with that, use 4 as the step size everywhere. Fixes: 2151350f60d1 ("media: rcar-isp: Add support for ISPCORE") Signed-off-by: Barnabás Pőcze <barnabas.pocze+renesas@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2026-10-01media: exynos4-is: Fix a race between s_stream(0) and the interrupt handlerGinger Li
fimc_lite_subdev_s_stream(on = 0) sets ST_FLITE_OFF outside of the fimc->slock protected region, and only then stops the capture in the hardware. flite_irq_handler() runs under fimc->slock and clears ST_FLITE_OFF, so an interrupt can be handled in between: the handler finds ST_FLITE_OFF already set, clears it and wakes up fimc->irq_queue before the capture has actually been stopped. The wait_event_timeout() right after it then returns immediately and the driver continues as if the capture had stopped. Set ST_FLITE_OFF in the same critical section that stops the capture, as fimc_lite_stop_capture() already does. Fixes: 6319d6a002be ("[media] fimc-lite: Add ISP FIFO output support") Cc: stable@vger.kernel.org Signed-off-by: Ginger Li <ginger.jzllee@gmail.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
2026-10-01media: mali-c55: Ignore disconnected queues when checking readinessLinus Walleij
mali_c55_pipeline_ready() waits for every video queue to enter its start_streaming callback, regardless of whether its media link is enabled. When libcamera uses the TPG, it disables the statistics and parameters links and queues only image buffers. Although STREAMON succeeds on the metadata nodes, videobuf2 never invokes their callbacks without queued buffers. The ISP and TPG are therefore never enabled and capture hangs. An unused full-resolution or downscaled output can similarly prevent the pipeline from starting. Only require queues connected through enabled media links to have started. Use media_pad_remote_pad_first() to check the video node pads, retaining the capability check before accessing the optional downscale device. The shared readiness check also keeps stream-off consistent: the first active queue to stop disables the ISP. Fixes: d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Linus Walleij <linusw@kernel.org> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
2026-10-01media: mali-c55: Check the statistics buffer address before fillingDavid Carlier
mali_c55_stats_cpu_read() copies the metering registers into the buffer returned by vb2_plane_vaddr() without checking it. As for the parameters queue, a DMABUF whose exporter cannot be vmapped yields NULL, and the memcpy_fromio() then dereferences it from the threaded interrupt handler. Report the failure to mali_c55_stats_fill_buffer() and complete the buffer with VB2_BUF_STATE_ERROR. Fixes: d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver") Cc: stable@vger.kernel.org Signed-off-by: David Carlier <devnexen@gmail.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
2026-10-01media: mali-c55: Check the parameters buffer address before copyingDavid Carlier
mali_c55_params_buf_prepare() copies the parameters buffer supplied by userspace into the driver's scratch buffer, using the result of vb2_plane_vaddr() as the source without checking it. The queue accepts VB2_DMABUF, and vb2_dc_vaddr() returns NULL for an exporter that cannot be vmapped, so the memcpy() dereferences NULL. Reject the buffer at prepare time instead. Fixes: d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver") Cc: stable@vger.kernel.org Signed-off-by: David Carlier <devnexen@gmail.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
2026-10-01media: mali-c55: Free the ISP control handler on unregisterDavid Carlier
mali_c55_isp_init_controls() initialises isp->handler and adds the capabilities control, but mali_c55_unregister_isp() never frees it. Neither v4l2_device_unregister_subdev() nor v4l2_subdev_cleanup() touches sd->ctrl_handler, so the handler and its control are leaked on every unbind or module removal. The probe error path already frees it, and the TPG subdevice does so in its own unregister function. Fixes: d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver") Cc: stable@vger.kernel.org Signed-off-by: David Carlier <devnexen@gmail.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
2026-10-01media: arm: mali-c55: Use devm_of_reserved_mem_device_init()Mukesh Ojha
Use the devres-managed devm_of_reserved_mem_device_init() instead of the manual of_reserved_mem_device_init()/of_reserved_mem_device_release() pair, letting the device resource manager handle cleanup automatically. Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
2026-10-01media: mali-c55: fail power-on when safe stop times outPengpeng Hou
The power-on path requests safe stop to establish a non-streaming state but ignores the polling result and publishes runtime resume success. Power the block back off and propagate a safe-stop timeout. Fixes: d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver") Cc: stable@vger.kernel.org Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
2026-10-01media: renesas: rzv2h-ivc: manage runtime PM with devresMyeonghun Pak
Runtime PM is enabled before the IRQ is looked up. If that lookup fails, probe returns without disabling runtime PM. The subdevice initialization error path disables runtime PM but leaves autosuspend enabled, while the remove path does neither. Use devm_pm_runtime_enable() so the driver core disables autosuspend and runtime PM on every failed probe and after remove. This also makes the manual subdevice error unwind unnecessary. This issue was identified during our ongoing static-analysis research while reviewing kernel code. Fixes: f0b3984d821b ("media: platform: Add Renesas Input Video Control block driver") Cc: stable@vger.kernel.org Signed-off-by: Ijae Kim <ae878000@gmail.com> Signed-off-by: Myeonghun Pak <mhun512@gmail.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
2026-09-29media: iris: add support for multi_slice in iris encoderSachin Kumar Garg
Add multi-slice encoding support with MAX_MB and MAX_BYTES modes. Clients can enable slice mode using V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE control and configure slice size via V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB or V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES controls. Reviewed-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com> Signed-off-by: Sachin Kumar Garg <sachin.garg@oss.qualcomm.com> Signed-off-by: Bryan O'Donoghue <bod@kernel.org>