Skip to contentSkip to conversation

iio: accel: fix ADXL355 temperature signature value

PATCH Applied Andrej Valek 4 participants 5 messages Mar 13 – Mar 22

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: accel: fix ADXL355 temperature signature value

From: "Valek Andrej <[email protected]>"

Temperature was wrongly represented as 12-bit signature, confirmed by DS. Even if the temperature is negative, the value in the register stays unsigned.

---
 drivers/iio/accel/adxl355_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/adxl355_core.c +1 -1
index 1c1d64d5cbcb2..8f90c58f41008 100644
@@ -745,7 +745,7 @@ static const struct iio_chan_spec adxl355_channels[] = {
 				      BIT(IIO_CHAN_INFO_OFFSET),
 		.scan_index = 3,
 		.scan_type = {
-			.sign = 's',
+			.sign = 'u',
 			.realbits = 12,
 			.storagebits = 16,
 			.endianness = IIO_BE,
Signature · 1 line
2.34.1
reviewer
#1 lore raw
Quoted 3 lines · Andrej Valek

From: "Valek Andrej <[email protected]>"

Temperature was wrongly represented as 12-bit signature, confirmed by DS.

signature == signed integer?

DS == datasheet?

Quoted 2 lines

Even if the temperature is negative, the value in the register stays unsigned.

And IIO_CHAN_INFO_OFFSET will be negative.

Quoted 19 lines
---
 drivers/iio/accel/adxl355_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/adxl355_core.c +1 -1
index 1c1d64d5cbcb2..8f90c58f41008 100644
@@ -745,7 +745,7 @@ static const struct iio_chan_spec adxl355_channels[] = {
 				      BIT(IIO_CHAN_INFO_OFFSET),
 		.scan_index = 3,
 		.scan_type = {
-			.sign = 's',
+			.sign = 'u',
 			.realbits = 12,
 			.storagebits = 16,
 			.endianness = IIO_BE,
#2 lore raw

Ah, I see, I described it wrongly.

Quoted 5 lines · David Lechner
Quoted 3 lines · Andrej Valek

From: "Valek Andrej <[email protected]>"

Temperature was wrongly represented as 12-bit signature, confirmed by DS.

signature == signed integer?

Correct, temperature is wrongly represented as signed 12-bit number, while it has to be unsigned.

Quoted 2 lines

DS == datasheet?

Yes

Quoted 4 lines
Quoted 3 lines

Even if the temperature is negative, the value in the register stays unsigned.

And IIO_CHAN_INFO_OFFSET will be negative.

Not sure what do you mean by this. I can only say, that output type was "be:s12/16>>0" and should be "be:u12/16>>0". So when some upper layer wanted to represent the number it "overflowed", while the bits have been masked.

Quoted 6 lines
Quoted 6 lines
---
  drivers/iio/accel/adxl355_core.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines

drivers/iio/accel/adxl355_core.c static const struct iio_chan_spec adxl355_channels[] = { · line 751

Quoted 13 lines
drivers/iio/accel/adxl355_core.c +1 -1
index 1c1d64d5cbcb2..8f90c58f41008 100644
@@ -745,7 +745,7 @@ static const struct iio_chan_spec adxl355_channels[] = {
  				      BIT(IIO_CHAN_INFO_OFFSET),
  		.scan_index = 3,
  		.scan_type = {
-			.sign = 's',
+			.sign = 'u',
  			.realbits = 12,
  			.storagebits = 16,
  			.endianness = IIO_BE,

Conclusion = Should I send a new version with "fixed" description?

BR,
Andy

reviewer
#3 lore raw
Quoted 10 lines · Andrej Valek

Ah, I see, I described it wrongly.

Quoted 5 lines · David Lechner
Quoted 3 lines · Andrej Valek

From: "Valek Andrej <[email protected]>"

Temperature was wrongly represented as 12-bit signature, confirmed by DS.

signature == signed integer?

Correct, temperature is wrongly represented as signed 12-bit number, while it has to be unsigned.

Quoted 1 line
Quoted 7 lines
Quoted 1 line

DS == datasheet?

Yes

Quoted 4 lines
Quoted 3 lines

Even if the temperature is negative, the value in the register stays unsigned.

And IIO_CHAN_INFO_OFFSET will be negative.

Not sure what do you mean by this. I can only say, that output type was "be:s12/16>>0" and should be "be:u12/16>>0". So when some upper layer wanted to represent the number it "overflowed", while the bits have been masked.

Mostly I was talking to myself on this point. No action is needed here.

Quoted 21 lines
Quoted 6 lines
Quoted 6 lines

---
  drivers/iio/accel/adxl355_core.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines

drivers/iio/accel/adxl355_core.c static const struct iio_chan_spec adxl355_channels[] = { · line 751

Quoted 13 lines
drivers/iio/accel/adxl355_core.c +1 -1
index 1c1d64d5cbcb2..8f90c58f41008 100644
@@ -745,7 +745,7 @@ static const struct iio_chan_spec adxl355_channels[] = {
                         BIT(IIO_CHAN_INFO_OFFSET),
           .scan_index = 3,
           .scan_type = {
-            .sign = 's',
+            .sign = 'u',
               .realbits = 12,
               .storagebits = 16,
               .endianness = IIO_BE,
Quoted 1 line

Conclusion = Should I send a new version with "fixed" description?

Sometimes, for small tweaks, Jonathan will just fix it while applying the patch. So wait for for his feedback.

You can also see the status of the patch in patchwork at [1]. If the State changes to "Changes requested", then you know a new version is expected. Right now, it says "New" which means he hasn't looked at it or made a decision yet.

[1]: https://patchwork.kernel.org/project/linux-iio/patch/[email protected]/

Quoted 3 lines

BR,
Andy

maintainer Applied
#4 lore raw
Quoted 47 lines · On Sun, 15 Mar 2026 11:18:18 -0500 David Lechner <[email protected]> wrote:
Quoted 10 lines · Andrej Valek

Ah, I see, I described it wrongly.

Quoted 5 lines · David Lechner
Quoted 3 lines · Andrej Valek

From: "Valek Andrej <[email protected]>"

Temperature was wrongly represented as 12-bit signature, confirmed by DS.

signature == signed integer?

Correct, temperature is wrongly represented as signed 12-bit number, while it has to be unsigned.

Quoted 1 line
Quoted 7 lines
Quoted 1 line

DS == datasheet?

Yes

Quoted 4 lines
Quoted 3 lines

Even if the temperature is negative, the value in the register stays unsigned.

And IIO_CHAN_INFO_OFFSET will be negative.

Not sure what do you mean by this. I can only say, that output type was "be:s12/16>>0" and should be "be:u12/16>>0". So when some upper layer wanted to represent the number it "overflowed", while the bits have been masked.

Mostly I was talking to myself on this point. No action is needed here.

Quoted 21 lines
Quoted 6 lines
Quoted 6 lines

---
  drivers/iio/accel/adxl355_core.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines

drivers/iio/accel/adxl355_core.c static const struct iio_chan_spec adxl355_channels[] = { · line 751

Quoted 13 lines
drivers/iio/accel/adxl355_core.c +1 -1
index 1c1d64d5cbcb2..8f90c58f41008 100644
@@ -745,7 +745,7 @@ static const struct iio_chan_spec adxl355_channels[] = {
                         BIT(IIO_CHAN_INFO_OFFSET),
           .scan_index = 3,
           .scan_type = {
-            .sign = 's',
+            .sign = 'u',
               .realbits = 12,
               .storagebits = 16,
               .endianness = IIO_BE,  
Quoted 1 line

Conclusion = Should I send a new version with "fixed" description?

Sometimes, for small tweaks, Jonathan will just fix it while applying the patch. So wait for for his feedback.

Quoted 7 lines

You can also see the status of the patch in patchwork at [1]. If the State changes to "Changes requested", then you know a new version is expected. Right now, it says "New" which means he hasn't looked at it or made a decision yet.

[1]: https://patchwork.kernel.org/project/linux-iio/patch/[email protected]/

Busy few weeks. Catching up now.

This also needs a fixes tag to indicate how far back we should be looking to backport it.

Looks like it was all the way so I've added one.

Fixes 12ed27863ea3 ("iio: accel: Add driver support for ADXL355")

Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,

Jonathan

Quoted 6 lines
Quoted 4 lines

BR,
Andy