Skip to contentSkip to conversation

i2c: at91: Restore pinctrl state if can't get scl/sda gpios

PATCH In review Codrin Ciubotariu 2 participants 2 messages May 13, 2020 – May 15, 2020

Subsystems (3)
lore
Share & tools
lore

Codrin Ciubotariu

author maintainer
#0 lore raw

PATCH 1/1 i2c: at91: Restore pinctrl state if can't get scl/sda gpios

If there is a strict pinmux or if simply the scl/sda gpios are missing, the pins will remain in gpio mode, compromizing the I2C bus. Change to the default state of the pins before returning the error.

Fixes a53acc7ebf27 ("i2c: at91: Fix pinmux after devm_gpiod_get() for bus recovery")
---
 drivers/i2c/busses/i2c-at91-master.c | 1 +
 1 file changed, 1 insertion(+)
drivers/i2c/busses/i2c-at91-master.c +1 -0
index d4a3aef4a594..363d540a8345 100644
@@ -877,6 +877,7 @@ static int at91_init_twi_recovery_gpio(struct platform_device *pdev,
 			gpiod_put(rinfo->scl_gpiod);
 			rinfo->scl_gpiod = NULL;
 		}
+		pinctrl_select_state(dev->pinctrl, dev->pinctrl_pins_default);
 		return -EINVAL;
 	}
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 6 lines · Codrin Ciubotariu

If there is a strict pinmux or if simply the scl/sda gpios are missing, the pins will remain in gpio mode, compromizing the I2C bus. Change to the default state of the pins before returning the error.

Fixes a53acc7ebf27 ("i2c: at91: Fix pinmux after devm_gpiod_get() for bus recovery")

I squashed it into the other patch and applied it to for-current, thanks!