Skip to content

Commit

Permalink
gpio: pca953x: support ACPI devices found on Galileo Gen2
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Andy Shevchenko authored and Linus Walleij committed Oct 5, 2015
1 parent c666414 commit f32517b
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion drivers/gpio/gpio-pca953x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -76,6 +77,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

Expand Down Expand Up @@ -680,7 +687,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);
Expand Down Expand Up @@ -773,6 +791,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,
Expand Down

0 comments on commit f32517b

Please sign in to comment.