pinctrl: bcm2835: Make pin freeing behavior configurable
authorStefan Wahren <wahrenst@gmx.net>
Fri, 3 May 2024 06:27:45 +0000 (08:27 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 6 May 2024 06:14:01 +0000 (08:14 +0200)
commit8ff05989b44e1a8f7d2bbe67320990ebc2fbb5e5
tree0c2b02adf784d5c602479e0c01b3454926a9cd4b
parent4ad4f6e2fd0a44e0aa03c7f220ac79abfe866fbf
pinctrl: bcm2835: Make pin freeing behavior configurable

Until now after a bcm2835 pin was freed its pinmux was set to GPIO_IN.
So in case it was configured as GPIO_OUT before the configured output
level also get lost. As long as GPIO sysfs was used this wasn't
actually a problem because the pins and their possible output level
were kept by sysfs.

Since more and more Raspberry Pi users start using libgpiod they are
confused about this behavior. So make the pin freeing behavior of
GPIO_OUT configurable via module parameter. In case
pinctrl-bcm2835.persist_gpio_outputs is set to 1, the output level is
kept.

This patch based on the downstream work of Phil Elwell.

Link: https://github.com/raspberrypi/linux/pull/6117
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Message-ID: <20240503062745.11298-1-wahrenst@gmx.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/bcm/pinctrl-bcm2835.c