From: Coiby Xu <coiby.xu@gmail.com>
To: "Barnabás Pőcze" <pobrn@protonmail.com>
Cc: "linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] HID: i2c-hid: add polling mode based on connected GPIO chip's pin status
Date: Fri, 16 Oct 2020 22:32:00 +0800 [thread overview]
Message-ID: <20201016143200.tev62sbttbac5kci@Rk> (raw)
In-Reply-To: <t_cZwIcdajFYTSx2_B2UCOxOZLfPVBz3goQ7mtcy1g1lyok_u0sGB5nKWhZ2AX0p4-_EhwMwjGzp50wv3SYfNa3PJQWrhkk3AN5MisD9TJg=@protonmail.com>
Hi Barnabás,
Thank you for reviewing theis patch! I've Cced a new version to you.
On Thu, Oct 15, 2020 at 10:33:50AM +0000, Barnabás Pőcze wrote:
>Hi,
>
>I believe this patch causes I2C HID devices not to work with IRQs after resuming
>from suspend.
>
>
>> [...]
>> #ifdef CONFIG_PM_SLEEP
>> @@ -1183,7 +1292,8 @@ static int i2c_hid_suspend(struct device *dev)
>> /* Save some power */
>> i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
>>
>> - disable_irq(client->irq);
>> + if (polling_mode == I2C_POLLING_DISABLED)
>> + disable_irq(client->irq);
>>
>
>The IRQ is disabled when suspending if polling is *off*.
>
>
>> if (device_may_wakeup(&client->dev)) {
>> wake_status = enable_irq_wake(client->irq);
>> @@ -1216,7 +1326,7 @@ static int i2c_hid_resume(struct device *dev)
>>
>> if (ihid->pdata.post_power_delay_ms)
>> msleep(ihid->pdata.post_power_delay_ms);
>> - } else if (ihid->irq_wake_enabled) {
>> + } else if (ihid->irq_wake_enabled && polling_mode != I2C_POLLING_DISABLED) {
>
>As a side note, I'm not sure if the 'polling_mode != I2C_POLLING_DISABLED' part
>is necessary (or that it's necessary *here*). It causes 'i2c_hid_resume' and
>'i2c_hid_suspend' to be "asymmetric" which - I believe - may cause problems.
>
>
>> wake_status = disable_irq_wake(client->irq);
>> if (!wake_status)
>> ihid->irq_wake_enabled = false;
>> @@ -1225,7 +1335,8 @@ static int i2c_hid_resume(struct device *dev)
>> wake_status);
>> }
>>
>> - enable_irq(client->irq);
>> + if (polling_mode != I2C_POLLING_DISABLED)
>> + enable_irq(client->irq);
>>
>
>The IRQ is enabled when resuming if polling is *on*. It should be enabled if polling is *off*
>in my opinion.
>
>
>> [...]
>
>
>Regards,
>Barnabás Pőcze
--
Best regards,
Coiby
prev parent reply other threads:[~2020-10-16 14:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-09 8:11 [PATCH] HID: i2c-hid: add polling mode based on connected GPIO chip's pin status Coiby Xu
2020-10-15 10:33 ` Barnabás Pőcze
2020-10-16 14:32 ` Coiby Xu [this message]
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=20201016143200.tev62sbttbac5kci@Rk \
--to=coiby.xu@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pobrn@protonmail.com \
/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).