From 7a96f91b3f180d10fde0e3dbb98773338beb8efb Mon Sep 17 00:00:00 2001 From: Caesar Wang Date: Fri, 18 Nov 2016 16:24:20 +0800 Subject: [PATCH] soc: rockchip: power-domain: export idle request We need to put the power status of HEVC IP into IDLE unless we can't reset that IP or the SoC would crash down. rockchip_pmu_idle_request(dev, true)---> enter idle rockchip_pmu_idle_request(dev, false)---> exit idle Change-Id: I76733efd2de4f7ee183c1b6bd1545d60038ee31b Signed-off-by: Caesar Wang Signed-off-by: Jeffy Chen Signed-off-by: Randy Li --- drivers/soc/rockchip/pm_domains.c | 23 +++++++++++++++++++++++ include/linux/rockchip/pmu.h | 1 + 2 files changed, 24 insertions(+) diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c index c102dbc4ef6a..1656c67bb1fe 100644 --- a/drivers/soc/rockchip/pm_domains.c +++ b/drivers/soc/rockchip/pm_domains.c @@ -158,6 +158,29 @@ static int rockchip_pmu_set_idle_request(struct rockchip_pm_domain *pd, return 0; } +int rockchip_pmu_idle_request(struct device *dev, bool idle) +{ + struct generic_pm_domain *genpd; + struct rockchip_pm_domain *pd; + int ret; + + if (IS_ERR_OR_NULL(dev)) + return -EINVAL; + + if (IS_ERR_OR_NULL(dev->pm_domain)) + return -EINVAL; + + genpd = pd_to_genpd(dev->pm_domain); + pd = to_rockchip_pd(genpd); + + mutex_lock(&pd->pmu->mutex); + ret = rockchip_pmu_set_idle_request(pd, idle); + mutex_unlock(&pd->pmu->mutex); + + return ret; +} +EXPORT_SYMBOL(rockchip_pmu_idle_request); + static int rockchip_pmu_save_qos(struct rockchip_pm_domain *pd) { int i; diff --git a/include/linux/rockchip/pmu.h b/include/linux/rockchip/pmu.h index ece7b277f5b9..5f983976a4ea 100644 --- a/include/linux/rockchip/pmu.h +++ b/include/linux/rockchip/pmu.h @@ -134,6 +134,7 @@ struct rockchip_pmu_operations { int (*set_idle_request)(enum pmu_idle_req req, bool idle); }; +int rockchip_pmu_idle_request(struct device *dev, bool idle); extern struct rockchip_pmu_operations rockchip_pmu_ops; #endif -- 2.34.1