pinctrl-tegra: Restore SFSEL bit when freeing pins
authorPrathamesh Shete <pshete@nvidia.com>
Wed, 5 Mar 2025 10:49:39 +0000 (16:19 +0530)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 14 Mar 2025 10:03:49 +0000 (11:03 +0100)
commitc12bfa0fee65940b10ff5187349f76c6f6b1df9c
treeb6451fe4535d95b917fcf29d17b3526c9050a9fb
parent4fd41e74bd6ad87085001b0f3e2883422fab499a
pinctrl-tegra: Restore SFSEL bit when freeing pins

Each pin can be configured as a Special Function IO (SFIO) or GPIO,
where the SFIO enables the pin to operate in alternative modes such as
I2C, SPI, etc.

The current implementation sets all the pins back to SFIO mode
even if they were initially in GPIO mode. This can cause glitches
on the pins when pinctrl_gpio_free() is called.

Avoid these undesired glitches by storing the pin's SFIO/GPIO
state on GPIO request and restoring it on GPIO free.

Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
Link: https://lore.kernel.org/20250305104939.15168-2-pshete@nvidia.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/tegra/pinctrl-tegra.c
drivers/pinctrl/tegra/pinctrl-tegra.h