* [PATCH v1 1/1] pinctrl: intel: Restore the pins that used to be in Direct IRQ mode
@ 2023-02-06 14:15 Andy Shevchenko
2023-02-06 14:26 ` Mika Westerberg
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Andy Shevchenko @ 2023-02-06 14:15 UTC (permalink / raw)
To: Andy Shevchenko, Mika Westerberg, linux-gpio, linux-kernel
Cc: Andy Shevchenko, Linus Walleij, Jim Minter
If the firmware mangled the register contents too much,
check the saved value for the Direct IRQ mode. If it
matches, we will restore the pin state.
Reported-by: Jim Minter <jimminter@microsoft.com>
Fixes: 6989ea4881c8 ("pinctrl: intel: Save and restore pins in "direct IRQ" mode")
Tested-by: Jim Minter <jimminter@microsoft.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
Jim, this is a bit simplified version than what you tested. But it shouldn't
be a functional changes. Anyway, it would be nice if you have a chance to give
this a try.
Linus, I don't expect more to come for this cycle, feel free to apply directly.
drivers/pinctrl/intel/pinctrl-intel.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index cc3aaba24188..e49f271de936 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -1709,6 +1709,12 @@ const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data(struct platform_
EXPORT_SYMBOL_GPL(intel_pinctrl_get_soc_data);
#ifdef CONFIG_PM_SLEEP
+static bool __intel_gpio_is_direct_irq(u32 value)
+{
+ return (value & PADCFG0_GPIROUTIOXAPIC) && (value & PADCFG0_GPIOTXDIS) &&
+ (__intel_gpio_get_gpio_mode(value) == PADCFG0_PMODE_GPIO);
+}
+
static bool intel_pinctrl_should_save(struct intel_pinctrl *pctrl, unsigned int pin)
{
const struct pin_desc *pd = pin_desc_get(pctrl->pctldev, pin);
@@ -1742,8 +1748,7 @@ static bool intel_pinctrl_should_save(struct intel_pinctrl *pctrl, unsigned int
* See https://bugzilla.kernel.org/show_bug.cgi?id=214749.
*/
value = readl(intel_get_padcfg(pctrl, pin, PADCFG0));
- if ((value & PADCFG0_GPIROUTIOXAPIC) && (value & PADCFG0_GPIOTXDIS) &&
- (__intel_gpio_get_gpio_mode(value) == PADCFG0_PMODE_GPIO))
+ if (__intel_gpio_is_direct_irq(value))
return true;
return false;
@@ -1873,7 +1878,12 @@ int intel_pinctrl_resume_noirq(struct device *dev)
for (i = 0; i < pctrl->soc->npins; i++) {
const struct pinctrl_pin_desc *desc = &pctrl->soc->pins[i];
- if (!intel_pinctrl_should_save(pctrl, desc->number))
+ if (!(intel_pinctrl_should_save(pctrl, desc->number) ||
+ /*
+ * If the firmware mangled the register contents too much,
+ * check the saved value for the Direct IRQ mode.
+ */
+ __intel_gpio_is_direct_irq(pads[i].padcfg0)))
continue;
intel_restore_padcfg(pctrl, desc->number, PADCFG0, pads[i].padcfg0);
--
2.39.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v1 1/1] pinctrl: intel: Restore the pins that used to be in Direct IRQ mode
2023-02-06 14:15 [PATCH v1 1/1] pinctrl: intel: Restore the pins that used to be in Direct IRQ mode Andy Shevchenko
@ 2023-02-06 14:26 ` Mika Westerberg
2023-02-06 15:02 ` Linus Walleij
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Mika Westerberg @ 2023-02-06 14:26 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-gpio, linux-kernel, Andy Shevchenko, Linus Walleij,
Jim Minter
On Mon, Feb 06, 2023 at 04:15:59PM +0200, Andy Shevchenko wrote:
> If the firmware mangled the register contents too much,
> check the saved value for the Direct IRQ mode. If it
> matches, we will restore the pin state.
>
> Reported-by: Jim Minter <jimminter@microsoft.com>
> Fixes: 6989ea4881c8 ("pinctrl: intel: Save and restore pins in "direct IRQ" mode")
> Tested-by: Jim Minter <jimminter@microsoft.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v1 1/1] pinctrl: intel: Restore the pins that used to be in Direct IRQ mode
2023-02-06 14:15 [PATCH v1 1/1] pinctrl: intel: Restore the pins that used to be in Direct IRQ mode Andy Shevchenko
2023-02-06 14:26 ` Mika Westerberg
@ 2023-02-06 15:02 ` Linus Walleij
2023-02-06 15:06 ` Andy Shevchenko
2023-02-07 9:14 ` Linus Walleij
2023-02-07 17:06 ` Jim Minter
3 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2023-02-06 15:02 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Mika Westerberg, linux-gpio, linux-kernel, Andy Shevchenko,
Jim Minter
On Mon, Feb 6, 2023 at 3:16 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> If the firmware mangled the register contents too much,
> check the saved value for the Direct IRQ mode. If it
> matches, we will restore the pin state.
>
> Reported-by: Jim Minter <jimminter@microsoft.com>
> Fixes: 6989ea4881c8 ("pinctrl: intel: Save and restore pins in "direct IRQ" mode")
> Tested-by: Jim Minter <jimminter@microsoft.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>
> Jim, this is a bit simplified version than what you tested. But it shouldn't
> be a functional changes. Anyway, it would be nice if you have a chance to give
> this a try.
>
> Linus, I don't expect more to come for this cycle, feel free to apply directly.
OK no problem, does it go into fixes pronto or for next (v6.3)?
I would guess fixes but I never know the difference between urgent
and nourgent fixes...
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v1 1/1] pinctrl: intel: Restore the pins that used to be in Direct IRQ mode
2023-02-06 15:02 ` Linus Walleij
@ 2023-02-06 15:06 ` Andy Shevchenko
0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2023-02-06 15:06 UTC (permalink / raw)
To: Linus Walleij; +Cc: Mika Westerberg, linux-gpio, linux-kernel, Jim Minter
On Mon, Feb 06, 2023 at 04:02:27PM +0100, Linus Walleij wrote:
> On Mon, Feb 6, 2023 at 3:16 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
>
> > If the firmware mangled the register contents too much,
> > check the saved value for the Direct IRQ mode. If it
> > matches, we will restore the pin state.
> >
> > Reported-by: Jim Minter <jimminter@microsoft.com>
> > Fixes: 6989ea4881c8 ("pinctrl: intel: Save and restore pins in "direct IRQ" mode")
> > Tested-by: Jim Minter <jimminter@microsoft.com>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >
> > Jim, this is a bit simplified version than what you tested. But it shouldn't
> > be a functional changes. Anyway, it would be nice if you have a chance to give
> > this a try.
> >
> > Linus, I don't expect more to come for this cycle, feel free to apply directly.
>
> OK no problem, does it go into fixes pronto or for next (v6.3)?
> I would guess fixes but I never know the difference between urgent
> and nourgent fixes...
Fixes and kinda urgent (bad user experience with touchpad device).
Thank you!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 1/1] pinctrl: intel: Restore the pins that used to be in Direct IRQ mode
2023-02-06 14:15 [PATCH v1 1/1] pinctrl: intel: Restore the pins that used to be in Direct IRQ mode Andy Shevchenko
2023-02-06 14:26 ` Mika Westerberg
2023-02-06 15:02 ` Linus Walleij
@ 2023-02-07 9:14 ` Linus Walleij
2023-02-07 17:06 ` Jim Minter
3 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2023-02-07 9:14 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Mika Westerberg, linux-gpio, linux-kernel, Andy Shevchenko,
Jim Minter
On Mon, Feb 6, 2023 at 3:16 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> If the firmware mangled the register contents too much,
> check the saved value for the Direct IRQ mode. If it
> matches, we will restore the pin state.
>
> Reported-by: Jim Minter <jimminter@microsoft.com>
> Fixes: 6989ea4881c8 ("pinctrl: intel: Save and restore pins in "direct IRQ" mode")
> Tested-by: Jim Minter <jimminter@microsoft.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Patch applied for fixes.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v1 1/1] pinctrl: intel: Restore the pins that used to be in Direct IRQ mode
2023-02-06 14:15 [PATCH v1 1/1] pinctrl: intel: Restore the pins that used to be in Direct IRQ mode Andy Shevchenko
` (2 preceding siblings ...)
2023-02-07 9:14 ` Linus Walleij
@ 2023-02-07 17:06 ` Jim Minter
3 siblings, 0 replies; 6+ messages in thread
From: Jim Minter @ 2023-02-07 17:06 UTC (permalink / raw)
To: Andy Shevchenko, Mika Westerberg, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Andy Shevchenko, Linus Walleij
On Mon, Feb 6, 2023 at 3:16 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> If the firmware mangled the register contents too much,
> check the saved value for the Direct IRQ mode. If it
> matches, we will restore the pin state.
>
> Reported-by: Jim Minter <jimminter@xxxxxxxxxxxxx>
> Fixes: 6989ea4881c8 ("pinctrl: intel: Save and restore pins in "direct IRQ" mode")
> Tested-by: Jim Minter <jimminter@xxxxxxxxxxxxx>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
>
> Jim, this is a bit simplified version than what you tested. But it shouldn't
> be a functional changes. Anyway, it would be nice if you have a chance to give
> this a try.
Andy, I retested this simplified patch and it worked fine for me.
Many thanks,
Jim
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-02-07 17:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-06 14:15 [PATCH v1 1/1] pinctrl: intel: Restore the pins that used to be in Direct IRQ mode Andy Shevchenko
2023-02-06 14:26 ` Mika Westerberg
2023-02-06 15:02 ` Linus Walleij
2023-02-06 15:06 ` Andy Shevchenko
2023-02-07 9:14 ` Linus Walleij
2023-02-07 17:06 ` Jim Minter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox