openwrt/target/linux/bcm27xx/patches-6.6/950-1082-pinctrl-rp1-Use-persist_gpio_outputs.patch

47 lines
1.6 KiB
Diff
Raw Normal View History

From f87840e805569bf6b072c389968a65b1ae1676ef Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Tue, 7 May 2024 13:33:48 +0100
Subject: [PATCH 1082/1085] pinctrl: rp1: Use persist_gpio_outputs
Following 8ff05989b44e1a8f7d2bbe67320990ebc2fbb5e5, adopt the same
parameter name but with the opposite default.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/pinctrl/pinctrl-rp1.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
--- a/drivers/pinctrl/pinctrl-rp1.c
+++ b/drivers/pinctrl/pinctrl-rp1.c
@@ -573,9 +573,9 @@ 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 bool persist_gpio_outputs = true;
+module_param(persist_gpio_outputs, bool, 0644);
+MODULE_PARM_DESC(persist_gpio_outputs, "Enable GPIO_OUT persistence when pin is freed");
static int rp1_pinconf_set(struct pinctrl_dev *pctldev,
unsigned int offset, unsigned long *configs,
@@ -1205,11 +1205,12 @@ 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, 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);
- }
+ /* Return all pins to GPIO_IN, unless persist_gpio_outputs is set */
+ if (persist_gpio_outputs && fsel == RP1_FSEL_GPIO)
+ return 0;
+
+ rp1_set_dir(pin, RP1_DIR_INPUT);
+ rp1_set_fsel(pin, RP1_FSEL_GPIO);
return 0;
}