Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Jun 2019 20:21:34 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r349214 - stable/11/sys/dev/amdgpio
Message-ID:  <201906192021.x5JKLYdv046637@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Wed Jun 19 20:21:34 2019
New Revision: 349214
URL: https://svnweb.freebsd.org/changeset/base/349214

Log:
  MFC r348228: amdgpio: fix reading status of input pins

Modified:
  stable/11/sys/dev/amdgpio/amdgpio.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/amdgpio/amdgpio.c
==============================================================================
--- stable/11/sys/dev/amdgpio/amdgpio.c	Wed Jun 19 20:20:02 2019	(r349213)
+++ stable/11/sys/dev/amdgpio/amdgpio.c	Wed Jun 19 20:21:34 2019	(r349214)
@@ -264,10 +264,17 @@ amdgpio_pin_get(device_t dev, uint32_t pin, unsigned i
 	reg = AMDGPIO_PIN_REGISTER(pin);
 	val = amdgpio_read_4(sc, reg);
 
-	if (val & BIT(OUTPUT_VALUE_OFF))
-		*value = GPIO_PIN_HIGH;
-	else
-		*value = GPIO_PIN_LOW;
+	if ((sc->sc_gpio_pins[pin].gp_flags & GPIO_PIN_OUTPUT) != 0) {
+		if (val & BIT(OUTPUT_VALUE_OFF))
+			*value = GPIO_PIN_HIGH;
+		else
+			*value = GPIO_PIN_LOW;
+	} else {
+		if (val & BIT(PIN_STS_OFF))
+			*value = GPIO_PIN_HIGH;
+		else
+			*value = GPIO_PIN_LOW;
+	}
 
 	dprintf("pin %d value 0x%x\n", pin, *value);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906192021.x5JKLYdv046637>