From: Janghyuck Kim Date: Mon, 25 Apr 2016 09:30:17 +0000 (+0900) Subject: [COMMON] iommu/exynos: add suspend/resume callback X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7ce79ed5978e38aa1d4230612c1ae6506a013f56;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [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 --- 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