From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Qii Wang <qii.wang@mediatek.com>
Cc: Wolfram Sang <wsa@the-dreams.de>, <matthias.bgg@gmail.com>,
<linux-i2c@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
<linux-mediatek@lists.infradead.org>,
<srv_heupstream@mediatek.com>, <leilk.liu@mediatek.com>
Subject: Re: [v2] i2c: mediatek: Move suspend and resume handling to NOIRQ phase
Date: Mon, 7 Dec 2020 18:35:52 +0200 [thread overview]
Message-ID: <a9cb5ba5-f3ce-3f82-15cc-30419bb70f4e@ti.com> (raw)
In-Reply-To: <1607326431.25719.33.camel@mhfsdcap03>
On 07/12/2020 09:33, Qii Wang wrote:
> Hi:
> Thank you very much for your patience review.
> There are two main purposes of this patch:
> 1.i2c_mark_adapter_suspended&i2c_mark_adapter_resumed
> Avoid accessing the adapter while it is suspended by marking it
> suspended during suspend. This allows the I2C core to catch this, and
> print a warning.
> https://patchwork.kernel.org/project/linux-arm-kernel/patch/20181219164827.20985-2-wsa+renesas@sang-engineering.com/
>
> 2. IRQF_NO_SUSPEND.
> Having interrupts disabled means not only that an interrupt will not
> occur at an awkward time, but also that using any functionality that
> requires interrupts will not work. So if the driver uses an I2C bus or
> similar to tell the device to turn off, and if the I2C bus uses
> interrupts to indicate completion (which is normal), then either the
> device must be powered-off in suspend_late, so the I2C interrupt must be
> marked IRQF_NO_SUSPEND.
> https://patchwork.kernel.org/project/linux-acpi/patch/20180923135812.29574-8-hdegoede@redhat.com/
>
Pls, do not top post.
>
> On Thu, 2020-12-03 at 10:01 +0200, Grygorii Strashko wrote:
>>
>> On 03/12/2020 03:25, Qii Wang wrote:
>>> On Wed, 2020-12-02 at 16:35 +0100, Wolfram Sang wrote:
>>>> Hi,
>>>>
>>>>> Some i2c device driver indirectly uses I2C driver when it is now
>>>>> being suspended. The i2c devices driver is suspended during the
>>>>> NOIRQ phase and this cannot be changed due to other dependencies.
>>>>> Therefore, we also need to move the suspend handling for the I2C
>>>>> controller driver to the NOIRQ phase as well.
>>>>>
>>>>> Signed-off-by: Qii Wang <qii.wang@mediatek.com>
>>>>
>>>> Is this a bugfix and should go into 5.10? Or can it wait for 5.11?
>>>>
>>>
>>> Yes, Can you help to apply it into 5.10? Thanks
>>
>> To be honest if you still do have any i2c device which accessing i2c buss after _noirq
>> stage and your driver does not implement .master_xfer_atomic() - you definitely have a bigger problem.
>> So adding IRQF_NO_SUSPEND sound like a hack and probably works just by luck.
>>
>
> At present, it is only a problem caused by missing interrupts,
> and .master_xfer_atomic() just a implement in polling mode. Why not set
> the interrupt to a state that can always be triggered?
>
>
Because you must not use any IRQ driven operations after _noirq suspend state as it might (and most probably will)
cause unpredictable behavior later in suspend_enter():
arch_suspend_disable_irqs();
BUG_ON(!irqs_disabled());
^after this point any IRQ driven I2C transfer will cause IRQ to be re-enabled
if you need turn off device from platform callbacks - .master_xfer_atomic() has to be implemented and used.
--
Best regards,
grygorii
next prev parent reply other threads:[~2020-12-07 16:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-18 12:17 [v2] i2c: mediatek: Move suspend and resume handling to NOIRQ phase qii.wang
2020-12-02 15:35 ` Wolfram Sang
2020-12-03 1:25 ` Qii Wang
2020-12-03 8:01 ` Grygorii Strashko
2020-12-07 7:33 ` Qii Wang
2020-12-07 16:35 ` Grygorii Strashko [this message]
2020-12-10 1:56 ` Qii Wang
2020-12-10 13:03 ` Grygorii Strashko
2020-12-14 8:48 ` Qii Wang
2020-12-14 20:08 ` Grygorii Strashko
2020-12-15 13:08 ` Qii Wang
2020-12-23 6:31 ` Qii Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a9cb5ba5-f3ce-3f82-15cc-30419bb70f4e@ti.com \
--to=grygorii.strashko@ti.com \
--cc=leilk.liu@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=qii.wang@mediatek.com \
--cc=srv_heupstream@mediatek.com \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).