Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1318143 > unrolled thread
| Started by | Daniel Baluta <daniel.baluta@intel.com> |
|---|---|
| First post | 2016-01-26 18:00 +0100 |
| Last post | 2016-01-26 18:00 +0100 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH v2 0/2] ms5611: Add triggered buffer support Daniel Baluta <daniel.baluta@intel.com> - 2016-01-26 18:00 +0100
[PATCH v2 1/2] iio: pressure: ms5611: Add IIO_CHAN_INFO_SCALE to mask Daniel Baluta <daniel.baluta@intel.com> - 2016-01-26 18:00 +0100
| From | Daniel Baluta <daniel.baluta@intel.com> |
|---|---|
| Date | 2016-01-26 18:00 +0100 |
| Subject | [PATCH v2 0/2] ms5611: Add triggered buffer support |
| Message-ID | <qVf8f-6St-19@gated-at.bofh.it> |
First patch reverts 7cb46c2a066 ("iio: pressure: ms5611: remove
IIO_CHAN_INFO_SCALE from mask") because we need the scale to correctly
transform "raw" data from buffer into correct measurement units.
Second patch adds the actual buffer support.
Changes since v1:
* addressed comments from Peter
* explain why the need for allocating a buffer of 4 s32 elements
* correctly handle data copy into buffer when not all channels are enabled
* fixed timestamp channel index (2 instead of 3)
* added some new lines for readability
Daniel Baluta (2):
iio: pressure: ms5611: Add IIO_CHAN_INFO_SCALE to mask
iio: pressure: ms5611: Add triggered buffer support
drivers/iio/pressure/Kconfig | 1 +
drivers/iio/pressure/ms5611.h | 1 +
drivers/iio/pressure/ms5611_core.c | 95 ++++++++++++++++++++++++++++++++++++--
drivers/iio/pressure/ms5611_i2c.c | 7 +++
drivers/iio/pressure/ms5611_spi.c | 8 ++++
5 files changed, 108 insertions(+), 4 deletions(-)
--
2.5.0
[toc] | [next] | [standalone]
| From | Daniel Baluta <daniel.baluta@intel.com> |
|---|---|
| Date | 2016-01-26 18:00 +0100 |
| Subject | [PATCH v2 1/2] iio: pressure: ms5611: Add IIO_CHAN_INFO_SCALE to mask |
| Message-ID | <qVf8f-6St-31@gated-at.bofh.it> |
| In reply to | #1318143 |
This allows data exported via buffer interface to be converted
to standard units in userspace.
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
---
drivers/iio/pressure/ms5611_core.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/pressure/ms5611_core.c b/drivers/iio/pressure/ms5611_core.c
index 2f3d9b4..6cf0e55 100644
--- a/drivers/iio/pressure/ms5611_core.c
+++ b/drivers/iio/pressure/ms5611_core.c
@@ -201,6 +201,18 @@ static int ms5611_read_raw(struct iio_dev *indio_dev,
default:
return -EINVAL;
}
+ case IIO_CHAN_INFO_SCALE:
+ switch (chan->type) {
+ case IIO_TEMP:
+ *val = 10;
+ return IIO_VAL_INT;
+ case IIO_PRESSURE:
+ *val = 0;
+ *val2 = 1000;
+ return IIO_VAL_INT_PLUS_MICRO;
+ default:
+ return -EINVAL;
+ }
}
return -EINVAL;
@@ -218,11 +230,13 @@ static struct ms5611_chip_info chip_info_tbl[] = {
static const struct iio_chan_spec ms5611_channels[] = {
{
.type = IIO_PRESSURE,
- .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
+ .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) |
+ BIT(IIO_CHAN_INFO_SCALE),
},
{
.type = IIO_TEMP,
- .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
+ .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) |
+ BIT(IIO_CHAN_INFO_SCALE),
}
};
--
2.5.0
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web