Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5628680rwb; Mon, 5 Dec 2022 01:40:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf43sdkL8wuQzl0T2KkXQJ3n7dQQ1bA1ytffS/Rcjhjz65Mk4XOXK8+tFUuOAXQLcu0N09um X-Received: by 2002:a05:6402:298f:b0:468:f142:3040 with SMTP id eq15-20020a056402298f00b00468f1423040mr72571152edb.107.1670233240604; Mon, 05 Dec 2022 01:40:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670233240; cv=none; d=google.com; s=arc-20160816; b=E9figkWeU80Pe+pfTO+3o72MXv/+b/6PYhnhRU06JdBTdcxfKmRSisvqs3uN5vPEym cBWAjchHifA1vF9LWfaC5O1JqbV0li5Pzq+Ez/pCDj/PCrX08/J3GrTn7M7YZrygYy9y 10j40ELOw3bKmpL/uT8pZvdiiHmalSkcihDKPGFyv0OXcomrZ48q2nudoNJbKNprFtx6 VbJDcX2F28nQSB2GXzeWrdDO2sEClPaeLCk/J/sHWYFco1NlxcSHFoaR2Ou/A/u7gYBL Pt4TCBjksKFiffXH6NDevtYnXA1ndTK1Z0BT5rqySGWEyOeoC9C5ADjcWJoRvE9InE+h BjQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=ZFVG2GHKql4mObap2ourAu7QFKuQou+XwSrycPDhCj4=; b=lNiUdRnrEu90EkN9mtNo8f6D4Xiwx37vBMavV2Rod51z7+fkvbNcSxr9v/6s5HOcCY e1Hk9ZDMo0bA4X3+wK0uClRsQhgMb0VqlD9WX3MO+m3ghvAJmL5q3wmaMVsz3y0Bhtps HJb4S62rZAjNZy7Weh4wfM3duOvX0aipV56UV77bo/6qAUQOyYhKdzff1QO+OqYBJ2GG 2KfAFiPL2JndeKfmRnKmM7qa2b34OqNqVUjao9jzcMuj0u7oZkPA1DbcPfM/qW5LCA1y 5hxglxg7+KSCiAXMvevwfhNwE9XVRp4rbKrqXTJXr1pBqdcEyqIFxt/ikKM6lemj/vju +BXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=h0mnTCNO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o9-20020a170906974900b007c0b22a5328si9703089ejy.385.2022.12.05.01.40.19; Mon, 05 Dec 2022 01:40:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=h0mnTCNO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231969AbiLEJBc (ORCPT + 82 others); Mon, 5 Dec 2022 04:01:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231745AbiLEJAp (ORCPT ); Mon, 5 Dec 2022 04:00:45 -0500 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0CCE18B11 for ; Mon, 5 Dec 2022 00:59:11 -0800 (PST) Received: by mail-ej1-x634.google.com with SMTP id fc4so19117465ejc.12 for ; Mon, 05 Dec 2022 00:59:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ZFVG2GHKql4mObap2ourAu7QFKuQou+XwSrycPDhCj4=; b=h0mnTCNOjIf3URNf8DcO22NFH34k+ScsW5BQAoDEFdCuHnl5B1JZhm9PA5niOgIBeH 5+d5a0WEeZbzqX044JciEYRXR4sz9I2SVL0NMHIxbDh0/trQbfTOOja0p8DfqkdVbG76 ssFwjAtjDjrdwYLcSMayNxcfux3pweAH1CMCc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZFVG2GHKql4mObap2ourAu7QFKuQou+XwSrycPDhCj4=; b=CgZW0B+6/yAtwEGu7bcazIcTpELJPMkzU3nsNOmXp3Bp1D+QvQ1oEiOKdtK3gNo6mw KbV5jmZOek3KoreoSAF3LHLTiP5AMlsMZKAuHFgt+cFd/FcOiltWjbnibItS8QMTTsqF 4HNNKhbsHbDUrwbI1M1+IlXzpdsWDpl+NbDt4YHjIbHYUS/pKTV8UPpUzCjn3FYz0mIc +sah5YKSpMQRcIF+sP0/bhoXnj9wrjNaAr/X8whwu4K+XJbn4S3509yHYoWpyuECH6pQ +I7HIul7X2nIGnSUFta9brK2IJM0XeHUw+3RfUAdYqF6/XeZUrPnFdw4ZkXqA9qC0xWu zZYA== X-Gm-Message-State: ANoB5pnXjsduxiK/E+bxaYZeGcDFbAwGxs7c15CP/RuVwN1zishvEl7j YcgZHxw5NWRJBosInzfpbhYKeA== X-Received: by 2002:a17:906:7e4c:b0:7c0:e990:27c4 with SMTP id z12-20020a1709067e4c00b007c0e99027c4mr4789870ejr.677.1670230750347; Mon, 05 Dec 2022 00:59:10 -0800 (PST) Received: from [172.16.11.74] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id l4-20020aa7c304000000b00458dc7e8ecasm5946590edq.72.2022.12.05.00.59.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Dec 2022 00:59:09 -0800 (PST) Message-ID: <58ec9951-32d7-6967-3571-d18c667ae478@rasmusvillemoes.dk> Date: Mon, 5 Dec 2022 09:59:08 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH] Input: edt-ft5x06 - always do msleep(300) during initialization Content-Language: en-US, da To: Jeff LaBundy Cc: Dmitry Torokhov , Dario Binacchi , Oliver Graute , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, broonie@kernel.org References: <20221202105800.653982-1-linux@rasmusvillemoes.dk> From: Rasmus Villemoes In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/12/2022 19.23, Jeff LaBundy wrote: > + Mark > > Hi Rasmus, > > On Fri, Dec 02, 2022 at 11:57:59AM +0100, Rasmus Villemoes wrote: >> We have a board with an FT5446, which is close enough to a >> FT5506 (i.e. it also supports up to 10 touch points and has similar >> register layout) for this driver to work. However, on our board the >> iovcc and vcc regulators are indeed controllable (so not always-on), >> but there is no reset or wakeup gpio hooked up. >> >> Without a large enough delay between the regulator_enable() calls and >> edt_ft5x06_ts_identify(), the first edt_ft5x06_ts_readwrite() call >> fails with -ENXIO and thus the device fails to probe. So >> unconditionally do an mdelay(300) instead of only when a reset-gpio is >> present. >> >> Signed-off-by: Rasmus Villemoes > > This is just my $.02, but it does not seem we are on the correct path > here. 300 ms sounds more like bulk capacitor charge time rather than > anything to do with this specific IC; is that a reasonable assumption? > > Normally, we want to do the following: > > 1. Enable regulator > 2. Wait for voltage rail to stabilize (RC time constant) > 3. Wait for any applicable POR delay (IC datasheet) > 4. Deassert reset > 5. Wait for any applicable reset delay (IC datasheet) > 6. Start communication > > Here we are dealing with step (2), Nope, we are really essentially dealing with step 5, even if there's no reset gpio that we've flipped around. The data sheet says to wait 200 ms (and I don't know why the driver does 300, perhaps there's some other chip in the family with that value, or perhaps it was just a belt-and-suspenders choice) after releasing reset. It's just that "releasing reset" is, in my case, effectively happens at the same time as the regulators are enabled. I also played around with some smaller values. As I wrote, with no delay, I would get -ENXIO, but with both 50 and 100, the chip would "respond", but the values were essentially garbage (and not reproducible from one boot to the next). So even if it's a rather long time, it most definitely is a hard requirement to wait that long - perhaps we could make it 200, but I'd rather not reduce that time when I don't know if other variants have that 300 as a requirement. Even if we could interrogate the regulator and ask it if "are you actually always-on", I'd rather not make the delay conditional on that; we cannot know if it has been on for 300+ ms, and since the device does respond, but not correctly, we could end up with probing and initializing the device, but in a wrong state. That's a recipe for impossible debugging (add a single printk somewhere earlier and the timing changes so that suddenly it gets initialized correctly...). Rasmus