From patchwork Tue Nov 9 02:15:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jooaun X-Patchwork-Id: 309962 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 oA92G8VD031966 for ; Tue, 9 Nov 2010 02:16:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754125Ab0KICP4 (ORCPT ); Mon, 8 Nov 2010 21:15:56 -0500 Received: from mail-gy0-f174.google.com ([209.85.160.174]:49374 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753997Ab0KICPy (ORCPT ); Mon, 8 Nov 2010 21:15:54 -0500 Received: by mail-gy0-f174.google.com with SMTP id 4so3965040gyh.19 for ; Mon, 08 Nov 2010 18:15:54 -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=6aDI6zUkU9JeTrVTHaUVIn6vT1bt2/plMHi4G37ycII=; b=JuI925A2+W2dH9sX8AnpRu0lT+fFK8Vg70+Cxwm3DD5l4OTmkGzqAKPfXvn3CPQrwx eYFUYDs8lDBv9jZ3KP6fkCkYmwKUB6OOJR4wKlboPP6hSmLi/F6FjR/tJqfeNqBmeYJP GTwDukmUSzAxXXLWq/PrYT8XDLjGXwCxKQ9Aw= 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=xKwdAw8CgUf7KcQFQoJKHSAS3fUSgmAuWwQQ3fgUatImm7XoaB/5hLV50WTvwbBmfI FoesfMK5MKkIHNdjBr5bM6sxFS21+Qn5QT8r8g4Jdfh3cPsvjy+EVK12TvB/7Cbn67q4 t1wmlvvEVHHpogATo/shW/Qh0K1sWXXhDe5ME= Received: by 10.150.139.21 with SMTP id m21mr9788615ybd.260.1289268953980; Mon, 08 Nov 2010 18:15:53 -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 j27sm449455yha.30.2010.11.08.18.15.51 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 08 Nov 2010 18:15:53 -0800 (PST) From: jooaun To: dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org, raphaelpereira@gmail.com, jooaun Subject: [PATCH 4/8] qt2160: add configurable power mode Date: Tue, 9 Nov 2010 13:15:07 +1100 Message-Id: <1289268911-32322-4-git-send-email-jasaw81@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1289268911-32322-1-git-send-email-jasaw81@gmail.com> References: <1289268911-32322-1-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:16:09 +0000 (UTC) diff --git a/drivers/input/keyboard/qt2160.c b/drivers/input/keyboard/qt2160.c index 6439e40..0d662e2 100755 --- a/drivers/input/keyboard/qt2160.c +++ b/drivers/input/keyboard/qt2160.c @@ -299,6 +299,15 @@ static int __devinit qt2160_configure_device(struct i2c_client *client, /* perform dummy write to reset I2C state */ i2c_smbus_write_byte(client, QT2160_CMD_CHIPID); + /* setup LP mode */ + if (pdata->low_power_mode) { + error = i2c_smbus_write_byte_data(client, QT2160_CMD_LP_MODE, + pdata->low_power_mode); + if (error) { + dev_err(&client->dev, "could not write power config\n"); + goto config_fault; + } + } /* setup slider control and slider options */ if (pdata->slider_length) { error |= i2c_smbus_write_byte_data( @@ -547,9 +556,13 @@ static int qt2160_suspend(struct i2c_client *client, pm_message_t message) static int qt2160_resume(struct i2c_client *client) { + struct qt2160_data *qt2160 = i2c_get_clientdata(client); + struct qt2160_info *hw_info = qt2160->hw_info; int error; u8 lp_mode_val = QT2160_LP_MODE_DEFAULT_VALUE; + if (hw_info->low_power_mode) + lp_mode_val = hw_info->low_power_mode; error = i2c_smbus_write_byte_data(client, QT2160_CMD_LP_MODE, lp_mode_val); if (error) diff --git a/include/linux/input/qt2160.h b/include/linux/input/qt2160.h index 748c86e..8a1913f 100755 --- a/include/linux/input/qt2160.h +++ b/include/linux/input/qt2160.h @@ -16,6 +16,8 @@ * same aks group; keys in the same aks group will only report 1 active key at * any time; value 0 disables aks group; valid aks groups are 1, 2, 3 * @key_burst_length: key sensitivity; 0 use default + * @low_power_mode: value 0 use default; each +1 increment causes the chip to + * sleep 16ms longer before detecting a touch (slower response); max 255 */ struct qt2160_info { unsigned char slider_length; @@ -23,6 +25,7 @@ struct qt2160_info { unsigned short keycodes[QT2160_MAXKEYS]; unsigned char key_aks[QT2160_MAXKEYS]; unsigned char key_burst_length[QT2160_MAXKEYS]; + unsigned char low_power_mode; }; #endif /* __QT2160_H__ */