From owner-freebsd-hackers@FreeBSD.ORG Tue May 13 10:18:20 2014 Return-Path: Delivered-To: freebsd-hackers@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 95C1E642 for ; Tue, 13 May 2014 10:18:20 +0000 (UTC) Received: from mail-wi0-x22b.google.com (mail-wi0-x22b.google.com [IPv6:2a00:1450:400c:c05::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 32BA725CB for ; Tue, 13 May 2014 10:18:20 +0000 (UTC) Received: by mail-wi0-f171.google.com with SMTP id hm4so5939097wib.16 for ; Tue, 13 May 2014 03:18:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=YCEgnFuwy6XreRcfgNJRxLOJZb6GTCEgXwsh4ELXOKI=; b=UVKNDTf7o3llSu9COsJymnSxzZ3dXufYRmsvVMBl+urYwvf0Yz7alcZ85FE60lGvsZ utjJgOybKWnpSe0RzIjqJyVu/q1rc2L/YfTnhcHkypKhqIbNgftksHNuF/3O+k52UDSk c8KalTfI959YyP/mBe1YzD+ah0L9r3IRG2bwOTQZIE0tyxltdTTwF/466QvzBwWMmwkJ PvsCbXcNETxRIOQGi8oEbQroSTmhf/xLBkEjUVKkMsiaLzHHYLNLSM1wSEN5esDj7ZMx jp9agUTfOY3VPyZ5ms/97tgDdrc9Sq/HaL+R3WPydRq6f4mvdNPLrbiEli9CcYH5vMfm QFWQ== X-Received: by 10.180.11.137 with SMTP id q9mr20637609wib.13.1399976298538; Tue, 13 May 2014 03:18:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.163.231 with HTTP; Tue, 13 May 2014 03:17:58 -0700 (PDT) In-Reply-To: <20140513084008.GA71115@machdep.com> References: <20140513084008.GA71115@machdep.com> From: Maxim Ignatenko Date: Tue, 13 May 2014 11:17:58 +0100 Message-ID: Subject: Re: Keyboard drivers, polling vs. non-polling mode To: Ruslan Bukin Content-Type: text/plain; charset=UTF-8 Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 May 2014 10:18:20 -0000 On 13 May 2014 09:40, Ruslan Bukin wrote: > On Sun, May 11, 2014 at 11:33:42PM +0100, Maxim Ignatenko wrote: >> Hello, >> >> I'm trying trying to get keyboard working in DDB on HP Chromebook 11 (ARM). >> br@ said that it doesn't work there because polling mode is not implemented yet. >> Where can I read about the difference between polling and non-polling >> modes (and about keyboard drivers in general)? >> sys/dev/kbd/kbdreg.h describes some structures and method signatures, >> but I have no clue what is the expected behaviour of those methods. >> >> My current guess is that in polling mode keyboard driver just queues >> up all the input coming from keyboard and then gives it to consumer >> upon request, while in non-polling mode it invokes some callback >> instead of queueing. But I cannot find any documentation to confirm or >> disprove that. >> > > Chrome Embedded Controller (EC) provides interrupt (KB_GPIO_INT pin, active low) > reporting that there are pending data and you need to read the data using > ec_command(..). After all data was read, pin comes to 1 (not active). > > We have no interrupts in KDB, so you have to check pin status manually and > if status == 0 (active) then read new data. > > Probably you can start with patch attached (I did't tested). Thanks, I've tried something like that, except with invoking ec_command immediately and comparing returned state to previous one rather than reading status bit from GPIO pin. I keep getting "fdb0: i2c transfer returned 6" and none of the printfs I've added to iicbus_transfer_gen in sys/dev/iicbus/iiconf.c. -- Best regards, Maxim