Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55EE0C433E0 for ; Thu, 25 Feb 2021 15:59:30 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F1EE864F1A for ; Thu, 25 Feb 2021 15:59:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F1EE864F1A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 70B906ECB4; Thu, 25 Feb 2021 15:59:24 +0000 (UTC) Received: from wnew4-smtp.messagingengine.com (wnew4-smtp.messagingengine.com [64.147.123.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0F6416E20B for ; Thu, 25 Feb 2021 15:59:19 +0000 (UTC) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id E02CBB6B; Thu, 25 Feb 2021 10:59:15 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 25 Feb 2021 10:59:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=jv5ckA19ZkKU4 Rjc7QxtOHEW45lL4ipQ44Uc7QnCaYE=; b=NLUdu0BBOw9ouMeK61kgTc2GnCSim v3dcIz86kkkDSRCIxhz6+PX2fZj4QoQy6NsxGABAh5IPXw5teXbc5JK0OGnJXgAV 4eEYmT8YBZJdcg3g4ut8qZHYNgMTKk2YPsNQYhiyuViB17aBWK0uxFpMkKaizBc1 AXlNv4Z42OEYpt2F3XWpWr6Lplx+YWH/4BYuLYdpf4RoJcBr9WG3mGuw8BV+Jg2g z0cvwB/MvbAoCL9NtyBt2VcnHf29EGUTu1polaxN0xxM/Q3Z3xrOV0ziouE/RD4W JRs90hsAburjJOgmhRvcfla1yDtiqnbVST4N2z2IUL9GcqkgCdRlYLggA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=jv5ckA19ZkKU4Rjc7QxtOHEW45lL4ipQ44Uc7QnCaYE=; b=QhvimSQW 6JcBFIlooxhH4XZp/8ELqhHLeZMIFn6UI5Wn6eVU4Y+w37G75I/ts7G7CEfPg/NR XODQNmBAqEVGwVTlzkncVEUWfd0Q3tqRxvA0ob+kvP+T2ZJaUD8LdrxKqE41M/zM 3wJcJSpuOo4T/teyrz7yrJ7WxAhzhyn1k0gUZrfdo4eBUoV6yYbKqF2IZm+ZFol4 AHKZsuiqi9isfCo8HnvJHOUoqMSr1UQOnQHdmmXn/VlRVLJoJt2LUxQqOLTb/d9i 18/Wau6LvdbskjhtnU9vvZdhecRoD+rlSAsILW7iAbH+ogR8yU3EpWOjSwY5acni XEM+Fi8+EphXUQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrkeelgdekgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucfkphepledtrdekledrieekrdejieenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 06A991080059; Thu, 25 Feb 2021 10:59:14 -0500 (EST) From: Maxime Ripard To: Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Mike Turquette , Stephen Boyd , linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH 1/8] clk: Add range accessors Date: Thu, 25 Feb 2021 16:59:02 +0100 Message-Id: <20210225155909.1853812-2-maxime@cerno.tech> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210225155909.1853812-1-maxime@cerno.tech> References: <20210225155909.1853812-1-maxime@cerno.tech> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tim Gover , Dave Stevenson , David Airlie , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, Daniel Vetter , Phil Elwell , Nicolas Saenz Julienne Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Some devices might need to access the current available range of a clock to discover their capabilities. Let's add those accessors. Signed-off-by: Maxime Ripard --- drivers/clk/clk.c | 30 ++++++++++++++++++++++++++++++ include/linux/clk.h | 16 ++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 8c1d04db990d..b7307d4f090d 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2407,6 +2407,36 @@ int clk_set_max_rate(struct clk *clk, unsigned long rate) } EXPORT_SYMBOL_GPL(clk_set_max_rate); +long clk_get_min_rate(struct clk *clk) +{ + unsigned long min_rate, max_rate; + + if (!clk) + return 0; + + clk_prepare_lock(); + clk_core_get_boundaries(clk->core, &min_rate, &max_rate); + clk_prepare_unlock(); + + return min_rate; +} +EXPORT_SYMBOL_GPL(clk_get_min_rate); + +long clk_get_max_rate(struct clk *clk) +{ + unsigned long min_rate, max_rate; + + if (!clk) + return 0; + + clk_prepare_lock(); + clk_core_get_boundaries(clk->core, &min_rate, &max_rate); + clk_prepare_unlock(); + + return max_rate; +} +EXPORT_SYMBOL_GPL(clk_get_max_rate); + /** * clk_get_parent - return the parent of a clk * @clk: the clk whose parent gets returned diff --git a/include/linux/clk.h b/include/linux/clk.h index 31ff1bf1b79f..6f0c00ddf3ac 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -709,6 +709,22 @@ int clk_set_min_rate(struct clk *clk, unsigned long rate); */ int clk_set_max_rate(struct clk *clk, unsigned long rate); +/** + * clk_get_min_rate - get the minimum clock rate for a clock source + * @clk: clock source + * + * Returns the minimum rate or negative errno. + */ +long clk_get_min_rate(struct clk *clk); + +/** + * clk_get_max_rate - get the maximum clock rate for a clock source + * @clk: clock source + * + * Returns the maximum rate or negative errno. + */ +long clk_get_max_rate(struct clk *clk); + /** * clk_set_parent - set the parent clock source for this clock * @clk: clock source -- 2.29.2 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel