mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chen Wang <unicorn_wang@outlook.com>
To: Brian Masney <bmasney@redhat.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Vladimir Zapolskiy <vz@mleia.com>,
	Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com>,
	Inochi Amaoto <inochiama@gmail.com>,
	Michal Simek <michal.simek@amd.com>,
	Bjorn Andersson <andersson@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	Andrea della Porta <andrea.porta@suse.com>,
	Maxime Ripard <mripard@kernel.org>
Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, sophgo@lists.linux.dev,
	linux-arm-msm@vger.kernel.org,
	linux-rockchip@lists.infradead.org
Subject: Re: [PATCH 6/8] clk: sophgo: sg2042-pll: remove round_rate() in favor of determine_rate()
Date: Fri, 29 Aug 2025 11:11:33 +0800	[thread overview]
Message-ID: <MAUPR01MB11072A23DEEA6F37D43DF0AFDFE3AA@MAUPR01MB11072.INDPRD01.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20250828-clk-round-rate-v2-v1-6-b97ec8ba6cc4@redhat.com>


On 8/29/2025 8:38 AM, Brian Masney wrote:
> 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.
>
> The implementation of sg2042_clk_pll_determine_rate() calls
> sg2042_clk_pll_round_rate(), so this folds the two into a single
> function.
>
> Reviewed-by: Chen Wang <unicorn_wang@outlook.com>
> Signed-off-by: Brian Masney <bmasney@redhat.com>

Tested-by: Chen Wang <unicorn_wang@outlook.com> # Pioneerbox

Thanks,

Chen

> ---
>   drivers/clk/sophgo/clk-sg2042-pll.c | 26 +++++++++-----------------
>   1 file changed, 9 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/clk/sophgo/clk-sg2042-pll.c b/drivers/clk/sophgo/clk-sg2042-pll.c
> index e5fb0bb7ac4f97616f3b472fcab45e5729eb653e..110b6ee06fe4b61e89f3cbf2ce00eb03c078afb6 100644
> --- a/drivers/clk/sophgo/clk-sg2042-pll.c
> +++ b/drivers/clk/sophgo/clk-sg2042-pll.c
> @@ -346,37 +346,30 @@ static unsigned long sg2042_clk_pll_recalc_rate(struct clk_hw *hw,
>   	return rate;
>   }
>   
> -static long sg2042_clk_pll_round_rate(struct clk_hw *hw,
> -				      unsigned long req_rate,
> -				      unsigned long *prate)
> +static int sg2042_clk_pll_determine_rate(struct clk_hw *hw,
> +					 struct clk_rate_request *req)
>   {
>   	struct sg2042_pll_ctrl pctrl_table;
>   	unsigned int value;
>   	long proper_rate;
>   	int ret;
>   
> -	ret = sg2042_get_pll_ctl_setting(&pctrl_table, req_rate, *prate);
> +	ret = sg2042_get_pll_ctl_setting(&pctrl_table,
> +					 min(req->rate, req->max_rate),
> +					 req->best_parent_rate);
>   	if (ret) {
>   		proper_rate = 0;
>   		goto out;
>   	}
>   
>   	value = sg2042_pll_ctrl_encode(&pctrl_table);
> -	proper_rate = (long)sg2042_pll_recalc_rate(value, *prate);
> +	proper_rate = (long)sg2042_pll_recalc_rate(value, req->best_parent_rate);
>   
>   out:
> -	pr_debug("--> %s: pll_round_rate: val = %ld\n",
> +	pr_debug("--> %s: pll_determine_rate: val = %ld\n",
>   		 clk_hw_get_name(hw), proper_rate);
> -	return proper_rate;
> -}
> +	req->rate = proper_rate;
>   
> -static int sg2042_clk_pll_determine_rate(struct clk_hw *hw,
> -					 struct clk_rate_request *req)
> -{
> -	req->rate = sg2042_clk_pll_round_rate(hw, min(req->rate, req->max_rate),
> -					      &req->best_parent_rate);
> -	pr_debug("--> %s: pll_determine_rate: val = %ld\n",
> -		 clk_hw_get_name(hw), req->rate);
>   	return 0;
>   }
>   
> @@ -417,14 +410,13 @@ static int sg2042_clk_pll_set_rate(struct clk_hw *hw,
>   
>   static const struct clk_ops sg2042_clk_pll_ops = {
>   	.recalc_rate = sg2042_clk_pll_recalc_rate,
> -	.round_rate = sg2042_clk_pll_round_rate,
>   	.determine_rate = sg2042_clk_pll_determine_rate,
>   	.set_rate = sg2042_clk_pll_set_rate,
>   };
>   
>   static const struct clk_ops sg2042_clk_pll_ro_ops = {
>   	.recalc_rate = sg2042_clk_pll_recalc_rate,
> -	.round_rate = sg2042_clk_pll_round_rate,
> +	.determine_rate = sg2042_clk_pll_determine_rate,
>   };
>   
>   /*
>

  reply	other threads:[~2025-08-29  3:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-29  0:38 [PATCH 0/8] clk: convert drivers from deprecated round_rate() to determine_rate() Brian Masney
2025-08-29  0:38 ` [PATCH 1/8] clk: nxp: lpc32xx: convert from " Brian Masney
2025-08-29  0:38 ` [PATCH 2/8] clk: qcom: alpha-pll: " Brian Masney
2025-08-29  0:38 ` [PATCH 3/8] clk: rockchip: half-divider: " Brian Masney
2025-08-29  0:38 ` [PATCH 4/8] clk: rp1: " Brian Masney
2025-09-04 18:28   ` Florian Fainelli
2025-08-29  0:38 ` [PATCH 5/8] clk: sophgo: sg2042-clkgen: " Brian Masney
2025-08-29  3:10   ` Chen Wang
2025-08-29  0:38 ` [PATCH 6/8] clk: sophgo: sg2042-pll: remove round_rate() in favor of determine_rate() Brian Masney
2025-08-29  3:11   ` Chen Wang [this message]
2025-08-29  0:38 ` [PATCH 7/8] clk: x86: cgu: convert from round_rate() to determine_rate() Brian Masney
2025-08-29  0:38 ` [PATCH 8/8] clk: zynqmp: divider: " Brian Masney
2025-09-04 14:35 ` (subset) [PATCH 0/8] clk: convert drivers from deprecated " Bjorn Andersson
2025-09-08 17:13 ` Brian Masney

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=MAUPR01MB11072A23DEEA6F37D43DF0AFDFE3AA@MAUPR01MB11072.INDPRD01.PROD.OUTLOOK.COM \
    --to=unicorn_wang@outlook.com \
    --cc=andersson@kernel.org \
    --cc=andrea.porta@suse.com \
    --cc=bmasney@redhat.com \
    --cc=heiko@sntech.de \
    --cc=inochiama@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=michal.simek@amd.com \
    --cc=mripard@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=piotr.wojtaszczyk@timesys.com \
    --cc=sboyd@kernel.org \
    --cc=sophgo@lists.linux.dev \
    --cc=vz@mleia.com \
    /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

all inboxes | Powered by JetHome®