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.
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABCAAGBQJYglMqAAoJEME3ZuaGi4PXM44QAIwQYe+ZaLJojKgAJ2wIP0Mc
 0Jc7DrI7YGc5SQRpyOWztVEPuUH04tqCymYpAIqJ8UwsVGYERPglVQdVML+P9oyR
 syIP7COQy5KvDtKMOrMid2+KJjf6zcEHQFecFEEkqffTmtlwnfmpSrSbtoIHFoK4
 33vuikSP3npGh9rHOClXi+SMtvor1hYg/8hPD6zfeXIbt6D5zIzTW/dIAFDm1gbV
 xdVJusWLOPcdOBB7eTO5GxBjTCWcrOojJOXr1M3hR/46Z2Vv/WEPaLv4h/FhJxhQ
 tXBCBppKvrjsmGfnKiKwAHrFF999cAyfjAW7kpAF+hCtLIMR+R17TI+EJ4ahDrbf
 ZQH+otFq0YioQbhFh4HUJ6EImXSBaGdDOlT7HZLWlruj3Yc6vyiLL17qQcGZp63g
 wrot39P0v04jIJewr4OR72KnfIAfkEkHkxgZMwV/YibsuzwOxxP8leax4oh2UELg
 GrzkOdiEulRPyyY2Xlq1TIEQS3wFkYDJNQJ9INW1yp4NYgPx0Q2/5JPz2w9Ep8aO
 ONp3h//Rt4bJRqI3vyhhhU1Rj90sKfutewggHC4jycxHCkaBS6/xtw6HJfxZzC82
 QnDxK/2ylQVpbA1Hy8hP90HkdhsvhwcUsXmhH66EszyUmdhjgl+iPgtDJGKwcHEC
 SlnIwnmZqI0r6NFraoao
 =ZQ36
 -----END PGP SIGNATURE-----

Merge tag 'samsung-drivers-soc-pmu-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux into devel

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.
This commit is contained in:
Linus Walleij 2017-01-26 16:56:41 +01:00
commit 545e3e7da3
2 changed files with 24 additions and 8 deletions

View File

@ -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();

View File

@ -12,6 +12,8 @@
#ifndef __LINUX_SOC_EXYNOS_PMU_H
#define __LINUX_SOC_EXYNOS_PMU_H
struct regmap;
enum sys_powerdown {
SYS_AFTR,
SYS_LPA,
@ -20,5 +22,13 @@ enum sys_powerdown {
};
extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
#ifdef CONFIG_EXYNOS_PMU
extern struct regmap *exynos_get_pmu_regmap(void);
#else
static inline struct regmap *exynos_get_pmu_regmap(void)
{
return ERR_PTR(-ENODEV);
}
#endif
#endif /* __LINUX_SOC_EXYNOS_PMU_H */