aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/soc
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2017-01-29 14:30:31 -0800
committerOlof Johansson <olof@lixom.net>2017-01-29 14:30:31 -0800
commitef73594a38a6df91bf9fa7a513237f677e7ad8c2 (patch)
tree10b2284d7456bf81f7d3d0b7d39af2cc8299b30e /drivers/soc
parentMerge tag 'reset-for-4.11' of git://git.pengutronix.de/pza/linux into next/drivers (diff)
parentsoc: samsung: pmu: Remove messages for failed memory allocation (diff)
downloadlinux-dev-ef73594a38a6df91bf9fa7a513237f677e7ad8c2.tar.xz
linux-dev-ef73594a38a6df91bf9fa7a513237f677e7ad8c2.zip
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>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/samsung/exynos-pmu.c22
1 files changed, 14 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 @@
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/mfd/syscon.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
@@ -92,9 +94,18 @@ 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;
struct device *dev = &pdev->dev;
struct resource *res;
@@ -106,15 +117,10 @@ static int exynos_pmu_probe(struct platform_device *pdev)
pmu_context = devm_kzalloc(&pdev->dev,
sizeof(struct exynos_pmu_context),
GFP_KERNEL);
- if (!pmu_context) {
- dev_err(dev, "Cannot allocate memory.\n");
+ if (!pmu_context)
return -ENOMEM;
- }
pmu_context->dev = dev;
-
- match = of_match_node(exynos_pmu_of_device_ids, dev->of_node);
-
- pmu_context->pmu_data = match->data;
+ pmu_context->pmu_data = of_device_get_match_data(dev);
if (pmu_context->pmu_data->pmu_init)
pmu_context->pmu_data->pmu_init();