Skip to content

Commit 438b6c2

Browse files
yopebrgl
authored andcommitted
gpio: pca953x: use pca953x_read_regs instead of regmap_bulk_read
The register number needs to be translated for chips with more than 8 ports. This patch fixes a bug causing all chips with more than 8 GPIO pins to not work correctly. Fixes: 0f25fda ("gpio: pca953x: Zap ad-hoc reg_direction cache") Cc: Cc: <[email protected]> Signed-off-by: David Jander <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent bc624a0 commit 438b6c2

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/gpio/gpio-pca953x.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -606,8 +606,7 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
606606
u8 invert_irq_mask[MAX_BANK];
607607
u8 reg_direction[MAX_BANK];
608608

609-
regmap_bulk_read(chip->regmap, chip->regs->direction, reg_direction,
610-
NBANK(chip));
609+
pca953x_read_regs(chip, chip->regs->direction, reg_direction);
611610

612611
if (chip->driver_data & PCA_PCAL) {
613612
/* Enable latch on interrupt-enabled inputs */
@@ -710,8 +709,7 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, u8 *pending)
710709
return false;
711710

712711
/* Remove output pins from the equation */
713-
regmap_bulk_read(chip->regmap, chip->regs->direction, reg_direction,
714-
NBANK(chip));
712+
pca953x_read_regs(chip, chip->regs->direction, reg_direction);
715713
for (i = 0; i < NBANK(chip); i++)
716714
cur_stat[i] &= reg_direction[i];
717715

@@ -789,8 +787,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
789787
* interrupt. We have to rely on the previous read for
790788
* this purpose.
791789
*/
792-
regmap_bulk_read(chip->regmap, chip->regs->direction, reg_direction,
793-
NBANK(chip));
790+
pca953x_read_regs(chip, chip->regs->direction, reg_direction);
794791
for (i = 0; i < NBANK(chip); i++)
795792
chip->irq_stat[i] &= reg_direction[i];
796793
mutex_init(&chip->irq_lock);

0 commit comments

Comments
 (0)