* [PATCH] iio: magnetometer: tlv493d: remove erroneous shift in X-axis data
@ 2026-02-10 16:49 Antoniu Miclaus
2026-02-18 19:20 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Antoniu Miclaus @ 2026-02-10 16:49 UTC (permalink / raw)
To: Dixit Parmar, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, linux-kernel
Cc: Antoniu Miclaus
TLV493D_BX2_MAG_X_AXIS_LSB is defined as GENMASK(7, 4). FIELD_GET()
already right-shifts bits [7:4] to [3:0], so the additional >> 4
discards most of the X-axis low nibble. The Y and Z axes correctly
omit this extra shift. Remove it.
Fixes: 106511d280c7 ("iio: magnetometer: add support for Infineon TLV493D 3D Magentic sensor")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/magnetometer/tlv493d.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/magnetometer/tlv493d.c b/drivers/iio/magnetometer/tlv493d.c
index ec53fd40277b..e5e050af2b74 100644
--- a/drivers/iio/magnetometer/tlv493d.c
+++ b/drivers/iio/magnetometer/tlv493d.c
@@ -171,7 +171,7 @@ static s16 tlv493d_get_channel_data(u8 *b, enum tlv493d_channels ch)
switch (ch) {
case TLV493D_AXIS_X:
val = FIELD_GET(TLV493D_BX_MAG_X_AXIS_MSB, b[TLV493D_RD_REG_BX]) << 4 |
- FIELD_GET(TLV493D_BX2_MAG_X_AXIS_LSB, b[TLV493D_RD_REG_BX2]) >> 4;
+ FIELD_GET(TLV493D_BX2_MAG_X_AXIS_LSB, b[TLV493D_RD_REG_BX2]);
break;
case TLV493D_AXIS_Y:
val = FIELD_GET(TLV493D_BY_MAG_Y_AXIS_MSB, b[TLV493D_RD_REG_BY]) << 4 |
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] iio: magnetometer: tlv493d: remove erroneous shift in X-axis data
2026-02-10 16:49 [PATCH] iio: magnetometer: tlv493d: remove erroneous shift in X-axis data Antoniu Miclaus
@ 2026-02-18 19:20 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2026-02-18 19:20 UTC (permalink / raw)
To: Antoniu Miclaus
Cc: Dixit Parmar, David Lechner, Nuno Sá, Andy Shevchenko,
linux-iio, linux-kernel
On Tue, 10 Feb 2026 18:49:50 +0200
Antoniu Miclaus <antoniu.miclaus@analog.com> wrote:
> TLV493D_BX2_MAG_X_AXIS_LSB is defined as GENMASK(7, 4). FIELD_GET()
> already right-shifts bits [7:4] to [3:0], so the additional >> 4
> discards most of the X-axis low nibble. The Y and Z axes correctly
> omit this extra shift. Remove it.
>
> Fixes: 106511d280c7 ("iio: magnetometer: add support for Infineon TLV493D 3D Magentic sensor")
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Applied and marked for stable. I'll be rebasing in a few days anyway, so
happy to add tags or indeed drop the patch if other reviews come in before then
Thanks,
Jonathan
> ---
> drivers/iio/magnetometer/tlv493d.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/magnetometer/tlv493d.c b/drivers/iio/magnetometer/tlv493d.c
> index ec53fd40277b..e5e050af2b74 100644
> --- a/drivers/iio/magnetometer/tlv493d.c
> +++ b/drivers/iio/magnetometer/tlv493d.c
> @@ -171,7 +171,7 @@ static s16 tlv493d_get_channel_data(u8 *b, enum tlv493d_channels ch)
> switch (ch) {
> case TLV493D_AXIS_X:
> val = FIELD_GET(TLV493D_BX_MAG_X_AXIS_MSB, b[TLV493D_RD_REG_BX]) << 4 |
> - FIELD_GET(TLV493D_BX2_MAG_X_AXIS_LSB, b[TLV493D_RD_REG_BX2]) >> 4;
> + FIELD_GET(TLV493D_BX2_MAG_X_AXIS_LSB, b[TLV493D_RD_REG_BX2]);
> break;
> case TLV493D_AXIS_Y:
> val = FIELD_GET(TLV493D_BY_MAG_Y_AXIS_MSB, b[TLV493D_RD_REG_BY]) << 4 |
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-18 19:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-10 16:49 [PATCH] iio: magnetometer: tlv493d: remove erroneous shift in X-axis data Antoniu Miclaus
2026-02-18 19:20 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox