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 0A491C433F5 for ; Wed, 11 May 2022 14:44:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244958AbiEKOoh (ORCPT ); Wed, 11 May 2022 10:44:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243335AbiEKOoe (ORCPT ); Wed, 11 May 2022 10:44:34 -0400 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62A52C9EED for ; Wed, 11 May 2022 07:44:33 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 8FA6332009BE; Wed, 11 May 2022 10:44:31 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 11 May 2022 10:44:32 -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=1652280271; x=1652366671; bh=q0 D9Wsi4pdUMw+NcbErEB00cueCJ4ezwWL1loLnAU1k=; b=gSeYtX7x1jQ9iyTTtq muZI8PcjuKWJxk8lIV4tCuOT3SpeD6NeepBCqdlz46U0H19NfqcNQG5ZVkdkyvPP I64ERnvxOusE7GTS5TJNfMsrK2jbdMRWgcAQ9xJPqthfKuG6MEyduxDBi3oJajDl CXo/WSxQe2mMhEOooq+8w870gkPlQL7il2Ktn+RcvLMFI8v1PwuBetonzsAsD3UL J4N0iLmMO9+p5Ypovt6PEbVGP7igcyUP5KIMw8iKghhwORGs/W5dvvDF2wblAbjs hUy6LSVQAhM6eAUQQm/PsM6q69Uqwn0liFuKW2K/K26n7UFhvxPZdGFBntcWI/an oqmw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; 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:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1652280271; x=1652366671; bh=q0D9Wsi4pdUMw+NcbErEB00cueCJ4ezwWL1 loLnAU1k=; b=lZBmVBEi/n0J+YiXVYVyOuCgwCeJIv0nsUyB1WK+ai6pdf51x4n 4PUh9hVz0NyD43ulT9O8D6iGP6VkYhi1Qmm6SomJmxg6733zvr3f8LbNq5Htc5Pr 50sHKRmVkLkzSSSb3CUKiyev9DZaxZvzk3jl117iQSb4XYP40ukRsTD+71HPg/f6 RCInJM3yTp96vnEsoDZz+4x966EVhPS/vPs1sssEKSvDOGJzBE0H55pBlNNXDU83 Lu3ebDoc692nbZbEFrScX5oGyOCr1ty7KFKCNOaK+RL0rcaABsmpd8ivgW++MTMG RkPItIrVeXeIn0Ut4Iij4YMVPknYdF6iqyA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrgeehgdejjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepleekfeetudfhkeejiefhtedugfeuvdevkeekteetkefhkefhtdelgfefuddv jefhnecuvehluhhsthgvrhfuihiivgepieenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 11 May 2022 10:44:30 -0400 (EDT) From: Maxime Ripard To: Mike Turquette , Stephen Boyd , linux-clk@vger.kernel.org Cc: Jerome Brunet , Alexander Stein , Naresh Kamboju , Yassine Oudjana , Marek Szyprowski , Neil Armstrong , Dmitry Baryshkov , Tony Lindgren , Maxime Ripard Subject: [PATCH v3 25/28] clk: Introduce the clk_hw_get_rate_range function Date: Wed, 11 May 2022 16:42:46 +0200 Message-Id: <20220511144249.354775-26-maxime@cerno.tech> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220511144249.354775-1-maxime@cerno.tech> References: <20220511144249.354775-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 597977c883ef..312ee08b00ca 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 7f4f34ff2b83..c0bcf72d5ecd 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -1235,6 +1235,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.36.1