[COMMON] iommu/exynos: add suspend/resume callback
authorJanghyuck Kim <janghyuck.kim@samsung.com>
Mon, 25 Apr 2016 09:30:17 +0000 (18:30 +0900)
committerSangwook Ju <sw.ju@samsung.com>
Mon, 14 May 2018 10:45:18 +0000 (19:45 +0900)
To support suspend and resume of APM, suspend and resume callback is
added to disable and enable sysmmu properly.

Change-Id: Ie2cf804b50219c1c820de794fe2e6aad68ae3d94
Signed-off-by: Janghyuck Kim <janghyuck.kim@samsung.com>
drivers/iommu/exynos-iommu.c

index ef9794fa5d69e6c4ac38c838461ed394afc019f8..ce66ac41f5e6c529e57e6b7bd8485905e6b53f59 100644 (file)
@@ -417,11 +417,32 @@ static int sysmmu_enable_from_master(struct device *master,
 #ifdef CONFIG_PM_SLEEP
 static int exynos_sysmmu_suspend(struct device *dev)
 {
+       unsigned long flags;
+       struct sysmmu_drvdata *drvdata = dev_get_drvdata(dev);
+
+       spin_lock_irqsave(&drvdata->lock, flags);
+       if (is_sysmmu_active(drvdata) &&
+                       (!pm_runtime_enabled(dev) ||
+                        is_sysmmu_runtime_active(drvdata))) {
+               __sysmmu_disable_nocount(drvdata);
+       }
+       spin_unlock_irqrestore(&drvdata->lock, flags);
+
        return 0;
 }
 
 static int exynos_sysmmu_resume(struct device *dev)
 {
+       unsigned long flags;
+       struct sysmmu_drvdata *drvdata = dev_get_drvdata(dev);
+
+       spin_lock_irqsave(&drvdata->lock, flags);
+       if (is_sysmmu_active(drvdata) &&
+                       (!pm_runtime_enabled(dev) ||
+                        is_sysmmu_runtime_active(drvdata)))
+               __sysmmu_enable_nocount(drvdata);
+       spin_unlock_irqrestore(&drvdata->lock, flags);
+
        return 0;
 }
 #endif