Skip to content

Commit a8520be

Browse files
andy-shevlinusw
authored andcommitted
pinctrl: intel: Restore the pins that used to be in Direct IRQ mode
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 <[email protected]> Fixes: 6989ea4 ("pinctrl: intel: Save and restore pins in "direct IRQ" mode") Tested-by: Jim Minter <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Mika Westerberg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 5921b25 commit a8520be

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

drivers/pinctrl/intel/pinctrl-intel.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,6 +1709,12 @@ const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data(struct platform_
17091709
EXPORT_SYMBOL_GPL(intel_pinctrl_get_soc_data);
17101710

17111711
#ifdef CONFIG_PM_SLEEP
1712+
static bool __intel_gpio_is_direct_irq(u32 value)
1713+
{
1714+
return (value & PADCFG0_GPIROUTIOXAPIC) && (value & PADCFG0_GPIOTXDIS) &&
1715+
(__intel_gpio_get_gpio_mode(value) == PADCFG0_PMODE_GPIO);
1716+
}
1717+
17121718
static bool intel_pinctrl_should_save(struct intel_pinctrl *pctrl, unsigned int pin)
17131719
{
17141720
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
17421748
* See https://bugzilla.kernel.org/show_bug.cgi?id=214749.
17431749
*/
17441750
value = readl(intel_get_padcfg(pctrl, pin, PADCFG0));
1745-
if ((value & PADCFG0_GPIROUTIOXAPIC) && (value & PADCFG0_GPIOTXDIS) &&
1746-
(__intel_gpio_get_gpio_mode(value) == PADCFG0_PMODE_GPIO))
1751+
if (__intel_gpio_is_direct_irq(value))
17471752
return true;
17481753

17491754
return false;
@@ -1873,7 +1878,12 @@ int intel_pinctrl_resume_noirq(struct device *dev)
18731878
for (i = 0; i < pctrl->soc->npins; i++) {
18741879
const struct pinctrl_pin_desc *desc = &pctrl->soc->pins[i];
18751880

1876-
if (!intel_pinctrl_should_save(pctrl, desc->number))
1881+
if (!(intel_pinctrl_should_save(pctrl, desc->number) ||
1882+
/*
1883+
* If the firmware mangled the register contents too much,
1884+
* check the saved value for the Direct IRQ mode.
1885+
*/
1886+
__intel_gpio_is_direct_irq(pads[i].padcfg0)))
18771887
continue;
18781888

18791889
intel_restore_padcfg(pctrl, desc->number, PADCFG0, pads[i].padcfg0);

0 commit comments

Comments
 (0)