* [PATCH] iio: afe: rescale: always expose offset
@ 2026-10-12 8:28 Andrea Amer via B4 Relay
2026-10-12 21:23 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Andrea Amer via B4 Relay @ 2026-10-12 8:28 UTC (permalink / raw)
To: Peter Rosin, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, Liam Beguin
Cc: linux-iio, linux-kernel, Jonathan Cameron, Andrea Amer
From: Andrea Amer <and.amer@gmail.com>
A rescale channel advertises IIO_CHAN_INFO_OFFSET only when its own
offset is non-zero. A child rescale therefore hides a source offset,
and consumers apply raw * scale and drop it. rescale_read_raw() already
folds the source offset in, so expose the attribute in every case.
Fixes: a29c3283653b ("iio: afe: rescale: add offset support")
Signed-off-by: Andrea Amer <and.amer@gmail.com>
---
drivers/iio/afe/iio-rescale.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/afe/iio-rescale.c b/drivers/iio/afe/iio-rescale.c
index 3a6a09ffa5267ddfd5131fbd04a5df928836589d..52be28cdb0c7e7c16a52329fe5d93459480736e0 100644
--- a/drivers/iio/afe/iio-rescale.c
+++ b/drivers/iio/afe/iio-rescale.c
@@ -301,10 +301,9 @@ static int rescale_configure_channel(struct device *dev,
}
chan->info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
- BIT(IIO_CHAN_INFO_SCALE);
+ BIT(IIO_CHAN_INFO_SCALE) |
+ BIT(IIO_CHAN_INFO_OFFSET);
- if (rescale->offset)
- chan->info_mask_separate |= BIT(IIO_CHAN_INFO_OFFSET);
/*
* Using .read_avail() is fringe to begin with and makes no sense
---
base-commit: a3b3580713f3ac5a32dc2874ee546828977a1d68
change-id: 20261012-iio-rescale-offset-41254a33b6d6
Best regards,
--
Andrea Amer <and.amer@gmail.com>
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] iio: afe: rescale: always expose offset
2026-10-12 8:28 [PATCH] iio: afe: rescale: always expose offset Andrea Amer via B4 Relay
@ 2026-10-12 21:23 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2026-10-12 21:23 UTC (permalink / raw)
To: and.amer
Cc: Peter Rosin, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, Liam Beguin, linux-iio, linux-kernel
On Mon, Oct 12, 2026 at 10:28:53AM +0200, Andrea Amer via B4 Relay wrote:
> A rescale channel advertises IIO_CHAN_INFO_OFFSET only when its own
> offset is non-zero. A child rescale therefore hides a source offset,
> and consumers apply raw * scale and drop it. rescale_read_raw() already
> folds the source offset in, so expose the attribute in every case.
...
> chan->info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> - BIT(IIO_CHAN_INFO_SCALE);
> + BIT(IIO_CHAN_INFO_SCALE) |
> + BIT(IIO_CHAN_INFO_OFFSET);
Make it less churn by not changing line for _SCALE.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-12 21:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-12 8:28 [PATCH] iio: afe: rescale: always expose offset Andrea Amer via B4 Relay
2026-10-12 21:23 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®