Skip to contentSkip to conversation

gpio: add ACPI support for APM X-Gene GPIO standby driver

PATCH New Y Vo 2 participants 3 messages May 29, 2015 – Jun 2, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Y Vo

author
#0 lore raw

PATCH 1/1 gpio: add ACPI support for APM X-Gene GPIO standby driver

This patch adds ACPI support for APM X-Gene GPIO standby driver.

V1 change:
- Remove check CONFIG_ACPI when call acpi_gpiochip_request_interrupts() function.
- Add acpi_gpiochip_free_interrupts() function to unregister the interrupt.

Y Vo (1):
gpio: xgene: add ACPI support for APM X-Gene GPIO standby driver

 drivers/gpio/gpio-xgene-sb.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
author
#1 lore raw

PATCH 1/1 gpio: xgene: add ACPI support for APM X-Gene GPIO standby driver

Add ACPI support for APM X-Gene GPIO standby driver.

---
 drivers/gpio/gpio-xgene-sb.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
drivers/gpio/gpio-xgene-sb.c +21 -0
index b6a15c3..df5a04f 100644
@@ -25,8 +25,11 @@
 #include <linux/of_gpio.h>
 #include <linux/gpio.h>
 #include <linux/gpio/driver.h>
+#include <linux/acpi.h>
 #include <linux/basic_mmio_gpio.h>
 
+#include "gpiolib.h"
+
 #define XGENE_MAX_GPIO_DS		22
 #define XGENE_MAX_GPIO_DS_IRQ		6
 
@@ -129,6 +132,11 @@ static int xgene_gpio_sb_probe(struct platform_device *pdev)
 	else
 		dev_info(&pdev->dev, "X-Gene GPIO Standby driver registered\n");
 
+	if (priv->nirq > 0) {
+		/* Register interrupt handlers for gpio signaled acpi events */
+		acpi_gpiochip_request_interrupts(&priv->bgc.gc);
+	}
+
 	return ret;
 }
 
@@ -136,6 +144,10 @@ static int xgene_gpio_sb_remove(struct platform_device *pdev)
 {
 	struct xgene_gpio_sb *priv = platform_get_drvdata(pdev);
 
+	if (priv->nirq > 0) {
+		acpi_gpiochip_free_interrupts(&priv->bgc.gc);
+	}
+
 	return bgpio_remove(&priv->bgc);
 }
 
@@ -145,10 +157,19 @@ static const struct of_device_id xgene_gpio_sb_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, xgene_gpio_sb_of_match);
 
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id xgene_gpio_sb_acpi_match[] = {
+	{"APMC0D15", 0},
+	{},
+};
+MODULE_DEVICE_TABLE(acpi, xgene_gpio_sb_acpi_match);
+#endif
+
 static struct platform_driver xgene_gpio_sb_driver = {
 	.driver = {
 		   .name = "xgene-gpio-sb",
 		   .of_match_table = xgene_gpio_sb_of_match,
+		   .acpi_match_table = ACPI_PTR(xgene_gpio_sb_acpi_match),
 		   },
 	.probe = xgene_gpio_sb_probe,
 	.remove = xgene_gpio_sb_remove,
Signature · 1 line
1.7.1