From patchwork Thu Aug 23 23:10:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Basehore X-Patchwork-Id: 10574661 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 62566109C for ; Thu, 23 Aug 2018 23:10:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B7322C6D3 for ; Thu, 23 Aug 2018 23:10:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F9972C6D8; Thu, 23 Aug 2018 23:10:22 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 D0B3A2C6D3 for ; Thu, 23 Aug 2018 23:10:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727428AbeHXCmO (ORCPT ); Thu, 23 Aug 2018 22:42:14 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:45545 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727136AbeHXCmO (ORCPT ); Thu, 23 Aug 2018 22:42:14 -0400 Received: by mail-pg1-f194.google.com with SMTP id m4-v6so2850786pgv.12 for ; Thu, 23 Aug 2018 16:10:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZUOKN+UyMz6MyOH+hKTvmBUtxDhaBxGiCHvAaiY8n/U=; b=SNGryQaK8uW8+D2PMxJV3eWo+BN0u6nSQDzhwQArqVrGLcV5p537duWddWPt3/0/2L 7ExM7BcqdSj0SKkjkl55ClkWJor90k0PE3h7xRK7xWeEUABx/nP8UUDZ8uLEsPn0BY54 MiJcaopWIwy3NoKQqXteBC7pvJ79HUEzRmBw8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZUOKN+UyMz6MyOH+hKTvmBUtxDhaBxGiCHvAaiY8n/U=; b=LKEyVnRk+c2rArZYqbQ9vbSdBglon9DcEHVJbPo2GO5HSyIDtzqga2bYwp2vocwpbF uZ2B1uMJK2vKDNyFwqPewHJa85j8DX2J1WJDCpJIDMdmE51bIu47q56xt3hQtVq1IfHv /CcGnUeFWtq8rY/gBvziabpFU6a0Kp0/hcHlSJp5CsDKSOAgYdGEQE4/RY0xHa/vaUci Q7v8/ffIJsODA1E4r4BsnUGu4yc1yEz2Eo3LuXBLsbXPxTHmudjfGZHlfgFQIIZLsoFj 1vcGQMzADjFjoj9n2XAk4iMkg5fYoqKbFSa6CazC8pRUZhibHlEDlnVHNvTd4Rict5HK qywQ== X-Gm-Message-State: AOUpUlErqYeqf44qEA6ELodwWO7s08rrfAU+5wRjJ3V9fq8BHVGb7/dL yS0QG++wuwww/Dw+EvoPoXfxQA== X-Google-Smtp-Source: AA+uWPxaib/abS9fqzOm7ntJe7b8glX0dH+dB/ttZ6cIqjGOhtBZJee0DDIzJvUyGxjoxNAa7Am3vQ== X-Received: by 2002:a63:6988:: with SMTP id e130-v6mr18427574pgc.249.1535065820122; Thu, 23 Aug 2018 16:10:20 -0700 (PDT) Received: from exogeni.mtv.corp.google.com ([2620:15c:202:1:5e2b:39df:72ed:4968]) by smtp.gmail.com with ESMTPSA id h3-v6sm6312469pgn.26.2018.08.23.16.10.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Aug 2018 16:10:19 -0700 (PDT) From: Derek Basehore To: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, joe@perches.com, andi@etezian.org, gregkh@linuxfoundation.org, dmitry.torokhov@gmail.com, Derek Basehore Subject: [PATCH] Input: elants_i2c - Fix sw reset delays Date: Thu, 23 Aug 2018 16:10:13 -0700 Message-Id: <20180823231013.254037-1-dbasehore@chromium.org> X-Mailer: git-send-email 2.19.0.rc0.228.g281dcd1b4d0-goog MIME-Version: 1.0 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 We only need to wait 10ms instead of 30ms before starting fastboot or sending IAP on the touchscreen. Also, instead of delaying everytime sw_reset is called, this delays 10ms in the function that starts fastboot. There's also an explicit 20ms delay before sending IAP when updating the firmware, so no additional delay is needed there. This change also has the benefit of not delaying when wakeup is enabled during suspend. This is because sw_reset is called, yet fastboot isn't. Change-Id: I9e3019720186ba0023891fafeb4fe3d2510e454b Signed-off-by: Derek Basehore --- drivers/input/touchscreen/elants_i2c.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c index d21ca39b0fdb..18ce04ba0173 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -284,12 +284,6 @@ static int elants_i2c_sw_reset(struct i2c_client *client) return error; } - /* - * We should wait at least 10 msec (but no more than 40) before - * sending fastboot or IAP command to the device. - */ - msleep(30); - return 0; } @@ -500,6 +494,12 @@ static int elants_i2c_fastboot(struct i2c_client *client) const u8 boot_cmd[] = { 0x4D, 0x61, 0x69, 0x6E }; int error; + /* + * We should wait at least 10 msec (but no more than 40) before sending + * fastboot command to the device. + */ + usleep_range(10 * 1000, 11 * 1000); + error = elants_i2c_send(client, boot_cmd, sizeof(boot_cmd)); if (error) { dev_err(&client->dev, "boot failed: %d\n", error); @@ -643,6 +643,10 @@ static int elants_i2c_do_update_firmware(struct i2c_client *client, dev_err(&client->dev, "Failed close idle: %d\n", error); msleep(60); elants_i2c_sw_reset(client); + /* + * We should wait at least 10 msec (but no more than 40) before + * sending IAP command to the device. + */ msleep(20); error = elants_i2c_send(client, enter_iap, sizeof(enter_iap)); }