From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9986C25B0E for ; Tue, 16 Aug 2022 11:53:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233847AbiHPLxL (ORCPT ); Tue, 16 Aug 2022 07:53:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234246AbiHPLwv (ORCPT ); Tue, 16 Aug 2022 07:52:51 -0400 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B2068E986 for ; Tue, 16 Aug 2022 04:27:25 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 14B33320091F; Tue, 16 Aug 2022 07:27:20 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 16 Aug 2022 07:27:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1660649240; x=1660735640; bh=o5 iFdopFa2HGCGEMFjs0ZUO1WJ5WU6C3Pgva9peIOew=; b=CjGUWJ3o0vjrh8X9BY +Oz6qrkSOR3hjmqPTxVpdBZyz6YM56Tsl2ndh/t20YM/65hc9C/xmlWvRERstdQq 1fAsddlFmDM5Rn0Ubt+/DpAbtIbFfq4arzPOYocWvcyfdwTy1QKPLwt4OGJWWkpC fimX/YU5Hm0Rke2HLm5ioc+D66psK24u2Rf39cef6VUSyW3hXx+kDxmub+KaCGiP fwwEH8imawyyOBAWlST1DObIVqelVyIFDl5gfioOGM7A7e7by1renMgp5VPj6xmn Csrr0HgcxiIiLNkJUzp90f7pHl+Sulyd6mk26NGY1KGIpLihlEIn7aDEPwPv9ziR gZXw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1660649240; x=1660735640; bh=o5iFdopFa2HGC GEMFjs0ZUO1WJ5WU6C3Pgva9peIOew=; b=rZB7T/PyQ9M8semSanPe7Xm/fvTTQ 49g2FJMkbrRv1GUEV2JyHbC7XThWt1wGZuwKHdRVaf+EAICYbpXpdEHgj7S4b1jc qdjaDxSY/ydgj2HZypVmlv1EmosuZA2aIfKsLVEby0cIMdhSpn5lgCRivBolzUIz 7SoAnWiJmLIbkYU1uQgyqh7AEY4QFglpYsvqZ05llXHEjXnIPAinb0fdnO7eZAqh ufNf7Yd3dWdXvO2dvYQeBLv2An4hFZ0RBnNC8bju+Tdsklo24TR0QynzelrAtPf2 haXPHLjZ1J5cvHyanCGU/FEGqNj/bDm1ySUvR8AOy21iZD+Q1G3GYVARA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdehgedggeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeelkeefteduhfekjeeihfetudfguedvveekkeetteekhfekhfdtlefgfedu vdejhfenucevlhhushhtvghrufhiiigvpeejnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 16 Aug 2022 07:27:19 -0400 (EDT) From: Maxime Ripard To: Mike Turquette , Stephen Boyd , linux-clk@vger.kernel.org Cc: Jerome Brunet , Naresh Kamboju , Dmitry Baryshkov , Alexander Stein , Neil Armstrong , Marek Szyprowski , Yassine Oudjana , Tony Lindgren , Maxime Ripard Subject: [PATCH v9 23/25] clk: Introduce the clk_hw_get_rate_range function Date: Tue, 16 Aug 2022 13:25:28 +0200 Message-Id: <20220816112530.1837489-24-maxime@cerno.tech> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220816112530.1837489-1-maxime@cerno.tech> References: <20220816112530.1837489-1-maxime@cerno.tech> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Some clock providers are hand-crafting their clk_rate_request, and need to figure out the current boundaries of their clk_hw to fill it properly. Let's create such a function for clock providers. Signed-off-by: Maxime Ripard --- drivers/clk/clk.c | 16 ++++++++++++++++ include/linux/clk-provider.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index fc145ea40f4e..453e2ff10961 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -683,6 +683,22 @@ static void clk_core_get_boundaries(struct clk_core *core, *max_rate = min(*max_rate, clk_user->max_rate); } +/* + * clk_hw_get_rate_range() - returns the clock rate range for a hw clk + * @hw: the hw clk we want to get the range from + * @min_rate: pointer to the variable that will hold the minimum + * @max_rate: pointer to the variable that will hold the maximum + * + * Fills the @min_rate and @max_rate variables with the minimum and + * maximum that clock can reach. + */ +void clk_hw_get_rate_range(struct clk_hw *hw, unsigned long *min_rate, + unsigned long *max_rate) +{ + clk_core_get_boundaries(hw->core, min_rate, max_rate); +} +EXPORT_SYMBOL_GPL(clk_hw_get_rate_range); + static bool clk_core_check_boundaries(struct clk_core *core, unsigned long min_rate, unsigned long max_rate) diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 8bce6c524f29..8724a3547a79 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -1267,6 +1267,8 @@ int clk_mux_determine_rate_flags(struct clk_hw *hw, struct clk_rate_request *req, unsigned long flags); void clk_hw_reparent(struct clk_hw *hw, struct clk_hw *new_parent); +void clk_hw_get_rate_range(struct clk_hw *hw, unsigned long *min_rate, + unsigned long *max_rate); void clk_hw_set_rate_range(struct clk_hw *hw, unsigned long min_rate, unsigned long max_rate); -- 2.37.1