]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iio: accel: adxl345: Implement event scaling for ABI compliance
authorTaha Ed-Dafili <0rayn.dev@gmail.com>
Thu, 26 Feb 2026 15:11:05 +0000 (15:11 +0000)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 1 Mar 2026 12:04:23 +0000 (12:04 +0000)
commit9fb007705c77b85bfad2d3d4818ebcd5fcfa9571
tree322c20c16f21c00cfa7e9dd733f6be4dc5bea91f
parentda29db0bcc95fb554ce9969ab57ba8f84c405be7
iio: accel: adxl345: Implement event scaling for ABI compliance

The ADXL345 uses a fixed threshold resolution of 62.5 mg/LSB for
event-related registers. Previously, the driver reported raw
values without a scale factor.

Implement IIO_EV_INFO_SCALE for all event types to provide the
conversion factor (0.612915 m/s^2) as required by the IIO ABI.

Consequently, remove the obsolete comment in adxl345_read_event_value()
which stated that the scale factor is not applied.

Add explicit write rejection for IIO_EV_INFO_SCALE in
adxl345_write_event_value() returning -EINVAL.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Taha Ed-Dafili <0rayn.dev@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/accel/adxl345_core.c