From patchwork Tue Nov 9 02:45:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jooaun X-Patchwork-Id: 310052 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oA92jwGe003342 for ; Tue, 9 Nov 2010 02:45:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754877Ab0KICp6 (ORCPT ); Mon, 8 Nov 2010 21:45:58 -0500 Received: from mail-gx0-f174.google.com ([209.85.161.174]:59232 "EHLO mail-gx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754722Ab0KICp5 (ORCPT ); Mon, 8 Nov 2010 21:45:57 -0500 Received: by gxk23 with SMTP id 23so3945227gxk.19 for ; Mon, 08 Nov 2010 18:45:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=0dUeqe+upRYbqe7gctDSfqwPeFEJTHShOHX0t7yf3RI=; b=hLy8RKxdueFMAZ6brQ/m30tAm5xNfOgBRky9xkuRpN3WY3dAMikjmCgyeHiRkoDk0t tsm/WmvBxiMVjMNN9PToF5XL9LHTEisv8UOutPKCX+SR5FrEe450bPKsUlTH48JPoCC6 JOEiAehCwIanu9w5HGqZ23v2gJOiqzZ6K3XRQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=DN5a5LP0XKuyd6AjwvGx6nom6c9eAMJsb8s06CRf8kiamqKR19ni1Z4kx2iIhu7Dm1 hndaoVh71vwncIoWkw90SFdheciqqvSLG18BUHy1ia4aBokrEYZmTzy0V1o+uVgcNawJ xn2dt1uXjmkY3eE4q07XGrDJumCTV18MIJJwE= Received: by 10.150.53.11 with SMTP id b11mr9801067yba.329.1289270757161; Mon, 08 Nov 2010 18:45:57 -0800 (PST) Received: from localhost.localdomain (203-206-227-95.perm.iinet.net.au [203.206.227.95]) by mx.google.com with ESMTPS id v12sm467867ybk.23.2010.11.08.18.45.54 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 08 Nov 2010 18:45:56 -0800 (PST) From: jooaun To: dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org, raphaelpereira@gmail.com, jooaun Subject: [PATCH 6/8] qt2160: only read device when Change pin is active Date: Tue, 9 Nov 2010 13:45:38 +1100 Message-Id: <1289270738-4297-1-git-send-email-jasaw81@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1289268911-32322-6-git-send-email-jasaw81@gmail.com> References: <1289268911-32322-6-git-send-email-jasaw81@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 09 Nov 2010 02:45:59 +0000 (UTC) diff --git a/drivers/input/keyboard/qt2160.c b/drivers/input/keyboard/qt2160.c index 7647849..8316fde 100755 --- a/drivers/input/keyboard/qt2160.c +++ b/drivers/input/keyboard/qt2160.c @@ -213,6 +213,12 @@ static irqreturn_t qt2160_irq(int irq, void *_qt2160) struct qt2160_data *qt2160 = _qt2160; unsigned long flags; + if (qt2160->hw_info->getchange) { + /* if change is not active, no IRQ to service */ + if (qt2160->hw_info->getchange(qt2160->hw_info->data) > 0) + return IRQ_HANDLED; + } + spin_lock_irqsave(&qt2160->lock, flags); __cancel_delayed_work(&qt2160->dwork); @@ -225,6 +231,12 @@ static irqreturn_t qt2160_irq(int irq, void *_qt2160) static void qt2160_schedule_read(struct qt2160_data *qt2160) { + if (qt2160->hw_info->getchange) { + /* if change is not active, no need to read device */ + if (qt2160->hw_info->getchange(qt2160->hw_info->data) > 0) + return; + } + spin_lock_irq(&qt2160->lock); schedule_delayed_work(&qt2160->dwork, QT2160_CYCLE_INTERVAL); spin_unlock_irq(&qt2160->lock); diff --git a/include/linux/input/qt2160.h b/include/linux/input/qt2160.h index 8a1913f..4eb7e18 100755 --- a/include/linux/input/qt2160.h +++ b/include/linux/input/qt2160.h @@ -7,6 +7,9 @@ /** * struct qt2160_info - defines the chip configuration + * @data: private data for lowlevel IO abstraction routines + * @getchange: return 0 when CHANGE pin is active/low; return 1 when CHANGE pin + * is deactivated/high * @slider_length: number of keys to use as slider, max 8 keys, min 2 keys * @slider_axis: absolute axis type, value 0 is ABS_X * @keycodes: key codes for keys that are part of the slider are ignored; slider @@ -20,6 +23,8 @@ * sleep 16ms longer before detecting a touch (slower response); max 255 */ struct qt2160_info { + void *data; + int (*getchange) (void *data); unsigned char slider_length; unsigned int slider_axis; unsigned short keycodes[QT2160_MAXKEYS];