aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2017-01-29 17:30:31 -0500
committerOlof Johansson <olof@lixom.net>2017-01-29 17:30:31 -0500
commitef73594a38a6df91bf9fa7a513237f677e7ad8c2 (patch)
tree10b2284d7456bf81f7d3d0b7d39af2cc8299b30e
parenta6589b44b077bcd615127aa1e574564029c8f4b1 (diff)
parent1da6de33e43901ec5220cbf292d71172635ada67 (diff)
Merge tag 'samsung-drivers-soc-pmu-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux into next/drivers
Improvements for Exynos PMU driver for v4.11: Beside basic function of setting proper configuration for low power modes, the Exynos PMU (Power Management Unit) driver is also a provider of syscon regmap for its registers. This regmap is essential to many other drivers wanting to or needing to implement low power mode. Exynos pinctrl driver, before getting support for Runtime Power Management, needs access to this syscon regmap. Let's do it in a DT ABI friendly way. * tag 'samsung-drivers-soc-pmu-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux: soc: samsung: pmu: Remove messages for failed memory allocation soc: samsung: pmu: Use of_device_get_match_data helper soc: samsung: pmu: Provide global function to get PMU regmap Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r--drivers/soc/samsung/exynos-pmu.c22
-rw-r--r--include/linux/soc/samsung/exynos-pmu.h10
2 files changed, 24 insertions, 8 deletions
diff --git a/drivers/soc/samsung/exynos-pmu.c b/drivers/soc/samsung/exynos-pmu.c
index 0acdfd82e751..813df6e7292d 100644
--- a/drivers/soc/samsung/exynos-pmu.c
+++ b/drivers/soc/samsung/exynos-pmu.c
@@ -11,6 +11,8 @@
11 11
12#include <linux/of.h> 12#include <linux/of.h>
13#include <linux/of_address.h> 13#include <linux/of_address.h>
14#include <linux/of_device.h>
15#include <linux/mfd/syscon.h>
14#include <linux/platform_device.h> 16#include <linux/platform_device.h>
15#include <linux/delay.h> 17#include <linux/delay.h>
16 18
@@ -92,9 +94,18 @@ static const struct of_device_id exynos_pmu_of_device_ids[] = {
92 { /*sentinel*/ }, 94 { /*sentinel*/ },
93}; 95};
94 96
97struct regmap *exynos_get_pmu_regmap(void)
98{
99 struct device_node *np = of_find_matching_node(NULL,
100 exynos_pmu_of_device_ids);
101 if (np)
102 return syscon_node_to_regmap(np);
103 return ERR_PTR(-ENODEV);
104}
105EXPORT_SYMBOL_GPL(exynos_get_pmu_regmap);
106
95static int exynos_pmu_probe(struct platform_device *pdev) 107static int exynos_pmu_probe(struct platform_device *pdev)
96{ 108{
97 const struct of_device_id *match;
98 struct device *dev = &pdev->dev; 109 struct device *dev = &pdev->dev;
99 struct resource *res; 110 struct resource *res;
100 111
@@ -106,15 +117,10 @@ static int exynos_pmu_probe(struct platform_device *pdev)
106 pmu_context = devm_kzalloc(&pdev->dev, 117 pmu_context = devm_kzalloc(&pdev->dev,
107 sizeof(struct exynos_pmu_context), 118 sizeof(struct exynos_pmu_context),
108 GFP_KERNEL); 119 GFP_KERNEL);
109 if (!pmu_context) { 120 if (!pmu_context)
110 dev_err(dev, "Cannot allocate memory.\n");
111 return -ENOMEM; 121 return -ENOMEM;
112 }
113 pmu_context->dev = dev; 122 pmu_context->dev = dev;
114 123 pmu_context->pmu_data = of_device_get_match_data(dev);
115 match = of_match_node(exynos_pmu_of_device_ids, dev->of_node);
116
117 pmu_context->pmu_data = match->data;
118 124
119 if (pmu_context->pmu_data->pmu_init) 125 if (pmu_context->pmu_data->pmu_init)
120 pmu_context->pmu_data->pmu_init(); 126 pmu_context->pmu_data->pmu_init();
diff --git a/include/linux/soc/samsung/exynos-pmu.h b/include/linux/soc/samsung/exynos-pmu.h
index e2e9de1acc5b..e57eb4b6cc5a 100644
--- a/include/linux/soc/samsung/exynos-pmu.h
+++ b/include/linux/soc/samsung/exynos-pmu.h
@@ -12,6 +12,8 @@
12#ifndef __LINUX_SOC_EXYNOS_PMU_H 12#ifndef __LINUX_SOC_EXYNOS_PMU_H
13#define __LINUX_SOC_EXYNOS_PMU_H 13#define __LINUX_SOC_EXYNOS_PMU_H
14 14
15struct regmap;
16
15enum sys_powerdown { 17enum sys_powerdown {
16 SYS_AFTR, 18 SYS_AFTR,
17 SYS_LPA, 19 SYS_LPA,
@@ -20,5 +22,13 @@ enum sys_powerdown {
20}; 22};
21 23
22extern void exynos_sys_powerdown_conf(enum sys_powerdown mode); 24extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
25#ifdef CONFIG_EXYNOS_PMU
26extern struct regmap *exynos_get_pmu_regmap(void);
27#else
28static inline struct regmap *exynos_get_pmu_regmap(void)
29{
30 return ERR_PTR(-ENODEV);
31}
32#endif
23 33
24#endif /* __LINUX_SOC_EXYNOS_PMU_H */ 34#endif /* __LINUX_SOC_EXYNOS_PMU_H */