Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1230040 > unrolled thread

[PATCH v1 6/8] gpio: pca953x: support ACPI devices found on Galileo Gen2

Started byAndy Shevchenko <andriy.shevchenko@linux.intel.com>
First post2015-09-22 12:20 +0200
Last post2015-10-02 13:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v1 6/8] gpio: pca953x: support ACPI devices found on Galileo Gen2 Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-09-22 12:20 +0200
    Re: [PATCH v1 6/8] gpio: pca953x: support ACPI devices found on  Galileo Gen2 Linus Walleij <linus.walleij@linaro.org> - 2015-10-02 13:00 +0200

#1230040 — [PATCH v1 6/8] gpio: pca953x: support ACPI devices found on Galileo Gen2

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2015-09-22 12:20 +0200
Subject[PATCH v1 6/8] gpio: pca953x: support ACPI devices found on Galileo Gen2
Message-ID<qbsQ1-2oh-1@gated-at.bofh.it>
This patch adds a support of the expandes found on Intel Galileo Gen2 board.
The platform information comes from ACPI.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-pca953x.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 242e244..0220b38 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -21,6 +21,7 @@
 #ifdef CONFIG_OF_GPIO
 #include <linux/of_platform.h>
 #endif
+#include <linux/acpi.h>
 
 #define PCA953X_INPUT		0
 #define PCA953X_OUTPUT		1
@@ -75,6 +76,12 @@ static const struct i2c_device_id pca953x_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, pca953x_id);
 
+static const struct acpi_device_id pca953x_acpi_ids[] = {
+	{ "INT3491", 16 | PCA953X_TYPE | PCA_INT, },
+	{ }
+};
+MODULE_DEVICE_TABLE(acpi, pca953x_acpi_ids);
+
 #define MAX_BANK 5
 #define BANK_SZ 8
 
@@ -675,7 +682,18 @@ static int pca953x_probe(struct i2c_client *client,
 
 	chip->client = client;
 
-	chip->driver_data = id->driver_data;
+	if (id) {
+		chip->driver_data = id->driver_data;
+	} else {
+		const struct acpi_device_id *id;
+
+		id = acpi_match_device(pca953x_acpi_ids, &client->dev);
+		if (!id)
+			return -ENODEV;
+
+		chip->driver_data = id->driver_data;
+	}
+
 	chip->chip_type = PCA_CHIP_TYPE(chip->driver_data);
 
 	mutex_init(&chip->i2c_lock);
@@ -768,6 +786,7 @@ static struct i2c_driver pca953x_driver = {
 	.driver = {
 		.name	= "pca953x",
 		.of_match_table = pca953x_dt_ids,
+		.acpi_match_table = ACPI_PTR(pca953x_acpi_ids),
 	},
 	.probe		= pca953x_probe,
 	.remove		= pca953x_remove,
-- 
2.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1238120 — Re: [PATCH v1 6/8] gpio: pca953x: support ACPI devices found on Galileo Gen2

FromLinus Walleij <linus.walleij@linaro.org>
Date2015-10-02 13:00 +0200
SubjectRe: [PATCH v1 6/8] gpio: pca953x: support ACPI devices found on Galileo Gen2
Message-ID<qf6ef-18p-21@gated-at.bofh.it>
In reply to#1230040
On Tue, Sep 22, 2015 at 3:10 AM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> This patch adds a support of the expandes found on Intel Galileo Gen2 board.
> The platform information comes from ACPI.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Paging Gregory, Grygorii, Graeme on this patch too.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web