From patchwork Sun Sep 20 04:29:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Wood X-Patchwork-Id: 7225441 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7A6969F443 for ; Sun, 20 Sep 2015 04:32:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D40F20767 for ; Sun, 20 Sep 2015 04:32:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A57AB20761 for ; Sun, 20 Sep 2015 04:32:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZdWHQ-0003jN-Qm; Sun, 20 Sep 2015 04:31:12 +0000 Received: from mail-by2on0129.outbound.protection.outlook.com ([207.46.100.129] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZdWH0-0003IQ-4w for linux-arm-kernel@lists.infradead.org; Sun, 20 Sep 2015 04:30:47 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=scottwood@freescale.com; Received: from snotra.am.freescale.net (192.88.168.49) by BLUPR03MB1473.namprd03.prod.outlook.com (10.163.81.158) with Microsoft SMTP Server (TLS) id 15.1.274.16; Sun, 20 Sep 2015 04:30:11 +0000 From: Scott Wood To: Michael Turquette , Stephen Boyd , "Rafael J. Wysocki" , Viresh Kumar , Russell King Subject: [PATCH v3 4/5] clk: Add consumer APIs for discovering possible parent clocks Date: Sat, 19 Sep 2015 23:29:56 -0500 Message-ID: <1442723397-26329-5-git-send-email-scottwood@freescale.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1442723397-26329-1-git-send-email-scottwood@freescale.com> References: <1442723397-26329-1-git-send-email-scottwood@freescale.com> MIME-Version: 1.0 X-Originating-IP: [192.88.168.49] X-ClientProxiedBy: SN1PR07CA0011.namprd07.prod.outlook.com (25.162.170.149) To BLUPR03MB1473.namprd03.prod.outlook.com (25.163.81.158) X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB1473; 2:+krKnF+VwTK0rpjXVsgy34mwigW9sd6G59QT4MmuKMeuMEfhBPhnIyUku4c4hbpZpwQBYPpCYEJF5MAEXmDSXFdrPR9Sb9jjdqr3UM/DHTLezzgUTz/cbC2vHw7rO7iNrxXqoUmQ6pp2f5EFqI00O/1bDDuT0XB7N5NNM0+DQok=; 3:q1EG3SoFzmPhqOyp6I2i5pg+AJKOrxe/DAW1C9dYhVtqnrGR9+hEWt6vd6ydghH1dpmfjQbefSk1k3rQ4pUfOValms3I7SOOLPMEfbKxKwrjKnLjLuouTcrFl7R14NulNW5KTRmmiRYzb2mUbaLq7g==; 25:3rWhtcUQnkwwN59ndYK9OhjHBY6tBl4lX9mPHTjzD9dFTKJ3ZpH36AeHvizwvBhOfxD30JrYED+45aKsNU2I7ERtEh7s0HMx4V4W92PXw2cVxlF3rQ9usM2Y0GJwUXvN7ZsYX446nJm0v+ZSCiMOE0OkqhfzWbyrEx5jnbSbgoH3w3jPu3iQ3y1rO95iTEI6u6k861EKEZjJ4yElTZw2WnhsfkONcwAC2KDKJ57Z1qEyPc6g4/KWAgVdqTLTfokA9DoSljimao82yNpk3XTngg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB1473; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB1473; 20:TT3vFAZBmmR4VHgRkRom7Na3IpRbzslZAzmlp0ydfU61RWu54NIiSXA9CPt+ZRyuXBYmr+qg/iquvTu0QV2Wj7SMvFK+jqYjAOVsWpM0ftIE2325gwGneuC0QJLMLxiINxGvQiv5ZGVLFHnx5vjGuiPYdEH7aklW4jzQjom24zXFsh7fHvz2sEufteP4rKo5zlu2QG6hy3/Xfj7RK3ovrs2rqFDcJLzPFBJKAS8RUKMQMsrNr8eNtim6vEn+7+m6KD+dawDAoB+DfOQ472t77iCAfYeH4pGaSftsDr+RMnJH0VUsIy3/anmK7pxzQKmw38A8Tg8iFSEbtmBo35Hk77/FvA8FBTu2hkBq+8YiaPC/Z79+jSN8PvxxLT7nnC+WKhicdl3dcLL7wdn39qIbQxpqFjkLFCThWWWJ0tK1S2w9Qlgq2h2p7zRnPn4yOGXOC6LIJk9NiwUSYGu54/7Pfuyq0A5fxlUBMrtHy6AWfq5EYyIbUrNRUhSKWXlIiLxr; 4:y/pLPdDOfpb5QTkKP8X2mQoTjXIVoV2YeenBPS6Jtw0Wq8uBEhAezGfRbAtQLCrFuFJWVfeNbFqdcOilS+5yaEzDPFt4kC13Ndq0zgzjPoaCZmTDupGxJLalrwn5zWmuisqT2Ax+k/fGILscx6LDdpo+kK94Z9jAn7Sf0Zpvzo/CyX138wdWxmwklftOipUat3RjOVOFLmo6DmCJh68tS37zUSsdNim5Bo1W9G8gGdVl6I8TwXH1KL/7UgSbxHsGGDkKs3JryySdb77TMR1VZxzvoH8nvbyx44wrN+chw6gkf2bwUn4fx0cyfQzBx2LIbdoEA6RsEuYzenBmyTCPqg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(8121501046)(5005006)(520078)(3002001); SRVR:BLUPR03MB1473; BCL:0; PCL:0; RULEID:; SRVR:BLUPR03MB1473; X-Forefront-PRVS: 0705EB1700 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(199003)(189002)(229853001)(76176999)(107886002)(5003940100001)(97736004)(81156007)(50986999)(66066001)(5001860100001)(5004730100002)(5007970100001)(4001540100001)(5001830100001)(87976001)(5001770100001)(5001960100002)(36756003)(575784001)(86362001)(42186005)(64706001)(189998001)(77156002)(47776003)(62966003)(92566002)(46102003)(122386002)(40100003)(77096005)(68736005)(33646002)(50226001)(106356001)(2950100001)(105586002)(48376002)(19580405001)(50466002)(101416001)(19580395003)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR03MB1473; H:snotra.am.freescale.net; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: freescale.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR03MB1473; 23:L6jyNM2i7+oiZLYwbAfysNAXey2IlGXhgGf5H5YbL?= =?us-ascii?Q?mu9agiQOuDPTbKAE78hQiZuUbQGPjA/YF3dYmv+wkDD1FQXCkNbwtFJGDcY1?= =?us-ascii?Q?NNUGSmOiF79pNkKzmYu62m5E8nlc+/+1UAfecCOzBBplaPrTfOw517HSUeKb?= =?us-ascii?Q?k/9quEd54ct60HS/cpdy7Y4UvzP8lr4wfeprQA4t/S+S3dnjXRIcrvrFPWNe?= =?us-ascii?Q?Lz1WjETaqF2ikyhYI0oYvP+eU+uLbFzb8cV0GwQ9MP51A5OOHPCPpyQRCiHx?= =?us-ascii?Q?X/h0M0GGrsXoyBuUq+IcSj5rCGfdLC80rPb8TOU6r9lQNA1VZaLOIWllX+XI?= =?us-ascii?Q?qeR9GVkH7s97bKHw0NUnjxBxVd1LQrOuTaa+uO5MlezrcrtWaTeywWsx+I6g?= =?us-ascii?Q?GUgd+a4tFehxLP0LvEmUIaGFxzsG/5uu18i2F67GqCzjryj/zfW36PhTcw8T?= =?us-ascii?Q?9mrjpmOaflQD3o4j9t0CDmndO6rcgVgmlsE1no9/0Jd4D6JhMPSeEUGFPcCg?= =?us-ascii?Q?tew7wivUxHizMHfY+Wvrq0G+7tScXkTlKWe6fwZHtRUXENjrp+i5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fS39l6r/PLy/zo2mFuHaGbyM4tvlV9+IHPMiESBHSJi/gkWlk063BWXeiNIy97LOj5OXgzBi5MUbZ50YfIk=; 20:RD8q39cyNLR5EoGFVLDE1CTD30gfKwbkp9VenJf4zbhrl598KmNfSPMV0XW3Bt1HbE0/4+gdYWr2JrTZdpSqhA== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2015 04:30:11.8769 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB1473 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150919_213046_540108_528D91A5 X-CRM114-Status: GOOD ( 10.77 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pm@vger.kernel.org, Tang Yuantian , Scott Wood , linuxppc-dev@lists.ozlabs.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit fc4a05d4b0eb ("clk: Remove unused provider APIs") removed __clk_get_num_parents() and clk_hw_get_parent_by_index(), leaving only true provider API versions that operate on struct clk_hw. qoriq-cpufreq needs these functions in order to determine the options it has for calling clk_set_parent() and thus populate the cpufreq table, so revive them as legitimate consumer APIs. Signed-off-by: Scott Wood --- v3: new patch drivers/clk/clk.c | 19 +++++++++++++++++++ include/linux/clk.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 43e2c3a..9436356 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -290,6 +290,12 @@ struct clk_hw *__clk_get_hw(struct clk *clk) } EXPORT_SYMBOL_GPL(__clk_get_hw); +unsigned int clk_get_num_parents(struct clk *clk) +{ + return !clk ? 0 : clk->core->num_parents; +} +EXPORT_SYMBOL_GPL(clk_get_num_parents); + unsigned int clk_hw_get_num_parents(const struct clk_hw *hw) { return hw->core->num_parents; @@ -359,6 +365,19 @@ static struct clk_core *clk_core_get_parent_by_index(struct clk_core *core, return core->parents[index]; } +struct clk *clk_get_parent_by_index(struct clk *clk, unsigned int index) +{ + struct clk_core *parent; + + if (!clk) + return NULL; + + parent = clk_core_get_parent_by_index(clk->core, index); + + return !parent ? NULL : parent->hw->clk; +} +EXPORT_SYMBOL_GPL(clk_get_parent_by_index); + struct clk_hw * clk_hw_get_parent_by_index(const struct clk_hw *hw, unsigned int index) { diff --git a/include/linux/clk.h b/include/linux/clk.h index 0df4a51..937de0e 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -392,6 +392,26 @@ int clk_set_parent(struct clk *clk, struct clk *parent); struct clk *clk_get_parent(struct clk *clk); /** + * clk_get_parent_by_index - get a possible parent clock by index + * @clk: clock source + * @index: index into the array of possible parents of this clock + * + * Returns struct clk corresponding to the requested possible + * parent clock source, or NULL. + */ +struct clk *clk_get_parent_by_index(struct clk *clk, + unsigned int index); + +/** + * clk_get_num_parents - get number of possible parents + * @clk: clock source + * + * Returns the number of possible parents of this clock, + * which can then be enumerated using clk_get_parent_by_index(). + */ +unsigned int clk_get_num_parents(struct clk *clk); + +/** * clk_get_sys - get a clock based upon the device name * @dev_id: device name * @con_id: connection ID @@ -461,6 +481,17 @@ static inline struct clk *clk_get_parent(struct clk *clk) return NULL; } +struct clk *clk_get_parent_by_index(struct clk *clk, + unsigned int index) +{ + return NULL; +} + +unsigned int clk_get_num_parents(struct clk *clk) +{ + return 0; +} + #endif /* clk_prepare_enable helps cases using clk_enable in non-atomic context. */