All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/5] Add support to LIS2DW12 accel sensor
@ 2017-08-30 11:50 ` Lorenzo Bianconi
  0 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-08-30 11:50 UTC (permalink / raw)
  To: jic23-DgEjT+Ai2ygdnm+yROfE0A
  Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
	lorenzo.bianconi-qxv4g6HH51o, devicetree-u79uwXL29TY76Z2rM5mHXA

Modify management of drdy line and status register in order to support
LIS2DW12 device

Changes since v2:
- swap status register patch (3rd in v2) with irq{1,2} definition one
  (1st in v2)
- patchset rebased onto 'fix drdy line configuration for LIS3MDL' patch
Changes since v1:
- remove drdy_irq parameter from LPS001WP settings since the sensor
does not support data-ready interrupts

Lorenzo Bianconi (5):
  iio: st_sensors: add register mask for status register
  iio: st_sensors: decouple irq1 configuration parameters from the irq2
    ones
  iio: st_sensors: do not always write enable_axis register
  iio: accel: add support to LIS2DW12
  dt-bindings: iio: accel: add LIS2DW12 sensor device binding

 .../devicetree/bindings/iio/st-sensors.txt         |   1 +
 drivers/iio/accel/st_accel.h                       |   2 +
 drivers/iio/accel/st_accel_core.c                  | 180 +++++++++++++++++----
 drivers/iio/accel/st_accel_i2c.c                   |   5 +
 drivers/iio/accel/st_accel_spi.c                   |   5 +
 drivers/iio/common/st_sensors/st_sensors_core.c    |  35 ++--
 drivers/iio/common/st_sensors/st_sensors_trigger.c |  16 +-
 drivers/iio/gyro/st_gyro_core.c                    |  33 ++--
 drivers/iio/magnetometer/st_magn_core.c            |  16 +-
 drivers/iio/pressure/st_pressure_core.c            |  46 ++++--
 include/linux/iio/common/st_sensors.h              |  23 ++-
 11 files changed, 270 insertions(+), 92 deletions(-)

-- 
2.14.1

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

* [PATCH v3 0/5] Add support to LIS2DW12 accel sensor
@ 2017-08-30 11:50 ` Lorenzo Bianconi
  0 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-08-30 11:50 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio, linus.walleij, lorenzo.bianconi, devicetree

Modify management of drdy line and status register in order to support
LIS2DW12 device

Changes since v2:
- swap status register patch (3rd in v2) with irq{1,2} definition one
  (1st in v2)
- patchset rebased onto 'fix drdy line configuration for LIS3MDL' patch
Changes since v1:
- remove drdy_irq parameter from LPS001WP settings since the sensor
does not support data-ready interrupts

Lorenzo Bianconi (5):
  iio: st_sensors: add register mask for status register
  iio: st_sensors: decouple irq1 configuration parameters from the irq2
    ones
  iio: st_sensors: do not always write enable_axis register
  iio: accel: add support to LIS2DW12
  dt-bindings: iio: accel: add LIS2DW12 sensor device binding

 .../devicetree/bindings/iio/st-sensors.txt         |   1 +
 drivers/iio/accel/st_accel.h                       |   2 +
 drivers/iio/accel/st_accel_core.c                  | 180 +++++++++++++++++----
 drivers/iio/accel/st_accel_i2c.c                   |   5 +
 drivers/iio/accel/st_accel_spi.c                   |   5 +
 drivers/iio/common/st_sensors/st_sensors_core.c    |  35 ++--
 drivers/iio/common/st_sensors/st_sensors_trigger.c |  16 +-
 drivers/iio/gyro/st_gyro_core.c                    |  33 ++--
 drivers/iio/magnetometer/st_magn_core.c            |  16 +-
 drivers/iio/pressure/st_pressure_core.c            |  46 ++++--
 include/linux/iio/common/st_sensors.h              |  23 ++-
 11 files changed, 270 insertions(+), 92 deletions(-)

-- 
2.14.1


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

* [PATCH v3 1/5] iio: st_sensors: add register mask for status register
  2017-08-30 11:50 ` Lorenzo Bianconi
@ 2017-08-30 11:50     ` Lorenzo Bianconi
  -1 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-08-30 11:50 UTC (permalink / raw)
  To: jic23-DgEjT+Ai2ygdnm+yROfE0A
  Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
	lorenzo.bianconi-qxv4g6HH51o, devicetree-u79uwXL29TY76Z2rM5mHXA

Introduce register mask for data-ready status register since
pressure sensors (e.g. LPS22HB) export just two channels
(BIT(0) and BIT(1)) and BIT(2) is marked reserved while in
st_sensors_new_samples_available() value read from status register
is masked using 0x7.
Moreover do not mask status register using active_scan_mask since
now status value is properly masked and if the result is not zero the
interrupt has to be consumed by the driver. This fix an issue on LPS25H
and LPS331AP where channel definition is swapped respect to status
register.
Furthermore that change allows to properly support new devices
(e.g LIS2DW12) that report just ZYXDA (data-ready) field in status register
to figure out if the interrupt has been generated by the device.

Fixes: 97865fe41322 (iio: st_sensors: verify interrupt event to status)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
---
 drivers/iio/accel/st_accel_core.c                  | 35 +++++++++++++++++-----
 drivers/iio/common/st_sensors/st_sensors_core.c    |  2 +-
 drivers/iio/common/st_sensors/st_sensors_trigger.c | 16 +++-------
 drivers/iio/gyro/st_gyro_core.c                    | 15 ++++++++--
 drivers/iio/magnetometer/st_magn_core.c            | 10 +++++--
 drivers/iio/pressure/st_pressure_core.c            | 15 ++++++++--
 include/linux/iio/common/st_sensors.h              |  7 +++--
 7 files changed, 70 insertions(+), 30 deletions(-)

diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index 1a2e54ff473a..140ba26f6131 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -164,7 +164,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask_int2 = 0x00,
 			.addr_ihl = 0x25,
 			.mask_ihl = 0x02,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.sim = {
 			.addr = 0x23,
@@ -236,7 +239,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask_ihl = 0x80,
 			.addr_od = 0x22,
 			.mask_od = 0x40,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.sim = {
 			.addr = 0x23,
@@ -318,7 +324,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask_int2 = 0x00,
 			.addr_ihl = 0x23,
 			.mask_ihl = 0x40,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 			.ig1 = {
 				.en_addr = 0x23,
 				.en_mask = 0x08,
@@ -389,7 +398,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 		.drdy_irq = {
 			.addr = 0x21,
 			.mask_int1 = 0x04,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.sim = {
 			.addr = 0x21,
@@ -451,7 +463,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask_ihl = 0x80,
 			.addr_od = 0x22,
 			.mask_od = 0x40,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.sim = {
 			.addr = 0x21,
@@ -569,7 +584,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 		.drdy_irq = {
 			.addr = 0x21,
 			.mask_int1 = 0x04,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.sim = {
 			.addr = 0x21,
@@ -640,7 +658,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask_int2 = 0x00,
 			.addr_ihl = 0x25,
 			.mask_ihl = 0x02,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.sim = {
 			.addr = 0x23,
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 02e833b14db0..34115f05d5c4 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -470,7 +470,7 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)
 		 * different one. Take into account irq status register
 		 * to understand if irq trigger can be properly supported
 		 */
-		if (sdata->sensor_settings->drdy_irq.addr_stat_drdy)
+		if (sdata->sensor_settings->drdy_irq.stat_drdy.addr)
 			sdata->hw_irq_trigger = enable;
 		return 0;
 	}
diff --git a/drivers/iio/common/st_sensors/st_sensors_trigger.c b/drivers/iio/common/st_sensors/st_sensors_trigger.c
index fa73e6795359..fdcc5a891958 100644
--- a/drivers/iio/common/st_sensors/st_sensors_trigger.c
+++ b/drivers/iio/common/st_sensors/st_sensors_trigger.c
@@ -31,7 +31,7 @@ static int st_sensors_new_samples_available(struct iio_dev *indio_dev,
 	int ret;
 
 	/* How would I know if I can't check it? */
-	if (!sdata->sensor_settings->drdy_irq.addr_stat_drdy)
+	if (!sdata->sensor_settings->drdy_irq.stat_drdy.addr)
 		return -EINVAL;
 
 	/* No scan mask, no interrupt */
@@ -39,23 +39,15 @@ static int st_sensors_new_samples_available(struct iio_dev *indio_dev,
 		return 0;
 
 	ret = sdata->tf->read_byte(&sdata->tb, sdata->dev,
-			sdata->sensor_settings->drdy_irq.addr_stat_drdy,
+			sdata->sensor_settings->drdy_irq.stat_drdy.addr,
 			&status);
 	if (ret < 0) {
 		dev_err(sdata->dev,
 			"error checking samples available\n");
 		return ret;
 	}
-	/*
-	 * the lower bits of .active_scan_mask[0] is directly mapped
-	 * to the channels on the sensor: either bit 0 for
-	 * one-dimensional sensors, or e.g. x,y,z for accelerometers,
-	 * gyroscopes or magnetometers. No sensor use more than 3
-	 * channels, so cut the other status bits here.
-	 */
-	status &= 0x07;
 
-	if (status & (u8)indio_dev->active_scan_mask[0])
+	if (status & sdata->sensor_settings->drdy_irq.stat_drdy.mask)
 		return 1;
 
 	return 0;
@@ -212,7 +204,7 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
 	 * it was "our" interrupt.
 	 */
 	if (sdata->int_pin_open_drain &&
-	    sdata->sensor_settings->drdy_irq.addr_stat_drdy)
+	    sdata->sensor_settings->drdy_irq.stat_drdy.addr)
 		irq_trig |= IRQF_SHARED;
 
 	err = request_threaded_irq(sdata->get_irq_data_ready(indio_dev),
diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c
index 4cf85aa01dde..22c0c1732996 100644
--- a/drivers/iio/gyro/st_gyro_core.c
+++ b/drivers/iio/gyro/st_gyro_core.c
@@ -118,7 +118,10 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
 			 * drain settings, but only for INT1 and not
 			 * for the DRDY line on INT2.
 			 */
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.multi_read_bit = true,
 		.bootime = 2,
@@ -188,7 +191,10 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
 			 * drain settings, but only for INT1 and not
 			 * for the DRDY line on INT2.
 			 */
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.multi_read_bit = true,
 		.bootime = 2,
@@ -253,7 +259,10 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
 			 * drain settings, but only for INT1 and not
 			 * for the DRDY line on INT2.
 			 */
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.multi_read_bit = true,
 		.bootime = 2,
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
index 703de313c418..ace72c57f53c 100644
--- a/drivers/iio/magnetometer/st_magn_core.c
+++ b/drivers/iio/magnetometer/st_magn_core.c
@@ -317,7 +317,10 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = {
 		},
 		.drdy_irq = {
 			/* drdy line is routed drdy pin */
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.multi_read_bit = true,
 		.bootime = 2,
@@ -361,7 +364,10 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = {
 		.drdy_irq = {
 			.addr = 0x62,
 			.mask_int1 = 0x01,
-			.addr_stat_drdy = 0x67,
+			.stat_drdy = {
+				.addr = 0x67,
+				.mask = 0x07,
+			},
 		},
 		.multi_read_bit = false,
 		.bootime = 2,
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 3117f4ce76e4..c2f7c2fe20ab 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -287,7 +287,10 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
 			.mask_ihl = 0x80,
 			.addr_od = 0x22,
 			.mask_od = 0x40,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x03,
+			},
 		},
 		.multi_read_bit = true,
 		.bootime = 2,
@@ -395,7 +398,10 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
 			.mask_ihl = 0x80,
 			.addr_od = 0x22,
 			.mask_od = 0x40,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x03,
+			},
 		},
 		.multi_read_bit = true,
 		.bootime = 2,
@@ -454,7 +460,10 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
 			.mask_ihl = 0x80,
 			.addr_od = 0x12,
 			.mask_od = 0x40,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x03,
+			},
 		},
 		.multi_read_bit = false,
 		.bootime = 2,
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 7b0fa8b5c120..ce0ef1c0a30a 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -139,7 +139,7 @@ struct st_sensor_das {
  * @mask_ihl: mask to enable/disable active low on the INT lines.
  * @addr_od: address to enable/disable Open Drain on the INT lines.
  * @mask_od: mask to enable/disable Open Drain on the INT lines.
- * @addr_stat_drdy: address to read status of DRDY (data ready) interrupt
+ * struct stat_drdy - status register of DRDY (data ready) interrupt.
  * struct ig1 - represents the Interrupt Generator 1 of sensors.
  * @en_addr: address of the enable ig1 register.
  * @en_mask: mask to write the on/off value for enable.
@@ -152,7 +152,10 @@ struct st_sensor_data_ready_irq {
 	u8 mask_ihl;
 	u8 addr_od;
 	u8 mask_od;
-	u8 addr_stat_drdy;
+	struct {
+		u8 addr;
+		u8 mask;
+	} stat_drdy;
 	struct {
 		u8 en_addr;
 		u8 en_mask;
-- 
2.14.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v3 1/5] iio: st_sensors: add register mask for status register
@ 2017-08-30 11:50     ` Lorenzo Bianconi
  0 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-08-30 11:50 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio, linus.walleij, lorenzo.bianconi, devicetree

Introduce register mask for data-ready status register since
pressure sensors (e.g. LPS22HB) export just two channels
(BIT(0) and BIT(1)) and BIT(2) is marked reserved while in
st_sensors_new_samples_available() value read from status register
is masked using 0x7.
Moreover do not mask status register using active_scan_mask since
now status value is properly masked and if the result is not zero the
interrupt has to be consumed by the driver. This fix an issue on LPS25H
and LPS331AP where channel definition is swapped respect to status
register.
Furthermore that change allows to properly support new devices
(e.g LIS2DW12) that report just ZYXDA (data-ready) field in status register
to figure out if the interrupt has been generated by the device.

Fixes: 97865fe41322 (iio: st_sensors: verify interrupt event to status)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
---
 drivers/iio/accel/st_accel_core.c                  | 35 +++++++++++++++++-----
 drivers/iio/common/st_sensors/st_sensors_core.c    |  2 +-
 drivers/iio/common/st_sensors/st_sensors_trigger.c | 16 +++-------
 drivers/iio/gyro/st_gyro_core.c                    | 15 ++++++++--
 drivers/iio/magnetometer/st_magn_core.c            | 10 +++++--
 drivers/iio/pressure/st_pressure_core.c            | 15 ++++++++--
 include/linux/iio/common/st_sensors.h              |  7 +++--
 7 files changed, 70 insertions(+), 30 deletions(-)

diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index 1a2e54ff473a..140ba26f6131 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -164,7 +164,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask_int2 = 0x00,
 			.addr_ihl = 0x25,
 			.mask_ihl = 0x02,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.sim = {
 			.addr = 0x23,
@@ -236,7 +239,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask_ihl = 0x80,
 			.addr_od = 0x22,
 			.mask_od = 0x40,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.sim = {
 			.addr = 0x23,
@@ -318,7 +324,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask_int2 = 0x00,
 			.addr_ihl = 0x23,
 			.mask_ihl = 0x40,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 			.ig1 = {
 				.en_addr = 0x23,
 				.en_mask = 0x08,
@@ -389,7 +398,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 		.drdy_irq = {
 			.addr = 0x21,
 			.mask_int1 = 0x04,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.sim = {
 			.addr = 0x21,
@@ -451,7 +463,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask_ihl = 0x80,
 			.addr_od = 0x22,
 			.mask_od = 0x40,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.sim = {
 			.addr = 0x21,
@@ -569,7 +584,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 		.drdy_irq = {
 			.addr = 0x21,
 			.mask_int1 = 0x04,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.sim = {
 			.addr = 0x21,
@@ -640,7 +658,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask_int2 = 0x00,
 			.addr_ihl = 0x25,
 			.mask_ihl = 0x02,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.sim = {
 			.addr = 0x23,
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 02e833b14db0..34115f05d5c4 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -470,7 +470,7 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)
 		 * different one. Take into account irq status register
 		 * to understand if irq trigger can be properly supported
 		 */
-		if (sdata->sensor_settings->drdy_irq.addr_stat_drdy)
+		if (sdata->sensor_settings->drdy_irq.stat_drdy.addr)
 			sdata->hw_irq_trigger = enable;
 		return 0;
 	}
diff --git a/drivers/iio/common/st_sensors/st_sensors_trigger.c b/drivers/iio/common/st_sensors/st_sensors_trigger.c
index fa73e6795359..fdcc5a891958 100644
--- a/drivers/iio/common/st_sensors/st_sensors_trigger.c
+++ b/drivers/iio/common/st_sensors/st_sensors_trigger.c
@@ -31,7 +31,7 @@ static int st_sensors_new_samples_available(struct iio_dev *indio_dev,
 	int ret;
 
 	/* How would I know if I can't check it? */
-	if (!sdata->sensor_settings->drdy_irq.addr_stat_drdy)
+	if (!sdata->sensor_settings->drdy_irq.stat_drdy.addr)
 		return -EINVAL;
 
 	/* No scan mask, no interrupt */
@@ -39,23 +39,15 @@ static int st_sensors_new_samples_available(struct iio_dev *indio_dev,
 		return 0;
 
 	ret = sdata->tf->read_byte(&sdata->tb, sdata->dev,
-			sdata->sensor_settings->drdy_irq.addr_stat_drdy,
+			sdata->sensor_settings->drdy_irq.stat_drdy.addr,
 			&status);
 	if (ret < 0) {
 		dev_err(sdata->dev,
 			"error checking samples available\n");
 		return ret;
 	}
-	/*
-	 * the lower bits of .active_scan_mask[0] is directly mapped
-	 * to the channels on the sensor: either bit 0 for
-	 * one-dimensional sensors, or e.g. x,y,z for accelerometers,
-	 * gyroscopes or magnetometers. No sensor use more than 3
-	 * channels, so cut the other status bits here.
-	 */
-	status &= 0x07;
 
-	if (status & (u8)indio_dev->active_scan_mask[0])
+	if (status & sdata->sensor_settings->drdy_irq.stat_drdy.mask)
 		return 1;
 
 	return 0;
@@ -212,7 +204,7 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
 	 * it was "our" interrupt.
 	 */
 	if (sdata->int_pin_open_drain &&
-	    sdata->sensor_settings->drdy_irq.addr_stat_drdy)
+	    sdata->sensor_settings->drdy_irq.stat_drdy.addr)
 		irq_trig |= IRQF_SHARED;
 
 	err = request_threaded_irq(sdata->get_irq_data_ready(indio_dev),
diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c
index 4cf85aa01dde..22c0c1732996 100644
--- a/drivers/iio/gyro/st_gyro_core.c
+++ b/drivers/iio/gyro/st_gyro_core.c
@@ -118,7 +118,10 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
 			 * drain settings, but only for INT1 and not
 			 * for the DRDY line on INT2.
 			 */
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.multi_read_bit = true,
 		.bootime = 2,
@@ -188,7 +191,10 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
 			 * drain settings, but only for INT1 and not
 			 * for the DRDY line on INT2.
 			 */
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.multi_read_bit = true,
 		.bootime = 2,
@@ -253,7 +259,10 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
 			 * drain settings, but only for INT1 and not
 			 * for the DRDY line on INT2.
 			 */
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.multi_read_bit = true,
 		.bootime = 2,
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
index 703de313c418..ace72c57f53c 100644
--- a/drivers/iio/magnetometer/st_magn_core.c
+++ b/drivers/iio/magnetometer/st_magn_core.c
@@ -317,7 +317,10 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = {
 		},
 		.drdy_irq = {
 			/* drdy line is routed drdy pin */
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
 		},
 		.multi_read_bit = true,
 		.bootime = 2,
@@ -361,7 +364,10 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = {
 		.drdy_irq = {
 			.addr = 0x62,
 			.mask_int1 = 0x01,
-			.addr_stat_drdy = 0x67,
+			.stat_drdy = {
+				.addr = 0x67,
+				.mask = 0x07,
+			},
 		},
 		.multi_read_bit = false,
 		.bootime = 2,
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 3117f4ce76e4..c2f7c2fe20ab 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -287,7 +287,10 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
 			.mask_ihl = 0x80,
 			.addr_od = 0x22,
 			.mask_od = 0x40,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x03,
+			},
 		},
 		.multi_read_bit = true,
 		.bootime = 2,
@@ -395,7 +398,10 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
 			.mask_ihl = 0x80,
 			.addr_od = 0x22,
 			.mask_od = 0x40,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x03,
+			},
 		},
 		.multi_read_bit = true,
 		.bootime = 2,
@@ -454,7 +460,10 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
 			.mask_ihl = 0x80,
 			.addr_od = 0x12,
 			.mask_od = 0x40,
-			.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x03,
+			},
 		},
 		.multi_read_bit = false,
 		.bootime = 2,
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 7b0fa8b5c120..ce0ef1c0a30a 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -139,7 +139,7 @@ struct st_sensor_das {
  * @mask_ihl: mask to enable/disable active low on the INT lines.
  * @addr_od: address to enable/disable Open Drain on the INT lines.
  * @mask_od: mask to enable/disable Open Drain on the INT lines.
- * @addr_stat_drdy: address to read status of DRDY (data ready) interrupt
+ * struct stat_drdy - status register of DRDY (data ready) interrupt.
  * struct ig1 - represents the Interrupt Generator 1 of sensors.
  * @en_addr: address of the enable ig1 register.
  * @en_mask: mask to write the on/off value for enable.
@@ -152,7 +152,10 @@ struct st_sensor_data_ready_irq {
 	u8 mask_ihl;
 	u8 addr_od;
 	u8 mask_od;
-	u8 addr_stat_drdy;
+	struct {
+		u8 addr;
+		u8 mask;
+	} stat_drdy;
 	struct {
 		u8 en_addr;
 		u8 en_mask;
-- 
2.14.1

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

* [PATCH v3 2/5] iio: st_sensors: decouple irq1 configuration parameters from the irq2 ones
  2017-08-30 11:50 ` Lorenzo Bianconi
@ 2017-08-30 11:50     ` Lorenzo Bianconi
  -1 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-08-30 11:50 UTC (permalink / raw)
  To: jic23-DgEjT+Ai2ygdnm+yROfE0A
  Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
	lorenzo.bianconi-qxv4g6HH51o, devicetree-u79uwXL29TY76Z2rM5mHXA

Separate data-ready configuration parameters for INT1 and INT2 pins in
st_sensor_data_ready_irq data structure. That change will be use to
properly support LIS2DW12 accel sensor.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
---
 drivers/iio/accel/st_accel_core.c               | 66 ++++++++++++++++---------
 drivers/iio/common/st_sensors/st_sensors_core.c | 28 ++++++-----
 drivers/iio/gyro/st_gyro_core.c                 | 18 ++++---
 drivers/iio/magnetometer/st_magn_core.c         |  6 ++-
 drivers/iio/pressure/st_pressure_core.c         | 31 +++++++-----
 include/linux/iio/common/st_sensors.h           | 16 +++---
 6 files changed, 104 insertions(+), 61 deletions(-)

diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index 140ba26f6131..a6eac959dfe8 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -159,9 +159,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask = 0x80,
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int1 = 0x10,
-			.mask_int2 = 0x00,
+			.int1 = {
+				.addr = 0x22,
+				.mask = 0x10,
+			},
 			.addr_ihl = 0x25,
 			.mask_ihl = 0x02,
 			.stat_drdy = {
@@ -232,9 +233,14 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask = 0x80,
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int1 = 0x02,
-			.mask_int2 = 0x10,
+			.int1 = {
+				.addr = 0x22,
+				.mask = 0x02,
+			},
+			.int2 = {
+				.addr = 0x22,
+				.mask = 0x10,
+			},
 			.addr_ihl = 0x22,
 			.mask_ihl = 0x80,
 			.addr_od = 0x22,
@@ -319,9 +325,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask = 0x08,
 		},
 		.drdy_irq = {
-			.addr = 0x23,
-			.mask_int1 = 0x80,
-			.mask_int2 = 0x00,
+			.int1 = {
+				.addr = 0x23,
+				.mask = 0x80,
+			},
 			.addr_ihl = 0x23,
 			.mask_ihl = 0x40,
 			.stat_drdy = {
@@ -396,8 +403,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask = 0x01,
 		},
 		.drdy_irq = {
-			.addr = 0x21,
-			.mask_int1 = 0x04,
+			.int1 = {
+				.addr = 0x21,
+				.mask = 0x04,
+			},
 			.stat_drdy = {
 				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
 				.mask = 0x07,
@@ -456,9 +465,14 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			},
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int1 = 0x04,
-			.mask_int2 = 0x20,
+			.int1 = {
+				.addr = 0x22,
+				.mask = 0x04,
+			},
+			.int2 = {
+				.addr = 0x22,
+				.mask = 0x20,
+			},
 			.addr_ihl = 0x22,
 			.mask_ihl = 0x80,
 			.addr_od = 0x22,
@@ -528,9 +542,14 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask = 0x80,
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int1 = 0x02,
-			.mask_int2 = 0x10,
+			.int1 = {
+				.addr = 0x22,
+				.mask = 0x02,
+			},
+			.int2 = {
+				.addr = 0x22,
+				.mask = 0x10,
+			},
 			.addr_ihl = 0x22,
 			.mask_ihl = 0x80,
 		},
@@ -582,8 +601,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 		.bdu = {
 		},
 		.drdy_irq = {
-			.addr = 0x21,
-			.mask_int1 = 0x04,
+			.int1 = {
+				.addr = 0x21,
+				.mask = 0x04,
+			},
 			.stat_drdy = {
 				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
 				.mask = 0x07,
@@ -653,9 +674,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			},
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int1 = 0x10,
-			.mask_int2 = 0x00,
+			.int1 = {
+				.addr = 0x22,
+				.mask = 0x10,
+			},
 			.addr_ihl = 0x25,
 			.mask_ihl = 0x02,
 			.stat_drdy = {
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 34115f05d5c4..af702fa8fa84 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -283,7 +283,8 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
 
 	/* Sensor does not support interrupts */
-	if (sdata->sensor_settings->drdy_irq.addr == 0) {
+	if (!sdata->sensor_settings->drdy_irq.int1.addr &&
+	    !sdata->sensor_settings->drdy_irq.int2.addr) {
 		if (pdata->drdy_int_pin)
 			dev_info(&indio_dev->dev,
 				 "DRDY on pin INT%d specified, but sensor "
@@ -294,7 +295,7 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
 
 	switch (pdata->drdy_int_pin) {
 	case 1:
-		if (sdata->sensor_settings->drdy_irq.mask_int1 == 0) {
+		if (!sdata->sensor_settings->drdy_irq.int1.mask) {
 			dev_err(&indio_dev->dev,
 					"DRDY on INT1 not available.\n");
 			return -EINVAL;
@@ -302,7 +303,7 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
 		sdata->drdy_int_pin = 1;
 		break;
 	case 2:
-		if (sdata->sensor_settings->drdy_irq.mask_int2 == 0) {
+		if (!sdata->sensor_settings->drdy_irq.int2.mask) {
 			dev_err(&indio_dev->dev,
 					"DRDY on INT2 not available.\n");
 			return -EINVAL;
@@ -460,10 +461,11 @@ EXPORT_SYMBOL(st_sensors_init_sensor);
 int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)
 {
 	int err;
-	u8 drdy_mask;
+	u8 drdy_addr, drdy_mask;
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
 
-	if (!sdata->sensor_settings->drdy_irq.addr) {
+	if (!sdata->sensor_settings->drdy_irq.int1.addr &&
+	    !sdata->sensor_settings->drdy_irq.int2.addr) {
 		/*
 		 * there are some devices (e.g. LIS3MDL) where drdy line is
 		 * routed to a given pin and it is not possible to select a
@@ -485,18 +487,20 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)
 			goto st_accel_set_dataready_irq_error;
 	}
 
-	if (sdata->drdy_int_pin == 1)
-		drdy_mask = sdata->sensor_settings->drdy_irq.mask_int1;
-	else
-		drdy_mask = sdata->sensor_settings->drdy_irq.mask_int2;
+	if (sdata->drdy_int_pin == 1) {
+		drdy_addr = sdata->sensor_settings->drdy_irq.int1.addr;
+		drdy_mask = sdata->sensor_settings->drdy_irq.int1.mask;
+	} else {
+		drdy_addr = sdata->sensor_settings->drdy_irq.int2.addr;
+		drdy_mask = sdata->sensor_settings->drdy_irq.int2.mask;
+	}
 
 	/* Flag to the poll function that the hardware trigger is in use */
 	sdata->hw_irq_trigger = enable;
 
 	/* Enable/Disable the interrupt generator for data ready. */
-	err = st_sensors_write_data_with_mask(indio_dev,
-					sdata->sensor_settings->drdy_irq.addr,
-					drdy_mask, (int)enable);
+	err = st_sensors_write_data_with_mask(indio_dev, drdy_addr,
+					      drdy_mask, (int)enable);
 
 st_accel_set_dataready_irq_error:
 	return err;
diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c
index 22c0c1732996..46991f7131d1 100644
--- a/drivers/iio/gyro/st_gyro_core.c
+++ b/drivers/iio/gyro/st_gyro_core.c
@@ -111,8 +111,10 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
 			.mask = 0x80,
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int2 = 0x08,
+			.int2 = {
+				.addr = 0x22,
+				.mask = 0x08,
+			},
 			/*
 			 * The sensor has IHL (active low) and open
 			 * drain settings, but only for INT1 and not
@@ -184,8 +186,10 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
 			.mask = 0x80,
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int2 = 0x08,
+			.int2 = {
+				.addr = 0x22,
+				.mask = 0x08,
+			},
 			/*
 			 * The sensor has IHL (active low) and open
 			 * drain settings, but only for INT1 and not
@@ -252,8 +256,10 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
 			.mask = 0x80,
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int2 = 0x08,
+			.int2 = {
+				.addr = 0x22,
+				.mask = 0x08,
+			},
 			/*
 			 * The sensor has IHL (active low) and open
 			 * drain settings, but only for INT1 and not
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
index ace72c57f53c..8745686f233c 100644
--- a/drivers/iio/magnetometer/st_magn_core.c
+++ b/drivers/iio/magnetometer/st_magn_core.c
@@ -362,8 +362,10 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = {
 			.mask = 0x10,
 		},
 		.drdy_irq = {
-			.addr = 0x62,
-			.mask_int1 = 0x01,
+			.int1 = {
+				.addr = 0x62,
+				.mask = 0x01,
+			},
 			.stat_drdy = {
 				.addr = 0x67,
 				.mask = 0x07,
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index c2f7c2fe20ab..0c1c092cc157 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -280,9 +280,14 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
 			.mask = 0x04,
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int1 = 0x04,
-			.mask_int2 = 0x20,
+			.int1 = {
+				.addr = 0x22,
+				.mask = 0x04,
+			},
+			.int2 = {
+				.addr = 0x22,
+				.mask = 0x20,
+			},
 			.addr_ihl = 0x22,
 			.mask_ihl = 0x80,
 			.addr_od = 0x22,
@@ -338,9 +343,6 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
 			.addr = 0x20,
 			.mask = 0x04,
 		},
-		.drdy_irq = {
-			.addr = 0,
-		},
 		.multi_read_bit = true,
 		.bootime = 2,
 	},
@@ -391,9 +393,10 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
 			.mask = 0x04,
 		},
 		.drdy_irq = {
-			.addr = 0x23,
-			.mask_int1 = 0x01,
-			.mask_int2 = 0x00,
+			.int1 = {
+				.addr = 0x23,
+				.mask = 0x01,
+			},
 			.addr_ihl = 0x22,
 			.mask_ihl = 0x80,
 			.addr_od = 0x22,
@@ -453,9 +456,10 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
 			.mask = 0x02,
 		},
 		.drdy_irq = {
-			.addr = 0x12,
-			.mask_int1 = 0x04,
-			.mask_int2 = 0x00,
+			.int1 = {
+				.addr = 0x12,
+				.mask = 0x04,
+			},
 			.addr_ihl = 0x12,
 			.mask_ihl = 0x80,
 			.addr_od = 0x12,
@@ -612,7 +616,8 @@ int st_press_common_probe(struct iio_dev *indio_dev)
 	press_data->odr = press_data->sensor_settings->odr.odr_avl[0].hz;
 
 	/* Some devices don't support a data ready pin. */
-	if (!pdata && press_data->sensor_settings->drdy_irq.addr)
+	if (!pdata && (press_data->sensor_settings->drdy_irq.int1.addr ||
+		       press_data->sensor_settings->drdy_irq.int2.addr))
 		pdata =	(struct st_sensors_platform_data *)&default_press_pdata;
 
 	err = st_sensors_init_sensor(indio_dev, press_data->dev->platform_data);
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index ce0ef1c0a30a..e6c646d5d6d4 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -132,9 +132,8 @@ struct st_sensor_das {
 
 /**
  * struct st_sensor_data_ready_irq - ST sensor device data-ready interrupt
- * @addr: address of the register.
- * @mask_int1: mask to enable/disable IRQ on INT1 pin.
- * @mask_int2: mask to enable/disable IRQ on INT2 pin.
+ * struct int1 - data-ready configuration register for INT1 pin.
+ * struct int2 - data-ready configuration register for INT2 pin.
  * @addr_ihl: address to enable/disable active low on the INT lines.
  * @mask_ihl: mask to enable/disable active low on the INT lines.
  * @addr_od: address to enable/disable Open Drain on the INT lines.
@@ -145,9 +144,14 @@ struct st_sensor_das {
  * @en_mask: mask to write the on/off value for enable.
  */
 struct st_sensor_data_ready_irq {
-	u8 addr;
-	u8 mask_int1;
-	u8 mask_int2;
+	struct {
+		u8 addr;
+		u8 mask;
+	} int1;
+	struct {
+		u8 addr;
+		u8 mask;
+	} int2;
 	u8 addr_ihl;
 	u8 mask_ihl;
 	u8 addr_od;
-- 
2.14.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v3 2/5] iio: st_sensors: decouple irq1 configuration parameters from the irq2 ones
@ 2017-08-30 11:50     ` Lorenzo Bianconi
  0 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-08-30 11:50 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio, linus.walleij, lorenzo.bianconi, devicetree

Separate data-ready configuration parameters for INT1 and INT2 pins in
st_sensor_data_ready_irq data structure. That change will be use to
properly support LIS2DW12 accel sensor.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
---
 drivers/iio/accel/st_accel_core.c               | 66 ++++++++++++++++---------
 drivers/iio/common/st_sensors/st_sensors_core.c | 28 ++++++-----
 drivers/iio/gyro/st_gyro_core.c                 | 18 ++++---
 drivers/iio/magnetometer/st_magn_core.c         |  6 ++-
 drivers/iio/pressure/st_pressure_core.c         | 31 +++++++-----
 include/linux/iio/common/st_sensors.h           | 16 +++---
 6 files changed, 104 insertions(+), 61 deletions(-)

diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index 140ba26f6131..a6eac959dfe8 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -159,9 +159,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask = 0x80,
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int1 = 0x10,
-			.mask_int2 = 0x00,
+			.int1 = {
+				.addr = 0x22,
+				.mask = 0x10,
+			},
 			.addr_ihl = 0x25,
 			.mask_ihl = 0x02,
 			.stat_drdy = {
@@ -232,9 +233,14 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask = 0x80,
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int1 = 0x02,
-			.mask_int2 = 0x10,
+			.int1 = {
+				.addr = 0x22,
+				.mask = 0x02,
+			},
+			.int2 = {
+				.addr = 0x22,
+				.mask = 0x10,
+			},
 			.addr_ihl = 0x22,
 			.mask_ihl = 0x80,
 			.addr_od = 0x22,
@@ -319,9 +325,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask = 0x08,
 		},
 		.drdy_irq = {
-			.addr = 0x23,
-			.mask_int1 = 0x80,
-			.mask_int2 = 0x00,
+			.int1 = {
+				.addr = 0x23,
+				.mask = 0x80,
+			},
 			.addr_ihl = 0x23,
 			.mask_ihl = 0x40,
 			.stat_drdy = {
@@ -396,8 +403,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask = 0x01,
 		},
 		.drdy_irq = {
-			.addr = 0x21,
-			.mask_int1 = 0x04,
+			.int1 = {
+				.addr = 0x21,
+				.mask = 0x04,
+			},
 			.stat_drdy = {
 				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
 				.mask = 0x07,
@@ -456,9 +465,14 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			},
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int1 = 0x04,
-			.mask_int2 = 0x20,
+			.int1 = {
+				.addr = 0x22,
+				.mask = 0x04,
+			},
+			.int2 = {
+				.addr = 0x22,
+				.mask = 0x20,
+			},
 			.addr_ihl = 0x22,
 			.mask_ihl = 0x80,
 			.addr_od = 0x22,
@@ -528,9 +542,14 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			.mask = 0x80,
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int1 = 0x02,
-			.mask_int2 = 0x10,
+			.int1 = {
+				.addr = 0x22,
+				.mask = 0x02,
+			},
+			.int2 = {
+				.addr = 0x22,
+				.mask = 0x10,
+			},
 			.addr_ihl = 0x22,
 			.mask_ihl = 0x80,
 		},
@@ -582,8 +601,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 		.bdu = {
 		},
 		.drdy_irq = {
-			.addr = 0x21,
-			.mask_int1 = 0x04,
+			.int1 = {
+				.addr = 0x21,
+				.mask = 0x04,
+			},
 			.stat_drdy = {
 				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
 				.mask = 0x07,
@@ -653,9 +674,10 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 			},
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int1 = 0x10,
-			.mask_int2 = 0x00,
+			.int1 = {
+				.addr = 0x22,
+				.mask = 0x10,
+			},
 			.addr_ihl = 0x25,
 			.mask_ihl = 0x02,
 			.stat_drdy = {
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 34115f05d5c4..af702fa8fa84 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -283,7 +283,8 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
 
 	/* Sensor does not support interrupts */
-	if (sdata->sensor_settings->drdy_irq.addr == 0) {
+	if (!sdata->sensor_settings->drdy_irq.int1.addr &&
+	    !sdata->sensor_settings->drdy_irq.int2.addr) {
 		if (pdata->drdy_int_pin)
 			dev_info(&indio_dev->dev,
 				 "DRDY on pin INT%d specified, but sensor "
@@ -294,7 +295,7 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
 
 	switch (pdata->drdy_int_pin) {
 	case 1:
-		if (sdata->sensor_settings->drdy_irq.mask_int1 == 0) {
+		if (!sdata->sensor_settings->drdy_irq.int1.mask) {
 			dev_err(&indio_dev->dev,
 					"DRDY on INT1 not available.\n");
 			return -EINVAL;
@@ -302,7 +303,7 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
 		sdata->drdy_int_pin = 1;
 		break;
 	case 2:
-		if (sdata->sensor_settings->drdy_irq.mask_int2 == 0) {
+		if (!sdata->sensor_settings->drdy_irq.int2.mask) {
 			dev_err(&indio_dev->dev,
 					"DRDY on INT2 not available.\n");
 			return -EINVAL;
@@ -460,10 +461,11 @@ EXPORT_SYMBOL(st_sensors_init_sensor);
 int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)
 {
 	int err;
-	u8 drdy_mask;
+	u8 drdy_addr, drdy_mask;
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
 
-	if (!sdata->sensor_settings->drdy_irq.addr) {
+	if (!sdata->sensor_settings->drdy_irq.int1.addr &&
+	    !sdata->sensor_settings->drdy_irq.int2.addr) {
 		/*
 		 * there are some devices (e.g. LIS3MDL) where drdy line is
 		 * routed to a given pin and it is not possible to select a
@@ -485,18 +487,20 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)
 			goto st_accel_set_dataready_irq_error;
 	}
 
-	if (sdata->drdy_int_pin == 1)
-		drdy_mask = sdata->sensor_settings->drdy_irq.mask_int1;
-	else
-		drdy_mask = sdata->sensor_settings->drdy_irq.mask_int2;
+	if (sdata->drdy_int_pin == 1) {
+		drdy_addr = sdata->sensor_settings->drdy_irq.int1.addr;
+		drdy_mask = sdata->sensor_settings->drdy_irq.int1.mask;
+	} else {
+		drdy_addr = sdata->sensor_settings->drdy_irq.int2.addr;
+		drdy_mask = sdata->sensor_settings->drdy_irq.int2.mask;
+	}
 
 	/* Flag to the poll function that the hardware trigger is in use */
 	sdata->hw_irq_trigger = enable;
 
 	/* Enable/Disable the interrupt generator for data ready. */
-	err = st_sensors_write_data_with_mask(indio_dev,
-					sdata->sensor_settings->drdy_irq.addr,
-					drdy_mask, (int)enable);
+	err = st_sensors_write_data_with_mask(indio_dev, drdy_addr,
+					      drdy_mask, (int)enable);
 
 st_accel_set_dataready_irq_error:
 	return err;
diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c
index 22c0c1732996..46991f7131d1 100644
--- a/drivers/iio/gyro/st_gyro_core.c
+++ b/drivers/iio/gyro/st_gyro_core.c
@@ -111,8 +111,10 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
 			.mask = 0x80,
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int2 = 0x08,
+			.int2 = {
+				.addr = 0x22,
+				.mask = 0x08,
+			},
 			/*
 			 * The sensor has IHL (active low) and open
 			 * drain settings, but only for INT1 and not
@@ -184,8 +186,10 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
 			.mask = 0x80,
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int2 = 0x08,
+			.int2 = {
+				.addr = 0x22,
+				.mask = 0x08,
+			},
 			/*
 			 * The sensor has IHL (active low) and open
 			 * drain settings, but only for INT1 and not
@@ -252,8 +256,10 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
 			.mask = 0x80,
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int2 = 0x08,
+			.int2 = {
+				.addr = 0x22,
+				.mask = 0x08,
+			},
 			/*
 			 * The sensor has IHL (active low) and open
 			 * drain settings, but only for INT1 and not
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
index ace72c57f53c..8745686f233c 100644
--- a/drivers/iio/magnetometer/st_magn_core.c
+++ b/drivers/iio/magnetometer/st_magn_core.c
@@ -362,8 +362,10 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = {
 			.mask = 0x10,
 		},
 		.drdy_irq = {
-			.addr = 0x62,
-			.mask_int1 = 0x01,
+			.int1 = {
+				.addr = 0x62,
+				.mask = 0x01,
+			},
 			.stat_drdy = {
 				.addr = 0x67,
 				.mask = 0x07,
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index c2f7c2fe20ab..0c1c092cc157 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -280,9 +280,14 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
 			.mask = 0x04,
 		},
 		.drdy_irq = {
-			.addr = 0x22,
-			.mask_int1 = 0x04,
-			.mask_int2 = 0x20,
+			.int1 = {
+				.addr = 0x22,
+				.mask = 0x04,
+			},
+			.int2 = {
+				.addr = 0x22,
+				.mask = 0x20,
+			},
 			.addr_ihl = 0x22,
 			.mask_ihl = 0x80,
 			.addr_od = 0x22,
@@ -338,9 +343,6 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
 			.addr = 0x20,
 			.mask = 0x04,
 		},
-		.drdy_irq = {
-			.addr = 0,
-		},
 		.multi_read_bit = true,
 		.bootime = 2,
 	},
@@ -391,9 +393,10 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
 			.mask = 0x04,
 		},
 		.drdy_irq = {
-			.addr = 0x23,
-			.mask_int1 = 0x01,
-			.mask_int2 = 0x00,
+			.int1 = {
+				.addr = 0x23,
+				.mask = 0x01,
+			},
 			.addr_ihl = 0x22,
 			.mask_ihl = 0x80,
 			.addr_od = 0x22,
@@ -453,9 +456,10 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
 			.mask = 0x02,
 		},
 		.drdy_irq = {
-			.addr = 0x12,
-			.mask_int1 = 0x04,
-			.mask_int2 = 0x00,
+			.int1 = {
+				.addr = 0x12,
+				.mask = 0x04,
+			},
 			.addr_ihl = 0x12,
 			.mask_ihl = 0x80,
 			.addr_od = 0x12,
@@ -612,7 +616,8 @@ int st_press_common_probe(struct iio_dev *indio_dev)
 	press_data->odr = press_data->sensor_settings->odr.odr_avl[0].hz;
 
 	/* Some devices don't support a data ready pin. */
-	if (!pdata && press_data->sensor_settings->drdy_irq.addr)
+	if (!pdata && (press_data->sensor_settings->drdy_irq.int1.addr ||
+		       press_data->sensor_settings->drdy_irq.int2.addr))
 		pdata =	(struct st_sensors_platform_data *)&default_press_pdata;
 
 	err = st_sensors_init_sensor(indio_dev, press_data->dev->platform_data);
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index ce0ef1c0a30a..e6c646d5d6d4 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -132,9 +132,8 @@ struct st_sensor_das {
 
 /**
  * struct st_sensor_data_ready_irq - ST sensor device data-ready interrupt
- * @addr: address of the register.
- * @mask_int1: mask to enable/disable IRQ on INT1 pin.
- * @mask_int2: mask to enable/disable IRQ on INT2 pin.
+ * struct int1 - data-ready configuration register for INT1 pin.
+ * struct int2 - data-ready configuration register for INT2 pin.
  * @addr_ihl: address to enable/disable active low on the INT lines.
  * @mask_ihl: mask to enable/disable active low on the INT lines.
  * @addr_od: address to enable/disable Open Drain on the INT lines.
@@ -145,9 +144,14 @@ struct st_sensor_das {
  * @en_mask: mask to write the on/off value for enable.
  */
 struct st_sensor_data_ready_irq {
-	u8 addr;
-	u8 mask_int1;
-	u8 mask_int2;
+	struct {
+		u8 addr;
+		u8 mask;
+	} int1;
+	struct {
+		u8 addr;
+		u8 mask;
+	} int2;
 	u8 addr_ihl;
 	u8 mask_ihl;
 	u8 addr_od;
-- 
2.14.1

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

* [PATCH v3 3/5] iio: st_sensors: do not always write enable_axis register
  2017-08-30 11:50 ` Lorenzo Bianconi
@ 2017-08-30 11:50     ` Lorenzo Bianconi
  -1 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-08-30 11:50 UTC (permalink / raw)
  To: jic23-DgEjT+Ai2ygdnm+yROfE0A
  Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
	lorenzo.bianconi-qxv4g6HH51o, devicetree-u79uwXL29TY76Z2rM5mHXA

New devices (e.g. LIS2DW12) enable all axis by default and do not export
that capability in register map. Check if the enable_axis register
address has been declared in st_sensor_settings map in order to verify if
the driver needs to enable all sensor axis

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
---
 drivers/iio/common/st_sensors/st_sensors_core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index af702fa8fa84..6657160b5a73 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -221,11 +221,14 @@ EXPORT_SYMBOL(st_sensors_set_enable);
 int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable)
 {
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
+	int err = 0;
 
-	return st_sensors_write_data_with_mask(indio_dev,
+	if (sdata->sensor_settings->enable_axis.addr)
+		err = st_sensors_write_data_with_mask(indio_dev,
 				sdata->sensor_settings->enable_axis.addr,
 				sdata->sensor_settings->enable_axis.mask,
 				axis_enable);
+	return err;
 }
 EXPORT_SYMBOL(st_sensors_set_axis_enable);
 
-- 
2.14.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v3 3/5] iio: st_sensors: do not always write enable_axis register
@ 2017-08-30 11:50     ` Lorenzo Bianconi
  0 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-08-30 11:50 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio, linus.walleij, lorenzo.bianconi, devicetree

New devices (e.g. LIS2DW12) enable all axis by default and do not export
that capability in register map. Check if the enable_axis register
address has been declared in st_sensor_settings map in order to verify if
the driver needs to enable all sensor axis

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
---
 drivers/iio/common/st_sensors/st_sensors_core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index af702fa8fa84..6657160b5a73 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -221,11 +221,14 @@ EXPORT_SYMBOL(st_sensors_set_enable);
 int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable)
 {
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
+	int err = 0;
 
-	return st_sensors_write_data_with_mask(indio_dev,
+	if (sdata->sensor_settings->enable_axis.addr)
+		err = st_sensors_write_data_with_mask(indio_dev,
 				sdata->sensor_settings->enable_axis.addr,
 				sdata->sensor_settings->enable_axis.mask,
 				axis_enable);
+	return err;
 }
 EXPORT_SYMBOL(st_sensors_set_axis_enable);
 
-- 
2.14.1

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

* [PATCH v3 4/5] iio: accel: add support to LIS2DW12
  2017-08-30 11:50 ` Lorenzo Bianconi
@ 2017-08-30 11:50     ` Lorenzo Bianconi
  -1 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-08-30 11:50 UTC (permalink / raw)
  To: jic23-DgEjT+Ai2ygdnm+yROfE0A
  Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
	lorenzo.bianconi-qxv4g6HH51o, devicetree-u79uwXL29TY76Z2rM5mHXA

add support to STMicroelectronics LIS2DW12 accelerometer in
st_accel framework

http://www.st.com/resource/en/datasheet/lis2dw12.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
---
 drivers/iio/accel/st_accel.h      |  2 +
 drivers/iio/accel/st_accel_core.c | 79 +++++++++++++++++++++++++++++++++++++++
 drivers/iio/accel/st_accel_i2c.c  |  5 +++
 drivers/iio/accel/st_accel_spi.c  |  5 +++
 4 files changed, 91 insertions(+)

diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
index 0fe521609a3a..2ed0f60418c0 100644
--- a/drivers/iio/accel/st_accel.h
+++ b/drivers/iio/accel/st_accel.h
@@ -32,6 +32,7 @@ enum st_accel_type {
 	H3LIS331DL,
 	LIS331DL,
 	LIS3LV02DL,
+	LIS2DW12,
 	ST_ACCEL_MAX,
 };
 
@@ -52,6 +53,7 @@ enum st_accel_type {
 #define LIS2DH12_ACCEL_DEV_NAME		"lis2dh12_accel"
 #define LIS3L02DQ_ACCEL_DEV_NAME	"lis3l02dq"
 #define LNG2DM_ACCEL_DEV_NAME		"lng2dm"
+#define LIS2DW12_ACCEL_DEV_NAME		"lis2dw12"
 
 /**
 * struct st_sensors_platform_data - default accel platform data
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index a6eac959dfe8..731ec3a4c82b 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -692,6 +692,85 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 		.multi_read_bit = true,
 		.bootime = 2,
 	},
+	{
+		.wai = 0x44,
+		.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
+		.sensors_supported = {
+			[0] = LIS2DW12_ACCEL_DEV_NAME,
+		},
+		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
+		.odr = {
+			.addr = 0x20,
+			.mask = 0xf0,
+			.odr_avl = {
+				{ .hz = 1, .value = 0x01, },
+				{ .hz = 12, .value = 0x02, },
+				{ .hz = 25, .value = 0x03, },
+				{ .hz = 50, .value = 0x04, },
+				{ .hz = 100, .value = 0x05, },
+				{ .hz = 200, .value = 0x06, },
+			},
+		},
+		.pw = {
+			.addr = 0x20,
+			.mask = 0xf0,
+			.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
+		},
+		.fs = {
+			.addr = 0x25,
+			.mask = 0x30,
+			.fs_avl = {
+				[0] = {
+					.num = ST_ACCEL_FS_AVL_2G,
+					.value = 0x00,
+					.gain = IIO_G_TO_M_S_2(976),
+				},
+				[1] = {
+					.num = ST_ACCEL_FS_AVL_4G,
+					.value = 0x01,
+					.gain = IIO_G_TO_M_S_2(1952),
+				},
+				[2] = {
+					.num = ST_ACCEL_FS_AVL_8G,
+					.value = 0x02,
+					.gain = IIO_G_TO_M_S_2(3904),
+				},
+				[3] = {
+					.num = ST_ACCEL_FS_AVL_16G,
+					.value = 0x03,
+					.gain = IIO_G_TO_M_S_2(7808),
+				},
+			},
+		},
+		.bdu = {
+			.addr = 0x21,
+			.mask = 0x08,
+		},
+		.drdy_irq = {
+			.int1 = {
+				.addr = 0x23,
+				.mask = 0x01,
+			},
+			.int2 = {
+				.addr = 0x24,
+				.mask = 0x01,
+			},
+			.addr_ihl = 0x22,
+			.mask_ihl = 0x08,
+			.addr_od = 0x22,
+			.mask_od = 0x20,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x01,
+			},
+		},
+		.sim = {
+			.addr = 0x21,
+			.value = BIT(0),
+		},
+		.multi_read_bit = false,
+		.bootime = 2,
+	},
 };
 
 static int st_accel_read_raw(struct iio_dev *indio_dev,
diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c
index 18cafb9f2468..363429b5686c 100644
--- a/drivers/iio/accel/st_accel_i2c.c
+++ b/drivers/iio/accel/st_accel_i2c.c
@@ -94,6 +94,10 @@ static const struct of_device_id st_accel_of_match[] = {
 		.compatible = "st,lng2dm-accel",
 		.data = LNG2DM_ACCEL_DEV_NAME,
 	},
+	{
+		.compatible = "st,lis2dw12",
+		.data = LIS2DW12_ACCEL_DEV_NAME,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match);
@@ -129,6 +133,7 @@ static const struct i2c_device_id st_accel_id_table[] = {
 	{ H3LIS331DL_ACCEL_DEV_NAME, H3LIS331DL },
 	{ LIS331DL_ACCEL_DEV_NAME, LIS331DL },
 	{ LIS3LV02DL_ACCEL_DEV_NAME, LIS3LV02DL },
+	{ LIS2DW12_ACCEL_DEV_NAME, LIS2DW12 },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
diff --git a/drivers/iio/accel/st_accel_spi.c b/drivers/iio/accel/st_accel_spi.c
index 915fa49085f7..7692da49e59f 100644
--- a/drivers/iio/accel/st_accel_spi.c
+++ b/drivers/iio/accel/st_accel_spi.c
@@ -82,6 +82,10 @@ static const struct of_device_id st_accel_of_match[] = {
 		.compatible = "st,lis331dl-accel",
 		.data = LIS331DL_ACCEL_DEV_NAME,
 	},
+	{
+		.compatible = "st,lis2dw12",
+		.data = LIS2DW12_ACCEL_DEV_NAME,
+	},
 	{}
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match);
@@ -133,6 +137,7 @@ static const struct spi_device_id st_accel_id_table[] = {
 	{ H3LIS331DL_ACCEL_DEV_NAME },
 	{ LIS331DL_ACCEL_DEV_NAME },
 	{ LIS3LV02DL_ACCEL_DEV_NAME },
+	{ LIS2DW12_ACCEL_DEV_NAME },
 	{},
 };
 MODULE_DEVICE_TABLE(spi, st_accel_id_table);
-- 
2.14.1

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

* [PATCH v3 4/5] iio: accel: add support to LIS2DW12
@ 2017-08-30 11:50     ` Lorenzo Bianconi
  0 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-08-30 11:50 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio, linus.walleij, lorenzo.bianconi, devicetree

add support to STMicroelectronics LIS2DW12 accelerometer in
st_accel framework

http://www.st.com/resource/en/datasheet/lis2dw12.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
---
 drivers/iio/accel/st_accel.h      |  2 +
 drivers/iio/accel/st_accel_core.c | 79 +++++++++++++++++++++++++++++++++++++++
 drivers/iio/accel/st_accel_i2c.c  |  5 +++
 drivers/iio/accel/st_accel_spi.c  |  5 +++
 4 files changed, 91 insertions(+)

diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
index 0fe521609a3a..2ed0f60418c0 100644
--- a/drivers/iio/accel/st_accel.h
+++ b/drivers/iio/accel/st_accel.h
@@ -32,6 +32,7 @@ enum st_accel_type {
 	H3LIS331DL,
 	LIS331DL,
 	LIS3LV02DL,
+	LIS2DW12,
 	ST_ACCEL_MAX,
 };
 
@@ -52,6 +53,7 @@ enum st_accel_type {
 #define LIS2DH12_ACCEL_DEV_NAME		"lis2dh12_accel"
 #define LIS3L02DQ_ACCEL_DEV_NAME	"lis3l02dq"
 #define LNG2DM_ACCEL_DEV_NAME		"lng2dm"
+#define LIS2DW12_ACCEL_DEV_NAME		"lis2dw12"
 
 /**
 * struct st_sensors_platform_data - default accel platform data
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index a6eac959dfe8..731ec3a4c82b 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -692,6 +692,85 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 		.multi_read_bit = true,
 		.bootime = 2,
 	},
+	{
+		.wai = 0x44,
+		.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
+		.sensors_supported = {
+			[0] = LIS2DW12_ACCEL_DEV_NAME,
+		},
+		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
+		.odr = {
+			.addr = 0x20,
+			.mask = 0xf0,
+			.odr_avl = {
+				{ .hz = 1, .value = 0x01, },
+				{ .hz = 12, .value = 0x02, },
+				{ .hz = 25, .value = 0x03, },
+				{ .hz = 50, .value = 0x04, },
+				{ .hz = 100, .value = 0x05, },
+				{ .hz = 200, .value = 0x06, },
+			},
+		},
+		.pw = {
+			.addr = 0x20,
+			.mask = 0xf0,
+			.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
+		},
+		.fs = {
+			.addr = 0x25,
+			.mask = 0x30,
+			.fs_avl = {
+				[0] = {
+					.num = ST_ACCEL_FS_AVL_2G,
+					.value = 0x00,
+					.gain = IIO_G_TO_M_S_2(976),
+				},
+				[1] = {
+					.num = ST_ACCEL_FS_AVL_4G,
+					.value = 0x01,
+					.gain = IIO_G_TO_M_S_2(1952),
+				},
+				[2] = {
+					.num = ST_ACCEL_FS_AVL_8G,
+					.value = 0x02,
+					.gain = IIO_G_TO_M_S_2(3904),
+				},
+				[3] = {
+					.num = ST_ACCEL_FS_AVL_16G,
+					.value = 0x03,
+					.gain = IIO_G_TO_M_S_2(7808),
+				},
+			},
+		},
+		.bdu = {
+			.addr = 0x21,
+			.mask = 0x08,
+		},
+		.drdy_irq = {
+			.int1 = {
+				.addr = 0x23,
+				.mask = 0x01,
+			},
+			.int2 = {
+				.addr = 0x24,
+				.mask = 0x01,
+			},
+			.addr_ihl = 0x22,
+			.mask_ihl = 0x08,
+			.addr_od = 0x22,
+			.mask_od = 0x20,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x01,
+			},
+		},
+		.sim = {
+			.addr = 0x21,
+			.value = BIT(0),
+		},
+		.multi_read_bit = false,
+		.bootime = 2,
+	},
 };
 
 static int st_accel_read_raw(struct iio_dev *indio_dev,
diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c
index 18cafb9f2468..363429b5686c 100644
--- a/drivers/iio/accel/st_accel_i2c.c
+++ b/drivers/iio/accel/st_accel_i2c.c
@@ -94,6 +94,10 @@ static const struct of_device_id st_accel_of_match[] = {
 		.compatible = "st,lng2dm-accel",
 		.data = LNG2DM_ACCEL_DEV_NAME,
 	},
+	{
+		.compatible = "st,lis2dw12",
+		.data = LIS2DW12_ACCEL_DEV_NAME,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match);
@@ -129,6 +133,7 @@ static const struct i2c_device_id st_accel_id_table[] = {
 	{ H3LIS331DL_ACCEL_DEV_NAME, H3LIS331DL },
 	{ LIS331DL_ACCEL_DEV_NAME, LIS331DL },
 	{ LIS3LV02DL_ACCEL_DEV_NAME, LIS3LV02DL },
+	{ LIS2DW12_ACCEL_DEV_NAME, LIS2DW12 },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
diff --git a/drivers/iio/accel/st_accel_spi.c b/drivers/iio/accel/st_accel_spi.c
index 915fa49085f7..7692da49e59f 100644
--- a/drivers/iio/accel/st_accel_spi.c
+++ b/drivers/iio/accel/st_accel_spi.c
@@ -82,6 +82,10 @@ static const struct of_device_id st_accel_of_match[] = {
 		.compatible = "st,lis331dl-accel",
 		.data = LIS331DL_ACCEL_DEV_NAME,
 	},
+	{
+		.compatible = "st,lis2dw12",
+		.data = LIS2DW12_ACCEL_DEV_NAME,
+	},
 	{}
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match);
@@ -133,6 +137,7 @@ static const struct spi_device_id st_accel_id_table[] = {
 	{ H3LIS331DL_ACCEL_DEV_NAME },
 	{ LIS331DL_ACCEL_DEV_NAME },
 	{ LIS3LV02DL_ACCEL_DEV_NAME },
+	{ LIS2DW12_ACCEL_DEV_NAME },
 	{},
 };
 MODULE_DEVICE_TABLE(spi, st_accel_id_table);
-- 
2.14.1

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

* [PATCH v3 5/5] dt-bindings: iio: accel: add LIS2DW12 sensor device binding
  2017-08-30 11:50 ` Lorenzo Bianconi
@ 2017-08-30 11:50     ` Lorenzo Bianconi
  -1 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-08-30 11:50 UTC (permalink / raw)
  To: jic23-DgEjT+Ai2ygdnm+yROfE0A
  Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
	lorenzo.bianconi-qxv4g6HH51o, devicetree-u79uwXL29TY76Z2rM5mHXA

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
---
 Documentation/devicetree/bindings/iio/st-sensors.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/iio/st-sensors.txt b/Documentation/devicetree/bindings/iio/st-sensors.txt
index 9ec6f5ce54fc..be64357808d0 100644
--- a/Documentation/devicetree/bindings/iio/st-sensors.txt
+++ b/Documentation/devicetree/bindings/iio/st-sensors.txt
@@ -46,6 +46,7 @@ Accelerometers:
 - st,h3lis331dl-accel
 - st,lng2dm-accel
 - st,lis3l02dq
+- st,lis2dw12
 
 Gyroscopes:
 - st,l3g4200d-gyro
-- 
2.14.1

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

* [PATCH v3 5/5] dt-bindings: iio: accel: add LIS2DW12 sensor device binding
@ 2017-08-30 11:50     ` Lorenzo Bianconi
  0 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-08-30 11:50 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio, linus.walleij, lorenzo.bianconi, devicetree

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
---
 Documentation/devicetree/bindings/iio/st-sensors.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/iio/st-sensors.txt b/Documentation/devicetree/bindings/iio/st-sensors.txt
index 9ec6f5ce54fc..be64357808d0 100644
--- a/Documentation/devicetree/bindings/iio/st-sensors.txt
+++ b/Documentation/devicetree/bindings/iio/st-sensors.txt
@@ -46,6 +46,7 @@ Accelerometers:
 - st,h3lis331dl-accel
 - st,lng2dm-accel
 - st,lis3l02dq
+- st,lis2dw12
 
 Gyroscopes:
 - st,l3g4200d-gyro
-- 
2.14.1


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

* Re: [PATCH v3 0/5] Add support to LIS2DW12 accel sensor
  2017-08-30 11:50 ` Lorenzo Bianconi
@ 2017-09-03 16:52     ` Jonathan Cameron
  -1 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2017-09-03 16:52 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
	lorenzo.bianconi-qxv4g6HH51o, devicetree-u79uwXL29TY76Z2rM5mHXA

On Wed, 30 Aug 2017 13:50:38 +0200
Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Modify management of drdy line and status register in order to support
> LIS2DW12 device
> 
> Changes since v2:
> - swap status register patch (3rd in v2) with irq{1,2} definition one
>   (1st in v2)
> - patchset rebased onto 'fix drdy line configuration for LIS3MDL' patch
> Changes since v1:
> - remove drdy_irq parameter from LPS001WP settings since the sensor
> does not support data-ready interrupts
> 
> Lorenzo Bianconi (5):
>   iio: st_sensors: add register mask for status register
>   iio: st_sensors: decouple irq1 configuration parameters from the irq2
>     ones
>   iio: st_sensors: do not always write enable_axis register
>   iio: accel: add support to LIS2DW12
>   dt-bindings: iio: accel: add LIS2DW12 sensor device binding
> 
>  .../devicetree/bindings/iio/st-sensors.txt         |   1 +
>  drivers/iio/accel/st_accel.h                       |   2 +
>  drivers/iio/accel/st_accel_core.c                  | 180 +++++++++++++++++----
>  drivers/iio/accel/st_accel_i2c.c                   |   5 +
>  drivers/iio/accel/st_accel_spi.c                   |   5 +
>  drivers/iio/common/st_sensors/st_sensors_core.c    |  35 ++--
>  drivers/iio/common/st_sensors/st_sensors_trigger.c |  16 +-
>  drivers/iio/gyro/st_gyro_core.c                    |  33 ++--
>  drivers/iio/magnetometer/st_magn_core.c            |  16 +-
>  drivers/iio/pressure/st_pressure_core.c            |  46 ++++--
>  include/linux/iio/common/st_sensors.h              |  23 ++-
>  11 files changed, 270 insertions(+), 92 deletions(-)
> 

I'm happy with the whole series, however it doesn't currently apply
due to various fixes working their way through the fixes branches
of the iio git tree.  I'll try to pick it up once those have unwound.
There is too much going on with this code at the moment to do this
cleanly now.

Give me a bump if I look like I have forgotten it once it will
apply cleanly to the togreg branch of iio.git.

If I was being really fussy  this should have had a dependency list
for everything it was dependant on that wasn't currently in mainline.

Jonathan
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v3 0/5] Add support to LIS2DW12 accel sensor
@ 2017-09-03 16:52     ` Jonathan Cameron
  0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2017-09-03 16:52 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: linux-iio, linus.walleij, lorenzo.bianconi, devicetree

On Wed, 30 Aug 2017 13:50:38 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:

> Modify management of drdy line and status register in order to support
> LIS2DW12 device
> 
> Changes since v2:
> - swap status register patch (3rd in v2) with irq{1,2} definition one
>   (1st in v2)
> - patchset rebased onto 'fix drdy line configuration for LIS3MDL' patch
> Changes since v1:
> - remove drdy_irq parameter from LPS001WP settings since the sensor
> does not support data-ready interrupts
> 
> Lorenzo Bianconi (5):
>   iio: st_sensors: add register mask for status register
>   iio: st_sensors: decouple irq1 configuration parameters from the irq2
>     ones
>   iio: st_sensors: do not always write enable_axis register
>   iio: accel: add support to LIS2DW12
>   dt-bindings: iio: accel: add LIS2DW12 sensor device binding
> 
>  .../devicetree/bindings/iio/st-sensors.txt         |   1 +
>  drivers/iio/accel/st_accel.h                       |   2 +
>  drivers/iio/accel/st_accel_core.c                  | 180 +++++++++++++++++----
>  drivers/iio/accel/st_accel_i2c.c                   |   5 +
>  drivers/iio/accel/st_accel_spi.c                   |   5 +
>  drivers/iio/common/st_sensors/st_sensors_core.c    |  35 ++--
>  drivers/iio/common/st_sensors/st_sensors_trigger.c |  16 +-
>  drivers/iio/gyro/st_gyro_core.c                    |  33 ++--
>  drivers/iio/magnetometer/st_magn_core.c            |  16 +-
>  drivers/iio/pressure/st_pressure_core.c            |  46 ++++--
>  include/linux/iio/common/st_sensors.h              |  23 ++-
>  11 files changed, 270 insertions(+), 92 deletions(-)
> 

I'm happy with the whole series, however it doesn't currently apply
due to various fixes working their way through the fixes branches
of the iio git tree.  I'll try to pick it up once those have unwound.
There is too much going on with this code at the moment to do this
cleanly now.

Give me a bump if I look like I have forgotten it once it will
apply cleanly to the togreg branch of iio.git.

If I was being really fussy  this should have had a dependency list
for everything it was dependant on that wasn't currently in mainline.

Jonathan

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

* Re: [PATCH v3 1/5] iio: st_sensors: add register mask for status register
  2017-08-30 11:50     ` Lorenzo Bianconi
@ 2017-09-21 11:13         ` Linus Walleij
  -1 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2017-09-21 11:13 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Jonathan Cameron, linux-iio-u79uwXL29TY76Z2rM5mHXA,
	Lorenzo Bianconi, devicetree-u79uwXL29TY76Z2rM5mHXA

On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
<lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Introduce register mask for data-ready status register since
> pressure sensors (e.g. LPS22HB) export just two channels
> (BIT(0) and BIT(1)) and BIT(2) is marked reserved while in
> st_sensors_new_samples_available() value read from status register
> is masked using 0x7.
> Moreover do not mask status register using active_scan_mask since
> now status value is properly masked and if the result is not zero the
> interrupt has to be consumed by the driver. This fix an issue on LPS25H
> and LPS331AP where channel definition is swapped respect to status
> register.
> Furthermore that change allows to properly support new devices
> (e.g LIS2DW12) that report just ZYXDA (data-ready) field in status register
> to figure out if the interrupt has been generated by the device.
>
> Fixes: 97865fe41322 (iio: st_sensors: verify interrupt event to status)
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>

Reviewed-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

I'm a bit worried that we would need to use this on some of the
older sensors too, mainly because of mine and others' ignorance.
Have you looked over everything or just pressure sensors?

Yours,
Linus Walleij

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

* Re: [PATCH v3 1/5] iio: st_sensors: add register mask for status register
@ 2017-09-21 11:13         ` Linus Walleij
  0 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2017-09-21 11:13 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Jonathan Cameron, linux-iio, Lorenzo Bianconi, devicetree

On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
<lorenzo.bianconi83@gmail.com> wrote:

> Introduce register mask for data-ready status register since
> pressure sensors (e.g. LPS22HB) export just two channels
> (BIT(0) and BIT(1)) and BIT(2) is marked reserved while in
> st_sensors_new_samples_available() value read from status register
> is masked using 0x7.
> Moreover do not mask status register using active_scan_mask since
> now status value is properly masked and if the result is not zero the
> interrupt has to be consumed by the driver. This fix an issue on LPS25H
> and LPS331AP where channel definition is swapped respect to status
> register.
> Furthermore that change allows to properly support new devices
> (e.g LIS2DW12) that report just ZYXDA (data-ready) field in status register
> to figure out if the interrupt has been generated by the device.
>
> Fixes: 97865fe41322 (iio: st_sensors: verify interrupt event to status)
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>

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

I'm a bit worried that we would need to use this on some of the
older sensors too, mainly because of mine and others' ignorance.
Have you looked over everything or just pressure sensors?

Yours,
Linus Walleij

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

* Re: [PATCH v3 2/5] iio: st_sensors: decouple irq1 configuration parameters from the irq2 ones
  2017-08-30 11:50     ` Lorenzo Bianconi
@ 2017-09-21 11:14         ` Linus Walleij
  -1 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2017-09-21 11:14 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Jonathan Cameron, linux-iio-u79uwXL29TY76Z2rM5mHXA,
	Lorenzo Bianconi, devicetree-u79uwXL29TY76Z2rM5mHXA

On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
<lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Separate data-ready configuration parameters for INT1 and INT2 pins in
> st_sensor_data_ready_irq data structure. That change will be use to
> properly support LIS2DW12 accel sensor.
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>

Reviewed-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Also here I feel we should make a sweep over old sensors
and make sure we got this right everywhere.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v3 2/5] iio: st_sensors: decouple irq1 configuration parameters from the irq2 ones
@ 2017-09-21 11:14         ` Linus Walleij
  0 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2017-09-21 11:14 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Jonathan Cameron, linux-iio, Lorenzo Bianconi, devicetree

On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
<lorenzo.bianconi83@gmail.com> wrote:

> Separate data-ready configuration parameters for INT1 and INT2 pins in
> st_sensor_data_ready_irq data structure. That change will be use to
> properly support LIS2DW12 accel sensor.
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>

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

Also here I feel we should make a sweep over old sensors
and make sure we got this right everywhere.

Yours,
Linus Walleij

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

* Re: [PATCH v3 3/5] iio: st_sensors: do not always write enable_axis register
  2017-08-30 11:50     ` Lorenzo Bianconi
@ 2017-09-21 11:15         ` Linus Walleij
  -1 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2017-09-21 11:15 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Jonathan Cameron, linux-iio-u79uwXL29TY76Z2rM5mHXA,
	Lorenzo Bianconi, devicetree-u79uwXL29TY76Z2rM5mHXA

On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
<lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> New devices (e.g. LIS2DW12) enable all axis by default and do not export
> that capability in register map. Check if the enable_axis register
> address has been declared in st_sensor_settings map in order to verify if
> the driver needs to enable all sensor axis
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>

Reviewed-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v3 3/5] iio: st_sensors: do not always write enable_axis register
@ 2017-09-21 11:15         ` Linus Walleij
  0 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2017-09-21 11:15 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Jonathan Cameron, linux-iio, Lorenzo Bianconi, devicetree

On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
<lorenzo.bianconi83@gmail.com> wrote:

> New devices (e.g. LIS2DW12) enable all axis by default and do not export
> that capability in register map. Check if the enable_axis register
> address has been declared in st_sensor_settings map in order to verify if
> the driver needs to enable all sensor axis
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>

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

Yours,
Linus Walleij

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

* Re: [PATCH v3 4/5] iio: accel: add support to LIS2DW12
  2017-08-30 11:50     ` Lorenzo Bianconi
@ 2017-09-21 11:17         ` Linus Walleij
  -1 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2017-09-21 11:17 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Jonathan Cameron, linux-iio-u79uwXL29TY76Z2rM5mHXA,
	Lorenzo Bianconi, devicetree-u79uwXL29TY76Z2rM5mHXA

On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
<lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> add support to STMicroelectronics LIS2DW12 accelerometer in
> st_accel framework
>
> http://www.st.com/resource/en/datasheet/lis2dw12.pdf
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>

Add a blank line between the datasheet link and the Signed-off-by.
Reviewed-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Yours,
Linus Walleij

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

* Re: [PATCH v3 4/5] iio: accel: add support to LIS2DW12
@ 2017-09-21 11:17         ` Linus Walleij
  0 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2017-09-21 11:17 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Jonathan Cameron, linux-iio, Lorenzo Bianconi, devicetree

On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
<lorenzo.bianconi83@gmail.com> wrote:

> add support to STMicroelectronics LIS2DW12 accelerometer in
> st_accel framework
>
> http://www.st.com/resource/en/datasheet/lis2dw12.pdf
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>

Add a blank line between the datasheet link and the Signed-off-by.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH v3 5/5] dt-bindings: iio: accel: add LIS2DW12 sensor device binding
  2017-08-30 11:50     ` Lorenzo Bianconi
@ 2017-09-21 11:18         ` Linus Walleij
  -1 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2017-09-21 11:18 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Jonathan Cameron, linux-iio-u79uwXL29TY76Z2rM5mHXA,
	Lorenzo Bianconi, devicetree-u79uwXL29TY76Z2rM5mHXA

On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
<lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>

Reviewed-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Yours,
Linus Walleij

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

* Re: [PATCH v3 5/5] dt-bindings: iio: accel: add LIS2DW12 sensor device binding
@ 2017-09-21 11:18         ` Linus Walleij
  0 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2017-09-21 11:18 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Jonathan Cameron, linux-iio, Lorenzo Bianconi, devicetree

On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
<lorenzo.bianconi83@gmail.com> wrote:

> Acked-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>

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

Yours,
Linus Walleij

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

* Re: [PATCH v3 1/5] iio: st_sensors: add register mask for status register
  2017-09-21 11:13         ` Linus Walleij
@ 2017-09-21 15:36             ` Lorenzo Bianconi
  -1 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-09-21 15:36 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Jonathan Cameron, linux-iio-u79uwXL29TY76Z2rM5mHXA,
	Lorenzo Bianconi, devicetree-u79uwXL29TY76Z2rM5mHXA

> On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
> <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>> Introduce register mask for data-ready status register since
>> pressure sensors (e.g. LPS22HB) export just two channels
>> (BIT(0) and BIT(1)) and BIT(2) is marked reserved while in
>> st_sensors_new_samples_available() value read from status register
>> is masked using 0x7.
>> Moreover do not mask status register using active_scan_mask since
>> now status value is properly masked and if the result is not zero the
>> interrupt has to be consumed by the driver. This fix an issue on LPS25H
>> and LPS331AP where channel definition is swapped respect to status
>> register.
>> Furthermore that change allows to properly support new devices
>> (e.g LIS2DW12) that report just ZYXDA (data-ready) field in status register
>> to figure out if the interrupt has been generated by the device.
>>
>> Fixes: 97865fe41322 (iio: st_sensors: verify interrupt event to status)
>> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
>
> Reviewed-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>
> I'm a bit worried that we would need to use this on some of the
> older sensors too, mainly because of mine and others' ignorance.
> Have you looked over everything or just pressure sensors?

I double-checked ds for all supported devices and just pressure
sensors have 0x3 as status mask.

Regards,
Lorenzo

>
> Yours,
> Linus Walleij



-- 
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep

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

* Re: [PATCH v3 1/5] iio: st_sensors: add register mask for status register
@ 2017-09-21 15:36             ` Lorenzo Bianconi
  0 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-09-21 15:36 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Jonathan Cameron, linux-iio, Lorenzo Bianconi, devicetree

> On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
> <lorenzo.bianconi83@gmail.com> wrote:
>
>> Introduce register mask for data-ready status register since
>> pressure sensors (e.g. LPS22HB) export just two channels
>> (BIT(0) and BIT(1)) and BIT(2) is marked reserved while in
>> st_sensors_new_samples_available() value read from status register
>> is masked using 0x7.
>> Moreover do not mask status register using active_scan_mask since
>> now status value is properly masked and if the result is not zero the
>> interrupt has to be consumed by the driver. This fix an issue on LPS25H
>> and LPS331AP where channel definition is swapped respect to status
>> register.
>> Furthermore that change allows to properly support new devices
>> (e.g LIS2DW12) that report just ZYXDA (data-ready) field in status register
>> to figure out if the interrupt has been generated by the device.
>>
>> Fixes: 97865fe41322 (iio: st_sensors: verify interrupt event to status)
>> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>
> I'm a bit worried that we would need to use this on some of the
> older sensors too, mainly because of mine and others' ignorance.
> Have you looked over everything or just pressure sensors?

I double-checked ds for all supported devices and just pressure
sensors have 0x3 as status mask.

Regards,
Lorenzo

>
> Yours,
> Linus Walleij



-- 
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep

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

* Re: [PATCH v3 2/5] iio: st_sensors: decouple irq1 configuration parameters from the irq2 ones
  2017-09-21 11:14         ` Linus Walleij
@ 2017-09-21 15:38             ` Lorenzo Bianconi
  -1 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-09-21 15:38 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Jonathan Cameron, linux-iio-u79uwXL29TY76Z2rM5mHXA,
	Lorenzo Bianconi, devicetree-u79uwXL29TY76Z2rM5mHXA

> On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
> <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>> Separate data-ready configuration parameters for INT1 and INT2 pins in
>> st_sensor_data_ready_irq data structure. That change will be use to
>> properly support LIS2DW12 accel sensor.
>>
>> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
>
> Reviewed-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>
> Also here I feel we should make a sweep over old sensors
> and make sure we got this right everywhere.

I checked all supported devices and irq configurations seem fine.
Regards,

Lorenzo

>
> Yours,
> Linus Walleij



-- 
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v3 2/5] iio: st_sensors: decouple irq1 configuration parameters from the irq2 ones
@ 2017-09-21 15:38             ` Lorenzo Bianconi
  0 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-09-21 15:38 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Jonathan Cameron, linux-iio, Lorenzo Bianconi, devicetree

> On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
> <lorenzo.bianconi83@gmail.com> wrote:
>
>> Separate data-ready configuration parameters for INT1 and INT2 pins in
>> st_sensor_data_ready_irq data structure. That change will be use to
>> properly support LIS2DW12 accel sensor.
>>
>> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>
> Also here I feel we should make a sweep over old sensors
> and make sure we got this right everywhere.

I checked all supported devices and irq configurations seem fine.
Regards,

Lorenzo

>
> Yours,
> Linus Walleij



-- 
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep

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

* Re: [PATCH v3 0/5] Add support to LIS2DW12 accel sensor
  2017-09-03 16:52     ` Jonathan Cameron
@ 2017-10-01 13:15       ` Lorenzo Bianconi
  -1 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-10-01 13:15 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA, Linus Walleij,
	Lorenzo BIANCONI, devicetree-u79uwXL29TY76Z2rM5mHXA

> On Wed, 30 Aug 2017 13:50:38 +0200
> Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>> Modify management of drdy line and status register in order to support
>> LIS2DW12 device
>>
>> Changes since v2:
>> - swap status register patch (3rd in v2) with irq{1,2} definition one
>>   (1st in v2)
>> - patchset rebased onto 'fix drdy line configuration for LIS3MDL' patch
>> Changes since v1:
>> - remove drdy_irq parameter from LPS001WP settings since the sensor
>> does not support data-ready interrupts
>>
>> Lorenzo Bianconi (5):
>>   iio: st_sensors: add register mask for status register
>>   iio: st_sensors: decouple irq1 configuration parameters from the irq2
>>     ones
>>   iio: st_sensors: do not always write enable_axis register
>>   iio: accel: add support to LIS2DW12
>>   dt-bindings: iio: accel: add LIS2DW12 sensor device binding
>>
>>  .../devicetree/bindings/iio/st-sensors.txt         |   1 +
>>  drivers/iio/accel/st_accel.h                       |   2 +
>>  drivers/iio/accel/st_accel_core.c                  | 180 +++++++++++++++++----
>>  drivers/iio/accel/st_accel_i2c.c                   |   5 +
>>  drivers/iio/accel/st_accel_spi.c                   |   5 +
>>  drivers/iio/common/st_sensors/st_sensors_core.c    |  35 ++--
>>  drivers/iio/common/st_sensors/st_sensors_trigger.c |  16 +-
>>  drivers/iio/gyro/st_gyro_core.c                    |  33 ++--
>>  drivers/iio/magnetometer/st_magn_core.c            |  16 +-
>>  drivers/iio/pressure/st_pressure_core.c            |  46 ++++--
>>  include/linux/iio/common/st_sensors.h              |  23 ++-
>>  11 files changed, 270 insertions(+), 92 deletions(-)
>>
>
> I'm happy with the whole series, however it doesn't currently apply
> due to various fixes working their way through the fixes branches
> of the iio git tree.  I'll try to pick it up once those have unwound.
> There is too much going on with this code at the moment to do this
> cleanly now.
>
> Give me a bump if I look like I have forgotten it once it will
> apply cleanly to the togreg branch of iio.git.
>
> If I was being really fussy  this should have had a dependency list
> for everything it was dependant on that wasn't currently in mainline.
>
> Jonathan

Hi Jonathan,

what about that patchset?
Regards,

Lorenzo

-- 
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v3 0/5] Add support to LIS2DW12 accel sensor
@ 2017-10-01 13:15       ` Lorenzo Bianconi
  0 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-10-01 13:15 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, Linus Walleij, Lorenzo BIANCONI, devicetree

> On Wed, 30 Aug 2017 13:50:38 +0200
> Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
>
>> Modify management of drdy line and status register in order to support
>> LIS2DW12 device
>>
>> Changes since v2:
>> - swap status register patch (3rd in v2) with irq{1,2} definition one
>>   (1st in v2)
>> - patchset rebased onto 'fix drdy line configuration for LIS3MDL' patch
>> Changes since v1:
>> - remove drdy_irq parameter from LPS001WP settings since the sensor
>> does not support data-ready interrupts
>>
>> Lorenzo Bianconi (5):
>>   iio: st_sensors: add register mask for status register
>>   iio: st_sensors: decouple irq1 configuration parameters from the irq2
>>     ones
>>   iio: st_sensors: do not always write enable_axis register
>>   iio: accel: add support to LIS2DW12
>>   dt-bindings: iio: accel: add LIS2DW12 sensor device binding
>>
>>  .../devicetree/bindings/iio/st-sensors.txt         |   1 +
>>  drivers/iio/accel/st_accel.h                       |   2 +
>>  drivers/iio/accel/st_accel_core.c                  | 180 +++++++++++++++++----
>>  drivers/iio/accel/st_accel_i2c.c                   |   5 +
>>  drivers/iio/accel/st_accel_spi.c                   |   5 +
>>  drivers/iio/common/st_sensors/st_sensors_core.c    |  35 ++--
>>  drivers/iio/common/st_sensors/st_sensors_trigger.c |  16 +-
>>  drivers/iio/gyro/st_gyro_core.c                    |  33 ++--
>>  drivers/iio/magnetometer/st_magn_core.c            |  16 +-
>>  drivers/iio/pressure/st_pressure_core.c            |  46 ++++--
>>  include/linux/iio/common/st_sensors.h              |  23 ++-
>>  11 files changed, 270 insertions(+), 92 deletions(-)
>>
>
> I'm happy with the whole series, however it doesn't currently apply
> due to various fixes working their way through the fixes branches
> of the iio git tree.  I'll try to pick it up once those have unwound.
> There is too much going on with this code at the moment to do this
> cleanly now.
>
> Give me a bump if I look like I have forgotten it once it will
> apply cleanly to the togreg branch of iio.git.
>
> If I was being really fussy  this should have had a dependency list
> for everything it was dependant on that wasn't currently in mainline.
>
> Jonathan

Hi Jonathan,

what about that patchset?
Regards,

Lorenzo

-- 
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep

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

* Re: [PATCH v3 0/5] Add support to LIS2DW12 accel sensor
  2017-10-01 13:15       ` Lorenzo Bianconi
@ 2017-10-02 10:33           ` Jonathan Cameron
  -1 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2017-10-02 10:33 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Jonathan Cameron, linux-iio-u79uwXL29TY76Z2rM5mHXA,
	Linus Walleij, Lorenzo BIANCONI,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Sun, 1 Oct 2017 15:15:26 +0200
Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> > On Wed, 30 Aug 2017 13:50:38 +0200
> > Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >  
> >> Modify management of drdy line and status register in order to support
> >> LIS2DW12 device
> >>
> >> Changes since v2:
> >> - swap status register patch (3rd in v2) with irq{1,2} definition one
> >>   (1st in v2)
> >> - patchset rebased onto 'fix drdy line configuration for LIS3MDL' patch
> >> Changes since v1:
> >> - remove drdy_irq parameter from LPS001WP settings since the sensor
> >> does not support data-ready interrupts
> >>
> >> Lorenzo Bianconi (5):
> >>   iio: st_sensors: add register mask for status register
> >>   iio: st_sensors: decouple irq1 configuration parameters from the irq2
> >>     ones
> >>   iio: st_sensors: do not always write enable_axis register
> >>   iio: accel: add support to LIS2DW12
> >>   dt-bindings: iio: accel: add LIS2DW12 sensor device binding
> >>
> >>  .../devicetree/bindings/iio/st-sensors.txt         |   1 +
> >>  drivers/iio/accel/st_accel.h                       |   2 +
> >>  drivers/iio/accel/st_accel_core.c                  | 180 +++++++++++++++++----
> >>  drivers/iio/accel/st_accel_i2c.c                   |   5 +
> >>  drivers/iio/accel/st_accel_spi.c                   |   5 +
> >>  drivers/iio/common/st_sensors/st_sensors_core.c    |  35 ++--
> >>  drivers/iio/common/st_sensors/st_sensors_trigger.c |  16 +-
> >>  drivers/iio/gyro/st_gyro_core.c                    |  33 ++--
> >>  drivers/iio/magnetometer/st_magn_core.c            |  16 +-
> >>  drivers/iio/pressure/st_pressure_core.c            |  46 ++++--
> >>  include/linux/iio/common/st_sensors.h              |  23 ++-
> >>  11 files changed, 270 insertions(+), 92 deletions(-)
> >>  
> >
> > I'm happy with the whole series, however it doesn't currently apply
> > due to various fixes working their way through the fixes branches
> > of the iio git tree.  I'll try to pick it up once those have unwound.
> > There is too much going on with this code at the moment to do this
> > cleanly now.
> >
> > Give me a bump if I look like I have forgotten it once it will
> > apply cleanly to the togreg branch of iio.git.
> >
> > If I was being really fussy  this should have had a dependency list
> > for everything it was dependant on that wasn't currently in mainline.
> >
> > Jonathan  
> 
> Hi Jonathan,
> 
> what about that patchset?
> Regards,
> 
> Lorenzo
> 

I think I'm still waiting for the fixes to get back round via mainline
to our upstream tree...   Will check again later this week.

Jonathan

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

* Re: [PATCH v3 0/5] Add support to LIS2DW12 accel sensor
@ 2017-10-02 10:33           ` Jonathan Cameron
  0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2017-10-02 10:33 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Jonathan Cameron, linux-iio, Linus Walleij, Lorenzo BIANCONI, devicetree

On Sun, 1 Oct 2017 15:15:26 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:

> > On Wed, 30 Aug 2017 13:50:38 +0200
> > Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
> >  
> >> Modify management of drdy line and status register in order to support
> >> LIS2DW12 device
> >>
> >> Changes since v2:
> >> - swap status register patch (3rd in v2) with irq{1,2} definition one
> >>   (1st in v2)
> >> - patchset rebased onto 'fix drdy line configuration for LIS3MDL' patch
> >> Changes since v1:
> >> - remove drdy_irq parameter from LPS001WP settings since the sensor
> >> does not support data-ready interrupts
> >>
> >> Lorenzo Bianconi (5):
> >>   iio: st_sensors: add register mask for status register
> >>   iio: st_sensors: decouple irq1 configuration parameters from the irq2
> >>     ones
> >>   iio: st_sensors: do not always write enable_axis register
> >>   iio: accel: add support to LIS2DW12
> >>   dt-bindings: iio: accel: add LIS2DW12 sensor device binding
> >>
> >>  .../devicetree/bindings/iio/st-sensors.txt         |   1 +
> >>  drivers/iio/accel/st_accel.h                       |   2 +
> >>  drivers/iio/accel/st_accel_core.c                  | 180 +++++++++++++++++----
> >>  drivers/iio/accel/st_accel_i2c.c                   |   5 +
> >>  drivers/iio/accel/st_accel_spi.c                   |   5 +
> >>  drivers/iio/common/st_sensors/st_sensors_core.c    |  35 ++--
> >>  drivers/iio/common/st_sensors/st_sensors_trigger.c |  16 +-
> >>  drivers/iio/gyro/st_gyro_core.c                    |  33 ++--
> >>  drivers/iio/magnetometer/st_magn_core.c            |  16 +-
> >>  drivers/iio/pressure/st_pressure_core.c            |  46 ++++--
> >>  include/linux/iio/common/st_sensors.h              |  23 ++-
> >>  11 files changed, 270 insertions(+), 92 deletions(-)
> >>  
> >
> > I'm happy with the whole series, however it doesn't currently apply
> > due to various fixes working their way through the fixes branches
> > of the iio git tree.  I'll try to pick it up once those have unwound.
> > There is too much going on with this code at the moment to do this
> > cleanly now.
> >
> > Give me a bump if I look like I have forgotten it once it will
> > apply cleanly to the togreg branch of iio.git.
> >
> > If I was being really fussy  this should have had a dependency list
> > for everything it was dependant on that wasn't currently in mainline.
> >
> > Jonathan  
> 
> Hi Jonathan,
> 
> what about that patchset?
> Regards,
> 
> Lorenzo
> 

I think I'm still waiting for the fixes to get back round via mainline
to our upstream tree...   Will check again later this week.

Jonathan

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

* Re: [PATCH v3 0/5] Add support to LIS2DW12 accel sensor
  2017-10-02 10:33           ` Jonathan Cameron
@ 2017-10-02 10:37               ` Lorenzo Bianconi
  -1 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-10-02 10:37 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Jonathan Cameron, linux-iio-u79uwXL29TY76Z2rM5mHXA,
	Linus Walleij, Lorenzo BIANCONI,
	devicetree-u79uwXL29TY76Z2rM5mHXA

> On Sun, 1 Oct 2017 15:15:26 +0200
> Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>> > On Wed, 30 Aug 2017 13:50:38 +0200
>> > Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> >
>> >> Modify management of drdy line and status register in order to support
>> >> LIS2DW12 device
>> >>
>> >> Changes since v2:
>> >> - swap status register patch (3rd in v2) with irq{1,2} definition one
>> >>   (1st in v2)
>> >> - patchset rebased onto 'fix drdy line configuration for LIS3MDL' patch
>> >> Changes since v1:
>> >> - remove drdy_irq parameter from LPS001WP settings since the sensor
>> >> does not support data-ready interrupts
>> >>
>> >> Lorenzo Bianconi (5):
>> >>   iio: st_sensors: add register mask for status register
>> >>   iio: st_sensors: decouple irq1 configuration parameters from the irq2
>> >>     ones
>> >>   iio: st_sensors: do not always write enable_axis register
>> >>   iio: accel: add support to LIS2DW12
>> >>   dt-bindings: iio: accel: add LIS2DW12 sensor device binding
>> >>
>> >>  .../devicetree/bindings/iio/st-sensors.txt         |   1 +
>> >>  drivers/iio/accel/st_accel.h                       |   2 +
>> >>  drivers/iio/accel/st_accel_core.c                  | 180 +++++++++++++++++----
>> >>  drivers/iio/accel/st_accel_i2c.c                   |   5 +
>> >>  drivers/iio/accel/st_accel_spi.c                   |   5 +
>> >>  drivers/iio/common/st_sensors/st_sensors_core.c    |  35 ++--
>> >>  drivers/iio/common/st_sensors/st_sensors_trigger.c |  16 +-
>> >>  drivers/iio/gyro/st_gyro_core.c                    |  33 ++--
>> >>  drivers/iio/magnetometer/st_magn_core.c            |  16 +-
>> >>  drivers/iio/pressure/st_pressure_core.c            |  46 ++++--
>> >>  include/linux/iio/common/st_sensors.h              |  23 ++-
>> >>  11 files changed, 270 insertions(+), 92 deletions(-)
>> >>
>> >
>> > I'm happy with the whole series, however it doesn't currently apply
>> > due to various fixes working their way through the fixes branches
>> > of the iio git tree.  I'll try to pick it up once those have unwound.
>> > There is too much going on with this code at the moment to do this
>> > cleanly now.
>> >
>> > Give me a bump if I look like I have forgotten it once it will
>> > apply cleanly to the togreg branch of iio.git.
>> >
>> > If I was being really fussy  this should have had a dependency list
>> > for everything it was dependant on that wasn't currently in mainline.
>> >
>> > Jonathan
>>
>> Hi Jonathan,
>>
>> what about that patchset?
>> Regards,
>>
>> Lorenzo
>>
>
> I think I'm still waiting for the fixes to get back round via mainline
> to our upstream tree...   Will check again later this week.
>
> Jonathan

Fine, thanks. A couple of series queued waiting for that one :)

Regards,
Lorenzo


-- 
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep

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

* Re: [PATCH v3 0/5] Add support to LIS2DW12 accel sensor
@ 2017-10-02 10:37               ` Lorenzo Bianconi
  0 siblings, 0 replies; 44+ messages in thread
From: Lorenzo Bianconi @ 2017-10-02 10:37 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Jonathan Cameron, linux-iio, Linus Walleij, Lorenzo BIANCONI, devicetree

> On Sun, 1 Oct 2017 15:15:26 +0200
> Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
>
>> > On Wed, 30 Aug 2017 13:50:38 +0200
>> > Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
>> >
>> >> Modify management of drdy line and status register in order to support
>> >> LIS2DW12 device
>> >>
>> >> Changes since v2:
>> >> - swap status register patch (3rd in v2) with irq{1,2} definition one
>> >>   (1st in v2)
>> >> - patchset rebased onto 'fix drdy line configuration for LIS3MDL' patch
>> >> Changes since v1:
>> >> - remove drdy_irq parameter from LPS001WP settings since the sensor
>> >> does not support data-ready interrupts
>> >>
>> >> Lorenzo Bianconi (5):
>> >>   iio: st_sensors: add register mask for status register
>> >>   iio: st_sensors: decouple irq1 configuration parameters from the irq2
>> >>     ones
>> >>   iio: st_sensors: do not always write enable_axis register
>> >>   iio: accel: add support to LIS2DW12
>> >>   dt-bindings: iio: accel: add LIS2DW12 sensor device binding
>> >>
>> >>  .../devicetree/bindings/iio/st-sensors.txt         |   1 +
>> >>  drivers/iio/accel/st_accel.h                       |   2 +
>> >>  drivers/iio/accel/st_accel_core.c                  | 180 +++++++++++++++++----
>> >>  drivers/iio/accel/st_accel_i2c.c                   |   5 +
>> >>  drivers/iio/accel/st_accel_spi.c                   |   5 +
>> >>  drivers/iio/common/st_sensors/st_sensors_core.c    |  35 ++--
>> >>  drivers/iio/common/st_sensors/st_sensors_trigger.c |  16 +-
>> >>  drivers/iio/gyro/st_gyro_core.c                    |  33 ++--
>> >>  drivers/iio/magnetometer/st_magn_core.c            |  16 +-
>> >>  drivers/iio/pressure/st_pressure_core.c            |  46 ++++--
>> >>  include/linux/iio/common/st_sensors.h              |  23 ++-
>> >>  11 files changed, 270 insertions(+), 92 deletions(-)
>> >>
>> >
>> > I'm happy with the whole series, however it doesn't currently apply
>> > due to various fixes working their way through the fixes branches
>> > of the iio git tree.  I'll try to pick it up once those have unwound.
>> > There is too much going on with this code at the moment to do this
>> > cleanly now.
>> >
>> > Give me a bump if I look like I have forgotten it once it will
>> > apply cleanly to the togreg branch of iio.git.
>> >
>> > If I was being really fussy  this should have had a dependency list
>> > for everything it was dependant on that wasn't currently in mainline.
>> >
>> > Jonathan
>>
>> Hi Jonathan,
>>
>> what about that patchset?
>> Regards,
>>
>> Lorenzo
>>
>
> I think I'm still waiting for the fixes to get back round via mainline
> to our upstream tree...   Will check again later this week.
>
> Jonathan

Fine, thanks. A couple of series queued waiting for that one :)

Regards,
Lorenzo


-- 
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep

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

* Re: [PATCH v3 1/5] iio: st_sensors: add register mask for status register
  2017-09-21 15:36             ` Lorenzo Bianconi
@ 2017-10-09 20:03                 ` Jonathan Cameron
  -1 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2017-10-09 20:03 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Linus Walleij, linux-iio-u79uwXL29TY76Z2rM5mHXA,
	Lorenzo Bianconi, devicetree-u79uwXL29TY76Z2rM5mHXA

On Thu, 21 Sep 2017 17:36:10 +0200
Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> > On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
> > <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >  
> >> Introduce register mask for data-ready status register since
> >> pressure sensors (e.g. LPS22HB) export just two channels
> >> (BIT(0) and BIT(1)) and BIT(2) is marked reserved while in
> >> st_sensors_new_samples_available() value read from status register
> >> is masked using 0x7.
> >> Moreover do not mask status register using active_scan_mask since
> >> now status value is properly masked and if the result is not zero the
> >> interrupt has to be consumed by the driver. This fix an issue on LPS25H
> >> and LPS331AP where channel definition is swapped respect to status
> >> register.
> >> Furthermore that change allows to properly support new devices
> >> (e.g LIS2DW12) that report just ZYXDA (data-ready) field in status register
> >> to figure out if the interrupt has been generated by the device.
> >>
> >> Fixes: 97865fe41322 (iio: st_sensors: verify interrupt event to status)
> >> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>  
> >
> > Reviewed-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> >
> > I'm a bit worried that we would need to use this on some of the
> > older sensors too, mainly because of mine and others' ignorance.
> > Have you looked over everything or just pressure sensors?  
> 
> I double-checked ds for all supported devices and just pressure
> sensors have 0x3 as status mask.

Ideally this patch would have gone via the fixes tree but we have
far too many patches queued up behind it for me to want to do that now.
Hence applied to the togreg branch of iio.git and pushed out
as testing for the autobuilders to play with it.

Thanks,

Jonathan

> 
> Regards,
> Lorenzo
> 
> >
> > Yours,
> > Linus Walleij  
> 
> 
> 

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

* Re: [PATCH v3 1/5] iio: st_sensors: add register mask for status register
@ 2017-10-09 20:03                 ` Jonathan Cameron
  0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2017-10-09 20:03 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: Linus Walleij, linux-iio, Lorenzo Bianconi, devicetree

On Thu, 21 Sep 2017 17:36:10 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:

> > On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
> > <lorenzo.bianconi83@gmail.com> wrote:
> >  
> >> Introduce register mask for data-ready status register since
> >> pressure sensors (e.g. LPS22HB) export just two channels
> >> (BIT(0) and BIT(1)) and BIT(2) is marked reserved while in
> >> st_sensors_new_samples_available() value read from status register
> >> is masked using 0x7.
> >> Moreover do not mask status register using active_scan_mask since
> >> now status value is properly masked and if the result is not zero the
> >> interrupt has to be consumed by the driver. This fix an issue on LPS25H
> >> and LPS331AP where channel definition is swapped respect to status
> >> register.
> >> Furthermore that change allows to properly support new devices
> >> (e.g LIS2DW12) that report just ZYXDA (data-ready) field in status register
> >> to figure out if the interrupt has been generated by the device.
> >>
> >> Fixes: 97865fe41322 (iio: st_sensors: verify interrupt event to status)
> >> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>  
> >
> > Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> >
> > I'm a bit worried that we would need to use this on some of the
> > older sensors too, mainly because of mine and others' ignorance.
> > Have you looked over everything or just pressure sensors?  
> 
> I double-checked ds for all supported devices and just pressure
> sensors have 0x3 as status mask.

Ideally this patch would have gone via the fixes tree but we have
far too many patches queued up behind it for me to want to do that now.
Hence applied to the togreg branch of iio.git and pushed out
as testing for the autobuilders to play with it.

Thanks,

Jonathan

> 
> Regards,
> Lorenzo
> 
> >
> > Yours,
> > Linus Walleij  
> 
> 
> 


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

* Re: [PATCH v3 2/5] iio: st_sensors: decouple irq1 configuration parameters from the irq2 ones
  2017-09-21 15:38             ` Lorenzo Bianconi
@ 2017-10-09 20:05                 ` Jonathan Cameron
  -1 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2017-10-09 20:05 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: Linus Walleij, linux-iio-u79uwXL29TY76Z2rM5mHXA,
	Lorenzo Bianconi, devicetree-u79uwXL29TY76Z2rM5mHXA

On Thu, 21 Sep 2017 17:38:34 +0200
Lorenzo Bianconi <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> > On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
> > <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >  
> >> Separate data-ready configuration parameters for INT1 and INT2 pins in
> >> st_sensor_data_ready_irq data structure. That change will be use to
> >> properly support LIS2DW12 accel sensor.
> >>
> >> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>  
> >
> > Reviewed-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> >
> > Also here I feel we should make a sweep over old sensors
> > and make sure we got this right everywhere.  
> 
> I checked all supported devices and irq configurations seem fine.
> Regards,
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan
> 
> Lorenzo
> 
> >
> > Yours,
> > Linus Walleij  
> 
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v3 2/5] iio: st_sensors: decouple irq1 configuration parameters from the irq2 ones
@ 2017-10-09 20:05                 ` Jonathan Cameron
  0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2017-10-09 20:05 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: Linus Walleij, linux-iio, Lorenzo Bianconi, devicetree

On Thu, 21 Sep 2017 17:38:34 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:

> > On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
> > <lorenzo.bianconi83@gmail.com> wrote:
> >  
> >> Separate data-ready configuration parameters for INT1 and INT2 pins in
> >> st_sensor_data_ready_irq data structure. That change will be use to
> >> properly support LIS2DW12 accel sensor.
> >>
> >> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>  
> >
> > Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> >
> > Also here I feel we should make a sweep over old sensors
> > and make sure we got this right everywhere.  
> 
> I checked all supported devices and irq configurations seem fine.
> Regards,
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan
> 
> Lorenzo
> 
> >
> > Yours,
> > Linus Walleij  
> 
> 
> 


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

* Re: [PATCH v3 3/5] iio: st_sensors: do not always write enable_axis register
  2017-09-21 11:15         ` Linus Walleij
@ 2017-10-09 20:59             ` Jonathan Cameron
  -1 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2017-10-09 20:59 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Lorenzo Bianconi, linux-iio-u79uwXL29TY76Z2rM5mHXA,
	Lorenzo Bianconi, devicetree-u79uwXL29TY76Z2rM5mHXA

On Thu, 21 Sep 2017 13:15:55 +0200
Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:

> On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
> <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 
> > New devices (e.g. LIS2DW12) enable all axis by default and do not export
> > that capability in register map. Check if the enable_axis register
> > address has been declared in st_sensor_settings map in order to verify if
> > the driver needs to enable all sensor axis
> >
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>  
> 
> Reviewed-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Applied.
> 
> Yours,
> Linus Walleij

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

* Re: [PATCH v3 3/5] iio: st_sensors: do not always write enable_axis register
@ 2017-10-09 20:59             ` Jonathan Cameron
  0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2017-10-09 20:59 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Lorenzo Bianconi, linux-iio, Lorenzo Bianconi, devicetree

On Thu, 21 Sep 2017 13:15:55 +0200
Linus Walleij <linus.walleij@linaro.org> wrote:

> On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
> <lorenzo.bianconi83@gmail.com> wrote:
> 
> > New devices (e.g. LIS2DW12) enable all axis by default and do not export
> > that capability in register map. Check if the enable_axis register
> > address has been declared in st_sensor_settings map in order to verify if
> > the driver needs to enable all sensor axis
> >
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>  
> 
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Applied.
> 
> Yours,
> Linus Walleij


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

* Re: [PATCH v3 4/5] iio: accel: add support to LIS2DW12
  2017-09-21 11:17         ` Linus Walleij
@ 2017-10-09 21:00             ` Jonathan Cameron
  -1 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2017-10-09 21:00 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Lorenzo Bianconi, linux-iio-u79uwXL29TY76Z2rM5mHXA,
	Lorenzo Bianconi, devicetree-u79uwXL29TY76Z2rM5mHXA

On Thu, 21 Sep 2017 13:17:23 +0200
Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:

> On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
> <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 
> > add support to STMicroelectronics LIS2DW12 accelerometer in
> > st_accel framework
> >
> > http://www.st.com/resource/en/datasheet/lis2dw12.pdf
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>  
> 
> Add a blank line between the datasheet link and the Signed-off-by.
> Reviewed-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Done and applied.
> 
> Yours,
> Linus Walleij
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v3 4/5] iio: accel: add support to LIS2DW12
@ 2017-10-09 21:00             ` Jonathan Cameron
  0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2017-10-09 21:00 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Lorenzo Bianconi, linux-iio, Lorenzo Bianconi, devicetree

On Thu, 21 Sep 2017 13:17:23 +0200
Linus Walleij <linus.walleij@linaro.org> wrote:

> On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
> <lorenzo.bianconi83@gmail.com> wrote:
> 
> > add support to STMicroelectronics LIS2DW12 accelerometer in
> > st_accel framework
> >
> > http://www.st.com/resource/en/datasheet/lis2dw12.pdf
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>  
> 
> Add a blank line between the datasheet link and the Signed-off-by.
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Done and applied.
> 
> Yours,
> Linus Walleij
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

* Re: [PATCH v3 5/5] dt-bindings: iio: accel: add LIS2DW12 sensor device binding
  2017-09-21 11:18         ` Linus Walleij
@ 2017-10-09 21:02             ` Jonathan Cameron
  -1 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2017-10-09 21:02 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Lorenzo Bianconi, linux-iio-u79uwXL29TY76Z2rM5mHXA,
	Lorenzo Bianconi, devicetree-u79uwXL29TY76Z2rM5mHXA

On Thu, 21 Sep 2017 13:18:01 +0200
Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:

> On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
> <lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 
> > Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>  
> 
> Reviewed-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> 
Applied to the togreg branch of iio.git and pushed out as
testing for the autobuilders to play with it.

I'm out of time for tonight, but hopefully should be able to catch
up with everything queued up behind this series in the next few days.

Jonathan

> Yours,
> Linus Walleij
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v3 5/5] dt-bindings: iio: accel: add LIS2DW12 sensor device binding
@ 2017-10-09 21:02             ` Jonathan Cameron
  0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2017-10-09 21:02 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Lorenzo Bianconi, linux-iio, Lorenzo Bianconi, devicetree

On Thu, 21 Sep 2017 13:18:01 +0200
Linus Walleij <linus.walleij@linaro.org> wrote:

> On Wed, Aug 30, 2017 at 1:50 PM, Lorenzo Bianconi
> <lorenzo.bianconi83@gmail.com> wrote:
> 
> > Acked-by: Rob Herring <robh@kernel.org>
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>  
> 
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> 
Applied to the togreg branch of iio.git and pushed out as
testing for the autobuilders to play with it.

I'm out of time for tonight, but hopefully should be able to catch
up with everything queued up behind this series in the next few days.

Jonathan

> Yours,
> Linus Walleij
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

end of thread, other threads:[~2017-10-10 19:42 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-30 11:50 [PATCH v3 0/5] Add support to LIS2DW12 accel sensor Lorenzo Bianconi
2017-08-30 11:50 ` Lorenzo Bianconi
     [not found] ` <20170830115043.3738-1-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-08-30 11:50   ` [PATCH v3 1/5] iio: st_sensors: add register mask for status register Lorenzo Bianconi
2017-08-30 11:50     ` Lorenzo Bianconi
     [not found]     ` <20170830115043.3738-2-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-09-21 11:13       ` Linus Walleij
2017-09-21 11:13         ` Linus Walleij
     [not found]         ` <CACRpkdaT-G_fRYVjhwiQiYuhjVHG7f_D1R=GHZVUpH7_6j7OHw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-09-21 15:36           ` Lorenzo Bianconi
2017-09-21 15:36             ` Lorenzo Bianconi
     [not found]             ` <CAA2SeN+0rjAB-84tZi81wu8AGRWOShwLGbW1OffO3GZ92-QOzQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-09 20:03               ` Jonathan Cameron
2017-10-09 20:03                 ` Jonathan Cameron
2017-08-30 11:50   ` [PATCH v3 2/5] iio: st_sensors: decouple irq1 configuration parameters from the irq2 ones Lorenzo Bianconi
2017-08-30 11:50     ` Lorenzo Bianconi
     [not found]     ` <20170830115043.3738-3-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-09-21 11:14       ` Linus Walleij
2017-09-21 11:14         ` Linus Walleij
     [not found]         ` <CACRpkdY-xgQ_Eu_Zf1EH-AnSo1pxTq8Pfg37UorMKCk_N7_TEg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-09-21 15:38           ` Lorenzo Bianconi
2017-09-21 15:38             ` Lorenzo Bianconi
     [not found]             ` <CAA2SeNJ8cq+hdEQP4d9Ped9SBQnwCgmSydbShtOexuSEwRGzeA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-09 20:05               ` Jonathan Cameron
2017-10-09 20:05                 ` Jonathan Cameron
2017-08-30 11:50   ` [PATCH v3 3/5] iio: st_sensors: do not always write enable_axis register Lorenzo Bianconi
2017-08-30 11:50     ` Lorenzo Bianconi
     [not found]     ` <20170830115043.3738-4-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-09-21 11:15       ` Linus Walleij
2017-09-21 11:15         ` Linus Walleij
     [not found]         ` <CACRpkdbFvAr26d_ExN-PuazsA_ZbPoOFuCKn-k-s3uwVvd64jg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-09 20:59           ` Jonathan Cameron
2017-10-09 20:59             ` Jonathan Cameron
2017-08-30 11:50   ` [PATCH v3 4/5] iio: accel: add support to LIS2DW12 Lorenzo Bianconi
2017-08-30 11:50     ` Lorenzo Bianconi
     [not found]     ` <20170830115043.3738-5-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-09-21 11:17       ` Linus Walleij
2017-09-21 11:17         ` Linus Walleij
     [not found]         ` <CACRpkdZE_67Qq8=E+Hs1kSH5cjUv_EOMiogZ+ss_wd_KNmzLfw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-09 21:00           ` Jonathan Cameron
2017-10-09 21:00             ` Jonathan Cameron
2017-08-30 11:50   ` [PATCH v3 5/5] dt-bindings: iio: accel: add LIS2DW12 sensor device binding Lorenzo Bianconi
2017-08-30 11:50     ` Lorenzo Bianconi
     [not found]     ` <20170830115043.3738-6-lorenzo.bianconi-qxv4g6HH51o@public.gmane.org>
2017-09-21 11:18       ` Linus Walleij
2017-09-21 11:18         ` Linus Walleij
     [not found]         ` <CACRpkdbKkctx3t3J36HBwkaYRq_CTadDed-ZkfL8ynXYBKVytg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-09 21:02           ` Jonathan Cameron
2017-10-09 21:02             ` Jonathan Cameron
2017-09-03 16:52   ` [PATCH v3 0/5] Add support to LIS2DW12 accel sensor Jonathan Cameron
2017-09-03 16:52     ` Jonathan Cameron
2017-10-01 13:15     ` Lorenzo Bianconi
2017-10-01 13:15       ` Lorenzo Bianconi
     [not found]       ` <CAA2SeNKaUhLvLV6iUoirotMtz+nitW5LzLS0una3=BH9v7=0qA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-02 10:33         ` Jonathan Cameron
2017-10-02 10:33           ` Jonathan Cameron
     [not found]           ` <20171002113312.00000064-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-10-02 10:37             ` Lorenzo Bianconi
2017-10-02 10:37               ` Lorenzo Bianconi

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.