Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <m.szyprowski@samsung.com>
Reviewed-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

authored by

Marek Szyprowski and committed by
Krzysztof Kozlowski
76640b84 0c744ea4

+21
+11
drivers/soc/samsung/exynos-pmu.c
··· 11 11 12 12 #include <linux/of.h> 13 13 #include <linux/of_address.h> 14 + #include <linux/mfd/syscon.h> 14 15 #include <linux/platform_device.h> 15 16 #include <linux/delay.h> 16 17 ··· 92 91 }, 93 92 { /*sentinel*/ }, 94 93 }; 94 + 95 + struct regmap *exynos_get_pmu_regmap(void) 96 + { 97 + struct device_node *np = of_find_matching_node(NULL, 98 + exynos_pmu_of_device_ids); 99 + if (np) 100 + return syscon_node_to_regmap(np); 101 + return ERR_PTR(-ENODEV); 102 + } 103 + EXPORT_SYMBOL_GPL(exynos_get_pmu_regmap); 95 104 96 105 static int exynos_pmu_probe(struct platform_device *pdev) 97 106 {
+10
include/linux/soc/samsung/exynos-pmu.h
··· 12 12 #ifndef __LINUX_SOC_EXYNOS_PMU_H 13 13 #define __LINUX_SOC_EXYNOS_PMU_H 14 14 15 + struct regmap; 16 + 15 17 enum sys_powerdown { 16 18 SYS_AFTR, 17 19 SYS_LPA, ··· 22 20 }; 23 21 24 22 extern void exynos_sys_powerdown_conf(enum sys_powerdown mode); 23 + #ifdef CONFIG_EXYNOS_PMU 24 + extern struct regmap *exynos_get_pmu_regmap(void); 25 + #else 26 + static inline struct regmap *exynos_get_pmu_regmap(void) 27 + { 28 + return ERR_PTR(-ENODEV); 29 + } 30 + #endif 25 31 26 32 #endif /* __LINUX_SOC_EXYNOS_PMU_H */