Commit 25a1b710 authored by Marek Vasut's avatar Marek Vasut Committed by Linus Walleij

gpio: pca953x: Zap ad-hoc I2C block write in multi GPIO set

The ad-hoc i2c block write can be replaced by standard register accessor
function, which correctly handles all the chip details and differences.
Do so to simplify the code.
Signed-off-by: default avatarMarek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 7a04aaa3
...@@ -364,8 +364,6 @@ static void pca953x_gpio_set_multiple(struct gpio_chip *gc, ...@@ -364,8 +364,6 @@ static void pca953x_gpio_set_multiple(struct gpio_chip *gc,
unsigned long *mask, unsigned long *bits) unsigned long *mask, unsigned long *bits)
{ {
struct pca953x_chip *chip = gpiochip_get_data(gc); struct pca953x_chip *chip = gpiochip_get_data(gc);
int bank_shift = pca953x_bank_shift(chip);
u32 regaddr = chip->regs->output << bank_shift;
unsigned int bank_mask, bank_val; unsigned int bank_mask, bank_val;
int bank; int bank;
u8 reg_val[MAX_BANK]; u8 reg_val[MAX_BANK];
...@@ -384,14 +382,7 @@ static void pca953x_gpio_set_multiple(struct gpio_chip *gc, ...@@ -384,14 +382,7 @@ static void pca953x_gpio_set_multiple(struct gpio_chip *gc,
} }
} }
/* PCA9575 needs address-increment on multi-byte writes */ ret = pca953x_write_regs(chip, chip->regs->output, reg_val);
if ((PCA_CHIP_TYPE(chip->driver_data) == PCA957X_TYPE) &&
(NBANK(chip) > 1)) {
regaddr |= REG_ADDR_AI;
}
ret = i2c_smbus_write_i2c_block_data(chip->client, regaddr,
NBANK(chip), reg_val);
if (ret) if (ret)
goto exit; goto exit;
......
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