Message ID | 1458959496-57455-3-git-send-email-qiujiang@huawei.com |
---|---|
State | New |
Headers | show |
On Sat, Mar 26, 2016 at 4:31 AM, qiujiang <qiujiang@huawei.com> wrote: > This patch adds gpio-signaled acpi event support. It is used for > power button on hisilicon D02 board, an arm64 platform. Yes, looks good, my tag stays. > @@ -502,10 +509,17 @@ dwapb_gpio_get_pdata(struct device *dev) > } > } > > + if (has_acpi_companion(dev) && pp->idx == 0) > + pp->irq = platform_get_irq(to_platform_device(dev), 0); > + > pp->irq_shared = false; > pp->gpio_base = -1; > + > if (dev->of_node) > pp->name = to_of_node(fwnode)->full_name; This change doesn't belong the patch, though it should gone with the two lines of pp->name assignment as per Alan's suggestion to get rid of pp->name completely. > + > + if (has_acpi_companion(dev)) > + pp->name = acpi_dev_name(to_acpi_device_node(fwnode));
在 2016/3/30 19:41, Andy Shevchenko 写道: > On Sat, Mar 26, 2016 at 4:31 AM, qiujiang <qiujiang@huawei.com> wrote: >> This patch adds gpio-signaled acpi event support. It is used for >> power button on hisilicon D02 board, an arm64 platform. > > Yes, looks good, my tag stays. > >> @@ -502,10 +509,17 @@ dwapb_gpio_get_pdata(struct device *dev) >> } >> } >> >> + if (has_acpi_companion(dev) && pp->idx == 0) >> + pp->irq = platform_get_irq(to_platform_device(dev), 0); >> + > >> pp->irq_shared = false; >> pp->gpio_base = -1; > > >> + >> if (dev->of_node) >> pp->name = to_of_node(fwnode)->full_name; > > This change doesn't belong the patch, though it should gone with the > two lines of pp->name assignment as per Alan's suggestion to get rid > of pp->name completely. Agree, I plan to take Alan's suggestion, thank you. > >> + >> + if (has_acpi_companion(dev)) >> + pp->name = acpi_dev_name(to_acpi_device_node(fwnode)); > -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c index 3498393..f52adc9 100644 --- a/drivers/gpio/gpio-dwapb.c +++ b/drivers/gpio/gpio-dwapb.c @@ -7,6 +7,7 @@ * * All enquiries to support@picochip.com */ +#include <linux/acpi.h> #include <linux/gpio/driver.h> /* FIXME: for gpio_get_value(), replace this with direct register read */ #include <linux/gpio.h> @@ -27,6 +28,8 @@ #include <linux/platform_data/gpio-dwapb.h> #include <linux/slab.h> +#include "gpiolib.h" + #define GPIO_SWPORTA_DR 0x00 #define GPIO_SWPORTA_DDR 0x04 #define GPIO_SWPORTB_DR 0x0c @@ -436,6 +439,10 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio, else port->is_registered = true; + /* Add GPIO-signaled ACPI event support */ + if (pp->irq) + acpi_gpiochip_request_interrupts(&port->gc); + return err; } @@ -502,10 +509,17 @@ dwapb_gpio_get_pdata(struct device *dev) } } + if (has_acpi_companion(dev) && pp->idx == 0) + pp->irq = platform_get_irq(to_platform_device(dev), 0); + pp->irq_shared = false; pp->gpio_base = -1; + if (dev->of_node) pp->name = to_of_node(fwnode)->full_name; + + if (has_acpi_companion(dev)) + pp->name = acpi_dev_name(to_acpi_device_node(fwnode)); } return pdata; @@ -578,6 +592,12 @@ static const struct of_device_id dwapb_of_match[] = { }; MODULE_DEVICE_TABLE(of, dwapb_of_match); +static const struct acpi_device_id dwapb_acpi_match[] = { + {"HISI0181", 0}, + { } +}; +MODULE_DEVICE_TABLE(acpi, dwapb_acpi_match); + #ifdef CONFIG_PM_SLEEP static int dwapb_gpio_suspend(struct device *dev) { @@ -672,6 +692,7 @@ static struct platform_driver dwapb_gpio_driver = { .name = "gpio-dwapb", .pm = &dwapb_gpio_pm_ops, .of_match_table = of_match_ptr(dwapb_of_match), + .acpi_match_table = ACPI_PTR(dwapb_acpi_match), }, .probe = dwapb_gpio_probe, .remove = dwapb_gpio_remove,