pinctrl: meson: fix drive strength register and bit calculation
authorHyeonki Hong <hhk7734@gmail.com>
Thu, 18 Jun 2020 02:59:22 +0000 (11:59 +0900)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 7 Jul 2020 11:15:11 +0000 (13:15 +0200)
commitf088ab6d4f4ce49d422c220074b7e605f54e2299
tree5694e890218aa616f8168eef48b8fbbeb7beb6d8
parentbc6d201591344aa21d616179ee9ad406a7336267
pinctrl: meson: fix drive strength register and bit calculation

If a GPIO bank has greater than 16 pins, PAD_DS_REG is split into two
or more registers. However, when register and bit were calculated, the
first register defined in the bank was used, and the bit was calculated
based on the first pin. This causes problems in setting the driving
strength.

The following method was used to solve this problem:
A bit is calculated first using predefined strides. Then, If the bit is
32 or more, the register is changed by the quotient of the bit divided
by 32. And the bit is set to the remainder.

Signed-off-by: Hyeonki Hong <hhk7734@gmail.com>
Link: https://lore.kernel.org/r/20200618025916.GA19368@home-desktop
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/meson/pinctrl-meson.c