summaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorBiju Das <biju.das.jz@bp.renesas.com>2023-08-19 21:04:43 +0300
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2023-08-22 12:41:17 +0300
commitdb3b16dcc7e4f5bfbe35806a54fb15dc858d19f8 (patch)
tree11059ae8d427284dd9bc3b4f0b019846e5b5ed1b /drivers/gpio
parentbb5ad5ef7493ed21abc2c8b890204c8f79df86a8 (diff)
downloadlinux-db3b16dcc7e4f5bfbe35806a54fb15dc858d19f8.tar.xz
gpio: pcf857x: Extend match data support for OF tables
The driver has OF match table, but still it uses an ID lookup table for retrieving match data. Currently, the driver is working on the assumption that an I2C device registered via OF will always match a legacy I2C device ID. Extend match data support for OF tables by using i2c_get_match_data() instead of the ID lookup for both OF/ID matches by making similar OF/ID tables. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-pcf857x.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c
index c4c785548408..53b69abe6787 100644
--- a/drivers/gpio/gpio-pcf857x.c
+++ b/drivers/gpio/gpio-pcf857x.c
@@ -36,19 +36,19 @@ static const struct i2c_device_id pcf857x_id[] = {
MODULE_DEVICE_TABLE(i2c, pcf857x_id);
static const struct of_device_id pcf857x_of_table[] = {
- { .compatible = "nxp,pcf8574" },
- { .compatible = "nxp,pcf8574a" },
- { .compatible = "nxp,pca8574" },
- { .compatible = "nxp,pca9670" },
- { .compatible = "nxp,pca9672" },
- { .compatible = "nxp,pca9674" },
- { .compatible = "nxp,pcf8575" },
- { .compatible = "nxp,pca8575" },
- { .compatible = "nxp,pca9671" },
- { .compatible = "nxp,pca9673" },
- { .compatible = "nxp,pca9675" },
- { .compatible = "maxim,max7328" },
- { .compatible = "maxim,max7329" },
+ { .compatible = "nxp,pcf8574", (void *)8 },
+ { .compatible = "nxp,pcf8574a", (void *)8 },
+ { .compatible = "nxp,pca8574", (void *)8 },
+ { .compatible = "nxp,pca9670", (void *)8 },
+ { .compatible = "nxp,pca9672", (void *)8 },
+ { .compatible = "nxp,pca9674", (void *)8 },
+ { .compatible = "nxp,pcf8575", (void *)16 },
+ { .compatible = "nxp,pca8575", (void *)16 },
+ { .compatible = "nxp,pca9671", (void *)16 },
+ { .compatible = "nxp,pca9673", (void *)16 },
+ { .compatible = "nxp,pca9675", (void *)16 },
+ { .compatible = "maxim,max7328", (void *)8 },
+ { .compatible = "maxim,max7329", (void *)8 },
{ }
};
MODULE_DEVICE_TABLE(of, pcf857x_of_table);
@@ -272,7 +272,6 @@ static const struct irq_chip pcf857x_irq_chip = {
static int pcf857x_probe(struct i2c_client *client)
{
- const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct pcf857x *gpio;
unsigned int n_latch = 0;
int status;
@@ -296,7 +295,7 @@ static int pcf857x_probe(struct i2c_client *client)
gpio->chip.set_multiple = pcf857x_set_multiple;
gpio->chip.direction_input = pcf857x_input;
gpio->chip.direction_output = pcf857x_output;
- gpio->chip.ngpio = id->driver_data;
+ gpio->chip.ngpio = (uintptr_t)i2c_get_match_data(client);
/* NOTE: the OnSemi jlc1562b is also largely compatible with
* these parts, notably for output. It has a low-resolution