Commit f9f96451 authored by Xia Jiang's avatar Xia Jiang Committed by Mauro Carvalho Chehab

media: platform: Improve the implementation of the system PM ops

Add v4l2_m2m_suspend() function call in mtk_jpeg_suspend() to make sure
that the current frame is processed completely before suspend.
Add v4l2_m2m_resume() function call in mtk_jpeg_resume() to unblock the
driver from scheduling next frame.
Reviewed-by: default avatarTomasz Figa <tfiga@chromium.org>
Signed-off-by: default avatarXia Jiang <xia.jiang@mediatek.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 911ea8ec
...@@ -1207,24 +1207,22 @@ static __maybe_unused int mtk_jpeg_pm_resume(struct device *dev) ...@@ -1207,24 +1207,22 @@ static __maybe_unused int mtk_jpeg_pm_resume(struct device *dev)
static __maybe_unused int mtk_jpeg_suspend(struct device *dev) static __maybe_unused int mtk_jpeg_suspend(struct device *dev)
{ {
int ret; struct mtk_jpeg_dev *jpeg = dev_get_drvdata(dev);
if (pm_runtime_suspended(dev))
return 0;
ret = mtk_jpeg_pm_suspend(dev); v4l2_m2m_suspend(jpeg->m2m_dev);
return ret; return pm_runtime_force_suspend(dev);
} }
static __maybe_unused int mtk_jpeg_resume(struct device *dev) static __maybe_unused int mtk_jpeg_resume(struct device *dev)
{ {
struct mtk_jpeg_dev *jpeg = dev_get_drvdata(dev);
int ret; int ret;
if (pm_runtime_suspended(dev)) ret = pm_runtime_force_resume(dev);
return 0; if (ret < 0)
return ret;
ret = mtk_jpeg_pm_resume(dev);
v4l2_m2m_resume(jpeg->m2m_dev);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment