Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp579738rwo; Fri, 21 Jul 2023 17:38:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlH/FSJrX/g1hsCkFNP3UneYa9t+A0e9rQY//LI878YAe3M98H7Q7ezo+ztjlpzXtFRkU0nD X-Received: by 2002:aa7:c986:0:b0:51a:42b2:cb83 with SMTP id c6-20020aa7c986000000b0051a42b2cb83mr2116597edt.42.1689986323889; Fri, 21 Jul 2023 17:38:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689986323; cv=none; d=google.com; s=arc-20160816; b=hPC9wUnbUsaYl7MtfaBveQH4n31YNsGLEVn9sRVmCSYGtVkLSsp7EOlukNKZAnA/yL MlwJz4iQDWUG9LMYzvrZxMfaUDrV1wzl76SdUbk/OM+gV91MFAmC+RCqhyCtQzn1pOqr 4paAhkN1cnkiR7Nso34fV4AqNXazfO2NNYn3OcL/KzV/3fpXQgE7f5KrFzRXP6navfMB LKbnBQIXuZbu0qmEdba9tokf7UMTYTQ65ZEpliDrbrvl9D50zL2TnxCH+eYe58WqznF8 5aksuzHr/Fj90EOqnyYCU/8+9DVxy1i3TVt7w/xks9ZqYfEuuL9Ny0xjbeXzciu27vqG 1VlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=GaufzkzTdbkEtghya4t6kc4yJ+HLUq9RLfLwNt/UYbo=; fh=ePRLjstoOQR4yc5EYTvLIuxKLyAjWHlsZ0EmxbuVKuA=; b=iGQnbFy66AmcrQ2NljYuZYz4f4StvwZas3jZGcST1qLKsi0VuOM4YhScnjL2ek01IO BCnWik3nxt2FFDqKQDH+ho/slwUNbtr/pDhLvmZB1NktSaDmvOhuKT4zbw/efJkoQpAy hI0YwRUGU5xSuEnj1fghcKVLOJ9WbvGT2XNO/1/3sa9db+mLnyBGTakpS4BLvaDHtOxv mOQ/8gAMArerRN18JUpj4Mu0Fb0SIOI49Xe7yb87OVCwmhsY0RFSxRKPM5hq15hoE41u 3iyrLTlPN6jdWh4i9H4QCY6fROv1WBPJBSBlxa1kmWbqEUB8KOdni5SH98zBdxcFCPTO nfWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=WGw4AWsB; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ay19-20020a056402203300b0051e1c968863si3053452edb.259.2023.07.21.17.38.20; Fri, 21 Jul 2023 17:38:43 -0700 (PDT) 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=@gmail.com header.s=20221208 header.b=WGw4AWsB; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230077AbjGUXxy (ORCPT + 99 others); Fri, 21 Jul 2023 19:53:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbjGUXxx (ORCPT ); Fri, 21 Jul 2023 19:53:53 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB4E930E1; Fri, 21 Jul 2023 16:53:52 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6686c74183cso2171459b3a.1; Fri, 21 Jul 2023 16:53:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689983632; x=1690588432; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=GaufzkzTdbkEtghya4t6kc4yJ+HLUq9RLfLwNt/UYbo=; b=WGw4AWsBk4Gpb7esrzVP6Gy5AEACeGv0QfkP8vVz7sOYQ+2/GzldfDXjSr+ux5i5CD o5kVxzXp88ar1SZxFPBVd0uMMHyiZ8huRrZh5Se8X2Gw+aCl+Pme6laPPAqTv8TNpuhI Od626zkWSYb/YvEimLBb4ddN/4qG8xTI49XmQrrM5aAFE2n0ymR/Qkim1acId5HifNso IoFO2/dY8DVJK7T96SCj/OKmTfMa+x8llRc5rzHF4v3UsuPowzs3H1SYr52XEbQ9+k7j 6VhyM3HPlioXitk1OiC/xfyqRuLz45ut9fSIEkXSszRbxPKQj7ixE2G1McjysBPv19PD l0YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689983632; x=1690588432; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=GaufzkzTdbkEtghya4t6kc4yJ+HLUq9RLfLwNt/UYbo=; b=kYtbUfsUWQP5FPM0diTaNSnocpMJ9ZOrEi/FAnJbohKDqhbUKh6Oj1GeU99w5Ew0ea eNBHp3EnCW6X+pAg9w7ooh94VU3bxheFwe36socBv/W2AxVQsIKYCW6B0H5A7eIRb6f2 dqGAxlrJS3OPNEvJKMfqkLdBzimI5VBBxrrSh/MVIMtB0sC4VVt8uxEK7AFYADeuwbKU FUW3mWDrwrzT+Q7aIPp9MAlGI+z8vO2MwyAhFDns68Fn+s2hdbHC3+jCmmjxtGOxKHyr YWXtUMN4rzo5lu+29IdvtIKfoerYMWwE504gTFOtStUHoHs4k9gIVzWs2I6i2uJiAyJd 7PAQ== X-Gm-Message-State: ABy/qLYCGsF4UJco5oNNDo8mTvhmq3FnU61qedMkry6/g+8Hww+OGsS7 ax5cjhQZf4ocrvxaVKNKOTU= X-Received: by 2002:a05:6a00:1988:b0:666:e42c:d5fb with SMTP id d8-20020a056a00198800b00666e42cd5fbmr1742204pfl.32.1689983632245; Fri, 21 Jul 2023 16:53:52 -0700 (PDT) Received: from google.com ([2620:15c:9d:2:fd88:dbb:fc42:8207]) by smtp.gmail.com with ESMTPSA id e5-20020aa78245000000b0064928cb5f03sm3494093pfn.69.2023.07.21.16.53.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 16:53:51 -0700 (PDT) Date: Fri, 21 Jul 2023 16:53:48 -0700 From: Dmitry Torokhov To: Jeffery Miller Cc: Jonathan Denose , jdenose@google.com, Lyude Paul , benjamin.tissoires@redhat.com, Andrew Duggan , loic.poulain@linaro.org, Andrew Duggan , Javier Martinez Canillas , Jeremy Kerr , Jonathan Cameron , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] Input: synaptics-rmi4 - retry reading SMBus version on resume Message-ID: References: <20230608210404.722123-1-jefferymiller@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230608210404.722123-1-jefferymiller@google.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,FSL_HELO_FAKE, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Hi Jeffery, On Thu, Jun 08, 2023 at 09:04:00PM +0000, Jeffery Miller wrote: > On resume there can be a period of time after the > preceding serio_resume -> psmouse_deactivate call > where calls to rmi_smb_get_version fail with > -ENXIO. > > The call path in rmi_smb_resume is rmi_smb_resume -> rmi_smb_reset -> > rmi_smb_enable_smbus_mode -> rmi_smb_get_version where > this failure would occur. > > Add a 30ms delay and retry in the ENXIO case to ensure the following > rmi_driver_resume calls in rmi_smbus_resume can succeed. > > This behavior was seen on a Lenovo T440p machine that required > a delay of approximately 7-12ms. > > The 30ms delay was chosen based on the linux-input message: > Link: https://lore.kernel.org/all/BYAPR03MB47572F2C65E52ED673238D41B2439@BYAPR03MB4757.namprd03.prod.outlook.com/ I do not quite like putting these retries in RMI code. I wonder if we should not move the delay into psmouse_smbus_reconnect(): if (smbdev->need_deactivate) { psmouse_deactivate(psmouse); /* Give the device time to switch to SMBus mode */ msleep(30); } or even factor it out into psmouse_activate_smbus_mode() and call it from psmouse_smbus_reconnect() as well as psmouse_smbus_init(). Thanks. or even factor it out into psmouse_activate_smbus_mode() and call it from psmouse_smbus_reconnect() as well as psmouse_smbus_init(). Thanks. -- Dmitry