[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<VI2PR04MB111474EAC1B4DB8EB6DD32628E8862@VI2PR04MB11147.eurprd04.prod.outlook.com>
Date: Sun, 27 Apr 2025 07:23:09 +0000
From: Carlos Song <carlos.song@....com>
To: Andi Shyti <andi.shyti@...nel.org>
CC: Aisheng Dong <aisheng.dong@....com>, Frank Li <frank.li@....com>,
"shawnguo@...nel.org" <shawnguo@...nel.org>, "s.hauer@...gutronix.de"
<s.hauer@...gutronix.de>, "kernel@...gutronix.de" <kernel@...gutronix.de>,
"festevam@...il.com" <festevam@...il.com>, "linux-i2c@...r.kernel.org"
<linux-i2c@...r.kernel.org>, "imx@...ts.linux.dev" <imx@...ts.linux.dev>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] i2c: imx-lpi2c: Fix clock count when probe defers
> -----Original Message-----
> From: Andi Shyti <andi.shyti@...nel.org>
> Sent: Friday, April 25, 2025 7:29 PM
> To: Carlos Song <carlos.song@....com>
> Cc: Aisheng Dong <aisheng.dong@....com>; Frank Li <frank.li@....com>;
> shawnguo@...nel.org; s.hauer@...gutronix.de; kernel@...gutronix.de;
> festevam@...il.com; linux-i2c@...r.kernel.org; imx@...ts.linux.dev;
> linux-arm-kernel@...ts.infradead.org; linux-kernel@...r.kernel.org
> Subject: [EXT] Re: [PATCH] i2c: imx-lpi2c: Fix clock count when probe defers
>
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report this
> email' button
>
>
> On Mon, Apr 21, 2025 at 02:23:41PM +0800, carlos.song@....com wrote:
> > From: Clark Wang <xiaoning.wang@....com>
> >
> > Deferred probe with pm_runtime_put() may delay clock disable, causing
> > incorrect clock usage count. Use pm_runtime_put_sync() to ensure the
> > clock is disabled immediately.
>
> What is the outcome of the incorrect clock usage count? Do you have any logs?
>
Hi, Andi
Thank you!
At imx943 board, I notice sometimes after boot one of lpi2cs enable count is 1, but now the controller has been suspend(enable count should be 0).
This is a lpi2c4 example:
root@...943evk:~# cat /sys/kernel/debug/clk/clk_summary
enable prepare protect duty hardware connection
clock count count count rate accuracy phase cycle enable consumer id
lpi2c8 0 0 0 24000000 0 0 50000 Y deviceless no_connection_id
lpi2c7 0 0 0 24000000 0 0 50000 Y deviceless no_connection_id
lpi2c6 0 2 1 24000000 0 0 50000 Y i2c@...c0000 no_connection_id
lpi2c5 0 0 0 24000000 0 0 50000 Y deviceless no_connection_id
--> lpi2c4 1 2 1 24000000 0 0 50000 Y i2c@...40000 no_connection_id
lpi2c3 0 2 1 24000000 0 0 50000 Y i2c@...30000 no_connection_id
lpi2c2 0 0 0 24000000 0 0 50000 Y deviceless no_connection_id
lpi2c1 0 0 0 24000000 0 0 50000 Y deviceless no_connection_id
root@...943evk:~# cat /sys/devices/platform/soc/42000000.bus/42540000.i2c/power/runtime_status
suspended
Normal case should be this:
Enable count is 0 and controller is suspended.
root@...943evk:~# cat /sys/kernel/debug/clk/clk_summary | grep i2c
enable prepare protect duty hardware connection
clock count count count rate accuracy phase cycle enable consumer id
lpi2c8 0 0 0 24000000 0 0 50000 Y deviceless no_connection_id
lpi2c7 0 0 0 24000000 0 0 50000 Y deviceless no_connection_id
lpi2c6 0 2 1 24000000 0 0 50000 Y i2c@...c0000 no_connection_id
lpi2c5 0 0 0 24000000 0 0 50000 Y deviceless no_connection_id
lpi2c4 0 2 1 24000000 0 0 50000 Y i2c@...40000 no_connection_id
lpi2c3 0 2 1 24000000 0 0 50000 Y i2c@...30000 no_connection_id
lpi2c2 0 0 0 24000000 0 0 50000 Y deviceless no_connection_id
lpi2c1 0 0 0 24000000 0 0 50000 Y deviceless no_connection_id
root@...943evk:~# cat /sys/devices/platform/soc/42000000.bus/42540000.i2c/power/runtime_status
suspended
Add debug log, when defer probe happened on imx-lpi2c 42540000.i2c.
goto rpm_disable path:
rpm_disable:
pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev);
pm_runtime_dont_use_autosuspend(&pdev->dev);
pm_runtime_put() may not work really sometimes.
[ 3.203715] imx-lpi2c 42530000.i2c: defer probe
[ 3.208324] imx-lpi2c 42530000.i2c: lpi2c_runtime_suspend
[ 3.214801] imx-lpi2c 42540000.i2c: defer probe
---> (No lpi2c_runtime_suspend callback(pm_runtime_put() is not really wrok))
[ 3.220672] imx-lpi2c 426c0000.i2c: defer probe
[ 3.225248] imx-lpi2c 426c0000.i2c: lpi2c_runtime_suspend
After apply this change:
rpm_disable:
pm_runtime_dont_use_autosuspend(&pdev->dev);
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
all issues gone.
[ 3.093025] imx-lpi2c 42530000.i2c: defer probe
[ 3.097592] imx-lpi2c 42530000.i2c: lpi2c_runtime_suspend
[ 3.104281] imx-lpi2c 42540000.i2c: defer probe
[ 3.108858] imx-lpi2c 42540000.i2c: lpi2c_runtime_suspend
[ 3.115278] imx-lpi2c 426c0000.i2c: defer probe
[ 3.119818] imx-lpi2c 426c0000.i2c: lpi2c_runtime_suspend
root@...943evk:~# cat /sys/kernel/debug/clk/clk_summary | grep i2c
enable prepare protect duty hardware connection
clock count count count rate accuracy phase cycle enable consumer id
lpi2c8 0 0 0 24000000 0 0 50000 Y deviceless no_connection_id
lpi2c7 0 0 0 24000000 0 0 50000 Y deviceless no_connection_id
lpi2c6 0 2 1 24000000 0 0 50000 Y i2c@...c0000 no_connection_id
lpi2c5 0 0 0 24000000 0 0 50000 Y deviceless no_connection_id
lpi2c4 0 2 1 24000000 0 0 50000 Y i2c@...40000 no_connection_id
lpi2c3 0 2 1 24000000 0 0 50000 Y i2c@...30000 no_connection_id
lpi2c2 0 0 0 24000000 0 0 50000 Y deviceless no_connection_id
lpi2c1 0 0 0 24000000 0 0 50000 Y deviceless no_connection_id
> > Signed-off-by: Carlos Song <carlos.song@....com>
> > Signed-off-by: Clark Wang <xiaoning.wang@....com>
> > Signed-off-by: Jun Li <jun.li@....com>
> > Signed-off-by: Haibo Chen <haibo.chen@....com>
>
> Carlo's SoB should be at the end of the chain. Should be nice to know what these
> are, though, are they co-developed-by? tested-by?
> Why so many SoB's?
>
This patch author is not me and they meet similar issue at some boards(Vague history), now
I meet this issue at new SOC again. I think this local patch is helpful and looks reasonable.
So I send the patch to community adding my SoB.
> (no need to resend for this)
>
> Andi
Powered by blists - more mailing lists