a10_gpio: Don't do read/set dance if pin is already configured for output

This fixes some regulator issues with a83t/BananaPi-M3; the pin value was
getting clobbered as we reconfigured the pin when initializing the
regulator.

Discussed with:	ian
This commit is contained in:
Kyle Evans 2017-12-05 21:40:52 +00:00
parent 09d8a81a0c
commit 4c7626db9f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326595

View File

@ -353,7 +353,8 @@ a10_gpio_pin_configure(struct a10_gpio_softc *sc, uint32_t pin, uint32_t flags)
/* Manage input/output. */
if (flags & GPIO_PIN_INPUT) {
err = a10_gpio_set_function(sc, pin, A10_GPIO_INPUT);
} else if (flags & GPIO_PIN_OUTPUT) {
} else if ((flags & GPIO_PIN_OUTPUT) &&
a10_gpio_get_function(sc, pin) != A10_GPIO_OUTPUT) {
if (flags & GPIO_PIN_PRESET_LOW) {
a10_gpio_pin_set_locked(sc, pin, 0);
} else if (flags & GPIO_PIN_PRESET_HIGH) {