From: Marek Szyprowski <m.szyprowski@samsung.com>
To: linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Tomasz Figa <tomasz.figa@gmail.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: [PATCH 01/12] soc: samsung: pmu: Use common device name to let others to find it easily
Date: Mon, 16 Jan 2017 07:44:56 +0100 [thread overview]
Message-ID: <1484549107-5957-2-git-send-email-m.szyprowski@samsung.com> (raw)
In-Reply-To: <1484549107-5957-1-git-send-email-m.szyprowski@samsung.com>
This patch always set device name to "exynos-pmu" to let other drivers to
find PMU device easily. This is done mainly to get regmap to access PMU
registers from other drivers. This way it can be avoided to add phandle to
the PMU node to almost all drivers in the SoC just to get a regmap access
in the drivers. PMU is something like a SoC wide service, so there is no
point modeling it as hardware dependency for all devices in device tree.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
drivers/soc/samsung/exynos-pmu.c | 1 +
include/linux/soc/samsung/exynos-pmu.h | 19 +++++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/drivers/soc/samsung/exynos-pmu.c b/drivers/soc/samsung/exynos-pmu.c
index 0acdfd82e751..63bb471845cb 100644
--- a/drivers/soc/samsung/exynos-pmu.c
+++ b/drivers/soc/samsung/exynos-pmu.c
@@ -120,6 +120,7 @@ static int exynos_pmu_probe(struct platform_device *pdev)
pmu_context->pmu_data->pmu_init();
platform_set_drvdata(pdev, pmu_context);
+ dev_set_name(dev, EXYNOS_PMU_DEV_NAME);
dev_dbg(dev, "Exynos PMU Driver probe done\n");
return 0;
diff --git a/include/linux/soc/samsung/exynos-pmu.h b/include/linux/soc/samsung/exynos-pmu.h
index e2e9de1acc5b..90d9205805ea 100644
--- a/include/linux/soc/samsung/exynos-pmu.h
+++ b/include/linux/soc/samsung/exynos-pmu.h
@@ -12,6 +12,10 @@
#ifndef __LINUX_SOC_EXYNOS_PMU_H
#define __LINUX_SOC_EXYNOS_PMU_H
+#include <linux/mfd/syscon.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+
enum sys_powerdown {
SYS_AFTR,
SYS_LPA,
@@ -21,4 +25,19 @@ enum sys_powerdown {
extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
+#define EXYNOS_PMU_DEV_NAME "exynos-pmu"
+
+static inline struct regmap *exynos_get_pmu_regs(void)
+{
+ struct device *dev = bus_find_device_by_name(&platform_bus_type, NULL,
+ EXYNOS_PMU_DEV_NAME);
+ if (dev) {
+ struct regmap *regs = syscon_node_to_regmap(dev->of_node);
+ put_device(dev);
+ if (!IS_ERR(regs))
+ return regs;
+ }
+ return NULL;
+}
+
#endif /* __LINUX_SOC_EXYNOS_PMU_H */
--
1.9.1
next prev parent reply other threads:[~2017-01-16 6:44 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170116064523eucas1p161a8e060b2883c076fc470ce7b522332@eucas1p1.samsung.com>
2017-01-16 6:44 ` [PATCH 00/12] Move pad retention control to Exynos pin controller driver Marek Szyprowski
2017-01-16 6:44 ` Marek Szyprowski [this message]
2017-01-16 19:48 ` [PATCH 01/12] soc: samsung: pmu: Use common device name to let others to find it easily Krzysztof Kozlowski
2017-01-17 4:39 ` Tomasz Figa
2017-01-16 6:44 ` [PATCH 02/12] soc: samsung: pmu: Use of_device_get_match_data helper Marek Szyprowski
2017-01-16 6:44 ` [PATCH 03/12] soc: samsung: pmu: Remove messages for failed memory allocation Marek Szyprowski
2017-01-16 6:44 ` [PATCH 04/12] pinctrl: samsung: Document Exynos3250 SoC support Marek Szyprowski
2017-01-16 19:01 ` Krzysztof Kozlowski
2017-01-16 6:45 ` [PATCH 05/12] pinctrl: samsung: Remove messages for failed memory allocation Marek Szyprowski
2017-01-16 19:04 ` Krzysztof Kozlowski
2017-01-16 6:45 ` [PATCH 06/12] pinctrl: samsung: Add missing initconst annotation Marek Szyprowski
2017-01-16 19:14 ` Krzysztof Kozlowski
2017-01-17 4:44 ` Tomasz Figa
2017-01-17 6:34 ` Krzysztof Kozlowski
2017-01-17 7:13 ` Tomasz Figa
2017-01-16 6:45 ` [PATCH 07/12] pinctrl: samsung: Remove dead code Marek Szyprowski
2017-01-16 6:45 ` [PATCH 08/12] pinctrl: samsung: Use generic of_device_get_match_data helper Marek Szyprowski
2017-01-16 19:19 ` Krzysztof Kozlowski
2017-01-16 6:45 ` [PATCH 09/12] pinctrl: samsung: Add infrastructure for pin-bank retention control Marek Szyprowski
2017-01-16 19:37 ` Krzysztof Kozlowski
2017-01-17 4:51 ` Tomasz Figa
2017-01-16 6:45 ` [PATCH 10/12] pinctrl: samsung: Move retention control from mach-exynos to the pinctrl driver Marek Szyprowski
2017-01-16 6:45 ` [PATCH 11/12] pinctrl: samsung: Move retention control from mach-s5pv210 " Marek Szyprowski
2017-01-16 6:45 ` [PATCH 12/12] pinctrl: samsung: Replace syscore ops with standard platform device pm_ops Marek Szyprowski
2017-01-16 19:23 ` [PATCH 00/12] Move pad retention control to Exynos pin controller driver Krzysztof Kozlowski
2017-01-16 19:50 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1484549107-5957-2-git-send-email-m.szyprowski@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=krzk@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=s.nawrocki@samsung.com \
--cc=tomasz.figa@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox