Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2208633imm; Thu, 23 Aug 2018 16:34:03 -0700 (PDT) X-Google-Smtp-Source: AA+uWPynB48aeLJf6b7QvGc03mhnuwAJRxvDEt7SahiRYiXg7gYgAa3XAL/lVnNw3xJVp3DngQJw X-Received: by 2002:a63:ef10:: with SMTP id u16-v6mr57859585pgh.269.1535067243132; Thu, 23 Aug 2018 16:34:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535067243; cv=none; d=google.com; s=arc-20160816; b=kvzv30VTfCtFH3mYpaclUPuPlwHcIDTjGEOeSt9iEy185nocm6hi1gUJacEKXXAgrh RSTG/zqXeGuRvVMkS5z6AuiszWtMwAJFMskYpKOKe+vrrgBicN8zr9qKqK2bv0CHRG6e yMuclryiGGPuwkDneRzZnfDmhw0DNaH7T08wrI2fxOJbcyHpSxVp0pT63nZjtcs9D8F7 4kuuAOakwB0H8rgw7OFJ2pP5qcq6Bmt6QkomUrmv0laH46rcGgl4Ul9VWfrHGkaHz/7j XVXG4QBpGhEV3jzJ0Fv6ramv+KYEWY5W8z557F9LSVEN4LJNuBlKR7NkZRgAgRWDcZOr Dh5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=3NGBTikZVTjhm7BaifILrjxyduiquLNjtzjAR5gHJFI=; b=izCIGoG6/IodViqKYkumg9ysNR6uLrfZxD2bfCOxjYOOKKZM9q8XCAgWGPcr5PepsD 1y3LEBYbaWJd5PBuyUwiVvsCAylQItSbic2ncpYyeZUgynMQOa+cuAPC3a1Xy73myR0T eiEeoTrdS70Llt2eVlLy2t2DLIoNu03HE+fdekpuCXsXdWBphyjD/kic9bZ6r5KO08sV lrgt85U1eIws8JSeSl1zD0XD3M7/PP9LYlDZJqvhigNZlRXAF1GyYKxU1rbv1n0mo250 McqWqorXabHboA6Kx8AkuXJlmpKcXRMKGpmTY/ZDbrLAv3GrDz0wvMWUc8wqHYPKkqZT bMOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OuRa2LBL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w15-v6si5517546plk.508.2018.08.23.16.33.47; Thu, 23 Aug 2018 16:34:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OuRa2LBL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727246AbeHXDEN (ORCPT + 99 others); Thu, 23 Aug 2018 23:04:13 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:44261 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727134AbeHXDEN (ORCPT ); Thu, 23 Aug 2018 23:04:13 -0400 Received: by mail-pl1-f193.google.com with SMTP id ba4-v6so247764plb.11; Thu, 23 Aug 2018 16:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3NGBTikZVTjhm7BaifILrjxyduiquLNjtzjAR5gHJFI=; b=OuRa2LBLzZvWVWw8Cwzgh0diOH9FdstQaiCDLGJqA1HZMZhqxnliNyTLCR5j2ECfjv do7eD+XZN6enVBSLzPTr3QQbo+B4VHQQ2XoP1yZ8r3rCHH8m5WOf9+s4AVXBkqjg0fjB eFLfcXcHdYZ4jhBY5XACswQuS2xQ/uuQtKGUjmKvh164lLQjmt8beJbLZRLGMYzBIkHF kFKRZI6k5dRnupwKSfkVNU7cLB8jvrzuV2+ip/qVi2jrbNl0ezuWE2nehl85fca77k9S p+nybPvf8FiexTTjVt+IaDISJlqLj79jdgTrYywCYsS15CB/M/SCp6LDK4dOGUoLB7hS +raA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=3NGBTikZVTjhm7BaifILrjxyduiquLNjtzjAR5gHJFI=; b=LZV9RGyTUE0sFGnUTL0+UdtH1JJYlQyQ54yRB2ZE4p3Sh/kvniwPXfkblYKXYmnjzB 5JyiictRF9wCDwLIGEcM0pOoinppyIgNjNR2XdUoAkcisBIhwIArte6N9ksS0T3y5MD4 aWKCIVBmayux5Gs7UUDyMMm13s1ziiTzBmLgwV0dx7FkCaJByc4tmxX+RXyD3NlR4q/o NuVYhoRm90leTCruA6yyQLvWyQDsnUCRLw1IhX3uiLbgdoVmmla0U0BSdGt6jAuIAy8k ihzl6Ck9EEoaxG2dyinABChxcxDo0M1SZqtfIz+PVnMp9FOeFe/OC5vwV+MNTrmsH6dp i/vQ== X-Gm-Message-State: AOUpUlEGl3vjRi92RTqxrR0K3DlfSsvjR6zE2x/NWbboKcWgnOglnMyn nFJ7bTRYehfXigew/M5Qskc= X-Received: by 2002:a17:902:aa83:: with SMTP id d3-v6mr59690086plr.242.1535067134657; Thu, 23 Aug 2018 16:32:14 -0700 (PDT) Received: from dtor-ws ([2620:15c:202:201:3adc:b08c:7acc:b325]) by smtp.gmail.com with ESMTPSA id j191-v6sm10293090pfc.136.2018.08.23.16.32.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Aug 2018 16:32:13 -0700 (PDT) Date: Thu, 23 Aug 2018 16:32:11 -0700 From: Dmitry Torokhov To: Derek Basehore Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, joe@perches.com, andi@etezian.org, gregkh@linuxfoundation.org Subject: Re: [PATCH] Input: elants_i2c - Fix sw reset delays Message-ID: <20180823233211.GD53155@dtor-ws> References: <20180823231013.254037-1-dbasehore@chromium.org> <20180823233028.GC53155@dtor-ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180823233028.GC53155@dtor-ws> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Let's add Elan folks to the discussion. On Thu, Aug 23, 2018 at 04:30:28PM -0700, Dmitry Torokhov wrote: > Hi Derek, > > On Thu, Aug 23, 2018 at 04:10:13PM -0700, Derek Basehore wrote: > > 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 > > This is not needed ;) > > > 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); > > So the original comment was talking about timing on fastboot or IAP > command, but the original code had 50 msec wait here (30 from > elants_i2c_sw_reset plus the 20), thus already violating 40 msec rule > for IAP. Unless Elan folks can confirm it is OK to reduce the wait here > I'd prefer we kept it at 50. Firmware update is does not happen that > often anyway. > > Thanks. > > -- > Dmitry -- Dmitry