From patchwork Fri Jan 27 14:48:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9541991 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 6AE0B60415 for ; Fri, 27 Jan 2017 14:53:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CABE28174 for ; Fri, 27 Jan 2017 14:53:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 514642817F; Fri, 27 Jan 2017 14:53: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=unavailable 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 CECB928174 for ; Fri, 27 Jan 2017 14:53:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755001AbdA0OvD (ORCPT ); Fri, 27 Jan 2017 09:51:03 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:46108 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754919AbdA0Ot0 (ORCPT ); Fri, 27 Jan 2017 09:49:26 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OKG008VY15XMC30@mailout4.w1.samsung.com>; Fri, 27 Jan 2017 14:49:09 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170127144908eucas1p2956a7cbf595a2de15620da66ed4af14c~dqFg2p8_f1893318933eucas1p2f; Fri, 27 Jan 2017 14:49:08 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 16.46.09557.4ED5B885; Fri, 27 Jan 2017 14:49:08 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170127144908eucas1p14c50396f670a01c31a69ec95b636a0e1~dqFgPOgt90150101501eucas1p1j; Fri, 27 Jan 2017 14:49:08 +0000 (GMT) X-AuditID: cbfec7f2-f790f6d000002555-1e-588b5de46fe1 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id D4.5F.06687.52E5B885; Fri, 27 Jan 2017 14:50:13 +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 <0OKG00L9615S2LA0@eusync2.samsung.com>; Fri, 27 Jan 2017 14:49:08 +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 v2 4/4] soc: samsung: pm_domains: Provide real name for all supported domains Date: Fri, 27 Jan 2017 15:48:58 +0100 Message-id: <1485528538-30256-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1485514072-29502-5-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLIsWRmVeSWpSXmKPExsWy7djPc7pPYrsjDH4e1LDYOGM9q8X1L89Z LSbdn8Bi8ebtGiaL8+c3sFt87j3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uYFyh2MXIwSEhYCKxZUVgFyMnkCkmceHeerYu Ri4OIYEljBKzGnZDOU1MEjuP7GIFqWITMJToetvFBmKLCNhL3H6yjB2kiFlgL5PE5akvmEAS wgLxEp8bZzGD2CwCqhIXNz8Da+YV8JC4fL6BDWKdnMTJY5PB4pwCnhL3Pl8HiwsB1XT23GWd wMi7gJFhFaNIamlxbnpusaFecWJucWleul5yfu4mRmBYbzv2c/MOxksbgw8xCnAwKvHwRsh3 RQixJpYVV+YeYpTgYFYS4Q0N7o4Q4k1JrKxKLcqPLyrNSS0+xGgKdNREZinR5HxgzOWVxBua GJpbGhoZW1iYGxkpifOWfLgSLiSQnliSmp2aWpBaBNPHxMEp1cBYWc67P4dD03BaXvyUF1/L fn22Pqa4fpbKcf/b3vULOiXfzL8VWySwQyL5/iN9yRl3Y8WLvY4k7c82NbRTUNcxvRMb0ZLb q+53+sS59wqmqR9roy//NNR/NPW3SajUlXv7pknYWZfVTj5ySHS+5Ooghu/PZJWmLvOec/fM +gy5G8Lv8iP/5GkpsRRnJBpqMRcVJwIArSxypYECAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170127144908eucas1p14c50396f670a01c31a69ec95b636a0e1 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: 20170127144908eucas1p14c50396f670a01c31a69ec95b636a0e1 X-RootMTR: 20170127144908eucas1p14c50396f670a01c31a69ec95b636a0e1 References: <1485514072-29502-5-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 --- Changelog: v2: - sorted all domains data by domain base address in the arrays --- 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..43003318b948 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 }, + { "CAM0", 0x105c4020 }, + { "MSCL", 0x105c4040 }, + { "G3D", 0x105c4060 }, + { "DISP", 0x105c4080 }, + { "CAM1", 0x105c40a0 }, + { "AUD", 0x105c40c0 }, + { "FSYS", 0x105c40e0 }, + { "G2D", 0x105c4120 }, + { "ISP", 0x105c4140 }, + { "MFC", 0x105c4180 }, + { "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);