forked from Openwrt/openwrt
8c405cdccc
The patches were generated from the RPi repo with the following command: git format-patch v6.6.34..rpi-6.1.y Some patches needed rebasing and, as usual, the applied and reverted, wireless drivers, Github workflows, READMEs and defconfigs patches were removed. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
39 lines
1.4 KiB
Diff
39 lines
1.4 KiB
Diff
From ddceddec2cedffd4af0e54dec3ab54843b1d5894 Mon Sep 17 00:00:00 2001
|
|
From: Phil Elwell <phil@raspberrypi.com>
|
|
Date: Fri, 19 Apr 2024 15:00:52 +0100
|
|
Subject: [PATCH 1043/1085] pinctrl: rp1: Add strict_gpiod module parameter
|
|
|
|
Setting strict_gpiod to Y makes libgpiod and the gpiod utilities behave
|
|
as documented, i.e. pins are returned to being GPIO inputs when they are
|
|
released.
|
|
|
|
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
|
|
---
|
|
drivers/pinctrl/pinctrl-rp1.c | 8 ++++++--
|
|
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
|
--- a/drivers/pinctrl/pinctrl-rp1.c
|
|
+++ b/drivers/pinctrl/pinctrl-rp1.c
|
|
@@ -573,6 +573,10 @@ static const char * const irq_type_names
|
|
[IRQ_TYPE_LEVEL_LOW] = "level-low",
|
|
};
|
|
|
|
+static bool strict_gpiod;
|
|
+module_param(strict_gpiod, bool, 0644);
|
|
+MODULE_PARM_DESC(strict_gpiod, "unless true, outputs remain outputs when freed");
|
|
+
|
|
static int rp1_pinconf_set(struct pinctrl_dev *pctldev,
|
|
unsigned int offset, unsigned long *configs,
|
|
unsigned int num_configs);
|
|
@@ -1201,8 +1205,8 @@ static int rp1_pmx_free(struct pinctrl_d
|
|
struct rp1_pin_info *pin = rp1_get_pin_pctl(pctldev, offset);
|
|
u32 fsel = rp1_get_fsel(pin);
|
|
|
|
- /* Return non-GPIOs to GPIO_IN */
|
|
- if (fsel != RP1_FSEL_GPIO) {
|
|
+ /* Return non-GPIOs to GPIO_IN, unless strict_gpiod is set */
|
|
+ if (strict_gpiod || fsel != RP1_FSEL_GPIO) {
|
|
rp1_set_dir(pin, RP1_DIR_INPUT);
|
|
rp1_set_fsel(pin, RP1_FSEL_GPIO);
|
|
}
|