Skip to contentSkip to conversation

media: imx-jpeg: Add pm-sleep support for imx-jpeg

PATCH In review Ming Qian 2 participants 2 messages Apr 6, 2022 – Apr 23, 2022

Subsystems (3)
lore
Share & tools
lore

Ming Qian

author
#0 lore raw

PATCH 1/1 media: imx-jpeg: Add pm-sleep support for imx-jpeg

Wait finishing jpeg job before system sleep, otherwise the encoding/decoding can't be resumed after suspend.

---
 .../media/platform/nxp/imx-jpeg/mxc-jpeg.c    | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +24 -0
index ccc26372e178..3df51d866011 100644
@@ -2356,9 +2356,33 @@ static int mxc_jpeg_runtime_suspend(struct device *dev)
 }
 #endif
 
+#ifdef CONFIG_PM_SLEEP
+static int mxc_jpeg_suspend(struct device *dev)
+{
+	struct mxc_jpeg_dev *jpeg = dev_get_drvdata(dev);
+
+	v4l2_m2m_suspend(jpeg->m2m_dev);
+	return pm_runtime_force_suspend(dev);
+}
+
+static int mxc_jpeg_resume(struct device *dev)
+{
+	struct mxc_jpeg_dev *jpeg = dev_get_drvdata(dev);
+	int ret;
+
+	ret = pm_runtime_force_resume(dev);
+	if (ret < 0)
+		return ret;
+
+	v4l2_m2m_resume(jpeg->m2m_dev);
+	return ret;
+}
+#endif
+
 static const struct dev_pm_ops	mxc_jpeg_pm_ops = {
 	SET_RUNTIME_PM_OPS(mxc_jpeg_runtime_suspend,
 			   mxc_jpeg_runtime_resume, NULL)
+	SET_SYSTEM_SLEEP_PM_OPS(mxc_jpeg_suspend, mxc_jpeg_resume)
 };
 
 static int mxc_jpeg_remove(struct platform_device *pdev)
Signature · 7 lines
2.33.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Reviewed-by Mirela Rabulea on v1 1/1
#1 lore raw
Quoted 4 lines · Ming Qian

Wait finishing jpeg job before system sleep, otherwise the encoding/decoding can't be resumed after suspend.

Quoted 42 lines
---
  .../media/platform/nxp/imx-jpeg/mxc-jpeg.c    | 24 +++++++++++++++++++
  1 file changed, 24 insertions(+)
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +24 -0
index ccc26372e178..3df51d866011 100644
@@ -2356,9 +2356,33 @@ static int mxc_jpeg_runtime_suspend(struct device *dev)
  }
  #endif
 
+#ifdef CONFIG_PM_SLEEP
+static int mxc_jpeg_suspend(struct device *dev)
+{
+	struct mxc_jpeg_dev *jpeg = dev_get_drvdata(dev);
+
+	v4l2_m2m_suspend(jpeg->m2m_dev);
+	return pm_runtime_force_suspend(dev);
+}
+
+static int mxc_jpeg_resume(struct device *dev)
+{
+	struct mxc_jpeg_dev *jpeg = dev_get_drvdata(dev);
+	int ret;
+
+	ret = pm_runtime_force_resume(dev);
+	if (ret < 0)
+		return ret;
+
+	v4l2_m2m_resume(jpeg->m2m_dev);
+	return ret;
+}
+#endif
+
  static const struct dev_pm_ops	mxc_jpeg_pm_ops = {
  	SET_RUNTIME_PM_OPS(mxc_jpeg_runtime_suspend,
  			   mxc_jpeg_runtime_resume, NULL)
+	SET_SYSTEM_SLEEP_PM_OPS(mxc_jpeg_suspend, mxc_jpeg_resume)
  };
 
  static int mxc_jpeg_remove(struct platform_device *pdev)