iio: accel: adxl313: add function to enable measurement
authorLothar Rubusch <l.rubusch@gmail.com>
Wed, 2 Jul 2025 23:08:13 +0000 (23:08 +0000)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 13 Jul 2025 14:36:26 +0000 (15:36 +0100)
commita1576623416a564c6561c722279c03fd0128f39d
treec55e0c0c84c441b62689b96343cd20e194417670
parentec489d91571ee85aa70f8a25f3882a6e97390ab4
iio: accel: adxl313: add function to enable measurement

Refactor the control of measurement and standby modes for the sensor.
Instead of directly writing to the register, encapsulate this operation
in a dedicated function that handles enabling and disabling measurement.
This approach will reduce code duplication wherever sensor configuration
changes are required. In subsequent patches, measurement mode will be
set to standby as part of this process.

Additionally, simplify the control mask to include only the measurement
bit. The sleep bit governs a different behavior—putting the sensor into
sleep mode, not just standby for configuration—and is currently unused.
Therefore, there's no need to include both the sleep and measurement
bits in the same mask.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250702230819.19353-3-l.rubusch@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/accel/adxl313.h
drivers/iio/accel/adxl313_core.c