From patchwork Mon Jan 16 06:44:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 91530 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1290669qgi; Sun, 15 Jan 2017 22:45:39 -0800 (PST) X-Received: by 10.84.212.144 with SMTP id e16mr48162476pli.140.1484549139546; Sun, 15 Jan 2017 22:45:39 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o8si20584929pgi.313.2017.01.15.22.45.39; Sun, 15 Jan 2017 22:45:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751412AbdAPGph (ORCPT + 13 others); Mon, 16 Jan 2017 01:45:37 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:59749 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751260AbdAPGp2 (ORCPT ); Mon, 16 Jan 2017 01:45:28 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OJV007R21FOAI50@mailout1.w1.samsung.com>; Mon, 16 Jan 2017 06:45:24 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170116064524eucas1p223ae7103f4896cc7ef91b250a2b948fe~aLZAhxWz52664726647eucas1p2x; Mon, 16 Jan 2017 06:45:24 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3.samsung.com (EUCPMTA) with SMTP id A5.77.09557.30C6C785; Mon, 16 Jan 2017 06:45:23 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170116064523eucas1p18a55f951566df5ddd978364486154931~aLY-5wb7Q0676406764eucas1p1N; Mon, 16 Jan 2017 06:45:23 +0000 (GMT) X-AuditID: cbfec7f2-f790f6d000002555-49-587c6c03cd80 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 64.9B.06687.B3C6C785; Mon, 16 Jan 2017 06:46:19 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OJV00BS81FJUN70@eusync2.samsung.com>; Mon, 16 Jan 2017 06:45:23 +0000 (GMT) From: Marek Szyprowski 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 , Sylwester Nawrocki , Krzysztof Kozlowski , Linus Walleij , Tomasz Figa , Bartlomiej Zolnierkiewicz 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 Message-id: <1484549107-5957-2-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1484549107-5957-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBIsWRmVeSWpSXmKPExsWy7djP87rMOTURBrt+W1tsnLGe1eL8+Q3s FlP+LGey2PT4GqvF5vl/GC0+9x5htJhxfh+Txdojd9ktDr9pZ7VYtesPowOXx85Zd9k9Nq3q ZPO4c20Pm8fmJfUefVtWMXp83iQXwBbFZZOSmpNZllqkb5fAlbHvdnzBJ4GKH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WJWIQDOjRMOSXjCH WWACk8TMTw1MIFXCAkkSbe9/gM1lEVCV+NXTwgJi8wq4S/yd84wRYp+cxMljk8FqOAU8JCbu awWrEQKqmfFqKvMERt4FjAyrGEVSS4tz03OLDfWKE3OLS/PS9ZLzczcxAkN+27Gfm3cwXtoY fIhRgINRiYf3x67qCCHWxLLiytxDjBIczEoivG6ZNRFCvCmJlVWpRfnxRaU5qcWHGE2BjprI LCWanA+Mx7ySeEMTQ3NLQyNjCwtzIyMlcd6SD1fChQTSE0tSs1NTC1KLYPqYODilGhi1TzSs PxPxd069zv3QiOtLShWqb1y1m+AUceWy80yHbvWQ5dFtdteDWZ+fuHBfr8Ux1dqps2P5jLfX NuYts7+gfy3hZcrfsP7Z9pfbrO/c600pXLpnOueZlA7jFXopZtfn9gS/OPOS49ye7Es7Twdp cuus26204I6SKMdlnxbHbSln1efHJK1VYinOSDTUYi4qTgQAlG2NNI8CAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170116064523eucas1p18a55f951566df5ddd978364486154931 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170116064523eucas1p18a55f951566df5ddd978364486154931 X-RootMTR: 20170116064523eucas1p18a55f951566df5ddd978364486154931 References: <1484549107-5957-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 --- drivers/soc/samsung/exynos-pmu.c | 1 + include/linux/soc/samsung/exynos-pmu.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 +#include +#include + 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 */