• Marek Vasut's avatar
    gpio: pca953x: Repair multi-byte IO address increment on PCA9575 · 8958262a
    Marek Vasut authored
    The multi-byte IO on various pca953x chips requires the auto-increment bit,
    while other chips toggle the LSbit automatically. Note that LSbit toggling
    only alternates between two registers during the IO, it is not the same as
    address auto-increment. The driver currently assumes that #gpios > 16 implies
    auto-increment, while #gpios <= 16 implies LSbit toggling. This is incorrect
    at there are chips with 16 GPIOs which require the auto-increment bit.
    
    The PCA9575, according to NXP datasheet rev. 4.2 from 16 April 2015, section
    7.3 Command Register, the bit 7 in command register is the auto-increment
    bit, which allows programming multiple registers sequentially.
    
    Set this bit both in pca953x_gpio_set_multiple(), where it fixes the multi
    register programming, and in pca957x_write_regs_16(), where is simplifies
    the function. In fact, the pca957x_write_regs_16() now looks rather similar
    to pca953x_write_regs_24() and pca953x_write_regs_16(), which is intended
    for subsequent patches.
    Signed-off-by: default avatarMarek Vasut <marek.vasut+renesas@gmail.com>
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    8958262a
gpio-pca953x.c 26.2 KB