From patchwork Tue Jan 23 12:50:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 10180835 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 2A386602B7 for ; Tue, 23 Jan 2018 17:24:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09182286C0 for ; Tue, 23 Jan 2018 17:24:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1FBF28751; Tue, 23 Jan 2018 17:24:57 +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 455F6286C0 for ; Tue, 23 Jan 2018 17:24:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751451AbeAWRY4 (ORCPT ); Tue, 23 Jan 2018 12:24:56 -0500 Received: from mail-by2nam01on0053.outbound.protection.outlook.com ([104.47.34.53]:16137 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751405AbeAWRYy (ORCPT ); Tue, 23 Jan 2018 12:24:54 -0500 Received: from CY4PR03CA0075.namprd03.prod.outlook.com (10.171.242.144) by BLUPR03MB1411.namprd03.prod.outlook.com (10.163.81.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Tue, 23 Jan 2018 17:24:52 +0000 Received: from BL2FFO11FD015.protection.gbl (2a01:111:f400:7c09::175) by CY4PR03CA0075.outlook.office365.com (2603:10b6:910:4d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.444.14 via Frontend Transport; Tue, 23 Jan 2018 17:24:52 +0000 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 BL2FFO11FD015.mail.protection.outlook.com (10.173.160.223) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.428.12 via Frontend Transport; Tue, 23 Jan 2018 17:24:51 +0000 Received: from b29396-OptiPlex-7040.ap.freescale.net (b29396-OptiPlex-7040.ap.freescale.net [10.192.242.1]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w0NCoq19021755; Tue, 23 Jan 2018 05:50:57 -0700 From: Dong Aisheng To: CC: , , , , , , , , , Dong Aisheng Subject: [RFC PATCH 1/2] clk: add new APIs to operate on all available clocks Date: Tue, 23 Jan 2018 20:50:40 +0800 Message-ID: <1516711841-25234-2-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516711841-25234-1-git-send-email-aisheng.dong@nxp.com> References: <1516711841-25234-1-git-send-email-aisheng.dong@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131612018922655538; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(376002)(346002)(39380400002)(396003)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(26005)(54906003)(336011)(104016004)(316002)(47776003)(16586007)(305945005)(8936002)(50226002)(97736004)(86362001)(51416003)(76176011)(106466001)(50466002)(6306002)(2906002)(77096007)(356003)(105606002)(966005)(81166006)(81156014)(8676002)(53936002)(450100002)(4326008)(48376002)(498600001)(36756003)(59450400001)(2351001)(68736007)(6346003)(6916009)(2950100002)(6666003)(5660300001)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR03MB1411; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD015; 1:h7NQsKGVhCfrkbtRwrCnh79JYN/YFczS/0WJffqDYFwaL492EcIMxuc8LFYq9DU6ojtcpWCngAsIW3jXbEKn6/0+ryjjIzPS0da3NdJv4+NjaRr8QZ+HGrIV0oIUYiAD MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1f401d63-0ff3-422c-2dd1-08d562863683 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:BLUPR03MB1411; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB1411; 3:tLTH0QJadywnlHab/BKbBoD9tRmGDo6GC4/4OrYA1tbT6sFJFq4sSi4KVCgVCH9u2B5jEmkjRbpvuUBYpYdvazq48+QfRqWZ0XwaXRZtP+h2iuPKQawGD0R7dDYmRtR8j2Z2HlEABnHQrBYe5GTwOM+sTvaC5Amc0k54nE5mGfuh/5IUUlL5/L853lEP/VEmRWchafGH+XrUs44icAr6Ad9JudjZ/Wo1Ig/Zb02wVrjIjtilbRkTHvAl8F9ioHv4k1TCtPJ6stunC8XqnxL2+iHsSZu8ZXepFugnB+6txaoiPltwMzMuZMdlgyv68/gj0Dpo493jKsQnWVmkmu2YdFkaVxfZKaafFoaMC9upmdg=; 25:vgfw48s7gDQVE1i12F8wZPk6kqIuetq0zR71fPBEgQhMCRnRcMPElhIVx5qRkNNexfY0e1igYHC7ga588+KkkZliq1YNqoRXh4JT5CLXpAs4Bfnf/GTjQQfecT05q6dBmnVNJFJRJ4TNoVMR+LLRCvGQKYxRQwBx/Dtw/UURhH6+kn7YIBKg6jM+BqXAbLW4JdomD+kepLNR04C7wrr1tJhB6jOwle9oHSp74N1bVA+ukZqUDE7QEyjhNn4FiPlNa0IMl41iNfVynFsfB6KZkyhfHYx/KiAVH3qhrSwjouMbzBwfjpjz9DNB/b91x3ywdBWdtHxTw0G/7JGfjMLclg== X-MS-TrafficTypeDiagnostic: BLUPR03MB1411: X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB1411; 31:65lE5ZsqUr+lbcs3VdBLtFEmTvQTBi74+iyd21xDPYwB+oY74xvN4iQ4XL7K+tc5AN26DLjHccOlIWhHeWO6XbkXS3VKzaMME7P2An8GVteiLFHyRqGt9k9WgtIMEAf+p927U04VHA969v8r9kqliBBcOepv7B0BxVsmdA0qsJA5VneWzJNP5ez+7f07xbp/ZsimWd2bXYYTDCu9MkdV9msBMZB/lmbFgimGYHPmwrs=; 4:MiddX1ZAL7/WbJqWn0jZD1T4cqtWrUJ9sFdyPJbeNjJPjX7aoVI36DMDgLGpueCC1BkqahyZ/Y6L+rKd0ayag6sa4RCfU8NueCF3g8aFLtYYocCo8QKNOxaTRWBb6Bh1HKvrdoUsY5thUGtUQNSQQp9gKhf/FHpmfR4JCBtv6lAvSx04kNwWz2F+16bI7ih28MtOQh8II7tlm8eJdkx+9U+yZp9gkN6Ip7t8L7jz539Xx3bwXqdZcq0IWqoUlIiHMEMiDj1aoe2flQJh3vVflf4jHgRzdrv11l++AQlcEN+KvFcexRn+rPNbh5KY5K/J X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3231023)(2400081)(944501161)(3002001)(6055026)(6096035)(20161123561025)(20161123563025)(20161123556025)(201703131430075)(201703131433075)(201703131448075)(201703151042153)(20161123559100)(20161123565025)(201708071742011); SRVR:BLUPR03MB1411; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BLUPR03MB1411; X-Forefront-PRVS: 05610E64EE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR03MB1411; 23:7iTc25GvtK5Sm6+++Zgb52XLL4yzQyx9JqksOyAOD?= =?us-ascii?Q?HORWc6028oqW4uAz63EakdWYsm6xLNgZl1L9ikJVnG4WEbe88P+zK40N6vX8?= =?us-ascii?Q?xu3reE9IgWBUyrPTQ9wkKKZ5EZDfmalmB35KF+3EBgLwDBuW4Ja3GvsC+Vtx?= =?us-ascii?Q?XHOhJ80DILQxGqBZQWZqQVpLzcopVT5+jXvbNsQr/Dr0VPDdZp8eue5/TPmi?= =?us-ascii?Q?3bB0/t4STNAPwO85y/NuIGfig19DNXcxjVFPRPdlsXKHOSukEbSGvxq9A2Hi?= =?us-ascii?Q?oq+uatqQ4QCp3JQAFyAhGn5z1anaQe9qnBYUo/TN6CgTDfAwh4kP0TmkocZn?= =?us-ascii?Q?UaAASGqBscz7ohAuxngEUXbcHMUL3Y06uA4DskdfRrT0D5KwKVJKFk9wRq8s?= =?us-ascii?Q?66K8gxyMZPppCBQIjOhPtEsapa77oLTAoBBczhWyo118ilSyW5Umcd2tUvm8?= =?us-ascii?Q?F8rbBTR2CxeJ2w1byn4IKpq9rMQudUjWMIwNlsAXDCZg33GZ6K9y3ly3Y0Mu?= =?us-ascii?Q?xMrY7LrNJ324W2uLwa+7v9LFPDOLyslsEF8OUlOHNFzsGq1t29MwK21RYkDO?= =?us-ascii?Q?efziDmrw+arNLDdMMEElpu+F0i45M/XRzyYEC3VOG+bOu42IDOUbLP7LkQ7S?= =?us-ascii?Q?bNsjNAlfRO+CG/AO96l90eYboQL8xsSprwBkPVTYNGDt9opzxxlD73ZcLy0a?= =?us-ascii?Q?ITgv4DPdAA2oRRq+zN54ftwnfWzZipYiRbOBr+6NNoJOZ1Gzx+SPSlYCSx0G?= =?us-ascii?Q?fivLdH2x0zFmC2VUAFTqd36+y6ju3BBgUYp3G3xzzW2rHffZa7iWM5nwzniZ?= =?us-ascii?Q?d2GapuQ80MYrTrRD5ifb5LY9qhxhWFxkcyEs884VXDycv5LLoFfoFAL85DxS?= =?us-ascii?Q?9xjjSTxCcLiL+0nXoH5IiOr11XUy7JvBg8NtqKEuIButtqunMj7Igb3E8F5I?= =?us-ascii?Q?f41dKCHbG+mQvv5SEAokxD5jEA9wZnoiJKdERg/UEHeDCRgm5SkRfjDy+ZId?= =?us-ascii?Q?kbmF72Kb6AllctTFLKTEoHZzCbGDgo5h0Il5ScrFIXsvYetTqoJ57AHEptTl?= =?us-ascii?Q?SdVl9LqccdI2a+Krvv+pj2WZFaoP5cuAJkiWPVaBnTE/lW/Lq3Cxv9GQGGsf?= =?us-ascii?Q?SxlBoLjWpDHt0lrCogxI68AJNQ4NFvBE5GS6n9gFGvVzaQgIotU+5ZzwUmA9?= =?us-ascii?Q?RVpC3JnNvsecak=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB1411; 6:tkvXyrU2nhNubGA6UC5y0je56MKeseEOcPf+i0c1TB03CyaSf8KMj9UO6/vGXxmzxp//B2yisRwNcBogNttDrNBPH0h5WD+Wy6SJQNgpeIlGu8gcvdBzTC2tAmVJDzPKM18fr5R2zk5SudoXjT0XJoPTFjK7CWKjp5HjgJe6poF/+0FgbSsYcRT2FXYlcJdMtoX0KntFMAXwtdLY8nQFLorA8ZYsqLa1eF6tZXgaslzDheZaqY+Mzf9zKA6c77zbmJINdbF6LYhithMxFD2O0JUXa1UaFLGd5s8e57XCKqUHnVXRWOtYRjs+tAUwSMeWmrKAn2Pzwm7iycLJswD5yvo37nZ9bm0k02KUsqBbadI=; 5:yHFe56LTupCunx/3UEfVMtUkHmIvWinNGpOCmiADKusqIxaPf3vbKxOR6Kay8JBuMLPxDugO91wDnBkRysoCP/so35xqYFexyRzU/Sy/lYxGbKD83qadDottcjITzQkn+N2b5b3tH+5CPwAZQuWoxLW+qTFpC5brjuJLxlHVg30=; 24:Sd4sMvUc3nxQlIqQBMlfq6/GPbTV3F3Fiq/lsVgMbHUGDlcNL0Y+Jm//Dc3vBW1aRib5cbDmHU7s/ypYC4pWW23xAon/sRdRh7eeSBlf0MU=; 7:16QPxXpKqosSbxfJeoE4/WHhXxu33ecBLIjyq4EIHFuIcFKBpGRkPuHxFDkK5uQrMsQi0U5CD2EJh6cSPMrfURov8EMlqGAtr1wh0v6wXB8Nb+wPEsQTRNaSkhNnZIGhbnCMFOl4oiQ37tAxAevOkAF246Zx8xiS6AypBjJRHWW2SIqZd1dSbvUm68PalqlgTaEY4t9wg6ahuv0t6h53LS7FGo/uyFiQ4Bo758Yi0k6LC3SpksjI5XXkqddWTOZB SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2018 17:24:51.1267 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f401d63-0ff3-422c-2dd1-08d562863683 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: BLUPR03MB1411 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch introduces of_clk_bulk_get_all and clk_bulk_x_all APIs to users who just want to handle all available clocks from device tree without need to know the detailed clock information likes clock numbers and names. This is useful in writing some generic drivers to handle clock part. Cc: Stephen Boyd Cc: Masahiro Yamada Signed-off-by: Dong Aisheng --- A few question may need discuss: 1) This patch is written based on of_clk_bulk_get. [V4,1/1] clk: bulk: add of_clk_bulk_get() https://patchwork.kernel.org/patch/9971527/ Stepen once said we may not need it, but i guess as we already have clk_bulk_get, there may be guys who want of_clk_bulk_get as well if they need specify the clock count information, becaues of_clk_bulk_get_all will not check the count. And of_clk_bulk_get is also helpful when implementing of_clk_bulk_get_all. 2) It only implements the DT type clk_get_all as i see Stephen said we probably may not need to implement non-dt type as there're still no users. If we do want to implement non-dt type as well, we could revise the patch to add it too. --- drivers/clk/clk-bulk.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/clk.h | 61 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 124 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c index 1c1a79d..bac2aae 100644 --- a/drivers/clk/clk-bulk.c +++ b/drivers/clk/clk-bulk.c @@ -17,9 +17,11 @@ */ #include +#include #include #include #include +#include #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK) int __must_check of_clk_bulk_get(struct device_node *np, int num_clks, @@ -50,6 +52,45 @@ int __must_check of_clk_bulk_get(struct device_node *np, int num_clks, return ret; } EXPORT_SYMBOL(of_clk_bulk_get); + +struct clk_bulk __must_check *of_clk_bulk_get_all(struct device_node *np) +{ + struct clk_bulk *clk_bulk; + int num_clks; + int ret; + + num_clks = of_clk_get_parent_count(np); + if (!num_clks) + return NULL; + + clk_bulk = kzalloc(sizeof(*clk_bulk) + + num_clks * sizeof(struct clk_bulk_data), + GFP_KERNEL); + if (!clk_bulk) + return ERR_PTR(-ENOMEM); + + clk_bulk->num_clks = num_clks; + ret = of_clk_bulk_get(np, clk_bulk->num_clks, clk_bulk->clks); + if (ret) { + kfree(clk_bulk); + return ERR_PTR(ret); + } + + return clk_bulk; +} +EXPORT_SYMBOL(of_clk_bulk_get_all); + +void of_clk_bulk_put_all(struct clk_bulk *clk_bulk) +{ + if (IS_ERR_OR_NULL(clk_bulk)) + return; + + clk_bulk_put(clk_bulk->num_clks, clk_bulk->clks); + + kfree(clk_bulk->clks); + kfree(clk_bulk); +} +EXPORT_SYMBOL(of_clk_bulk_put_all); #endif void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) @@ -107,6 +148,12 @@ void clk_bulk_unprepare(int num_clks, const struct clk_bulk_data *clks) } EXPORT_SYMBOL_GPL(clk_bulk_unprepare); +void inline clk_bulk_unprepare_all(const struct clk_bulk *clk_bulk) +{ + clk_bulk_unprepare(clk_bulk->num_clks, clk_bulk->clks); +} +EXPORT_SYMBOL_GPL(clk_bulk_unprepare_all); + /** * clk_bulk_prepare - prepare a set of clocks * @num_clks: the number of clk_bulk_data @@ -139,6 +186,11 @@ int __must_check clk_bulk_prepare(int num_clks, } EXPORT_SYMBOL_GPL(clk_bulk_prepare); +int inline __must_check clk_bulk_prepare_all(const struct clk_bulk *clk_bulk) +{ + return clk_bulk_prepare(clk_bulk->num_clks, clk_bulk->clks); +} + #endif /* CONFIG_HAVE_CLK_PREPARE */ /** @@ -158,6 +210,12 @@ void clk_bulk_disable(int num_clks, const struct clk_bulk_data *clks) } EXPORT_SYMBOL_GPL(clk_bulk_disable); +void inline clk_bulk_disable_all(const struct clk_bulk *clk_bulk) +{ + return clk_bulk_disable(clk_bulk->num_clks, clk_bulk->clks); +} +EXPORT_SYMBOL_GPL(clk_bulk_disable_all); + /** * clk_bulk_enable - ungate a set of clocks * @num_clks: the number of clk_bulk_data @@ -188,3 +246,9 @@ int __must_check clk_bulk_enable(int num_clks, const struct clk_bulk_data *clks) return ret; } EXPORT_SYMBOL_GPL(clk_bulk_enable); + +int inline __must_check clk_bulk_enable_all(const struct clk_bulk *clk_bulk) +{ + return clk_bulk_enable(clk_bulk->num_clks, clk_bulk->clks); +} +EXPORT_SYMBOL_GPL(clk_bulk_enable_all); diff --git a/include/linux/clk.h b/include/linux/clk.h index 09ae760..ccafda1 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -92,6 +92,21 @@ struct clk_bulk_data { struct clk *clk; }; +/** + * struct clk_bulk - bulk clk structure + * + * @num_clks: the number of avaliable clocks in this bulk + * @clks: struct clk_bulk_data * to store the associated clock + * + * The CLK APIs provide a series of clk_bulk_x_all() API calls as + * a convenience to consumers which require multiple clks. This + * structure is used to manage data for these calls. + */ +struct clk_bulk { + int num_clks; + struct clk_bulk_data *clks; +}; + #ifdef CONFIG_COMMON_CLK /** @@ -202,6 +217,7 @@ static inline bool clk_is_match(const struct clk *p, const struct clk *q) int clk_prepare(struct clk *clk); int __must_check clk_bulk_prepare(int num_clks, const struct clk_bulk_data *clks); +int __must_check clk_bulk_prepare_all(const struct clk_bulk *clk_bulk); #else static inline int clk_prepare(struct clk *clk) { @@ -214,6 +230,12 @@ static inline int clk_bulk_prepare(int num_clks, struct clk_bulk_data *clks) might_sleep(); return 0; } + +static inline int clk_bulk_prepare_all(const struct clk_bulk *clk_bulk) +{ + might_sleep(); + return 0; +} #endif /** @@ -228,6 +250,7 @@ static inline int clk_bulk_prepare(int num_clks, struct clk_bulk_data *clks) #ifdef CONFIG_HAVE_CLK_PREPARE void clk_unprepare(struct clk *clk); void clk_bulk_unprepare(int num_clks, const struct clk_bulk_data *clks); +void clk_bulk_unprepare_all(const struct clk_bulk *clk_bulk); #else static inline void clk_unprepare(struct clk *clk) { @@ -237,6 +260,10 @@ static inline void clk_bulk_unprepare(int num_clks, struct clk_bulk_data *clks) { might_sleep(); } +static inline void clk_bulk_unprepare_all(struct clk_bulk *clk_bulk) +{ + might_sleep(); +} #endif #ifdef CONFIG_HAVE_CLK @@ -389,6 +416,13 @@ int __must_check clk_bulk_enable(int num_clks, const struct clk_bulk_data *clks); /** + * clk_bulk_enable_all - inform the system when all avaiable clks should + * be running. + * @clk_bulk: pointer to struct clk_bulk which contains all available clocks + */ +int __must_check clk_bulk_enable_all(const struct clk_bulk *clk_bulk); + +/** * clk_disable - inform the system when the clock source is no longer required. * @clk: clock source * @@ -423,6 +457,13 @@ void clk_disable(struct clk *clk); void clk_bulk_disable(int num_clks, const struct clk_bulk_data *clks); /** + * clk_bulk_disable_all - inform the system when all avaiable clks are no + * longer required. + * @clk_bulk: pointer to struct clk_bulk which contains all available clocks + */ +void clk_bulk_disable_all(const struct clk_bulk *clk_bulk); + +/** * 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 @@ -650,12 +691,18 @@ 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 int clk_bulk_enable_all(struct clk_bulk *clk_bulk) +{ + 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 void clk_bulk_disable_all(const struct clk_bulk *clk_bulk) {} + static inline unsigned long clk_get_rate(struct clk *clk) { return 0; @@ -744,6 +791,8 @@ static inline void clk_bulk_disable_unprepare(int num_clks, #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK) int __must_check of_clk_bulk_get(struct device_node *np, int num_clks, struct clk_bulk_data *clks); +struct clk_bulk __must_check *of_clk_bulk_get_all(struct device_node *np); +void of_clk_bulk_put_all(struct clk_bulk *clk_bulk); struct clk *of_clk_get(struct device_node *np, int index); struct clk *of_clk_get_by_name(struct device_node *np, const char *name); struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec); @@ -754,6 +803,16 @@ static inline int __must_check of_clk_bulk_get(struct device_node *np, int num_c return -ENOENT; } +static struct clk_bulk __must_check *of_clk_bulk_get_all(struct device_node *np) +{ + return -ENOENT; +} + +static void of_clk_bulk_put_all(struct clk_bulk *clk_bulk) +{ + return -ENOENT; +} + static inline struct clk *of_clk_get(struct device_node *np, int index) { return ERR_PTR(-ENOENT);