From: Mario Limonciello <mario.limonciello@amd.com>
To: "Natikar, Basavaraj" <Basavaraj.Natikar@amd.com>,
"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"S-k, Shyam-sundar" <Shyam-sundar.S-k@amd.com>
Subject: Re: [PATCH 2/3] pinctrl: amd: Don't save/restore interrupt status and wake status bits
Date: Sat, 9 Jul 2022 09:06:29 -0500 [thread overview]
Message-ID: <64457e5e-060b-0514-aa1c-501b34d3a968@amd.com> (raw)
In-Reply-To: <MN0PR12MB6101592307B55649B8EFE47AE2AB9@MN0PR12MB6101.namprd12.prod.outlook.com>
On 6/13/22 09:17, Limonciello, Mario wrote:
> [Public]
>
>> -----Original Message-----
>> From: Natikar, Basavaraj <Basavaraj.Natikar@amd.com>
>> Sent: Monday, June 13, 2022 01:41
>> To: linus.walleij@linaro.org; linux-gpio@vger.kernel.org; S-k, Shyam-sundar
>> <Shyam-sundar.S-k@amd.com>
>> Cc: Limonciello, Mario <Mario.Limonciello@amd.com>; Natikar, Basavaraj
>> <Basavaraj.Natikar@amd.com>
>> Subject: [PATCH 2/3] pinctrl: amd: Don't save/restore interrupt status and wake
>> status bits
>>
>> Saving/restoring interrupt and wake status bits across suspend can
>> cause the suspend to fail if an IRQ is serviced across the
>> suspend cycle.
>>
>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
>> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
>
> I think this should also pick up this tag:
> Fixes: 79d2c8bede2c ("pinctrl/amd: save pin registers over suspend/resume")
This was confirmed to fix a bug reported to AMD gitlab with multiple
suspend/resume cycles. So one more tag to add:
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1333
>
>> ---
>> drivers/pinctrl/pinctrl-amd.c | 11 +++++++++--
>> 1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
>> index ff3d0edbea48..40e23b5795b0 100644
>> --- a/drivers/pinctrl/pinctrl-amd.c
>> +++ b/drivers/pinctrl/pinctrl-amd.c
>> @@ -917,6 +917,7 @@ static int amd_gpio_suspend(struct device *dev)
>> {
>> struct amd_gpio *gpio_dev = dev_get_drvdata(dev);
>> struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
>> + unsigned long flags;
>> int i;
>>
>> for (i = 0; i < desc->npins; i++) {
>> @@ -925,7 +926,9 @@ static int amd_gpio_suspend(struct device *dev)
>> if (!amd_gpio_should_save(gpio_dev, pin))
>> continue;
>>
>> - gpio_dev->saved_regs[i] = readl(gpio_dev->base + pin*4);
>> + raw_spin_lock_irqsave(&gpio_dev->lock, flags);
>> + gpio_dev->saved_regs[i] = readl(gpio_dev->base + pin * 4) &
>> ~PIN_IRQ_PENDING;
>> + raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
>> }
>>
>> return 0;
>> @@ -935,6 +938,7 @@ static int amd_gpio_resume(struct device *dev)
>> {
>> struct amd_gpio *gpio_dev = dev_get_drvdata(dev);
>> struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
>> + unsigned long flags;
>> int i;
>>
>> for (i = 0; i < desc->npins; i++) {
>> @@ -943,7 +947,10 @@ static int amd_gpio_resume(struct device *dev)
>> if (!amd_gpio_should_save(gpio_dev, pin))
>> continue;
>>
>> - writel(gpio_dev->saved_regs[i], gpio_dev->base + pin*4);
>> + raw_spin_lock_irqsave(&gpio_dev->lock, flags);
>> + gpio_dev->saved_regs[i] |= readl(gpio_dev->base + pin * 4) &
>> PIN_IRQ_PENDING;
>> + writel(gpio_dev->saved_regs[i], gpio_dev->base + pin * 4);
>> + raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
>> }
>>
>> return 0;
>> --
>> 2.25.1
next prev parent reply other threads:[~2022-07-09 14:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-13 6:41 [PATCH 0/3] Fixes and updates to pinctrl-amd Basavaraj Natikar
2022-06-13 6:41 ` [PATCH 1/3] pinctrl: amd: Use devm_platform_get_and_ioremap_resource Basavaraj Natikar
2022-06-13 6:41 ` [PATCH 2/3] pinctrl: amd: Don't save/restore interrupt status and wake status bits Basavaraj Natikar
2022-06-13 14:17 ` Limonciello, Mario
2022-07-09 14:06 ` Mario Limonciello [this message]
2022-06-13 6:41 ` [PATCH 3/3] pinctrl: amd: Remove contact information Basavaraj Natikar
2022-07-07 18:25 ` [PATCH 0/3] Fixes and updates to pinctrl-amd Limonciello, Mario
2022-07-09 23:09 ` Linus Walleij
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=64457e5e-060b-0514-aa1c-501b34d3a968@amd.com \
--to=mario.limonciello@amd.com \
--cc=Basavaraj.Natikar@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
/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).