From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx.socionext.com (mx.socionext.com [202.248.49.38]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F85C10E0; Thu, 24 Jul 2025 04:05:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.248.49.38 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753329953; cv=none; b=CGkyHFXBpxUePHM5PbZmT+43vX9Ss2n6BkyDc8YCZDxVTksSBVov5MQjOuZZHT60V3f3FCmm2FjBe7Sq8xX3awtzrQC4cts2907hkxe7g7SWpVzGl42MCphP7VJJpTwHGvvuyqxUyfAYnXzZH+SfEz+BurqJ/KY90eOLG1Q8Tno= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753329953; c=relaxed/simple; bh=PjC0BovuGjzZhyhgBKhpq9oPTWYLbz/8Llr3tOMBOqM=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=u1/o9gWOKAPQaTDZxJlT4/p53NVhkWjsOC2pvwf50FzEoa5IrahCWOU4fLWs5/1PBFFNN/PlibvT5DZfkG85gtgXthHuzyuwUU7+aujTdSRftT+YvkLWc8UkccPNa8MkD5ZC0j00DaSnhDAMmjbfo7xwIE5OM5obv2kq3b7Yjbo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=socionext.com; spf=pass smtp.mailfrom=socionext.com; arc=none smtp.client-ip=202.248.49.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=socionext.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=socionext.com Received: from unknown (HELO iyokan3-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 24 Jul 2025 13:05:49 +0900 Received: from mail.mfilter.local (mail-arc01.css.socionext.com [10.213.46.36]) by iyokan3-ex.css.socionext.com (Postfix) with ESMTP id 309302091485; Thu, 24 Jul 2025 13:05:49 +0900 (JST) Received: from iyokan3.css.socionext.com ([172.31.9.53]) by m-FILTER with ESMTP; Thu, 24 Jul 2025 13:05:49 +0900 Received: from [10.212.247.235] (unknown [10.212.247.235]) by iyokan3.css.socionext.com (Postfix) with ESMTP id 7EB7910D847; Thu, 24 Jul 2025 13:05:48 +0900 (JST) Message-ID: Date: Thu, 24 Jul 2025 13:05:48 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] i2c: designware: Fix clock issue when PM is disabled From: Kunihiko Hayashi To: Jarkko Nikula , Andy Shevchenko , Mika Westerberg , Jan Dabros , Andi Shyti Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, ito.kohei@socionext.com References: <20250724021317.2116943-1-hayashi.kunihiko@socionext.com> <20250724021317.2116943-2-hayashi.kunihiko@socionext.com> Content-Language: en-US In-Reply-To: <20250724021317.2116943-2-hayashi.kunihiko@socionext.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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