Skip to contentSkip to conversation

gpio: pca953x_gpio: Add support for 24 bit IO expander

PATCH New Vignesh Raghavendra 2 participants 2 messages Jan 27, 2020 – Feb 4, 2020 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: pca953x_gpio: Add support for 24 bit IO expander

J721e EVM has a TCA6424 IO expander that has 24 GPIOs. Add support for the same

---
 drivers/gpio/pca953x_gpio.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpio/pca953x_gpio.c +9 -2
index 07a3356b3c87..5c2944067bc1 100644
@@ -15,8 +15,7 @@
  *
  * TODO:
  * 1. Support PCA957X_TYPE
- * 2. Support 24 gpio pins
- * 3. Support Polarity Inversion
+ * 2. Support Polarity Inversion
  */
 
 #include <common.h>
@@ -118,6 +117,10 @@ static int pca953x_read_regs(struct udevice *dev, int reg, u8 *val)
 		ret = dm_i2c_read(dev, reg, val, 1);
 	} else if (info->gpio_count <= 16) {
 		ret = dm_i2c_read(dev, reg << 1, val, info->bank_count);
+	} else if (info->gpio_count <= 24) {
+		/* Auto increment */
+		ret = dm_i2c_read(dev, (reg << 2) | 0x80, val,
+				  info->bank_count);
 	} else if (info->gpio_count == 40) {
 		/* Auto increment */
 		ret = dm_i2c_read(dev, (reg << 3) | 0x80, val,
@@ -139,6 +142,10 @@ static int pca953x_write_regs(struct udevice *dev, int reg, u8 *val)
 		ret = dm_i2c_write(dev, reg, val, 1);
 	} else if (info->gpio_count <= 16) {
 		ret = dm_i2c_write(dev, reg << 1, val, info->bank_count);
+	} else if (info->gpio_count <= 24) {
+		/* Auto increment */
+		ret = dm_i2c_write(dev, (reg << 2) | 0x80, val,
+				   info->bank_count);
 	} else if (info->gpio_count == 40) {
 		/* Auto increment */
 		ret = dm_i2c_write(dev, (reg << 3) | 0x80, val, info->bank_count);
Signature · 1 line
2.25.0
#1 lore raw

PATCH 1/1 gpio: pca953x_gpio: Add support for 24 bit IO expander

Quoted 4 lines · Vignesh Raghavendra

J721e EVM has a TCA6424 IO expander that has 24 GPIOs. Add support for the same

pulled into u-boot-ti tree.

Thanks and regards,
Lokesh