Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1391034

[PATCH 3/3] imu: bmi160: Add avail frequency and scale attributes

From Daniel Baluta <daniel.baluta@intel.com>
Newsgroups linux.kernel
Subject [PATCH 3/3] imu: bmi160: Add avail frequency and scale attributes
Date 2016-04-29 13:50 +0200
Message-ID <rtf5N-5f6-15@gated-at.bofh.it> (permalink)
References <rtf5M-5f6-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
---
 drivers/iio/imu/bmi160/bmi160_core.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c
index b8a290e..97928d5 100644
--- a/drivers/iio/imu/bmi160/bmi160_core.c
+++ b/drivers/iio/imu/bmi160/bmi160_core.c
@@ -20,6 +20,7 @@
 #include <linux/iio/triggered_buffer.h>
 #include <linux/iio/trigger_consumer.h>
 #include <linux/iio/buffer.h>
+#include <linux/iio/sysfs.h>
 
 #include "bmi160.h"
 
@@ -466,10 +467,36 @@ static int bmi160_write_raw(struct iio_dev *indio_dev,
 	return 0;
 }
 
+static
+IIO_CONST_ATTR(in_accel_sampling_frequency_available,
+	       "0.78125 1.5625 3.125 6.25 12.5 25 50 100 200 400 800 1600");
+static
+IIO_CONST_ATTR(in_anglvel_sampling_frequency_available,
+	       "25 50 100 200 400 800 1600 3200");
+static
+IIO_CONST_ATTR(in_accel_scale_available,
+	       "0.000598 0.001197 0.002394 0.004788");
+static
+IIO_CONST_ATTR(in_anglvel_scale_available,
+	       "0.001065 0.000532 0.000266 0.000133 0.000066");
+
+static struct attribute *bmi160_attrs[] = {
+	&iio_const_attr_in_accel_sampling_frequency_available.dev_attr.attr,
+	&iio_const_attr_in_anglvel_sampling_frequency_available.dev_attr.attr,
+	&iio_const_attr_in_accel_scale_available.dev_attr.attr,
+	&iio_const_attr_in_anglvel_scale_available.dev_attr.attr,
+	NULL,
+};
+
+static const struct attribute_group bmi160_attrs_group = {
+	.attrs = bmi160_attrs,
+};
+
 static const struct iio_info bmi160_info = {
 	.driver_module = THIS_MODULE,
 	.read_raw = bmi160_read_raw,
 	.write_raw = bmi160_write_raw,
+	.attrs = &bmi160_attrs_group,
 };
 
 static const char *bmi160_match_acpi_device(struct device *dev)
-- 
2.5.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] Add available sampling frequency and scale attributes Daniel Baluta <daniel.baluta@intel.com> - 2016-04-29 13:50 +0200
  [PATCH 3/3] imu: bmi160: Add avail frequency and scale attributes Daniel Baluta <daniel.baluta@intel.com> - 2016-04-29 13:50 +0200
    Re: [PATCH 3/3] imu: bmi160: Add avail frequency and scale attributes Jonathan Cameron <jic23@kernel.org> - 2016-05-01 23:30 +0200
      Re: [PATCH 3/3] imu: bmi160: Add avail frequency and scale attributes Jonathan Cameron <jic23@kernel.org> - 2016-05-04 16:40 +0200
  [PATCH 1/3] iio: bmi160: Fix output data rate for accel Daniel Baluta <daniel.baluta@intel.com> - 2016-04-29 13:50 +0200
    Re: [PATCH 1/3] iio: bmi160: Fix output data rate for accel Jonathan Cameron <jic23@kernel.org> - 2016-05-01 23:30 +0200
      Re: [PATCH 1/3] iio: bmi160: Fix output data rate for accel Jonathan Cameron <jic23@kernel.org> - 2016-05-04 16:40 +0200
  Re: [PATCH 0/3] Add available sampling frequency and scale attributes Jonathan Cameron <jic23@kernel.org> - 2016-05-01 23:30 +0200

csiph-web