[PATCH] media: chips-media: wave5: Add system suspend/resume support
From: Thorsten Lannynd
Date: Tue Jul 07 2026 - 16:17:33 EST
Add SET_SYSTEM_SLEEP_PM_OPS with wave5_system_suspend() and
wave5_system_resume() so the driver handles system suspend to RAM. When
suspended, Wave5 should gracefully finish the job and shutdown. When
resumed, Wave5 should resume the context and finish executing the suspended
stream.
Signed-off-by: Thorsten Lannynd <t-lannynd@xxxxxx>
---
.../platform/chips-media/wave5/wave5-vpu.c | 30 +++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu.c b/drivers/media/platform/chips-media/wave5/wave5-vpu.c
index 76d57c6b6..a83640751 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-vpu.c
+++ b/drivers/media/platform/chips-media/wave5/wave5-vpu.c
@@ -254,7 +254,37 @@ static __maybe_unused int wave5_pm_resume(struct device *dev)
return ret;
}
+static __maybe_unused int wave5_system_suspend(struct device *dev)
+{
+ struct vpu_device *vpu = dev_get_drvdata(dev);
+
+ if (vpu->v4l2_m2m_dec_dev)
+ v4l2_m2m_suspend(vpu->v4l2_m2m_dec_dev);
+ if (vpu->v4l2_m2m_enc_dev)
+ v4l2_m2m_suspend(vpu->v4l2_m2m_enc_dev);
+
+ return pm_runtime_force_suspend(dev);
+}
+
+static __maybe_unused int wave5_system_resume(struct device *dev)
+{
+ struct vpu_device *vpu = dev_get_drvdata(dev);
+ int ret;
+
+ ret = pm_runtime_force_resume(dev);
+ if (ret < 0)
+ return ret;
+
+ if (vpu->v4l2_m2m_dec_dev)
+ v4l2_m2m_resume(vpu->v4l2_m2m_dec_dev);
+ if (vpu->v4l2_m2m_enc_dev)
+ v4l2_m2m_resume(vpu->v4l2_m2m_enc_dev);
+
+ return 0;
+}
+
static const struct dev_pm_ops wave5_pm_ops = {
+ SET_SYSTEM_SLEEP_PM_OPS(wave5_system_suspend, wave5_system_resume)
SET_RUNTIME_PM_OPS(wave5_pm_suspend, wave5_pm_resume, NULL)
};
--
2.34.1