Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1600701

Re: [PATCH] mfd: cros ec: spi: Increase wait time to 200ms

Path csiph.com!xmission!news.glorb.com!bofh.it!news.nic.it!robomod
From Lee Jones <lee.jones@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH] mfd: cros ec: spi: Increase wait time to 200ms
Date Tue, 14 Mar 2017 18:00:02 +0100
Message-ID <tkXXI-2UI-19@gated-at.bofh.it> (permalink)
References <tgb5g-2A8-23@gated-at.bofh.it>
X-Original-To Enric Balletbo i Serra <enric.balletbo@collabora.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=TDUYyWgeEcgqtSO+m52RCUnBcSI/72pJPSzx/Oju1OE=; b=IIQK2YYlyMKP36qwWWpgX/GmyTH3mxDtUK9qfs/bTfCfAjiSSWBO2SX651WCpDxX2I 7IfaGDDlPG2jYPsZ9kO85bBtama6Zl+mGWnH79TRmt+ek0N83l6lXVmRJvt52XeAQLD1 3LBsDrLDrO4HqzPyq+vkPfKkt5Xg7A3gFTFSc=
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:content-transfer-encoding :in-reply-to:user-agent; bh=TDUYyWgeEcgqtSO+m52RCUnBcSI/72pJPSzx/Oju1OE=; b=PG9FyX57uiI5WnSyyYFdE8yyitWEwaBSbzu0/DOw9+6yQ3Zl5bg52Hs3bqV3bA1Y5z H2H3p4OCZSXsNK+NCDBHSRQHy2e9XfFVtzUSXc75RqSJuh3z4bj45lLBzuuUbyAcrOcP S/i07EsBrSkTGqR/7cZsOReq6wPoyMB02w77/mBb96ctxhuVPl1ZX+6zSTIXX40LSbqh 8ibsASVfrWDCaCqch5tJdI20D7g0pQqe8NoRI0qm9ZgyNsXPbjTUD+6rsNhp2ReqR4Oe CHDN6UFfrHSozfkIyqMG6EVbkswyTBjnB9vqELBuvbqyAQ2fVOFdsiysi47rnWbu4fHE advA==
X-Gm-Message-State AMke39m8mP8U3w5WhTlFY6Iq4JAsV55wM9rgwQskCwoG8cDsiMXC64wEQXIzm/0WOxYApeUL
X-Received by 10.223.134.44 with SMTP id 41mr33870708wrv.26.1489510528756; Tue, 14 Mar 2017 09:55:28 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Disposition inline
Content-Transfer-Encoding 8bit
User-Agent Mutt/1.6.2-neo (2016-08-21)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 62
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, Doug Anderson <dianders@chromium.org>
X-Original-Date Tue, 14 Mar 2017 16:55:25 +0000
X-Original-Message-ID <20170314165525.qgecoxvne6nrgatk@dell>
X-Original-References <20170301115832.21181-1-enric.balletbo@collabora.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1600701

Show key headers only | View raw


On Wed, 01 Mar 2017, Enric Balletbo i Serra wrote:

> From: Doug Anderson <dianders@chromium.org>
> 
> This is a sucky change to bump up the time we'll wait for the EC.  Why
> is it sucky?  If 200ms for a transfer is a common thing it will have a
> massively bad impact on keyboard responsiveness.
> 
> It still seems like a good idea to do this, though, because we have a
> gas gauge that claims that in an extreme case it could stretch the i2c
> clock for 144ms.  It's not a common case so it shouldn't affect
> responsiveness, but it can happen.  It's much better to have a single
> slow keyboard response than to start returning errors when we don't
> have to.
> 
> In newer EC designs we should probably implement a virtual battery to
> respond to the kernel to insulate the kernel from these types of
> issues.
> 
> Signed-off-by: Doug Anderson <dianders@chromium.org>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
>  This fixes a random BUG report in cros-ec-spi in my rk3399 gru device.
> 
>  drivers/mfd/cros_ec_spi.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/cros_ec_spi.c b/drivers/mfd/cros_ec_spi.c
> index a518832..c971407 100644
> --- a/drivers/mfd/cros_ec_spi.c
> +++ b/drivers/mfd/cros_ec_spi.c
> @@ -45,8 +45,11 @@
>   * on the other end and need to transfer ~256 bytes, then we need:
>   *  10 us/bit * ~10 bits/byte * ~256 bytes = ~25ms
>   *
> - * We'll wait 4 times that to handle clock stretching and other
> - * paranoia.
> + * We'll wait 8 times that to handle clock stretching and other
> + * paranoia.  Note that some battery gas gauge ICs claim to have a
> + * clock stretch of 144ms in rare situations.  That's incentive for
> + * not directly passing i2c through, but it's too late for that for
> + * existing hardware.
>   *
>   * It's pretty unlikely that we'll really see a 249 byte tunnel in
>   * anything other than testing.  If this was more common we might
> @@ -54,7 +57,7 @@
>   * wait loop.  The 'flash write' command would be another candidate
>   * for this, clocking in at 2-3ms.
>   */
> -#define EC_MSG_DEADLINE_MS		100
> +#define EC_MSG_DEADLINE_MS		200
>  
>  /*
>    * Time between raising the SPI chip select (for the end of a

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] mfd: cros ec: spi: Increase wait time to 200ms Lee Jones <lee.jones@linaro.org> - 2017-03-14 18:00 +0100

csiph-web