imx.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13] clk: imx: convert from clk round_rate() to determine_rate()
@ 2025-07-10 21:10 Brian Masney
  2025-07-10 21:10 ` [PATCH 01/13] clk: imx: composite-8m: remove round_rate() in favor of determine_rate() Brian Masney
                   ` (13 more replies)
  0 siblings, 14 replies; 28+ messages in thread
From: Brian Masney @ 2025-07-10 21:10 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Maxime Ripard
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

The round_rate() clk ops is deprecated in the clk framework in favor
of the determine_rate() clk ops. The first two patches in this series
drops the round_rate() function since a determine_rate() function is
already implemented. The remaining patches convert the drivers using
the Coccinelle semantic patch posted below. I did a few minor cosmetic
cleanups of the code in a few cases.

Coccinelle semantic patch:

    virtual patch

    // Look up the current name of the round_rate function
    @ has_round_rate @
    identifier round_rate_name =~ ".*_round_rate";
    identifier hw_param, rate_param, parent_rate_param;
    @@

    long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
                  unsigned long *parent_rate_param)
    {
    	...
    }

    // Rename the route_rate function name to determine_rate()
    @ script:python generate_name depends on has_round_rate @
    round_rate_name << has_round_rate.round_rate_name;
    new_name;
    @@

    coccinelle.new_name = round_rate_name.replace("_round_rate", "_determine_rate")

    // Change rate to req->rate; also change occurrences of 'return XXX'.
    @ chg_rate depends on generate_name @
    identifier has_round_rate.round_rate_name;
    identifier has_round_rate.hw_param;
    identifier has_round_rate.rate_param;
    identifier has_round_rate.parent_rate_param;
    identifier ERR =~ "E.*";
    expression E;
    @@

    long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
                  unsigned long *parent_rate_param)
    {
    <...
    (
    -return -ERR;
    +return -ERR;
    |
    - return rate_param;
    + return 0;
    |
    - return E;
    + req->rate = E;
    +
    + return 0;
    |
    - rate_param
    + req->rate
    )
    ...>
    }

    // Coccinelle only transforms the first occurrence of the rate parameter
    // Run a second time. FIXME: Is there a better way to do this?
    @ chg_rate2 depends on generate_name @
    identifier has_round_rate.round_rate_name;
    identifier has_round_rate.hw_param;
    identifier has_round_rate.rate_param;
    identifier has_round_rate.parent_rate_param;
    @@

    long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
                  unsigned long *parent_rate_param)
    {
    <...
    - rate_param
    + req->rate
    ...>
    }

    // Change parent_rate to req->best_parent_rate
    @ chg_parent_rate depends on generate_name @
    identifier has_round_rate.round_rate_name;
    identifier has_round_rate.hw_param;
    identifier has_round_rate.rate_param;
    identifier has_round_rate.parent_rate_param;
    @@

    long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
                  unsigned long *parent_rate_param)
    {
    <...
    (
    - *parent_rate_param
    + req->best_parent_rate
    |
    - parent_rate_param
    + &req->best_parent_rate
    )
    ...>
    }

    // Convert the function definition from round_rate() to determine_rate()
    @ func_definition depends on chg_rate @
    identifier has_round_rate.round_rate_name;
    identifier has_round_rate.hw_param;
    identifier has_round_rate.rate_param;
    identifier has_round_rate.parent_rate_param;
    identifier generate_name.new_name;
    @@

    - long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
    -               unsigned long *parent_rate_param)
    + int new_name(struct clk_hw *hw, struct clk_rate_request *req)
    {
        ...
    }

    // Update the ops from round_rate() to determine_rate()
    @ ops depends on func_definition @
    identifier has_round_rate.round_rate_name;
    identifier generate_name.new_name;
    @@

    {
        ...,
    -   .round_rate = round_rate_name,
    +   .determine_rate = new_name,
        ...,
    }

Note that I used coccinelle 1.2 instead of 1.3 since the newer version
adds unnecessary braces as described in this post.
https://lore.kernel.org/cocci/67642477-5f3e-4b2a-914d-579a54f48cbd@intel.com/

Signed-off-by: Brian Masney <bmasney@redhat.com>
---
Brian Masney (13):
      clk: imx: composite-8m: remove round_rate() in favor of determine_rate()
      clk: imx: composite-93: remove round_rate() in favor of determine_rate()
      clk: imx: busy: convert from round_rate() to determine_rate()
      clk: imx: cpu: convert from round_rate() to determine_rate()
      clk: imx: fixup-div: convert from round_rate() to determine_rate()
      clk: imx: fracn-gppll: convert from round_rate() to determine_rate()
      clk: imx: frac-pll: convert from round_rate() to determine_rate()
      clk: imx: pfd: convert from round_rate() to determine_rate()
      clk: imx: pll14xx: convert from round_rate() to determine_rate()
      clk: imx: pllv2: convert from round_rate() to determine_rate()
      clk: imx: pllv3: convert from round_rate() to determine_rate()
      clk: imx: pllv4: convert from round_rate() to determine_rate()
      clk: imx: scu: convert from round_rate() to determine_rate()

 drivers/clk/imx/clk-busy.c         |  8 ++---
 drivers/clk/imx/clk-composite-8m.c | 16 ---------
 drivers/clk/imx/clk-composite-93.c |  7 ----
 drivers/clk/imx/clk-cpu.c          | 10 +++---
 drivers/clk/imx/clk-fixup-div.c    |  8 ++---
 drivers/clk/imx/clk-frac-pll.c     | 20 ++++++-----
 drivers/clk/imx/clk-fracn-gppll.c  | 17 +++++----
 drivers/clk/imx/clk-pfd.c          | 18 +++++-----
 drivers/clk/imx/clk-pll14xx.c      | 29 +++++++++------
 drivers/clk/imx/clk-pllv2.c        | 23 +++++++-----
 drivers/clk/imx/clk-pllv3.c        | 72 +++++++++++++++++++++-----------------
 drivers/clk/imx/clk-pllv4.c        | 29 +++++++++------
 drivers/clk/imx/clk-scu.c          | 36 +++++--------------
 13 files changed, 146 insertions(+), 147 deletions(-)
---
base-commit: b551c4e2a98a177a06148cf16505643cd2108386
change-id: 20250710-clk-imx-round-rate-b9fca1f65834

Best regards,
-- 
Brian Masney <bmasney@redhat.com>


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 01/13] clk: imx: composite-8m: remove round_rate() in favor of determine_rate()
  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 ` Brian Masney
  2025-07-24 22:16   ` Stephen Boyd
  2025-07-10 21:10 ` [PATCH 02/13] clk: imx: composite-93: " Brian Masney
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Brian Masney @ 2025-07-10 21:10 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Maxime Ripard
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

This driver implements both the determine_rate() and round_rate() clk
ops, and the round_rate() clk ops is deprecated. When both are defined,
clk_core_determine_round_nolock() from the clk core will only use the
determine_rate() clk ops, so let's remove the round_rate() clk ops since
it's unused.

Signed-off-by: Brian Masney <bmasney@redhat.com>
---
 drivers/clk/imx/clk-composite-8m.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/drivers/clk/imx/clk-composite-8m.c b/drivers/clk/imx/clk-composite-8m.c
index f187582ba49196e3cee2b5dbaba9bdd9b091bb40..1467d0a1b9341bc4b0a40591bca00392eabf7cfb 100644
--- a/drivers/clk/imx/clk-composite-8m.c
+++ b/drivers/clk/imx/clk-composite-8m.c
@@ -73,21 +73,6 @@ static int imx8m_clk_composite_compute_dividers(unsigned long rate,
 	return ret;
 }
 
-static long imx8m_clk_composite_divider_round_rate(struct clk_hw *hw,
-						unsigned long rate,
-						unsigned long *prate)
-{
-	int prediv_value;
-	int div_value;
-
-	imx8m_clk_composite_compute_dividers(rate, *prate,
-						&prediv_value, &div_value);
-	rate = DIV_ROUND_UP(*prate, prediv_value);
-
-	return DIV_ROUND_UP(rate, div_value);
-
-}
-
 static int imx8m_clk_composite_divider_set_rate(struct clk_hw *hw,
 					unsigned long rate,
 					unsigned long parent_rate)
@@ -153,7 +138,6 @@ static int imx8m_divider_determine_rate(struct clk_hw *hw,
 
 static const struct clk_ops imx8m_clk_composite_divider_ops = {
 	.recalc_rate = imx8m_clk_composite_divider_recalc_rate,
-	.round_rate = imx8m_clk_composite_divider_round_rate,
 	.set_rate = imx8m_clk_composite_divider_set_rate,
 	.determine_rate = imx8m_divider_determine_rate,
 };

-- 
2.50.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 02/13] clk: imx: composite-93: remove round_rate() in favor of determine_rate()
  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-10 21:10 ` 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
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Brian Masney @ 2025-07-10 21:10 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Maxime Ripard
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

This driver implements both the determine_rate() and round_rate() clk
ops, and the round_rate() clk ops is deprecated. When both are defined,
clk_core_determine_round_nolock() from the clk core will only use the
determine_rate() clk ops, so let's remove the round_rate() clk ops since
it's unused.

Signed-off-by: Brian Masney <bmasney@redhat.com>
---
 drivers/clk/imx/clk-composite-93.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/clk/imx/clk-composite-93.c b/drivers/clk/imx/clk-composite-93.c
index 6c6c5a30f3282d4d128751147714bf24b64c52f3..513d74a39d3bd391c61db2e9a5b7752af611d3b0 100644
--- a/drivers/clk/imx/clk-composite-93.c
+++ b/drivers/clk/imx/clk-composite-93.c
@@ -98,12 +98,6 @@ imx93_clk_composite_divider_recalc_rate(struct clk_hw *hw, unsigned long parent_
 	return clk_divider_ops.recalc_rate(hw, parent_rate);
 }
 
-static long
-imx93_clk_composite_divider_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *prate)
-{
-	return clk_divider_ops.round_rate(hw, rate, prate);
-}
-
 static int
 imx93_clk_composite_divider_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)
 {
@@ -141,7 +135,6 @@ static int imx93_clk_composite_divider_set_rate(struct clk_hw *hw, unsigned long
 
 static const struct clk_ops imx93_clk_composite_divider_ops = {
 	.recalc_rate = imx93_clk_composite_divider_recalc_rate,
-	.round_rate = imx93_clk_composite_divider_round_rate,
 	.determine_rate = imx93_clk_composite_divider_determine_rate,
 	.set_rate = imx93_clk_composite_divider_set_rate,
 };

-- 
2.50.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 03/13] clk: imx: busy: convert from round_rate() to determine_rate()
  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-10 21:10 ` [PATCH 02/13] clk: imx: composite-93: " Brian Masney
@ 2025-07-10 21:10 ` Brian Masney
  2025-07-24 22:16   ` Stephen Boyd
  2025-07-10 21:10 ` [PATCH 04/13] clk: imx: cpu: " Brian Masney
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Brian Masney @ 2025-07-10 21:10 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Maxime Ripard
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

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.

The change to call busy->div_ops->determine_rate() instead of
busy->div_ops->round_rate() was done by hand.

Signed-off-by: Brian Masney <bmasney@redhat.com>
---
 drivers/clk/imx/clk-busy.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/imx/clk-busy.c b/drivers/clk/imx/clk-busy.c
index f163df952ccc65baf300b62048f4303b0050fd75..eb27c6fee359d12eea8381cda981eab650ddcd50 100644
--- a/drivers/clk/imx/clk-busy.c
+++ b/drivers/clk/imx/clk-busy.c
@@ -46,12 +46,12 @@ static unsigned long clk_busy_divider_recalc_rate(struct clk_hw *hw,
 	return busy->div_ops->recalc_rate(&busy->div.hw, parent_rate);
 }
 
-static long clk_busy_divider_round_rate(struct clk_hw *hw, unsigned long rate,
-					unsigned long *prate)
+static int clk_busy_divider_determine_rate(struct clk_hw *hw,
+					   struct clk_rate_request *req)
 {
 	struct clk_busy_divider *busy = to_clk_busy_divider(hw);
 
-	return busy->div_ops->round_rate(&busy->div.hw, rate, prate);
+	return busy->div_ops->determine_rate(&busy->div.hw, req);
 }
 
 static int clk_busy_divider_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -69,7 +69,7 @@ static int clk_busy_divider_set_rate(struct clk_hw *hw, unsigned long rate,
 
 static const struct clk_ops clk_busy_divider_ops = {
 	.recalc_rate = clk_busy_divider_recalc_rate,
-	.round_rate = clk_busy_divider_round_rate,
+	.determine_rate = clk_busy_divider_determine_rate,
 	.set_rate = clk_busy_divider_set_rate,
 };
 

-- 
2.50.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 04/13] clk: imx: cpu: convert from round_rate() to determine_rate()
  2025-07-10 21:10 [PATCH 00/13] clk: imx: convert from clk round_rate() to determine_rate() Brian Masney
                   ` (2 preceding siblings ...)
  2025-07-10 21:10 ` [PATCH 03/13] clk: imx: busy: convert from round_rate() to determine_rate() Brian Masney
@ 2025-07-10 21:10 ` Brian Masney
  2025-07-24 22:16   ` Stephen Boyd
  2025-07-10 21:10 ` [PATCH 05/13] clk: imx: fixup-div: " Brian Masney
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Brian Masney @ 2025-07-10 21:10 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Maxime Ripard
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

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-cpu.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/imx/clk-cpu.c b/drivers/clk/imx/clk-cpu.c
index cb6ca4cf0535bab2d9d519c46a84564711aaf209..43637cb61693845f54b3bd1b92f548b43bc30caa 100644
--- a/drivers/clk/imx/clk-cpu.c
+++ b/drivers/clk/imx/clk-cpu.c
@@ -30,12 +30,14 @@ static unsigned long clk_cpu_recalc_rate(struct clk_hw *hw,
 	return clk_get_rate(cpu->div);
 }
 
-static long clk_cpu_round_rate(struct clk_hw *hw, unsigned long rate,
-			       unsigned long *prate)
+static int clk_cpu_determine_rate(struct clk_hw *hw,
+				  struct clk_rate_request *req)
 {
 	struct clk_cpu *cpu = to_clk_cpu(hw);
 
-	return clk_round_rate(cpu->pll, rate);
+	req->rate = clk_round_rate(cpu->pll, req->rate);
+
+	return 0;
 }
 
 static int clk_cpu_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -66,7 +68,7 @@ static int clk_cpu_set_rate(struct clk_hw *hw, unsigned long rate,
 
 static const struct clk_ops clk_cpu_ops = {
 	.recalc_rate	= clk_cpu_recalc_rate,
-	.round_rate	= clk_cpu_round_rate,
+	.determine_rate = clk_cpu_determine_rate,
 	.set_rate	= clk_cpu_set_rate,
 };
 

-- 
2.50.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 05/13] clk: imx: fixup-div: convert from round_rate() to determine_rate()
  2025-07-10 21:10 [PATCH 00/13] clk: imx: convert from clk round_rate() to determine_rate() Brian Masney
                   ` (3 preceding siblings ...)
  2025-07-10 21:10 ` [PATCH 04/13] clk: imx: cpu: " Brian Masney
@ 2025-07-10 21:10 ` Brian Masney
  2025-07-24 22:16   ` Stephen Boyd
  2025-07-10 21:10 ` [PATCH 06/13] clk: imx: fracn-gppll: " Brian Masney
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Brian Masney @ 2025-07-10 21:10 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Maxime Ripard
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

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.

The change to call fixup_div->ops->determine_rate() instead of
fixup_div->ops->round_rate() was done by hand.

Signed-off-by: Brian Masney <bmasney@redhat.com>
---
 drivers/clk/imx/clk-fixup-div.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/imx/clk-fixup-div.c b/drivers/clk/imx/clk-fixup-div.c
index 100ca828b052d701be84b62378844c1a9fcc1aaa..6af8fd065fd3cd71b66713105aa68b3b19a22810 100644
--- a/drivers/clk/imx/clk-fixup-div.c
+++ b/drivers/clk/imx/clk-fixup-div.c
@@ -41,12 +41,12 @@ static unsigned long clk_fixup_div_recalc_rate(struct clk_hw *hw,
 	return fixup_div->ops->recalc_rate(&fixup_div->divider.hw, parent_rate);
 }
 
-static long clk_fixup_div_round_rate(struct clk_hw *hw, unsigned long rate,
-			       unsigned long *prate)
+static int clk_fixup_div_determine_rate(struct clk_hw *hw,
+					struct clk_rate_request *req)
 {
 	struct clk_fixup_div *fixup_div = to_clk_fixup_div(hw);
 
-	return fixup_div->ops->round_rate(&fixup_div->divider.hw, rate, prate);
+	return fixup_div->ops->determine_rate(&fixup_div->divider.hw, req);
 }
 
 static int clk_fixup_div_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -81,7 +81,7 @@ static int clk_fixup_div_set_rate(struct clk_hw *hw, unsigned long rate,
 
 static const struct clk_ops clk_fixup_div_ops = {
 	.recalc_rate = clk_fixup_div_recalc_rate,
-	.round_rate = clk_fixup_div_round_rate,
+	.determine_rate = clk_fixup_div_determine_rate,
 	.set_rate = clk_fixup_div_set_rate,
 };
 

-- 
2.50.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 06/13] clk: imx: fracn-gppll: convert from round_rate() to determine_rate()
  2025-07-10 21:10 [PATCH 00/13] clk: imx: convert from clk round_rate() to determine_rate() Brian Masney
                   ` (4 preceding siblings ...)
  2025-07-10 21:10 ` [PATCH 05/13] clk: imx: fixup-div: " Brian Masney
@ 2025-07-10 21:10 ` Brian Masney
  2025-07-24 22:15   ` Stephen Boyd
  2025-07-10 21:10 ` [PATCH 07/13] clk: imx: frac-pll: " Brian Masney
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Brian Masney @ 2025-07-10 21:10 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Maxime Ripard
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

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-fracn-gppll.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/imx/clk-fracn-gppll.c b/drivers/clk/imx/clk-fracn-gppll.c
index 85771afd4698ae6a0d8a7e82193301e187049255..090d608672508a8819dc68eedec5b8d4a2c140c8 100644
--- a/drivers/clk/imx/clk-fracn-gppll.c
+++ b/drivers/clk/imx/clk-fracn-gppll.c
@@ -134,8 +134,8 @@ imx_get_pll_settings(struct clk_fracn_gppll *pll, unsigned long rate)
 	return NULL;
 }
 
-static long clk_fracn_gppll_round_rate(struct clk_hw *hw, unsigned long rate,
-				       unsigned long *prate)
+static int clk_fracn_gppll_determine_rate(struct clk_hw *hw,
+					  struct clk_rate_request *req)
 {
 	struct clk_fracn_gppll *pll = to_clk_fracn_gppll(hw);
 	const struct imx_fracn_gppll_rate_table *rate_table = pll->rate_table;
@@ -143,11 +143,16 @@ static long clk_fracn_gppll_round_rate(struct clk_hw *hw, unsigned long rate,
 
 	/* Assuming rate_table is in descending order */
 	for (i = 0; i < pll->rate_count; i++)
-		if (rate >= rate_table[i].rate)
-			return rate_table[i].rate;
+		if (req->rate >= rate_table[i].rate) {
+			req->rate = rate_table[i].rate;
+
+			return 0;
+		}
 
 	/* return minimum supported value */
-	return rate_table[pll->rate_count - 1].rate;
+	req->rate = rate_table[pll->rate_count - 1].rate;
+
+	return 0;
 }
 
 static unsigned long clk_fracn_gppll_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
@@ -345,7 +350,7 @@ static const struct clk_ops clk_fracn_gppll_ops = {
 	.unprepare	= clk_fracn_gppll_unprepare,
 	.is_prepared	= clk_fracn_gppll_is_prepared,
 	.recalc_rate	= clk_fracn_gppll_recalc_rate,
-	.round_rate	= clk_fracn_gppll_round_rate,
+	.determine_rate = clk_fracn_gppll_determine_rate,
 	.set_rate	= clk_fracn_gppll_set_rate,
 };
 

-- 
2.50.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 07/13] clk: imx: frac-pll: convert from round_rate() to determine_rate()
  2025-07-10 21:10 [PATCH 00/13] clk: imx: convert from clk round_rate() to determine_rate() Brian Masney
                   ` (5 preceding siblings ...)
  2025-07-10 21:10 ` [PATCH 06/13] clk: imx: fracn-gppll: " Brian Masney
@ 2025-07-10 21:10 ` Brian Masney
  2025-07-24 22:15   ` Stephen Boyd
  2025-07-10 21:10 ` [PATCH 08/13] clk: imx: pfd: " Brian Masney
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Brian Masney @ 2025-07-10 21:10 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Maxime Ripard
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

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


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 08/13] clk: imx: pfd: convert from round_rate() to determine_rate()
  2025-07-10 21:10 [PATCH 00/13] clk: imx: convert from clk round_rate() to determine_rate() Brian Masney
                   ` (6 preceding siblings ...)
  2025-07-10 21:10 ` [PATCH 07/13] clk: imx: frac-pll: " Brian Masney
@ 2025-07-10 21:10 ` Brian Masney
  2025-07-24 22:15   ` Stephen Boyd
  2025-07-10 21:10 ` [PATCH 09/13] clk: imx: pll14xx: " Brian Masney
                   ` (5 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Brian Masney @ 2025-07-10 21:10 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Maxime Ripard
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

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-pfd.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/imx/clk-pfd.c b/drivers/clk/imx/clk-pfd.c
index 5cf0149dfa15aab8b4cee47c8120753e3df45dac..31220fa7882b601f3535ad125114dba1eec95a9f 100644
--- a/drivers/clk/imx/clk-pfd.c
+++ b/drivers/clk/imx/clk-pfd.c
@@ -62,24 +62,26 @@ static unsigned long clk_pfd_recalc_rate(struct clk_hw *hw,
 	return tmp;
 }
 
-static long clk_pfd_round_rate(struct clk_hw *hw, unsigned long rate,
-			       unsigned long *prate)
+static int clk_pfd_determine_rate(struct clk_hw *hw,
+				  struct clk_rate_request *req)
 {
-	u64 tmp = *prate;
+	u64 tmp = req->best_parent_rate;
 	u8 frac;
 
-	tmp = tmp * 18 + rate / 2;
-	do_div(tmp, rate);
+	tmp = tmp * 18 + req->rate / 2;
+	do_div(tmp, req->rate);
 	frac = tmp;
 	if (frac < 12)
 		frac = 12;
 	else if (frac > 35)
 		frac = 35;
-	tmp = *prate;
+	tmp = req->best_parent_rate;
 	tmp *= 18;
 	do_div(tmp, frac);
 
-	return tmp;
+	req->rate = tmp;
+
+	return 0;
 }
 
 static int clk_pfd_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -117,7 +119,7 @@ static const struct clk_ops clk_pfd_ops = {
 	.enable		= clk_pfd_enable,
 	.disable	= clk_pfd_disable,
 	.recalc_rate	= clk_pfd_recalc_rate,
-	.round_rate	= clk_pfd_round_rate,
+	.determine_rate = clk_pfd_determine_rate,
 	.set_rate	= clk_pfd_set_rate,
 	.is_enabled     = clk_pfd_is_enabled,
 };

-- 
2.50.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 09/13] clk: imx: pll14xx: convert from round_rate() to determine_rate()
  2025-07-10 21:10 [PATCH 00/13] clk: imx: convert from clk round_rate() to determine_rate() Brian Masney
                   ` (7 preceding siblings ...)
  2025-07-10 21:10 ` [PATCH 08/13] clk: imx: pfd: " Brian Masney
@ 2025-07-10 21:10 ` Brian Masney
  2025-07-24 22:15   ` Stephen Boyd
  2025-07-10 21:10 ` [PATCH 10/13] clk: imx: pllv2: " Brian Masney
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Brian Masney @ 2025-07-10 21:10 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Maxime Ripard
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

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-pll14xx.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c
index f290981ea13bdba3602af7aa44aaadfe0b78dcf9..36d0e80b55b80385a065808916187d6d4c30137c 100644
--- a/drivers/clk/imx/clk-pll14xx.c
+++ b/drivers/clk/imx/clk-pll14xx.c
@@ -216,8 +216,8 @@ static void imx_pll14xx_calc_settings(struct clk_pll14xx *pll, unsigned long rat
 		 t->mdiv, t->kdiv);
 }
 
-static long clk_pll1416x_round_rate(struct clk_hw *hw, unsigned long rate,
-			unsigned long *prate)
+static int clk_pll1416x_determine_rate(struct clk_hw *hw,
+				       struct clk_rate_request *req)
 {
 	struct clk_pll14xx *pll = to_clk_pll14xx(hw);
 	const struct imx_pll14xx_rate_table *rate_table = pll->rate_table;
@@ -225,22 +225,29 @@ static long clk_pll1416x_round_rate(struct clk_hw *hw, unsigned long rate,
 
 	/* Assuming rate_table is in descending order */
 	for (i = 0; i < pll->rate_count; i++)
-		if (rate >= rate_table[i].rate)
-			return rate_table[i].rate;
+		if (req->rate >= rate_table[i].rate) {
+			req->rate = rate_table[i].rate;
+
+			return 0;
+		}
 
 	/* return minimum supported value */
-	return rate_table[pll->rate_count - 1].rate;
+	req->rate = rate_table[pll->rate_count - 1].rate;
+
+	return 0;
 }
 
-static long clk_pll1443x_round_rate(struct clk_hw *hw, unsigned long rate,
-			unsigned long *prate)
+static int clk_pll1443x_determine_rate(struct clk_hw *hw,
+				       struct clk_rate_request *req)
 {
 	struct clk_pll14xx *pll = to_clk_pll14xx(hw);
 	struct imx_pll14xx_rate_table t;
 
-	imx_pll14xx_calc_settings(pll, rate, *prate, &t);
+	imx_pll14xx_calc_settings(pll, req->rate, req->best_parent_rate, &t);
+
+	req->rate = t.rate;
 
-	return t.rate;
+	return 0;
 }
 
 static unsigned long clk_pll14xx_recalc_rate(struct clk_hw *hw,
@@ -470,7 +477,7 @@ static const struct clk_ops clk_pll1416x_ops = {
 	.unprepare	= clk_pll14xx_unprepare,
 	.is_prepared	= clk_pll14xx_is_prepared,
 	.recalc_rate	= clk_pll14xx_recalc_rate,
-	.round_rate	= clk_pll1416x_round_rate,
+	.determine_rate = clk_pll1416x_determine_rate,
 	.set_rate	= clk_pll1416x_set_rate,
 };
 
@@ -483,7 +490,7 @@ static const struct clk_ops clk_pll1443x_ops = {
 	.unprepare	= clk_pll14xx_unprepare,
 	.is_prepared	= clk_pll14xx_is_prepared,
 	.recalc_rate	= clk_pll14xx_recalc_rate,
-	.round_rate	= clk_pll1443x_round_rate,
+	.determine_rate = clk_pll1443x_determine_rate,
 	.set_rate	= clk_pll1443x_set_rate,
 };
 

-- 
2.50.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 10/13] clk: imx: pllv2: convert from round_rate() to determine_rate()
  2025-07-10 21:10 [PATCH 00/13] clk: imx: convert from clk round_rate() to determine_rate() Brian Masney
                   ` (8 preceding siblings ...)
  2025-07-10 21:10 ` [PATCH 09/13] clk: imx: pll14xx: " Brian Masney
@ 2025-07-10 21:10 ` Brian Masney
  2025-07-24 22:15   ` Stephen Boyd
  2025-07-10 21:10 ` [PATCH 11/13] clk: imx: pllv3: " Brian Masney
                   ` (3 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Brian Masney @ 2025-07-10 21:10 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Maxime Ripard
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

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-pllv2.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/imx/clk-pllv2.c b/drivers/clk/imx/clk-pllv2.c
index ff17f0664faad23d826d384fa8f972e21ebd7da7..bb497ad5e0ae3df923e8f01eb2b8af710f8f8f29 100644
--- a/drivers/clk/imx/clk-pllv2.c
+++ b/drivers/clk/imx/clk-pllv2.c
@@ -178,18 +178,25 @@ static int clk_pllv2_set_rate(struct clk_hw *hw, unsigned long rate,
 	return 0;
 }
 
-static long clk_pllv2_round_rate(struct clk_hw *hw, unsigned long rate,
-		unsigned long *prate)
+static int clk_pllv2_determine_rate(struct clk_hw *hw,
+				    struct clk_rate_request *req)
 {
 	u32 dp_op, dp_mfd, dp_mfn;
 	int ret;
 
-	ret = __clk_pllv2_set_rate(rate, *prate, &dp_op, &dp_mfd, &dp_mfn);
-	if (ret)
-		return ret;
+	ret = __clk_pllv2_set_rate(req->rate, req->best_parent_rate, &dp_op,
+				   &dp_mfd, &dp_mfn);
+	if (ret) {
+		req->rate = ret;
 
-	return __clk_pllv2_recalc_rate(*prate, MXC_PLL_DP_CTL_DPDCK0_2_EN,
-			dp_op, dp_mfd, dp_mfn);
+		return 0;
+	}
+
+	req->rate = __clk_pllv2_recalc_rate(req->best_parent_rate,
+					    MXC_PLL_DP_CTL_DPDCK0_2_EN, dp_op,
+					    dp_mfd, dp_mfn);
+
+	return 0;
 }
 
 static int clk_pllv2_prepare(struct clk_hw *hw)
@@ -235,7 +242,7 @@ static const struct clk_ops clk_pllv2_ops = {
 	.prepare = clk_pllv2_prepare,
 	.unprepare = clk_pllv2_unprepare,
 	.recalc_rate = clk_pllv2_recalc_rate,
-	.round_rate = clk_pllv2_round_rate,
+	.determine_rate = clk_pllv2_determine_rate,
 	.set_rate = clk_pllv2_set_rate,
 };
 

-- 
2.50.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 11/13] clk: imx: pllv3: convert from round_rate() to determine_rate()
  2025-07-10 21:10 [PATCH 00/13] clk: imx: convert from clk round_rate() to determine_rate() Brian Masney
                   ` (9 preceding siblings ...)
  2025-07-10 21:10 ` [PATCH 10/13] clk: imx: pllv2: " Brian Masney
@ 2025-07-10 21:10 ` Brian Masney
  2025-07-24 22:15   ` Stephen Boyd
  2025-07-10 21:10 ` [PATCH 12/13] clk: imx: pllv4: " Brian Masney
                   ` (2 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Brian Masney @ 2025-07-10 21:10 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Maxime Ripard
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

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-pllv3.c | 72 +++++++++++++++++++++++++--------------------
 1 file changed, 40 insertions(+), 32 deletions(-)

diff --git a/drivers/clk/imx/clk-pllv3.c b/drivers/clk/imx/clk-pllv3.c
index 11fb238ee8f0ece8116d3d7cebbbb7deaa4aee68..b99508367bcb4d7f3ef12cdbb5f5d5dcbf526c31 100644
--- a/drivers/clk/imx/clk-pllv3.c
+++ b/drivers/clk/imx/clk-pllv3.c
@@ -117,13 +117,14 @@ static unsigned long clk_pllv3_recalc_rate(struct clk_hw *hw,
 	return (div == 1) ? parent_rate * 22 : parent_rate * 20;
 }
 
-static long clk_pllv3_round_rate(struct clk_hw *hw, unsigned long rate,
-				 unsigned long *prate)
+static int clk_pllv3_determine_rate(struct clk_hw *hw,
+				    struct clk_rate_request *req)
 {
-	unsigned long parent_rate = *prate;
+	unsigned long parent_rate = req->best_parent_rate;
 
-	return (rate >= parent_rate * 22) ? parent_rate * 22 :
-					    parent_rate * 20;
+	req->rate = (req->rate >= parent_rate * 22) ? parent_rate * 22 : parent_rate * 20;
+
+	return 0;
 }
 
 static int clk_pllv3_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -152,7 +153,7 @@ static const struct clk_ops clk_pllv3_ops = {
 	.unprepare	= clk_pllv3_unprepare,
 	.is_prepared	= clk_pllv3_is_prepared,
 	.recalc_rate	= clk_pllv3_recalc_rate,
-	.round_rate	= clk_pllv3_round_rate,
+	.determine_rate = clk_pllv3_determine_rate,
 	.set_rate	= clk_pllv3_set_rate,
 };
 
@@ -165,21 +166,23 @@ static unsigned long clk_pllv3_sys_recalc_rate(struct clk_hw *hw,
 	return parent_rate * div / 2;
 }
 
-static long clk_pllv3_sys_round_rate(struct clk_hw *hw, unsigned long rate,
-				     unsigned long *prate)
+static int clk_pllv3_sys_determine_rate(struct clk_hw *hw,
+					struct clk_rate_request *req)
 {
-	unsigned long parent_rate = *prate;
+	unsigned long parent_rate = req->best_parent_rate;
 	unsigned long min_rate = parent_rate * 54 / 2;
 	unsigned long max_rate = parent_rate * 108 / 2;
 	u32 div;
 
-	if (rate > max_rate)
-		rate = max_rate;
-	else if (rate < min_rate)
-		rate = min_rate;
-	div = rate * 2 / parent_rate;
+	if (req->rate > max_rate)
+		req->rate = max_rate;
+	else if (req->rate < min_rate)
+		req->rate = min_rate;
+	div = req->rate * 2 / parent_rate;
 
-	return parent_rate * div / 2;
+	req->rate = parent_rate * div / 2;
+
+	return 0;
 }
 
 static int clk_pllv3_sys_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -207,7 +210,7 @@ static const struct clk_ops clk_pllv3_sys_ops = {
 	.unprepare	= clk_pllv3_unprepare,
 	.is_prepared	= clk_pllv3_is_prepared,
 	.recalc_rate	= clk_pllv3_sys_recalc_rate,
-	.round_rate	= clk_pllv3_sys_round_rate,
+	.determine_rate = clk_pllv3_sys_determine_rate,
 	.set_rate	= clk_pllv3_sys_set_rate,
 };
 
@@ -226,10 +229,10 @@ static unsigned long clk_pllv3_av_recalc_rate(struct clk_hw *hw,
 	return parent_rate * div + (unsigned long)temp64;
 }
 
-static long clk_pllv3_av_round_rate(struct clk_hw *hw, unsigned long rate,
-				    unsigned long *prate)
+static int clk_pllv3_av_determine_rate(struct clk_hw *hw,
+				       struct clk_rate_request *req)
 {
-	unsigned long parent_rate = *prate;
+	unsigned long parent_rate = req->best_parent_rate;
 	unsigned long min_rate = parent_rate * 27;
 	unsigned long max_rate = parent_rate * 54;
 	u32 div;
@@ -237,16 +240,16 @@ static long clk_pllv3_av_round_rate(struct clk_hw *hw, unsigned long rate,
 	u32 max_mfd = 0x3FFFFFFF;
 	u64 temp64;
 
-	if (rate > max_rate)
-		rate = max_rate;
-	else if (rate < min_rate)
-		rate = min_rate;
+	if (req->rate > max_rate)
+		req->rate = max_rate;
+	else if (req->rate < min_rate)
+		req->rate = min_rate;
 
 	if (parent_rate <= max_mfd)
 		mfd = parent_rate;
 
-	div = rate / parent_rate;
-	temp64 = (u64) (rate - div * parent_rate);
+	div = req->rate / parent_rate;
+	temp64 = (u64) (req->rate - div * parent_rate);
 	temp64 *= mfd;
 	temp64 = div64_ul(temp64, parent_rate);
 	mfn = temp64;
@@ -255,7 +258,9 @@ static long clk_pllv3_av_round_rate(struct clk_hw *hw, unsigned long rate,
 	temp64 *= mfn;
 	do_div(temp64, mfd);
 
-	return parent_rate * div + (unsigned long)temp64;
+	req->rate = parent_rate * div + (unsigned long)temp64;
+
+	return 0;
 }
 
 static int clk_pllv3_av_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -296,7 +301,7 @@ static const struct clk_ops clk_pllv3_av_ops = {
 	.unprepare	= clk_pllv3_unprepare,
 	.is_prepared	= clk_pllv3_is_prepared,
 	.recalc_rate	= clk_pllv3_av_recalc_rate,
-	.round_rate	= clk_pllv3_av_round_rate,
+	.determine_rate = clk_pllv3_av_determine_rate,
 	.set_rate	= clk_pllv3_av_set_rate,
 };
 
@@ -355,12 +360,15 @@ static unsigned long clk_pllv3_vf610_recalc_rate(struct clk_hw *hw,
 	return clk_pllv3_vf610_mf_to_rate(parent_rate, mf);
 }
 
-static long clk_pllv3_vf610_round_rate(struct clk_hw *hw, unsigned long rate,
-				    unsigned long *prate)
+static int clk_pllv3_vf610_determine_rate(struct clk_hw *hw,
+					  struct clk_rate_request *req)
 {
-	struct clk_pllv3_vf610_mf mf = clk_pllv3_vf610_rate_to_mf(*prate, rate);
+	struct clk_pllv3_vf610_mf mf = clk_pllv3_vf610_rate_to_mf(req->best_parent_rate,
+								  req->rate);
+
+	req->rate = clk_pllv3_vf610_mf_to_rate(req->best_parent_rate, mf);
 
-	return clk_pllv3_vf610_mf_to_rate(*prate, mf);
+	return 0;
 }
 
 static int clk_pllv3_vf610_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -389,7 +397,7 @@ static const struct clk_ops clk_pllv3_vf610_ops = {
 	.unprepare	= clk_pllv3_unprepare,
 	.is_prepared	= clk_pllv3_is_prepared,
 	.recalc_rate	= clk_pllv3_vf610_recalc_rate,
-	.round_rate	= clk_pllv3_vf610_round_rate,
+	.determine_rate = clk_pllv3_vf610_determine_rate,
 	.set_rate	= clk_pllv3_vf610_set_rate,
 };
 

-- 
2.50.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 12/13] clk: imx: pllv4: convert from round_rate() to determine_rate()
  2025-07-10 21:10 [PATCH 00/13] clk: imx: convert from clk round_rate() to determine_rate() Brian Masney
                   ` (10 preceding siblings ...)
  2025-07-10 21:10 ` [PATCH 11/13] clk: imx: pllv3: " Brian Masney
@ 2025-07-10 21:10 ` Brian Masney
  2025-07-24 22:15   ` Stephen Boyd
  2025-07-10 21:10 ` [PATCH 13/13] clk: imx: scu: " Brian Masney
  2025-07-15  6:57 ` [PATCH 00/13] clk: imx: convert from clk " Peng Fan
  13 siblings, 1 reply; 28+ messages in thread
From: Brian Masney @ 2025-07-10 21:10 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Maxime Ripard
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

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-pllv4.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/clk/imx/clk-pllv4.c b/drivers/clk/imx/clk-pllv4.c
index 9b136c951762c23cb7424405e1a66ec70af57d5c..01d05b5d543852c9eb48d1ae2b63e8f32b4f4a89 100644
--- a/drivers/clk/imx/clk-pllv4.c
+++ b/drivers/clk/imx/clk-pllv4.c
@@ -95,11 +95,11 @@ static unsigned long clk_pllv4_recalc_rate(struct clk_hw *hw,
 	return (parent_rate * mult) + (u32)temp64;
 }
 
-static long clk_pllv4_round_rate(struct clk_hw *hw, unsigned long rate,
-				 unsigned long *prate)
+static int clk_pllv4_determine_rate(struct clk_hw *hw,
+				    struct clk_rate_request *req)
 {
 	struct clk_pllv4 *pll = to_clk_pllv4(hw);
-	unsigned long parent_rate = *prate;
+	unsigned long parent_rate = req->best_parent_rate;
 	unsigned long round_rate, i;
 	u32 mfn, mfd = DEFAULT_MFD;
 	bool found = false;
@@ -107,7 +107,7 @@ static long clk_pllv4_round_rate(struct clk_hw *hw, unsigned long rate,
 	u32 mult;
 
 	if (pll->use_mult_range) {
-		temp64 = (u64)rate;
+		temp64 = (u64) req->rate;
 		do_div(temp64, parent_rate);
 		mult = temp64;
 		if (mult >= pllv4_mult_range[1] &&
@@ -118,7 +118,7 @@ static long clk_pllv4_round_rate(struct clk_hw *hw, unsigned long rate,
 	} else {
 		for (i = 0; i < ARRAY_SIZE(pllv4_mult_table); i++) {
 			round_rate = parent_rate * pllv4_mult_table[i];
-			if (rate >= round_rate) {
+			if (req->rate >= round_rate) {
 				found = true;
 				break;
 			}
@@ -127,14 +127,16 @@ static long clk_pllv4_round_rate(struct clk_hw *hw, unsigned long rate,
 
 	if (!found) {
 		pr_warn("%s: unable to round rate %lu, parent rate %lu\n",
-			clk_hw_get_name(hw), rate, parent_rate);
+			clk_hw_get_name(hw), req->rate, parent_rate);
+		req->rate = 0;
+
 		return 0;
 	}
 
 	if (parent_rate <= MAX_MFD)
 		mfd = parent_rate;
 
-	temp64 = (u64)(rate - round_rate);
+	temp64 = (u64)(req->rate - round_rate);
 	temp64 *= mfd;
 	do_div(temp64, parent_rate);
 	mfn = temp64;
@@ -145,14 +147,19 @@ static long clk_pllv4_round_rate(struct clk_hw *hw, unsigned long rate,
 	 * pair of mfn/mfd, we simply return the round_rate without using
 	 * the frac part.
 	 */
-	if (mfn >= mfd)
-		return round_rate;
+	if (mfn >= mfd) {
+		req->rate = round_rate;
+
+		return 0;
+	}
 
 	temp64 = (u64)parent_rate;
 	temp64 *= mfn;
 	do_div(temp64, mfd);
 
-	return round_rate + (u32)temp64;
+	req->rate = round_rate + (u32)temp64;
+
+	return 0;
 }
 
 static bool clk_pllv4_is_valid_mult(struct clk_pllv4 *pll, unsigned int mult)
@@ -229,7 +236,7 @@ static void clk_pllv4_unprepare(struct clk_hw *hw)
 
 static const struct clk_ops clk_pllv4_ops = {
 	.recalc_rate	= clk_pllv4_recalc_rate,
-	.round_rate	= clk_pllv4_round_rate,
+	.determine_rate = clk_pllv4_determine_rate,
 	.set_rate	= clk_pllv4_set_rate,
 	.prepare	= clk_pllv4_prepare,
 	.unprepare	= clk_pllv4_unprepare,

-- 
2.50.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 13/13] clk: imx: scu: convert from round_rate() to determine_rate()
  2025-07-10 21:10 [PATCH 00/13] clk: imx: convert from clk round_rate() to determine_rate() Brian Masney
                   ` (11 preceding siblings ...)
  2025-07-10 21:10 ` [PATCH 12/13] clk: imx: pllv4: " Brian Masney
@ 2025-07-10 21:10 ` Brian Masney
  2025-07-24 22:15   ` Stephen Boyd
  2025-07-15  6:57 ` [PATCH 00/13] clk: imx: convert from clk " Peng Fan
  13 siblings, 1 reply; 28+ messages in thread
From: Brian Masney @ 2025-07-10 21:10 UTC (permalink / raw)
  To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Maxime Ripard
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

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.

This driver also implements both the determine_rate() and round_rate()
clk ops, and the round_rate() clk ops is deprecated. When both are
defined, clk_core_determine_round_nolock() from the clk core will only
use the determine_rate() clk ops, so let's remove the round_rate() clk
ops since it's unused.

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

diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
index b27186aaf2a15628910ea6a3d4aaa5320ec4295a..77c4cde8a72bd71653bbd2e95148bc1357ec1aae 100644
--- a/drivers/clk/imx/clk-scu.c
+++ b/drivers/clk/imx/clk-scu.c
@@ -269,24 +269,6 @@ static int clk_scu_determine_rate(struct clk_hw *hw,
 	return 0;
 }
 
-/*
- * clk_scu_round_rate - Round clock rate for a SCU clock
- * @hw: clock to round rate for
- * @rate: rate to round
- * @parent_rate: parent rate provided by common clock framework, not used
- *
- * Returns the current clock rate, or zero in failure.
- */
-static long clk_scu_round_rate(struct clk_hw *hw, unsigned long rate,
-			       unsigned long *parent_rate)
-{
-	/*
-	 * Assume we support all the requested rate and let the SCU firmware
-	 * to handle the left work
-	 */
-	return rate;
-}
-
 static int clk_scu_atf_set_cpu_rate(struct clk_hw *hw, unsigned long rate,
 				    unsigned long parent_rate)
 {
@@ -454,7 +436,7 @@ static const struct clk_ops clk_scu_ops = {
 
 static const struct clk_ops clk_scu_cpu_ops = {
 	.recalc_rate = clk_scu_recalc_rate,
-	.round_rate = clk_scu_round_rate,
+	.determine_rate = clk_scu_determine_rate,
 	.set_rate = clk_scu_atf_set_cpu_rate,
 	.prepare = clk_scu_prepare,
 	.unprepare = clk_scu_unprepare,
@@ -462,7 +444,7 @@ static const struct clk_ops clk_scu_cpu_ops = {
 
 static const struct clk_ops clk_scu_pi_ops = {
 	.recalc_rate = clk_scu_recalc_rate,
-	.round_rate  = clk_scu_round_rate,
+	.determine_rate = clk_scu_determine_rate,
 	.set_rate    = clk_scu_set_rate,
 };
 
@@ -766,15 +748,15 @@ static unsigned long clk_gpr_div_scu_recalc_rate(struct clk_hw *hw,
 	return err ? 0 : rate;
 }
 
-static long clk_gpr_div_scu_round_rate(struct clk_hw *hw, unsigned long rate,
-				   unsigned long *prate)
+static int clk_gpr_div_scu_determine_rate(struct clk_hw *hw,
+					  struct clk_rate_request *req)
 {
-	if (rate < *prate)
-		rate = *prate / 2;
+	if (req->rate < req->best_parent_rate)
+		req->rate = req->best_parent_rate / 2;
 	else
-		rate = *prate;
+		req->rate = req->best_parent_rate;
 
-	return rate;
+	return 0;
 }
 
 static int clk_gpr_div_scu_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -793,7 +775,7 @@ static int clk_gpr_div_scu_set_rate(struct clk_hw *hw, unsigned long rate,
 
 static const struct clk_ops clk_gpr_div_scu_ops = {
 	.recalc_rate = clk_gpr_div_scu_recalc_rate,
-	.round_rate = clk_gpr_div_scu_round_rate,
+	.determine_rate = clk_gpr_div_scu_determine_rate,
 	.set_rate = clk_gpr_div_scu_set_rate,
 };
 

-- 
2.50.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCH 00/13] clk: imx: convert from clk round_rate() to determine_rate()
  2025-07-10 21:10 [PATCH 00/13] clk: imx: convert from clk round_rate() to determine_rate() Brian Masney
                   ` (12 preceding siblings ...)
  2025-07-10 21:10 ` [PATCH 13/13] clk: imx: scu: " Brian Masney
@ 2025-07-15  6:57 ` Peng Fan
  13 siblings, 0 replies; 28+ messages in thread
From: Peng Fan @ 2025-07-15  6:57 UTC (permalink / raw)
  To: Brian Masney
  Cc: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Maxime Ripard, linux-clk, imx, linux-arm-kernel, linux-kernel

On Thu, Jul 10, 2025 at 05:10:32PM -0400, Brian Masney wrote:
>The round_rate() clk ops is deprecated in the clk framework in favor
>of the determine_rate() clk ops. The first two patches in this series
>drops the round_rate() function since a determine_rate() function is
>already implemented. The remaining patches convert the drivers using
>the Coccinelle semantic patch posted below. I did a few minor cosmetic
>cleanups of the code in a few cases.
>
>Coccinelle semantic patch:
>
>    virtual patch
>
>    // Look up the current name of the round_rate function
>    @ has_round_rate @
>    identifier round_rate_name =~ ".*_round_rate";
>    identifier hw_param, rate_param, parent_rate_param;
>    @@
>
>    long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
>                  unsigned long *parent_rate_param)
>    {
>    	...
>    }
>
>    // Rename the route_rate function name to determine_rate()
>    @ script:python generate_name depends on has_round_rate @
>    round_rate_name << has_round_rate.round_rate_name;
>    new_name;
>    @@
>
>    coccinelle.new_name = round_rate_name.replace("_round_rate", "_determine_rate")
>
>    // Change rate to req->rate; also change occurrences of 'return XXX'.
>    @ chg_rate depends on generate_name @
>    identifier has_round_rate.round_rate_name;
>    identifier has_round_rate.hw_param;
>    identifier has_round_rate.rate_param;
>    identifier has_round_rate.parent_rate_param;
>    identifier ERR =~ "E.*";
>    expression E;
>    @@
>
>    long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
>                  unsigned long *parent_rate_param)
>    {
>    <...
>    (
>    -return -ERR;
>    +return -ERR;
>    |
>    - return rate_param;
>    + return 0;
>    |
>    - return E;
>    + req->rate = E;
>    +
>    + return 0;
>    |
>    - rate_param
>    + req->rate
>    )
>    ...>
>    }
>
>    // Coccinelle only transforms the first occurrence of the rate parameter
>    // Run a second time. FIXME: Is there a better way to do this?
>    @ chg_rate2 depends on generate_name @
>    identifier has_round_rate.round_rate_name;
>    identifier has_round_rate.hw_param;
>    identifier has_round_rate.rate_param;
>    identifier has_round_rate.parent_rate_param;
>    @@
>
>    long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
>                  unsigned long *parent_rate_param)
>    {
>    <...
>    - rate_param
>    + req->rate
>    ...>
>    }
>
>    // Change parent_rate to req->best_parent_rate
>    @ chg_parent_rate depends on generate_name @
>    identifier has_round_rate.round_rate_name;
>    identifier has_round_rate.hw_param;
>    identifier has_round_rate.rate_param;
>    identifier has_round_rate.parent_rate_param;
>    @@
>
>    long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
>                  unsigned long *parent_rate_param)
>    {
>    <...
>    (
>    - *parent_rate_param
>    + req->best_parent_rate
>    |
>    - parent_rate_param
>    + &req->best_parent_rate
>    )
>    ...>
>    }
>
>    // Convert the function definition from round_rate() to determine_rate()
>    @ func_definition depends on chg_rate @
>    identifier has_round_rate.round_rate_name;
>    identifier has_round_rate.hw_param;
>    identifier has_round_rate.rate_param;
>    identifier has_round_rate.parent_rate_param;
>    identifier generate_name.new_name;
>    @@
>
>    - long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
>    -               unsigned long *parent_rate_param)
>    + int new_name(struct clk_hw *hw, struct clk_rate_request *req)
>    {
>        ...
>    }
>
>    // Update the ops from round_rate() to determine_rate()
>    @ ops depends on func_definition @
>    identifier has_round_rate.round_rate_name;
>    identifier generate_name.new_name;
>    @@
>
>    {
>        ...,
>    -   .round_rate = round_rate_name,
>    +   .determine_rate = new_name,
>        ...,
>    }
>
>Note that I used coccinelle 1.2 instead of 1.3 since the newer version
>adds unnecessary braces as described in this post.
>https://lore.kernel.org/cocci/67642477-5f3e-4b2a-914d-579a54f48cbd@intel.com/
>
>Signed-off-by: Brian Masney <bmasney@redhat.com>

patchset LGTM:
Reviewed-by: Peng Fan <peng.fan@nxp.com>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 13/13] clk: imx: scu: convert from round_rate() to determine_rate()
  2025-07-10 21:10 ` [PATCH 13/13] clk: imx: scu: " Brian Masney
@ 2025-07-24 22:15   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2025-07-24 22:15 UTC (permalink / raw)
  To: Abel Vesa, Brian Masney, Fabio Estevam, Maxime Ripard,
	Michael Turquette, Peng Fan, Pengutronix Kernel Team,
	Sascha Hauer, Shawn Guo
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

Quoting Brian Masney (2025-07-10 14:10:45)
> 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.
> 
> This driver also implements both the determine_rate() and round_rate()
> clk ops, and the round_rate() clk ops is deprecated. When both are
> defined, clk_core_determine_round_nolock() from the clk core will only
> use the determine_rate() clk ops, so let's remove the round_rate() clk
> ops since it's unused.
> 
> Signed-off-by: Brian Masney <bmasney@redhat.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 12/13] clk: imx: pllv4: convert from round_rate() to determine_rate()
  2025-07-10 21:10 ` [PATCH 12/13] clk: imx: pllv4: " Brian Masney
@ 2025-07-24 22:15   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2025-07-24 22:15 UTC (permalink / raw)
  To: Abel Vesa, Brian Masney, Fabio Estevam, Maxime Ripard,
	Michael Turquette, Peng Fan, Pengutronix Kernel Team,
	Sascha Hauer, Shawn Guo
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

Quoting Brian Masney (2025-07-10 14:10:44)
> 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>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 11/13] clk: imx: pllv3: convert from round_rate() to determine_rate()
  2025-07-10 21:10 ` [PATCH 11/13] clk: imx: pllv3: " Brian Masney
@ 2025-07-24 22:15   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2025-07-24 22:15 UTC (permalink / raw)
  To: Abel Vesa, Brian Masney, Fabio Estevam, Maxime Ripard,
	Michael Turquette, Peng Fan, Pengutronix Kernel Team,
	Sascha Hauer, Shawn Guo
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

Quoting Brian Masney (2025-07-10 14:10:43)
> 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>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 10/13] clk: imx: pllv2: convert from round_rate() to determine_rate()
  2025-07-10 21:10 ` [PATCH 10/13] clk: imx: pllv2: " Brian Masney
@ 2025-07-24 22:15   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2025-07-24 22:15 UTC (permalink / raw)
  To: Abel Vesa, Brian Masney, Fabio Estevam, Maxime Ripard,
	Michael Turquette, Peng Fan, Pengutronix Kernel Team,
	Sascha Hauer, Shawn Guo
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

Quoting Brian Masney (2025-07-10 14:10:42)
> 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>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 09/13] clk: imx: pll14xx: convert from round_rate() to determine_rate()
  2025-07-10 21:10 ` [PATCH 09/13] clk: imx: pll14xx: " Brian Masney
@ 2025-07-24 22:15   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2025-07-24 22:15 UTC (permalink / raw)
  To: Abel Vesa, Brian Masney, Fabio Estevam, Maxime Ripard,
	Michael Turquette, Peng Fan, Pengutronix Kernel Team,
	Sascha Hauer, Shawn Guo
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

Quoting Brian Masney (2025-07-10 14:10:41)
> 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>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 08/13] clk: imx: pfd: convert from round_rate() to determine_rate()
  2025-07-10 21:10 ` [PATCH 08/13] clk: imx: pfd: " Brian Masney
@ 2025-07-24 22:15   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2025-07-24 22:15 UTC (permalink / raw)
  To: Abel Vesa, Brian Masney, Fabio Estevam, Maxime Ripard,
	Michael Turquette, Peng Fan, Pengutronix Kernel Team,
	Sascha Hauer, Shawn Guo
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

Quoting Brian Masney (2025-07-10 14:10:40)
> 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>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 07/13] clk: imx: frac-pll: convert from round_rate() to determine_rate()
  2025-07-10 21:10 ` [PATCH 07/13] clk: imx: frac-pll: " Brian Masney
@ 2025-07-24 22:15   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2025-07-24 22:15 UTC (permalink / raw)
  To: Abel Vesa, Brian Masney, Fabio Estevam, Maxime Ripard,
	Michael Turquette, Peng Fan, Pengutronix Kernel Team,
	Sascha Hauer, Shawn Guo
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

Quoting Brian Masney (2025-07-10 14:10:39)
> 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>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 06/13] clk: imx: fracn-gppll: convert from round_rate() to determine_rate()
  2025-07-10 21:10 ` [PATCH 06/13] clk: imx: fracn-gppll: " Brian Masney
@ 2025-07-24 22:15   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2025-07-24 22:15 UTC (permalink / raw)
  To: Abel Vesa, Brian Masney, Fabio Estevam, Maxime Ripard,
	Michael Turquette, Peng Fan, Pengutronix Kernel Team,
	Sascha Hauer, Shawn Guo
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

Quoting Brian Masney (2025-07-10 14:10:38)
> 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>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 05/13] clk: imx: fixup-div: convert from round_rate() to determine_rate()
  2025-07-10 21:10 ` [PATCH 05/13] clk: imx: fixup-div: " Brian Masney
@ 2025-07-24 22:16   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2025-07-24 22:16 UTC (permalink / raw)
  To: Abel Vesa, Brian Masney, Fabio Estevam, Maxime Ripard,
	Michael Turquette, Peng Fan, Pengutronix Kernel Team,
	Sascha Hauer, Shawn Guo
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

Quoting Brian Masney (2025-07-10 14:10:37)
> 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.
> 
> The change to call fixup_div->ops->determine_rate() instead of
> fixup_div->ops->round_rate() was done by hand.
> 
> Signed-off-by: Brian Masney <bmasney@redhat.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 04/13] clk: imx: cpu: convert from round_rate() to determine_rate()
  2025-07-10 21:10 ` [PATCH 04/13] clk: imx: cpu: " Brian Masney
@ 2025-07-24 22:16   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2025-07-24 22:16 UTC (permalink / raw)
  To: Abel Vesa, Brian Masney, Fabio Estevam, Maxime Ripard,
	Michael Turquette, Peng Fan, Pengutronix Kernel Team,
	Sascha Hauer, Shawn Guo
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

Quoting Brian Masney (2025-07-10 14:10:36)
> 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>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 03/13] clk: imx: busy: convert from round_rate() to determine_rate()
  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
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2025-07-24 22:16 UTC (permalink / raw)
  To: Abel Vesa, Brian Masney, Fabio Estevam, Maxime Ripard,
	Michael Turquette, Peng Fan, Pengutronix Kernel Team,
	Sascha Hauer, Shawn Guo
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

Quoting Brian Masney (2025-07-10 14:10:35)
> 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.
> 
> The change to call busy->div_ops->determine_rate() instead of
> busy->div_ops->round_rate() was done by hand.
> 
> Signed-off-by: Brian Masney <bmasney@redhat.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 02/13] clk: imx: composite-93: remove round_rate() in favor of determine_rate()
  2025-07-10 21:10 ` [PATCH 02/13] clk: imx: composite-93: " Brian Masney
@ 2025-07-24 22:16   ` Stephen Boyd
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2025-07-24 22:16 UTC (permalink / raw)
  To: Abel Vesa, Brian Masney, Fabio Estevam, Maxime Ripard,
	Michael Turquette, Peng Fan, Pengutronix Kernel Team,
	Sascha Hauer, Shawn Guo
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

Quoting Brian Masney (2025-07-10 14:10:34)
> This driver implements both the determine_rate() and round_rate() clk
> ops, and the round_rate() clk ops is deprecated. When both are defined,
> clk_core_determine_round_nolock() from the clk core will only use the
> determine_rate() clk ops, so let's remove the round_rate() clk ops since
> it's unused.
> 
> Signed-off-by: Brian Masney <bmasney@redhat.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 01/13] clk: imx: composite-8m: remove round_rate() in favor of determine_rate()
  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
  0 siblings, 0 replies; 28+ messages in thread
From: Stephen Boyd @ 2025-07-24 22:16 UTC (permalink / raw)
  To: Abel Vesa, Brian Masney, Fabio Estevam, Maxime Ripard,
	Michael Turquette, Peng Fan, Pengutronix Kernel Team,
	Sascha Hauer, Shawn Guo
  Cc: linux-clk, imx, linux-arm-kernel, linux-kernel, Brian Masney

Quoting Brian Masney (2025-07-10 14:10:33)
> This driver implements both the determine_rate() and round_rate() clk
> ops, and the round_rate() clk ops is deprecated. When both are defined,
> clk_core_determine_round_nolock() from the clk core will only use the
> determine_rate() clk ops, so let's remove the round_rate() clk ops since
> it's unused.
> 
> Signed-off-by: Brian Masney <bmasney@redhat.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2025-07-24 22:16 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 07/13] clk: imx: frac-pll: " Brian Masney
2025-07-24 22:15   ` 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

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).