Skip to content

Commit

Permalink
gpio: pca953x: use pca953x_read_regs instead of regmap_bulk_read
Browse files Browse the repository at this point in the history
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: <stable@vger.kernel.org>
Signed-off-by: David Jander <david@protonic.nl>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
  • Loading branch information
David Jander authored and Bartosz Golaszewski committed Aug 28, 2019
1 parent bc624a0 commit 438b6c2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/gpio/gpio-pca953x.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,7 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
u8 invert_irq_mask[MAX_BANK];
u8 reg_direction[MAX_BANK];

regmap_bulk_read(chip->regmap, chip->regs->direction, reg_direction,
NBANK(chip));
pca953x_read_regs(chip, chip->regs->direction, reg_direction);

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

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

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

0 comments on commit 438b6c2

Please sign in to comment.