Re: [PATCH] i2c: imx: make controller available until system suspend_noirq() and from resume_noirq()

From: Andi Shyti
Date: Thu Dec 12 2024 - 07:12:49 EST


Hi Carlos,

On Mon, Nov 25, 2024 at 10:21:08PM +0800, carlos.song@xxxxxxx wrote:
> From: Carlos Song <carlos.song@xxxxxxx>
>
> Put runtime pm to resume state between suspend() and suspend_noirq(),
> resume_noirq() and resume(), because some I2C devices need controller
> on to do communication during this period.
>
> The controller can't be wakeup once runtime pm is disabled and in
> runtime autosuspended state.
>
> The problem can be easily reproduced on the I.MX8MQ platform:
> PMIC needs to be used to enable regular when the system resumes.
> When PMIC uses I2C controller, I2C runtime pm has not been enabled,
> so in i2c xfer(), pm_runtime_resume_and_get() will return error,
> which causes data transfer failed. Therefore, regulars can not
> be enabled and hang system resumes.
> Here is resume error log:
> [ 53.888902] galcore 38000000.gpu3d: PM: calling genpd_resume_noirq @ 529, parent: platform
> [ 53.897203] i2c_imx_xfer, pm_runtime_resume_and_get is -13
> [ 53.902713] imx-pgc imx-pgc-domain.5: failed to enable regulator: -EACCES
> [ 53.909518] galcore 38000000.gpu3d: PM: genpd_resume_noirq returned 0 after 12331 usecs
> [ 53.917545] mxc_hantro 38300000.vpu: PM: calling genpd_resume_noirq @ 529, parent: soc@0
> [ 53.925659] i2c_imx_xfer, pm_runtime_resume_and_get is -13
> [ 53.931157] imx-pgc imx-pgc-domain.6: failed to enable regulator: -EACCES
>
> I.MX8MQ system resume normally after applying the fix. Here is resume log:
> [ 71.068807] galcore 38000000.gpu3d: PM: calling genpd_resume_noirq @ 530, parent: platform
> [ 71.077103] i2c_imx_xfer, pm_runtime_resume_and_get is 0
> [ 71.083578] galcore 38000000.gpu3d: PM: genpd_resume_noirq returned 0 after 6490 usecs
> [ 71.091526] mxc_hantro 38300000.vpu: PM: calling genpd_resume_noirq @ 530, parent: soc@0
> [ 71.099638] i2c_imx_xfer, pm_runtime_resume_and_get is 0
> [ 71.106091] mxc_hantro 38300000.vpu: PM: genpd_resume_noirq returned 0 after 6458 usecs
>
> Signed-off-by: Carlos Song <carlos.song@xxxxxxx>
> Signed-off-by: Haibo Chen <haibo.chen@xxxxxxx>

merged to i2c/i2c-host.

Thanks,
Andi