linux-stable/drivers/gpio
Uwe Kleine-König bcf41dc480 gpio: pca953x: fix handling of automatic address incrementing
Some of the chips supported by the pca953x driver need the most
significant bit in the address word set to automatically increment the
address pointer on subsequent reads and writes (example: PCA9505). With
this bit unset the same register is read multiple times on a multi-byte
read sequence. Other chips must not have this bit set and autoincrement
always (example: PCA9555).

Up to now this AI bit was interpreted to be part of the address, which
resulted in inconsistent regmap caching when a register was written with
AI set and then read without it. This happened for the PCA9505 in
pca953x_gpio_set_multiple() where pca953x_read_regs() bulk read from the
cache for registers 0x8-0xc and then wrote to registers 0x88-0x8c. (Side
note: reading 5 values from offset 0x8 yiels OP0 5 times because AI must
be set to get OP0-OP4, which is another bug that is resolved here as a
by-product.) The same problem happens when calls to gpio_set_value() and
gpio_set_array_value() were mixed.

With this patch the AI bit is always set for chips that support it. This
works as there are no code locations that make use of the behaviour with
AI unset (for the chips that support it).

Note that the call to pca953x_setup_gpio() had to be done a bit earlier
to make the NBANK macro work.

The history of this bug is a bit complicated. Commit b32cecb46b
("gpio: pca953x: Extract the register address mangling to single
function") changed which chips and functions are affected. Commit
3b00691cc4 ("gpio: pca953x: hack to fix 24 bit gpio expanders") used
some duct tape to make the driver at least appear to work. Commit
4942723276 ("gpio: pca953x: Perform basic regmap conversion")
introduced the caching. Commit b4818afeac ("gpio: pca953x: Add
set_multiple to allow multiple bits to be set in one write.") introduced
the .set_multiple() callback which didn't work for chips that need the
AI bit which was fixed later for some chips in 8958262af3 ("gpio:
pca953x: Repair multi-byte IO address increment on PCA9575"). So I'm
sorry, I don't know which commit I should pick for a Fixes: line.

Tested-by: Marcel Gudert <m.gudert@eckelmann.de>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-04-29 13:19:51 +02:00
..
gpio-74x164.c gpio: 74x164: utilize the for_each_set_clump8 macro 2019-12-04 19:44:12 -08:00
gpio-74xx-mmio.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-104-dio-48e.c gpio: 104-dio-48e: utilize for_each_set_clump8 macro 2019-12-04 19:44:12 -08:00
gpio-104-idi-48.c gpio: 104-idi-48: utilize for_each_set_clump8 macro 2019-12-04 19:44:12 -08:00
gpio-104-idio-16.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-adnp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
gpio-adp5520.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 149 2019-05-30 11:25:18 -07:00
gpio-adp5588.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 149 2019-05-30 11:25:18 -07:00
gpio-altera-a10sr.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
gpio-altera.c gpio: altera: change to platform_get_irq_optional to avoid false-positive error 2020-01-09 10:35:05 +01:00
gpio-amd-fch.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-amd8111.c
gpio-amdpt.c Bulk GPIO changes for the v5.3 kernel cycle: 2019-07-09 09:07:00 -07:00
gpio-arizona.c gpio: arizona: Use local copy of pdata 2019-08-05 11:42:29 +02:00
gpio-aspeed-sgpio.c gpio: aspeed-sgpio: fixed typos 2020-01-23 16:16:05 +01:00
gpio-aspeed.c gpio: aspeed-sgpio: fixed typos 2020-01-23 16:16:05 +01:00
gpio-ath79.c gpio: ath79: use devm_platform_ioremap_resource() 2019-10-09 18:20:19 +02:00
gpio-bcm-kona.c gpio: bcm-kona: use platform_irq_count 2019-12-11 11:06:31 +01:00
gpio-bd9571mwv.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-bd70528.c This is the bulk of GPIO changes for the v5.5 kernel cycle 2019-12-01 17:56:50 -08:00
gpio-bd71828.c gpio: bd71828: Remove unneeded defines for GPIO_LINE_DIRECTION_IN/OUT 2020-02-10 10:55:18 +01:00
gpio-brcmstb.c gpio: brcmstb: support gpio-line-names property 2020-03-26 00:02:03 +01:00
gpio-bt8xx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
gpio-cadence.c gpio: cadence: Pass irqchip when adding gpiochip 2019-08-15 09:44:19 +02:00
gpio-clps711x.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
gpio-creg-snps.c gpio: aspeed-sgpio: fixed typos 2020-01-23 16:16:05 +01:00
gpio-crystalcove.c gpio: crystalcove: Convert to use SPDX identifier 2019-02-08 15:55:40 +02:00
gpio-cs5535.c docs: driver-model: move it to the driver-api book 2019-07-15 11:03:02 -03:00
gpio-da9052.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
gpio-da9055.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
gpio-davinci.c gpio: Unconditionally assign .request()/.free() 2020-04-02 09:16:06 +02:00
gpio-dln2.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-dwapb.c gpiolib: acpi: Split ACPI stuff to gpiolib-acpi.h 2019-07-31 00:57:21 +02:00
gpio-eic-sprd.c Revert "gpio: eic-sprd: Use devm_platform_ioremap_resource()" 2020-04-02 09:39:09 +02:00
gpio-em.c gpio: em: Use platform_get_irq() to obtain interrupts 2019-11-13 13:47:48 +01:00
gpio-ep93xx.c gpio: ep93xx: Pass irqchip when adding gpiochip 2019-09-04 10:59:10 +02:00
gpio-exar.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-f7188x.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-ftgpio010.c gpio: ftgpio: Fix an error handling path in 'ftgpio_gpio_probe()' 2019-08-23 12:02:34 +02:00
gpio-ge.c
gpio-gpio-mm.c gpio: gpio-mm: utilize for_each_set_clump8 macro 2019-12-04 19:44:12 -08:00
gpio-grgpio.c gpio: Remove the unused flags 2020-01-15 11:24:19 +01:00
gpio-gw-pld.c gpio: Add a Gateworks PLD GPIO driver 2019-02-09 11:33:37 +01:00
gpio-hlwd.c gpio: hlwd: Pass irqchip when adding gpiochip 2019-08-15 09:57:29 +02:00
gpio-htc-egpio.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-ich.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-intel-mid.c gpio: intel-mid: Move hardware initialization to callback 2019-10-15 01:18:51 +02:00
gpio-iop.c Merge branch 'i2c/for-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2019-07-15 21:10:39 -07:00
gpio-it87.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 300 2019-06-05 17:37:00 +02:00
gpio-ixp4xx.c gpio: updates for v5.4 2019-09-03 16:04:19 +02:00
gpio-janz-ttl.c Bulk GPIO changes for the v5.3 kernel cycle: 2019-07-09 09:07:00 -07:00
gpio-kempld.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-logicvc.c gpio: Add support for the Xylon LogiCVC GPIOs 2019-12-13 09:50:29 +01:00
gpio-loongson.c MIPS: Loongson64: Rename CPU TYPES 2019-10-31 15:03:10 -07:00
gpio-loongson1.c drivers: gpio: loongon1: use devm_platform_ioremap_resource() 2019-04-05 00:04:26 +07:00
gpio-lp873x.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-lp3943.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 372 2019-06-05 17:37:10 +02:00
gpio-lp87565.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-lpc18xx.c drivers: gpio: lpc18xx: use devm_platform_ioremap_resource() 2019-04-05 00:04:26 +07:00
gpio-lpc32xx.c gpio: lpc32xx: allow building on non-lpc32xx targets 2019-08-15 21:33:07 +02:00
gpio-madera.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-max730x.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
gpio-max732x.c Bulk GPIO changes for the v5.3 kernel cycle: 2019-07-09 09:07:00 -07:00
gpio-max3191x.c gpio: max3191x: utilize the for_each_set_clump8 macro 2019-12-04 19:44:13 -08:00
gpio-max7300.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
gpio-max7301.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
gpio-max77620.c This is the bulk of GPIO changes for the v5.5 kernel cycle 2019-12-01 17:56:50 -08:00
gpio-max77650.c gpio: max77650: add MODULE_ALIAS() 2019-07-29 00:03:52 +02:00
gpio-mb86s7x.c gpiolib: acpi: Split ACPI stuff to gpiolib-acpi.h 2019-07-31 00:57:21 +02:00
gpio-mc9s08dz60.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
gpio-mc33880.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 176 2019-05-30 11:29:19 -07:00
gpio-menz127.c drivers: mcb: use symbol namespaces 2019-11-03 19:54:53 +01:00
gpio-merrifield.c gpio: merrifield: Pass irqchip when adding gpiochip 2019-11-13 15:30:53 +02:00
gpio-ml-ioh.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 167 2019-05-30 11:26:39 -07:00
gpio-mlxbf.c gpio: mlxbf: remove unused including <linux/version.h> 2019-04-08 08:47:06 +02:00
gpio-mlxbf2.c gpio: add driver for Mellanox BlueField 2 GPIO controller 2020-03-09 09:47:50 +01:00
gpio-mm-lantiq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
gpio-mmio.c gpio: mmio: introduce BGPIOF_NO_SET_ON_INPUT 2020-03-25 09:50:45 +01:00
gpio-mockup.c gpio: mockup: coding-style fix 2020-02-20 15:41:05 +01:00
gpio-moxtet.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-mpc8xxx.c Linux 5.5-rc6 2020-01-17 08:59:29 +01:00
gpio-mpc5200.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333 2019-06-05 17:37:06 +02:00
gpio-msic.c gpio: msic: Convert to use SPDX identifier 2019-02-08 15:55:41 +02:00
gpio-mt7621.c gpio: mt7621: add BGPIOF_NO_SET_ON_INPUT flag 2020-03-25 09:50:45 +01:00
gpio-mvebu.c gpio: mvebu: avoid error message for optional IRQ 2020-03-25 09:50:45 +01:00
gpio-mxc.c gpio: Unconditionally assign .request()/.free() 2020-04-02 09:16:06 +02:00
gpio-mxs.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-octeon.c drivers: gpio: octeon: use devm_platform_ioremap_resource() 2019-04-05 00:04:27 +07:00
gpio-omap.c Revert "gpio: omap: Fix lost edge wake-up interrupts" 2020-03-09 10:24:46 +01:00
gpio-palmas.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
gpio-pca953x.c gpio: pca953x: fix handling of automatic address incrementing 2020-04-29 13:19:51 +02:00
gpio-pcf857x.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
gpio-pch.c gpio: pch: Use dev_get_drvdata 2019-07-23 18:59:05 +03:00
gpio-pci-idio-16.c gpio: pci-idio-16: utilize for_each_set_clump8 macro 2019-12-04 19:44:12 -08:00
gpio-pcie-idio-24.c gpio: pcie-idio-24: utilize for_each_set_clump8 macro 2019-12-04 19:44:12 -08:00
gpio-pisosr.c gpio: pisosr: utilize the for_each_set_clump8 macro 2019-12-04 19:44:13 -08:00
gpio-pl061.c gpio: pl061: Support building as module 2020-04-14 16:23:46 +02:00
gpio-pmic-eic-sprd.c gpio: Remove dev_err() usage after platform_get_irq() 2019-08-05 13:25:34 +02:00
gpio-pxa.c gpio: Unconditionally assign .request()/.free() 2020-04-02 09:16:06 +02:00
gpio-raspberrypi-exp.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-rc5t583.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
gpio-rcar.c gpio: rcar: Fix typo in comment 2020-02-20 09:18:54 +01:00
gpio-rda.c gpio: Add RDA Micro GPIO controller support 2019-10-29 15:12:52 +01:00
gpio-rdc321x.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
gpio-reg.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-sa1100.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-sama5d2-piobu.c gpio: remove unneeded MODULE_VERSION() usage 2019-12-12 17:09:50 +01:00
gpio-sch.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-sch311x.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-sifive.c gpio: sifive: fix static checker warning 2020-02-10 13:54:17 +01:00
gpio-siox.c gpio: siox: use raw spinlock for irq related locking 2020-02-21 14:51:56 +01:00
gpio-sodaville.c gpio: sodaville: Convert to use SPDX identifier 2018-12-07 17:34:08 +02:00
gpio-spear-spics.c drivers: gpio: spear-spics: use devm_platform_ioremap_resource() 2019-04-05 00:04:27 +07:00
gpio-sprd.c gpio: Remove dev_err() usage after platform_get_irq() 2019-08-05 13:25:34 +02:00
gpio-sta2x11.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333 2019-06-05 17:37:06 +02:00
gpio-stmpe.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-stp-xway.c Bulk GPIO changes for the v5.3 kernel cycle: 2019-07-09 09:07:00 -07:00
gpio-syscon.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
gpio-tb10x.c gpio: remove unneeded MODULE_VERSION() usage 2019-12-12 17:09:50 +01:00
gpio-tc3589x.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-tegra.c gpio: tegra: Use NOIRQ phase for suspend/resume 2019-12-20 10:58:23 +01:00
gpio-tegra186.c gpio: tegra186: Add Tegra194 pin ranges for GG.0 and GG.1 2020-03-27 11:38:21 +01:00
gpio-thunderx.c gpio: thunderx: Switch to GPIOLIB_IRQCHIP 2020-01-15 11:18:29 +01:00
gpio-timberdale.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 176 2019-05-30 11:29:19 -07:00
gpio-tpic2810.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-tps6586x.c
gpio-tps65086.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-tps65218.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 111 2019-05-24 17:39:01 +02:00
gpio-tps65910.c
gpio-tps65912.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-tps68470.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-tqmx86.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-ts4800.c drivers: gpio: ts4800: use devm_platform_ioremap_resource() 2019-04-05 00:04:28 +07:00
gpio-ts4900.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-ts5500.c
gpio-twl4030.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-twl6040.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-ucb1400.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
gpio-uniphier.c gpio: uniphier: Replace zero-length array with flexible-array member 2020-03-02 08:52:55 +01:00
gpio-vf610.c gpio: vf610: Pass irqchip when adding gpiochip 2019-08-23 09:41:18 +02:00
gpio-viperboard.c gpio: viperboard: Replace 'unsigned' with 'unsigned int' 2019-08-05 11:26:58 +02:00
gpio-vr41xx.c gpio: vr41xx: Use devm_platform_ioremap_resource() 2019-06-27 15:56:51 +01:00
gpio-vx855.c gpio: vx855: fixed a typo 2020-01-15 13:45:01 +01:00
gpio-wcd934x.c gpio: wcd934x: Fix logic of wcd_gpio_get 2020-02-10 10:50:58 +01:00
gpio-wcove.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-winbond.c
gpio-wm831x.c
gpio-wm8350.c
gpio-wm8994.c
gpio-ws16c48.c gpio: ws16c48: utilize for_each_set_clump8 macro 2019-12-04 19:44:12 -08:00
gpio-xgene-sb.c gpio: xgene-sb: set valid IRQ type in to_irq() 2020-04-14 16:15:55 +02:00
gpio-xgene.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-xgs-iproc.c This is the bulk of pin control changes for the v5.6 kernel cycle: 2020-01-29 09:51:36 -08:00
gpio-xilinx.c gpio: xilinx: Fix bug where the wrong GPIO register is written to 2020-02-10 12:52:34 +01:00
gpio-xlp.c gpio: xlp: Pass irqchip when adding gpiochip 2019-08-15 09:55:07 +02:00
gpio-xra1403.c gpio: Use new GPIO_LINE_DIRECTION 2019-11-07 09:27:48 +01:00
gpio-xtensa.c gpio: xtensa: fix driver build 2019-12-09 10:40:18 +01:00
gpio-zevio.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
gpio-zx.c gpio: Unconditionally assign .request()/.free() 2020-04-02 09:16:06 +02:00
gpio-zynq.c gpio: zynq: Fix for bug in zynq_gpio_restore_context API 2020-01-07 11:24:44 +01:00
gpiolib-acpi.c gpiolib: acpi: Add quirk to ignore EC wakeups on HP x2 10 CHT + AXP288 model 2020-03-24 10:06:54 +01:00
gpiolib-acpi.h gpiolib: acpi: make acpi_can_fallback_to_crs() static 2019-09-10 11:34:20 +01:00
gpiolib-devprop.c gpiolib: devprop: Warn if gpio-line-names is too long 2020-04-24 09:10:01 +02:00
gpiolib-devres.c gpio: Move devres calls to devres file 2020-03-20 10:23:06 +01:00
gpiolib-legacy.c
gpiolib-of.c gpiolib: of: improve gpiolib-of support of pull up/down on expanders 2020-04-15 13:20:00 +02:00
gpiolib-of.h gpio: of: Add DT overlay support for GPIO hogs 2020-02-21 17:10:33 +01:00
gpiolib-sysfs.c gpiolib: Add GPIOCHIP_NAME definition 2019-12-12 11:36:13 +01:00
gpiolib.c This is the bulk of GPIO development for the v5.7 kernel cycle. 2020-04-04 10:27:00 -07:00
gpiolib.h gpio: of: Add DT overlay support for GPIO hogs 2020-02-21 17:10:33 +01:00
Kconfig gpio: pl061: Support building as module 2020-04-14 16:23:46 +02:00
Makefile gpio: add driver for Mellanox BlueField 2 GPIO controller 2020-03-09 09:47:50 +01:00
TODO gpio: Extend TODO to cover code duplication avoidance 2020-04-14 16:15:55 +02:00