Skip to content

Commit 3668014

Browse files
committed
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 <[email protected]>
1 parent ff02855 commit 3668014

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/pinctrl/pinctrl-rp1.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,10 @@ static const char * const irq_type_names[] = {
573573
[IRQ_TYPE_LEVEL_LOW] = "level-low",
574574
};
575575

576+
static bool strict_gpiod;
577+
module_param(strict_gpiod, bool, 0644);
578+
MODULE_PARM_DESC(strict_gpiod, "unless true, outputs remain outputs when freed");
579+
576580
static int rp1_pinconf_set(struct pinctrl_dev *pctldev,
577581
unsigned int offset, unsigned long *configs,
578582
unsigned int num_configs);
@@ -1201,8 +1205,9 @@ static int rp1_pmx_free(struct pinctrl_dev *pctldev, unsigned offset)
12011205
struct rp1_pin_info *pin = rp1_get_pin_pctl(pctldev, offset);
12021206
u32 fsel = rp1_get_fsel(pin);
12031207

1204-
/* Return non-GPIOs to GPIO_IN */
1205-
if (fsel != RP1_FSEL_GPIO) {
1208+
/* Return non-GPIOs to GPIO_IN, unless strict_gpiod is set */
1209+
pr_err("%s(%d) - strict_gpiod %d\n", __func__, offset, strict_gpiod);
1210+
if (strict_gpiod || fsel != RP1_FSEL_GPIO) {
12061211
rp1_set_dir(pin, RP1_DIR_INPUT);
12071212
rp1_set_fsel(pin, RP1_FSEL_GPIO);
12081213
}

0 commit comments

Comments
 (0)