aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/pressure
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@kernel.org>2014-06-22 15:59:00 -0400
committerJonathan Cameron <jic23@kernel.org>2014-07-07 04:39:57 -0400
commit2d239c9e92087d5f4f667371ae350db9f76e3191 (patch)
tree114c0ce21c9f9258ee82ac849d15b715265f07b0 /drivers/iio/pressure
parenta244e7b57f0fb778bd333b10fffbeb362b94ffc3 (diff)
iio:st sensors: remove custom sampling frequence attribute in favour of core support.
This allows in kernel client drivers to access this Signed-off-by: Jonathan Cameron <jic23@kernel.org> Cc: Denis Ciocca <denis.ciocca@st.com> Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
Diffstat (limited to 'drivers/iio/pressure')
-rw-r--r--drivers/iio/pressure/st_pressure_core.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index cd7e01f3a93b..473d914ef470 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -307,6 +307,27 @@ static const struct st_sensors st_press_sensors[] = {
307 }, 307 },
308}; 308};
309 309
310static int st_press_write_raw(struct iio_dev *indio_dev,
311 struct iio_chan_spec const *ch,
312 int val,
313 int val2,
314 long mask)
315{
316 int err;
317
318 switch (mask) {
319 case IIO_CHAN_INFO_SAMP_FREQ:
320 if (val2)
321 return -EINVAL;
322 mutex_lock(&indio_dev->mlock);
323 err = st_sensors_set_odr(indio_dev, val);
324 mutex_unlock(&indio_dev->mlock);
325 return err;
326 default:
327 return -EINVAL;
328 }
329}
330
310static int st_press_read_raw(struct iio_dev *indio_dev, 331static int st_press_read_raw(struct iio_dev *indio_dev,
311 struct iio_chan_spec const *ch, int *val, 332 struct iio_chan_spec const *ch, int *val,
312 int *val2, long mask) 333 int *val2, long mask)
@@ -349,6 +370,9 @@ static int st_press_read_raw(struct iio_dev *indio_dev,
349 } 370 }
350 371
351 return IIO_VAL_FRACTIONAL; 372 return IIO_VAL_FRACTIONAL;
373 case IIO_CHAN_INFO_SAMP_FREQ:
374 *val = pdata->odr;
375 return IIO_VAL_INT;
352 default: 376 default:
353 return -EINVAL; 377 return -EINVAL;
354 } 378 }
@@ -357,12 +381,10 @@ read_error:
357 return err; 381 return err;
358} 382}
359 383
360static ST_SENSOR_DEV_ATTR_SAMP_FREQ();
361static ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL(); 384static ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL();
362 385
363static struct attribute *st_press_attributes[] = { 386static struct attribute *st_press_attributes[] = {
364 &iio_dev_attr_sampling_frequency_available.dev_attr.attr, 387 &iio_dev_attr_sampling_frequency_available.dev_attr.attr,
365 &iio_dev_attr_sampling_frequency.dev_attr.attr,
366 NULL, 388 NULL,
367}; 389};
368 390
@@ -374,6 +396,7 @@ static const struct iio_info press_info = {
374 .driver_module = THIS_MODULE, 396 .driver_module = THIS_MODULE,
375 .attrs = &st_press_attribute_group, 397 .attrs = &st_press_attribute_group,
376 .read_raw = &st_press_read_raw, 398 .read_raw = &st_press_read_raw,
399 .write_raw = &st_press_write_raw,
377}; 400};
378 401
379#ifdef CONFIG_IIO_TRIGGER 402#ifdef CONFIG_IIO_TRIGGER