Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp1377737iof; Tue, 7 Jun 2022 04:33:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYhkSdJ+y0LTkHgld+beRJzQ8o56Q3Aoc6h3pGAdphHph8Hq0BwDFzv/eUpElgiB/q4/bD X-Received: by 2002:a17:902:cec5:b0:166:3418:5260 with SMTP id d5-20020a170902cec500b0016634185260mr28664746plg.129.1654601611495; Tue, 07 Jun 2022 04:33:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654601611; cv=none; d=google.com; s=arc-20160816; b=dSdzIulCeXGy9AyGn3ApEpmlMZWQZHeERjoX0Sn4R1hCvXpGPgp/NVbhgIxGRGyP5q F2wKEK/XoTABZFz0RllOTStlT57NETwyF3cV35PSzkuDNKcGZtFj+vYnXn0Xt5gvtv9z pbfz5H01v3R0mGEZPMKlO6uswJmvnzXDs2cj3u1RX52Qmgf9xkNP3gJMz5AexNoO2lyk 4xnMeECVFclWfmAdBP07GoFDdoXtU7XJ4PHvJaK6W4EF2SQXFSnpO9WI9TZMki1s+4KO 5y21EjOurrwIX3fBgHFTim9hQuVKBhVnIU1EpzGIBxNDBk2Pz19wM/kwjLzEgk6Yd5hB T2rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :feedback-id:message-id:subject:reply-to:cc:from:to:dkim-signature :date; bh=D9FtRQsL64UZzeNlDSZGhV3sxAUQRz/jzb9A2KCTcNc=; b=tRmUlq0DD8IsyUOwWXyXRjYt0fdGh8/KasFY5Swoye3Fzd34xIK20eg32q2KTDJATM BZo78onveWkn7amVZpex+PNLZTBbK9XKczM8acpJd1dXZxhTn/TvGtzt1U4zINIwaPhO lrgr48DG+81r6Nsqq0uuvNckM0qZMJ4ETcLH2YUin2sgEO5s6deddGOySAlAFIwQ9BQh 40NFASvWWJFtmv0++i+taH0ULdILsO4vsR3XJNRgxxWar5q/0Aobh4M3U6d5hRJBxBiy K/zcPCevkyoqi2wl7DpGtrGFLHBFzgvBJW+ZepEigf20UZTuPQJn15zyre4+OWzYPAze 26JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=i6mTSUcT; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r20-20020a6560d4000000b003c642710cc1si13022118pgv.725.2022.06.07.04.33.19; Tue, 07 Jun 2022 04:33:31 -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=@protonmail.com header.s=protonmail3 header.b=i6mTSUcT; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237786AbiFGHnU (ORCPT + 99 others); Tue, 7 Jun 2022 03:43:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231833AbiFGHnR (ORCPT ); Tue, 7 Jun 2022 03:43:17 -0400 Received: from mail-0201.mail-europe.com (mail-0201.mail-europe.com [51.77.79.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 166342E093; Tue, 7 Jun 2022 00:43:17 -0700 (PDT) Date: Tue, 07 Jun 2022 07:43:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1654587793; x=1654846993; bh=D9FtRQsL64UZzeNlDSZGhV3sxAUQRz/jzb9A2KCTcNc=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:Feedback-ID:From:To: Cc:Date:Subject:Reply-To:Feedback-ID:Message-ID; b=i6mTSUcTRPosAWilhmCAwd5mvCKSmf+X6domJ9XNYgWu3XZzkkHWiVAPQ03pqcISA tvSLTTF7a5+Gzy6Tus1NrtlT1gSep4rDK0fETn2N0fjRn6lTsWtnDabdtEGZRZKN6g 0S2tL+Cisllizz5L7QOdUeg4rnan6P/LgWgQuLb6H5Tlnx82IONYb+5d5XXKkZNZ2o Hi82zZiQC3r6/3hsEFJ/3C5s1bKKgMmKKGbBcMGjEZ6ZeblGYJL+0hikwtSRCbTVTZ zqQhMPWsNgvfbK+UBnqDrghDbTOJ/SX9UJvlSeVBs/KjBiAT9HnkgYnhEjzWietluv M5C1LbFSYs61w== To: linux-kernel@vger.kernel.org From: "Lin, Meng-Bo" Cc: dmitry.torokhov@gmail.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, rydberg@bitmath.org, zhengyongjun3@huawei.com, linux-input@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, ~postmarketos/upstreaming@lists.sr.ht, andi@etezian.org, stephan@gerhold.net, nikita@trvn.ru Reply-To: "Lin, Meng-Bo" Subject: [RESEND PATCH] input: stmfts: Add #define STMFTS_RETRY_COUNT 3 Message-ID: <20220607074249.21763-1-linmengbo0689@protonmail.com> Feedback-ID: 40467236:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,FREEMAIL_REPLYTO_END_DIGIT,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 Add #define STMFTS_RETRY_COUNT 3 to retry stmfts_command() 3 times. Without it, STMFTS_SYSTEM_RESET or STMFTS_SLEEP_OUT may return -ETIMEDOUT to failed attempt due to no event received for the completion. Signed-off-by: Lin, Meng-Bo --- drivers/input/touchscreen/stmfts.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen= /stmfts.c index c175d44c52f3..730035f5c62c 100644 --- a/drivers/input/touchscreen/stmfts.c +++ b/drivers/input/touchscreen/stmfts.c @@ -68,6 +68,7 @@ #define STMFTS_DATA_MAX_SIZE=09(STMFTS_EVENT_SIZE * STMFTS_STACK_DEPTH) #define STMFTS_MAX_FINGERS=0910 #define STMFTS_DEV_NAME=09=09"stmfts" +#define STMFTS_RETRY_COUNT=093 =20 enum stmfts_regulators { =09STMFTS_REGULATOR_VDD, @@ -317,19 +318,20 @@ static irqreturn_t stmfts_irq_handler(int irq, void *= dev) =20 static int stmfts_command(struct stmfts_data *sdata, const u8 cmd) { -=09int err; +=09int err, retry; =20 =09reinit_completion(&sdata->cmd_done); =20 -=09err =3D i2c_smbus_write_byte(sdata->client, cmd); -=09if (err) -=09=09return err; - -=09if (!wait_for_completion_timeout(&sdata->cmd_done, -=09=09=09=09=09 msecs_to_jiffies(1000))) -=09=09return -ETIMEDOUT; +=09for (retry =3D 0; retry < STMFTS_RETRY_COUNT; retry++) { +=09=09err =3D i2c_smbus_write_byte(sdata->client, cmd); +=09=09if (err) +=09=09=09return err; =20 -=09return 0; +=09=09if (wait_for_completion_timeout(&sdata->cmd_done, +=09=09=09=09=09=09msecs_to_jiffies(1000))) +=09=09=09return 0; +=09} +=09return -ETIMEDOUT; } =20 static int stmfts_input_open(struct input_dev *dev) --=20 2.30.2