From patchwork Tue Jan 17 12:44:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9520859 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 73CB460244 for ; Tue, 17 Jan 2017 13:17:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A42726E4E for ; Tue, 17 Jan 2017 13:17:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E92F2842E; Tue, 17 Jan 2017 13:17:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D3E426E4E for ; Tue, 17 Jan 2017 13:17:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751081AbdAQNRK (ORCPT ); Tue, 17 Jan 2017 08:17:10 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:12031 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751063AbdAQNRH (ORCPT ); Tue, 17 Jan 2017 08:17:07 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OJX005Y1CQY0E60@mailout1.w1.samsung.com>; Tue, 17 Jan 2017 12:44:58 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170117124457eucas1p29f6b3ace9833bdacb6a66d21f858b58b~aj8OfNp2k0762907629eucas1p25; Tue, 17 Jan 2017 12:44:57 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 07.66.17477.9C11E785; Tue, 17 Jan 2017 12:44:57 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170117124456eucas1p1d42d11aa2117caed8d89faa8c09e6218~aj8Nyod_02833328333eucas1p1h; Tue, 17 Jan 2017 12:44:56 +0000 (GMT) X-AuditID: cbfec7f5-f79d06d000004445-75-587e11c979fe Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id F0.A5.06687.1021E785; Tue, 17 Jan 2017 12:45:53 +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 <0OJX00GNRCQPHB20@eusync2.samsung.com>; Tue, 17 Jan 2017 12:44:56 +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 v2 01/13] soc: samsung: pmu: Provide global function to get PMU regmap Date: Tue, 17 Jan 2017 13:44:32 +0100 Message-id: <1484657084-26227-2-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1484657084-26227-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLIsWRmVeSWpSXmKPExsWy7djPc7onBesiDJZfEbDYOGM9q8X58xvY Lab8Wc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oS8wpBfKMDNCAg3OAe7CSvl2CW8a6ea9YC1YKVHT/PMvewPiAt4uRk0NCwERi 5q+DLBC2mMSFe+vZuhi5OIQEljBK3HqxhQXCaWKSeLvzCytIFZuAoUTX2y6wKhGBZkaJhiW9 YA6zwAQmiZmfGphAqoQFIiTmXX3DDmKzCKhK/Dh0hA3E5hXwkNg+7wwjxD45iZPHJoNN5RTw lPjxcz1YrxBQzfn7+1gnMPIuYGRYxSiSWlqcm55bbKhXnJhbXJqXrpecn7uJERj224793LyD 8dLG4EOMAhyMSjy8DrdrIoRYE8uKK3MPMUpwMCuJ8M4VqIsQ4k1JrKxKLcqPLyrNSS0+xGgK dNREZinR5HxgTOaVxBuaGJpbGhoZW1iYGxkpifOWfLgSLiSQnliSmp2aWpBaBNPHxMEp1cDI Uckm8TGNa0vym3krPAwEfmSYnOyKeV511mC2zQ3r/62lB4QWaUU+Nf9ZafNWeA6XQiLDFOW9 0W7h/5tN7xS9X+i4bOHSdsacB5xbM5Zu++/asN5i4lOf6tDAirkWaXoXvsgI8mSeUkn4GOkV finOLb31Vm+qBtfJ8CkHjjjmFCSfX2uVVabEUpyRaKjFXFScCABBUSftkQIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170117124456eucas1p1d42d11aa2117caed8d89faa8c09e6218 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170117124456eucas1p1d42d11aa2117caed8d89faa8c09e6218 X-RootMTR: 20170117124456eucas1p1d42d11aa2117caed8d89faa8c09e6218 References: <1484657084-26227-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP PMU is something like a SoC wide service, so add a helper function to get PMU regmap. This will be used by other Exynos device drivers. This way it can be avoided to model this dependency in device tree (as phandles to PMU node) for almost every device in the SoC. Signed-off-by: Marek Szyprowski --- drivers/soc/samsung/exynos-pmu.c | 11 +++++++++++ include/linux/soc/samsung/exynos-pmu.h | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/soc/samsung/exynos-pmu.c b/drivers/soc/samsung/exynos-pmu.c index 0acdfd82e751..5c269bf23210 100644 --- a/drivers/soc/samsung/exynos-pmu.c +++ b/drivers/soc/samsung/exynos-pmu.c @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -92,6 +93,16 @@ void exynos_sys_powerdown_conf(enum sys_powerdown mode) { /*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; diff --git a/include/linux/soc/samsung/exynos-pmu.h b/include/linux/soc/samsung/exynos-pmu.h index e2e9de1acc5b..2a841a474684 100644 --- a/include/linux/soc/samsung/exynos-pmu.h +++ b/include/linux/soc/samsung/exynos-pmu.h @@ -12,6 +12,8 @@ #ifndef __LINUX_SOC_EXYNOS_PMU_H #define __LINUX_SOC_EXYNOS_PMU_H +#include + enum sys_powerdown { SYS_AFTR, SYS_LPA, @@ -20,5 +22,10 @@ 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 NULL; } +#endif #endif /* __LINUX_SOC_EXYNOS_PMU_H */