From 76640b84bd7a9d68c70d8bc8ecd02cdc4bd8855e Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Thu, 19 Jan 2017 14:48:41 +0100 Subject: soc: samsung: pmu: Provide global function to get PMU regmap PMU is something like a SoC wide service, so add a helper function to get PMU regmap. This will be used by other Exynos device drivers. This way it can be avoided to model this dependency in device tree (as phandles to PMU node) for almost every device in the SoC. Signed-off-by: Marek Szyprowski Reviewed-by: Tomasz Figa Signed-off-by: Krzysztof Kozlowski --- drivers/soc/samsung/exynos-pmu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'drivers/soc/samsung') diff --git a/drivers/soc/samsung/exynos-pmu.c b/drivers/soc/samsung/exynos-pmu.c index 0acdfd82e751..5c269bf23210 100644 --- a/drivers/soc/samsung/exynos-pmu.c +++ b/drivers/soc/samsung/exynos-pmu.c @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -92,6 +93,16 @@ static const struct of_device_id exynos_pmu_of_device_ids[] = { { /*sentinel*/ }, }; +struct regmap *exynos_get_pmu_regmap(void) +{ + struct device_node *np = of_find_matching_node(NULL, + exynos_pmu_of_device_ids); + if (np) + return syscon_node_to_regmap(np); + return ERR_PTR(-ENODEV); +} +EXPORT_SYMBOL_GPL(exynos_get_pmu_regmap); + static int exynos_pmu_probe(struct platform_device *pdev) { const struct of_device_id *match; -- cgit v1.2.3