* [PATCH] i2c: rk3x: enable clock before getting rate
@ 2021-10-04 13:15 John Keeping
2021-11-21 18:00 ` Heiko Stübner
2021-11-29 9:40 ` Wolfram Sang
0 siblings, 2 replies; 4+ messages in thread
From: John Keeping @ 2021-10-04 13:15 UTC (permalink / raw)
To: linux-i2c
Cc: John Keeping, Heiko Stuebner, linux-arm-kernel, linux-rockchip,
linux-kernel
clk_get_rate() is documented as requiring the clock to be enabled.
Ensure that the bus clock is enabled before calling clk_get_rate() in
rk3x_i2c_probe() to satisfy this requirement.
Signed-off-by: John Keeping <john@metanate.com>
---
drivers/i2c/busses/i2c-rk3x.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
index 819ab4ee517e..332755fab2a1 100644
--- a/drivers/i2c/busses/i2c-rk3x.c
+++ b/drivers/i2c/busses/i2c-rk3x.c
@@ -1338,8 +1338,15 @@ static int rk3x_i2c_probe(struct platform_device *pdev)
goto err_pclk;
}
+ ret = clk_enable(i2c->clk);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "Can't enable bus clk: %d\n", ret);
+ goto err_clk_notifier;
+ }
+
clk_rate = clk_get_rate(i2c->clk);
rk3x_i2c_adapt_div(i2c, clk_rate);
+ clk_disable(i2c->clk);
ret = i2c_add_adapter(&i2c->adap);
if (ret < 0)
--
2.33.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: rk3x: enable clock before getting rate
2021-10-04 13:15 [PATCH] i2c: rk3x: enable clock before getting rate John Keeping
@ 2021-11-21 18:00 ` Heiko Stübner
2021-11-22 7:39 ` Wolfram Sang
2021-11-29 9:40 ` Wolfram Sang
1 sibling, 1 reply; 4+ messages in thread
From: Heiko Stübner @ 2021-11-21 18:00 UTC (permalink / raw)
To: linux-i2c, John Keeping
Cc: John Keeping, linux-arm-kernel, linux-rockchip, linux-kernel
Am Montag, 4. Oktober 2021, 15:15:39 CET schrieb John Keeping:
> clk_get_rate() is documented as requiring the clock to be enabled.
> Ensure that the bus clock is enabled before calling clk_get_rate() in
> rk3x_i2c_probe() to satisfy this requirement.
>
> Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Do you maybe want to repost and include the actual i2c-maintainers
in the recipient list?
Heiko
> ---
> drivers/i2c/busses/i2c-rk3x.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
> index 819ab4ee517e..332755fab2a1 100644
> --- a/drivers/i2c/busses/i2c-rk3x.c
> +++ b/drivers/i2c/busses/i2c-rk3x.c
> @@ -1338,8 +1338,15 @@ static int rk3x_i2c_probe(struct platform_device *pdev)
> goto err_pclk;
> }
>
> + ret = clk_enable(i2c->clk);
> + if (ret < 0) {
> + dev_err(&pdev->dev, "Can't enable bus clk: %d\n", ret);
> + goto err_clk_notifier;
> + }
> +
> clk_rate = clk_get_rate(i2c->clk);
> rk3x_i2c_adapt_div(i2c, clk_rate);
> + clk_disable(i2c->clk);
>
> ret = i2c_add_adapter(&i2c->adap);
> if (ret < 0)
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: rk3x: enable clock before getting rate
2021-11-21 18:00 ` Heiko Stübner
@ 2021-11-22 7:39 ` Wolfram Sang
0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2021-11-22 7:39 UTC (permalink / raw)
To: Heiko Stübner
Cc: linux-i2c, John Keeping, linux-arm-kernel, linux-rockchip, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 637 bytes --]
On Sun, Nov 21, 2021 at 07:00:55PM +0100, Heiko Stübner wrote:
> Am Montag, 4. Oktober 2021, 15:15:39 CET schrieb John Keeping:
> > clk_get_rate() is documented as requiring the clock to be enabled.
> > Ensure that the bus clock is enabled before calling clk_get_rate() in
> > rk3x_i2c_probe() to satisfy this requirement.
> >
> > Signed-off-by: John Keeping <john@metanate.com>
>
> Reviewed-by: Heiko Stuebner <heiko@sntech.de>
>
> Do you maybe want to repost and include the actual i2c-maintainers
> in the recipient list?
No need. This is in patchwork and now has a Rev-by. Good enough.
Thanks for the review!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: rk3x: enable clock before getting rate
2021-10-04 13:15 [PATCH] i2c: rk3x: enable clock before getting rate John Keeping
2021-11-21 18:00 ` Heiko Stübner
@ 2021-11-29 9:40 ` Wolfram Sang
1 sibling, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2021-11-29 9:40 UTC (permalink / raw)
To: John Keeping
Cc: linux-i2c, Heiko Stuebner, linux-arm-kernel, linux-rockchip,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 436 bytes --]
On Mon, Oct 04, 2021 at 02:15:39PM +0100, John Keeping wrote:
> clk_get_rate() is documented as requiring the clock to be enabled.
> Ensure that the bus clock is enabled before calling clk_get_rate() in
> rk3x_i2c_probe() to satisfy this requirement.
>
> Signed-off-by: John Keeping <john@metanate.com>
Doesn't look like an urgent bugfix, so applied to for-next, thanks! Let
me know if it should go to for-current instead.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-29 9:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-04 13:15 [PATCH] i2c: rk3x: enable clock before getting rate John Keeping
2021-11-21 18:00 ` Heiko Stübner
2021-11-22 7:39 ` Wolfram Sang
2021-11-29 9:40 ` Wolfram Sang
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).