iio:st_pressure: improvements
v2 cover iio:st_pressure: improvements
This follows up on various comments related to the preliminary patch series found at http://www.spinics.net/lists/linux-iio/msg24239.html
Note ! Note ! First patch reworks the way triggered buffering is done and will affect other st_sensors. If anyone owning one of these could run some tests, I'd be glad to get some feedback.
What you'll find here :
* make st_pressure sensors compliant with IIO ABI ;
* fix the way st_sensors samples are stored in memory to comply with IIO expected alignment constraints ;
* add support for temperature triggered buffering ;
* enhance LPS22HB support.
Changes since v1 :
* drop first patch since already applied
* comment skipping of timestamping channel at setup time
* remove useless channel initializers
Changes since preliminary series :
* drop patches already applied onto testing branch
* 1st patch is a rebase of Jonathan's fixes-togreg branch d43a411 commit onto testing branch
* reorder patches to move fix patches ahead of series
* document sampling gains and datasheets in a separate patch
* rebase of other patches on top of testing branch
* complete LPS22HB support with Linus' open drain mode
Tested with the following Linus' fixes-togreg branch patches applied :
9914760 iio: st_sensors: Disable DRDY at init time
ff05916 iio: st_sensors: Init trigger before irq request 65925b6 iio: st_sensors: switch to a threaded interrupt
Regards,
gregor.
Gregor Boirie (7):
iio:st_sensors: align on storagebits boundaries iio:st_pressure: align storagebits on power of 2 iio:st_pressure: document sampling gains iio:st_pressure: temperature triggered buffering iio:st_pressure:lps22hb: open drain support iio:st_pressure:lps22hb: temperature support iio:st_pressure: clean useless static channel initializers
drivers/iio/common/st_sensors/st_sensors_buffer.c | 37 +++--- drivers/iio/common/st_sensors/st_sensors_core.c | 2 +- drivers/iio/pressure/st_pressure_core.c | 155 ++++++++++++++++++---- 3 files changed, 148 insertions(+), 46 deletions(-)
Signature · 1 line
2.1.4
PATCH v2 1/7 iio:st_sensors: align on storagebits boundaries
Ensure triggered buffering memory accesses are properly aligned on per channel storagebits boundaries.
--- drivers/iio/common/st_sensors/st_sensors_buffer.c | 37 +++++++++++------------ drivers/iio/common/st_sensors/st_sensors_core.c | 2 +- 2 files changed, 19 insertions(+), 20 deletions(-)
drivers/iio/common/st_sensors/st_sensors_buffer.c +18 -19
@@ -24,30 +24,29 @@static int st_sensors_get_buffer_element (struct iio_dev *indio_dev,u8 *buf) { -int i, len; -int total =0 ; +int i;struct st_sensor_data *sdata =iio_priv (indio_dev);unsigned int num_data_channels = sdata->num_data_channels; -for (i =0 ; i < num_data_channels; i++) { -unsigned int bytes_to_read; - -if (test_bit (i, indio_dev->active_scan_mask)) { - bytes_to_read = indio_dev->channels[i].scan_type.storagebits >>3 ; - len = sdata->tf->read_multiple_byte (&sdata->tb, - sdata->dev, indio_dev->channels[i].address, - bytes_to_read, - buf + total, sdata->multiread_bit); - -if (len < bytes_to_read) -return -EIO ; - -/* Advance the buffer pointer */ - total += len; - } +for_each_set_bit (i, indio_dev->active_scan_mask, num_data_channels) { +const struct iio_chan_spec *channel = &indio_dev->channels[i]; +unsigned int bytes_to_read = channel->scan_type.realbits >>3 ; +unsigned int storage_bytes = + channel->scan_type.storagebits >>3 ; + + buf =PTR_ALIGN (buf, storage_bytes); +if (sdata->tf->read_multiple_byte (&sdata->tb, sdata->dev, + channel->address, + bytes_to_read, buf, + sdata->multiread_bit) < + bytes_to_read) +return -EIO ; + +/* Advance the buffer pointer */ + buf += storage_bytes; } -return total; +return 0 ; }irqreturn_t st_sensors_trigger_handler (int irq,void *p)
drivers/iio/common/st_sensors/st_sensors_core.c +1 -1
@@ -490,7 +490,7 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev,int err;u8 *outdata;struct st_sensor_data *sdata =iio_priv (indio_dev); -unsigned int byte_for_channel = ch->scan_type.storagebits >>3 ; +unsigned int byte_for_channel = ch->scan_type.realbits >>3 ; outdata =kmalloc (byte_for_channel,GFP_KERNEL );if (!outdata)
Signature · 1 line
2.1.4
Jonathan Cameron
maintainerRe: [PATCH v2 1/7] iio:st_sensors: align on storagebits boundaries
Quoted 4 lines · Gregor Boirie
Ensure triggered buffering memory accesses are properly aligned on per channel storagebits boundaries.
Signed-off-by Gregor Boirie <[email protected]>
Applied to the togreg branch of iio.git - initially pushed out as testing for the autobuilders to play with it.
Thanks,
Jonathan
Quoted 72 lines
--- drivers/iio/common/st_sensors/st_sensors_buffer.c | 37 +++++++++++------------ drivers/iio/common/st_sensors/st_sensors_core.c | 2 +- 2 files changed, 19 insertions(+), 20 deletions(-)drivers/iio/common/st_sensors/st_sensors_buffer.c +18
-19@@ -24,30 +24,29 @@static int st_sensors_get_buffer_element (struct iio_dev *indio_dev,u8 *buf) { -int i, len; -int total =0 ; +int i;struct st_sensor_data *sdata =iio_priv (indio_dev);unsigned int num_data_channels = sdata->num_data_channels; -for (i =0 ; i < num_data_channels; i++) { -unsigned int bytes_to_read; - -if (test_bit (i, indio_dev->active_scan_mask)) { - bytes_to_read = indio_dev->channels[i].scan_type.storagebits >>3 ; - len = sdata->tf->read_multiple_byte (&sdata->tb, - sdata->dev, indio_dev->channels[i].address, - bytes_to_read, - buf + total, sdata->multiread_bit); - -if (len < bytes_to_read) -return -EIO ; - -/* Advance the buffer pointer */ - total += len; - } +for_each_set_bit (i, indio_dev->active_scan_mask, num_data_channels) { +const struct iio_chan_spec *channel = &indio_dev->channels[i]; +unsigned int bytes_to_read = channel->scan_type.realbits >>3 ; +unsigned int storage_bytes = + channel->scan_type.storagebits >>3 ; + + buf =PTR_ALIGN (buf, storage_bytes); +if (sdata->tf->read_multiple_byte (&sdata->tb, sdata->dev, + channel->address, + bytes_to_read, buf, + sdata->multiread_bit) < + bytes_to_read) +return -EIO ; + +/* Advance the buffer pointer */ + buf += storage_bytes; } -return total; +return 0 ; }irqreturn_t st_sensors_trigger_handler (int irq,void *p)drivers/iio/common/st_sensors/st_sensors_core.c +1
-1@@ -490,7 +490,7 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev,int err;u8 *outdata;struct st_sensor_data *sdata =iio_priv (indio_dev); -unsigned int byte_for_channel = ch->scan_type.storagebits >>3 ; +unsigned int byte_for_channel = ch->scan_type.realbits >>3 ; outdata =kmalloc (byte_for_channel,GFP_KERNEL );if (!outdata)
PATCH v2 2/7 iio:st_pressure: align storagebits on power of 2
In reply to Gregor BoirieSampled pressure data are 24 bits long and should be stored in a 32 bits word.
--- drivers/iio/pressure/st_pressure_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/pressure/st_pressure_core.c +2 -2
@@ -146,7 +146,7 @@ static const struct iio_chan_spec st_press_1_channels[] = { .scan_type = { .sign = 'u', .realbits = 24, - .storagebits = 24, + .storagebits = 32, .endianness = IIO_LE, }, .info_mask_separate =
@@ -218,7 +218,7 @@ static const struct iio_chan_spec st_press_lps22hb_channels[] = { .scan_type = { .sign = 'u', .realbits = 24, - .storagebits = 24, + .storagebits = 32, .endianness = IIO_LE, }, .info_mask_separate =
Signature · 1 line
2.1.4
Re: [PATCH v2 2/7] iio:st_pressure: align storagebits on power of 2
Quoted 4 lines · Gregor Boirie
Sampled pressure data are 24 bits long and should be stored in a 32 bits word.
Signed-off-by Gregor Boirie <[email protected]>
Applied.
Quoted 27 lines
--- drivers/iio/pressure/st_pressure_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/pressure/st_pressure_core.c +2
-2@@ -146,7 +146,7 @@ static const struct iio_chan_spec st_press_1_channels[] = { .scan_type = { .sign = 'u', .realbits = 24, - .storagebits = 24, + .storagebits = 32, .endianness = IIO_LE, }, .info_mask_separate =@@ -218,7 +218,7 @@ static const struct iio_chan_spec st_press_lps22hb_channels[] = { .scan_type = { .sign = 'u', .realbits = 24, - .storagebits = 24, + .storagebits = 32, .endianness = IIO_LE, }, .info_mask_separate =
PATCH v2 3/7 iio:st_pressure: document sampling gains
In reply to Gregor BoirieDetails scaling factors and offsets applied to raw temperature and pressure samples.
--- drivers/iio/pressure/st_pressure_core.c | 92 +++++++++++++++++++++++++++++++-- 1 file changed, 88 insertions(+), 4 deletions(-)
drivers/iio/pressure/st_pressure_core.c +88 -4
@@ -28,6 +28,72 @@#include <linux/iio/common/st_sensors.h> #include "st_pressure.h" +/* +* About determining pressure scaling factors +* ------------------------------------------ +* +* Datasheets specify typical pressure sensitivity so that pressure is computed +* according to the following equation : +* pressure[mBar] = raw / sensitivity +* where : +* raw the 24 bits long raw sampled pressure +* sensitivity a scaling factor specified by the datasheet in LSB/mBar +* +* IIO ABI expects pressure to be expressed as kPascal, hence pressure should be +* computed according to : +* pressure[kPascal] = pressure[mBar] / 10 +* = raw / (sensitivity * 10) (1) +* +* Finally, st_press_read_raw() returns pressure scaling factor as an +* IIO_VAL_INT_PLUS_NANO with a zero integral part and "gain" as decimal part. +* Therefore, from (1), "gain" becomes : +* gain = 10^9 / (sensitivity * 10) +* = 10^8 / sensitivity +* +* About determining temperature scaling factors and offsets +* --------------------------------------------------------- +* +* Datasheets specify typical temperature sensitivity and offset so that +* temperature is computed according to the following equation : +* temp[Celsius] = offset[Celsius] + (raw / sensitivity) +* where : +* raw the 16 bits long raw sampled temperature +* offset a constant specified by the datasheet in degree Celsius +* (sometimes zero) +* sensitivity a scaling factor specified by the datasheet in LSB/Celsius +* +* IIO ABI expects temperature to be expressed as milli degree Celsius such as +* user space should compute temperature according to : +* temp[mCelsius] = temp[Celsius] * 10^3 +* = (offset[Celsius] + (raw / sensitivity)) * 10^3 +* = ((offset[Celsius] * sensitivity) + raw) * +* (10^3 / sensitivity) (2) +* +* IIO ABI expects user space to apply offset and scaling factors to raw samples +* according to : +* temp[mCelsius] = (OFFSET + raw) * SCALE +* where : +* OFFSET an arbitrary constant exposed by device +* SCALE an arbitrary scaling factor exposed by device +* +* Matching OFFSET and SCALE with members of (2) gives : +* OFFSET = offset[Celsius] * sensitivity (3) +* SCALE = 10^3 / sensitivity (4) +* +* st_press_read_raw() returns temperature scaling factor as an +* IIO_VAL_FRACTIONAL with a 10^3 numerator and "gain2" as denominator. +* Therefore, from (3), "gain2" becomes : +* gain2 = sensitivity +* +* When declared within channel, i.e. for a non zero specified offset, +* st_press_read_raw() will return the latter as an IIO_VAL_FRACTIONAL such as : +* numerator = OFFSET * 10^3 +* denominator = 10^3 +* giving from (4): +* numerator = offset[Celsius] * 10^3 * sensitivity +* = offset[mCelsius] * gain2 +*/ +#define MCELSIUS_PER_CELSIUS 1000/* Default pressure sensitivity */
@@ -48,7 +114,11 @@#define ST_PRESS_1_OUT_XL_ADDR 0x28#define ST_TEMP_1_OUT_L_ADDR 0x2b -/* CUSTOM VALUES FOR LPS331AP SENSOR */ +/* +* CUSTOM VALUES FOR LPS331AP SENSOR +* See LPS331AP datasheet: +* http://www2.st.com/resource/en/datasheet/lps331ap.pdf +*/ #define ST_PRESS_LPS331AP_WAI_EXP 0xbb#define ST_PRESS_LPS331AP_ODR_ADDR 0x20#define ST_PRESS_LPS331AP_ODR_MASK 0x70
@@ -71,7 +141,9 @@#define ST_PRESS_LPS331AP_OD_IRQ_MASK 0x40#define ST_PRESS_LPS331AP_MULTIREAD_BIT true -/* CUSTOM VALUES FOR LPS001WP SENSOR */ +/* +* CUSTOM VALUES FOR THE OBSOLETE LPS001WP SENSOR +*/ /* LPS001WP pressure resolution */ #define ST_PRESS_LPS001WP_LSB_PER_MBAR 16UL
@@ -94,7 +166,11 @@#define ST_PRESS_LPS001WP_OUT_L_ADDR 0x28#define ST_TEMP_LPS001WP_OUT_L_ADDR 0x2a -/* CUSTOM VALUES FOR LPS25H SENSOR */ +/* +* CUSTOM VALUES FOR LPS25H SENSOR +* See LPS25H datasheet: +* http://www2.st.com/resource/en/datasheet/lps25h.pdf +*/ #define ST_PRESS_LPS25H_WAI_EXP 0xbd#define ST_PRESS_LPS25H_ODR_ADDR 0x20#define ST_PRESS_LPS25H_ODR_MASK 0x70
@@ -117,7 +193,11 @@#define ST_PRESS_LPS25H_OUT_XL_ADDR 0x28#define ST_TEMP_LPS25H_OUT_L_ADDR 0x2b -/* CUSTOM VALUES FOR LPS22HB SENSOR */ +/* +* CUSTOM VALUES FOR LPS22HB SENSOR +* See LPS22HB datasheet: +* http://www2.st.com/resource/en/datasheet/lps22hb.pdf +*/ #define ST_PRESS_LPS22HB_WAI_EXP 0xb1#define ST_PRESS_LPS22HB_ODR_ADDR 0x10#define ST_PRESS_LPS22HB_ODR_MASK 0x70
@@ -413,6 +493,10 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { }, .fs = { .fs_avl = { +/* +* Sensitivity values as defined in table 3 of +* LPS22HB datasheet. + */ [0] = { .num = ST_PRESS_FS_AVL_1260MB, .gain = ST_PRESS_KPASCAL_NANO_SCALE,
Signature · 1 line
2.1.4
Re: [PATCH v2 3/7] iio:st_pressure: document sampling gains
Quoted 4 lines · Gregor Boirie
Details scaling factors and offsets applied to raw temperature and pressure samples.
Signed-off-by Gregor Boirie <[email protected]>
I try to apply the patches on top of Jonathan's 4.8a branch, but I fail when I get to this patch like this:
$ git am 03.patch Applying: iio:st_pressure: document sampling gains error: patch failed: drivers/iio/pressure/st_pressure_core.c:28 error: drivers/iio/pressure/st_pressure_core.c: patch does not apply Patch failed at 0001 iio:st_pressure: document sampling gains The copy of the patch that failed is found in: /home/linus/linux-iio/.git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
Can you rebase/make sure they all apply on the 4.8a or so so that I can test them?
Or do you have a git branch I can just pull and test?
Yours,
Linus Walleij
Re: [PATCH v2 3/7] iio:st_pressure: document sampling gains
Linus,
Quoted 10 lines · Linus Walleij
Quoted 4 lines · Gregor Boirie
Details scaling factors and offsets applied to raw temperature and pressure samples.
Signed-off-by Gregor Boirie <[email protected]>I try to apply the patches on top of Jonathan's 4.8a branch, but I fail when I get to this patch like this:
Quoted 10 lines
$ git am 03.patch
Applying: iio:st_pressure: document sampling gains
error: patch failed: drivers/iio/pressure/st_pressure_core.c:28
error: drivers/iio/pressure/st_pressure_core.c: patch does not apply
Patch failed at 0001 iio:st_pressure: document sampling gains
The copy of the patch that failed is found in:
/home/linus/linux-iio/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".yep. it seems the patch "iio:st_pressure: fix sampling gains (bring inline with ABI)" is not applied onto togreg branch.
Quoted 5 lines
Can you rebase/make sure they all apply on the 4.8a or so so that I can test them?
Or do you have a git branch I can just pull and test?
Please, find a rebase onto togreg branch with current interrupts related patches applied (without the "harden interrupt handling" stuff) here :
https://github.com/grgbr/linux-iio/tree/iio-togreg-lps22hb
Quoted 3 lines
Yours,
Linus Walleij
Jonathan Cameron
maintainerRe: [PATCH v2 3/7] iio:st_pressure: document sampling gains
Quoted 27 lines · Gregor Boirie
Linus,
Quoted 10 lines · Linus Walleij
Quoted 4 lines · Gregor Boirie
Details scaling factors and offsets applied to raw temperature and pressure samples.
Signed-off-by Gregor Boirie <[email protected]>I try to apply the patches on top of Jonathan's 4.8a branch, but I fail when I get to this patch like this:
Quoted 10 lines
$ git am 03.patch Applying: iio:st_pressure: document sampling gains error: patch failed: drivers/iio/pressure/st_pressure_core.c:28 error: drivers/iio/pressure/st_pressure_core.c: patch does not apply Patch failed at 0001 iio:st_pressure: document sampling gains The copy of the patch that failed is found in: /home/linus/linux-iio/.git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".yep. it seems the patch "iio:st_pressure: fix sampling gains (bring inline with ABI)" is not applied onto togreg branch.
Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Can you rebase/make sure they all apply on the 4.8a or so so that I can test them?
Or do you have a git branch I can just pull and test?
Please, find a rebase onto togreg branch with current interrupts related patches applied (without the "harden interrupt handling" stuff) here :
https://github.com/grgbr/linux-iio/tree/iio-togreg-lps22hb
Hi Linus,
Any luck with testing these? They apply cleanly on the tree now as the fix has worked it's way into staging-next and hence back to iio.git after the last pull.
Jonathan
Quoted 4 lines
Quoted 3 lines
Yours,
Linus Walleij
Re: [PATCH v2 3/7] iio:st_pressure: document sampling gains
Quoted 2 lines · Jonathan Cameron
Any luck with testing these? They apply cleanly on the tree now as the fix has worked it's way into staging-next and hence back to iio.git after the last pull.
Just tested and sent my Tested-by on patch 0.
Works like a charm.
Yours,
Linus Walleij
Jonathan Cameron
maintainerRe: [PATCH v2 3/7] iio:st_pressure: document sampling gains
Quoted 8 lines · Linus Walleij
Quoted 2 lines · Jonathan Cameron
Any luck with testing these? They apply cleanly on the tree now as the fix has worked it's way into staging-next and hence back to iio.git after the last pull.
Just tested and sent my Tested-by on patch 0.
Works like a charm.
Thanks Linus.
Quoted 3 lines
Yours,
Linus Walleij
Re: [PATCH v2 3/7] iio:st_pressure: document sampling gains
In reply to Gregor BoirieQuoted 4 lines · Gregor Boirie
Details scaling factors and offsets applied to raw temperature and pressure samples.
Signed-off-by Gregor Boirie <[email protected]>
Applied.
Quoted 143 lines
--- drivers/iio/pressure/st_pressure_core.c | 92 +++++++++++++++++++++++++++++++-- 1 file changed, 88 insertions(+), 4 deletions(-)drivers/iio/pressure/st_pressure_core.c +88
-4@@ -28,6 +28,72 @@#include <linux/iio/common/st_sensors.h> #include "st_pressure.h" +/* +* About determining pressure scaling factors +* ------------------------------------------ +* +* Datasheets specify typical pressure sensitivity so that pressure is computed +* according to the following equation : +* pressure[mBar] = raw / sensitivity +* where : +* raw the 24 bits long raw sampled pressure +* sensitivity a scaling factor specified by the datasheet in LSB/mBar +* +* IIO ABI expects pressure to be expressed as kPascal, hence pressure should be +* computed according to : +* pressure[kPascal] = pressure[mBar] / 10 +* = raw / (sensitivity * 10) (1) +* +* Finally, st_press_read_raw() returns pressure scaling factor as an +* IIO_VAL_INT_PLUS_NANO with a zero integral part and "gain" as decimal part. +* Therefore, from (1), "gain" becomes : +* gain = 10^9 / (sensitivity * 10) +* = 10^8 / sensitivity +* +* About determining temperature scaling factors and offsets +* --------------------------------------------------------- +* +* Datasheets specify typical temperature sensitivity and offset so that +* temperature is computed according to the following equation : +* temp[Celsius] = offset[Celsius] + (raw / sensitivity) +* where : +* raw the 16 bits long raw sampled temperature +* offset a constant specified by the datasheet in degree Celsius +* (sometimes zero) +* sensitivity a scaling factor specified by the datasheet in LSB/Celsius +* +* IIO ABI expects temperature to be expressed as milli degree Celsius such as +* user space should compute temperature according to : +* temp[mCelsius] = temp[Celsius] * 10^3 +* = (offset[Celsius] + (raw / sensitivity)) * 10^3 +* = ((offset[Celsius] * sensitivity) + raw) * +* (10^3 / sensitivity) (2) +* +* IIO ABI expects user space to apply offset and scaling factors to raw samples +* according to : +* temp[mCelsius] = (OFFSET + raw) * SCALE +* where : +* OFFSET an arbitrary constant exposed by device +* SCALE an arbitrary scaling factor exposed by device +* +* Matching OFFSET and SCALE with members of (2) gives : +* OFFSET = offset[Celsius] * sensitivity (3) +* SCALE = 10^3 / sensitivity (4) +* +* st_press_read_raw() returns temperature scaling factor as an +* IIO_VAL_FRACTIONAL with a 10^3 numerator and "gain2" as denominator. +* Therefore, from (3), "gain2" becomes : +* gain2 = sensitivity +* +* When declared within channel, i.e. for a non zero specified offset, +* st_press_read_raw() will return the latter as an IIO_VAL_FRACTIONAL such as : +* numerator = OFFSET * 10^3 +* denominator = 10^3 +* giving from (4): +* numerator = offset[Celsius] * 10^3 * sensitivity +* = offset[mCelsius] * gain2 +*/ +#define MCELSIUS_PER_CELSIUS 1000/* Default pressure sensitivity */ @@ -48,7 +114,11 @@#define ST_PRESS_1_OUT_XL_ADDR 0x28#define ST_TEMP_1_OUT_L_ADDR 0x2b -/* CUSTOM VALUES FOR LPS331AP SENSOR */ +/* +* CUSTOM VALUES FOR LPS331AP SENSOR +* See LPS331AP datasheet: +* http://www2.st.com/resource/en/datasheet/lps331ap.pdf +*/ #define ST_PRESS_LPS331AP_WAI_EXP 0xbb#define ST_PRESS_LPS331AP_ODR_ADDR 0x20#define ST_PRESS_LPS331AP_ODR_MASK 0x70@@ -71,7 +141,9 @@#define ST_PRESS_LPS331AP_OD_IRQ_MASK 0x40#define ST_PRESS_LPS331AP_MULTIREAD_BIT true -/* CUSTOM VALUES FOR LPS001WP SENSOR */ +/* +* CUSTOM VALUES FOR THE OBSOLETE LPS001WP SENSOR +*/ /* LPS001WP pressure resolution */ #define ST_PRESS_LPS001WP_LSB_PER_MBAR 16UL@@ -94,7 +166,11 @@#define ST_PRESS_LPS001WP_OUT_L_ADDR 0x28#define ST_TEMP_LPS001WP_OUT_L_ADDR 0x2a -/* CUSTOM VALUES FOR LPS25H SENSOR */ +/* +* CUSTOM VALUES FOR LPS25H SENSOR +* See LPS25H datasheet: +* http://www2.st.com/resource/en/datasheet/lps25h.pdf +*/ #define ST_PRESS_LPS25H_WAI_EXP 0xbd#define ST_PRESS_LPS25H_ODR_ADDR 0x20#define ST_PRESS_LPS25H_ODR_MASK 0x70@@ -117,7 +193,11 @@#define ST_PRESS_LPS25H_OUT_XL_ADDR 0x28#define ST_TEMP_LPS25H_OUT_L_ADDR 0x2b -/* CUSTOM VALUES FOR LPS22HB SENSOR */ +/* +* CUSTOM VALUES FOR LPS22HB SENSOR +* See LPS22HB datasheet: +* http://www2.st.com/resource/en/datasheet/lps22hb.pdf +*/ #define ST_PRESS_LPS22HB_WAI_EXP 0xb1#define ST_PRESS_LPS22HB_ODR_ADDR 0x10#define ST_PRESS_LPS22HB_ODR_MASK 0x70@@ -413,6 +493,10 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { }, .fs = { .fs_avl = { +/* +* Sensitivity values as defined in table 3 of +* LPS22HB datasheet. + */ [0] = { .num = ST_PRESS_FS_AVL_1260MB, .gain = ST_PRESS_KPASCAL_NANO_SCALE,
PATCH v2 4/7 iio:st_pressure: temperature triggered buffering
In reply to Gregor BoirieEnable support for triggered buffering of temperature samples.
--- drivers/iio/pressure/st_pressure_core.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/iio/pressure/st_pressure_core.c +13 -9
@@ -105,8 +105,6 @@#define ST_PRESS_LSB_PER_CELSIUS 480UL#define ST_PRESS_MILLI_CELSIUS_OFFSET 42500UL -#define ST_PRESS_NUMBER_DATA_CHANNELS 1 -/* FULLSCALE */ #define ST_PRESS_FS_AVL_1100MB 1100#define ST_PRESS_FS_AVL_1260MB 1260
@@ -222,7 +220,7 @@ static const struct iio_chan_spec st_press_1_channels[] = { .type = IIO_PRESSURE, .channel2 = IIO_NO_MOD, .address = ST_PRESS_1_OUT_XL_ADDR, - .scan_index = ST_SENSORS_SCAN_X, + .scan_index = 0, .scan_type = { .sign = 'u', .realbits = 24,
@@ -237,7 +235,7 @@ static const struct iio_chan_spec st_press_1_channels[] = { .type = IIO_TEMP, .channel2 = IIO_NO_MOD, .address = ST_TEMP_1_OUT_L_ADDR, - .scan_index = -1, + .scan_index = 1, .scan_type = { .sign = 'u', .realbits = 16,
@@ -250,7 +248,7 @@ static const struct iio_chan_spec st_press_1_channels[] = { BIT(IIO_CHAN_INFO_OFFSET), .modified =0 , }, -IIO_CHAN_SOFT_TIMESTAMP (1 ) +IIO_CHAN_SOFT_TIMESTAMP (2 ) }; static const struct iio_chan_spec st_press_lps001wp_channels[] = {
@@ -258,7 +256,7 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { .type = IIO_PRESSURE, .channel2 = IIO_NO_MOD, .address = ST_PRESS_LPS001WP_OUT_L_ADDR, - .scan_index = ST_SENSORS_SCAN_X, + .scan_index = 0, .scan_type = { .sign = 'u', .realbits = 16,
@@ -274,7 +272,7 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { .type = IIO_TEMP, .channel2 = IIO_NO_MOD, .address = ST_TEMP_LPS001WP_OUT_L_ADDR, - .scan_index = -1, + .scan_index = 1, .scan_type = { .sign = 'u', .realbits = 16,
@@ -286,7 +284,7 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { BIT(IIO_CHAN_INFO_SCALE), .modified =0 , }, -IIO_CHAN_SOFT_TIMESTAMP (1 ) +IIO_CHAN_SOFT_TIMESTAMP (2 ) }; static const struct iio_chan_spec st_press_lps22hb_channels[] = {
@@ -642,7 +640,13 @@ int st_press_common_probe(struct iio_dev *indio_dev)if (err <0 ) goto st_press_power_off; - press_data->num_data_channels =ST_PRESS_NUMBER_DATA_CHANNELS ; +/* +* Skip timestamping channel while declaring available channels to +* common st_sensor layer. Look at st_sensors_get_buffer_element() to +* see how timestamps are explicitly pushed as last samples block +* element. +*/ + press_data->num_data_channels = press_data->sensor_settings->num_ch -1 ; press_data->multiread_bit = press_data->sensor_settings->multi_read_bit; indio_dev->channels = press_data->sensor_settings->ch; indio_dev->num_channels = press_data->sensor_settings->num_ch;
Signature · 1 line
2.1.4
Re: [PATCH v2 4/7] iio:st_pressure: temperature triggered buffering
Quoted 3 lines · Gregor Boirie
Enable support for triggered buffering of temperature samples.
Signed-off-by Gregor Boirie <[email protected]>
Applied. Thanks
Quoted 87 lines
--- drivers/iio/pressure/st_pressure_core.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)drivers/iio/pressure/st_pressure_core.c +13
-9@@ -105,8 +105,6 @@#define ST_PRESS_LSB_PER_CELSIUS 480UL#define ST_PRESS_MILLI_CELSIUS_OFFSET 42500UL -#define ST_PRESS_NUMBER_DATA_CHANNELS 1 -/* FULLSCALE */ #define ST_PRESS_FS_AVL_1100MB 1100#define ST_PRESS_FS_AVL_1260MB 1260@@ -222,7 +220,7 @@ static const struct iio_chan_spec st_press_1_channels[] = { .type = IIO_PRESSURE, .channel2 = IIO_NO_MOD, .address = ST_PRESS_1_OUT_XL_ADDR, - .scan_index = ST_SENSORS_SCAN_X, + .scan_index = 0, .scan_type = { .sign = 'u', .realbits = 24,@@ -237,7 +235,7 @@ static const struct iio_chan_spec st_press_1_channels[] = { .type = IIO_TEMP, .channel2 = IIO_NO_MOD, .address = ST_TEMP_1_OUT_L_ADDR, - .scan_index = -1, + .scan_index = 1, .scan_type = { .sign = 'u', .realbits = 16,@@ -250,7 +248,7 @@ static const struct iio_chan_spec st_press_1_channels[] = { BIT(IIO_CHAN_INFO_OFFSET), .modified =0 , }, -IIO_CHAN_SOFT_TIMESTAMP (1 ) +IIO_CHAN_SOFT_TIMESTAMP (2 ) }; static const struct iio_chan_spec st_press_lps001wp_channels[] = {@@ -258,7 +256,7 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { .type = IIO_PRESSURE, .channel2 = IIO_NO_MOD, .address = ST_PRESS_LPS001WP_OUT_L_ADDR, - .scan_index = ST_SENSORS_SCAN_X, + .scan_index = 0, .scan_type = { .sign = 'u', .realbits = 16,@@ -274,7 +272,7 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { .type = IIO_TEMP, .channel2 = IIO_NO_MOD, .address = ST_TEMP_LPS001WP_OUT_L_ADDR, - .scan_index = -1, + .scan_index = 1, .scan_type = { .sign = 'u', .realbits = 16,@@ -286,7 +284,7 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { BIT(IIO_CHAN_INFO_SCALE), .modified =0 , }, -IIO_CHAN_SOFT_TIMESTAMP (1 ) +IIO_CHAN_SOFT_TIMESTAMP (2 ) }; static const struct iio_chan_spec st_press_lps22hb_channels[] = {@@ -642,7 +640,13 @@ int st_press_common_probe(struct iio_dev *indio_dev)if (err <0 ) goto st_press_power_off; - press_data->num_data_channels =ST_PRESS_NUMBER_DATA_CHANNELS ; +/* +* Skip timestamping channel while declaring available channels to +* common st_sensor layer. Look at st_sensors_get_buffer_element() to +* see how timestamps are explicitly pushed as last samples block +* element. +*/ + press_data->num_data_channels = press_data->sensor_settings->num_ch -1 ; press_data->multiread_bit = press_data->sensor_settings->multi_read_bit; indio_dev->channels = press_data->sensor_settings->ch; indio_dev->num_channels = press_data->sensor_settings->num_ch;
PATCH v2 5/7 iio:st_pressure:lps22hb: open drain support
In reply to Gregor BoirieAdd support for open drain interrupt line.
--- drivers/iio/pressure/st_pressure_core.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/iio/pressure/st_pressure_core.c +5 -0
@@ -213,6 +213,8 @@#define ST_PRESS_LPS22HB_DRDY_IRQ_INT2_MASK 0x08#define ST_PRESS_LPS22HB_IHL_IRQ_ADDR 0x12#define ST_PRESS_LPS22HB_IHL_IRQ_MASK 0x80 +#define ST_PRESS_LPS22HB_OD_IRQ_ADDR 0x12 +#define ST_PRESS_LPS22HB_OD_IRQ_MASK 0x40#define ST_PRESS_LPS22HB_MULTIREAD_BIT truestatic const struct iio_chan_spec st_press_1_channels[] = {
@@ -511,6 +513,9 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { .mask_int2 = ST_PRESS_LPS22HB_DRDY_IRQ_INT2_MASK, .addr_ihl = ST_PRESS_LPS22HB_IHL_IRQ_ADDR, .mask_ihl = ST_PRESS_LPS22HB_IHL_IRQ_MASK, + .addr_od = ST_PRESS_LPS22HB_OD_IRQ_ADDR, + .mask_od = ST_PRESS_LPS22HB_OD_IRQ_MASK, + .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, }, .multi_read_bit = ST_PRESS_LPS22HB_MULTIREAD_BIT, },
Signature · 1 line
2.1.4
Re: [PATCH v2 5/7] iio:st_pressure:lps22hb: open drain support
Quoted 3 lines · Gregor Boirie
Add support for open drain interrupt line.
Signed-off-by Gregor Boirie <[email protected]>
Applied. Thanks
Quoted 28 lines
--- drivers/iio/pressure/st_pressure_core.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/iio/pressure/st_pressure_core.c +5
-0@@ -213,6 +213,8 @@#define ST_PRESS_LPS22HB_DRDY_IRQ_INT2_MASK 0x08#define ST_PRESS_LPS22HB_IHL_IRQ_ADDR 0x12#define ST_PRESS_LPS22HB_IHL_IRQ_MASK 0x80 +#define ST_PRESS_LPS22HB_OD_IRQ_ADDR 0x12 +#define ST_PRESS_LPS22HB_OD_IRQ_MASK 0x40#define ST_PRESS_LPS22HB_MULTIREAD_BIT truestatic const struct iio_chan_spec st_press_1_channels[] = {@@ -511,6 +513,9 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { .mask_int2 = ST_PRESS_LPS22HB_DRDY_IRQ_INT2_MASK, .addr_ihl = ST_PRESS_LPS22HB_IHL_IRQ_ADDR, .mask_ihl = ST_PRESS_LPS22HB_IHL_IRQ_MASK, + .addr_od = ST_PRESS_LPS22HB_OD_IRQ_ADDR, + .mask_od = ST_PRESS_LPS22HB_OD_IRQ_MASK, + .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, }, .multi_read_bit = ST_PRESS_LPS22HB_MULTIREAD_BIT, },
PATCH v2 6/7 iio:st_pressure:lps22hb: temperature support
In reply to Gregor BoirieImplement lps22hb temperature sampling channel.
--- drivers/iio/pressure/st_pressure_core.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)
drivers/iio/pressure/st_pressure_core.c +23 -3
@@ -196,6 +196,10 @@* See LPS22HB datasheet: * http://www2.st.com/resource/en/datasheet/lps22hb.pdf */ + +/* LPS22HB temperature sensitivity */ +#define ST_PRESS_LPS22HB_LSB_PER_CELSIUS 100UL +#define ST_PRESS_LPS22HB_WAI_EXP 0xb1#define ST_PRESS_LPS22HB_ODR_ADDR 0x10#define ST_PRESS_LPS22HB_ODR_MASK 0x70
@@ -307,7 +311,22 @@ static const struct iio_chan_spec st_press_lps22hb_channels[] = { .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), .modified = 0, }, -IIO_CHAN_SOFT_TIMESTAMP (1 ) + { + .type = IIO_TEMP, + .address = ST_TEMP_1_OUT_L_ADDR, + .scan_index = 1, + .scan_type = { + .sign = 's', + .realbits = 16, + .storagebits = 16, + .endianness = IIO_LE, + }, + .info_mask_separate = +BIT (IIO_CHAN_INFO_RAW ) | + BIT(IIO_CHAN_INFO_SCALE), + .info_mask_shared_by_all =BIT (IIO_CHAN_INFO_SAMP_FREQ ), + }, +IIO_CHAN_SOFT_TIMESTAMP (2 ) }; static const struct st_sensor_settings st_press_sensors_settings[] = {
@@ -494,12 +513,13 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { .fs = { .fs_avl = {/* -* Sensitivity values as defined in table 3 of -* LPS22HB datasheet. +* Pressure and temperature sensitivity values +* as defined in table 3 of LPS22HB datasheet. */ [0 ] = { .num =ST_PRESS_FS_AVL_1260MB , .gain =ST_PRESS_KPASCAL_NANO_SCALE , + .gain2 =ST_PRESS_LPS22HB_LSB_PER_CELSIUS , }, }, },
Signature · 1 line
2.1.4
Re: [PATCH v2 6/7] iio:st_pressure:lps22hb: temperature support
Quoted 3 lines · Gregor Boirie
Implement lps22hb temperature sampling channel.
Signed-off-by Gregor Boirie <[email protected]>
Applied. Thanks.
Quoted 60 lines
--- drivers/iio/pressure/st_pressure_core.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)drivers/iio/pressure/st_pressure_core.c +23
-3@@ -196,6 +196,10 @@* See LPS22HB datasheet: * http://www2.st.com/resource/en/datasheet/lps22hb.pdf */ + +/* LPS22HB temperature sensitivity */ +#define ST_PRESS_LPS22HB_LSB_PER_CELSIUS 100UL +#define ST_PRESS_LPS22HB_WAI_EXP 0xb1#define ST_PRESS_LPS22HB_ODR_ADDR 0x10#define ST_PRESS_LPS22HB_ODR_MASK 0x70@@ -307,7 +311,22 @@ static const struct iio_chan_spec st_press_lps22hb_channels[] = { .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), .modified = 0, }, -IIO_CHAN_SOFT_TIMESTAMP (1 ) + { + .type = IIO_TEMP, + .address = ST_TEMP_1_OUT_L_ADDR, + .scan_index = 1, + .scan_type = { + .sign = 's', + .realbits = 16, + .storagebits = 16, + .endianness = IIO_LE, + }, + .info_mask_separate = +BIT (IIO_CHAN_INFO_RAW ) | + BIT(IIO_CHAN_INFO_SCALE), + .info_mask_shared_by_all =BIT (IIO_CHAN_INFO_SAMP_FREQ ), + }, +IIO_CHAN_SOFT_TIMESTAMP (2 ) }; static const struct st_sensor_settings st_press_sensors_settings[] = {@@ -494,12 +513,13 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { .fs = { .fs_avl = {/* -* Sensitivity values as defined in table 3 of -* LPS22HB datasheet. +* Pressure and temperature sensitivity values +* as defined in table 3 of LPS22HB datasheet. */ [0 ] = { .num =ST_PRESS_FS_AVL_1260MB , .gain =ST_PRESS_KPASCAL_NANO_SCALE , + .gain2 =ST_PRESS_LPS22HB_LSB_PER_CELSIUS , }, }, },
PATCH v2 7/7 iio:st_pressure: clean useless static channel initializers
In reply to Gregor BoirieSome static channels are explicitly initialized with default values. Remove them to enhance readability.
--- drivers/iio/pressure/st_pressure_core.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/iio/pressure/st_pressure_core.c +0 -10
@@ -224,7 +224,6 @@static const struct iio_chan_spec st_press_1_channels[] = { { .type =IIO_PRESSURE , - .channel2 =IIO_NO_MOD , .address =ST_PRESS_1_OUT_XL_ADDR , .scan_index =0 , .scan_type = {
@@ -235,11 +234,9 @@ static const struct iio_chan_spec st_press_1_channels[] = { }, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), - .modified = 0, }, { .type = IIO_TEMP, - .channel2 = IIO_NO_MOD, .address = ST_TEMP_1_OUT_L_ADDR, .scan_index = 1, .scan_type = {
@@ -252,7 +249,6 @@ static const struct iio_chan_spec st_press_1_channels[] = { BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_OFFSET), - .modified = 0, },IIO_CHAN_SOFT_TIMESTAMP (2 ) };
@@ -260,7 +256,6 @@ static const struct iio_chan_spec st_press_1_channels[] = {static const struct iio_chan_spec st_press_lps001wp_channels[] = { { .type =IIO_PRESSURE , - .channel2 =IIO_NO_MOD , .address =ST_PRESS_LPS001WP_OUT_L_ADDR , .scan_index =0 , .scan_type = {
@@ -272,11 +267,9 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), - .modified = 0, }, { .type = IIO_TEMP, - .channel2 = IIO_NO_MOD, .address = ST_TEMP_LPS001WP_OUT_L_ADDR, .scan_index = 1, .scan_type = {
@@ -288,7 +281,6 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), - .modified = 0, }, IIO_CHAN_SOFT_TIMESTAMP(2) };
@@ -296,7 +288,6 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = {static const struct iio_chan_spec st_press_lps22hb_channels[] = { { .type =IIO_PRESSURE , - .channel2 =IIO_NO_MOD , .address =ST_PRESS_1_OUT_XL_ADDR , .scan_index =0 , .scan_type = {
@@ -309,7 +300,6 @@ static const struct iio_chan_spec st_press_lps22hb_channels[] = {BIT (IIO_CHAN_INFO_RAW ) | BIT(IIO_CHAN_INFO_SCALE), .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), - .modified = 0, }, { .type = IIO_TEMP,
Signature · 1 line
2.1.4
Re: [PATCH v2 7/7] iio:st_pressure: clean useless static channel initializers
Quoted 4 lines · Gregor Boirie
Some static channels are explicitly initialized with default values. Remove them to enhance readability.
Signed-off-by Gregor Boirie <[email protected]>
Applied to the togreg branch of iio.git - initially pushed out as testing for the autobuilders to play with it.
I perhaps got a little carried away with Linus' tested by tag and added it even to those patches with only docs in them. Ah well - I'm sure he tested them by reading the docs :)
Anyhow, thanks for these and good to get them in (hopefully) before the end of this cycle.
Thanks,
Jonathan
Quoted 81 lines
--- drivers/iio/pressure/st_pressure_core.c | 10 ---------- 1 file changed, 10 deletions(-)drivers/iio/pressure/st_pressure_core.c +0
-10@@ -224,7 +224,6 @@static const struct iio_chan_spec st_press_1_channels[] = { { .type =IIO_PRESSURE , - .channel2 =IIO_NO_MOD , .address =ST_PRESS_1_OUT_XL_ADDR , .scan_index =0 , .scan_type = {@@ -235,11 +234,9 @@ static const struct iio_chan_spec st_press_1_channels[] = { }, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), - .modified = 0, }, { .type = IIO_TEMP, - .channel2 = IIO_NO_MOD, .address = ST_TEMP_1_OUT_L_ADDR, .scan_index = 1, .scan_type = {@@ -252,7 +249,6 @@ static const struct iio_chan_spec st_press_1_channels[] = { BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_OFFSET), - .modified = 0, },IIO_CHAN_SOFT_TIMESTAMP (2 ) };@@ -260,7 +256,6 @@ static const struct iio_chan_spec st_press_1_channels[] = {static const struct iio_chan_spec st_press_lps001wp_channels[] = { { .type =IIO_PRESSURE , - .channel2 =IIO_NO_MOD , .address =ST_PRESS_LPS001WP_OUT_L_ADDR , .scan_index =0 , .scan_type = {@@ -272,11 +267,9 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), - .modified = 0, }, { .type = IIO_TEMP, - .channel2 = IIO_NO_MOD, .address = ST_TEMP_LPS001WP_OUT_L_ADDR, .scan_index = 1, .scan_type = {@@ -288,7 +281,6 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), - .modified = 0, }, IIO_CHAN_SOFT_TIMESTAMP(2) };@@ -296,7 +288,6 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = {static const struct iio_chan_spec st_press_lps22hb_channels[] = { { .type =IIO_PRESSURE , - .channel2 =IIO_NO_MOD , .address =ST_PRESS_1_OUT_XL_ADDR , .scan_index =0 , .scan_type = {@@ -309,7 +300,6 @@ static const struct iio_chan_spec st_press_lps22hb_channels[] = {BIT (IIO_CHAN_INFO_RAW ) | BIT(IIO_CHAN_INFO_SCALE), .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), - .modified = 0, }, { .type = IIO_TEMP,
Re: [PATCH v2 7/7] iio:st_pressure: clean useless static channel initializers
Quoted 11 lines · Jonathan Cameron
Quoted 4 lines · Gregor Boirie
Some static channels are explicitly initialized with default values. Remove them to enhance readability.
Signed-off-by Gregor Boirie <[email protected]>Applied to the togreg branch of iio.git - initially pushed out as testing for the autobuilders to play with it.
I perhaps got a little carried away with Linus' tested by tag and added it even to those patches with only docs in them. Ah well - I'm sure he tested them by reading the docs :)
Haha who cares :)
I'm happy these patches are in, they are working like a charm here.
Yours,
Linus Walleij
I pulled in the version from Gregor on
https://github.com/grgbr/linux-iio/tree/iio-togreg-lps22hb
And then cherry-picked some fixes etc to get the Ux500 up properly. Results:
:/ lsiio
(...)
Device 005: lps001wp
cd /sys/bus/iio/devices/iio\:device5/
$ cat in_pressure_raw && cat in_temp_raw 15658 1673
OK looks reasonable, but it is unscaled so let's run generic buffer:
Using an HRtimer trigger foo:
$ generic_buffer -a -c10 -n lps001wp iio device number being used is 5 Failed to find the trigger lps001wp-trigger root@Ux500:/ generic_buffer -a -c10 -n lps001wp -t foo iio device number being used is 5 iio trigger number being used is 3 No channels are enabled, enabling all channels Enabling: in_temp_en Enabling: in_pressure_en Enabling: in_timestamp_en /sys/bus/iio/devices/iio:device5 foo 97.849998 26140.625000 946685067925048828 97.849998 26140.625000 946685067935028076 97.849998 26140.625000 946685067945465087 97.849998 26500.000000 946685067955474853 97.849998 26500.000000 946685067965332031 97.849998 26500.000000 946685067975311279 97.849998 26500.000000 946685067985351562 97.849998 26500.000000 946685067995117187 97.849998 26500.000000 946685068005340576 97.849998 26500.000000 946685068015319824 Disabling: in_temp_en Disabling: in_pressure_en Disabling: in_timestamp_en
97.8 kPa
26.5 degrees celsius
The pressure is way too low but it is a known problem with this particular sensor (same issue before patches, I guess it needs recalibration). Patches seem ready to go!
Yours,
Linus Walleij