diff options
author | Jin Feng <jin88.feng@gmail.com> | 2013-04-05 04:51:00 (GMT) |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-04-09 17:29:52 (GMT) |
commit | ff3fc8eb470ff0e47466c291148a30f958d6691d (patch) | |
tree | 6ec3b220e5bf47f3df66373b54526ccc64b75c8f /drivers/staging/iio/iio_simple_dummy.c | |
parent | 9f16778c5d0a32f264812a9bf1602b71613720b8 (diff) | |
download | linux-ff3fc8eb470ff0e47466c291148a30f958d6691d.tar.xz |
staging:iio:dummy: Fix mismatch and export sysfs entry
Correct the mismatch bewteen calibscale and calibbias, and export
the in_accel_calibscale sysfs entry
Updated to apply to current tree.
Signed-off-by: Jin Feng <jin88.feng@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/staging/iio/iio_simple_dummy.c')
-rw-r--r-- | drivers/staging/iio/iio_simple_dummy.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c index 0193e17..0e8e02a 100644 --- a/drivers/staging/iio/iio_simple_dummy.c +++ b/drivers/staging/iio/iio_simple_dummy.c @@ -166,11 +166,12 @@ static const struct iio_chan_spec iio_dummy_channels[] = { .channel2 = IIO_MOD_X, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | /* - * Internal bias correction value. Applied + * Internal bias and gain correction values. Applied * by the hardware or driver prior to userspace * seeing the readings. Typically part of hardware * calibration. */ + BIT(IIO_CHAN_INFO_CALIBSCALE) | BIT(IIO_CHAN_INFO_CALIBBIAS), .scan_index = accelx, .scan_type = { /* Description of storage in buffer */ @@ -311,7 +312,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++) @@ -324,6 +325,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; } |