svn commit: r326595 - head/sys/arm/allwinner

Kyle Evans kevans at FreeBSD.org
Tue Dec 5 21:40:53 UTC 2017


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) {


More information about the svn-src-all mailing list