]> git.baikalelectronics.ru Git - kernel.git/commit
gpio: pca953x: hack to fix 24 bit gpio expanders
authorH. Nikolaus Schaller <hns@goldelico.com>
Tue, 4 Jun 2019 12:35:58 +0000 (14:35 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 7 Jun 2019 22:03:18 +0000 (00:03 +0200)
commitb5e6c49812d1baef66b577d693e6e419b5b927e0
tree8dfdd0941d277e7a9ec9480029d8343c2b8da710
parent31750888ad4ce9d2a30f744c4c2ab30aee07f569
gpio: pca953x: hack to fix 24 bit gpio expanders

24 bit expanders use REG_ADDR_AI in combination with register addressing. This
conflicts with regmap which takes this bit as part of the register number,
i.e. a second cache entry is defined for accessed with REG_ADDR_AI being
set although on the chip it is the same register as with REG_ADDR_AI being
cleared.

The problem was introduced by

commit 6ec8ba81815c ("gpio: pca953x: Extract the register address mangling to single function")

but only became visible by

commit 2d1bf18b54d4 ("regmap: verify if register is writeable before writing operations")

because before, the regmap size was effectively ignored and
pca953x_writeable_register() did know to ignore REG_ADDR_AI. Still, there
were two separate cache entries created.

Since the use of REG_ADDR_AI seems to be static we can work around this
issue by simply increasing the size of the regmap to cover the "virtual"
registers with REG_ADDR_AI being set. This only means that half of the
regmap buffer will be unused.

Reported-by: H. Nikolaus Schaller <hns@goldelico.com>
Suggested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-pca953x.c