From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9939A39B483; Wed, 20 May 2026 17:51:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779299464; cv=none; b=TWTBFd3Wn5dlnVomqSIO0oXRMgiF4bTSmkvtNqT0v+mFcqoCkyQKpAplgHPqig+v1bEP9GJv/ece870juzSV4BWSmAXWrLqMOcsXF+N/b7MrwRP/ZQejODDiQetTpdHivjU3oS0JFL5f+IUZ27iypF5mnTQ53owfhJ1m7+Fv7PI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779299464; c=relaxed/simple; bh=SKsYaqiPjur4Qt8yQp5s7iMcHqM4i94sXs2S6jqicPQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L+oCEZG3Ji09j2JJ9ZUCj4Ml8D6ABm+veDkFd7Z8m4WZ/B521qvvptZ2eGy+3Rn3ksfRionMP1zClfddS7kR5S1LYFbCvpwqZ8DS7DGi4abcm4aoBI3mQHmXhPRMEG+AqXjy7aXs/4aZ8+8EQjU9HZKYw14auIkz9/swEWPQeKY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MW0RDbTd; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="MW0RDbTd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0ADB81F000E9; Wed, 20 May 2026 17:51:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779299463; bh=WxLQwceetoX4JHjQ5Bm3i1kNGUgqaau9Y270G38c9CI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MW0RDbTdH9v3NPCev2D395vPS6zT5M8FbRaXCI0/S8dJpQlAcK+J09cF23vchkU7g EuGY+r5Nr7qmrLHrBE9fj0QmEgaTyTc5+aJvqCzqiCqw9SK4cS9abGJU28M/upMMTm yAeoMaKedcb8FbgWy224WXKn09DeikXcmR2wa23U= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Paul Geurts , Krzysztof Kozlowski , Mark Greer , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.18 781/957] NFC: trf7970a: Ignore antenna noise when checking for RF field Date: Wed, 20 May 2026 18:21:04 +0200 Message-ID: <20260520162151.497495025@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162134.554764788@linuxfoundation.org> References: <20260520162134.554764788@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paul Geurts [ Upstream commit a9bc28aa4e64320668131349436a650bf42591a5 ] The main channel Received Signal Strength Indicator (RSSI) measurement is used to determine whether an RF field is present or not. RSSI != 0 is interpreted as an RF Field is present. This does not take RF noise and measurement inaccuracy into account, and results in false positives in the field. Define a noise level and make sure the RF field is only interpreted as present when the RSSI is above the noise level. Fixes: 851ee3cbf850 ("NFC: trf7970a: Don't turn on RF if there is already an RF field") Signed-off-by: Paul Geurts Reviewed-by: Krzysztof Kozlowski Reviewed-by: Mark Greer Link: https://patch.msgid.link/20260422100930.581237-1-paul.geurts@prodrive-technologies.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/nfc/trf7970a.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c index d17c701c7888b..08c27bb438b59 100644 --- a/drivers/nfc/trf7970a.c +++ b/drivers/nfc/trf7970a.c @@ -317,6 +317,7 @@ #define TRF7970A_RSSI_OSC_STATUS_RSSI_MASK (BIT(2) | BIT(1) | BIT(0)) #define TRF7970A_RSSI_OSC_STATUS_RSSI_X_MASK (BIT(5) | BIT(4) | BIT(3)) #define TRF7970A_RSSI_OSC_STATUS_RSSI_OSC_OK BIT(6) +#define TRF7970A_RSSI_OSC_STATUS_RSSI_NOISE_LEVEL 1 #define TRF7970A_SPECIAL_FCN_REG1_COL_7_6 BIT(0) #define TRF7970A_SPECIAL_FCN_REG1_14_ANTICOLL BIT(1) @@ -1300,7 +1301,7 @@ static int trf7970a_is_rf_field(struct trf7970a *trf, bool *is_rf_field) if (ret) return ret; - if (rssi & TRF7970A_RSSI_OSC_STATUS_RSSI_MASK) + if ((rssi & TRF7970A_RSSI_OSC_STATUS_RSSI_MASK) > TRF7970A_RSSI_OSC_STATUS_RSSI_NOISE_LEVEL) *is_rf_field = true; else *is_rf_field = false; -- 2.53.0