iommu: arm-smmu: Add Deepsleep support for smmu
Add Deepsleep support for arm-smmu driver. Change-Id: Id95f84c1670dd5a0f7265898bed3af8b9d960428 Signed-off-by: Nagireddy Annem <quic_nannem@quicinc.com>
This commit is contained in:
@@ -3675,7 +3675,7 @@ static int __maybe_unused arm_smmu_runtime_suspend(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused arm_smmu_pm_resume(struct device *dev)
|
||||
static int __maybe_unused arm_smmu_pm_resume_common(struct device *dev)
|
||||
{
|
||||
int ret;
|
||||
struct arm_smmu_device *smmu = dev_get_drvdata(dev);
|
||||
@@ -3702,23 +3702,6 @@ static int __maybe_unused arm_smmu_pm_resume(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __maybe_unused arm_smmu_pm_suspend(struct device *dev)
|
||||
{
|
||||
int ret = 0;
|
||||
struct arm_smmu_device *smmu = dev_get_drvdata(dev);
|
||||
|
||||
if (pm_runtime_suspended(dev))
|
||||
goto clk_unprepare;
|
||||
|
||||
ret = arm_smmu_runtime_suspend(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
clk_unprepare:
|
||||
clk_bulk_unprepare(smmu->num_clks, smmu->clks);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __maybe_unused arm_smmu_pm_restore_early(struct device *dev)
|
||||
{
|
||||
struct arm_smmu_device *smmu = dev_get_drvdata(dev);
|
||||
@@ -3751,7 +3734,7 @@ static int __maybe_unused arm_smmu_pm_restore_early(struct device *dev)
|
||||
smmu_domain->pgtbl_ops = pgtbl_ops;
|
||||
arm_smmu_init_context_bank(smmu_domain, pgtbl_cfg);
|
||||
}
|
||||
arm_smmu_pm_resume(dev);
|
||||
arm_smmu_pm_resume_common(dev);
|
||||
ret = arm_smmu_runtime_suspend(dev);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to suspend\n");
|
||||
@@ -3799,6 +3782,34 @@ static int arm_smmu_pm_prepare(struct device *dev)
|
||||
return (atomic_read(&dev->power.usage_count) == 1) ? -EINPROGRESS : 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused arm_smmu_pm_suspend(struct device *dev)
|
||||
{
|
||||
int ret = 0;
|
||||
struct arm_smmu_device *smmu = dev_get_drvdata(dev);
|
||||
|
||||
if (pm_suspend_via_firmware())
|
||||
arm_smmu_pm_freeze_late(dev);
|
||||
|
||||
if (pm_runtime_suspended(dev))
|
||||
goto clk_unprepare;
|
||||
|
||||
ret = arm_smmu_runtime_suspend(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
clk_unprepare:
|
||||
clk_bulk_unprepare(smmu->num_clks, smmu->clks);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __maybe_unused arm_smmu_pm_resume(struct device *dev)
|
||||
{
|
||||
if (pm_suspend_via_firmware())
|
||||
return arm_smmu_pm_restore_early(dev);
|
||||
else
|
||||
return arm_smmu_pm_resume_common(dev);
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops arm_smmu_pm_ops = {
|
||||
SET_RUNTIME_PM_OPS(arm_smmu_runtime_suspend,
|
||||
arm_smmu_runtime_resume, NULL)
|
||||
|
||||
Reference in New Issue
Block a user