From: Janghyuck Kim Date: Mon, 25 Apr 2016 09:27:20 +0000 (+0900) Subject: [COMMON] iommu/exynos: runtime suspend/resume callback X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f231c2313712ae6aa34499bb6c7aed290e25fffa;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] iommu/exynos: runtime suspend/resume callback Sysmmu operation is implicitly enabled and disabled when master device turned on the power and off the power. This patch replaces runtime pm suspend/resume callback of platform bus with exynos_iommu_runtime_suspend/resume that added sysmmu handling. Change-Id: I5e5e1f5fb485a9943c84c0e6a379b8720de57094 Signed-off-by: Janghyuck Kim --- diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index aba7bfc69d25..ef9794fa5d69 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -426,7 +426,35 @@ static int exynos_sysmmu_resume(struct device *dev) } #endif +int exynos_iommu_runtime_suspend(struct device *sysmmu) +{ + unsigned long flags; + struct sysmmu_drvdata *drvdata = dev_get_drvdata(sysmmu); + + spin_lock_irqsave(&drvdata->lock, flags); + if (put_sysmmu_runtime_active(drvdata) && is_sysmmu_active(drvdata)) + __sysmmu_disable_nocount(drvdata); + spin_unlock_irqrestore(&drvdata->lock, flags); + + return 0; +} + +int exynos_iommu_runtime_resume(struct device *sysmmu) +{ + unsigned long flags; + struct sysmmu_drvdata *drvdata = dev_get_drvdata(sysmmu); + + spin_lock_irqsave(&drvdata->lock, flags); + if (get_sysmmu_runtime_active(drvdata) && is_sysmmu_active(drvdata)) + __sysmmu_enable_nocount(drvdata); + spin_unlock_irqrestore(&drvdata->lock, flags); + + return 0; +} + static const struct dev_pm_ops sysmmu_pm_ops = { + SET_RUNTIME_PM_OPS(exynos_iommu_runtime_suspend, + exynos_iommu_runtime_resume, NULL) SET_LATE_SYSTEM_SLEEP_PM_OPS(exynos_sysmmu_suspend, exynos_sysmmu_resume) };