aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/magnetometer
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/magnetometer
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/magnetometer')
-rw-r--r--drivers/iio/magnetometer/st_magn_core.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
index 240a21dd0c61..a4b64130ac2f 100644
--- a/drivers/iio/magnetometer/st_magn_core.c
+++ b/drivers/iio/magnetometer/st_magn_core.c
@@ -299,6 +299,9 @@ static int st_magn_read_raw(struct iio_dev *indio_dev,
299 else 299 else
300 *val2 = mdata->current_fullscale->gain; 300 *val2 = mdata->current_fullscale->gain;
301 return IIO_VAL_INT_PLUS_MICRO; 301 return IIO_VAL_INT_PLUS_MICRO;
302 case IIO_CHAN_INFO_SAMP_FREQ:
303 *val = mdata->odr;
304 return IIO_VAL_INT;
302 default: 305 default:
303 return -EINVAL; 306 return -EINVAL;
304 } 307 }
@@ -316,6 +319,13 @@ static int st_magn_write_raw(struct iio_dev *indio_dev,
316 case IIO_CHAN_INFO_SCALE: 319 case IIO_CHAN_INFO_SCALE:
317 err = st_sensors_set_fullscale_by_gain(indio_dev, val2); 320 err = st_sensors_set_fullscale_by_gain(indio_dev, val2);
318 break; 321 break;
322 case IIO_CHAN_INFO_SAMP_FREQ:
323 if (val2)
324 return -EINVAL;
325 mutex_lock(&indio_dev->mlock);
326 err = st_sensors_set_odr(indio_dev, val);
327 mutex_unlock(&indio_dev->mlock);
328 return err;
319 default: 329 default:
320 err = -EINVAL; 330 err = -EINVAL;
321 } 331 }
@@ -323,14 +333,12 @@ static int st_magn_write_raw(struct iio_dev *indio_dev,
323 return err; 333 return err;
324} 334}
325 335
326static ST_SENSOR_DEV_ATTR_SAMP_FREQ();
327static ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL(); 336static ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL();
328static ST_SENSORS_DEV_ATTR_SCALE_AVAIL(in_magn_scale_available); 337static ST_SENSORS_DEV_ATTR_SCALE_AVAIL(in_magn_scale_available);
329 338
330static struct attribute *st_magn_attributes[] = { 339static struct attribute *st_magn_attributes[] = {
331 &iio_dev_attr_sampling_frequency_available.dev_attr.attr, 340 &iio_dev_attr_sampling_frequency_available.dev_attr.attr,
332 &iio_dev_attr_in_magn_scale_available.dev_attr.attr, 341 &iio_dev_attr_in_magn_scale_available.dev_attr.attr,
333 &iio_dev_attr_sampling_frequency.dev_attr.attr,
334 NULL, 342 NULL,
335}; 343};
336 344