Skip to content

Commit 23c5144

Browse files
asmellbykartben
authored andcommitted
drivers: pinctrl: silabs: Fix pin deallocation from digital bus
Fix the scenario where a pinctrl node intends to deallocate a pin from a peripheral. If the GPIO mode is disabled the DBUS route should be cleared, not set. This allows reuse of a pin for other purposes when a driver is suspended and the pinctrl sleep state is applied, as GPIOs are typically disabled in the sleep state. Signed-off-by: Aksel Skauge Mellbye <[email protected]>
1 parent 9282dca commit 23c5144

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/pinctrl/pinctrl_silabs_dbus.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintp
4040
sys_write32(pins[i].port | FIELD_PREP(PIN_MASK, pins[i].pin), route_reg);
4141

4242
if (pins[i].en_bit != SILABS_PINCTRL_UNUSED) {
43-
sys_set_bit(enable_reg, pins[i].en_bit);
43+
if (pins[i].mode == gpioModeDisabled) {
44+
sys_clear_bit(enable_reg, pins[i].en_bit);
45+
} else {
46+
sys_set_bit(enable_reg, pins[i].en_bit);
47+
}
4448
}
4549
}
4650

0 commit comments

Comments
 (0)