Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/gpio When reading the bits from the I2C bus, also re...
details: https://anonhg.NetBSD.org/src/rev/20855b69bd17
branches: trunk
changeset: 767581:20855b69bd17
user: mbalmer <mbalmer%NetBSD.org@localhost>
date: Sat Jul 23 09:03:38 2011 +0000
description:
When reading the bits from the I2C bus, also report SCL. Fixes PR43275.
Fix originally from Maxim Weber, thanks.
diffstat:
sys/dev/gpio/gpioiic.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diffs (35 lines):
diff -r f08e09010258 -r 20855b69bd17 sys/dev/gpio/gpioiic.c
--- a/sys/dev/gpio/gpioiic.c Sat Jul 23 07:17:34 2011 +0000
+++ b/sys/dev/gpio/gpioiic.c Sat Jul 23 09:03:38 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gpioiic.c,v 1.2 2009/12/06 22:33:44 dyoung Exp $ */
+/* $NetBSD: gpioiic.c,v 1.3 2011/07/23 09:03:38 mbalmer Exp $ */
/* $OpenBSD: gpioiic.c,v 1.8 2008/11/24 12:12:12 mbalmer Exp $ */
/*
@@ -18,7 +18,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gpioiic.c,v 1.2 2009/12/06 22:33:44 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpioiic.c,v 1.3 2011/07/23 09:03:38 mbalmer Exp $");
/*
* I2C bus bit-banging through GPIO pins.
@@ -295,7 +295,14 @@
gpioiic_bb_read_bits(void *cookie)
{
struct gpioiic_softc *sc = cookie;
+ u_int32_t bits = 0;
- return gpio_pin_read(sc->sc_gpio, &sc->sc_map,
- GPIOIIC_PIN_SDA) == GPIO_PIN_HIGH ? GPIOIIC_SDA : 0;
+ if (gpio_pin_read(sc->sc_gpio, &sc->sc_map,
+ GPIOIIC_PIN_SDA) == GPIO_PIN_HIGH)
+ bits |= GPIOIIC_SDA;
+ if (gpio_pin_read(sc->sc_gpio, &sc->sc_map,
+ GPIOIIC_PIN_SCL) == GPIO_PIN_HIGH)
+ bits |= GPIOIIC_SCL;
+
+ return bits;
}
Home |
Main Index |
Thread Index |
Old Index