imx.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Brian Masney <bmasney@redhat.com>
To: Abel Vesa <abelvesa@kernel.org>, Peng Fan <peng.fan@nxp.com>,
	 Michael Turquette <mturquette@baylibre.com>,
	 Stephen Boyd <sboyd@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	 Sascha Hauer <s.hauer@pengutronix.de>,
	 Pengutronix Kernel Team <kernel@pengutronix.de>,
	 Fabio Estevam <festevam@gmail.com>,
	Maxime Ripard <mripard@kernel.org>
Cc: linux-clk@vger.kernel.org, imx@lists.linux.dev,
	 linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,  Brian Masney <bmasney@redhat.com>
Subject: [PATCH 07/13] clk: imx: frac-pll: convert from round_rate() to determine_rate()
Date: Thu, 10 Jul 2025 17:10:39 -0400	[thread overview]
Message-ID: <20250710-clk-imx-round-rate-v1-7-5726f98e6d8d@redhat.com> (raw)
In-Reply-To: <20250710-clk-imx-round-rate-v1-0-5726f98e6d8d@redhat.com>

The round_rate() clk ops is deprecated, so migrate this driver from
round_rate() to determine_rate() using the Coccinelle semantic patch
on the cover letter of this series.

Signed-off-by: Brian Masney <bmasney@redhat.com>
---
 drivers/clk/imx/clk-frac-pll.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/clk/imx/clk-frac-pll.c b/drivers/clk/imx/clk-frac-pll.c
index c703056fae85cca492b2edcfaadab58fd13c6b5a..eb668faaa38fd085f90bd1c01811e0deba5d0102 100644
--- a/drivers/clk/imx/clk-frac-pll.c
+++ b/drivers/clk/imx/clk-frac-pll.c
@@ -119,19 +119,19 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw,
 	return rate;
 }
 
-static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate,
-			       unsigned long *prate)
+static int clk_pll_determine_rate(struct clk_hw *hw,
+				  struct clk_rate_request *req)
 {
-	u64 parent_rate = *prate;
+	u64 parent_rate = req->best_parent_rate;
 	u32 divff, divfi;
 	u64 temp64;
 
 	parent_rate *= 8;
-	rate *= 2;
-	temp64 = rate;
+	req->rate *= 2;
+	temp64 = req->rate;
 	do_div(temp64, parent_rate);
 	divfi = temp64;
-	temp64 = rate - divfi * parent_rate;
+	temp64 = req->rate - divfi * parent_rate;
 	temp64 *= PLL_FRAC_DENOM;
 	do_div(temp64, parent_rate);
 	divff = temp64;
@@ -140,9 +140,11 @@ static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate,
 	temp64 *= divff;
 	do_div(temp64, PLL_FRAC_DENOM);
 
-	rate = parent_rate * divfi + temp64;
+	req->rate = parent_rate * divfi + temp64;
+
+	req->rate = req->rate / 2;
 
-	return rate / 2;
+	return 0;
 }
 
 /*
@@ -198,7 +200,7 @@ static const struct clk_ops clk_frac_pll_ops = {
 	.unprepare	= clk_pll_unprepare,
 	.is_prepared	= clk_pll_is_prepared,
 	.recalc_rate	= clk_pll_recalc_rate,
-	.round_rate	= clk_pll_round_rate,
+	.determine_rate = clk_pll_determine_rate,
 	.set_rate	= clk_pll_set_rate,
 };
 

-- 
2.50.0


  parent reply	other threads:[~2025-07-10 21:11 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-10 21:10 [PATCH 00/13] clk: imx: convert from clk round_rate() to determine_rate() Brian Masney
2025-07-10 21:10 ` [PATCH 01/13] clk: imx: composite-8m: remove round_rate() in favor of determine_rate() Brian Masney
2025-07-24 22:16   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 02/13] clk: imx: composite-93: " Brian Masney
2025-07-24 22:16   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 03/13] clk: imx: busy: convert from round_rate() to determine_rate() Brian Masney
2025-07-24 22:16   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 04/13] clk: imx: cpu: " Brian Masney
2025-07-24 22:16   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 05/13] clk: imx: fixup-div: " Brian Masney
2025-07-24 22:16   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 06/13] clk: imx: fracn-gppll: " Brian Masney
2025-07-24 22:15   ` Stephen Boyd
2025-07-10 21:10 ` Brian Masney [this message]
2025-07-24 22:15   ` [PATCH 07/13] clk: imx: frac-pll: " Stephen Boyd
2025-07-10 21:10 ` [PATCH 08/13] clk: imx: pfd: " Brian Masney
2025-07-24 22:15   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 09/13] clk: imx: pll14xx: " Brian Masney
2025-07-24 22:15   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 10/13] clk: imx: pllv2: " Brian Masney
2025-07-24 22:15   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 11/13] clk: imx: pllv3: " Brian Masney
2025-07-24 22:15   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 12/13] clk: imx: pllv4: " Brian Masney
2025-07-24 22:15   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 13/13] clk: imx: scu: " Brian Masney
2025-07-24 22:15   ` Stephen Boyd
2025-07-15  6:57 ` [PATCH 00/13] clk: imx: convert from clk " Peng Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250710-clk-imx-round-rate-v1-7-5726f98e6d8d@redhat.com \
    --to=bmasney@redhat.com \
    --cc=abelvesa@kernel.org \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=peng.fan@nxp.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).