mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
To: Jarkko Nikula <jarkko.nikula@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Jan Dabros <jsd@semihalf.com>, Andi Shyti <andi.shyti@kernel.org>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	ito.kohei@socionext.com
Subject: Re: [PATCH 1/2] i2c: designware: Fix clock issue when PM is disabled
Date: Thu, 24 Jul 2025 13:05:48 +0900	[thread overview]
Message-ID: <e884f5c2-0bb3-42a2-9d96-d199e60f1dec@socionext.com> (raw)
In-Reply-To: <20250724021317.2116943-2-hayashi.kunihiko@socionext.com>

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

  reply	other threads:[~2025-07-24  4:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-24  2:13 [PATCH 0/2] i2c: designware: Fixes clock issues with platform driver Kunihiko Hayashi
2025-07-24  2:13 ` [PATCH 1/2] i2c: designware: Fix clock issue when PM is disabled Kunihiko Hayashi
2025-07-24  4:05   ` Kunihiko Hayashi [this message]
2025-07-24  2:13 ` [PATCH 2/2] i2c: designware: Add disabling clocks when probe fails Kunihiko Hayashi

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=e884f5c2-0bb3-42a2-9d96-d199e60f1dec@socionext.com \
    --to=hayashi.kunihiko@socionext.com \
    --cc=andi.shyti@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ito.kohei@socionext.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jsd@semihalf.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    /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

all inboxes | Powered by JetHome®