Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Y Vo <yvo@apm.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Y Vo and committed by
Linus Walleij
733cf014 81d49ce8

+21
+21
drivers/gpio/gpio-xgene-sb.c
··· 25 25 #include <linux/of_gpio.h> 26 26 #include <linux/gpio.h> 27 27 #include <linux/gpio/driver.h> 28 + #include <linux/acpi.h> 28 29 #include <linux/basic_mmio_gpio.h> 30 + 31 + #include "gpiolib.h" 29 32 30 33 #define XGENE_MAX_GPIO_DS 22 31 34 #define XGENE_MAX_GPIO_DS_IRQ 6 ··· 131 128 else 132 129 dev_info(&pdev->dev, "X-Gene GPIO Standby driver registered\n"); 133 130 131 + if (priv->nirq > 0) { 132 + /* Register interrupt handlers for gpio signaled acpi events */ 133 + acpi_gpiochip_request_interrupts(&priv->bgc.gc); 134 + } 135 + 134 136 return ret; 135 137 } 136 138 137 139 static int xgene_gpio_sb_remove(struct platform_device *pdev) 138 140 { 139 141 struct xgene_gpio_sb *priv = platform_get_drvdata(pdev); 142 + 143 + if (priv->nirq > 0) { 144 + acpi_gpiochip_free_interrupts(&priv->bgc.gc); 145 + } 140 146 141 147 return bgpio_remove(&priv->bgc); 142 148 } ··· 156 144 }; 157 145 MODULE_DEVICE_TABLE(of, xgene_gpio_sb_of_match); 158 146 147 + #ifdef CONFIG_ACPI 148 + static const struct acpi_device_id xgene_gpio_sb_acpi_match[] = { 149 + {"APMC0D15", 0}, 150 + {}, 151 + }; 152 + MODULE_DEVICE_TABLE(acpi, xgene_gpio_sb_acpi_match); 153 + #endif 154 + 159 155 static struct platform_driver xgene_gpio_sb_driver = { 160 156 .driver = { 161 157 .name = "xgene-gpio-sb", 162 158 .of_match_table = xgene_gpio_sb_of_match, 159 + .acpi_match_table = ACPI_PTR(xgene_gpio_sb_acpi_match), 163 160 }, 164 161 .probe = xgene_gpio_sb_probe, 165 162 .remove = xgene_gpio_sb_remove,