Skip to content

Commit 81d5a53

Browse files
airtower-lunajic23
authored andcommitted
iio: chemical: scd4x: fix reported channel endianness
The driver converts values read from the sensor from BE to CPU endianness in scd4x_read_meas(). The result is then pushed into the buffer in scd4x_trigger_handler(), so on LE architectures parsing the buffer using the reported BE type gave wrong results. scd4x_read_raw() which provides sysfs *_raw values is not affected, it used the values returned by scd4x_read_meas() without further conversion. Fixes: 49d22b6 ("drivers: iio: chemical: Add support for Sensirion SCD4x CO2 sensor") Signed-off-by: Fiona Klute <fiona.klute@gmx.de> Reviewed-by: David Lechner <dlechner@baylibre.com> Cc: <stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 943cbf9 commit 81d5a53

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/iio/chemical/scd4x.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ static const struct iio_chan_spec scd4x_channels[] = {
584584
.sign = 'u',
585585
.realbits = 16,
586586
.storagebits = 16,
587-
.endianness = IIO_BE,
587+
.endianness = IIO_CPU,
588588
},
589589
},
590590
{
@@ -599,7 +599,7 @@ static const struct iio_chan_spec scd4x_channels[] = {
599599
.sign = 'u',
600600
.realbits = 16,
601601
.storagebits = 16,
602-
.endianness = IIO_BE,
602+
.endianness = IIO_CPU,
603603
},
604604
},
605605
{
@@ -612,7 +612,7 @@ static const struct iio_chan_spec scd4x_channels[] = {
612612
.sign = 'u',
613613
.realbits = 16,
614614
.storagebits = 16,
615-
.endianness = IIO_BE,
615+
.endianness = IIO_CPU,
616616
},
617617
},
618618
};

0 commit comments

Comments
 (0)