hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/pinctrl/intel/pinctrl-intel.c
....@@ -1606,6 +1606,12 @@
16061606 EXPORT_SYMBOL_GPL(intel_pinctrl_get_soc_data);
16071607
16081608 #ifdef CONFIG_PM_SLEEP
1609
+static bool __intel_gpio_is_direct_irq(u32 value)
1610
+{
1611
+ return (value & PADCFG0_GPIROUTIOXAPIC) && (value & PADCFG0_GPIOTXDIS) &&
1612
+ (__intel_gpio_get_gpio_mode(value) == PADCFG0_PMODE_GPIO);
1613
+}
1614
+
16091615 static bool intel_pinctrl_should_save(struct intel_pinctrl *pctrl, unsigned int pin)
16101616 {
16111617 const struct pin_desc *pd = pin_desc_get(pctrl->pctldev, pin);
....@@ -1639,8 +1645,7 @@
16391645 * See https://bugzilla.kernel.org/show_bug.cgi?id=214749.
16401646 */
16411647 value = readl(intel_get_padcfg(pctrl, pin, PADCFG0));
1642
- if ((value & PADCFG0_GPIROUTIOXAPIC) && (value & PADCFG0_GPIOTXDIS) &&
1643
- (__intel_gpio_get_gpio_mode(value) == PADCFG0_PMODE_GPIO))
1648
+ if (__intel_gpio_is_direct_irq(value))
16441649 return true;
16451650
16461651 return false;
....@@ -1770,7 +1775,12 @@
17701775 for (i = 0; i < pctrl->soc->npins; i++) {
17711776 const struct pinctrl_pin_desc *desc = &pctrl->soc->pins[i];
17721777
1773
- if (!intel_pinctrl_should_save(pctrl, desc->number))
1778
+ if (!(intel_pinctrl_should_save(pctrl, desc->number) ||
1779
+ /*
1780
+ * If the firmware mangled the register contents too much,
1781
+ * check the saved value for the Direct IRQ mode.
1782
+ */
1783
+ __intel_gpio_is_direct_irq(pads[i].padcfg0)))
17741784 continue;
17751785
17761786 intel_restore_padcfg(pctrl, desc->number, PADCFG0, pads[i].padcfg0);