All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/7] iio:st_pressure: improvements
@ 2016-06-27 10:38 Gregor Boirie
  2016-06-27 10:38 ` [PATCH v2 1/7] iio:st_sensors: align on storagebits boundaries Gregor Boirie
                   ` (7 more replies)
  0 siblings, 8 replies; 22+ messages in thread
From: Gregor Boirie @ 2016-06-27 10:38 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Linus Walleij, Denis Ciocca,
	Giuseppe Barba, Crestez Dan Leonard, Gregor Boirie

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(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v2 1/7] iio:st_sensors: align on storagebits boundaries
  2016-06-27 10:38 [PATCH v2 0/7] iio:st_pressure: improvements Gregor Boirie
@ 2016-06-27 10:38 ` Gregor Boirie
  2016-07-04 17:09   ` Jonathan Cameron
  2016-06-27 10:38 ` [PATCH v2 2/7] iio:st_pressure: align storagebits on power of 2 Gregor Boirie
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 22+ messages in thread
From: Gregor Boirie @ 2016-06-27 10:38 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Linus Walleij, Denis Ciocca,
	Giuseppe Barba, Crestez Dan Leonard, Gregor Boirie

Ensure triggered buffering memory accesses are properly aligned on per
channel storagebits boundaries.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
---
 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(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_buffer.c b/drivers/iio/common/st_sensors/st_sensors_buffer.c
index 50afc0f..d766643 100644
--- a/drivers/iio/common/st_sensors/st_sensors_buffer.c
+++ b/drivers/iio/common/st_sensors/st_sensors_buffer.c
@@ -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)
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 6db12ea..df9d5e8 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -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)
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v2 2/7] iio:st_pressure: align storagebits on power of 2
  2016-06-27 10:38 [PATCH v2 0/7] iio:st_pressure: improvements Gregor Boirie
  2016-06-27 10:38 ` [PATCH v2 1/7] iio:st_sensors: align on storagebits boundaries Gregor Boirie
@ 2016-06-27 10:38 ` Gregor Boirie
  2016-07-04 17:10   ` Jonathan Cameron
  2016-06-27 10:38 ` [PATCH v2 3/7] iio:st_pressure: document sampling gains Gregor Boirie
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 22+ messages in thread
From: Gregor Boirie @ 2016-06-27 10:38 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Linus Walleij, Denis Ciocca,
	Giuseppe Barba, Crestez Dan Leonard, Gregor Boirie

Sampled pressure data are 24 bits long and should be stored in a 32 bits
word.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
---
 drivers/iio/pressure/st_pressure_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 56d8f5e..8fa3d81 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -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 =
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v2 3/7] iio:st_pressure: document sampling gains
  2016-06-27 10:38 [PATCH v2 0/7] iio:st_pressure: improvements Gregor Boirie
  2016-06-27 10:38 ` [PATCH v2 1/7] iio:st_sensors: align on storagebits boundaries Gregor Boirie
  2016-06-27 10:38 ` [PATCH v2 2/7] iio:st_pressure: align storagebits on power of 2 Gregor Boirie
@ 2016-06-27 10:38 ` Gregor Boirie
  2016-06-27 16:44   ` Linus Walleij
  2016-07-04 17:15   ` Jonathan Cameron
  2016-06-27 10:38 ` [PATCH v2 4/7] iio:st_pressure: temperature triggered buffering Gregor Boirie
                   ` (4 subsequent siblings)
  7 siblings, 2 replies; 22+ messages in thread
From: Gregor Boirie @ 2016-06-27 10:38 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Linus Walleij, Denis Ciocca,
	Giuseppe Barba, Crestez Dan Leonard, Gregor Boirie

Details scaling factors and offsets applied to raw temperature and pressure
samples.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
---
 drivers/iio/pressure/st_pressure_core.c | 92 +++++++++++++++++++++++++++++++--
 1 file changed, 88 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 8fa3d81..2ab1056 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -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,
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v2 4/7] iio:st_pressure: temperature triggered buffering
  2016-06-27 10:38 [PATCH v2 0/7] iio:st_pressure: improvements Gregor Boirie
                   ` (2 preceding siblings ...)
  2016-06-27 10:38 ` [PATCH v2 3/7] iio:st_pressure: document sampling gains Gregor Boirie
@ 2016-06-27 10:38 ` Gregor Boirie
  2016-07-04 17:15   ` Jonathan Cameron
  2016-06-27 10:38 ` [PATCH v2 5/7] iio:st_pressure:lps22hb: open drain support Gregor Boirie
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 22+ messages in thread
From: Gregor Boirie @ 2016-06-27 10:38 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Linus Walleij, Denis Ciocca,
	Giuseppe Barba, Crestez Dan Leonard, Gregor Boirie

Enable support for triggered buffering of temperature samples.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
---
 drivers/iio/pressure/st_pressure_core.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 2ab1056..ea8241f 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -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;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v2 5/7] iio:st_pressure:lps22hb: open drain support
  2016-06-27 10:38 [PATCH v2 0/7] iio:st_pressure: improvements Gregor Boirie
                   ` (3 preceding siblings ...)
  2016-06-27 10:38 ` [PATCH v2 4/7] iio:st_pressure: temperature triggered buffering Gregor Boirie
@ 2016-06-27 10:38 ` Gregor Boirie
  2016-07-04 17:15   ` Jonathan Cameron
  2016-06-27 10:38 ` [PATCH v2 6/7] iio:st_pressure:lps22hb: temperature support Gregor Boirie
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 22+ messages in thread
From: Gregor Boirie @ 2016-06-27 10:38 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Linus Walleij, Denis Ciocca,
	Giuseppe Barba, Crestez Dan Leonard, Gregor Boirie

Add support for open drain interrupt line.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
---
 drivers/iio/pressure/st_pressure_core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index ea8241f..70230a1 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -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		true
 
 static 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,
 	},
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v2 6/7] iio:st_pressure:lps22hb: temperature support
  2016-06-27 10:38 [PATCH v2 0/7] iio:st_pressure: improvements Gregor Boirie
                   ` (4 preceding siblings ...)
  2016-06-27 10:38 ` [PATCH v2 5/7] iio:st_pressure:lps22hb: open drain support Gregor Boirie
@ 2016-06-27 10:38 ` Gregor Boirie
  2016-07-04 17:15   ` Jonathan Cameron
  2016-06-27 10:38 ` [PATCH v2 7/7] iio:st_pressure: clean useless static channel initializers Gregor Boirie
  2016-07-04  8:15 ` [PATCH v2 0/7] iio:st_pressure: improvements Linus Walleij
  7 siblings, 1 reply; 22+ messages in thread
From: Gregor Boirie @ 2016-06-27 10:38 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Linus Walleij, Denis Ciocca,
	Giuseppe Barba, Crestez Dan Leonard, Gregor Boirie

Implement lps22hb temperature sampling channel.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
---
 drivers/iio/pressure/st_pressure_core.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 70230a1..274cdec 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -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,
 				},
 			},
 		},
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v2 7/7] iio:st_pressure: clean useless static channel initializers
  2016-06-27 10:38 [PATCH v2 0/7] iio:st_pressure: improvements Gregor Boirie
                   ` (5 preceding siblings ...)
  2016-06-27 10:38 ` [PATCH v2 6/7] iio:st_pressure:lps22hb: temperature support Gregor Boirie
@ 2016-06-27 10:38 ` Gregor Boirie
  2016-07-04 17:17   ` Jonathan Cameron
  2016-07-04  8:15 ` [PATCH v2 0/7] iio:st_pressure: improvements Linus Walleij
  7 siblings, 1 reply; 22+ messages in thread
From: Gregor Boirie @ 2016-06-27 10:38 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Linus Walleij, Denis Ciocca,
	Giuseppe Barba, Crestez Dan Leonard, Gregor Boirie

Some static channels are explicitly initialized with default values.
Remove them to enhance readability.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
---
 drivers/iio/pressure/st_pressure_core.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 274cdec..55df9a7 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -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,
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 3/7] iio:st_pressure: document sampling gains
  2016-06-27 10:38 ` [PATCH v2 3/7] iio:st_pressure: document sampling gains Gregor Boirie
@ 2016-06-27 16:44   ` Linus Walleij
  2016-06-28  8:41     ` Gregor Boirie
  2016-07-04 17:15   ` Jonathan Cameron
  1 sibling, 1 reply; 22+ messages in thread
From: Linus Walleij @ 2016-06-27 16:44 UTC (permalink / raw)
  To: Gregor Boirie
  Cc: linux-iio, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Denis Ciocca, Giuseppe Barba,
	Crestez Dan Leonard

On Mon, Jun 27, 2016 at 12:38 PM, Gregor Boirie
<gregor.boirie@parrot.com> wrote:

> Details scaling factors and offsets applied to raw temperature and pressure
> samples.
>
> Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>

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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 3/7] iio:st_pressure: document sampling gains
  2016-06-27 16:44   ` Linus Walleij
@ 2016-06-28  8:41     ` Gregor Boirie
  2016-07-03  9:29       ` Jonathan Cameron
  0 siblings, 1 reply; 22+ messages in thread
From: Gregor Boirie @ 2016-06-28  8:41 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-iio, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Denis Ciocca, Giuseppe Barba,
	Crestez Dan Leonard

Linus,

On 06/27/2016 06:44 PM, Linus Walleij wrote:
> On Mon, Jun 27, 2016 at 12:38 PM, Gregor Boirie
> <gregor.boirie@parrot.com> wrote:
>
>> Details scaling factors and offsets applied to raw temperature and pressure
>> samples.
>>
>> Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
> 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".
yep. it seems the patch "iio:st_pressure: fix sampling gains (bring 
inline with ABI)"
is not applied onto togreg branch.

>
> 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
>
> Yours,
> Linus Walleij

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 3/7] iio:st_pressure: document sampling gains
  2016-06-28  8:41     ` Gregor Boirie
@ 2016-07-03  9:29       ` Jonathan Cameron
  2016-07-04  8:16         ` Linus Walleij
  0 siblings, 1 reply; 22+ messages in thread
From: Jonathan Cameron @ 2016-07-03  9:29 UTC (permalink / raw)
  To: Gregor Boirie, Linus Walleij
  Cc: linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Denis Ciocca, Giuseppe Barba,
	Crestez Dan Leonard

On 28/06/16 09:41, Gregor Boirie wrote:
> Linus,
> 
> On 06/27/2016 06:44 PM, Linus Walleij wrote:
>> On Mon, Jun 27, 2016 at 12:38 PM, Gregor Boirie
>> <gregor.boirie@parrot.com> wrote:
>>
>>> Details scaling factors and offsets applied to raw temperature and pressure
>>> samples.
>>>
>>> Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
>> 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".
> yep. it seems the patch "iio:st_pressure: fix sampling gains (bring inline with ABI)"
> is not applied onto togreg branch.
> 
>>
>> 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
>>
>> Yours,
>> Linus Walleij
> 


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 0/7] iio:st_pressure: improvements
  2016-06-27 10:38 [PATCH v2 0/7] iio:st_pressure: improvements Gregor Boirie
                   ` (6 preceding siblings ...)
  2016-06-27 10:38 ` [PATCH v2 7/7] iio:st_pressure: clean useless static channel initializers Gregor Boirie
@ 2016-07-04  8:15 ` Linus Walleij
  7 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2016-07-04  8:15 UTC (permalink / raw)
  To: Gregor Boirie
  Cc: linux-iio, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Denis Ciocca, Giuseppe Barba,
	Crestez Dan Leonard

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!

Tested-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 3/7] iio:st_pressure: document sampling gains
  2016-07-03  9:29       ` Jonathan Cameron
@ 2016-07-04  8:16         ` Linus Walleij
  2016-07-04 17:05           ` Jonathan Cameron
  0 siblings, 1 reply; 22+ messages in thread
From: Linus Walleij @ 2016-07-04  8:16 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Gregor Boirie, linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Denis Ciocca, Giuseppe Barba,
	Crestez Dan Leonard

On Sun, Jul 3, 2016 at 11:29 AM, Jonathan Cameron <jic23@kernel.org> wrote:

> 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 3/7] iio:st_pressure: document sampling gains
  2016-07-04  8:16         ` Linus Walleij
@ 2016-07-04 17:05           ` Jonathan Cameron
  0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2016-07-04 17:05 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Gregor Boirie, linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Denis Ciocca, Giuseppe Barba,
	Crestez Dan Leonard

On 04/07/16 09:16, Linus Walleij wrote:
> On Sun, Jul 3, 2016 at 11:29 AM, Jonathan Cameron <jic23@kernel.org> wrote:
> 
>> 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.
> Yours,
> Linus Walleij
> 


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 1/7] iio:st_sensors: align on storagebits boundaries
  2016-06-27 10:38 ` [PATCH v2 1/7] iio:st_sensors: align on storagebits boundaries Gregor Boirie
@ 2016-07-04 17:09   ` Jonathan Cameron
  0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2016-07-04 17:09 UTC (permalink / raw)
  To: Gregor Boirie, linux-iio
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Linus Walleij, Denis Ciocca, Giuseppe Barba, Crestez Dan Leonard

On 27/06/16 11:38, Gregor Boirie wrote:
> Ensure triggered buffering memory accesses are properly aligned on per
> channel storagebits boundaries.
> 
> Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Applied to the togreg branch of iio.git - initially pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan
> ---
>  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(-)
> 
> diff --git a/drivers/iio/common/st_sensors/st_sensors_buffer.c b/drivers/iio/common/st_sensors/st_sensors_buffer.c
> index 50afc0f..d766643 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_buffer.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_buffer.c
> @@ -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)
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index 6db12ea..df9d5e8 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -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)
> 


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 2/7] iio:st_pressure: align storagebits on power of 2
  2016-06-27 10:38 ` [PATCH v2 2/7] iio:st_pressure: align storagebits on power of 2 Gregor Boirie
@ 2016-07-04 17:10   ` Jonathan Cameron
  0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2016-07-04 17:10 UTC (permalink / raw)
  To: Gregor Boirie, linux-iio
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Linus Walleij, Denis Ciocca, Giuseppe Barba, Crestez Dan Leonard

On 27/06/16 11:38, Gregor Boirie wrote:
> Sampled pressure data are 24 bits long and should be stored in a 32 bits
> word.
> 
> Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Applied.
> ---
>  drivers/iio/pressure/st_pressure_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 56d8f5e..8fa3d81 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -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 =
> 


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 3/7] iio:st_pressure: document sampling gains
  2016-06-27 10:38 ` [PATCH v2 3/7] iio:st_pressure: document sampling gains Gregor Boirie
  2016-06-27 16:44   ` Linus Walleij
@ 2016-07-04 17:15   ` Jonathan Cameron
  1 sibling, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2016-07-04 17:15 UTC (permalink / raw)
  To: Gregor Boirie, linux-iio
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Linus Walleij, Denis Ciocca, Giuseppe Barba, Crestez Dan Leonard

On 27/06/16 11:38, Gregor Boirie wrote:
> Details scaling factors and offsets applied to raw temperature and pressure
> samples.
> 
> Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Applied. 
> ---
>  drivers/iio/pressure/st_pressure_core.c | 92 +++++++++++++++++++++++++++++++--
>  1 file changed, 88 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 8fa3d81..2ab1056 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -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,
> 


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 4/7] iio:st_pressure: temperature triggered buffering
  2016-06-27 10:38 ` [PATCH v2 4/7] iio:st_pressure: temperature triggered buffering Gregor Boirie
@ 2016-07-04 17:15   ` Jonathan Cameron
  0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2016-07-04 17:15 UTC (permalink / raw)
  To: Gregor Boirie, linux-iio
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Linus Walleij, Denis Ciocca, Giuseppe Barba, Crestez Dan Leonard

On 27/06/16 11:38, Gregor Boirie wrote:
> Enable support for triggered buffering of temperature samples.
> 
> Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Applied. Thanks
> ---
>  drivers/iio/pressure/st_pressure_core.c | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 2ab1056..ea8241f 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -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;
> 


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 5/7] iio:st_pressure:lps22hb: open drain support
  2016-06-27 10:38 ` [PATCH v2 5/7] iio:st_pressure:lps22hb: open drain support Gregor Boirie
@ 2016-07-04 17:15   ` Jonathan Cameron
  0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2016-07-04 17:15 UTC (permalink / raw)
  To: Gregor Boirie, linux-iio
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Linus Walleij, Denis Ciocca, Giuseppe Barba, Crestez Dan Leonard

On 27/06/16 11:38, Gregor Boirie wrote:
> Add support for open drain interrupt line.
> 
> Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Applied.  Thanks
> ---
>  drivers/iio/pressure/st_pressure_core.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index ea8241f..70230a1 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -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		true
>  
>  static 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,
>  	},
> 


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 6/7] iio:st_pressure:lps22hb: temperature support
  2016-06-27 10:38 ` [PATCH v2 6/7] iio:st_pressure:lps22hb: temperature support Gregor Boirie
@ 2016-07-04 17:15   ` Jonathan Cameron
  0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2016-07-04 17:15 UTC (permalink / raw)
  To: Gregor Boirie, linux-iio
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Linus Walleij, Denis Ciocca, Giuseppe Barba, Crestez Dan Leonard

On 27/06/16 11:38, Gregor Boirie wrote:
> Implement lps22hb temperature sampling channel.
> 
> Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Applied. Thanks.
> ---
>  drivers/iio/pressure/st_pressure_core.c | 26 +++++++++++++++++++++++---
>  1 file changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 70230a1..274cdec 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -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,
>  				},
>  			},
>  		},
> 


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 7/7] iio:st_pressure: clean useless static channel initializers
  2016-06-27 10:38 ` [PATCH v2 7/7] iio:st_pressure: clean useless static channel initializers Gregor Boirie
@ 2016-07-04 17:17   ` Jonathan Cameron
  2016-07-05 12:48     ` Linus Walleij
  0 siblings, 1 reply; 22+ messages in thread
From: Jonathan Cameron @ 2016-07-04 17:17 UTC (permalink / raw)
  To: Gregor Boirie, linux-iio
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Linus Walleij, Denis Ciocca, Giuseppe Barba, Crestez Dan Leonard

On 27/06/16 11:38, Gregor Boirie wrote:
> Some static channels are explicitly initialized with default values.
> Remove them to enhance readability.
> 
> Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
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
> ---
>  drivers/iio/pressure/st_pressure_core.c | 10 ----------
>  1 file changed, 10 deletions(-)
> 
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 274cdec..55df9a7 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -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,
> 


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 7/7] iio:st_pressure: clean useless static channel initializers
  2016-07-04 17:17   ` Jonathan Cameron
@ 2016-07-05 12:48     ` Linus Walleij
  0 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2016-07-05 12:48 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Gregor Boirie, linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Denis Ciocca, Giuseppe Barba,
	Crestez Dan Leonard

On Mon, Jul 4, 2016 at 7:17 PM, Jonathan Cameron <jic23@kernel.org> wrote:
> On 27/06/16 11:38, Gregor Boirie wrote:
>> Some static channels are explicitly initialized with default values.
>> Remove them to enhance readability.
>>
>> Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
> 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

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2016-07-05 12:48 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-27 10:38 [PATCH v2 0/7] iio:st_pressure: improvements Gregor Boirie
2016-06-27 10:38 ` [PATCH v2 1/7] iio:st_sensors: align on storagebits boundaries Gregor Boirie
2016-07-04 17:09   ` Jonathan Cameron
2016-06-27 10:38 ` [PATCH v2 2/7] iio:st_pressure: align storagebits on power of 2 Gregor Boirie
2016-07-04 17:10   ` Jonathan Cameron
2016-06-27 10:38 ` [PATCH v2 3/7] iio:st_pressure: document sampling gains Gregor Boirie
2016-06-27 16:44   ` Linus Walleij
2016-06-28  8:41     ` Gregor Boirie
2016-07-03  9:29       ` Jonathan Cameron
2016-07-04  8:16         ` Linus Walleij
2016-07-04 17:05           ` Jonathan Cameron
2016-07-04 17:15   ` Jonathan Cameron
2016-06-27 10:38 ` [PATCH v2 4/7] iio:st_pressure: temperature triggered buffering Gregor Boirie
2016-07-04 17:15   ` Jonathan Cameron
2016-06-27 10:38 ` [PATCH v2 5/7] iio:st_pressure:lps22hb: open drain support Gregor Boirie
2016-07-04 17:15   ` Jonathan Cameron
2016-06-27 10:38 ` [PATCH v2 6/7] iio:st_pressure:lps22hb: temperature support Gregor Boirie
2016-07-04 17:15   ` Jonathan Cameron
2016-06-27 10:38 ` [PATCH v2 7/7] iio:st_pressure: clean useless static channel initializers Gregor Boirie
2016-07-04 17:17   ` Jonathan Cameron
2016-07-05 12:48     ` Linus Walleij
2016-07-04  8:15 ` [PATCH v2 0/7] iio:st_pressure: improvements Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.