linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: qiujiang <qiujiang@huawei.com>
To: <linus.walleij@linaro.org>, <gnurou@gmail.com>
Cc: <mika.westerberg@linux.intel.com>, <andy.shevchenko@gmail.com>,
	<linux-kernel@vger.kernel.org>, <linux-gpio@vger.kernel.org>,
	<linux-acpi@vger.kernel.org>, <linuxarm@huawei.com>,
	<haifeng.wei@huawei.com>, <charles.chenxin@huawei.com>,
	qiujiang <qiujiang@huawei.com>
Subject: [PATCH v5 2/3] gpio: designware: add acpi binding
Date: Fri, 4 Mar 2016 15:44:33 +0800	[thread overview]
Message-ID: <1457077474-124064-3-git-send-email-qiujiang@huawei.com> (raw)
In-Reply-To: <1457077474-124064-1-git-send-email-qiujiang@huawei.com>

This patch adds acpi binding for designware gpio driver,
because it is used to support power button on hisilicon
d02 board.

These two bindings, DT and acpi, are compatible in this
driver.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: qiujiang <qiujiang@huawei.com>
---
 drivers/gpio/gpio-dwapb.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index 49f6e5d..2ae506f 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>
@@ -449,7 +450,7 @@ static void dwapb_gpio_unregister(struct dwapb_gpio *gpio)
 }
 
 static struct dwapb_platform_data *
-dwapb_gpio_get_pdata_of(struct device *dev)
+dwapb_gpio_get_pdata(struct device *dev)
 {
 	struct fwnode_handle *fwnode;
 	struct dwapb_platform_data *pdata;
@@ -502,9 +503,17 @@ dwapb_gpio_get_pdata_of(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;
-		pp->name	= to_of_node(fwnode)->full_name;
+
+		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;
@@ -520,7 +529,7 @@ static int dwapb_gpio_probe(struct platform_device *pdev)
 	struct dwapb_platform_data *pdata = dev_get_platdata(dev);
 
 	if (!pdata) {
-		pdata = dwapb_gpio_get_pdata_of(dev);
+		pdata = dwapb_gpio_get_pdata(dev);
 		if (IS_ERR(pdata))
 			return PTR_ERR(pdata);
 	}
@@ -577,6 +586,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)
 {
@@ -671,6 +686,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,
-- 
1.9.1

  parent reply	other threads:[~2016-03-04  7:39 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-04  7:44 [PATCH v5 0/3] "gpio: designware: add gpio-signaled acpi event support for power button" qiujiang
2016-03-04  7:44 ` [PATCH v5 1/3] gpio: designware: convert device node to fwnode qiujiang
2016-03-10 19:09   ` Alan Tull
2016-03-10 20:27     ` Andy Shevchenko
2016-03-11  0:48       ` Jiang Qiu
2016-03-15 12:56       ` Jiang Qiu
2016-03-23 11:41       ` Jiang Qiu
2016-03-23 16:20         ` Alan Tull
2016-03-24  1:24           ` Jiang Qiu
2016-03-11  0:44     ` Jiang Qiu
2016-03-22 10:38   ` Linus Walleij
2016-03-22 15:55     ` Mika Westerberg
2016-03-04  7:44 ` qiujiang [this message]
2016-03-10 20:30   ` [PATCH v5 2/3] gpio: designware: add acpi binding Andy Shevchenko
2016-03-04  7:44 ` [PATCH v5 3/3] gpio: designware: add gpio-signaled acpi event support qiujiang
2016-03-10 20:31   ` Andy Shevchenko
2016-03-09  2:26 ` [PATCH v5 0/3] "gpio: designware: add gpio-signaled acpi event support for power button" Linus Walleij
2016-03-10 20:10   ` Alan Tull

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1457077474-124064-3-git-send-email-qiujiang@huawei.com \
    --to=qiujiang@huawei.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=charles.chenxin@huawei.com \
    --cc=gnurou@gmail.com \
    --cc=haifeng.wei@huawei.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mika.westerberg@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).