From owner-svn-src-head@FreeBSD.ORG Wed May 28 06:15:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BA69DF88; Wed, 28 May 2014 06:15:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8B5A2FC1; Wed, 28 May 2014 06:15:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4S6Fjsi071393; Wed, 28 May 2014 06:15:45 GMT (envelope-from br@svn.freebsd.org) Received: (from br@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4S6FjbZ071392; Wed, 28 May 2014 06:15:45 GMT (envelope-from br@svn.freebsd.org) Message-Id: <201405280615.s4S6FjbZ071392@svn.freebsd.org> From: Ruslan Bukin Date: Wed, 28 May 2014 06:15:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r266787 - head/sys/arm/samsung/exynos X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 May 2014 06:15:45 -0000 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 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);