From patchwork Fri May 19 13:49:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 9737315 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 3A4DC601A1 for ; Fri, 19 May 2017 13:50:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EB1128881 for ; Fri, 19 May 2017 13:50:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12AF628927; Fri, 19 May 2017 13:50:19 +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=-1.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 46AE428881 for ; Fri, 19 May 2017 13:50:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8jl/Z/V3xcRcMNPah5tMMrPJKCYHGrW1+A+He+AQ4aU=; b=kOpaV/oXdAO0uc ZXIyrJrm4e15maeCDn3xwo5FxqPyniH0IWaIB04qe8UvVge95P3b8qKeFhhJ1xwaqCvQ/ATFQ9GYl pP3QPJiKFzwToy9l5PDbWQc9p8Wb1VGWX6kwiAXuvRpgVAOuALOUWgJzt5MvDbR0wR+K8AG4YoG/6 +mtqo2os2b+aFOECKDZCZ3a3xVNvOxDVV9K1DJ1+gYp2NHxATBnInIke31Pc2JwDZx8MFUL1WM2/m 2gPt+RK11g9o2YiENWBSXFpQZ/3KIKV8Y9ROmsIjNRl6W1FCZhiDMQGv1w62w4J+T+ioPlJxdgeAp Kw4PC2OFavoiSxLHQjKA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dBiIL-0007nb-Mv; Fri, 19 May 2017 13:50:17 +0000 Received: from mail-cys01nam02on0078.outbound.protection.outlook.com ([104.47.37.78] helo=NAM02-CY1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dBiHg-0005dV-4o for linux-arm-kernel@lists.infradead.org; Fri, 19 May 2017 13:49:45 +0000 Received: from BN3PR03CA0111.namprd03.prod.outlook.com (10.174.66.29) by DM2PR0301MB0912.namprd03.prod.outlook.com (10.160.217.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14; Fri, 19 May 2017 13:49:13 +0000 Received: from BN1AFFO11FD032.protection.gbl (2a01:111:f400:7c10::128) by BN3PR03CA0111.outlook.office365.com (2603:10b6:400:4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14 via Frontend Transport; Fri, 19 May 2017 13:49:14 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; arm.linux.org.uk; dkim=none (message not signed) header.d=none; arm.linux.org.uk; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD032.mail.protection.outlook.com (10.58.52.186) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1075.5 via Frontend Transport; Fri, 19 May 2017 13:49:12 +0000 Received: from b29396-OptiPlex-7040.ap.freescale.net (b29396-OptiPlex-7040.ap.freescale.net [10.192.242.182]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v4JDmtEN032293; Fri, 19 May 2017 06:49:04 -0700 From: Dong Aisheng To: Subject: [PATCH V3 1/3] clk: add clk_bulk_get accessories Date: Fri, 19 May 2017 21:49:04 +0800 Message-ID: <1495201746-31841-2-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495201746-31841-1-git-send-email-aisheng.dong@nxp.com> References: <1495201746-31841-1-git-send-email-aisheng.dong@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131396753526661250; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39380400002)(39400400002)(39850400002)(39840400002)(39450400003)(39860400002)(39410400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(54534003)(9170700003)(39060400002)(6916009)(2950100002)(498600001)(105606002)(356003)(6306002)(53936002)(47776003)(33646002)(86362001)(36756003)(2906002)(76176999)(77096006)(50986999)(7416002)(8656002)(104016004)(2351001)(5660300001)(54906002)(4326008)(85426001)(189998001)(8936002)(8676002)(5003940100001)(106466001)(110136004)(38730400002)(50466002)(48376002)(50226002)(81166006)(305945005)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0301MB0912; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD032; 1:laT36/vp/7oQs91qlhg9GzN8zHsm0PTqBRr81SQCbZVN2g+K+4JHZY9/H/LLvVuQxIWDi/pdXQ4C/Fo8Hw40iwAzDS2gVJEyRFiqhIFaX/DdP+MHHKDENLC2P/TUasEqL/p4BYYDiezjFY4oIb6LPRumDjkLEnFLLAL4uUpNrsuxAuGx/Rk6n/NJCgKkfNPrWXcvlSXV4o8nrLKAFHTcWJYpqhh/QD22AXaUPuzCPRjri+Wv/QPE4dCzfktwkS+qf0w3/Ld91ALrSN7Yg82hGrBCwbxvmPIcQRGhDHEDjQyxmo3FHTg7+6PQAst7nUD5B4jo5zatFYMU7DkyliOsDuNZTT6ZrRUtD6hK/XqsT8lK8ysGVHyKUH/uk4C4FLbfRvoJJr2Z90WcGf6ieskrjv8sKFZnbOD4Bq4ZlDaCyk2BBDKUeMyLv6IzY8T901MS8Z8ZJt65s+pjnr6nDn6n88uIsLSd+R2LI1RGsX3+aiYBnZ4oyeigAtu+Mg1AJbtIzxvcT00U4BWJzIdRqMJMcvq7LHH+m9LzAoHpjtdwQOu9IUV3tgKTkjJi/+S0HnclxCdEDQiTDTC5SwNFYxrSz7VU2/gmfmPtOBFmtkRSXkap8YKW7UWNgcAbZRjBFhav MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM2PR0301MB0912: X-MS-Office365-Filtering-Correlation-Id: 6e4b906b-155c-4c3c-3f21-08d49ebdd50d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:DM2PR0301MB0912; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0912; 3:jqVhiSiZXvUsUntqgWNalKr+aSLylaW05ED2qCxtoZ5gCW0GR/jkP1LA5oM0fUJLI0OY6GLAV9nM4xE1Q8+j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EqQ/dSzlqXx78bvVtZnJoA5yiWDG+fBpmQkHqN0AXDtlKjqn3Qd5IM776np106zvxwYQWRWRKjAhjOQi+Pyo4/K7XNJbUeTvFbBKwoR472lbDv2OQEWU= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(22074186197030)(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(5005006)(13015025)(13017025)(13024025)(13023025)(13018025)(8121501046)(93006095)(93001095)(10201501046)(3002001)(6055026)(6096035)(20161123561025)(20161123563025)(20161123559100)(20161123565025)(20161123556025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150); SRVR:DM2PR0301MB0912; BCL:0; PCL:0; RULEID:(400006); SRVR:DM2PR0301MB0912; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0301MB0912; 4:OGUUIgk2VmLNEt7q4qRynwfpQoRfr5QNo4Ir6aBm?= =?us-ascii?Q?IO5d6v1UbE09t05nG1e3r514mX/Kd8YNPXQSRcw5vigspU0oyS62v+pVyMEW?= =?us-ascii?Q?UiXLJamGB3LfsE0XLudaq5CCDbPrr9pDAD49m7CJGmCrqIaX89vNCd6bXhiy?= =?us-ascii?Q?Xgina5jTpFxDlAYq8wlaR7VaLbv+o3uf3iftp/r6RxPU3zFAHDO7y4ulFFxI?= =?us-ascii?Q?AIiO39VBOCaDdyYP+HNOoBRaXckOoBD358ju1ntVDp2YbUFjownMTQ2255r/?= =?us-ascii?Q?LKpb+ugVH4Nz2SSOPlPHw0HDiAlWx40FTNBO/MbCbu/6Fhsv8aHqWWUPYUEo?= =?us-ascii?Q?EyJYheaXUM65fI3rQPE7Qm6WCT1VqX2NgD8D7YoGIW/MeLLbWIhtBk8OEyNv?= =?us-ascii?Q?YhCXQfRFVtu2yENDxvZIkBYDHAHESz0ap5qit2rB7Wvk2YnG0XDRIU8rbrvC?= =?us-ascii?Q?RTr22AljYQjfSBrBAwovoSWmKwyze9K1UIydJ/eJR++jkfyyMeDPuwKWLdZW?= =?us-ascii?Q?DDoyradIze2X0iUg7KOZ10Q8bSZS6Tz1jlsyDD8rs1OgZPwZMD7qZM4lqgSj?= =?us-ascii?Q?4343Vd2vwwmHCegAyTu4u8dLN+Fi9AST1pPUTp9F3G2rWGspjO3kKsI2atw+?= =?us-ascii?Q?ra8wsv1cpa1w7ShVO24kVqIEEwTSRAmbg7fWJJVS8+4xi0TZfCLV3AkxXhEO?= =?us-ascii?Q?G2mf0p5Z23962BZtnkJWgxGklOXuHu5a22liXn2uj7WT8YiTv86v1HDAic+E?= =?us-ascii?Q?/vVC0qKEBInbEynpujhheJEGeR4FQt9fIspr42FslhRSmuL4H4rOPNpiiQbO?= =?us-ascii?Q?Ku6QSOvWwbjTKELIwSyZBiYbBLp3opB5swVtyUxaazGvEa8adya92VLytnqp?= =?us-ascii?Q?l6ztyUM9/t2+0HV+JVB2+OvJup7I1/iVBAxjAJqfw46Ss2bvfvjaS1e3DWD1?= =?us-ascii?Q?GFyVgd7DMh44bFHPlfPgZzogQrgDSlIp/Mw/5PfBhzZS43ANOS5w5yDP4s6p?= =?us-ascii?Q?oYIINLrthvD6k/R9WNSyl3r1qT8BLaibZSefGhr/30dnUw=3D=3D?= X-Forefront-PRVS: 031257FE13 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0301MB0912; 23:sIGu49nqAFlwXwdiozwlrpJTKlzXXeln0JRbSWF?= =?us-ascii?Q?eZgrf/o3Spx7lDApToNPBuB0i9xGkX1u3giT/KTBII57BBmMng5+kfgYUVkb?= =?us-ascii?Q?mZhfYkmP2GZwT3YQpwIaBbHb0Oqntp183moiT9ccvaG+Zy/YD58kezwpO//Q?= =?us-ascii?Q?2H0Vbn3fRoswVWuJKtje9L3koAhsXT2x8WppKyLeA+np9nPHNoUB0bRNEY26?= =?us-ascii?Q?GMNV8y9jD46J8HpaY8ZmxmVhpCbMle4QsOaQ6hdrTPGsBFo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yXkY5k/najZzHuOX17EZVzMQNSWBl6ymt7B5JT1HH0QcU8i3kxfYEFJZk5iS5g= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0912; 7:VxPGfzTOGX9vCSCjsp52MAt8w/BdSu1Be4WfiyoThQRxDyDv+lNw9NfX8zwsysvNze9215lKGf2bDg5agSdAvxQ32pT+C7CwpcmIXR22+pqz8IaRMWG8c4+zex2k4iTGw8+NGyKzMSgYi9xVhMIJvvhRyn6cphzQotIyvKDaJSvUytBTGATgXXgKhNyVTzZuC1s18kveVgyOvGP8Vd18JeF9ZtjeqH1ciJN/jaVfAC4fjUlA3U13/lG2Z7FPCPEAkc6GSd6Ut1pe8HuzFcIlSro8bpmSgkRhhoSHXiCxYTTjESXYFTd5GNW5cWYonld0YQvS+UUXas65U/7EfyTMrQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2017 13:49:12.3697 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0301MB0912 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170519_064936_626422_C46DC674 X-CRM114-Status: GOOD ( 22.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aisheng.dong@nxp.com, leonard.crestez@nxp.com, Russell King , ping.bai@nxp.com, anson.huang@nxp.com, viresh.kumar@linaro.org, mturquette@baylibre.com, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, linux@armlinux.org.uk, broonie@kernel.org, geert@linux-m68k.org, octavian.purdila@nxp.com, kernel@pengutronix.de, fabio.estevam@nxp.com, f.fainelli@gmail.com, yibin.gong@nxp.com, shawnguo@kernel.org, sboyd@codeaurora.org, linux-arm-kernel@lists.infradead.org, dongas86@gmail.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP These helper function allows drivers to get several clk consumers in one operation. If any of the clk cannot be acquired then any clks that were got will be put before returning to the caller. This can relieve the driver owners' life who needs to handle many clocks, as well as each clock error reporting. Cc: Michael Turquette Cc: Stephen Boyd Cc: Russell King Cc: Geert Uytterhoeven Cc: "Rafael J. Wysocki" Cc: Viresh Kumar Cc: Mark Brown Cc: Shawn Guo Cc: Fabio Estevam Cc: Sascha Hauer Cc: Anson Huang Cc: Robin Gong Cc: Bai Ping Cc: Leonard Crestez Cc: Octavian Purdila Signed-off-by: Dong Aisheng --- ChangeLog: v2->v3: * release resource in reversed order in case an error according to Geert Uytterhoeven's suggestion v1->v2: * fix comments of clk_bulk_get that only one dev is possible with the API. * Comments 'bulk of clock source' replaced by 'set of clks' * Mark clk_bulk_data structure as const for the following API: clk_bulk_{enable|disable} clk_bulk_{prepare|unprepare} Except clk_bulk_{get|put} which needs update clk_bulk_date * Introduce clk-bulk.c to centrally handle bulk_clks, especially moving platform independant clk_bulk_{get|put} out of clkdev.c which depends on CONFIG_CLKDEV_LOOKUP and is used in devm_clk_bulk_get(clk-devres.c) later which is independant of CONFIG_CLKDEV_LOOKUP. * Should call clk_disable in error path of clk_bulk_enable * Fix a build warning of clk_bulk_get in !CONFIG_COMMON_CLK case * Add __must_check anatation in function definition as well to make it more explicitly --- drivers/clk/Makefile | 2 +- drivers/clk/clk-bulk.c | 157 +++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/clk.h | 111 ++++++++++++++++++++++++++++++++++ 3 files changed, 269 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/clk-bulk.c diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index c19983a..ed1e99f 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -1,5 +1,5 @@ # common clock types -obj-$(CONFIG_HAVE_CLK) += clk-devres.o +obj-$(CONFIG_HAVE_CLK) += clk-devres.o clk-bulk.o obj-$(CONFIG_CLKDEV_LOOKUP) += clkdev.o obj-$(CONFIG_COMMON_CLK) += clk.o obj-$(CONFIG_COMMON_CLK) += clk-divider.o diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c new file mode 100644 index 0000000..c834f5a --- /dev/null +++ b/drivers/clk/clk-bulk.c @@ -0,0 +1,157 @@ +/* + * Copyright 2017 NXP + * + * Dong Aisheng + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include + +void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) +{ + while (--num_clks >= 0) { + clk_put(clks[num_clks].clk); + clks[num_clks].clk = NULL; + } +} +EXPORT_SYMBOL_GPL(clk_bulk_put); + +int __must_check clk_bulk_get(struct device *dev, int num_clks, + struct clk_bulk_data *clks) +{ + int ret; + int i; + + for (i = 0; i < num_clks; i++) + clks[i].clk = NULL; + + for (i = 0; i < num_clks; i++) { + clks[i].clk = clk_get(dev, clks[i].id); + if (IS_ERR(clks[i].clk)) { + ret = PTR_ERR(clks[i].clk); + dev_err(dev, "Failed to get clk '%s': %d\n", + clks[i].id, ret); + clks[i].clk = NULL; + goto err; + } + } + + return 0; + +err: + clk_bulk_put(i, clks); + + return ret; +} +EXPORT_SYMBOL(clk_bulk_get); + +#ifdef CONFIG_HAVE_CLK_PREPARE + +/** + * clk_bulk_unprepare - undo preparation of a set of clock sources + * @num_clks: the number of clk_bulk_data + * @clks: the clk_bulk_data table being unprepared + * + * clk_bulk_unprepare may sleep, which differentiates it from clk_bulk_disable. + * Returns 0 on success, -EERROR otherwise. + */ +void clk_bulk_unprepare(int num_clks, const struct clk_bulk_data *clks) +{ + while (--num_clks >= 0) + clk_unprepare(clks[num_clks].clk); +} +EXPORT_SYMBOL_GPL(clk_bulk_unprepare); + +/** + * clk_bulk_prepare - prepare a set of clocks + * @num_clks: the number of clk_bulk_data + * @clks: the clk_bulk_data table being prepared + * + * clk_bulk_prepare may sleep, which differentiates it from clk_bulk_enable. + * Returns 0 on success, -EERROR otherwise. + */ +int __must_check clk_bulk_prepare(int num_clks, + const struct clk_bulk_data *clks) +{ + int ret; + int i; + + for (i = 0; i < num_clks; i++) { + ret = clk_prepare(clks[i].clk); + if (ret) { + pr_err("Failed to prepare clk '%s': %d\n", + clks[i].id, ret); + goto err; + } + } + + return 0; + +err: + clk_bulk_unprepare(i, clks); + + return ret; +} + +#endif /* CONFIG_HAVE_CLK_PREPARE */ + +/** + * clk_bulk_disable - gate a set of clocks + * @num_clks: the number of clk_bulk_data + * @clks: the clk_bulk_data table being gated + * + * clk_bulk_disable must not sleep, which differentiates it from + * clk_bulk_unprepare. clk_bulk_disable must be called before + * clk_bulk_unprepare. + */ +void clk_bulk_disable(int num_clks, const struct clk_bulk_data *clks) +{ + + while (--num_clks >= 0) + clk_disable(clks[num_clks].clk); +} +EXPORT_SYMBOL_GPL(clk_bulk_disable); + +/** + * clk_bulk_enable - ungate a set of clocks + * @num_clks: the number of clk_bulk_data + * @clks: the clk_bulk_data table being ungated + * + * clk_bulk_enable must not sleep + * Returns 0 on success, -EERROR otherwise. + */ +int __must_check clk_bulk_enable(int num_clks, const struct clk_bulk_data *clks) +{ + int ret; + int i; + + for (i = 0; i < num_clks; i++) { + ret = clk_enable(clks[i].clk); + if (ret) { + pr_err("Failed to enable clk '%s': %d\n", + clks[i].id, ret); + goto err; + } + } + + return 0; + +err: + clk_bulk_disable(i, clks); + + return ret; +} +EXPORT_SYMBOL_GPL(clk_bulk_enable); diff --git a/include/linux/clk.h b/include/linux/clk.h index e9d36b3..1201944 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -77,6 +77,21 @@ struct clk_notifier_data { unsigned long new_rate; }; +/** + * struct clk_bulk_data - Data used for bulk clk operations. + * + * @id: clock consumer ID + * @clk: struct clk * to store the associated clock + * + * The CLK APIs provide a series of clk_bulk_() API calls as + * a convenience to consumers which require multiple clks. This + * structure is used to manage data for these calls. + */ +struct clk_bulk_data { + const char *id; + struct clk *clk; +}; + #ifdef CONFIG_COMMON_CLK /** @@ -185,12 +200,20 @@ static inline bool clk_is_match(const struct clk *p, const struct clk *q) */ #ifdef CONFIG_HAVE_CLK_PREPARE int clk_prepare(struct clk *clk); +int __must_check clk_bulk_prepare(int num_clks, + const struct clk_bulk_data *clks); #else static inline int clk_prepare(struct clk *clk) { might_sleep(); return 0; } + +static inline int clk_bulk_prepare(int num_clks, struct clk_bulk_data *clks) +{ + might_sleep(); + return 0; +} #endif /** @@ -204,11 +227,16 @@ static inline int clk_prepare(struct clk *clk) */ #ifdef CONFIG_HAVE_CLK_PREPARE void clk_unprepare(struct clk *clk); +void clk_bulk_unprepare(int num_clks, const struct clk_bulk_data *clks); #else static inline void clk_unprepare(struct clk *clk) { might_sleep(); } +static inline void clk_bulk_unprepare(int num_clks, struct clk_bulk_data *clks) +{ + might_sleep(); +} #endif #ifdef CONFIG_HAVE_CLK @@ -230,6 +258,29 @@ static inline void clk_unprepare(struct clk *clk) struct clk *clk_get(struct device *dev, const char *id); /** + * clk_bulk_get - lookup and obtain a number of references to clock producer. + * @dev: device for clock "consumer" + * @num_clks: the number of clk_bulk_data + * @clks: the clk_bulk_data table of consumer + * + * This helper function allows drivers to get several clk consumers in one + * operation. If any of the clk cannot be acquired then any clks + * that were obtained will be freed before returning to the caller. + * + * Returns 0 if all clocks specified in clk_bulk_data table are obtained + * successfully, or valid IS_ERR() condition containing errno. + * The implementation uses @dev and @clk_bulk_data.id to determine the + * clock consumer, and thereby the clock producer. + * The clock returned is stored in each @clk_bulk_data.clk field. + * + * Drivers must assume that the clock source is not enabled. + * + * clk_bulk_get should not be called from within interrupt context. + */ +int __must_check clk_bulk_get(struct device *dev, int num_clks, + struct clk_bulk_data *clks); + +/** * devm_clk_get - lookup and obtain a managed reference to a clock producer. * @dev: device for clock "consumer" * @id: clock consumer ID @@ -279,6 +330,18 @@ struct clk *devm_get_clk_from_child(struct device *dev, int clk_enable(struct clk *clk); /** + * clk_bulk_enable - inform the system when the set of clks should be running. + * @num_clks: the number of clk_bulk_data + * @clks: the clk_bulk_data table of consumer + * + * May be called from atomic contexts. + * + * Returns success (0) or negative errno. + */ +int __must_check clk_bulk_enable(int num_clks, + const struct clk_bulk_data *clks); + +/** * clk_disable - inform the system when the clock source is no longer required. * @clk: clock source * @@ -295,6 +358,24 @@ int clk_enable(struct clk *clk); void clk_disable(struct clk *clk); /** + * clk_bulk_disable - inform the system when the set of clks is no + * longer required. + * @num_clks: the number of clk_bulk_data + * @clks: the clk_bulk_data table of consumer + * + * Inform the system that a set of clks is no longer required by + * a driver and may be shut down. + * + * May be called from atomic contexts. + * + * Implementation detail: if the set of clks is shared between + * multiple drivers, clk_bulk_enable() calls must be balanced by the + * same number of clk_bulk_disable() calls for the clock source to be + * disabled. + */ +void clk_bulk_disable(int num_clks, const struct clk_bulk_data *clks); + +/** * clk_get_rate - obtain the current clock rate (in Hz) for a clock source. * This is only valid once the clock source has been enabled. * @clk: clock source @@ -314,6 +395,19 @@ unsigned long clk_get_rate(struct clk *clk); void clk_put(struct clk *clk); /** + * clk_bulk_put - "free" the clock source + * @num_clks: the number of clk_bulk_data + * @clks: the clk_bulk_data table of consumer + * + * Note: drivers must ensure that all clk_bulk_enable calls made on this + * clock source are balanced by clk_bulk_disable calls prior to calling + * this function. + * + * clk_bulk_put should not be called from within interrupt context. + */ +void clk_bulk_put(int num_clks, struct clk_bulk_data *clks); + +/** * devm_clk_put - "free" a managed clock source * @dev: device used to acquire the clock * @clk: clock source acquired with devm_clk_get() @@ -445,6 +539,12 @@ static inline struct clk *clk_get(struct device *dev, const char *id) return NULL; } +static inline int clk_bulk_get(struct device *dev, int num_clks, + struct clk_bulk_data *clks) +{ + return 0; +} + static inline struct clk *devm_clk_get(struct device *dev, const char *id) { return NULL; @@ -458,6 +558,8 @@ static inline struct clk *devm_get_clk_from_child(struct device *dev, static inline void clk_put(struct clk *clk) {} +static inline void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) {} + static inline void devm_clk_put(struct device *dev, struct clk *clk) {} static inline int clk_enable(struct clk *clk) @@ -465,8 +567,17 @@ static inline int clk_enable(struct clk *clk) return 0; } +static inline int clk_bulk_enable(int num_clks, struct clk_bulk_data *clks) +{ + return 0; +} + static inline void clk_disable(struct clk *clk) {} + +static inline void clk_bulk_disable(int num_clks, + struct clk_bulk_data *clks) {} + static inline unsigned long clk_get_rate(struct clk *clk) { return 0;