From patchwork Thu Jan 5 22:53:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brendan McGrath X-Patchwork-Id: 9499775 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 7F0AB606DE for ; Fri, 6 Jan 2017 00:02:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F54C2848A for ; Fri, 6 Jan 2017 00:02:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6403E2848B; Fri, 6 Jan 2017 00:02:06 +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 C92F928496 for ; Fri, 6 Jan 2017 00:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034627AbdAFAB5 (ORCPT ); Thu, 5 Jan 2017 19:01:57 -0500 Received: from ipmail07.adl2.internode.on.net ([150.101.137.131]:36654 "EHLO ipmail07.adl2.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968928AbdAFABo (ORCPT ); Thu, 5 Jan 2017 19:01:44 -0500 Received: from ppp118-209-12-109.lns20.mel4.internode.on.net (HELO mail.hermana.com.au) ([118.209.12.109]) by ipmail07.adl2.internode.on.net with ESMTP; 06 Jan 2017 09:23:38 +1030 Received: from localhost.localdomain (2001-44b8-412c-1c00-242c-35a6-84fd-cf90.static.ipv6.internode.on.net [IPv6:2001:44b8:412c:1c00:242c:35a6:84fd:cf90]) by mail.hermana.com.au (Postfix) with ESMTPSA id 9265B2AC; Fri, 6 Jan 2017 09:53:35 +1100 (AEDT) From: Brendan McGrath To: Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Victor Vlasenko , Frederik Wenigwieser , Brendan McGrath Subject: [PATCHv2] HID: i2c-hid: Add sleep between POWER ON and RESET Date: Fri, 6 Jan 2017 09:53:10 +1100 Message-Id: <1483656790-27977-1-git-send-email-redmcg@redmandi.dyndns.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20170105112319.GA17928@mail.corp.redhat.com> References: <20170105112319.GA17928@mail.corp.redhat.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 Support for the Asus Touchpad was recently added. It turns out this device can fail initialisation (and become unusable) when the RESET command is sent too soon after the POWER ON command. Unfortunately the i2c-hid specification does not specify the need for a delay between these two commands. But it was discovered the Windows driver has a 1ms delay. As a result, this patch modifies the i2c-hid module to add a sleep inbetween the POWER ON and RESET commands which lasts between 1ms and 5ms. See https://github.com/vlasenko/hid-asus-dkms/issues/24 for further details. Signed-off-by: Brendan McGrath --- Patch has been changed to use option a) I upped the minimum sleep to 1ms to match Microsoft. I figure this is a safer value. drivers/hid/i2c-hid/i2c-hid.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index 844662c..61ff6a6 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c @@ -426,6 +426,7 @@ static int i2c_hid_hwreset(struct i2c_client *client) if (ret) goto out_unlock; + usleep_range(1000, 5000); i2c_hid_dbg(ihid, "resetting...\n"); ret = i2c_hid_command(client, &hid_reset_cmd, NULL, 0);