Skip to content

Commit b8c768c

Browse files
Haibo Chenbrgl
authored andcommitted
gpio: pca953x: use the correct register address when regcache sync during init
For regcache_sync_region, we need to use pca953x_recalc_addr() to get the real register address. Fixes: ec82d1e ("gpio: pca953x: Zap ad-hoc reg_output cache") Fixes: 0f25fda ("gpio: pca953x: Zap ad-hoc reg_direction cache") Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
1 parent 2abc17a commit b8c768c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/gpio/gpio-pca953x.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -909,15 +909,18 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
909909
static int device_pca95xx_init(struct pca953x_chip *chip, u32 invert)
910910
{
911911
DECLARE_BITMAP(val, MAX_LINE);
912+
u8 regaddr;
912913
int ret;
913914

914-
ret = regcache_sync_region(chip->regmap, chip->regs->output,
915-
chip->regs->output + NBANK(chip) - 1);
915+
regaddr = pca953x_recalc_addr(chip, chip->regs->output, 0);
916+
ret = regcache_sync_region(chip->regmap, regaddr,
917+
regaddr + NBANK(chip) - 1);
916918
if (ret)
917919
goto out;
918920

919-
ret = regcache_sync_region(chip->regmap, chip->regs->direction,
920-
chip->regs->direction + NBANK(chip) - 1);
921+
regaddr = pca953x_recalc_addr(chip, chip->regs->direction, 0);
922+
ret = regcache_sync_region(chip->regmap, regaddr,
923+
regaddr + NBANK(chip) - 1);
921924
if (ret)
922925
goto out;
923926

0 commit comments

Comments
 (0)