Skip to contentSkip to conversation

gpio-lynxpoint: enable input sensing in resume

PATCH Superseded Mathias Nyman 2 participants 3 messages Aug 19, 2014 GPIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio-lynxpoint: enable input sensing in resume

It appears that input sensing bit might be reset during suspend/resume. Set input sensing again for all requested gpios in resume

---
 drivers/gpio/gpio-lynxpoint.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/gpio/gpio-lynxpoint.c +24 -0
index ff9eb91..4165672 100644
@@ -407,9 +407,33 @@ static int lp_gpio_runtime_resume(struct device *dev)
 	return 0;
 }
 
+static int lp_gpio_suspend(struct device *dev)
+{
+	return 0;
+}
+
+static int lp_gpio_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct lp_gpio *lg = platform_get_drvdata(pdev);
+	unsigned long reg;
+	int i;
+
+	/* on some hardware suspend clears input sensing, re-enable it here */
+	for (i = 0; i < lg->chip.ngpio; i++) {
+		if (gpiochip_is_requested(&lg->chip, i) != NULL) {
+			reg = lp_gpio_reg(&lg->chip, i, LP_CONFIG2);
+			outl(inl(reg) & ~GPINDIS_BIT, reg);
+		}
+	}
+	return 0;
+}
+
 static const struct dev_pm_ops lp_gpio_pm_ops = {
 	.runtime_suspend = lp_gpio_runtime_suspend,
 	.runtime_resume = lp_gpio_runtime_resume,
+	.suspend = lp_gpio_suspend,
+	.resume = lp_gpio_resume,
 };
 
 static const struct acpi_device_id lynxpoint_gpio_acpi_match[] = {
Signature · 1 line
1.8.3.2
#1 lore raw
Quoted 15 lines · Mathias Nyman

It appears that input sensing bit might be reset during suspend/resume. Set input sensing again for all requested gpios in resume

---
 drivers/gpio/gpio-lynxpoint.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/gpio/gpio-lynxpoint.c +0 -0
index ff9eb91..4165672 100644

drivers/gpio/gpio-lynxpoint.c static int lp_gpio_runtime_resume(struct device *dev) · line 413

Quoted 7 lines
drivers/gpio/gpio-lynxpoint.c +4 -0
@@ -407,9 +407,33 @@ static int lp_gpio_runtime_resume(struct device *dev)
 	return 0;
 }
 
+static int lp_gpio_suspend(struct device *dev)
+{
+	return 0;
+}

If this function doesn't do anything why it needs to be defined here?

Quoted 28 lines
drivers/gpio/gpio-lynxpoint.c +20 -0
+
+static int lp_gpio_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct lp_gpio *lg = platform_get_drvdata(pdev);
+	unsigned long reg;
+	int i;
+
+	/* on some hardware suspend clears input sensing, re-enable it here */
+	for (i = 0; i < lg->chip.ngpio; i++) {
+		if (gpiochip_is_requested(&lg->chip, i) != NULL) {
+			reg = lp_gpio_reg(&lg->chip, i, LP_CONFIG2);
+			outl(inl(reg) & ~GPINDIS_BIT, reg);
+		}
+	}
+	return 0;
+}
+
 static const struct dev_pm_ops lp_gpio_pm_ops = {
 	.runtime_suspend = lp_gpio_runtime_suspend,
 	.runtime_resume = lp_gpio_runtime_resume,
+	.suspend = lp_gpio_suspend,
+	.resume = lp_gpio_resume,
 };
 
 static const struct acpi_device_id lynxpoint_gpio_acpi_match[] = {
Signature · 1 line
1.8.3.2
#2 lore raw
Quoted 19 lines · Mika Westerberg
Quoted 18 lines · Mathias Nyman

It appears that input sensing bit might be reset during suspend/resume. Set input sensing again for all requested gpios in resume

---
 drivers/gpio/gpio-lynxpoint.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/gpio/gpio-lynxpoint.c +0 -0
index ff9eb91..4165672 100644
@@ -407,9 +407,33 @@ static int lp_gpio_runtime_resume(struct device *dev)
 	return 0;
 }
 
Quoted 7 lines

drivers/gpio/gpio-lynxpoint.c static int lp_gpio_runtime_resume(struct device *dev) · line 413

Quoted 4 lines
drivers/gpio/gpio-lynxpoint.c +4 -0
+static int lp_gpio_suspend(struct device *dev)
+{
+	return 0;
+}

If this function doesn't do anything why it needs to be defined here?

I guess it doesn't, Added the suspend and resume functions as a pair, but only resume turned out to do something,

I'll remove it.

-Mathias