On 9/12/22 12:15, Hans de Goede wrote:
Hi Richard,
On 12/9/22 12:40, Richard Fitzgerald wrote:
Ensure that i2c_mark_adapter_suspended() is always balanced by a call to
i2c_mark_adapter_resumed().
<snip>
It is not entirely clear to me where the unbalance you claim to see comes
from? When runtime-suspended SMART_SUSPEND should keep it suspended at which point
the system suspend callback will never run ?
Are you sure that you are not maybe seeing a suspend/resume ordering issue?
Did you add printk messages to the suspend/resume callbacks of
i2c-designware-platdrv.c which show the system suspend callback
being called but not the system resume one ?
With messages in strategic places.
[ 169.607358] i2c_designware i2c_designware.2: PM: dev_pm_skip_suspend:
SMART_SUSPEND=0 pm_runtime_status_suspended=1
[ 169.607361] i2c_designware i2c_designware.2: PM:
__device_suspend_late: dev_pm_skip_suspend:false
[ 169.607364] i2c_designware i2c_designware.2: dw_i2c_plat_suspend
...
[ 169.702511] i2c_designware i2c_designware.2: PM: dev_pm_skip_resume:
1 because !power.must_resume
[ 169.706241] i2c_designware i2c_designware.2: PM: dev_pm_skip_resume:
1 because !power.must_resume
[ 169.706244] i2c_designware i2c_designware.2: PM: device_resume_early:
dev_pm_skip_resume:true
...
[ 175.254832] i2c i2c-2: Transfer while suspended
(Just to prove my logging isn't lying, for i2c3 it reports
SMART_SUSPEND=1)
So it can skip the resume even if it didn't skip the suspend.
The SMART_SUSPEND flag is not set on i2c2 and the driver core can
skip resume even if it didn't skip suspend.