Author: kevans
Date: Tue Dec  5 21:40:52 2017
New Revision: 326595
URL: https://svnweb.freebsd.org/changeset/base/326595

Log:
  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

Modified:
  head/sys/arm/allwinner/a10_gpio.c

Modified: head/sys/arm/allwinner/a10_gpio.c
==============================================================================
--- head/sys/arm/allwinner/a10_gpio.c   Tue Dec  5 21:38:24 2017        
(r326594)
+++ head/sys/arm/allwinner/a10_gpio.c   Tue Dec  5 21:40:52 2017        
(r326595)
@@ -353,7 +353,8 @@ a10_gpio_pin_configure(struct a10_gpio_softc *sc, uint
        /* 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) {
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to