Commit 438b6c20 authored by David Jander's avatar David Jander Committed by Bartosz Golaszewski

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: 0f25fda8 ("gpio: pca953x: Zap ad-hoc reg_direction cache")
Cc: Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarDavid Jander <david@protonic.nl>
Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
parent bc624a06
...@@ -606,8 +606,7 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d) ...@@ -606,8 +606,7 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
u8 invert_irq_mask[MAX_BANK]; u8 invert_irq_mask[MAX_BANK];
u8 reg_direction[MAX_BANK]; u8 reg_direction[MAX_BANK];
regmap_bulk_read(chip->regmap, chip->regs->direction, reg_direction, pca953x_read_regs(chip, chip->regs->direction, reg_direction);
NBANK(chip));
if (chip->driver_data & PCA_PCAL) { if (chip->driver_data & PCA_PCAL) {
/* Enable latch on interrupt-enabled inputs */ /* Enable latch on interrupt-enabled inputs */
...@@ -710,8 +709,7 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, u8 *pending) ...@@ -710,8 +709,7 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, u8 *pending)
return false; return false;
/* Remove output pins from the equation */ /* Remove output pins from the equation */
regmap_bulk_read(chip->regmap, chip->regs->direction, reg_direction, pca953x_read_regs(chip, chip->regs->direction, reg_direction);
NBANK(chip));
for (i = 0; i < NBANK(chip); i++) for (i = 0; i < NBANK(chip); i++)
cur_stat[i] &= reg_direction[i]; cur_stat[i] &= reg_direction[i];
...@@ -789,8 +787,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, ...@@ -789,8 +787,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
* interrupt. We have to rely on the previous read for * interrupt. We have to rely on the previous read for
* this purpose. * this purpose.
*/ */
regmap_bulk_read(chip->regmap, chip->regs->direction, reg_direction, pca953x_read_regs(chip, chip->regs->direction, reg_direction);
NBANK(chip));
for (i = 0; i < NBANK(chip); i++) for (i = 0; i < NBANK(chip); i++)
chip->irq_stat[i] &= reg_direction[i]; chip->irq_stat[i] &= reg_direction[i];
mutex_init(&chip->irq_lock); mutex_init(&chip->irq_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment