From 7ce79ed5978e38aa1d4230612c1ae6506a013f56 Mon Sep 17 00:00:00 2001 From: Janghyuck Kim Date: Mon, 25 Apr 2016 18:30:17 +0900 Subject: [PATCH] [COMMON] iommu/exynos: add suspend/resume callback 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 --- drivers/iommu/exynos-iommu.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index ef9794fa5d69..ce66ac41f5e6 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -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 -- 2.20.1