From patchwork Tue Jun 21 10:27:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guohua Zhong X-Patchwork-Id: 9190297 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CDB5D6075A for ; Tue, 21 Jun 2016 10:34:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDE4E28113 for ; Tue, 21 Jun 2016 10:34:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2AB628111; Tue, 21 Jun 2016 10:34:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DC3B28066 for ; Tue, 21 Jun 2016 10:34:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751307AbcFUKeh (ORCPT ); Tue, 21 Jun 2016 06:34:37 -0400 Received: from mail.yifangdigital.com ([121.15.200.100]:3537 "EHLO yifangdigital.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751652AbcFUKe1 (ORCPT ); Tue, 21 Jun 2016 06:34:27 -0400 Received: from localhost.localdomain by yifangdigital.com (MDaemon.PRO.v8.1.5.R) with ESMTP id md50005220535.msg; Tue, 21 Jun 2016 18:30:14 +0800 From: Guohua Zhong To: Jiri Kosina , Benjamin Tissoires , Mika Westerberg , Dmitry Torokhov , Benson Leung , Andrew Duggan Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Guohua Zhong Subject: [PATCH v2] HID: i2c-hid: set power sleep before shutdown Date: Tue, 21 Jun 2016 18:27:45 +0800 Message-Id: <1466504865-19907-1-git-send-email-ghzhong@yifangdigital.com> X-Mailer: git-send-email 1.9.1 X-Authenticated-Sender: ghzhong@yifangdigital.com X-MDRemoteIP: 192.168.0.9 X-Return-Path: ghzhong@yifangdigital.com Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add i2c_hid_shutdown for i2c-hid driver to send suspend cmd & free irq before device shutdown. Some HW design (i.e. Umaro, a chromebook model) is that the power to i2c hid device won't down after device shutdown. Also the i2c-hid driver do not send suspend cmd to the hid i2c device and free its irq before shutdown.So if We touch the touchscreen or some other i2c hid device, the power consumtion will be go up even when the device is in shutdown state. Though the root cause maybe a HW issue. But it seems that it is a good pratice to set power sleep for i2c-hid device before shutdown. Signed-off-by: Guohua Zhong --- drivers/hid/i2c-hid/i2c-hid.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index 2e021ba..79406ae 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c @@ -1106,6 +1106,14 @@ static int i2c_hid_remove(struct i2c_client *client) return 0; } +static void i2c_hid_shutdown(struct i2c_client *client) +{ + struct i2c_hid *ihid = i2c_get_clientdata(client); + + i2c_hid_set_power(client, I2C_HID_PWR_SLEEP); + free_irq(client->irq, ihid); +} + #ifdef CONFIG_PM_SLEEP static int i2c_hid_suspend(struct device *dev) { @@ -1230,7 +1238,7 @@ static struct i2c_driver i2c_hid_driver = { .probe = i2c_hid_probe, .remove = i2c_hid_remove, - + .shutdown = i2c_hid_shutdown, .id_table = i2c_hid_id_table, };