Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2258241pxb; Tue, 23 Feb 2021 02:33:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxyyQpUzD/6WCZQYbksd5HVjMGk+qYgoOd8EX6GUo3urB4Vzj0R6qWz9i50iI6fejmpnrIw X-Received: by 2002:aa7:c80a:: with SMTP id a10mr15126639edt.380.1614076382223; Tue, 23 Feb 2021 02:33:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614076382; cv=none; d=google.com; s=arc-20160816; b=0WDA9yzAwgJ/3oKozlQkJttUIUQWG2fQZn9gGJJoJ6FxfxbziGf7/Nco/KsaG7Zktt A2XapaGdMJNPestcRwPY1z2mEAoWUQD4+aaIPDCaB+0dewQRXzAC+s9Khl0N7SCN9P0w lRsmgCr0GzmErcobudDvWgk8GnwViSgAvDB2FqTyf7rP1hfIIkDh90Btc0xzKwXhCfYt cKafzAojsJ9l+Y8d30AH4cLPUrChf3spYr9l3nEmU9qYx1C6qkpvtzjUykFDgLida5zV /wWNIGH6Apvo7fXXH1GBs2e3eAl2rgQ+g66qEIjxouvP9oauBClbDiOkPkYPhe/UoZTG XUuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=iXcBc1o5hh/WkUAy628H+6uYgT81bbyAYfuq+HSCaho=; b=oxkuPK9lh+MdqNPqUwf6Y7hYVjJTeoaYKVYii50NLrXPfBxjxi1vcXGwhuxueX+7Pe Z3WGNkVi/x7PEh8NWDS/k7HYyhGF8jS3EhHAODq+oNxBSLY/k4tXrkCC1PibmDiQAO/J Se7YW+kdSTjY9PNMV8/v4RkqlBZNXAqDZTxNi81z8KndbDHb5yu+m4+kDGc2uGBKbcAu eEEJJ4ry8EoOjiOi6ShaUjw9mmyvDMs7RqozDSPVlceEdAJ4KmlG/zuU5pTTixg53SiL YBMWbwzQSTOeDxR3zobVFkzXLlVXAS/bpvXT8p1DMRgRi2qKtMYSCBT4pEjcPVMpibVk jieg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cq1si10986923edb.162.2021.02.23.02.32.34; Tue, 23 Feb 2021 02:33:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230008AbhBWK3v (ORCPT + 99 others); Tue, 23 Feb 2021 05:29:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230142AbhBWK3r (ORCPT ); Tue, 23 Feb 2021 05:29:47 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDE85C061786 for ; Tue, 23 Feb 2021 02:29:07 -0800 (PST) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEUwB-0007i8-GF; Tue, 23 Feb 2021 11:29:03 +0100 Received: from mtr by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1lEUw8-0003mA-W0; Tue, 23 Feb 2021 11:29:00 +0100 Date: Tue, 23 Feb 2021 11:29:00 +0100 From: Michael Tretter To: Geert Uytterhoeven Cc: Dmitry Torokhov , Andrej Valek , linux-input@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Input: st1232 - Fix NORMAL vs. IDLE state handling Message-ID: <20210223102900.GA8833@pengutronix.de> References: <20210223090201.1430542-1-geert+renesas@glider.be> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210223090201.1430542-1-geert+renesas@glider.be> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 11:23:19 up 5 days, 13:47, 64 users, load average: 0.03, 0.11, 0.20 User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: mtr@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 Feb 2021 10:02:01 +0100, Geert Uytterhoeven wrote: > NORMAL (0x0) and IDLE (0x4) are really two different states. Hence you > cannot check for both using a bitmask, as that checks for IDLE only, > breaking operation for devices that are in NORMAL state. Thanks. I missed that the state is actually a value and not a bitfield. > > Fix the wait function to report either state as ready. > > Fixes: 6524d8eac258452e ("Input: st1232 - add IDLE state as ready condition") > Signed-off-by: Geert Uytterhoeven Reviewed-by: Michael Tretter > --- > drivers/input/touchscreen/st1232.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c > index 885f0572488dd061..6abae665ca71d8ec 100644 > --- a/drivers/input/touchscreen/st1232.c > +++ b/drivers/input/touchscreen/st1232.c > @@ -94,8 +94,13 @@ static int st1232_ts_wait_ready(struct st1232_ts_data *ts) > > for (retries = 10; retries; retries--) { > error = st1232_ts_read_data(ts, REG_STATUS, 1); > - if (!error && ts->read_buf[0] == (STATUS_NORMAL | STATUS_IDLE | ERROR_NONE)) > - return 0; > + if (!error) { > + switch (ts->read_buf[0]) { > + case STATUS_NORMAL | ERROR_NONE: > + case STATUS_IDLE | ERROR_NONE: > + return 0; > + } > + } > > usleep_range(1000, 2000); > } > -- > 2.25.1 > >