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: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Xia Jiang 2020-08-14 09:11:41 +02:00 коммит произвёл Mauro Carvalho Chehab
Родитель 911ea8ec42
Коммит f9f964519c
1 изменённых файлов: 8 добавлений и 10 удалений

Просмотреть файл

@ -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)
{
int ret;
struct mtk_jpeg_dev *jpeg = dev_get_drvdata(dev);
if (pm_runtime_suspended(dev))
return 0;
ret = mtk_jpeg_pm_suspend(dev);
return ret;
v4l2_m2m_suspend(jpeg->m2m_dev);
return pm_runtime_force_suspend(dev);
}
static __maybe_unused int mtk_jpeg_resume(struct device *dev)
{
struct mtk_jpeg_dev *jpeg = dev_get_drvdata(dev);
int ret;
if (pm_runtime_suspended(dev))
return 0;
ret = mtk_jpeg_pm_resume(dev);
ret = pm_runtime_force_resume(dev);
if (ret < 0)
return ret;
v4l2_m2m_resume(jpeg->m2m_dev);
return ret;
}