HomeFreeBSD

arm64: rockchip: rk_gpio: Improve mode switching

Description

arm64: rockchip: rk_gpio: Improve mode switching

Changing mode on a pin (input/output/pullup/pulldown) is a bit slow.
Improve this by caching what we can.
We need to check if the pin is in gpio mode, do that the first time
that we have a request for this pin and cache the result. We can't do
that at attach as we are a child of rk_pinctrl and it didn't finished
its attach then.
Cache also the flags specific to the pinctrl (pullup or pulldown) if the
pin is in input mode.
Cache the registers that deals with input/output mode and output value. Also
remove some register reads when we change the direction of a pin or when we
change the output value since the bit changed in the registers only affect output
pins.

(cherry picked from commit 87f642ac03e3cefea7048cb46b17810d01e97dd5)

Details

Provenance
manuAuthored on Sep 22 2021, 2:55 PM
Parents
rGe5624479d191: arm64: rockchip: pinctrl: Do not rely on the node name
Branches
Unknown
Tags
Unknown