Skip to content

Commit f32517b

Browse files
andy-shevLinus Walleij
authored andcommitted
gpio: pca953x: support ACPI devices found on Galileo Gen2
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>
1 parent c666414 commit f32517b

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

drivers/gpio/gpio-pca953x.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#ifdef CONFIG_OF_GPIO
2222
#include <linux/of_platform.h>
2323
#endif
24+
#include <linux/acpi.h>
2425

2526
#define PCA953X_INPUT 0
2627
#define PCA953X_OUTPUT 1
@@ -76,6 +77,12 @@ static const struct i2c_device_id pca953x_id[] = {
7677
};
7778
MODULE_DEVICE_TABLE(i2c, pca953x_id);
7879

80+
static const struct acpi_device_id pca953x_acpi_ids[] = {
81+
{ "INT3491", 16 | PCA953X_TYPE | PCA_INT, },
82+
{ }
83+
};
84+
MODULE_DEVICE_TABLE(acpi, pca953x_acpi_ids);
85+
7986
#define MAX_BANK 5
8087
#define BANK_SZ 8
8188

@@ -680,7 +687,18 @@ static int pca953x_probe(struct i2c_client *client,
680687

681688
chip->client = client;
682689

683-
chip->driver_data = id->driver_data;
690+
if (id) {
691+
chip->driver_data = id->driver_data;
692+
} else {
693+
const struct acpi_device_id *id;
694+
695+
id = acpi_match_device(pca953x_acpi_ids, &client->dev);
696+
if (!id)
697+
return -ENODEV;
698+
699+
chip->driver_data = id->driver_data;
700+
}
701+
684702
chip->chip_type = PCA_CHIP_TYPE(chip->driver_data);
685703

686704
mutex_init(&chip->i2c_lock);
@@ -773,6 +791,7 @@ static struct i2c_driver pca953x_driver = {
773791
.driver = {
774792
.name = "pca953x",
775793
.of_match_table = pca953x_dt_ids,
794+
.acpi_match_table = ACPI_PTR(pca953x_acpi_ids),
776795
},
777796
.probe = pca953x_probe,
778797
.remove = pca953x_remove,

0 commit comments

Comments
 (0)