diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2023-03-16 15:12:58 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-03-16 15:12:58 +0100 |
commit | 99f4aafa139ea9f6e0eebecbddb3c9a216853e81 (patch) | |
tree | 97443484018f991c3ca98299075417476ebcc4c8 /drivers/gpio | |
parent | 9b6c8c0aa005554673b1a95f5ae8db72f60a589b (diff) | |
parent | 9c432ede2cb016b2a98902a8b3aa1f8f26f29ee4 (diff) | |
download | barebox-99f4aafa139ea9f6e0eebecbddb3c9a216853e81.tar.gz |
Merge branch 'for-next/misc' into next
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-pca953x.c | 34 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.c | 2 |
2 files changed, 34 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index 2d3f8a8871..bfcfcfb56c 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -12,6 +12,8 @@ #include <common.h> #include <malloc.h> #include <driver.h> +#include <gpiod.h> +#include <regulator.h> #include <xfuncs.h> #include <errno.h> #include <i2c/i2c.h> @@ -416,7 +418,8 @@ static int pca953x_probe(struct device *dev) unsigned long driver_data; struct pca953x_platform_data *pdata; struct pca953x_chip *chip; - int ret; + struct regulator *reg; + int reset_gpio, ret; u32 invert = 0; chip = xzalloc(sizeof(struct pca953x_chip)); @@ -439,6 +442,20 @@ static int pca953x_probe(struct device *dev) chip->client = client; + reset_gpio = gpiod_get(dev, "reset", GPIOD_OUT_LOW); + if (!gpio_is_valid(reset_gpio) && reset_gpio != -ENOENT) + dev_warn(dev, "Failed to get 'reset' GPIO (ignored)\n"); + + reg = regulator_get(dev, "vcc"); + if (IS_ERR(reg)) { + dev_warn(dev, "Failed to get 'vcc' regulator (ignored).\n"); + reg = NULL; + } + + ret = regulator_enable(reg); + if (ret) + return dev_err_probe(dev, ret, "failed to enable register\n"); + chip->chip_type = driver_data & (PCA953X_TYPE | PCA957X_TYPE); /* initialize cached registers from their original values. @@ -472,7 +489,10 @@ static int pca953x_probe(struct device *dev) #define OF_957X(__nrgpio, __int) (void *)(__nrgpio | PCA957X_TYPE | __int) static const struct of_device_id pca953x_dt_ids[] = { + { .compatible = "nxp,pca6408", .data = OF_953X(8, PCA_INT), }, + { .compatible = "nxp,pca6416", .data = OF_953X(16, PCA_INT), }, { .compatible = "nxp,pca9505", .data = OF_953X(40, PCA_INT), }, + { .compatible = "nxp,pca9506", .data = OF_953X(40, PCA_INT), }, { .compatible = "nxp,pca9534", .data = OF_953X( 8, PCA_INT), }, { .compatible = "nxp,pca9535", .data = OF_953X(16, PCA_INT), }, { .compatible = "nxp,pca9536", .data = OF_953X( 4, 0), }, @@ -488,16 +508,28 @@ static const struct of_device_id pca953x_dt_ids[] = { { .compatible = "nxp,pca9698", .data = OF_953X(40, 0), }, { .compatible = "nxp,pcal6408", .data = OF_953X(8, PCA_LATCH_INT), }, + { .compatible = "nxp,pcal6416", .data = OF_953X(16, PCA_LATCH_INT), }, + { .compatible = "nxp,pcal6524", .data = OF_953X(24, PCA_LATCH_INT), }, + { .compatible = "nxp,pcal9535", .data = OF_953X(16, PCA_LATCH_INT), }, + { .compatible = "nxp,pcal9554b", .data = OF_953X( 8, PCA_LATCH_INT), }, + { .compatible = "nxp,pcal9555a", .data = OF_953X(16, PCA_LATCH_INT), }, { .compatible = "maxim,max7310", .data = OF_953X( 8, 0), }, { .compatible = "maxim,max7312", .data = OF_953X(16, PCA_INT), }, { .compatible = "maxim,max7313", .data = OF_953X(16, PCA_INT), }, { .compatible = "maxim,max7315", .data = OF_953X( 8, PCA_INT), }, + { .compatible = "maxim,max7318", .data = OF_953X(16, PCA_INT), }, { .compatible = "ti,pca6107", .data = OF_953X( 8, PCA_INT), }, + { .compatible = "ti,pca9536", .data = OF_953X( 4, 0), }, { .compatible = "ti,tca6408", .data = OF_953X( 8, PCA_INT), }, { .compatible = "ti,tca6416", .data = OF_953X(16, PCA_INT), }, { .compatible = "ti,tca6424", .data = OF_953X(24, PCA_INT), }, + { .compatible = "ti,tca9539", .data = OF_953X(16, PCA_INT), }, + + { .compatible = "onnn,cat9554", .data = OF_953X( 8, PCA_INT), }, + { .compatible = "onnn,pca9654", .data = OF_953X( 8, PCA_INT), }, + { .compatible = "onnn,pca9655", .data = OF_953X(16, PCA_INT), }, { .compatible = "exar,xra1202", .data = OF_953X( 8, 0), }, { } diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 2e7a39b475..7362798758 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -716,7 +716,7 @@ static int do_gpiolib(int argc, char *argv[]) printf("\nGPIOs %u-%u, chip %s:\n", gi->chip->base, gi->chip->base + gi->chip->ngpio - 1, - gi->chip->dev->name); + dev_name(gi->chip->dev)); printf(" %-3s %-3s %-9s %-20s %-20s\n", "dir", "val", "requested", "name", "label"); } |