Skip to contentSkip to conversation

staging:iio:dummy: Fix mismatch and export sysfs entry

PATCH New Jin Feng 1 participant 1 message Apr 5, 2013

Subsystems (3)
lore
Share & tools
lore

Jin Feng

author
#0 lore raw

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

---
 drivers/staging/iio/iio_simple_dummy.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/staging/iio/iio_simple_dummy.c +8 -1
index aee76c7..4f2e876 100644
@@ -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