[PATCH v5 0/2] media: hantro: fix runtime PM resource handling
From: Tharit Tangkijwanichakul
Date: Wed Jul 29 2026 - 02:20:15 EST
The Hantro device_run() path acquires a runtime PM reference before
invoking the codec-specific run callback. Failure paths can leave the
runtime PM reference and enabled clocks held.
Patch 1 moves clock enable and disable operations into the runtime PM
callbacks and releases the runtime PM reference when device_run()
fails. It retains the existing CONFIG_PM conditional so that the patch
remains independently buildable.
Patch 2 removes the explicit CONFIG_PM conditional, defines the PM
operations with DEFINE_RUNTIME_DEV_PM_OPS(), and uses pm_ptr() when
assigning the PM operations to the platform driver.
Changes in v5:
- Split the runtime PM changes into two patches.
- Move clock management into the runtime PM callbacks.
- Release the runtime PM reference on device_run() failure.
- Retain the CONFIG_PM conditional in patch 1.
- Remove the CONFIG_PM conditional in patch 2 using
DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr().
v4:
https://lore.kernel.org/linux-media/20260728045921.4761-1-tharitt97@xxxxxxxxx
Tharit Tangkijwanichakul (2):
media: hantro: release runtime resources when device_run fails
media: hantro: use DEFINE_RUNTIME_DEV_PM_OPS
.../media/platform/verisilicon/hantro_drv.c | 75 ++++++++++---------
1 file changed, 41 insertions(+), 34 deletions(-)
---
Tested on a Rockchip RK3588 (Rock 5B) board with Fluster:
H.264 (JVT-AVC_V1): 129/135, unchanged
MPEG-2 (MPEG2_VIDEO-MAIN): 23/43, unchanged
VP8 (VP8-TEST-VECTORS): 61/61, unchanged
base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
--
2.47.3