MLK-20595-2: camera: check camera's running state before suspend
authorGuoniu.Zhou <guoniu.zhou@nxp.com>
Mon, 17 Dec 2018 02:16:55 +0000 (10:16 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
Check camera's running state before suspend for imx8qm/qxp
and don't support suspend when camera's running

Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
drivers/media/platform/imx8/mxc-isi-core.c

index 79ffd7a..5dd92b3 100644 (file)
@@ -216,6 +216,13 @@ static int mxc_isi_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int mxc_isi_pm_suspend(struct device *dev)
 {
+       struct mxc_isi_dev *mxc_isi = dev_get_drvdata(dev);
+
+       if (mxc_isi->is_streaming) {
+               dev_warn(dev, "running, prevent entering suspend.\n");
+               return -EAGAIN;
+       }
+
        return pm_runtime_force_suspend(dev);
 }