public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Benedikt Spranger <b.spranger@linutronix.de>
To: Maxime Ripard <mripard@kernel.org>
Cc: Mike Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Dinh Nguyen <dinguyen@kernel.org>,
	linux-clk@vger.kernel.org
Subject: Re: [PATCH] clk: socfpga: gate: Account for the divider in determine_rate
Date: Fri, 13 Oct 2023 10:32:46 +0200	[thread overview]
Message-ID: <20231013103246.17ba3576@mitra> (raw)
In-Reply-To: <20231012083729.2148044-1-mripard@kernel.org>

Am Thu, 12 Oct 2023 10:37:29 +0200
schrieb Maxime Ripard <mripard@kernel.org>:

> Commit 9607beb917df ("clk: socfpga: gate: Add a determine_rate hook")
> added a determine_rate implementation set to the
> clk_hw_determine_rate_no_reparent, but failed to account for the
> internal divider that wasn't used before anywhere but in recalc_rate.
> 
> This led to inconsistencies between the clock rate stored in
> clk_core->rate and the one returned by clk_round_rate() that leverages
> determine_rate().
> 
> Since that driver seems to be widely used (and thus regression-prone)
> and not supporting rate changes (since it's missing a .set_rate
> implementation), we can just report the current divider programmed in
> the clock but not try to change it in any way.
> 
> This should be good enough to fix the issues reported, and if someone
> ever wants to allow the divider to change then it should be easy enough
> using the clk-divider helpers.
> 
> Link: https://lore.kernel.org/linux-clk/20231005095927.12398-2-b.spranger@linutronix.de/
> Fixes: 9607beb917df ("clk: socfpga: gate: Add a determine_rate hook")
> Reported-by: Benedikt Spranger <b.spranger@linutronix.de>
> Signed-off-by: Maxime Ripard <mripard@kernel.org>

To compile the patch I need that minor fix:

diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c
index 486a4d84e418..0a5a95e0267f 100644
--- a/drivers/clk/socfpga/clk-gate.c
+++ b/drivers/clk/socfpga/clk-gate.c
@@ -116,7 +116,7 @@ static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk,
 }


-static int socfpga_clk_determine_rate(struct clk_hw *hw,
+static int socfpga_clk_determine_rate(struct clk_hw *hwclk,
                                      struct clk_rate_request *req)
 {
        struct socfpga_gate_clk *socfpgaclk =
        to_socfpga_gate_clk(hwclk);


Thanks for the fix and your work.

Tested-by: Benedikt Spranger <b.spranger@linutronix.de>

      parent reply	other threads:[~2023-10-13  8:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-12  8:37 [PATCH] clk: socfpga: gate: Account for the divider in determine_rate Maxime Ripard
2023-10-12 22:42 ` Stephen Boyd
2023-10-13  8:32 ` Benedikt Spranger [this message]

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=20231013103246.17ba3576@mitra \
    --to=b.spranger@linutronix.de \
    --cc=dinguyen@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@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