Re: [PATCH 1/2] i2c: designware: Fix clock issue when PM is disabled

From: Kunihiko Hayashi
Date: Thu Jul 24 2025 - 00:06:02 EST


On 2025/07/24 11:13, Kunihiko Hayashi wrote:
When removing the driver, enable the clocks once by calling
pm_runtime_get_sync(), and call pm_runtime_put_sync() to disable
the clocks.

If CONFIG_PM=y, clocks for this controller are disabled when it's in
the idle state. So the clocks are properly disabled when the driver
exits.

Othewise, the clocks are always enabled and the PM functions have
no effect. Therefore, the driver exits without disabling the clocks.

# cat /sys/kernel/debug/clk/clk-pclk/clk_enable_count
18
# echo 1214a000.i2c > /sys/bus/platform/drivers/i2c_designware/bind
# cat /sys/kernel/debug/clk/clk-pclk/clk_enable_count
20
# echo 1214a000.i2c > /sys/bus/platform/drivers/i2c_designware/unbind
# cat /sys/kernel/debug/clk/clk-pclk/clk_enable_count
20

To ensure that the clocks can be disabled correctly even without
CONFIG_PM=y, should add the following fixes:

- Replace with pm_runtime_put_noidle(), which only decrements the clock
count.

This description is wrong.
The pm_runtime_put_noidle() decrements the runtime PM usage count.

- Call i2c_dw_prepare_clk(false) to explicitly disable the clocks.

This decrements the clock count.

I'll fix it and resend as v2.

Thanks,

---
Best Regards
Kunihiko Hayashi