提交 733cf014 编写于 作者: Y Y Vo 提交者: Linus Walleij

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

Add ACPI support for APM X-Gene GPIO standby driver.
Signed-off-by: NY Vo <yvo@apm.com>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 81d49ce8
...@@ -25,8 +25,11 @@ ...@@ -25,8 +25,11 @@
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio/driver.h> #include <linux/gpio/driver.h>
#include <linux/acpi.h>
#include <linux/basic_mmio_gpio.h> #include <linux/basic_mmio_gpio.h>
#include "gpiolib.h"
#define XGENE_MAX_GPIO_DS 22 #define XGENE_MAX_GPIO_DS 22
#define XGENE_MAX_GPIO_DS_IRQ 6 #define XGENE_MAX_GPIO_DS_IRQ 6
...@@ -128,6 +131,11 @@ static int xgene_gpio_sb_probe(struct platform_device *pdev) ...@@ -128,6 +131,11 @@ static int xgene_gpio_sb_probe(struct platform_device *pdev)
else else
dev_info(&pdev->dev, "X-Gene GPIO Standby driver registered\n"); 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; return ret;
} }
...@@ -135,6 +143,10 @@ static int xgene_gpio_sb_remove(struct platform_device *pdev) ...@@ -135,6 +143,10 @@ static int xgene_gpio_sb_remove(struct platform_device *pdev)
{ {
struct xgene_gpio_sb *priv = platform_get_drvdata(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); return bgpio_remove(&priv->bgc);
} }
...@@ -144,10 +156,19 @@ static const struct of_device_id xgene_gpio_sb_of_match[] = { ...@@ -144,10 +156,19 @@ static const struct of_device_id xgene_gpio_sb_of_match[] = {
}; };
MODULE_DEVICE_TABLE(of, 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 = { static struct platform_driver xgene_gpio_sb_driver = {
.driver = { .driver = {
.name = "xgene-gpio-sb", .name = "xgene-gpio-sb",
.of_match_table = xgene_gpio_sb_of_match, .of_match_table = xgene_gpio_sb_of_match,
.acpi_match_table = ACPI_PTR(xgene_gpio_sb_acpi_match),
}, },
.probe = xgene_gpio_sb_probe, .probe = xgene_gpio_sb_probe,
.remove = xgene_gpio_sb_remove, .remove = xgene_gpio_sb_remove,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册