diff --git a/crates/scmi/kernel/iio-dummy/README.md b/crates/scmi/kernel/iio-dummy/README.md index ed87101..59e16f4 100644 --- a/crates/scmi/kernel/iio-dummy/README.md +++ b/crates/scmi/kernel/iio-dummy/README.md @@ -14,6 +14,7 @@ Otherwise, this alternative is provided with the following changes: - Simplified Makefile for out of tree compilation. - The accelerometer has three axes instead of just one. +- The Y axis of the accelerometer has offset and scale. Of course, you can modified it further for your liking if needed. diff --git a/crates/scmi/kernel/iio-dummy/iio_modified_dummy.c b/crates/scmi/kernel/iio-dummy/iio_modified_dummy.c index 7504489..dd5e594 100644 --- a/crates/scmi/kernel/iio-dummy/iio_modified_dummy.c +++ b/crates/scmi/kernel/iio-dummy/iio_modified_dummy.c @@ -16,6 +16,7 @@ * * - Dropped conditional parts. * - Use 3 axes in the accelerometer device. + * - Define offset and scale for some of the accelerometer axes. */ #include #include @@ -184,6 +185,9 @@ static const struct iio_chan_spec iio_dummy_channels[] = { /* Channel 2 is use for modifiers */ .channel2 = IIO_MOD_Y, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_OFFSET) | + BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_CALIBSCALE) | BIT(IIO_CHAN_INFO_CALIBBIAS), .info_mask_shared_by_dir = BIT(IIO_CHAN_INFO_SAMP_FREQ), @@ -352,6 +356,15 @@ static int iio_dummy_read_raw(struct iio_dev *indio_dev, *val2 = 1344; ret = IIO_VAL_INT_PLUS_NANO; } + break; + case IIO_ACCEL: + switch(chan->scan_index) { + case DUMMY_INDEX_ACCEL_Y: + *val = 0; + *val2 = 1344; + break; + } + ret = IIO_VAL_INT_PLUS_MICRO; break; default: break;