@@ -573,9 +573,9 @@ 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" );
576+ static bool persist_gpio_outputs = true ;
577+ module_param (persist_gpio_outputs , bool , 0644 );
578+ MODULE_PARM_DESC (persist_gpio_outputs , "Enable GPIO_OUT persistence when pin is freed" );
579579
580580static int rp1_pinconf_set (struct pinctrl_dev * pctldev ,
581581 unsigned int offset , unsigned long * configs ,
@@ -1205,11 +1205,12 @@ static int rp1_pmx_free(struct pinctrl_dev *pctldev, unsigned offset)
12051205 struct rp1_pin_info * pin = rp1_get_pin_pctl (pctldev , offset );
12061206 u32 fsel = rp1_get_fsel (pin );
12071207
1208- /* Return non-GPIOs to GPIO_IN, unless strict_gpiod is set */
1209- if (strict_gpiod || fsel != RP1_FSEL_GPIO ) {
1210- rp1_set_dir (pin , RP1_DIR_INPUT );
1211- rp1_set_fsel (pin , RP1_FSEL_GPIO );
1212- }
1208+ /* Return all pins to GPIO_IN, unless persist_gpio_outputs is set */
1209+ if (persist_gpio_outputs && fsel == RP1_FSEL_GPIO )
1210+ return 0 ;
1211+
1212+ rp1_set_dir (pin , RP1_DIR_INPUT );
1213+ rp1_set_fsel (pin , RP1_FSEL_GPIO );
12131214
12141215 return 0 ;
12151216}
0 commit comments