staging:iio:dummy: Fix mismatch and export sysfs entry
Subsystems (3)
PATCH 1/1 staging:iio:dummy: Fix mismatch and export sysfs entry
Correct the mismatch bewteen calibscale and calibbias, and export the in_accel_calibscale sysfs entry
Signed-off-by Jin Feng <[email protected]>
--- drivers/staging/iio/iio_simple_dummy.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/staging/iio/iio_simple_dummy.c +8 -1
@@ -168,6 +168,7 @@ static const struct iio_chan_spec iio_dummy_channels[] = { .channel2 = IIO_MOD_X, .info_mask =IIO_CHAN_INFO_RAW_SEPARATE_BIT | + IIO_CHAN_INFO_CALIBSCALE_SHARED_BIT |/* * Internal bias correction value. Applied * by the hardware or driver prior to userspace
@@ -314,7 +315,7 @@ static int iio_dummy_write_raw(struct iio_dev *indio_dev, st->dac_val = val;mutex_unlock (&st->lock);return 0 ; -case IIO_CHAN_INFO_CALIBBIAS : +case IIO_CHAN_INFO_CALIBSCALE :mutex_lock (&st->lock);/* Compare against table - hard matching here */ for (i =0 ; i <ARRAY_SIZE (dummy_scales); i++)
@@ -327,6 +328,12 @@ static int iio_dummy_write_raw(struct iio_dev *indio_dev, st->accel_calibscale = &dummy_scales[i];mutex_unlock (&st->lock);return ret; +case IIO_CHAN_INFO_CALIBBIAS : +mutex_lock (&st->lock); + st->accel_calibbias = val; +mutex_unlock (&st->lock); +return 0 ; +default :return -EINVAL ; }
Signature · 1 line
1.7.9.5