* [PATCH] clk: rockchip: re-add rational best approximation algorithm to the fractional divider
@ 2022-01-31 16:32 quentin.schulz
2022-01-31 18:22 ` Andy Shevchenko
2022-02-23 23:44 ` Heiko Stuebner
0 siblings, 2 replies; 3+ messages in thread
From: quentin.schulz @ 2022-01-31 16:32 UTC (permalink / raw)
Cc: mturquette, sboyd, heiko, andriy.shevchenko, linux-clk,
linux-arm-kernel, linux-rockchip, linux-kernel, Quentin Schulz,
stable, Quentin Schulz
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
In commit 4e7cf74fa3b2 ("clk: fractional-divider: Export approximation
algorithm to the CCF users"), the code handling the rational best
approximation algorithm was replaced by a call to the core
clk_fractional_divider_general_approximation function which did the same
thing back then.
However, in commit 82f53f9ee577 ("clk: fractional-divider: Introduce
POWER_OF_TWO_PS flag"), this common code was made conditional on
CLK_FRAC_DIVIDER_POWER_OF_TWO_PS flag which was not added back to the
rockchip clock driver.
This broke the ltk050h3146w-a2 MIPI DSI display present on a PX30-based
downstream board.
Let's add the flag to the fractional divider flags so that the original
and intended behavior is brought back to the rockchip clock drivers.
Fixes: 82f53f9ee577 ("clk: fractional-divider: Introduce POWER_OF_TWO_PS flag")
Cc: stable@vger.kernel.org
Cc: Quentin Schulz <foss+kernel@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
drivers/clk/rockchip/clk.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
index b7be7e11b0df..bb8a844309bf 100644
--- a/drivers/clk/rockchip/clk.c
+++ b/drivers/clk/rockchip/clk.c
@@ -180,6 +180,7 @@ static void rockchip_fractional_approximation(struct clk_hw *hw,
unsigned long rate, unsigned long *parent_rate,
unsigned long *m, unsigned long *n)
{
+ struct clk_fractional_divider *fd = to_clk_fd(hw);
unsigned long p_rate, p_parent_rate;
struct clk_hw *p_parent;
@@ -190,6 +191,8 @@ static void rockchip_fractional_approximation(struct clk_hw *hw,
*parent_rate = p_parent_rate;
}
+ fd->flags |= CLK_FRAC_DIVIDER_POWER_OF_TWO_PS;
+
clk_fractional_divider_general_approximation(hw, rate, parent_rate, m, n);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: rockchip: re-add rational best approximation algorithm to the fractional divider
2022-01-31 16:32 [PATCH] clk: rockchip: re-add rational best approximation algorithm to the fractional divider quentin.schulz
@ 2022-01-31 18:22 ` Andy Shevchenko
2022-02-23 23:44 ` Heiko Stuebner
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2022-01-31 18:22 UTC (permalink / raw)
To: quentin.schulz, Chris Morgan, Douglas Anderson
Cc: mturquette, sboyd, heiko, linux-clk, linux-arm-kernel,
linux-rockchip, linux-kernel, stable, Quentin Schulz
On Mon, Jan 31, 2022 at 05:32:24PM +0100, quentin.schulz@theobroma-systems.com wrote:
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Thanks for your report.
> In commit 4e7cf74fa3b2 ("clk: fractional-divider: Export approximation
> algorithm to the CCF users"), the code handling the rational best
> approximation algorithm was replaced by a call to the core
> clk_fractional_divider_general_approximation function which did the same
> thing back then.
>
> However, in commit 82f53f9ee577 ("clk: fractional-divider: Introduce
> POWER_OF_TWO_PS flag"), this common code was made conditional on
> CLK_FRAC_DIVIDER_POWER_OF_TWO_PS flag which was not added back to the
> rockchip clock driver.
>
> This broke the ltk050h3146w-a2 MIPI DSI display present on a PX30-based
> downstream board.
>
> Let's add the flag to the fractional divider flags so that the original
> and intended behavior is brought back to the rockchip clock drivers.
I believe this was the result of the discussion about 1000 in DRM code.
I Cc'ed this to the people from 64ec4912c51a ("drm/rockchip: Update crtc
fixup to account for fractional clk change").
> Fixes: 82f53f9ee577 ("clk: fractional-divider: Introduce POWER_OF_TWO_PS flag")
> Cc: stable@vger.kernel.org
> Cc: Quentin Schulz <foss+kernel@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
> drivers/clk/rockchip/clk.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
> index b7be7e11b0df..bb8a844309bf 100644
> --- a/drivers/clk/rockchip/clk.c
> +++ b/drivers/clk/rockchip/clk.c
> @@ -180,6 +180,7 @@ static void rockchip_fractional_approximation(struct clk_hw *hw,
> unsigned long rate, unsigned long *parent_rate,
> unsigned long *m, unsigned long *n)
> {
> + struct clk_fractional_divider *fd = to_clk_fd(hw);
> unsigned long p_rate, p_parent_rate;
> struct clk_hw *p_parent;
>
> @@ -190,6 +191,8 @@ static void rockchip_fractional_approximation(struct clk_hw *hw,
> *parent_rate = p_parent_rate;
> }
>
> + fd->flags |= CLK_FRAC_DIVIDER_POWER_OF_TWO_PS;
> +
> clk_fractional_divider_general_approximation(hw, rate, parent_rate, m, n);
> }
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: rockchip: re-add rational best approximation algorithm to the fractional divider
2022-01-31 16:32 [PATCH] clk: rockchip: re-add rational best approximation algorithm to the fractional divider quentin.schulz
2022-01-31 18:22 ` Andy Shevchenko
@ 2022-02-23 23:44 ` Heiko Stuebner
1 sibling, 0 replies; 3+ messages in thread
From: Heiko Stuebner @ 2022-02-23 23:44 UTC (permalink / raw)
To: quentin.schulz
Cc: Heiko Stuebner, sboyd, linux-rockchip, linux-clk,
andriy.shevchenko, Quentin Schulz, mturquette, stable,
linux-arm-kernel, linux-kernel
On Mon, 31 Jan 2022 17:32:24 +0100, quentin.schulz@theobroma-systems.com wrote:
> In commit 4e7cf74fa3b2 ("clk: fractional-divider: Export approximation
> algorithm to the CCF users"), the code handling the rational best
> approximation algorithm was replaced by a call to the core
> clk_fractional_divider_general_approximation function which did the same
> thing back then.
>
> However, in commit 82f53f9ee577 ("clk: fractional-divider: Introduce
> POWER_OF_TWO_PS flag"), this common code was made conditional on
> CLK_FRAC_DIVIDER_POWER_OF_TWO_PS flag which was not added back to the
> rockchip clock driver.
>
> [...]
Applied, thanks!
[1/1] clk: rockchip: re-add rational best approximation algorithm to the fractional divider
commit: 10b74af310735860510a533433b1d3ab2e05a138
Best regards,
--
Heiko Stuebner <heiko@sntech.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-23 23:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-31 16:32 [PATCH] clk: rockchip: re-add rational best approximation algorithm to the fractional divider quentin.schulz
2022-01-31 18:22 ` Andy Shevchenko
2022-02-23 23:44 ` Heiko Stuebner
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).