Add available sampling frequency and scale attributes
cover Add available sampling frequency and scale attributes
First two patches are bugfixes related to sampling frequency and the last one is adding support for exporting available sampling frequency and scale.
Daniel Baluta (3):
iio: bmi160: Fix output data rate for accel
iio: bmi160: Fix ODR setting
imu: bmi160: Add avail frequency and scale attributes
drivers/iio/imu/bmi160/bmi160_core.c | 43 +++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 8 deletions(-)
Signature · 1 line
2.5.0
PATCH 1/3 iio: bmi160: Fix output data rate for accel
Format is INT_PLUS_MICRO and micro odr part of ODR should be parts of a micro.
Also s/8000/800 this is obviously a typo.
--- drivers/iio/imu/bmi160/bmi160_core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/iio/imu/bmi160/bmi160_core.c +6 -6
@@ -209,11 +209,11 @@ static const struct bmi160_scale_item bmi160_scale_table[] = { };static const struct bmi160_odr bmi160_accel_odr[] = { - {0x01 ,0 ,78125 }, - {0x02 ,1 ,5625 }, - {0x03 ,3 ,125 }, - {0x04 ,6 ,25 }, - {0x05 ,12 ,5 }, + {0x01 ,0 ,781250 }, + {0x02 ,1 ,562500 }, + {0x03 ,3 ,125000 }, + {0x04 ,6 ,250000 }, + {0x05 ,12 ,500000 }, {0x06 ,25 ,0 }, {0x07 ,50 ,0 }, {0x08 ,100 ,0 },
@@ -229,7 +229,7 @@ static const struct bmi160_odr bmi160_gyro_odr[] = { {0x08, 100, 0}, {0x09, 200, 0}, {0x0A, 400, 0}, - {0x0B, 8000, 0}, + {0x0B, 800, 0}, {0x0C, 1600, 0}, {0x0D, 3200, 0}, };
Signature · 1 line
2.5.0
Jonathan Cameron
maintainerRe: [PATCH 1/3] iio: bmi160: Fix output data rate for accel
Quoted 7 lines · Daniel Baluta
Format is
INT_PLUS_MICROand micro odr part of ODR should be parts of a micro.Also s/8000/800 this is obviously a typo.
Fixes 77c4ad2d6a9 ("iio: imu: Add initial support for Bosch BMI160")Signed-off-by Daniel Baluta <[email protected]>
I can't set up a suitable fixes branch for this as I'm without internet to grab an updated staging-next tree right now. Will mark it to be sorted out when I get some time back on a sensible internet connection (France is always a lot bigger than I expect it to be for some reason...)
Anyhow, poke me if you don't hear anything before the end of the week.
Note this will probably have to go in post merge window now as I doubt I'll be doing another pull before that opens.
Jonathan
Quoted 35 lines
--- drivers/iio/imu/bmi160/bmi160_core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/iio/imu/bmi160/bmi160_core.c +6
-6@@ -209,11 +209,11 @@ static const struct bmi160_scale_item bmi160_scale_table[] = { };static const struct bmi160_odr bmi160_accel_odr[] = { - {0x01 ,0 ,78125 }, - {0x02 ,1 ,5625 }, - {0x03 ,3 ,125 }, - {0x04 ,6 ,25 }, - {0x05 ,12 ,5 }, + {0x01 ,0 ,781250 }, + {0x02 ,1 ,562500 }, + {0x03 ,3 ,125000 }, + {0x04 ,6 ,250000 }, + {0x05 ,12 ,500000 }, {0x06 ,25 ,0 }, {0x07 ,50 ,0 }, {0x08 ,100 ,0 },@@ -229,7 +229,7 @@ static const struct bmi160_odr bmi160_gyro_odr[] = { {0x08, 100, 0}, {0x09, 200, 0}, {0x0A, 400, 0}, - {0x0B, 8000, 0}, + {0x0B, 800, 0}, {0x0C, 1600, 0}, {0x0D, 3200, 0}, };
Re: [PATCH 1/3] iio: bmi160: Fix output data rate for accel
Quoted 13 lines · Jonathan Cameron
Quoted 7 lines · Daniel Baluta
Format is
INT_PLUS_MICROand micro odr part of ODR should be parts of a micro.Also s/8000/800 this is obviously a typo.
Fixes 77c4ad2d6a9 ("iio: imu: Add initial support for Bosch BMI160")Signed-off-by Daniel Baluta <[email protected]>I can't set up a suitable fixes branch for this as I'm without internet to grab an updated staging-next tree right now. Will mark it to be sorted out when I get some time back on a sensible internet connection (France is always a lot bigger than I expect it to be for some reason...)
Quoted 6 lines
Anyhow, poke me if you don't hear anything before the end of the week.
Note this will probably have to go in post merge window now as I doubt I'll be doing another pull before that opens.
Jonathan
Applied to the fixes-togreg-post-rc1 branch which will get pushed out when I get home. France is awfully big sometimes.
Jonathan
Quoted 41 lines
Quoted 27 lines
--- drivers/iio/imu/bmi160/bmi160_core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/iio/imu/bmi160/bmi160_core.c +5
-5@@ -209,11 +209,11 @@ static const struct bmi160_scale_item bmi160_scale_table[] = { };static const struct bmi160_odr bmi160_accel_odr[] = { - {0x01 ,0 ,78125 }, - {0x02 ,1 ,5625 }, - {0x03 ,3 ,125 }, - {0x04 ,6 ,25 }, - {0x05 ,12 ,5 }, + {0x01 ,0 ,781250 }, + {0x02 ,1 ,562500 }, + {0x03 ,3 ,125000 }, + {0x04 ,6 ,250000 }, + {0x05 ,12 ,500000 }, {0x06 ,25 ,0 }, {0x07 ,50 ,0 }, {0x08 ,100 ,0 },drivers/iio/imu/bmi160/bmi160_core.c static const struct bmi160_odr bmi160_gyro_odr[] = { · line 235
Quoted 8 lines
drivers/iio/imu/bmi160/bmi160_core.c +1
-1@@ -229,7 +229,7 @@ static const struct bmi160_odr bmi160_gyro_odr[] = { {0x08, 100, 0}, {0x09, 200, 0}, {0x0A, 400, 0}, - {0x0B, 8000, 0}, + {0x0B, 800, 0}, {0x0C, 1600, 0}, {0x0D, 3200, 0}, };--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/3 iio: bmi160: Fix ODR setting
In reply to Daniel Balutamask and val parameters of regmap_update_bits were reveresed.
--- drivers/iio/imu/bmi160/bmi160_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/imu/bmi160/bmi160_core.c +2 -2
@@ -364,8 +364,8 @@ int bmi160_set_odr(struct bmi160_data *data, enum bmi160_sensor_type t,return regmap_update_bits (data->regmap, bmi160_regs[t].config, - bmi160_odr_table[t].tbl[i].bits, - bmi160_regs[t].config_odr_mask); + bmi160_regs[t].config_odr_mask, + bmi160_odr_table[t].tbl[i].bits); } static int bmi160_get_odr(struct bmi160_data *data, enum bmi160_sensor_type t,
Signature · 1 line
2.5.0
Re: [PATCH 2/3] iio: bmi160: Fix ODR setting
Quoted 4 lines · Daniel Baluta
mask and val parameters of
regmap_update_bitswere reveresed.Fixes 77c4ad2d6a9 ("iio: imu: Add initial support for Bosch BMI160")Signed-off-by Daniel Baluta <[email protected]>
Applied to the fixes-togreg-post-rc1 branch of iio.git.
Not pushed out as anything at all yet.
Jonathan
Quoted 20 lines
--- drivers/iio/imu/bmi160/bmi160_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/imu/bmi160/bmi160_core.c +2
-2@@ -364,8 +364,8 @@ int bmi160_set_odr(struct bmi160_data *data, enum bmi160_sensor_type t,return regmap_update_bits (data->regmap, bmi160_regs[t].config, - bmi160_odr_table[t].tbl[i].bits, - bmi160_regs[t].config_odr_mask); + bmi160_regs[t].config_odr_mask, + bmi160_odr_table[t].tbl[i].bits); } static int bmi160_get_odr(struct bmi160_data *data, enum bmi160_sensor_type t,
PATCH 3/3 imu: bmi160: Add avail frequency and scale attributes
In reply to Daniel Baluta--- drivers/iio/imu/bmi160/bmi160_core.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/iio/imu/bmi160/bmi160_core.c +27 -0
@@ -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)
Signature · 1 line
2.5.0
Jonathan Cameron
maintainerRe: [PATCH 3/3] imu: bmi160: Add avail frequency and scale attributes
Quoted 1 line · Daniel Baluta
Signed-off-by Daniel Baluta <[email protected]>
These are not strictly 'required' so will have to be next cycle now...
Again, poke me if I haven't picked this up in a week or so... Jonathan
Quoted 54 lines
--- drivers/iio/imu/bmi160/bmi160_core.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)drivers/iio/imu/bmi160/bmi160_core.c +27
-0@@ -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)
Re: [PATCH 3/3] imu: bmi160: Add avail frequency and scale attributes
Quoted 6 lines · Jonathan Cameron
Quoted 1 line · Daniel Baluta
Signed-off-by Daniel Baluta <[email protected]>These are not strictly 'required' so will have to be next cycle now...
Again, poke me if I haven't picked this up in a week or so... Jonathan
Applied to the togreg branch of iio.git
Thanks,
Jonathan
Quoted 60 lines
Quoted 44 lines
--- drivers/iio/imu/bmi160/bmi160_core.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)drivers/iio/imu/bmi160/bmi160_core.c +24
-0@@ -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,drivers/iio/imu/bmi160/bmi160_core.c static int bmi160_write_raw(struct iio_dev *indio_dev, · line 502
Quoted 10 lines
drivers/iio/imu/bmi160/bmi160_core.c +3
-0+}; +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)--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Jonathan Cameron
maintainerQuoted 11 lines · Daniel Baluta
First two patches are bugfixes related to sampling frequency and the last one is adding support for exporting available sampling frequency and scale.
Daniel Baluta (3):
iio: bmi160: Fix output data rate for accel
iio: bmi160: Fix ODR setting
imu: bmi160: Add avail frequency and scale attributesdrivers/iio/imu/bmi160/bmi160_core.c | 43 +++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 8 deletions(-)
*cough* Daniel, a part name might be nice in the cover letter title!
J