summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJonghwa Lee <jonghwa3.lee@samsung.com>2015-08-07 23:17:16 +0900
committerSeung-Woo Kim <sw0312.kim@samsung.com>2016-12-14 13:47:05 +0900
commite7b6ff3483825916f05db8d53bc1b708b8b7523f (patch)
tree0c96c4039a6c9e06835a61b980afd8efc42f58aa /drivers
parent0f2f3c13e883d7c1aaeea46f29112b43243cfc7b (diff)
soc: samsung: pm_domain: Support pm_domain creation notification.
For some drivers which is probed earlier than pm_domain creation, it provides a interface to get notification. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/soc/samsung/pm_domains.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/soc/samsung/pm_domains.c b/drivers/soc/samsung/pm_domains.c
index 38d3df1ce12a..4b36f2b00565 100644
--- a/drivers/soc/samsung/pm_domains.c
+++ b/drivers/soc/samsung/pm_domains.c
@@ -46,28 +46,36 @@ struct exynos_pm_domain {
u32 local_pwr_cfg;
};
+static BLOCKING_NOTIFIER_HEAD(exynos_pd_nh);
+
int exynos_pd_notifier_register(struct generic_pm_domain *domain,
struct notifier_block *nb)
{
struct exynos_pm_domain *pd;
- if (!domain || !nb)
+ if (!nb)
return -EINVAL;
+ if (!domain)
+ return blocking_notifier_chain_register(&exynos_pd_nh, nb);
+
pd = container_of(domain, struct exynos_pm_domain, pd);
return atomic_notifier_chain_register(&pd->nh, nb);
}
-void exynos_pd_notifier_unregister(struct generic_pm_domain *domain,
+int exynos_pd_notifier_unregister(struct generic_pm_domain *domain,
struct notifier_block *nb)
{
struct exynos_pm_domain *pd;
- if (!domain || !nb)
- return;
+ if (!nb)
+ return -EINVAL;
+
+ if (!domain)
+ return blocking_notifier_chain_unregister(&exynos_pd_nh, nb);
pd = container_of(domain, struct exynos_pm_domain, pd);
- atomic_notifier_chain_unregister(&pd->nh, nb);
+ return atomic_notifier_chain_unregister(&pd->nh, nb);
}
static void exynos_pd_notify_pre(struct exynos_pm_domain *pd, bool power_on)
@@ -252,6 +260,9 @@ static __init int exynos4_pm_init_power_domain(void)
pm_genpd_init(&pd->pd, NULL, !on);
of_genpd_add_provider_simple(np, &pd->pd);
+
+ blocking_notifier_call_chain(&exynos_pd_nh,
+ EXYNOS_PD_ADD, &pd->pd);
}
/* Assign the child power domains to their parents */