devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v0] gpio: xgene: add ACPI support for APM X-Gene GPIO standby driver
@ 2015-05-28  6:46 Y Vo
  2015-05-29  9:25 ` Mika Westerberg
  0 siblings, 1 reply; 3+ messages in thread
From: Y Vo @ 2015-05-28  6:46 UTC (permalink / raw)
  To: linus.walleij, linux-gpio, devicetree, linux-arm-kernel,
	linux-acpi
  Cc: patches, Toan Le, Loc Ho, Y Vo, Phong Vo

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

Signed-off-by: Y Vo <yvo@apm.com>
---
 drivers/gpio/gpio-xgene-sb.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/gpio/gpio-xgene-sb.c b/drivers/gpio/gpio-xgene-sb.c
index b6a15c3..50aaae5 100644
--- a/drivers/gpio/gpio-xgene-sb.c
+++ b/drivers/gpio/gpio-xgene-sb.c
@@ -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,13 @@ static int xgene_gpio_sb_probe(struct platform_device *pdev)
 	else
 		dev_info(&pdev->dev, "X-Gene GPIO Standby driver registered\n");
 
+#ifdef CONFIG_ACPI
+	if (priv->nirq > 0) {
+		/* Register interrupt handlers for gpio signaled acpi events */
+		acpi_gpiochip_request_interrupts(&priv->bgc.gc);
+	}
+#endif
+
 	return ret;
 }
 
@@ -145,10 +155,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,
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v0] gpio: xgene: add ACPI support for APM X-Gene GPIO standby driver
  2015-05-28  6:46 [PATCH v0] gpio: xgene: add ACPI support for APM X-Gene GPIO standby driver Y Vo
@ 2015-05-29  9:25 ` Mika Westerberg
  2015-05-29  9:42   ` Y Vo
  0 siblings, 1 reply; 3+ messages in thread
From: Mika Westerberg @ 2015-05-29  9:25 UTC (permalink / raw)
  To: Y Vo
  Cc: linus.walleij, linux-gpio, devicetree, linux-arm-kernel,
	linux-acpi, Phong Vo, Toan Le, Loc Ho, patches

On Thu, May 28, 2015 at 01:46:28PM +0700, Y Vo wrote:
> +#ifdef CONFIG_ACPI
> +	if (priv->nirq > 0) {
> +		/* Register interrupt handlers for gpio signaled acpi events */
> +		acpi_gpiochip_request_interrupts(&priv->bgc.gc);
> +	}
> +#endif

You don't need to check CONFIG_ACPI as acpi_gpiochip_request_interrupts()
will be stubbed out if !CONFIG_ACPI.

Should you call acpi_gpiochip_free_interrupts() somewhere to unregister
the interrupts as well?

Even better if you can switch your driver to use GPIOLIB_IRQCHIP all
this is done automatically for you.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v0] gpio: xgene: add ACPI support for APM X-Gene GPIO standby driver
  2015-05-29  9:25 ` Mika Westerberg
@ 2015-05-29  9:42   ` Y Vo
  0 siblings, 0 replies; 3+ messages in thread
From: Y Vo @ 2015-05-29  9:42 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: Linus Walleij, linux-gpio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-acpi, Phong Vo, Toan Le, Loc Ho, patches

On Fri, May 29, 2015 at 4:25 PM, Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
> On Thu, May 28, 2015 at 01:46:28PM +0700, Y Vo wrote:
>> +#ifdef CONFIG_ACPI
>> +     if (priv->nirq > 0) {
>> +             /* Register interrupt handlers for gpio signaled acpi events */
>> +             acpi_gpiochip_request_interrupts(&priv->bgc.gc);
>> +     }
>> +#endif
>
> You don't need to check CONFIG_ACPI as acpi_gpiochip_request_interrupts()
> will be stubbed out if !CONFIG_ACPI.
I will remove this check.
>
> Should you call acpi_gpiochip_free_interrupts() somewhere to unregister
> the interrupts as well?
I will add this to xgene_gpio_sb_remove function.

>
> Even better if you can switch your driver to use GPIOLIB_IRQCHIP all
> this is done automatically for you.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-29  9:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-28  6:46 [PATCH v0] gpio: xgene: add ACPI support for APM X-Gene GPIO standby driver Y Vo
2015-05-29  9:25 ` Mika Westerberg
2015-05-29  9:42   ` Y Vo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).