From patchwork Fri Jan 27 10:47:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9541037 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 170D160429 for ; Fri, 27 Jan 2017 10:49:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E12B2029C for ; Fri, 27 Jan 2017 10:49:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02F6527F9F; Fri, 27 Jan 2017 10:49:49 +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 B718F20649 for ; Fri, 27 Jan 2017 10:49:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932604AbdA0Ktr (ORCPT ); Fri, 27 Jan 2017 05:49:47 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:10635 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932679AbdA0KsM (ORCPT ); Fri, 27 Jan 2017 05:48:12 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OKF00LXJQ04JC70@mailout3.w1.samsung.com>; Fri, 27 Jan 2017 10:48:04 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170127104803eucas1p179da728317474857f1aeb937455f0eff~dmzAv71NQ2980829808eucas1p1k; Fri, 27 Jan 2017 10:48:03 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges5.samsung.com (EUCPMTA) with SMTP id FD.BF.17477.3652B885; Fri, 27 Jan 2017 10:48:03 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170127104802eucas1p121f5f44f8a047ad9b5118a37f66ea032~dmzAFO9Oc2980829808eucas1p1j; Fri, 27 Jan 2017 10:48:02 +0000 (GMT) X-AuditID: cbfec7f5-f79d06d000004445-1e-588b2563a37c Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 11.E0.06687.3A52B885; Fri, 27 Jan 2017 10:49:07 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OKF003YLPZX2Z80@eusync4.samsung.com>; Fri, 27 Jan 2017 10:48:02 +0000 (GMT) From: Marek Szyprowski To: linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Krzysztof Kozlowski , Javier Martinez Canillas , Bartlomiej Zolnierkiewicz , Chanwoo Choi , Inki Dae Subject: [PATCH 4/4] soc: samsung: pm_domains: Provide real name for all supported domains Date: Fri, 27 Jan 2017 11:47:52 +0100 Message-id: <1485514072-29502-5-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1485514072-29502-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLIsWRmVeSWpSXmKPExsWy7djP87rJqt0RBm9Ws1lsnLGe1eL6l+es FpPuT2CxePN2DZPF+fMb2C0+9x5htJhxfh+Txd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4eEgInEz7fPGCFsMYkL99azdTFy cQgJLGGU+H1jPTOE08QksXzyZ1aQKjYBQ4mut11sILaIgL3E7SfL2EGKmAX2MklcnvqCCSQh LBAjcWLKVbAGFgFViQ2rT4LFeQU8JL4uusECsU5O4uSxyWA1nAKeEuc2zACzhYBq1q57wDqB kXcBI8MqRpHU0uLc9NxiQ73ixNzi0rx0veT83E2MwMDeduzn5h2MlzYGH2IU4GBU4uGNkO+K EGJNLCuuzD3EKMHBrCTCqyvWHSHEm5JYWZValB9fVJqTWnyI0RToqInMUqLJ+cCoyyuJNzQx NLc0NDK2sDA3MlIS5y35cCVcSCA9sSQ1OzW1ILUIpo+Jg1OqgXHS55bTyed5GC5H+ORNPOFW GFFyUH6VX0NDuOOcHcYB7z5PC/efL2rsq2+Yr3VXycqh7JBlYsCVc/96Kv84FHsu8548uybR /6nl24tC26KePVL93jOjtu76/aSSSON1NaJWzq2/Q8v2dCnMbH62z6K7gGFpUESsuFD9nPeH /zT03OqadOjFTiWW4oxEQy3mouJEAJ9hGWOCAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170127104802eucas1p121f5f44f8a047ad9b5118a37f66ea032 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: 20170127104802eucas1p121f5f44f8a047ad9b5118a37f66ea032 X-RootMTR: 20170127104802eucas1p121f5f44f8a047ad9b5118a37f66ea032 References: <1485514072-29502-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 Device tree nodes for each power domain should use generic "power-domain" name, so using it as a domain name doesn't give much benefits. This patch adds human readable names for all supported domains, what makes debugging much easier. Signed-off-by: Marek Szyprowski --- drivers/soc/samsung/pm_domains.c | 125 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 123 insertions(+), 2 deletions(-) diff --git a/drivers/soc/samsung/pm_domains.c b/drivers/soc/samsung/pm_domains.c index 5a0a46bcbe18..67d385eaab63 100644 --- a/drivers/soc/samsung/pm_domains.c +++ b/drivers/soc/samsung/pm_domains.c @@ -30,6 +30,17 @@ struct exynos_pm_domain_config { u32 local_pwr_cfg; }; +struct exynos_pm_domain_data { + const char *name; + u32 base; +}; + +struct exynos_pm_domain_soc_data { + const char *compatible; + unsigned int nr_domains; + const struct exynos_pm_domain_data *domains; +}; + /* * Exynos specific wrapper around the generic power domain */ @@ -123,6 +134,91 @@ static int exynos_pd_power_off(struct generic_pm_domain *domain) return exynos_pd_power(domain, false); } +static const struct exynos_pm_domain_data exynos4210_domains[] __initconst = { + { "LCD1", 0x10023CA0 }, +}; + +static const struct exynos_pm_domain_data exynos4412_domains[] __initconst = { + { "CAM", 0x10023C00 }, + { "TV", 0x10023C20 }, + { "MFC", 0x10023C40 }, + { "G3D", 0x10023C60 }, + { "LCD0", 0x10023C80 }, + { "ISP", 0x10023CA0 }, + { "GPS", 0x10023CE0 }, + { "GPS alive", 0x10023D00 }, +}; + +static const struct exynos_pm_domain_data exynos5250_domains[] __initconst = { + { "GSCL", 0x10044000 }, + { "ISP", 0x10044020 }, + { "MFC", 0x10044040 }, + { "G3D", 0x10044060 }, + { "DISP1", 0x100440A0 }, + { "MAU", 0x100440C0 }, +}; + +static const struct exynos_pm_domain_data exynos542x_domains[] __initconst = { + { "SCALER", 0x10044000 }, + { "ISP", 0x10044020 }, + { "MFC", 0x10044060 }, + { "G3D", 0x10044080 }, + { "DISP1", 0x100440C0 }, + { "MAU", 0x100440E0 }, + { "G2D", 0x10044100 }, + { "MSCL", 0x10044120 }, + { "FSYS", 0x10044140 }, + { "PERIC", 0x100441A0 }, + { "CAM", 0x10045100 }, +}; + +static const struct exynos_pm_domain_data exynos5433_domains[] __initconst = { + { "GSCL", 0x105c4000 }, + { "MSCL", 0x105c4040 }, + { "DISP", 0x105c4080 }, + { "MFC", 0x105c4180 }, + { "CAM0", 0x105c4020 }, + { "CAM1", 0x105c40a0 }, + { "ISP", 0x105c4140 }, + { "G2D", 0x105c4120 }, + { "G3D", 0x105c4060 }, + { "AUD", 0x105c40c0 }, + { "FSYS", 0x105c40e0 }, + { "HEVC", 0x105c41c0 }, +}; + +static const struct exynos_pm_domain_soc_data soc_domains_data[] __initconst = { + { /* Exynos3250 uses a subset of 4412 domains */ + .compatible = "samsung,exynos3250", + .nr_domains = ARRAY_SIZE(exynos4412_domains), + .domains = exynos4412_domains, + }, { /* first check samsung,exynos4210 to detect LCD1 domain */ + .compatible = "samsung,exynos4210", + .nr_domains = ARRAY_SIZE(exynos4210_domains), + .domains = exynos4210_domains, + }, { /* remaining domains for Exynos4210 and 4412 */ + .compatible = "samsung,exynos4", + .nr_domains = ARRAY_SIZE(exynos4412_domains), + .domains = exynos4412_domains + }, { + .compatible = "samsung,exynos5250", + .nr_domains = ARRAY_SIZE(exynos5250_domains), + .domains = exynos5250_domains, + }, { + .compatible = "samsung,exynos5420", + .nr_domains = ARRAY_SIZE(exynos542x_domains), + .domains = exynos542x_domains, + }, { + .compatible = "samsung,exynos5800", + .nr_domains = ARRAY_SIZE(exynos542x_domains), + .domains = exynos542x_domains, + }, { + .compatible = "samsung,exynos5433", + .nr_domains = ARRAY_SIZE(exynos5433_domains), + .domains = exynos5433_domains, + }, +}; + static const struct exynos_pm_domain_config exynos4210_cfg __initconst = { .local_pwr_cfg = 0x7, }; @@ -142,6 +238,32 @@ static int exynos_pd_power_off(struct generic_pm_domain *domain) { }, }; +static __init const char *exynos_get_domain_name(struct device_node *np) +{ + const struct exynos_pm_domain_soc_data *soc = soc_domains_data; + const __be32 *reg; + u64 addr; + int i, j; + + + reg = of_get_property(np, "reg", NULL); + if (!reg || (addr = of_translate_address(np, reg)) == OF_BAD_ADDR) + goto not_found; + + for (i = 0; i < ARRAY_SIZE(soc_domains_data); i++, soc++) { + if (!of_machine_is_compatible(soc->compatible)) + continue; + + for (j = 0; j < soc->nr_domains; j++) { + if (soc->domains[j].base == addr) + return kstrdup_const(soc->domains[j].name, + GFP_KERNEL); + } + } +not_found: + return kstrdup_const(strrchr(np->full_name, '/') + 1, GFP_KERNEL); +} + static __init int exynos4_pm_init_power_domain(void) { struct device_node *np; @@ -159,8 +281,7 @@ static __init int exynos4_pm_init_power_domain(void) of_node_put(np); return -ENOMEM; } - pd->pd.name = kstrdup_const(strrchr(np->full_name, '/') + 1, - GFP_KERNEL); + pd->pd.name = exynos_get_domain_name(np); if (!pd->pd.name) { kfree(pd); of_node_put(np);