From patchwork Thu Jan 19 13:48:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9525873 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 B645D601AE for ; Thu, 19 Jan 2017 13:51:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7EA128517 for ; Thu, 19 Jan 2017 13:51:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9CC452851B; Thu, 19 Jan 2017 13:51:04 +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 3985428517 for ; Thu, 19 Jan 2017 13:51:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752855AbdASNvA (ORCPT ); Thu, 19 Jan 2017 08:51:00 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:41643 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752738AbdASNtp (ORCPT ); Thu, 19 Jan 2017 08:49:45 -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 <0OK100GH851TDE70@mailout1.w1.samsung.com>; Thu, 19 Jan 2017 13:49:05 +0000 (GMT) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170119134905eucas1p209417b3b5be9f213474f6aa256b1d8d6~bMGyaM-k40537905379eucas1p2Y; Thu, 19 Jan 2017 13:49:05 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges4.samsung.com (EUCPMTA) with SMTP id 92.6F.28517.0D3C0885; Thu, 19 Jan 2017 13:49:04 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170119134904eucas1p153a1d5b2ff9826c88293b6a8fe5140bc~bMGxvHTcb0980309803eucas1p1U; Thu, 19 Jan 2017 13:49:04 +0000 (GMT) X-AuditID: cbfec7f4-f79716d000006f65-d1-5880c3d02e58 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id A0.31.06687.A04C0885; Thu, 19 Jan 2017 13:50:02 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OK100BYG51LGB30@eusync1.samsung.com>; Thu, 19 Jan 2017 13:49:04 +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 v3 01/13] soc: samsung: pmu: Provide global function to get PMU regmap Date: Thu, 19 Jan 2017 14:48:41 +0100 Message-id: <1484833733-16082-2-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1484833733-16082-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFIsWRmVeSWpSXmKPExsWy7djP87oXDjdEGFz+amaxccZ6Vovz5zew W0z5s5zJYtPja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kADDs4B7sFK+nYJbhkn9h5nLXgmUHFwi3kD41S+LkZODgkBE4nz //pZIGwxiQv31rN1MXJxCAksYZQ4t2wrM4TTxCRx+fY1VpAqNgFDia63XWBVIgLNjBINS3rB HGaBCUwSMz81MHUxcnAIC0RIHNxZBdLAIqAqsXRnJzuIzSvgIbFl8X02iHVyEiePTQYbying KTF1ThNYXAioZsnSi6wTGHkXMDKsYhRJLS3OTc8tNtQrTswtLs1L10vOz93ECAz5bcd+bt7B eGlj8CFGAQ5GJR7ejqL6CCHWxLLiytxDjBIczEoivDZ7GyKEeFMSK6tSi/Lji0pzUosPMZoC HTWRWUo0OR8Yj3kl8YYmhuaWhkbGFhbmRkZK4rwlH66ECwmkJ5akZqemFqQWwfQxcXBKNTDy 58xY8jRVSmn6A6njc6ySMq9m/BE88NkqIK/rgTBL160VrknPtzaJ971cxLH74WyJfY/M/0pk idcoPTJ92F32/NNNk5NB9aeXfL305uFC1XiRttvyeqvDY6+9U0u71jKrIVPS4mx2gQAf71Tf GUIeR0Q5ru+tae98+n5b2rxTHwP2rvQwN5yixFKckWioxVxUnAgAS6kz7Y8CAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170119134904eucas1p153a1d5b2ff9826c88293b6a8fe5140bc 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: 20170119134904eucas1p153a1d5b2ff9826c88293b6a8fe5140bc X-RootMTR: 20170119134904eucas1p153a1d5b2ff9826c88293b6a8fe5140bc References: <1484833733-16082-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 Reviewed-by: Tomasz Figa --- drivers/soc/samsung/exynos-pmu.c | 11 +++++++++++ include/linux/soc/samsung/exynos-pmu.h | 10 ++++++++++ 2 files changed, 21 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..e57eb4b6cc5a 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 +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 */