Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2225929pxb; Tue, 23 Feb 2021 01:31:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAnQmoa+HbwbRE3xHSZntvdqzVvRk09HROcQ+w0PYuX38E4zYgwTSDh9Z9eaISQScrQQbP X-Received: by 2002:a17:907:1186:: with SMTP id uz6mr25439341ejb.330.1614072662032; Tue, 23 Feb 2021 01:31:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614072662; cv=none; d=google.com; s=arc-20160816; b=z4dTGM27zBLoWGK0/l7LkoHJh4zOsi5mwspzqguO61M4fQW7dVeQ6LVn+rvQ0CXBn3 WuRBFMkeJ5DRZ5NOJ5nESSoSWuUyWL43csGFmRVoRtIFMjeUgDljHn9XFVZuP3VL7OIS YhuJifHnNVDXIHCqv1SzqIIbp6RtMyqJNSIqteYKUii3j5LIlKKP6NjnQwnjqX58zj8/ dwFuX0dH+oasjsmp1BT+YJC0Ij4F7EHeds2YAY2CMKGaKZyIQIPS75BCJjMvp+e+QuU7 d3lV+cT6Z5/D+GRPHFfYa03dBnFiV4893+ugb5cEaA2MEQSxcSmx7M3cpd+LIg6xhgOG vgNw== 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 :message-id:date:subject:cc:to:from; bh=qJ9+DMqSHepSEGbYfTJ6bYFKBKiaajZSiSIv6R/H/eU=; b=GrCfOVvfysiu58G1kAUGScn5MsTCqEM4EvEnqRQmJk2/JMfwOY2lWSq+hswmL4Bvbt Hu/djI4eeK64hwcoljdlgI54jDEVxLs/xOLqlLKH3vPeDxxg0CjzLZ8GDb8cHjPhBWtv mNvj7VTn4ETPsqSiY2RDoblMuL1KF4P8nHIYWuH4vfhfr7/nlHj0DFE1IeQld2Bgy9UP 7B8J7KtbWiUPlTjUyAr3kSlkD43GN3ZIrJd1cpsNxSqi6qleh0nmdoTQJisAyGYzM7yu XnopGvAoHzP5aOxV1EA1+Qt++nOt0wRSdb83cGgLeqHzn2HHvflOv2qtqoVwiOHKFC/a O+Ww== 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 fs18si4039559ejc.644.2021.02.23.01.30.33; Tue, 23 Feb 2021 01:31: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 S232163AbhBWJD6 (ORCPT + 99 others); Tue, 23 Feb 2021 04:03:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232056AbhBWJDE (ORCPT ); Tue, 23 Feb 2021 04:03:04 -0500 Received: from baptiste.telenet-ops.be (unknown [IPv6:2a02:1800:120:4::f00:13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 895ADC06174A for ; Tue, 23 Feb 2021 01:02:23 -0800 (PST) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed20:254f:253d:debc:790b]) by baptiste.telenet-ops.be with bizsmtp id YZ262401Z1v7dkx01Z266N; Tue, 23 Feb 2021 10:02:06 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1lETa2-000zVr-AV; Tue, 23 Feb 2021 10:02:06 +0100 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1lETa1-0060Pd-F7; Tue, 23 Feb 2021 10:02:05 +0100 From: Geert Uytterhoeven To: Dmitry Torokhov , Michael Tretter Cc: Andrej Valek , linux-input@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] Input: st1232 - Fix NORMAL vs. IDLE state handling Date: Tue, 23 Feb 2021 10:02:01 +0100 Message-Id: <20210223090201.1430542-1-geert+renesas@glider.be> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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 --- 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