aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/light/cm32181.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iio/light/cm32181.c')
-rw-r--r--drivers/iio/light/cm32181.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/iio/light/cm32181.c b/drivers/iio/light/cm32181.c
index f17b4e6183c6..47a6dbac2d0c 100644
--- a/drivers/iio/light/cm32181.c
+++ b/drivers/iio/light/cm32181.c
@@ -103,13 +103,13 @@ static int cm32181_reg_init(struct cm32181_chip *cm32181)
103/** 103/**
104 * cm32181_read_als_it() - Get sensor integration time (ms) 104 * cm32181_read_als_it() - Get sensor integration time (ms)
105 * @cm32181: pointer of struct cm32181 105 * @cm32181: pointer of struct cm32181
106 * @val: pointer of int to load the als_it value. 106 * @val2: pointer of int to load the als_it value.
107 * 107 *
108 * Report the current integartion time by millisecond. 108 * Report the current integartion time by millisecond.
109 * 109 *
110 * Return: IIO_VAL_INT for success, otherwise -EINVAL. 110 * Return: IIO_VAL_INT_PLUS_MICRO for success, otherwise -EINVAL.
111 */ 111 */
112static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val) 112static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val2)
113{ 113{
114 u16 als_it; 114 u16 als_it;
115 int i; 115 int i;
@@ -119,8 +119,8 @@ static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val)
119 als_it >>= CM32181_CMD_ALS_IT_SHIFT; 119 als_it >>= CM32181_CMD_ALS_IT_SHIFT;
120 for (i = 0; i < ARRAY_SIZE(als_it_bits); i++) { 120 for (i = 0; i < ARRAY_SIZE(als_it_bits); i++) {
121 if (als_it == als_it_bits[i]) { 121 if (als_it == als_it_bits[i]) {
122 *val = als_it_value[i]; 122 *val2 = als_it_value[i];
123 return IIO_VAL_INT; 123 return IIO_VAL_INT_PLUS_MICRO;
124 } 124 }
125 } 125 }
126 126
@@ -221,7 +221,7 @@ static int cm32181_read_raw(struct iio_dev *indio_dev,
221 *val = cm32181->calibscale; 221 *val = cm32181->calibscale;
222 return IIO_VAL_INT; 222 return IIO_VAL_INT;
223 case IIO_CHAN_INFO_INT_TIME: 223 case IIO_CHAN_INFO_INT_TIME:
224 ret = cm32181_read_als_it(cm32181, val); 224 ret = cm32181_read_als_it(cm32181, val2);
225 return ret; 225 return ret;
226 } 226 }
227 227
@@ -240,7 +240,7 @@ static int cm32181_write_raw(struct iio_dev *indio_dev,
240 cm32181->calibscale = val; 240 cm32181->calibscale = val;
241 return val; 241 return val;
242 case IIO_CHAN_INFO_INT_TIME: 242 case IIO_CHAN_INFO_INT_TIME:
243 ret = cm32181_write_als_it(cm32181, val); 243 ret = cm32181_write_als_it(cm32181, val2);
244 return ret; 244 return ret;
245 } 245 }
246 246
@@ -264,7 +264,7 @@ static ssize_t cm32181_get_it_available(struct device *dev,
264 264
265 n = ARRAY_SIZE(als_it_value); 265 n = ARRAY_SIZE(als_it_value);
266 for (i = 0, len = 0; i < n; i++) 266 for (i = 0, len = 0; i < n; i++)
267 len += sprintf(buf + len, "%d ", als_it_value[i]); 267 len += sprintf(buf + len, "0.%06u ", als_it_value[i]);
268 return len + sprintf(buf + len, "\n"); 268 return len + sprintf(buf + len, "\n");
269} 269}
270 270