public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NFC: trf7970a: Ignore antenna noise when checking for RF field
@ 2026-04-22 10:09 Paul Geurts
  2026-04-24  9:39 ` Krzysztof Kozlowski
  2026-04-24 16:20 ` Mark Greer
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Geurts @ 2026-04-22 10:09 UTC (permalink / raw)
  To: mgreer, sameo, linux-wireless, netdev, linux-kernel
  Cc: martijn.de.gouw, Paul Geurts

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 <paul.geurts@prodrive-technologies.com>
---
 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 d17c701c7888..08c27bb438b5 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.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] NFC: trf7970a: Ignore antenna noise when checking for RF field
  2026-04-22 10:09 [PATCH] NFC: trf7970a: Ignore antenna noise when checking for RF field Paul Geurts
@ 2026-04-24  9:39 ` Krzysztof Kozlowski
  2026-04-24 16:20 ` Mark Greer
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2026-04-24  9:39 UTC (permalink / raw)
  To: Paul Geurts, mgreer, sameo, linux-wireless, netdev, linux-kernel
  Cc: martijn.de.gouw

On 22/04/2026 12:09, Paul Geurts wrote:
> 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 <paul.geurts@prodrive-technologies.com>
> ---
>  drivers/nfc/trf7970a.c | 3 ++-

Looks reasonable so a poor man's review:

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] NFC: trf7970a: Ignore antenna noise when checking for RF field
  2026-04-22 10:09 [PATCH] NFC: trf7970a: Ignore antenna noise when checking for RF field Paul Geurts
  2026-04-24  9:39 ` Krzysztof Kozlowski
@ 2026-04-24 16:20 ` Mark Greer
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Greer @ 2026-04-24 16:20 UTC (permalink / raw)
  To: Paul Geurts, sameo, linux-wireless, netdev, linux-kernel; +Cc: martijn.de.gouw


On 4/22/26 3:09 AM, Paul Geurts wrote:
> 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 <paul.geurts@prodrive-technologies.com>
> ---
>   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 d17c701c7888..08c27bb438b5 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;

Given that false positives are happening in the field and assuming that 
a value of 1 is enough to filter out those false positives, this seems 
like a reasonable solution.

Reviewed-by: Mark Greer <mgreer@animalcreek.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-24 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-22 10:09 [PATCH] NFC: trf7970a: Ignore antenna noise when checking for RF field Paul Geurts
2026-04-24  9:39 ` Krzysztof Kozlowski
2026-04-24 16:20 ` Mark Greer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox