* [PATCH] pmdomain: mediatek: convert from clk round_rate() to determine_rate()
@ 2025-11-06 23:40 Brian Masney
2025-11-10 10:49 ` Nicolas Frattaroli
2025-11-10 12:23 ` Ulf Hansson
0 siblings, 2 replies; 3+ messages in thread
From: Brian Masney @ 2025-11-06 23:40 UTC (permalink / raw)
To: Ulf Hansson, Matthias Brugger, AngeloGioacchino Del Regno,
Nicolas Frattaroli, Maxime Ripard, Stephen Boyd
Cc: linux-clk, linux-pm, linux-kernel, linux-arm-kernel,
linux-mediatek, Brian Masney
The round_rate() clk ops is deprecated in the clk framework in favor
of the determine_rate() clk ops, so let's convert this driver so that
round_rate() can be removed from the clk core.
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c b/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c
index af20111067c02a5f9a0d6d751e9e0dc32c1a4d90..9bad577b3ae4bf1b83d4f782bb52f56f779a8974 100644
--- a/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c
+++ b/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c
@@ -309,11 +309,11 @@ static unsigned long mtk_mfg_recalc_rate_gpu(struct clk_hw *hw,
return readl(mfg->shared_mem + GF_REG_FREQ_OUT_GPU) * HZ_PER_KHZ;
}
-static long mtk_mfg_round_rate(struct clk_hw *hw, unsigned long rate,
- unsigned long *parent_rate)
+static int mtk_mfg_determine_rate(struct clk_hw *hw,
+ struct clk_rate_request *req)
{
/*
- * The round_rate callback needs to be implemented to avoid returning
+ * The determine_rate callback needs to be implemented to avoid returning
* the current clock frequency, rather than something even remotely
* close to the frequency that was asked for.
*
@@ -325,7 +325,7 @@ static long mtk_mfg_round_rate(struct clk_hw *hw, unsigned long rate,
* high current frequency, breaking the powersave governor in the process.
*/
- return rate;
+ return 0;
}
static unsigned long mtk_mfg_recalc_rate_stack(struct clk_hw *hw,
@@ -338,12 +338,12 @@ static unsigned long mtk_mfg_recalc_rate_stack(struct clk_hw *hw,
static const struct clk_ops mtk_mfg_clk_gpu_ops = {
.recalc_rate = mtk_mfg_recalc_rate_gpu,
- .round_rate = mtk_mfg_round_rate,
+ .determine_rate = mtk_mfg_determine_rate,
};
static const struct clk_ops mtk_mfg_clk_stack_ops = {
.recalc_rate = mtk_mfg_recalc_rate_stack,
- .round_rate = mtk_mfg_round_rate,
+ .determine_rate = mtk_mfg_determine_rate,
};
static const struct clk_init_data mtk_mfg_clk_gpu_init = {
---
base-commit: df5d79720b152e7ff058f11ed7e88d5b5c8d2a0c
change-id: 20251106-clk-pmdomain-mediatek-round-rate-649a9bf7d30a
Best regards,
--
Brian Masney <bmasney@redhat.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] pmdomain: mediatek: convert from clk round_rate() to determine_rate()
2025-11-06 23:40 [PATCH] pmdomain: mediatek: convert from clk round_rate() to determine_rate() Brian Masney
@ 2025-11-10 10:49 ` Nicolas Frattaroli
2025-11-10 12:23 ` Ulf Hansson
1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Frattaroli @ 2025-11-10 10:49 UTC (permalink / raw)
To: Ulf Hansson, Matthias Brugger, AngeloGioacchino Del Regno,
Maxime Ripard, Stephen Boyd, Brian Masney, Brian Masney
Cc: linux-clk, linux-pm, linux-kernel, linux-arm-kernel,
linux-mediatek
On Friday, 7 November 2025 00:40:43 Central European Standard Time Brian Masney wrote:
> The round_rate() clk ops is deprecated in the clk framework in favor
> of the determine_rate() clk ops, so let's convert this driver so that
> round_rate() can be removed from the clk core.
>
> Signed-off-by: Brian Masney <bmasney@redhat.com>
> ---
> drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c b/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c
> index af20111067c02a5f9a0d6d751e9e0dc32c1a4d90..9bad577b3ae4bf1b83d4f782bb52f56f779a8974 100644
> --- a/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c
> +++ b/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c
> @@ -309,11 +309,11 @@ static unsigned long mtk_mfg_recalc_rate_gpu(struct clk_hw *hw,
> return readl(mfg->shared_mem + GF_REG_FREQ_OUT_GPU) * HZ_PER_KHZ;
> }
>
> -static long mtk_mfg_round_rate(struct clk_hw *hw, unsigned long rate,
> - unsigned long *parent_rate)
> +static int mtk_mfg_determine_rate(struct clk_hw *hw,
> + struct clk_rate_request *req)
> {
> /*
> - * The round_rate callback needs to be implemented to avoid returning
> + * The determine_rate callback needs to be implemented to avoid returning
> * the current clock frequency, rather than something even remotely
> * close to the frequency that was asked for.
> *
> @@ -325,7 +325,7 @@ static long mtk_mfg_round_rate(struct clk_hw *hw, unsigned long rate,
> * high current frequency, breaking the powersave governor in the process.
> */
>
> - return rate;
> + return 0;
> }
>
> static unsigned long mtk_mfg_recalc_rate_stack(struct clk_hw *hw,
> @@ -338,12 +338,12 @@ static unsigned long mtk_mfg_recalc_rate_stack(struct clk_hw *hw,
>
> static const struct clk_ops mtk_mfg_clk_gpu_ops = {
> .recalc_rate = mtk_mfg_recalc_rate_gpu,
> - .round_rate = mtk_mfg_round_rate,
> + .determine_rate = mtk_mfg_determine_rate,
> };
>
> static const struct clk_ops mtk_mfg_clk_stack_ops = {
> .recalc_rate = mtk_mfg_recalc_rate_stack,
> - .round_rate = mtk_mfg_round_rate,
> + .determine_rate = mtk_mfg_determine_rate,
> };
>
> static const struct clk_init_data mtk_mfg_clk_gpu_init = {
>
> ---
> base-commit: df5d79720b152e7ff058f11ed7e88d5b5c8d2a0c
> change-id: 20251106-clk-pmdomain-mediatek-round-rate-649a9bf7d30a
>
> Best regards,
>
Reviewed-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
I didn't test boot this, but it should be fine, as I've checked
and all the places where the clk core checks for round_rate, it
also checks for determine_rate. So this is likely correct.
I've also made sure the adjusted op implementation is correct,
in that simply returning 0 leaves the requested rate as-is and
preserves the existing behaviour.
Kind regards,
Nicolas Frattaroli
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] pmdomain: mediatek: convert from clk round_rate() to determine_rate()
2025-11-06 23:40 [PATCH] pmdomain: mediatek: convert from clk round_rate() to determine_rate() Brian Masney
2025-11-10 10:49 ` Nicolas Frattaroli
@ 2025-11-10 12:23 ` Ulf Hansson
1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2025-11-10 12:23 UTC (permalink / raw)
To: Brian Masney
Cc: Matthias Brugger, AngeloGioacchino Del Regno, Nicolas Frattaroli,
Maxime Ripard, Stephen Boyd, linux-clk, linux-pm, linux-kernel,
linux-arm-kernel, linux-mediatek
On Fri, 7 Nov 2025 at 00:40, Brian Masney <bmasney@redhat.com> wrote:
>
> The round_rate() clk ops is deprecated in the clk framework in favor
> of the determine_rate() clk ops, so let's convert this driver so that
> round_rate() can be removed from the clk core.
>
> Signed-off-by: Brian Masney <bmasney@redhat.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c b/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c
> index af20111067c02a5f9a0d6d751e9e0dc32c1a4d90..9bad577b3ae4bf1b83d4f782bb52f56f779a8974 100644
> --- a/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c
> +++ b/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c
> @@ -309,11 +309,11 @@ static unsigned long mtk_mfg_recalc_rate_gpu(struct clk_hw *hw,
> return readl(mfg->shared_mem + GF_REG_FREQ_OUT_GPU) * HZ_PER_KHZ;
> }
>
> -static long mtk_mfg_round_rate(struct clk_hw *hw, unsigned long rate,
> - unsigned long *parent_rate)
> +static int mtk_mfg_determine_rate(struct clk_hw *hw,
> + struct clk_rate_request *req)
> {
> /*
> - * The round_rate callback needs to be implemented to avoid returning
> + * The determine_rate callback needs to be implemented to avoid returning
> * the current clock frequency, rather than something even remotely
> * close to the frequency that was asked for.
> *
> @@ -325,7 +325,7 @@ static long mtk_mfg_round_rate(struct clk_hw *hw, unsigned long rate,
> * high current frequency, breaking the powersave governor in the process.
> */
>
> - return rate;
> + return 0;
> }
>
> static unsigned long mtk_mfg_recalc_rate_stack(struct clk_hw *hw,
> @@ -338,12 +338,12 @@ static unsigned long mtk_mfg_recalc_rate_stack(struct clk_hw *hw,
>
> static const struct clk_ops mtk_mfg_clk_gpu_ops = {
> .recalc_rate = mtk_mfg_recalc_rate_gpu,
> - .round_rate = mtk_mfg_round_rate,
> + .determine_rate = mtk_mfg_determine_rate,
> };
>
> static const struct clk_ops mtk_mfg_clk_stack_ops = {
> .recalc_rate = mtk_mfg_recalc_rate_stack,
> - .round_rate = mtk_mfg_round_rate,
> + .determine_rate = mtk_mfg_determine_rate,
> };
>
> static const struct clk_init_data mtk_mfg_clk_gpu_init = {
>
> ---
> base-commit: df5d79720b152e7ff058f11ed7e88d5b5c8d2a0c
> change-id: 20251106-clk-pmdomain-mediatek-round-rate-649a9bf7d30a
>
> Best regards,
> --
> Brian Masney <bmasney@redhat.com>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-10 12:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-06 23:40 [PATCH] pmdomain: mediatek: convert from clk round_rate() to determine_rate() Brian Masney
2025-11-10 10:49 ` Nicolas Frattaroli
2025-11-10 12:23 ` Ulf Hansson
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).