Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 May 2014 06:15:45 +0000 (UTC)
From:      Ruslan Bukin <br@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r266787 - head/sys/arm/samsung/exynos
Message-ID:  <201405280615.s4S6FjbZ071392@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: br
Date: Wed May 28 06:15:45 2014
New Revision: 266787
URL: http://svnweb.freebsd.org/changeset/base/266787

Log:
  Add simple polling mechanism that works for KDB.
  
  Submitted by:	Maxim Ignatenko <gelraen.ua@gmail.com>

Modified:
  head/sys/arm/samsung/exynos/chrome_kb.c

Modified: head/sys/arm/samsung/exynos/chrome_kb.c
==============================================================================
--- head/sys/arm/samsung/exynos/chrome_kb.c	Wed May 28 06:11:16 2014	(r266786)
+++ head/sys/arm/samsung/exynos/chrome_kb.c	Wed May 28 06:15:45 2014	(r266787)
@@ -131,6 +131,7 @@ struct ckb_softc {
 	int			rows;
 	int			cols;
 	device_t		dev;
+	device_t		gpio_dev;
 	struct thread		*sc_poll_thread;
 
 	uint8_t			*scan_local;
@@ -331,6 +332,7 @@ ckb_read_char_locked(keyboard_t *kbd, in
 	uint16_t key;
 	int oldbit;
 	int newbit;
+	int status;
 
 	sc = kbd->kb_data;
 
@@ -347,7 +349,20 @@ ckb_read_char_locked(keyboard_t *kbd, in
 	};
 
 	if (sc->sc_flags & CKB_FLAG_POLLING) {
-		/* TODO */
+		for (;;) {
+			GPIO_PIN_GET(sc->gpio_dev, KB_GPIO_INT, &status);
+			if (status == 0) {
+				if (ec_command(EC_CMD_MKBP_STATE, sc->scan, sc->cols,
+				    sc->scan, sc->cols)) {
+					return (NOKEY);
+				}
+				break;
+			}
+			if (!wait) {
+				return (NOKEY);
+			}
+			DELAY(1000);
+		}
 	};
 
 	for (i = 0; i < sc->cols; i++) {
@@ -710,6 +725,12 @@ chrome_kb_attach(device_t dev)
 	if ((error = parse_dts(sc)) != 0)
 		return error;
 
+	sc->gpio_dev = devclass_get_device(devclass_find("gpio"), 0);
+	if (sc->gpio_dev == NULL) {
+		device_printf(sc->dev, "Can't find gpio device.\n");
+		return (ENXIO);
+	}
+
 #if 0
 	device_printf(sc->dev, "Keyboard matrix [%dx%d]\n",
 	    sc->cols, sc->rows);



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