Re: [PATCH 1/2] i2c: sprd: Prevent i2c accesses after suspend is called

From: Grygorii Strashko
Date: Thu May 03 2018 - 12:27:00 EST




On 05/02/2018 12:48 AM, Baolin Wang wrote:
> On 2 May 2018 at 13:23, Wolfram Sang <wsa@xxxxxxxxxxxxx> wrote:
>>
>>>> We should maybe handle this in the core somewhen, though. Or?
>>>
>>> Thanks. Yes, It will more helpful if we can handle this in the i2c core.
>>
>> To understand the issue better: which kind of devices in your system
>> still send I2C transfers when the system is going to suspend? Do you
>> know?
>
> Now we found the touch screen device will trigger I2C transfers when
> the system is going to suspend.
>

And you have to fix it (touch screen) - not your i2c driver. Otherwise, you can get
situation when set of I2C transfers (executed from some kthread/work/threaded_irq/..)
will be just interrupted in the middle - usual behavior after this is (I2C timeout) [and/or
not-functional I2C client device [and/or I2C bus stuck (worst case)].

In case, somebody is trying to access I2C after .suspend_noirq() stage I2C bus driver
should produce big fat warning and, most probably, abort suspend.
Above, in general, can be part of I2C core functionality.

--
regards,
-grygorii