All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/38] iio: ST clean-ups and new sensor support
@ 2013-09-10 12:49 ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio

Hi Jonathan,

Sorry for the continued development and resubmission. I won't write
anymore patches now. At least until these have been accepted.

This patch-set includes a few clean-ups surrounding error handling and
non-mandatory functionality along with regulator support and the addition
of a new pressure/temperature sensor (LPS001WP) and extended support for
a new magnetometer sensor (LSM303DLH).

Everything has been tested with Device Tree.
  
v2:
 - Rebased onto Linux -next as requested by Jonathan
 - Reworked clean-up patch to address Jonathan's concerns
 - Added binding document (inc regulators)
 - Extended regulator support in the driver
 - Re-worked Data Ready pin handling

v3:
 - Standardise sensor names: <model>_<sensor-type>
 - Added error handling clean-ups
 - More binding documents; for magn, accel and gyro
 - Message on successful sensor bring-up; for press, magn, accel and gyro
 - More device enablement for ux500 by way of CONFIGs
 - New neat reorder/grouping of patches 

 Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt        |  21 ++++++++
 Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt          |  21 ++++++++
 Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt |  21 ++++++++
 Documentation/devicetree/bindings/iio/pressure/lps001wp.txt      |  21 ++++++++
 arch/arm/boot/dts/ste-dbx5x0.dtsi                                |   5 --
 arch/arm/boot/dts/ste-snowball.dts                               |  34 ++++++++++++
 arch/arm/configs/u8500_defconfig                                 |   5 ++
 drivers/iio/accel/st_accel.h                                     |   4 +-
 drivers/iio/accel/st_accel_core.c                                |  28 +++++-----
 drivers/iio/common/st_sensors/st_sensors_core.c                  |  79 +++++++++++++++-------------
 drivers/iio/gyro/st_gyro.h                                       |   8 +--
 drivers/iio/gyro/st_gyro_core.c                                  |  24 +++++----
 drivers/iio/magnetometer/st_magn.h                               |   3 +-
 drivers/iio/magnetometer/st_magn_core.c                          |  27 +++++-----
 drivers/iio/pressure/st_pressure.h                               |   3 +-
 drivers/iio/pressure/st_pressure_core.c                          | 303 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
 drivers/iio/pressure/st_pressure_i2c.c                           |   1 +
 include/linux/iio/common/st_sensors.h                            |   6 +++
 18 files changed, 453 insertions(+), 161 deletions(-)


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

* [PATCH v3 00/38] iio: ST clean-ups and new sensor support
@ 2013-09-10 12:49 ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Jonathan,

Sorry for the continued development and resubmission. I won't write
anymore patches now. At least until these have been accepted.

This patch-set includes a few clean-ups surrounding error handling and
non-mandatory functionality along with regulator support and the addition
of a new pressure/temperature sensor (LPS001WP) and extended support for
a new magnetometer sensor (LSM303DLH).

Everything has been tested with Device Tree.
  
v2:
 - Rebased onto Linux -next as requested by Jonathan
 - Reworked clean-up patch to address Jonathan's concerns
 - Added binding document (inc regulators)
 - Extended regulator support in the driver
 - Re-worked Data Ready pin handling

v3:
 - Standardise sensor names: <model>_<sensor-type>
 - Added error handling clean-ups
 - More binding documents; for magn, accel and gyro
 - Message on successful sensor bring-up; for press, magn, accel and gyro
 - More device enablement for ux500 by way of CONFIGs
 - New neat reorder/grouping of patches 

 Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt        |  21 ++++++++
 Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt          |  21 ++++++++
 Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt |  21 ++++++++
 Documentation/devicetree/bindings/iio/pressure/lps001wp.txt      |  21 ++++++++
 arch/arm/boot/dts/ste-dbx5x0.dtsi                                |   5 --
 arch/arm/boot/dts/ste-snowball.dts                               |  34 ++++++++++++
 arch/arm/configs/u8500_defconfig                                 |   5 ++
 drivers/iio/accel/st_accel.h                                     |   4 +-
 drivers/iio/accel/st_accel_core.c                                |  28 +++++-----
 drivers/iio/common/st_sensors/st_sensors_core.c                  |  79 +++++++++++++++-------------
 drivers/iio/gyro/st_gyro.h                                       |   8 +--
 drivers/iio/gyro/st_gyro_core.c                                  |  24 +++++----
 drivers/iio/magnetometer/st_magn.h                               |   3 +-
 drivers/iio/magnetometer/st_magn_core.c                          |  27 +++++-----
 drivers/iio/pressure/st_pressure.h                               |   3 +-
 drivers/iio/pressure/st_pressure_core.c                          | 303 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
 drivers/iio/pressure/st_pressure_i2c.c                           |   1 +
 include/linux/iio/common/st_sensors.h                            |   6 +++
 18 files changed, 453 insertions(+), 161 deletions(-)

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

* [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Turns out that they're actually not required and the driver probes just
fine without them. The ID is incorrect at the moment anyway. They actually
currently specify the stn8815.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/boot/dts/ste-dbx5x0.dtsi | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/arm/boot/dts/ste-dbx5x0.dtsi b/arch/arm/boot/dts/ste-dbx5x0.dtsi
index 1c1091e..0c1338e 100644
--- a/arch/arm/boot/dts/ste-dbx5x0.dtsi
+++ b/arch/arm/boot/dts/ste-dbx5x0.dtsi
@@ -559,7 +559,6 @@
 			compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
 			reg = <0x80004000 0x1000>;
 			interrupts = <0 21 IRQ_TYPE_LEVEL_HIGH>;
-			arm,primecell-periphid = <0x180024>;
 
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -572,7 +571,6 @@
 			compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
 			reg = <0x80122000 0x1000>;
 			interrupts = <0 22 IRQ_TYPE_LEVEL_HIGH>;
-			arm,primecell-periphid = <0x180024>;
 
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -585,7 +583,6 @@
 			compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
 			reg = <0x80128000 0x1000>;
 			interrupts = <0 55 IRQ_TYPE_LEVEL_HIGH>;
-			arm,primecell-periphid = <0x180024>;
 
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -598,7 +595,6 @@
 			compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
 			reg = <0x80110000 0x1000>;
 			interrupts = <0 12 IRQ_TYPE_LEVEL_HIGH>;
-			arm,primecell-periphid = <0x180024>;
 
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -611,7 +607,6 @@
 			compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
 			reg = <0x8012a000 0x1000>;
 			interrupts = <0 51 IRQ_TYPE_LEVEL_HIGH>;
-			arm,primecell-periphid = <0x180024>;
 
 			#address-cells = <1>;
 			#size-cells = <0>;
-- 
1.8.1.2


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

* [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Turns out that they're actually not required and the driver probes just
fine without them. The ID is incorrect at the moment anyway. They actually
currently specify the stn8815.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/boot/dts/ste-dbx5x0.dtsi | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/arm/boot/dts/ste-dbx5x0.dtsi b/arch/arm/boot/dts/ste-dbx5x0.dtsi
index 1c1091e..0c1338e 100644
--- a/arch/arm/boot/dts/ste-dbx5x0.dtsi
+++ b/arch/arm/boot/dts/ste-dbx5x0.dtsi
@@ -559,7 +559,6 @@
 			compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
 			reg = <0x80004000 0x1000>;
 			interrupts = <0 21 IRQ_TYPE_LEVEL_HIGH>;
-			arm,primecell-periphid = <0x180024>;
 
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -572,7 +571,6 @@
 			compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
 			reg = <0x80122000 0x1000>;
 			interrupts = <0 22 IRQ_TYPE_LEVEL_HIGH>;
-			arm,primecell-periphid = <0x180024>;
 
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -585,7 +583,6 @@
 			compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
 			reg = <0x80128000 0x1000>;
 			interrupts = <0 55 IRQ_TYPE_LEVEL_HIGH>;
-			arm,primecell-periphid = <0x180024>;
 
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -598,7 +595,6 @@
 			compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
 			reg = <0x80110000 0x1000>;
 			interrupts = <0 12 IRQ_TYPE_LEVEL_HIGH>;
-			arm,primecell-periphid = <0x180024>;
 
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -611,7 +607,6 @@
 			compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
 			reg = <0x8012a000 0x1000>;
 			interrupts = <0 51 IRQ_TYPE_LEVEL_HIGH>;
-			arm,primecell-periphid = <0x180024>;
 
 			#address-cells = <1>;
 			#size-cells = <0>;
-- 
1.8.1.2

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

* [PATCH 02/38] ARM: ux500: Enable the LPS001WP Pressure & Temperature sensor from DT
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

After applying this node the LPS001WP sensor chip should probe
successfully once the driver support has also been applied.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/boot/dts/ste-snowball.dts | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
index f1fc128..d355d25 100644
--- a/arch/arm/boot/dts/ste-snowball.dts
+++ b/arch/arm/boot/dts/ste-snowball.dts
@@ -153,6 +153,16 @@
 			status = "okay";
 		};
 
+		i2c@80128000 {
+			lps001wp_press@5c {
+				compatible = "st,lps001wp_press";
+				reg = <0x5c>;
+
+				vdd-supply = <&ab8500_ldo_aux1_reg>;
+				vddio-supply = <&db8500_vsmps2_reg>;
+			};
+		};
+
 		uart@80120000 {
 			status = "okay";
 		};
-- 
1.8.1.2


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

* [PATCH 02/38] ARM: ux500: Enable the LPS001WP Pressure & Temperature sensor from DT
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

After applying this node the LPS001WP sensor chip should probe
successfully once the driver support has also been applied.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/boot/dts/ste-snowball.dts | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
index f1fc128..d355d25 100644
--- a/arch/arm/boot/dts/ste-snowball.dts
+++ b/arch/arm/boot/dts/ste-snowball.dts
@@ -153,6 +153,16 @@
 			status = "okay";
 		};
 
+		i2c at 80128000 {
+			lps001wp_press at 5c {
+				compatible = "st,lps001wp_press";
+				reg = <0x5c>;
+
+				vdd-supply = <&ab8500_ldo_aux1_reg>;
+				vddio-supply = <&db8500_vsmps2_reg>;
+			};
+		};
+
 		uart at 80120000 {
 			status = "okay";
 		};
-- 
1.8.1.2

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

* [PATCH 03/38] ARM: ux500: Enable the LSM303DLH Accelerator sensor from DT
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

After applying this node the LSM303DLH sensor chip should probe
successfully once the driver support has also been applied.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/boot/dts/ste-snowball.dts | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
index d355d25..d1f4c60 100644
--- a/arch/arm/boot/dts/ste-snowball.dts
+++ b/arch/arm/boot/dts/ste-snowball.dts
@@ -161,6 +161,14 @@
 				vdd-supply = <&ab8500_ldo_aux1_reg>;
 				vddio-supply = <&db8500_vsmps2_reg>;
 			};
+
+			lsm303dlh_accel@19 {
+				compatible = "st,lsm303dlh_accel";
+				reg = <0x19>;
+
+				vdd-supply = <&ab8500_ldo_aux1_reg>;
+				vddio-supply = <&db8500_vsmps2_reg>;
+			};
 		};
 
 		uart@80120000 {
-- 
1.8.1.2


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

* [PATCH 03/38] ARM: ux500: Enable the LSM303DLH Accelerator sensor from DT
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

After applying this node the LSM303DLH sensor chip should probe
successfully once the driver support has also been applied.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/boot/dts/ste-snowball.dts | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
index d355d25..d1f4c60 100644
--- a/arch/arm/boot/dts/ste-snowball.dts
+++ b/arch/arm/boot/dts/ste-snowball.dts
@@ -161,6 +161,14 @@
 				vdd-supply = <&ab8500_ldo_aux1_reg>;
 				vddio-supply = <&db8500_vsmps2_reg>;
 			};
+
+			lsm303dlh_accel at 19 {
+				compatible = "st,lsm303dlh_accel";
+				reg = <0x19>;
+
+				vdd-supply = <&ab8500_ldo_aux1_reg>;
+				vddio-supply = <&db8500_vsmps2_reg>;
+			};
 		};
 
 		uart at 80120000 {
-- 
1.8.1.2

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

* [PATCH 04/38] ARM: ux500: Enable the LSM303DLH Magnetometer sensor from DT
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

After applying this node the LSM303DLH sensor chip should probe
successfully once the driver support has also been applied.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/boot/dts/ste-snowball.dts | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
index d1f4c60..e37284e 100644
--- a/arch/arm/boot/dts/ste-snowball.dts
+++ b/arch/arm/boot/dts/ste-snowball.dts
@@ -169,6 +169,14 @@
 				vdd-supply = <&ab8500_ldo_aux1_reg>;
 				vddio-supply = <&db8500_vsmps2_reg>;
 			};
+
+			lsm303dlh_magn@1e {
+				compatible = "st,lsm303dlh_magn";
+				reg = <0x1e>;
+
+				vdd-supply = <&ab8500_ldo_aux1_reg>;
+				vddio-supply = <&db8500_vsmps2_reg>;
+			};
 		};
 
 		uart@80120000 {
-- 
1.8.1.2


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

* [PATCH 04/38] ARM: ux500: Enable the LSM303DLH Magnetometer sensor from DT
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

After applying this node the LSM303DLH sensor chip should probe
successfully once the driver support has also been applied.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/boot/dts/ste-snowball.dts | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
index d1f4c60..e37284e 100644
--- a/arch/arm/boot/dts/ste-snowball.dts
+++ b/arch/arm/boot/dts/ste-snowball.dts
@@ -169,6 +169,14 @@
 				vdd-supply = <&ab8500_ldo_aux1_reg>;
 				vddio-supply = <&db8500_vsmps2_reg>;
 			};
+
+			lsm303dlh_magn at 1e {
+				compatible = "st,lsm303dlh_magn";
+				reg = <0x1e>;
+
+				vdd-supply = <&ab8500_ldo_aux1_reg>;
+				vddio-supply = <&db8500_vsmps2_reg>;
+			};
 		};
 
 		uart at 80120000 {
-- 
1.8.1.2

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

* [PATCH 05/38] ARM: ux500: Enable the L3G4200D Gyroscope sensor from DT
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

After applying this node the L3G4200D sensor chip should probe
successfully once the driver support has also been applied.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/boot/dts/ste-snowball.dts | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
index e37284e..0b53854 100644
--- a/arch/arm/boot/dts/ste-snowball.dts
+++ b/arch/arm/boot/dts/ste-snowball.dts
@@ -177,6 +177,14 @@
 				vdd-supply = <&ab8500_ldo_aux1_reg>;
 				vddio-supply = <&db8500_vsmps2_reg>;
 			};
+
+			l3g4200d_gyro@68 {
+				compatible = "st,l3g4200d_gyro";
+				reg = <0x68>;
+
+				vdd-supply = <&ab8500_ldo_aux1_reg>;
+				vddio-supply = <&db8500_vsmps2_reg>;
+			};
 		};
 
 		uart@80120000 {
-- 
1.8.1.2


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

* [PATCH 05/38] ARM: ux500: Enable the L3G4200D Gyroscope sensor from DT
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

After applying this node the L3G4200D sensor chip should probe
successfully once the driver support has also been applied.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/boot/dts/ste-snowball.dts | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
index e37284e..0b53854 100644
--- a/arch/arm/boot/dts/ste-snowball.dts
+++ b/arch/arm/boot/dts/ste-snowball.dts
@@ -177,6 +177,14 @@
 				vdd-supply = <&ab8500_ldo_aux1_reg>;
 				vddio-supply = <&db8500_vsmps2_reg>;
 			};
+
+			l3g4200d_gyro at 68 {
+				compatible = "st,l3g4200d_gyro";
+				reg = <0x68>;
+
+				vdd-supply = <&ab8500_ldo_aux1_reg>;
+				vddio-supply = <&db8500_vsmps2_reg>;
+			};
 		};
 
 		uart at 80120000 {
-- 
1.8.1.2

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

* [PATCH 06/38] ARM: ux500: CONFIG: Enable ST's IIO Pressure Sensors by default
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/configs/u8500_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index a0025dc..6b29109 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -37,6 +37,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=65536
 CONFIG_SENSORS_BH1780=y
+CONFIG_IIO=y
+CONFIG_IIO_ST_PRESS=y
 CONFIG_NETDEVICES=y
 CONFIG_SMSC911X=y
 CONFIG_SMSC_PHY=y
-- 
1.8.1.2


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

* [PATCH 06/38] ARM: ux500: CONFIG: Enable ST's IIO Pressure Sensors by default
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/configs/u8500_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index a0025dc..6b29109 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -37,6 +37,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=65536
 CONFIG_SENSORS_BH1780=y
+CONFIG_IIO=y
+CONFIG_IIO_ST_PRESS=y
 CONFIG_NETDEVICES=y
 CONFIG_SMSC911X=y
 CONFIG_SMSC_PHY=y
-- 
1.8.1.2

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

* [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/configs/u8500_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index 6b29109..24f88d6 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -39,6 +39,7 @@ CONFIG_BLK_DEV_RAM_SIZE=65536
 CONFIG_SENSORS_BH1780=y
 CONFIG_IIO=y
 CONFIG_IIO_ST_PRESS=y
+CONFIG_IIO_ST_ACCEL_3AXIS=y
 CONFIG_NETDEVICES=y
 CONFIG_SMSC911X=y
 CONFIG_SMSC_PHY=y
-- 
1.8.1.2


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

* [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/configs/u8500_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index 6b29109..24f88d6 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -39,6 +39,7 @@ CONFIG_BLK_DEV_RAM_SIZE=65536
 CONFIG_SENSORS_BH1780=y
 CONFIG_IIO=y
 CONFIG_IIO_ST_PRESS=y
+CONFIG_IIO_ST_ACCEL_3AXIS=y
 CONFIG_NETDEVICES=y
 CONFIG_SMSC911X=y
 CONFIG_SMSC_PHY=y
-- 
1.8.1.2

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

* [PATCH 08/38] ARM: ux500: CONFIG: Enable ST's IIO Magnetometer Sensors by default
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/configs/u8500_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index 24f88d6..4b94b42 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -40,6 +40,7 @@ CONFIG_SENSORS_BH1780=y
 CONFIG_IIO=y
 CONFIG_IIO_ST_PRESS=y
 CONFIG_IIO_ST_ACCEL_3AXIS=y
+CONFIG_IIO_ST_MAGN_3AXIS=y
 CONFIG_NETDEVICES=y
 CONFIG_SMSC911X=y
 CONFIG_SMSC_PHY=y
-- 
1.8.1.2


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

* [PATCH 08/38] ARM: ux500: CONFIG: Enable ST's IIO Magnetometer Sensors by default
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/configs/u8500_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index 24f88d6..4b94b42 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -40,6 +40,7 @@ CONFIG_SENSORS_BH1780=y
 CONFIG_IIO=y
 CONFIG_IIO_ST_PRESS=y
 CONFIG_IIO_ST_ACCEL_3AXIS=y
+CONFIG_IIO_ST_MAGN_3AXIS=y
 CONFIG_NETDEVICES=y
 CONFIG_SMSC911X=y
 CONFIG_SMSC_PHY=y
-- 
1.8.1.2

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

* [PATCH 09/38] ARM: ux500: CONFIG: Enable ST's IIO Gyroscope Sensors by default
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/configs/u8500_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index 4b94b42..aaa6c0a 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -41,6 +41,7 @@ CONFIG_IIO=y
 CONFIG_IIO_ST_PRESS=y
 CONFIG_IIO_ST_ACCEL_3AXIS=y
 CONFIG_IIO_ST_MAGN_3AXIS=y
+CONFIG_IIO_ST_GYRO_3AXIS=y
 CONFIG_NETDEVICES=y
 CONFIG_SMSC911X=y
 CONFIG_SMSC_PHY=y
-- 
1.8.1.2


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

* [PATCH 09/38] ARM: ux500: CONFIG: Enable ST's IIO Gyroscope Sensors by default
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/configs/u8500_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index 4b94b42..aaa6c0a 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -41,6 +41,7 @@ CONFIG_IIO=y
 CONFIG_IIO_ST_PRESS=y
 CONFIG_IIO_ST_ACCEL_3AXIS=y
 CONFIG_IIO_ST_MAGN_3AXIS=y
+CONFIG_IIO_ST_GYRO_3AXIS=y
 CONFIG_NETDEVICES=y
 CONFIG_SMSC911X=y
 CONFIG_SMSC_PHY=y
-- 
1.8.1.2

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

* [PATCH 10/38] Documentation: dt: iio: Add binding for LPS001WP
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

LPS001WP is a Pressure and Temperature sensor.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 .../devicetree/bindings/iio/pressure/lps001wp.txt   | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/pressure/lps001wp.txt

diff --git a/Documentation/devicetree/bindings/iio/pressure/lps001wp.txt b/Documentation/devicetree/bindings/iio/pressure/lps001wp.txt
new file mode 100644
index 0000000..3294a65c6
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/pressure/lps001wp.txt
@@ -0,0 +1,21 @@
+* STMicroelectronics Pressure Sensor
+
+Required properties:
+  - compatible: Should be "st,lps001wp_press"
+  - reg: The I2C address of the sensor
+
+Optional properties:
+  - vdd-supply: Phandle to the Vdd supply regulator
+  - vddio-supply: Phandle to the Vdd-IO supply regulator
+
+Example:
+
+i2c@80128000 {
+        lps001wp@5c {
+                compatible = "st,lps001wp_press";
+                reg = <0x5c>;
+
+                vdd-supply = <&ab8500_ldo_aux1_reg>;
+                vddio-supply = <&db8500_vsmps2_reg>;
+        };
+};
-- 
1.8.1.2


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

* [PATCH 10/38] Documentation: dt: iio: Add binding for LPS001WP
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

LPS001WP is a Pressure and Temperature sensor.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 .../devicetree/bindings/iio/pressure/lps001wp.txt   | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/pressure/lps001wp.txt

diff --git a/Documentation/devicetree/bindings/iio/pressure/lps001wp.txt b/Documentation/devicetree/bindings/iio/pressure/lps001wp.txt
new file mode 100644
index 0000000..3294a65c6
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/pressure/lps001wp.txt
@@ -0,0 +1,21 @@
+* STMicroelectronics Pressure Sensor
+
+Required properties:
+  - compatible: Should be "st,lps001wp_press"
+  - reg: The I2C address of the sensor
+
+Optional properties:
+  - vdd-supply: Phandle to the Vdd supply regulator
+  - vddio-supply: Phandle to the Vdd-IO supply regulator
+
+Example:
+
+i2c at 80128000 {
+        lps001wp at 5c {
+                compatible = "st,lps001wp_press";
+                reg = <0x5c>;
+
+                vdd-supply = <&ab8500_ldo_aux1_reg>;
+                vddio-supply = <&db8500_vsmps2_reg>;
+        };
+};
-- 
1.8.1.2

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

* [PATCH 11/38] Documentation: dt: iio: Add binding for LSM303DLH
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

LSM303DLH is a Accelerometer Sensor

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 .../devicetree/bindings/iio/accel/lsm303dlh.txt     | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt

diff --git a/Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt b/Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt
new file mode 100644
index 0000000..bb59363
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt
@@ -0,0 +1,21 @@
+* STMicroelectronics Accelerometer Sensor
+
+Required properties:
+  - compatible: Should be "st,lsm303dlh_accel"
+  - reg: The I2C address of the sensor
+
+Optional properties:
+  - vdd-supply: Phandle to the Vdd supply regulator
+  - vddio-supply: Phandle to the Vdd-IO supply regulator
+
+Example:
+
+i2c@80128000 {
+	lsm303dlh_accel@19 {
+		compatible = "st,lsm303dlh_accel";
+		reg = <0x19>;
+
+		vdd-supply = <&ab8500_ldo_aux1_reg>;
+		vddio-supply = <&db8500_vsmps2_reg>;
+	};
+};
-- 
1.8.1.2


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

* [PATCH 11/38] Documentation: dt: iio: Add binding for LSM303DLH
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

LSM303DLH is a Accelerometer Sensor

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 .../devicetree/bindings/iio/accel/lsm303dlh.txt     | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt

diff --git a/Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt b/Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt
new file mode 100644
index 0000000..bb59363
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt
@@ -0,0 +1,21 @@
+* STMicroelectronics Accelerometer Sensor
+
+Required properties:
+  - compatible: Should be "st,lsm303dlh_accel"
+  - reg: The I2C address of the sensor
+
+Optional properties:
+  - vdd-supply: Phandle to the Vdd supply regulator
+  - vddio-supply: Phandle to the Vdd-IO supply regulator
+
+Example:
+
+i2c at 80128000 {
+	lsm303dlh_accel at 19 {
+		compatible = "st,lsm303dlh_accel";
+		reg = <0x19>;
+
+		vdd-supply = <&ab8500_ldo_aux1_reg>;
+		vddio-supply = <&db8500_vsmps2_reg>;
+	};
+};
-- 
1.8.1.2

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

* [PATCH 12/38] Documentation: dt: iio: Add binding for L3G4200D
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

L3G4200D is a Gyroscope Sensor

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 .../devicetree/bindings/iio/gyro/l3g4200d.txt       | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt

diff --git a/Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt b/Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt
new file mode 100644
index 0000000..29baf9d
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt
@@ -0,0 +1,21 @@
+* STMicroelectronics Gyroscope Sensor
+
+Required properties:
+  - compatible: Should be "st,l3g4200d_gyro"
+  - reg: The I2C address of the sensor
+
+Optional properties:
+  - vdd-supply: Phandle to the Vdd supply regulator
+  - vddio-supply: Phandle to the Vdd-IO supply regulator
+
+Example:
+
+i2c@80128000 {
+	l3g4200d_gyro@68 {
+		compatible = "st,l3g4200d_gyro";
+		reg = <0x68>;
+
+		vdd-supply = <&ab8500_ldo_aux1_reg>;
+		vddio-supply = <&db8500_vsmps2_reg>;
+	};
+};
-- 
1.8.1.2


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

* [PATCH 12/38] Documentation: dt: iio: Add binding for L3G4200D
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

L3G4200D is a Gyroscope Sensor

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 .../devicetree/bindings/iio/gyro/l3g4200d.txt       | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt

diff --git a/Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt b/Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt
new file mode 100644
index 0000000..29baf9d
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt
@@ -0,0 +1,21 @@
+* STMicroelectronics Gyroscope Sensor
+
+Required properties:
+  - compatible: Should be "st,l3g4200d_gyro"
+  - reg: The I2C address of the sensor
+
+Optional properties:
+  - vdd-supply: Phandle to the Vdd supply regulator
+  - vddio-supply: Phandle to the Vdd-IO supply regulator
+
+Example:
+
+i2c at 80128000 {
+	l3g4200d_gyro at 68 {
+		compatible = "st,l3g4200d_gyro";
+		reg = <0x68>;
+
+		vdd-supply = <&ab8500_ldo_aux1_reg>;
+		vddio-supply = <&db8500_vsmps2_reg>;
+	};
+};
-- 
1.8.1.2

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

* [PATCH 13/38] Documentation: dt: iio: Add binding for LSM303DLH
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

LSM303DLH is a Magnetometer Sensor

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 .../bindings/iio/magnetometer/lsm303dlh.txt         | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt

diff --git a/Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt b/Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt
new file mode 100644
index 0000000..5938369
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt
@@ -0,0 +1,21 @@
+* STMicroelectronics Magnetometer Sensor
+
+Required properties:
+  - compatible: Should be "st,lsm303dlh_magn"
+  - reg: The I2C address of the sensor
+
+Optional properties:
+  - vdd-supply: Phandle to the Vdd supply regulator
+  - vddio-supply: Phandle to the Vdd-IO supply regulator
+
+Example:
+
+i2c@80128000 {
+	lsm303dlh_magn@1e {
+		compatible = "st,lsm303dlh_magn";
+		reg = <0x1e>;
+
+		vdd-supply = <&ab8500_ldo_aux1_reg>;
+		vddio-supply = <&db8500_vsmps2_reg>;
+	};
+};
-- 
1.8.1.2


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

* [PATCH 13/38] Documentation: dt: iio: Add binding for LSM303DLH
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

LSM303DLH is a Magnetometer Sensor

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 .../bindings/iio/magnetometer/lsm303dlh.txt         | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt

diff --git a/Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt b/Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt
new file mode 100644
index 0000000..5938369
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt
@@ -0,0 +1,21 @@
+* STMicroelectronics Magnetometer Sensor
+
+Required properties:
+  - compatible: Should be "st,lsm303dlh_magn"
+  - reg: The I2C address of the sensor
+
+Optional properties:
+  - vdd-supply: Phandle to the Vdd supply regulator
+  - vddio-supply: Phandle to the Vdd-IO supply regulator
+
+Example:
+
+i2c at 80128000 {
+	lsm303dlh_magn at 1e {
+		compatible = "st,lsm303dlh_magn";
+		reg = <0x1e>;
+
+		vdd-supply = <&ab8500_ldo_aux1_reg>;
+		vddio-supply = <&db8500_vsmps2_reg>;
+	};
+};
-- 
1.8.1.2

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

* [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Some of ST's sensors are appended with their sensor type and some
are not. For consistency we're extending the same naming convention
throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/accel/st_accel.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
index c387763..d8d22e5 100644
--- a/drivers/iio/accel/st_accel.h
+++ b/drivers/iio/accel/st_accel.h
@@ -15,11 +15,11 @@
 #include <linux/iio/common/st_sensors.h>
 
 #define LSM303DLHC_ACCEL_DEV_NAME	"lsm303dlhc_accel"
-#define LIS3DH_ACCEL_DEV_NAME		"lis3dh"
+#define LIS3DH_ACCEL_DEV_NAME		"lis3dh_accel"
 #define LSM330D_ACCEL_DEV_NAME		"lsm330d_accel"
 #define LSM330DL_ACCEL_DEV_NAME		"lsm330dl_accel"
 #define LSM330DLC_ACCEL_DEV_NAME	"lsm330dlc_accel"
-#define LIS331DLH_ACCEL_DEV_NAME	"lis331dlh"
+#define LIS331DLH_ACCEL_DEV_NAME	"lis331dlh_accel"
 #define LSM303DL_ACCEL_DEV_NAME		"lsm303dl_accel"
 #define LSM303DLH_ACCEL_DEV_NAME	"lsm303dlh_accel"
 #define LSM303DLM_ACCEL_DEV_NAME	"lsm303dlm_accel"
-- 
1.8.1.2


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

* [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Some of ST's sensors are appended with their sensor type and some
are not. For consistency we're extending the same naming convention
throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/accel/st_accel.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
index c387763..d8d22e5 100644
--- a/drivers/iio/accel/st_accel.h
+++ b/drivers/iio/accel/st_accel.h
@@ -15,11 +15,11 @@
 #include <linux/iio/common/st_sensors.h>
 
 #define LSM303DLHC_ACCEL_DEV_NAME	"lsm303dlhc_accel"
-#define LIS3DH_ACCEL_DEV_NAME		"lis3dh"
+#define LIS3DH_ACCEL_DEV_NAME		"lis3dh_accel"
 #define LSM330D_ACCEL_DEV_NAME		"lsm330d_accel"
 #define LSM330DL_ACCEL_DEV_NAME		"lsm330dl_accel"
 #define LSM330DLC_ACCEL_DEV_NAME	"lsm330dlc_accel"
-#define LIS331DLH_ACCEL_DEV_NAME	"lis331dlh"
+#define LIS331DLH_ACCEL_DEV_NAME	"lis331dlh_accel"
 #define LSM303DL_ACCEL_DEV_NAME		"lsm303dl_accel"
 #define LSM303DLH_ACCEL_DEV_NAME	"lsm303dlh_accel"
 #define LSM303DLM_ACCEL_DEV_NAME	"lsm303dlm_accel"
-- 
1.8.1.2

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

* [PATCH 15/38] iio: gyro: st: Append _gyro to gyroscope sensor device names
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Some of ST's sensors are appended with their sensor type and some
are not. For consistency we're extending the same naming convention
throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/gyro/st_gyro.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/gyro/st_gyro.h b/drivers/iio/gyro/st_gyro.h
index f8f2bf8..5f0ec99 100644
--- a/drivers/iio/gyro/st_gyro.h
+++ b/drivers/iio/gyro/st_gyro.h
@@ -14,13 +14,13 @@
 #include <linux/types.h>
 #include <linux/iio/common/st_sensors.h>
 
-#define L3G4200D_GYRO_DEV_NAME		"l3g4200d"
+#define L3G4200D_GYRO_DEV_NAME		"l3g4200d_gyro"
 #define LSM330D_GYRO_DEV_NAME		"lsm330d_gyro"
 #define LSM330DL_GYRO_DEV_NAME		"lsm330dl_gyro"
 #define LSM330DLC_GYRO_DEV_NAME		"lsm330dlc_gyro"
-#define L3GD20_GYRO_DEV_NAME		"l3gd20"
-#define L3GD20H_GYRO_DEV_NAME		"l3gd20h"
-#define L3G4IS_GYRO_DEV_NAME		"l3g4is_ui"
+#define L3GD20_GYRO_DEV_NAME		"l3gd20_gyro"
+#define L3GD20H_GYRO_DEV_NAME		"l3gd20h_gyro"
+#define L3G4IS_GYRO_DEV_NAME		"l3g4is_ui_gyro"
 #define LSM330_GYRO_DEV_NAME		"lsm330_gyro"
 
 /**
-- 
1.8.1.2


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

* [PATCH 15/38] iio: gyro: st: Append _gyro to gyroscope sensor device names
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Some of ST's sensors are appended with their sensor type and some
are not. For consistency we're extending the same naming convention
throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/gyro/st_gyro.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/gyro/st_gyro.h b/drivers/iio/gyro/st_gyro.h
index f8f2bf8..5f0ec99 100644
--- a/drivers/iio/gyro/st_gyro.h
+++ b/drivers/iio/gyro/st_gyro.h
@@ -14,13 +14,13 @@
 #include <linux/types.h>
 #include <linux/iio/common/st_sensors.h>
 
-#define L3G4200D_GYRO_DEV_NAME		"l3g4200d"
+#define L3G4200D_GYRO_DEV_NAME		"l3g4200d_gyro"
 #define LSM330D_GYRO_DEV_NAME		"lsm330d_gyro"
 #define LSM330DL_GYRO_DEV_NAME		"lsm330dl_gyro"
 #define LSM330DLC_GYRO_DEV_NAME		"lsm330dlc_gyro"
-#define L3GD20_GYRO_DEV_NAME		"l3gd20"
-#define L3GD20H_GYRO_DEV_NAME		"l3gd20h"
-#define L3G4IS_GYRO_DEV_NAME		"l3g4is_ui"
+#define L3GD20_GYRO_DEV_NAME		"l3gd20_gyro"
+#define L3GD20H_GYRO_DEV_NAME		"l3gd20h_gyro"
+#define L3G4IS_GYRO_DEV_NAME		"l3g4is_ui_gyro"
 #define LSM330_GYRO_DEV_NAME		"lsm330_gyro"
 
 /**
-- 
1.8.1.2

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

* [PATCH 16/38] iio: magn: st: Append _magn to magnetometer sensor device names
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Some of ST's sensors are appended with their sensor type and some
are not. For consistency we're extending the same naming convention
throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/magnetometer/st_magn.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/magnetometer/st_magn.h b/drivers/iio/magnetometer/st_magn.h
index 694e33e..f185720 100644
--- a/drivers/iio/magnetometer/st_magn.h
+++ b/drivers/iio/magnetometer/st_magn.h
@@ -16,7 +16,7 @@
 
 #define LSM303DLHC_MAGN_DEV_NAME	"lsm303dlhc_magn"
 #define LSM303DLM_MAGN_DEV_NAME		"lsm303dlm_magn"
-#define LIS3MDL_MAGN_DEV_NAME		"lis3mdl"
+#define LIS3MDL_MAGN_DEV_NAME		"lis3mdl_magn"
 
 int st_magn_common_probe(struct iio_dev *indio_dev,
 					struct st_sensors_platform_data *pdata);
-- 
1.8.1.2


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

* [PATCH 16/38] iio: magn: st: Append _magn to magnetometer sensor device names
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Some of ST's sensors are appended with their sensor type and some
are not. For consistency we're extending the same naming convention
throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/magnetometer/st_magn.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/magnetometer/st_magn.h b/drivers/iio/magnetometer/st_magn.h
index 694e33e..f185720 100644
--- a/drivers/iio/magnetometer/st_magn.h
+++ b/drivers/iio/magnetometer/st_magn.h
@@ -16,7 +16,7 @@
 
 #define LSM303DLHC_MAGN_DEV_NAME	"lsm303dlhc_magn"
 #define LSM303DLM_MAGN_DEV_NAME		"lsm303dlm_magn"
-#define LIS3MDL_MAGN_DEV_NAME		"lis3mdl"
+#define LIS3MDL_MAGN_DEV_NAME		"lis3mdl_magn"
 
 int st_magn_common_probe(struct iio_dev *indio_dev,
 					struct st_sensors_platform_data *pdata);
-- 
1.8.1.2

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

* [PATCH 17/38] iio: press: st: Append _press to pressure sensor device names
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Some of ST's sensors are appended with their sensor type and some
are not. For consistency we're extending the same naming convention
throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/pressure/st_pressure.h b/drivers/iio/pressure/st_pressure.h
index b0b6306..f1bebce 100644
--- a/drivers/iio/pressure/st_pressure.h
+++ b/drivers/iio/pressure/st_pressure.h
@@ -14,7 +14,7 @@
 #include <linux/types.h>
 #include <linux/iio/common/st_sensors.h>
 
-#define LPS331AP_PRESS_DEV_NAME		"lps331ap"
+#define LPS331AP_PRESS_DEV_NAME		"lps331ap_press"
 
 /**
  * struct st_sensors_platform_data - default press platform data
-- 
1.8.1.2


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

* [PATCH 17/38] iio: press: st: Append _press to pressure sensor device names
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Some of ST's sensors are appended with their sensor type and some
are not. For consistency we're extending the same naming convention
throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/pressure/st_pressure.h b/drivers/iio/pressure/st_pressure.h
index b0b6306..f1bebce 100644
--- a/drivers/iio/pressure/st_pressure.h
+++ b/drivers/iio/pressure/st_pressure.h
@@ -14,7 +14,7 @@
 #include <linux/types.h>
 #include <linux/iio/common/st_sensors.h>
 
-#define LPS331AP_PRESS_DEV_NAME		"lps331ap"
+#define LPS331AP_PRESS_DEV_NAME		"lps331ap_press"
 
 /**
  * struct st_sensors_platform_data - default press platform data
-- 
1.8.1.2

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

* [PATCH 18/38] iio: sensors-core: st: Allow full-scale to be an optional feature
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Some chips either don't support it or fail to provide adequate documentation,
so sometimes it's impossible to enable the feature even if it is supported.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/common/st_sensors/st_sensors_core.c | 11 +++++++----
 drivers/iio/pressure/st_pressure_core.c         |  6 ++++--
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 965ee22..eb261a5 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -235,10 +235,13 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
 	if (err < 0)
 		goto init_error;
 
-	err = st_sensors_set_fullscale(indio_dev,
-						sdata->current_fullscale->num);
-	if (err < 0)
-		goto init_error;
+	if (sdata->current_fullscale) {
+		err = st_sensors_set_fullscale(indio_dev,
+					       sdata->current_fullscale->num);
+		if (err < 0)
+			goto init_error;
+	} else
+		dev_info(&indio_dev->dev, "Full-scale not possible\n");
 
 	err = st_sensors_set_odr(indio_dev, sdata->odr);
 	if (err < 0)
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index ceebd3c..16cfbc5 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -226,8 +226,10 @@ int st_press_common_probe(struct iio_dev *indio_dev,
 	indio_dev->channels = pdata->sensor->ch;
 	indio_dev->num_channels = ARRAY_SIZE(st_press_channels);
 
-	pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
-						&pdata->sensor->fs.fs_avl[0];
+	if (pdata->sensor->fs.addr != 0)
+		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
+			&pdata->sensor->fs.fs_avl[0];
+
 	pdata->odr = pdata->sensor->odr.odr_avl[0].hz;
 
 	if (!plat_data)
-- 
1.8.1.2


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

* [PATCH 18/38] iio: sensors-core: st: Allow full-scale to be an optional feature
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Some chips either don't support it or fail to provide adequate documentation,
so sometimes it's impossible to enable the feature even if it is supported.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/common/st_sensors/st_sensors_core.c | 11 +++++++----
 drivers/iio/pressure/st_pressure_core.c         |  6 ++++--
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 965ee22..eb261a5 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -235,10 +235,13 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
 	if (err < 0)
 		goto init_error;
 
-	err = st_sensors_set_fullscale(indio_dev,
-						sdata->current_fullscale->num);
-	if (err < 0)
-		goto init_error;
+	if (sdata->current_fullscale) {
+		err = st_sensors_set_fullscale(indio_dev,
+					       sdata->current_fullscale->num);
+		if (err < 0)
+			goto init_error;
+	} else
+		dev_info(&indio_dev->dev, "Full-scale not possible\n");
 
 	err = st_sensors_set_odr(indio_dev, sdata->odr);
 	if (err < 0)
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index ceebd3c..16cfbc5 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -226,8 +226,10 @@ int st_press_common_probe(struct iio_dev *indio_dev,
 	indio_dev->channels = pdata->sensor->ch;
 	indio_dev->num_channels = ARRAY_SIZE(st_press_channels);
 
-	pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
-						&pdata->sensor->fs.fs_avl[0];
+	if (pdata->sensor->fs.addr != 0)
+		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
+			&pdata->sensor->fs.fs_avl[0];
+
 	pdata->odr = pdata->sensor->odr.odr_avl[0].hz;
 
 	if (!plat_data)
-- 
1.8.1.2

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

* [PATCH 19/38] iio: sensors-core: st: Support sensors which don't have a Data Ready pin
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Not all ST's sensors support data ready, so let's make the declaration
of one conditional.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/common/st_sensors/st_sensors_core.c | 24 +++++++++++++++++++-----
 drivers/iio/pressure/st_pressure_core.c         |  3 ++-
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index eb261a5..b86cad2 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -198,14 +198,11 @@ int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable)
 }
 EXPORT_SYMBOL(st_sensors_set_axis_enable);
 
-int st_sensors_init_sensor(struct iio_dev *indio_dev,
-					struct st_sensors_platform_data *pdata)
+int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
+				struct st_sensors_platform_data *pdata)
 {
-	int err;
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
 
-	mutex_init(&sdata->tb.buf_lock);
-
 	switch (pdata->drdy_int_pin) {
 	case 1:
 		if (sdata->sensor->drdy_irq.mask_int1 == 0) {
@@ -231,6 +228,20 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
 		goto init_error;
 	}
 
+	return 0;
+}
+
+int st_sensors_init_sensor(struct iio_dev *indio_dev,
+					struct st_sensors_platform_data *pdata)
+{
+	int err = 0;
+	struct st_sensor_data *sdata = iio_priv(indio_dev);
+
+	mutex_init(&sdata->tb.buf_lock);
+
+	if (pdata)
+		err = st_sensors_set_drdy_int_pin(indio_dev, pdata);
+
 	err = st_sensors_set_enable(indio_dev, false);
 	if (err < 0)
 		goto init_error;
@@ -266,6 +277,9 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)
 	u8 drdy_mask;
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
 
+	if (!sdata->sensor->drdy_irq.addr)
+		return 0;
+
 	/* Enable/Disable the interrupt generator 1. */
 	if (sdata->sensor->drdy_irq.ig1.en_addr > 0) {
 		err = st_sensors_write_data_with_mask(indio_dev,
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 16cfbc5..279aafd 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -232,7 +232,8 @@ int st_press_common_probe(struct iio_dev *indio_dev,
 
 	pdata->odr = pdata->sensor->odr.odr_avl[0].hz;
 
-	if (!plat_data)
+	/* Some devices don't support a data ready pin. */
+	if (!plat_data && pdata->sensor->drdy_irq.addr)
 		plat_data =
 			(struct st_sensors_platform_data *)&default_press_pdata;
 
-- 
1.8.1.2


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

* [PATCH 19/38] iio: sensors-core: st: Support sensors which don't have a Data Ready pin
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Not all ST's sensors support data ready, so let's make the declaration
of one conditional.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/common/st_sensors/st_sensors_core.c | 24 +++++++++++++++++++-----
 drivers/iio/pressure/st_pressure_core.c         |  3 ++-
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index eb261a5..b86cad2 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -198,14 +198,11 @@ int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable)
 }
 EXPORT_SYMBOL(st_sensors_set_axis_enable);
 
-int st_sensors_init_sensor(struct iio_dev *indio_dev,
-					struct st_sensors_platform_data *pdata)
+int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
+				struct st_sensors_platform_data *pdata)
 {
-	int err;
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
 
-	mutex_init(&sdata->tb.buf_lock);
-
 	switch (pdata->drdy_int_pin) {
 	case 1:
 		if (sdata->sensor->drdy_irq.mask_int1 == 0) {
@@ -231,6 +228,20 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
 		goto init_error;
 	}
 
+	return 0;
+}
+
+int st_sensors_init_sensor(struct iio_dev *indio_dev,
+					struct st_sensors_platform_data *pdata)
+{
+	int err = 0;
+	struct st_sensor_data *sdata = iio_priv(indio_dev);
+
+	mutex_init(&sdata->tb.buf_lock);
+
+	if (pdata)
+		err = st_sensors_set_drdy_int_pin(indio_dev, pdata);
+
 	err = st_sensors_set_enable(indio_dev, false);
 	if (err < 0)
 		goto init_error;
@@ -266,6 +277,9 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)
 	u8 drdy_mask;
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
 
+	if (!sdata->sensor->drdy_irq.addr)
+		return 0;
+
 	/* Enable/Disable the interrupt generator 1. */
 	if (sdata->sensor->drdy_irq.ig1.en_addr > 0) {
 		err = st_sensors_write_data_with_mask(indio_dev,
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 16cfbc5..279aafd 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -232,7 +232,8 @@ int st_press_common_probe(struct iio_dev *indio_dev,
 
 	pdata->odr = pdata->sensor->odr.odr_avl[0].hz;
 
-	if (!plat_data)
+	/* Some devices don't support a data ready pin. */
+	if (!plat_data && pdata->sensor->drdy_irq.addr)
 		plat_data =
 			(struct st_sensors_platform_data *)&default_press_pdata;
 
-- 
1.8.1.2

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

* [PATCH 20/38] iio: sensors-core: st: Clean-up error handling in st_sensors_init_sensor()
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Strip out all those unnecessary gotos and just return the error right away.

Aids to simplicity and reduces code.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/common/st_sensors/st_sensors_core.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index b86cad2..8c4c54c 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -208,8 +208,7 @@ int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
 		if (sdata->sensor->drdy_irq.mask_int1 == 0) {
 			dev_err(&indio_dev->dev,
 					"DRDY on INT1 not available.\n");
-			err = -EINVAL;
-			goto init_error;
+			return -EINVAL;
 		}
 		sdata->drdy_int_pin = 1;
 		break;
@@ -217,15 +216,13 @@ int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
 		if (sdata->sensor->drdy_irq.mask_int2 == 0) {
 			dev_err(&indio_dev->dev,
 					"DRDY on INT2 not available.\n");
-			err = -EINVAL;
-			goto init_error;
+			return -EINVAL;
 		}
 		sdata->drdy_int_pin = 2;
 		break;
 	default:
 		dev_err(&indio_dev->dev, "DRDY on pdata not valid.\n");
-		err = -EINVAL;
-		goto init_error;
+		return -EINVAL;
 	}
 
 	return 0;
@@ -244,29 +241,28 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
 
 	err = st_sensors_set_enable(indio_dev, false);
 	if (err < 0)
-		goto init_error;
+		return err;
 
 	if (sdata->current_fullscale) {
 		err = st_sensors_set_fullscale(indio_dev,
 					       sdata->current_fullscale->num);
 		if (err < 0)
-			goto init_error;
+			return err;
 	} else
 		dev_info(&indio_dev->dev, "Full-scale not possible\n");
 
 	err = st_sensors_set_odr(indio_dev, sdata->odr);
 	if (err < 0)
-		goto init_error;
+		return err;
 
 	/* set BDU */
 	err = st_sensors_write_data_with_mask(indio_dev,
 			sdata->sensor->bdu.addr, sdata->sensor->bdu.mask, true);
 	if (err < 0)
-		goto init_error;
+		return err;
 
 	err = st_sensors_set_axis_enable(indio_dev, ST_SENSORS_ENABLE_ALL_AXIS);
 
-init_error:
 	return err;
 }
 EXPORT_SYMBOL(st_sensors_init_sensor);
-- 
1.8.1.2


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

* [PATCH 20/38] iio: sensors-core: st: Clean-up error handling in st_sensors_init_sensor()
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Strip out all those unnecessary gotos and just return the error right away.

Aids to simplicity and reduces code.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/common/st_sensors/st_sensors_core.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index b86cad2..8c4c54c 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -208,8 +208,7 @@ int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
 		if (sdata->sensor->drdy_irq.mask_int1 == 0) {
 			dev_err(&indio_dev->dev,
 					"DRDY on INT1 not available.\n");
-			err = -EINVAL;
-			goto init_error;
+			return -EINVAL;
 		}
 		sdata->drdy_int_pin = 1;
 		break;
@@ -217,15 +216,13 @@ int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
 		if (sdata->sensor->drdy_irq.mask_int2 == 0) {
 			dev_err(&indio_dev->dev,
 					"DRDY on INT2 not available.\n");
-			err = -EINVAL;
-			goto init_error;
+			return -EINVAL;
 		}
 		sdata->drdy_int_pin = 2;
 		break;
 	default:
 		dev_err(&indio_dev->dev, "DRDY on pdata not valid.\n");
-		err = -EINVAL;
-		goto init_error;
+		return -EINVAL;
 	}
 
 	return 0;
@@ -244,29 +241,28 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
 
 	err = st_sensors_set_enable(indio_dev, false);
 	if (err < 0)
-		goto init_error;
+		return err;
 
 	if (sdata->current_fullscale) {
 		err = st_sensors_set_fullscale(indio_dev,
 					       sdata->current_fullscale->num);
 		if (err < 0)
-			goto init_error;
+			return err;
 	} else
 		dev_info(&indio_dev->dev, "Full-scale not possible\n");
 
 	err = st_sensors_set_odr(indio_dev, sdata->odr);
 	if (err < 0)
-		goto init_error;
+		return err;
 
 	/* set BDU */
 	err = st_sensors_write_data_with_mask(indio_dev,
 			sdata->sensor->bdu.addr, sdata->sensor->bdu.mask, true);
 	if (err < 0)
-		goto init_error;
+		return err;
 
 	err = st_sensors_set_axis_enable(indio_dev, ST_SENSORS_ENABLE_ALL_AXIS);
 
-init_error:
 	return err;
 }
 EXPORT_SYMBOL(st_sensors_init_sensor);
-- 
1.8.1.2

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

* [PATCH 21/38] iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data()
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Gets rid of those unnecessary gotos.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/common/st_sensors/st_sensors_core.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 8c4c54c..148f0e5 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -331,26 +331,23 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev,
 	unsigned int byte_for_channel = ch->scan_type.storagebits >> 3;
 
 	outdata = kmalloc(byte_for_channel, GFP_KERNEL);
-	if (!outdata) {
-		err = -EINVAL;
-		goto st_sensors_read_axis_data_error;
-	}
+	if (!outdata)
+		return -ENOMEM;
 
 	err = sdata->tf->read_multiple_byte(&sdata->tb, sdata->dev,
 				ch->address, byte_for_channel,
 				outdata, sdata->multiread_bit);
-	if (err < 0)
-		goto st_sensors_free_memory;
+	if (err < 0) {
+		kfree(outdata);
+		return err;
+	}
 
 	if (byte_for_channel == 2)
 		*data = (s16)get_unaligned_le16(outdata);
 	else if (byte_for_channel == 3)
 		*data = (s32)st_sensors_get_unaligned_le24(outdata);
 
-st_sensors_free_memory:
-	kfree(outdata);
-st_sensors_read_axis_data_error:
-	return err;
+	return 0;
 }
 
 int st_sensors_read_info_raw(struct iio_dev *indio_dev,
-- 
1.8.1.2


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

* [PATCH 21/38] iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data()
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Gets rid of those unnecessary gotos.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/common/st_sensors/st_sensors_core.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 8c4c54c..148f0e5 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -331,26 +331,23 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev,
 	unsigned int byte_for_channel = ch->scan_type.storagebits >> 3;
 
 	outdata = kmalloc(byte_for_channel, GFP_KERNEL);
-	if (!outdata) {
-		err = -EINVAL;
-		goto st_sensors_read_axis_data_error;
-	}
+	if (!outdata)
+		return -ENOMEM;
 
 	err = sdata->tf->read_multiple_byte(&sdata->tb, sdata->dev,
 				ch->address, byte_for_channel,
 				outdata, sdata->multiread_bit);
-	if (err < 0)
-		goto st_sensors_free_memory;
+	if (err < 0) {
+		kfree(outdata);
+		return err;
+	}
 
 	if (byte_for_channel == 2)
 		*data = (s16)get_unaligned_le16(outdata);
 	else if (byte_for_channel == 3)
 		*data = (s32)st_sensors_get_unaligned_le24(outdata);
 
-st_sensors_free_memory:
-	kfree(outdata);
-st_sensors_read_axis_data_error:
-	return err;
+	return 0;
 }
 
 int st_sensors_read_info_raw(struct iio_dev *indio_dev,
-- 
1.8.1.2

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

* [PATCH 22/38] iio: sensors-core: st: Clean-up error handling in st_sensors_read_info_raw()
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Saving a few lines of code.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/common/st_sensors/st_sensors_core.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 148f0e5..25d4c7e 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -359,28 +359,25 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev,
 	mutex_lock(&indio_dev->mlock);
 	if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) {
 		err = -EBUSY;
-		goto read_error;
+		goto out;
 	} else {
 		err = st_sensors_set_enable(indio_dev, true);
 		if (err < 0)
-			goto read_error;
+			goto out;
 
 		msleep((sdata->sensor->bootime * 1000) / sdata->odr);
 		err = st_sensors_read_axis_data(indio_dev, ch, val);
 		if (err < 0)
-			goto read_error;
+			goto out;
 
 		*val = *val >> ch->scan_type.shift;
 
 		err = st_sensors_set_enable(indio_dev, false);
 	}
+out:
 	mutex_unlock(&indio_dev->mlock);
 
 	return err;
-
-read_error:
-	mutex_unlock(&indio_dev->mlock);
-	return err;
 }
 EXPORT_SYMBOL(st_sensors_read_info_raw);
 
-- 
1.8.1.2


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

* [PATCH 22/38] iio: sensors-core: st: Clean-up error handling in st_sensors_read_info_raw()
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Saving a few lines of code.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/common/st_sensors/st_sensors_core.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 148f0e5..25d4c7e 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -359,28 +359,25 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev,
 	mutex_lock(&indio_dev->mlock);
 	if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) {
 		err = -EBUSY;
-		goto read_error;
+		goto out;
 	} else {
 		err = st_sensors_set_enable(indio_dev, true);
 		if (err < 0)
-			goto read_error;
+			goto out;
 
 		msleep((sdata->sensor->bootime * 1000) / sdata->odr);
 		err = st_sensors_read_axis_data(indio_dev, ch, val);
 		if (err < 0)
-			goto read_error;
+			goto out;
 
 		*val = *val >> ch->scan_type.shift;
 
 		err = st_sensors_set_enable(indio_dev, false);
 	}
+out:
 	mutex_unlock(&indio_dev->mlock);
 
 	return err;
-
-read_error:
-	mutex_unlock(&indio_dev->mlock);
-	return err;
 }
 EXPORT_SYMBOL(st_sensors_read_info_raw);
 
-- 
1.8.1.2

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

* [PATCH 23/38] iio: pressure-core: st: Describe LPS331AP defines by name
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

They're currently named *_1_*, for 'Sensor 1', but the code will be much
more readable if we use the naming convention *_LPS331AP_* instead.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure_core.c | 94 ++++++++++++++++-----------------
 1 file changed, 46 insertions(+), 48 deletions(-)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 279aafd..2ee4bcd 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -36,94 +36,92 @@
 						 ST_PRESS_LSB_PER_CELSIUS)
 #define ST_PRESS_NUMBER_DATA_CHANNELS		1
 
-/* DEFAULT VALUE FOR SENSORS */
-#define ST_PRESS_DEFAULT_OUT_XL_ADDR		0x28
-#define ST_TEMP_DEFAULT_OUT_L_ADDR		0x2b
-
 /* FULLSCALE */
 #define ST_PRESS_FS_AVL_1260MB			1260
 
-/* CUSTOM VALUES FOR SENSOR 1 */
-#define ST_PRESS_1_WAI_EXP			0xbb
-#define ST_PRESS_1_ODR_ADDR			0x20
-#define ST_PRESS_1_ODR_MASK			0x70
-#define ST_PRESS_1_ODR_AVL_1HZ_VAL		0x01
-#define ST_PRESS_1_ODR_AVL_7HZ_VAL		0x05
-#define ST_PRESS_1_ODR_AVL_13HZ_VAL		0x06
-#define ST_PRESS_1_ODR_AVL_25HZ_VAL		0x07
-#define ST_PRESS_1_PW_ADDR			0x20
-#define ST_PRESS_1_PW_MASK			0x80
-#define ST_PRESS_1_FS_ADDR			0x23
-#define ST_PRESS_1_FS_MASK			0x30
-#define ST_PRESS_1_FS_AVL_1260_VAL		0x00
-#define ST_PRESS_1_FS_AVL_1260_GAIN		ST_PRESS_KPASCAL_NANO_SCALE
-#define ST_PRESS_1_FS_AVL_TEMP_GAIN		ST_PRESS_CELSIUS_NANO_SCALE
-#define ST_PRESS_1_BDU_ADDR			0x20
-#define ST_PRESS_1_BDU_MASK			0x04
-#define ST_PRESS_1_DRDY_IRQ_ADDR		0x22
-#define ST_PRESS_1_DRDY_IRQ_INT1_MASK		0x04
-#define ST_PRESS_1_DRDY_IRQ_INT2_MASK		0x20
-#define ST_PRESS_1_MULTIREAD_BIT		true
-#define ST_PRESS_1_TEMP_OFFSET			42500
+/* CUSTOM VALUES FOR LPS331AP SENSOR */
+#define ST_PRESS_LPS331AP_WAI_EXP		0xbb
+#define ST_PRESS_LPS331AP_ODR_ADDR		0x20
+#define ST_PRESS_LPS331AP_ODR_MASK		0x70
+#define ST_PRESS_LPS331AP_ODR_AVL_1HZ_VAL	0x01
+#define ST_PRESS_LPS331AP_ODR_AVL_7HZ_VAL	0x05
+#define ST_PRESS_LPS331AP_ODR_AVL_13HZ_VAL	0x06
+#define ST_PRESS_LPS331AP_ODR_AVL_25HZ_VAL	0x07
+#define ST_PRESS_LPS331AP_PW_ADDR		0x20
+#define ST_PRESS_LPS331AP_PW_MASK		0x80
+#define ST_PRESS_LPS331AP_FS_ADDR		0x23
+#define ST_PRESS_LPS331AP_FS_MASK		0x30
+#define ST_PRESS_LPS331AP_FS_AVL_1260_VAL	0x00
+#define ST_PRESS_LPS331AP_FS_AVL_1260_GAIN	ST_PRESS_KPASCAL_NANO_SCALE
+#define ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN	ST_PRESS_CELSIUS_NANO_SCALE
+#define ST_PRESS_LPS331AP_BDU_ADDR		0x20
+#define ST_PRESS_LPS331AP_BDU_MASK		0x04
+#define ST_PRESS_LPS331AP_DRDY_IRQ_ADDR		0x22
+#define ST_PRESS_LPS331AP_DRDY_IRQ_INT1_MASK	0x04
+#define ST_PRESS_LPS331AP_DRDY_IRQ_INT2_MASK	0x20
+#define ST_PRESS_LPS331AP_MULTIREAD_BIT		true
+#define ST_PRESS_LPS331AP_TEMP_OFFSET		42500
+#define ST_PRESS_LPS331AP_OUT_XL_ADDR		0x28
+#define ST_TEMP_LPS331AP_OUT_L_ADDR		0x2b
 
 static const struct iio_chan_spec st_press_channels[] = {
 	ST_SENSORS_LSM_CHANNELS(IIO_PRESSURE,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_X, 0, IIO_NO_MOD, 'u', IIO_LE, 24, 24,
-			ST_PRESS_DEFAULT_OUT_XL_ADDR),
+			ST_PRESS_LPS331AP_OUT_XL_ADDR),
 	ST_SENSORS_LSM_CHANNELS(IIO_TEMP,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) |
 						BIT(IIO_CHAN_INFO_OFFSET),
 			-1, 0, IIO_NO_MOD, 's', IIO_LE, 16, 16,
-			ST_TEMP_DEFAULT_OUT_L_ADDR),
+			ST_TEMP_LPS331AP_OUT_L_ADDR),
 	IIO_CHAN_SOFT_TIMESTAMP(1)
 };
 
 static const struct st_sensors st_press_sensors[] = {
 	{
-		.wai = ST_PRESS_1_WAI_EXP,
+		.wai = ST_PRESS_LPS331AP_WAI_EXP,
 		.sensors_supported = {
 			[0] = LPS331AP_PRESS_DEV_NAME,
 		},
 		.ch = (struct iio_chan_spec *)st_press_channels,
 		.odr = {
-			.addr = ST_PRESS_1_ODR_ADDR,
-			.mask = ST_PRESS_1_ODR_MASK,
+			.addr = ST_PRESS_LPS331AP_ODR_ADDR,
+			.mask = ST_PRESS_LPS331AP_ODR_MASK,
 			.odr_avl = {
-				{ 1, ST_PRESS_1_ODR_AVL_1HZ_VAL, },
-				{ 7, ST_PRESS_1_ODR_AVL_7HZ_VAL, },
-				{ 13, ST_PRESS_1_ODR_AVL_13HZ_VAL, },
-				{ 25, ST_PRESS_1_ODR_AVL_25HZ_VAL, },
+				{ 1, ST_PRESS_LPS331AP_ODR_AVL_1HZ_VAL, },
+				{ 7, ST_PRESS_LPS331AP_ODR_AVL_7HZ_VAL, },
+				{ 13, ST_PRESS_LPS331AP_ODR_AVL_13HZ_VAL, },
+				{ 25, ST_PRESS_LPS331AP_ODR_AVL_25HZ_VAL, },
 			},
 		},
 		.pw = {
-			.addr = ST_PRESS_1_PW_ADDR,
-			.mask = ST_PRESS_1_PW_MASK,
+			.addr = ST_PRESS_LPS331AP_PW_ADDR,
+			.mask = ST_PRESS_LPS331AP_PW_MASK,
 			.value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE,
 			.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
 		},
 		.fs = {
-			.addr = ST_PRESS_1_FS_ADDR,
-			.mask = ST_PRESS_1_FS_MASK,
+			.addr = ST_PRESS_LPS331AP_FS_ADDR,
+			.mask = ST_PRESS_LPS331AP_FS_MASK,
 			.fs_avl = {
 				[0] = {
 					.num = ST_PRESS_FS_AVL_1260MB,
-					.value = ST_PRESS_1_FS_AVL_1260_VAL,
-					.gain = ST_PRESS_1_FS_AVL_1260_GAIN,
-					.gain2 = ST_PRESS_1_FS_AVL_TEMP_GAIN,
+					.value = ST_PRESS_LPS331AP_FS_AVL_1260_VAL,
+					.gain = ST_PRESS_LPS331AP_FS_AVL_1260_GAIN,
+					.gain2 = ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN,
 				},
 			},
 		},
 		.bdu = {
-			.addr = ST_PRESS_1_BDU_ADDR,
-			.mask = ST_PRESS_1_BDU_MASK,
+			.addr = ST_PRESS_LPS331AP_BDU_ADDR,
+			.mask = ST_PRESS_LPS331AP_BDU_MASK,
 		},
 		.drdy_irq = {
-			.addr = ST_PRESS_1_DRDY_IRQ_ADDR,
-			.mask_int1 = ST_PRESS_1_DRDY_IRQ_INT1_MASK,
-			.mask_int2 = ST_PRESS_1_DRDY_IRQ_INT2_MASK,
+			.addr = ST_PRESS_LPS331AP_DRDY_IRQ_ADDR,
+			.mask_int1 = ST_PRESS_LPS331AP_DRDY_IRQ_INT1_MASK,
+			.mask_int2 = ST_PRESS_LPS331AP_DRDY_IRQ_INT2_MASK,
 		},
-		.multi_read_bit = ST_PRESS_1_MULTIREAD_BIT,
+		.multi_read_bit = ST_PRESS_LPS331AP_MULTIREAD_BIT,
 		.bootime = 2,
 	},
 };
-- 
1.8.1.2


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

* [PATCH 23/38] iio: pressure-core: st: Describe LPS331AP defines by name
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

They're currently named *_1_*, for 'Sensor 1', but the code will be much
more readable if we use the naming convention *_LPS331AP_* instead.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure_core.c | 94 ++++++++++++++++-----------------
 1 file changed, 46 insertions(+), 48 deletions(-)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 279aafd..2ee4bcd 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -36,94 +36,92 @@
 						 ST_PRESS_LSB_PER_CELSIUS)
 #define ST_PRESS_NUMBER_DATA_CHANNELS		1
 
-/* DEFAULT VALUE FOR SENSORS */
-#define ST_PRESS_DEFAULT_OUT_XL_ADDR		0x28
-#define ST_TEMP_DEFAULT_OUT_L_ADDR		0x2b
-
 /* FULLSCALE */
 #define ST_PRESS_FS_AVL_1260MB			1260
 
-/* CUSTOM VALUES FOR SENSOR 1 */
-#define ST_PRESS_1_WAI_EXP			0xbb
-#define ST_PRESS_1_ODR_ADDR			0x20
-#define ST_PRESS_1_ODR_MASK			0x70
-#define ST_PRESS_1_ODR_AVL_1HZ_VAL		0x01
-#define ST_PRESS_1_ODR_AVL_7HZ_VAL		0x05
-#define ST_PRESS_1_ODR_AVL_13HZ_VAL		0x06
-#define ST_PRESS_1_ODR_AVL_25HZ_VAL		0x07
-#define ST_PRESS_1_PW_ADDR			0x20
-#define ST_PRESS_1_PW_MASK			0x80
-#define ST_PRESS_1_FS_ADDR			0x23
-#define ST_PRESS_1_FS_MASK			0x30
-#define ST_PRESS_1_FS_AVL_1260_VAL		0x00
-#define ST_PRESS_1_FS_AVL_1260_GAIN		ST_PRESS_KPASCAL_NANO_SCALE
-#define ST_PRESS_1_FS_AVL_TEMP_GAIN		ST_PRESS_CELSIUS_NANO_SCALE
-#define ST_PRESS_1_BDU_ADDR			0x20
-#define ST_PRESS_1_BDU_MASK			0x04
-#define ST_PRESS_1_DRDY_IRQ_ADDR		0x22
-#define ST_PRESS_1_DRDY_IRQ_INT1_MASK		0x04
-#define ST_PRESS_1_DRDY_IRQ_INT2_MASK		0x20
-#define ST_PRESS_1_MULTIREAD_BIT		true
-#define ST_PRESS_1_TEMP_OFFSET			42500
+/* CUSTOM VALUES FOR LPS331AP SENSOR */
+#define ST_PRESS_LPS331AP_WAI_EXP		0xbb
+#define ST_PRESS_LPS331AP_ODR_ADDR		0x20
+#define ST_PRESS_LPS331AP_ODR_MASK		0x70
+#define ST_PRESS_LPS331AP_ODR_AVL_1HZ_VAL	0x01
+#define ST_PRESS_LPS331AP_ODR_AVL_7HZ_VAL	0x05
+#define ST_PRESS_LPS331AP_ODR_AVL_13HZ_VAL	0x06
+#define ST_PRESS_LPS331AP_ODR_AVL_25HZ_VAL	0x07
+#define ST_PRESS_LPS331AP_PW_ADDR		0x20
+#define ST_PRESS_LPS331AP_PW_MASK		0x80
+#define ST_PRESS_LPS331AP_FS_ADDR		0x23
+#define ST_PRESS_LPS331AP_FS_MASK		0x30
+#define ST_PRESS_LPS331AP_FS_AVL_1260_VAL	0x00
+#define ST_PRESS_LPS331AP_FS_AVL_1260_GAIN	ST_PRESS_KPASCAL_NANO_SCALE
+#define ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN	ST_PRESS_CELSIUS_NANO_SCALE
+#define ST_PRESS_LPS331AP_BDU_ADDR		0x20
+#define ST_PRESS_LPS331AP_BDU_MASK		0x04
+#define ST_PRESS_LPS331AP_DRDY_IRQ_ADDR		0x22
+#define ST_PRESS_LPS331AP_DRDY_IRQ_INT1_MASK	0x04
+#define ST_PRESS_LPS331AP_DRDY_IRQ_INT2_MASK	0x20
+#define ST_PRESS_LPS331AP_MULTIREAD_BIT		true
+#define ST_PRESS_LPS331AP_TEMP_OFFSET		42500
+#define ST_PRESS_LPS331AP_OUT_XL_ADDR		0x28
+#define ST_TEMP_LPS331AP_OUT_L_ADDR		0x2b
 
 static const struct iio_chan_spec st_press_channels[] = {
 	ST_SENSORS_LSM_CHANNELS(IIO_PRESSURE,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_X, 0, IIO_NO_MOD, 'u', IIO_LE, 24, 24,
-			ST_PRESS_DEFAULT_OUT_XL_ADDR),
+			ST_PRESS_LPS331AP_OUT_XL_ADDR),
 	ST_SENSORS_LSM_CHANNELS(IIO_TEMP,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) |
 						BIT(IIO_CHAN_INFO_OFFSET),
 			-1, 0, IIO_NO_MOD, 's', IIO_LE, 16, 16,
-			ST_TEMP_DEFAULT_OUT_L_ADDR),
+			ST_TEMP_LPS331AP_OUT_L_ADDR),
 	IIO_CHAN_SOFT_TIMESTAMP(1)
 };
 
 static const struct st_sensors st_press_sensors[] = {
 	{
-		.wai = ST_PRESS_1_WAI_EXP,
+		.wai = ST_PRESS_LPS331AP_WAI_EXP,
 		.sensors_supported = {
 			[0] = LPS331AP_PRESS_DEV_NAME,
 		},
 		.ch = (struct iio_chan_spec *)st_press_channels,
 		.odr = {
-			.addr = ST_PRESS_1_ODR_ADDR,
-			.mask = ST_PRESS_1_ODR_MASK,
+			.addr = ST_PRESS_LPS331AP_ODR_ADDR,
+			.mask = ST_PRESS_LPS331AP_ODR_MASK,
 			.odr_avl = {
-				{ 1, ST_PRESS_1_ODR_AVL_1HZ_VAL, },
-				{ 7, ST_PRESS_1_ODR_AVL_7HZ_VAL, },
-				{ 13, ST_PRESS_1_ODR_AVL_13HZ_VAL, },
-				{ 25, ST_PRESS_1_ODR_AVL_25HZ_VAL, },
+				{ 1, ST_PRESS_LPS331AP_ODR_AVL_1HZ_VAL, },
+				{ 7, ST_PRESS_LPS331AP_ODR_AVL_7HZ_VAL, },
+				{ 13, ST_PRESS_LPS331AP_ODR_AVL_13HZ_VAL, },
+				{ 25, ST_PRESS_LPS331AP_ODR_AVL_25HZ_VAL, },
 			},
 		},
 		.pw = {
-			.addr = ST_PRESS_1_PW_ADDR,
-			.mask = ST_PRESS_1_PW_MASK,
+			.addr = ST_PRESS_LPS331AP_PW_ADDR,
+			.mask = ST_PRESS_LPS331AP_PW_MASK,
 			.value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE,
 			.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
 		},
 		.fs = {
-			.addr = ST_PRESS_1_FS_ADDR,
-			.mask = ST_PRESS_1_FS_MASK,
+			.addr = ST_PRESS_LPS331AP_FS_ADDR,
+			.mask = ST_PRESS_LPS331AP_FS_MASK,
 			.fs_avl = {
 				[0] = {
 					.num = ST_PRESS_FS_AVL_1260MB,
-					.value = ST_PRESS_1_FS_AVL_1260_VAL,
-					.gain = ST_PRESS_1_FS_AVL_1260_GAIN,
-					.gain2 = ST_PRESS_1_FS_AVL_TEMP_GAIN,
+					.value = ST_PRESS_LPS331AP_FS_AVL_1260_VAL,
+					.gain = ST_PRESS_LPS331AP_FS_AVL_1260_GAIN,
+					.gain2 = ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN,
 				},
 			},
 		},
 		.bdu = {
-			.addr = ST_PRESS_1_BDU_ADDR,
-			.mask = ST_PRESS_1_BDU_MASK,
+			.addr = ST_PRESS_LPS331AP_BDU_ADDR,
+			.mask = ST_PRESS_LPS331AP_BDU_MASK,
 		},
 		.drdy_irq = {
-			.addr = ST_PRESS_1_DRDY_IRQ_ADDR,
-			.mask_int1 = ST_PRESS_1_DRDY_IRQ_INT1_MASK,
-			.mask_int2 = ST_PRESS_1_DRDY_IRQ_INT2_MASK,
+			.addr = ST_PRESS_LPS331AP_DRDY_IRQ_ADDR,
+			.mask_int1 = ST_PRESS_LPS331AP_DRDY_IRQ_INT1_MASK,
+			.mask_int2 = ST_PRESS_LPS331AP_DRDY_IRQ_INT2_MASK,
 		},
-		.multi_read_bit = ST_PRESS_1_MULTIREAD_BIT,
+		.multi_read_bit = ST_PRESS_LPS331AP_MULTIREAD_BIT,
 		.bootime = 2,
 	},
 };
-- 
1.8.1.2

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

* [PATCH 24/38] iio: pressure-core: st: Expand and rename LPS331AP's channel descriptor
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Due to the MACRO used, the task of reading, understanding and maintaining
the LPS331AP's channel descriptor is substantially difficult. This patch
is based on the view that it's better to have easy to read, maintainable
code than to save a few lines here and there. For that reason we're
expanding the array so initialisation is completed in full.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure_core.c | 45 +++++++++++++++++++++++++--------
 1 file changed, 34 insertions(+), 11 deletions(-)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 2ee4bcd..60c2ee4 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -64,16 +64,39 @@
 #define ST_PRESS_LPS331AP_OUT_XL_ADDR		0x28
 #define ST_TEMP_LPS331AP_OUT_L_ADDR		0x2b
 
-static const struct iio_chan_spec st_press_channels[] = {
-	ST_SENSORS_LSM_CHANNELS(IIO_PRESSURE,
+static const struct iio_chan_spec st_press_lps331ap_channels[] = {
+	{
+		.type = IIO_PRESSURE,
+		.channel2 = IIO_NO_MOD,
+		.address = ST_PRESS_LPS331AP_OUT_XL_ADDR,
+		.scan_index = ST_SENSORS_SCAN_X,
+		.scan_type = {
+			.sign = 'u',
+			.realbits = 24,
+			.storagebits = 24,
+			.endianness = IIO_LE,
+		},
+		.info_mask_separate =
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
-			ST_SENSORS_SCAN_X, 0, IIO_NO_MOD, 'u', IIO_LE, 24, 24,
-			ST_PRESS_LPS331AP_OUT_XL_ADDR),
-	ST_SENSORS_LSM_CHANNELS(IIO_TEMP,
-			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) |
-						BIT(IIO_CHAN_INFO_OFFSET),
-			-1, 0, IIO_NO_MOD, 's', IIO_LE, 16, 16,
-			ST_TEMP_LPS331AP_OUT_L_ADDR),
+		.modified = 0,
+	},
+	{
+		.type = IIO_TEMP,
+		.channel2 = IIO_NO_MOD,
+		.address = ST_TEMP_LPS331AP_OUT_L_ADDR,
+		.scan_index = -1,
+		.scan_type = {
+			.sign = 'u',
+			.realbits = 16,
+			.storagebits = 16,
+			.endianness = IIO_LE,
+		},
+		.info_mask_separate =
+			BIT(IIO_CHAN_INFO_RAW) |
+			BIT(IIO_CHAN_INFO_SCALE) |
+			BIT(IIO_CHAN_INFO_OFFSET),
+		.modified = 0,
+	},
 	IIO_CHAN_SOFT_TIMESTAMP(1)
 };
 
@@ -83,7 +106,7 @@ static const struct st_sensors st_press_sensors[] = {
 		.sensors_supported = {
 			[0] = LPS331AP_PRESS_DEV_NAME,
 		},
-		.ch = (struct iio_chan_spec *)st_press_channels,
+		.ch = (struct iio_chan_spec *)st_press_lps331ap_channels,
 		.odr = {
 			.addr = ST_PRESS_LPS331AP_ODR_ADDR,
 			.mask = ST_PRESS_LPS331AP_ODR_MASK,
@@ -222,7 +245,7 @@ int st_press_common_probe(struct iio_dev *indio_dev,
 	pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS;
 	pdata->multiread_bit = pdata->sensor->multi_read_bit;
 	indio_dev->channels = pdata->sensor->ch;
-	indio_dev->num_channels = ARRAY_SIZE(st_press_channels);
+	indio_dev->num_channels = ARRAY_SIZE(st_press_lps331ap_channels);
 
 	if (pdata->sensor->fs.addr != 0)
 		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
-- 
1.8.1.2


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

* [PATCH 24/38] iio: pressure-core: st: Expand and rename LPS331AP's channel descriptor
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Due to the MACRO used, the task of reading, understanding and maintaining
the LPS331AP's channel descriptor is substantially difficult. This patch
is based on the view that it's better to have easy to read, maintainable
code than to save a few lines here and there. For that reason we're
expanding the array so initialisation is completed in full.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure_core.c | 45 +++++++++++++++++++++++++--------
 1 file changed, 34 insertions(+), 11 deletions(-)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 2ee4bcd..60c2ee4 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -64,16 +64,39 @@
 #define ST_PRESS_LPS331AP_OUT_XL_ADDR		0x28
 #define ST_TEMP_LPS331AP_OUT_L_ADDR		0x2b
 
-static const struct iio_chan_spec st_press_channels[] = {
-	ST_SENSORS_LSM_CHANNELS(IIO_PRESSURE,
+static const struct iio_chan_spec st_press_lps331ap_channels[] = {
+	{
+		.type = IIO_PRESSURE,
+		.channel2 = IIO_NO_MOD,
+		.address = ST_PRESS_LPS331AP_OUT_XL_ADDR,
+		.scan_index = ST_SENSORS_SCAN_X,
+		.scan_type = {
+			.sign = 'u',
+			.realbits = 24,
+			.storagebits = 24,
+			.endianness = IIO_LE,
+		},
+		.info_mask_separate =
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
-			ST_SENSORS_SCAN_X, 0, IIO_NO_MOD, 'u', IIO_LE, 24, 24,
-			ST_PRESS_LPS331AP_OUT_XL_ADDR),
-	ST_SENSORS_LSM_CHANNELS(IIO_TEMP,
-			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) |
-						BIT(IIO_CHAN_INFO_OFFSET),
-			-1, 0, IIO_NO_MOD, 's', IIO_LE, 16, 16,
-			ST_TEMP_LPS331AP_OUT_L_ADDR),
+		.modified = 0,
+	},
+	{
+		.type = IIO_TEMP,
+		.channel2 = IIO_NO_MOD,
+		.address = ST_TEMP_LPS331AP_OUT_L_ADDR,
+		.scan_index = -1,
+		.scan_type = {
+			.sign = 'u',
+			.realbits = 16,
+			.storagebits = 16,
+			.endianness = IIO_LE,
+		},
+		.info_mask_separate =
+			BIT(IIO_CHAN_INFO_RAW) |
+			BIT(IIO_CHAN_INFO_SCALE) |
+			BIT(IIO_CHAN_INFO_OFFSET),
+		.modified = 0,
+	},
 	IIO_CHAN_SOFT_TIMESTAMP(1)
 };
 
@@ -83,7 +106,7 @@ static const struct st_sensors st_press_sensors[] = {
 		.sensors_supported = {
 			[0] = LPS331AP_PRESS_DEV_NAME,
 		},
-		.ch = (struct iio_chan_spec *)st_press_channels,
+		.ch = (struct iio_chan_spec *)st_press_lps331ap_channels,
 		.odr = {
 			.addr = ST_PRESS_LPS331AP_ODR_ADDR,
 			.mask = ST_PRESS_LPS331AP_ODR_MASK,
@@ -222,7 +245,7 @@ int st_press_common_probe(struct iio_dev *indio_dev,
 	pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS;
 	pdata->multiread_bit = pdata->sensor->multi_read_bit;
 	indio_dev->channels = pdata->sensor->ch;
-	indio_dev->num_channels = ARRAY_SIZE(st_press_channels);
+	indio_dev->num_channels = ARRAY_SIZE(st_press_lps331ap_channels);
 
 	if (pdata->sensor->fs.addr != 0)
 		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
-- 
1.8.1.2

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

* [PATCH 25/38] iio: pressure-core: st: Allow for number of channels to vary
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

At the moment the number of channels specified is dictated by the first
sensor supported by the driver. As we add support for more sensors this
is likely to vary. Instead of using the ARRAY_SIZE() of the LPS331AP's
channel specifier we'll use a new adaptable 'struct st_sensors' element
instead.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure_core.c | 3 ++-
 include/linux/iio/common/st_sensors.h   | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 60c2ee4..3abada2 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -107,6 +107,7 @@ static const struct st_sensors st_press_sensors[] = {
 			[0] = LPS331AP_PRESS_DEV_NAME,
 		},
 		.ch = (struct iio_chan_spec *)st_press_lps331ap_channels,
+		.num_ch = ARRAY_SIZE(st_press_lps331ap_channels),
 		.odr = {
 			.addr = ST_PRESS_LPS331AP_ODR_ADDR,
 			.mask = ST_PRESS_LPS331AP_ODR_MASK,
@@ -245,7 +246,7 @@ int st_press_common_probe(struct iio_dev *indio_dev,
 	pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS;
 	pdata->multiread_bit = pdata->sensor->multi_read_bit;
 	indio_dev->channels = pdata->sensor->ch;
-	indio_dev->num_channels = ARRAY_SIZE(st_press_lps331ap_channels);
+	indio_dev->num_channels = pdata->sensor->num_ch;
 
 	if (pdata->sensor->fs.addr != 0)
 		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index e51f654..e732fda 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -184,6 +184,7 @@ struct st_sensors {
 	u8 wai;
 	char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME];
 	struct iio_chan_spec *ch;
+	int num_ch;
 	struct st_sensor_odr odr;
 	struct st_sensor_power pw;
 	struct st_sensor_axis enable_axis;
-- 
1.8.1.2


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

* [PATCH 25/38] iio: pressure-core: st: Allow for number of channels to vary
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

At the moment the number of channels specified is dictated by the first
sensor supported by the driver. As we add support for more sensors this
is likely to vary. Instead of using the ARRAY_SIZE() of the LPS331AP's
channel specifier we'll use a new adaptable 'struct st_sensors' element
instead.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure_core.c | 3 ++-
 include/linux/iio/common/st_sensors.h   | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 60c2ee4..3abada2 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -107,6 +107,7 @@ static const struct st_sensors st_press_sensors[] = {
 			[0] = LPS331AP_PRESS_DEV_NAME,
 		},
 		.ch = (struct iio_chan_spec *)st_press_lps331ap_channels,
+		.num_ch = ARRAY_SIZE(st_press_lps331ap_channels),
 		.odr = {
 			.addr = ST_PRESS_LPS331AP_ODR_ADDR,
 			.mask = ST_PRESS_LPS331AP_ODR_MASK,
@@ -245,7 +246,7 @@ int st_press_common_probe(struct iio_dev *indio_dev,
 	pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS;
 	pdata->multiread_bit = pdata->sensor->multi_read_bit;
 	indio_dev->channels = pdata->sensor->ch;
-	indio_dev->num_channels = ARRAY_SIZE(st_press_lps331ap_channels);
+	indio_dev->num_channels = pdata->sensor->num_ch;
 
 	if (pdata->sensor->fs.addr != 0)
 		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index e51f654..e732fda 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -184,6 +184,7 @@ struct st_sensors {
 	u8 wai;
 	char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME];
 	struct iio_chan_spec *ch;
+	int num_ch;
 	struct st_sensor_odr odr;
 	struct st_sensor_power pw;
 	struct st_sensor_axis enable_axis;
-- 
1.8.1.2

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

* [PATCH 26/38] iio: pressure-core: st: Clean-up probe() function
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

This patch contains some pretty basic clean-ups in probe() pertaining to
the simplification of error handling and a couple of readability adaptions.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure_core.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 3abada2..6ffd949 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -232,21 +232,23 @@ static const struct iio_trigger_ops st_press_trigger_ops = {
 int st_press_common_probe(struct iio_dev *indio_dev,
 				struct st_sensors_platform_data *plat_data)
 {
-	int err;
 	struct st_sensor_data *pdata = iio_priv(indio_dev);
+	int irq = pdata->get_irq_data_ready(indio_dev);
+	int err;
 
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = &press_info;
 
 	err = st_sensors_check_device_support(indio_dev,
-				ARRAY_SIZE(st_press_sensors), st_press_sensors);
+					      ARRAY_SIZE(st_press_sensors),
+					      st_press_sensors);
 	if (err < 0)
-		goto st_press_common_probe_error;
+		return err;
 
 	pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS;
-	pdata->multiread_bit = pdata->sensor->multi_read_bit;
-	indio_dev->channels = pdata->sensor->ch;
-	indio_dev->num_channels = pdata->sensor->num_ch;
+	pdata->multiread_bit     = pdata->sensor->multi_read_bit;
+	indio_dev->channels      = pdata->sensor->ch;
+	indio_dev->num_channels  = pdata->sensor->num_ch;
 
 	if (pdata->sensor->fs.addr != 0)
 		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
@@ -261,32 +263,30 @@ int st_press_common_probe(struct iio_dev *indio_dev,
 
 	err = st_sensors_init_sensor(indio_dev, plat_data);
 	if (err < 0)
-		goto st_press_common_probe_error;
+		return err;
 
-	if (pdata->get_irq_data_ready(indio_dev) > 0) {
+	if (irq > 0) {
 		err = st_press_allocate_ring(indio_dev);
 		if (err < 0)
-			goto st_press_common_probe_error;
+			return err;
 
 		err = st_sensors_allocate_trigger(indio_dev,
-							ST_PRESS_TRIGGER_OPS);
+						  ST_PRESS_TRIGGER_OPS);
 		if (err < 0)
 			goto st_press_probe_trigger_error;
 	}
 
 	err = iio_device_register(indio_dev);
-	if (err)
+	if (err && irq > 0)
 		goto st_press_device_register_error;
 
 	return err;
 
 st_press_device_register_error:
-	if (pdata->get_irq_data_ready(indio_dev) > 0)
-		st_sensors_deallocate_trigger(indio_dev);
+	st_sensors_deallocate_trigger(indio_dev);
 st_press_probe_trigger_error:
-	if (pdata->get_irq_data_ready(indio_dev) > 0)
-		st_press_deallocate_ring(indio_dev);
-st_press_common_probe_error:
+	st_press_deallocate_ring(indio_dev);
+
 	return err;
 }
 EXPORT_SYMBOL(st_press_common_probe);
-- 
1.8.1.2


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

* [PATCH 26/38] iio: pressure-core: st: Clean-up probe() function
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

This patch contains some pretty basic clean-ups in probe() pertaining to
the simplification of error handling and a couple of readability adaptions.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure_core.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 3abada2..6ffd949 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -232,21 +232,23 @@ static const struct iio_trigger_ops st_press_trigger_ops = {
 int st_press_common_probe(struct iio_dev *indio_dev,
 				struct st_sensors_platform_data *plat_data)
 {
-	int err;
 	struct st_sensor_data *pdata = iio_priv(indio_dev);
+	int irq = pdata->get_irq_data_ready(indio_dev);
+	int err;
 
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = &press_info;
 
 	err = st_sensors_check_device_support(indio_dev,
-				ARRAY_SIZE(st_press_sensors), st_press_sensors);
+					      ARRAY_SIZE(st_press_sensors),
+					      st_press_sensors);
 	if (err < 0)
-		goto st_press_common_probe_error;
+		return err;
 
 	pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS;
-	pdata->multiread_bit = pdata->sensor->multi_read_bit;
-	indio_dev->channels = pdata->sensor->ch;
-	indio_dev->num_channels = pdata->sensor->num_ch;
+	pdata->multiread_bit     = pdata->sensor->multi_read_bit;
+	indio_dev->channels      = pdata->sensor->ch;
+	indio_dev->num_channels  = pdata->sensor->num_ch;
 
 	if (pdata->sensor->fs.addr != 0)
 		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
@@ -261,32 +263,30 @@ int st_press_common_probe(struct iio_dev *indio_dev,
 
 	err = st_sensors_init_sensor(indio_dev, plat_data);
 	if (err < 0)
-		goto st_press_common_probe_error;
+		return err;
 
-	if (pdata->get_irq_data_ready(indio_dev) > 0) {
+	if (irq > 0) {
 		err = st_press_allocate_ring(indio_dev);
 		if (err < 0)
-			goto st_press_common_probe_error;
+			return err;
 
 		err = st_sensors_allocate_trigger(indio_dev,
-							ST_PRESS_TRIGGER_OPS);
+						  ST_PRESS_TRIGGER_OPS);
 		if (err < 0)
 			goto st_press_probe_trigger_error;
 	}
 
 	err = iio_device_register(indio_dev);
-	if (err)
+	if (err && irq > 0)
 		goto st_press_device_register_error;
 
 	return err;
 
 st_press_device_register_error:
-	if (pdata->get_irq_data_ready(indio_dev) > 0)
-		st_sensors_deallocate_trigger(indio_dev);
+	st_sensors_deallocate_trigger(indio_dev);
 st_press_probe_trigger_error:
-	if (pdata->get_irq_data_ready(indio_dev) > 0)
-		st_press_deallocate_ring(indio_dev);
-st_press_common_probe_error:
+	st_press_deallocate_ring(indio_dev);
+
 	return err;
 }
 EXPORT_SYMBOL(st_press_common_probe);
-- 
1.8.1.2

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

* [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

At the moment the driver is silent in some error cases and if successful.
Prior to this patch there was no clear way to know if the driver succeeded
or not without looking deep into sysfs.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 6ffd949..34b3fb1 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev *indio_dev,
 	if (err && irq > 0)
 		goto st_press_device_register_error;
 
+	if (!err)
+		dev_info(&indio_dev->dev, "Successfully registered\n");
+
 	return err;
 
 st_press_device_register_error:
-- 
1.8.1.2


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

* [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

At the moment the driver is silent in some error cases and if successful.
Prior to this patch there was no clear way to know if the driver succeeded
or not without looking deep into sysfs.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 6ffd949..34b3fb1 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev *indio_dev,
 	if (err && irq > 0)
 		goto st_press_device_register_error;
 
+	if (!err)
+		dev_info(&indio_dev->dev, "Successfully registered\n");
+
 	return err;
 
 st_press_device_register_error:
-- 
1.8.1.2

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

* [PATCH 28/38] iio: pressure: st: Add support for new LPS001WP pressure sensor
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Here we use existing practices to introduce support for another
pressure/temperature sensor, the LPS001WP.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure.h      |  1 +
 drivers/iio/pressure/st_pressure_core.c | 84 +++++++++++++++++++++++++++++++++
 drivers/iio/pressure/st_pressure_i2c.c  |  1 +
 3 files changed, 86 insertions(+)

diff --git a/drivers/iio/pressure/st_pressure.h b/drivers/iio/pressure/st_pressure.h
index f1bebce..36b1cc6 100644
--- a/drivers/iio/pressure/st_pressure.h
+++ b/drivers/iio/pressure/st_pressure.h
@@ -15,6 +15,7 @@
 #include <linux/iio/common/st_sensors.h>
 
 #define LPS331AP_PRESS_DEV_NAME		"lps331ap_press"
+#define LPS001WP_PRESS_DEV_NAME		"lps001wp_press"
 
 /**
  * struct st_sensors_platform_data - default press platform data
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 34b3fb1..b42614a 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -64,6 +64,21 @@
 #define ST_PRESS_LPS331AP_OUT_XL_ADDR		0x28
 #define ST_TEMP_LPS331AP_OUT_L_ADDR		0x2b
 
+/* CUSTOM VALUES FOR LPS001WP SENSOR */
+#define ST_PRESS_LPS001WP_WAI_EXP		0xba
+#define ST_PRESS_LPS001WP_ODR_ADDR		0x20
+#define ST_PRESS_LPS001WP_ODR_MASK		0x30
+#define ST_PRESS_LPS001WP_ODR_AVL_1HZ_VAL	0x01
+#define ST_PRESS_LPS001WP_ODR_AVL_7HZ_VAL	0x02
+#define ST_PRESS_LPS001WP_ODR_AVL_13HZ_VAL	0x03
+#define ST_PRESS_LPS001WP_PW_ADDR		0x20
+#define ST_PRESS_LPS001WP_PW_MASK		0x40
+#define ST_PRESS_LPS001WP_BDU_ADDR		0x20
+#define ST_PRESS_LPS001WP_BDU_MASK		0x04
+#define ST_PRESS_LPS001WP_MULTIREAD_BIT		true
+#define ST_PRESS_LPS001WP_OUT_L_ADDR		0x28
+#define ST_TEMP_LPS001WP_OUT_L_ADDR		0x2a
+
 static const struct iio_chan_spec st_press_lps331ap_channels[] = {
 	{
 		.type = IIO_PRESSURE,
@@ -100,6 +115,40 @@ static const struct iio_chan_spec st_press_lps331ap_channels[] = {
 	IIO_CHAN_SOFT_TIMESTAMP(1)
 };
 
+static const struct iio_chan_spec st_press_lps001wp_channels[] = {
+	{
+		.type = IIO_PRESSURE,
+		.channel2 = IIO_NO_MOD,
+		.address = ST_PRESS_LPS001WP_OUT_L_ADDR,
+		.scan_index = ST_SENSORS_SCAN_X,
+		.scan_type = {
+			.sign = 'u',
+			.realbits = 16,
+			.storagebits = 16,
+			.endianness = IIO_LE,
+		},
+		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+		.modified = 0,
+	},
+	{
+		.type = IIO_TEMP,
+		.channel2 = IIO_NO_MOD,
+		.address = ST_TEMP_LPS001WP_OUT_L_ADDR,
+		.scan_index = -1,
+		.scan_type = {
+			.sign = 'u',
+			.realbits = 16,
+			.storagebits = 16,
+			.endianness = IIO_LE,
+		},
+		.info_mask_separate =
+			BIT(IIO_CHAN_INFO_RAW) |
+			BIT(IIO_CHAN_INFO_OFFSET),
+		.modified = 0,
+	},
+	IIO_CHAN_SOFT_TIMESTAMP(1)
+};
+
 static const struct st_sensors st_press_sensors[] = {
 	{
 		.wai = ST_PRESS_LPS331AP_WAI_EXP,
@@ -148,6 +197,41 @@ static const struct st_sensors st_press_sensors[] = {
 		.multi_read_bit = ST_PRESS_LPS331AP_MULTIREAD_BIT,
 		.bootime = 2,
 	},
+	{
+		.wai = ST_PRESS_LPS001WP_WAI_EXP,
+		.sensors_supported = {
+			[0] = LPS001WP_PRESS_DEV_NAME,
+		},
+		.ch = (struct iio_chan_spec *)st_press_lps001wp_channels,
+		.num_ch = ARRAY_SIZE(st_press_lps001wp_channels),
+		.odr = {
+			.addr = ST_PRESS_LPS001WP_ODR_ADDR,
+			.mask = ST_PRESS_LPS001WP_ODR_MASK,
+			.odr_avl = {
+				{ 1, ST_PRESS_LPS001WP_ODR_AVL_1HZ_VAL, },
+				{ 7, ST_PRESS_LPS001WP_ODR_AVL_7HZ_VAL, },
+				{ 13, ST_PRESS_LPS001WP_ODR_AVL_13HZ_VAL, },
+			},
+		},
+		.pw = {
+			.addr = ST_PRESS_LPS001WP_PW_ADDR,
+			.mask = ST_PRESS_LPS001WP_PW_MASK,
+			.value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE,
+			.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
+		},
+		.fs = {
+			.addr = 0,
+		},
+		.bdu = {
+			.addr = ST_PRESS_LPS001WP_BDU_ADDR,
+			.mask = ST_PRESS_LPS001WP_BDU_MASK,
+		},
+		.drdy_irq = {
+			.addr = 0,
+		},
+		.multi_read_bit = ST_PRESS_LPS001WP_MULTIREAD_BIT,
+		.bootime = 2,
+	},
 };
 
 static int st_press_read_raw(struct iio_dev *indio_dev,
diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c
index 08aac5e..ada5cbd 100644
--- a/drivers/iio/pressure/st_pressure_i2c.c
+++ b/drivers/iio/pressure/st_pressure_i2c.c
@@ -50,6 +50,7 @@ static int st_press_i2c_remove(struct i2c_client *client)
 
 static const struct i2c_device_id st_press_id_table[] = {
 	{ LPS331AP_PRESS_DEV_NAME },
+	{ LPS001WP_PRESS_DEV_NAME },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, st_press_id_table);
-- 
1.8.1.2


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

* [PATCH 28/38] iio: pressure: st: Add support for new LPS001WP pressure sensor
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Here we use existing practices to introduce support for another
pressure/temperature sensor, the LPS001WP.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure.h      |  1 +
 drivers/iio/pressure/st_pressure_core.c | 84 +++++++++++++++++++++++++++++++++
 drivers/iio/pressure/st_pressure_i2c.c  |  1 +
 3 files changed, 86 insertions(+)

diff --git a/drivers/iio/pressure/st_pressure.h b/drivers/iio/pressure/st_pressure.h
index f1bebce..36b1cc6 100644
--- a/drivers/iio/pressure/st_pressure.h
+++ b/drivers/iio/pressure/st_pressure.h
@@ -15,6 +15,7 @@
 #include <linux/iio/common/st_sensors.h>
 
 #define LPS331AP_PRESS_DEV_NAME		"lps331ap_press"
+#define LPS001WP_PRESS_DEV_NAME		"lps001wp_press"
 
 /**
  * struct st_sensors_platform_data - default press platform data
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 34b3fb1..b42614a 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -64,6 +64,21 @@
 #define ST_PRESS_LPS331AP_OUT_XL_ADDR		0x28
 #define ST_TEMP_LPS331AP_OUT_L_ADDR		0x2b
 
+/* CUSTOM VALUES FOR LPS001WP SENSOR */
+#define ST_PRESS_LPS001WP_WAI_EXP		0xba
+#define ST_PRESS_LPS001WP_ODR_ADDR		0x20
+#define ST_PRESS_LPS001WP_ODR_MASK		0x30
+#define ST_PRESS_LPS001WP_ODR_AVL_1HZ_VAL	0x01
+#define ST_PRESS_LPS001WP_ODR_AVL_7HZ_VAL	0x02
+#define ST_PRESS_LPS001WP_ODR_AVL_13HZ_VAL	0x03
+#define ST_PRESS_LPS001WP_PW_ADDR		0x20
+#define ST_PRESS_LPS001WP_PW_MASK		0x40
+#define ST_PRESS_LPS001WP_BDU_ADDR		0x20
+#define ST_PRESS_LPS001WP_BDU_MASK		0x04
+#define ST_PRESS_LPS001WP_MULTIREAD_BIT		true
+#define ST_PRESS_LPS001WP_OUT_L_ADDR		0x28
+#define ST_TEMP_LPS001WP_OUT_L_ADDR		0x2a
+
 static const struct iio_chan_spec st_press_lps331ap_channels[] = {
 	{
 		.type = IIO_PRESSURE,
@@ -100,6 +115,40 @@ static const struct iio_chan_spec st_press_lps331ap_channels[] = {
 	IIO_CHAN_SOFT_TIMESTAMP(1)
 };
 
+static const struct iio_chan_spec st_press_lps001wp_channels[] = {
+	{
+		.type = IIO_PRESSURE,
+		.channel2 = IIO_NO_MOD,
+		.address = ST_PRESS_LPS001WP_OUT_L_ADDR,
+		.scan_index = ST_SENSORS_SCAN_X,
+		.scan_type = {
+			.sign = 'u',
+			.realbits = 16,
+			.storagebits = 16,
+			.endianness = IIO_LE,
+		},
+		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+		.modified = 0,
+	},
+	{
+		.type = IIO_TEMP,
+		.channel2 = IIO_NO_MOD,
+		.address = ST_TEMP_LPS001WP_OUT_L_ADDR,
+		.scan_index = -1,
+		.scan_type = {
+			.sign = 'u',
+			.realbits = 16,
+			.storagebits = 16,
+			.endianness = IIO_LE,
+		},
+		.info_mask_separate =
+			BIT(IIO_CHAN_INFO_RAW) |
+			BIT(IIO_CHAN_INFO_OFFSET),
+		.modified = 0,
+	},
+	IIO_CHAN_SOFT_TIMESTAMP(1)
+};
+
 static const struct st_sensors st_press_sensors[] = {
 	{
 		.wai = ST_PRESS_LPS331AP_WAI_EXP,
@@ -148,6 +197,41 @@ static const struct st_sensors st_press_sensors[] = {
 		.multi_read_bit = ST_PRESS_LPS331AP_MULTIREAD_BIT,
 		.bootime = 2,
 	},
+	{
+		.wai = ST_PRESS_LPS001WP_WAI_EXP,
+		.sensors_supported = {
+			[0] = LPS001WP_PRESS_DEV_NAME,
+		},
+		.ch = (struct iio_chan_spec *)st_press_lps001wp_channels,
+		.num_ch = ARRAY_SIZE(st_press_lps001wp_channels),
+		.odr = {
+			.addr = ST_PRESS_LPS001WP_ODR_ADDR,
+			.mask = ST_PRESS_LPS001WP_ODR_MASK,
+			.odr_avl = {
+				{ 1, ST_PRESS_LPS001WP_ODR_AVL_1HZ_VAL, },
+				{ 7, ST_PRESS_LPS001WP_ODR_AVL_7HZ_VAL, },
+				{ 13, ST_PRESS_LPS001WP_ODR_AVL_13HZ_VAL, },
+			},
+		},
+		.pw = {
+			.addr = ST_PRESS_LPS001WP_PW_ADDR,
+			.mask = ST_PRESS_LPS001WP_PW_MASK,
+			.value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE,
+			.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
+		},
+		.fs = {
+			.addr = 0,
+		},
+		.bdu = {
+			.addr = ST_PRESS_LPS001WP_BDU_ADDR,
+			.mask = ST_PRESS_LPS001WP_BDU_MASK,
+		},
+		.drdy_irq = {
+			.addr = 0,
+		},
+		.multi_read_bit = ST_PRESS_LPS001WP_MULTIREAD_BIT,
+		.bootime = 2,
+	},
 };
 
 static int st_press_read_raw(struct iio_dev *indio_dev,
diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c
index 08aac5e..ada5cbd 100644
--- a/drivers/iio/pressure/st_pressure_i2c.c
+++ b/drivers/iio/pressure/st_pressure_i2c.c
@@ -50,6 +50,7 @@ static int st_press_i2c_remove(struct i2c_client *client)
 
 static const struct i2c_device_id st_press_id_table[] = {
 	{ LPS331AP_PRESS_DEV_NAME },
+	{ LPS001WP_PRESS_DEV_NAME },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, st_press_id_table);
-- 
1.8.1.2

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

* [PATCH 29/38] iio: pressure-core: st: Provide support for the Vdd power supply
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

The power to some of the sensors are controlled by regulators. In most
cases these are 'always on', but if not they will fail to work until
the regulator is enabled using the relevant APIs. This patch allows for
the Vdd power supply to be specified by either platform data or Device
Tree.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure_core.c | 28 ++++++++++++++++++++++++++++
 include/linux/iio/common/st_sensors.h   |  3 +++
 2 files changed, 31 insertions(+)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index b42614a..d52b487 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -23,6 +23,7 @@
 #include <linux/iio/sysfs.h>
 #include <linux/iio/trigger.h>
 #include <linux/iio/buffer.h>
+#include <linux/regulator/consumer.h>
 #include <asm/unaligned.h>
 
 #include <linux/iio/common/st_sensors.h>
@@ -313,6 +314,29 @@ static const struct iio_trigger_ops st_press_trigger_ops = {
 #define ST_PRESS_TRIGGER_OPS NULL
 #endif
 
+void st_press_power_enable(struct iio_dev *indio_dev)
+{
+	struct st_sensor_data *pdata = iio_priv(indio_dev);
+	int err;
+
+	/* Regulators not mandatory, but if requested we should enable it. */
+	pdata->vdd = devm_regulator_get_optional(&indio_dev->dev, "vdd");
+	if (!IS_ERR(pdata->vdd)) {
+		err = regulator_enable(pdata->vdd);
+		if (err != 0)
+			dev_warn(&indio_dev->dev,
+				 "Failed to enable specified Vdd supply\n");
+	}
+}
+
+void st_press_power_disable(struct iio_dev *indio_dev)
+{
+	struct st_sensor_data *pdata = iio_priv(indio_dev);
+
+	if (!IS_ERR(pdata->vdd))
+		regulator_disable(pdata->vdd);
+}
+
 int st_press_common_probe(struct iio_dev *indio_dev,
 				struct st_sensors_platform_data *plat_data)
 {
@@ -323,6 +347,8 @@ int st_press_common_probe(struct iio_dev *indio_dev,
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = &press_info;
 
+	st_press_power_enable(indio_dev);
+
 	err = st_sensors_check_device_support(indio_dev,
 					      ARRAY_SIZE(st_press_sensors),
 					      st_press_sensors);
@@ -382,6 +408,8 @@ void st_press_common_remove(struct iio_dev *indio_dev)
 {
 	struct st_sensor_data *pdata = iio_priv(indio_dev);
 
+	st_press_power_disable(indio_dev);
+
 	iio_device_unregister(indio_dev);
 	if (pdata->get_irq_data_ready(indio_dev) > 0) {
 		st_sensors_deallocate_trigger(indio_dev);
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index e732fda..968b84e 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -16,6 +16,7 @@
 #include <linux/irqreturn.h>
 #include <linux/iio/trigger.h>
 #include <linux/bitops.h>
+#include <linux/regulator/consumer.h>
 
 #include <linux/platform_data/st_sensors_pdata.h>
 
@@ -201,6 +202,7 @@ struct st_sensors {
  * @trig: The trigger in use by the core driver.
  * @sensor: Pointer to the current sensor struct in use.
  * @current_fullscale: Maximum range of measure by the sensor.
+ * @vdd: Pointer to sensor's Vdd power supply
  * @enabled: Status of the sensor (false->off, true->on).
  * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
  * @buffer_data: Data used by buffer part.
@@ -216,6 +218,7 @@ struct st_sensor_data {
 	struct iio_trigger *trig;
 	struct st_sensors *sensor;
 	struct st_sensor_fullscale_avl *current_fullscale;
+	struct regulator *vdd;
 
 	bool enabled;
 	bool multiread_bit;
-- 
1.8.1.2


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

* [PATCH 29/38] iio: pressure-core: st: Provide support for the Vdd power supply
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

The power to some of the sensors are controlled by regulators. In most
cases these are 'always on', but if not they will fail to work until
the regulator is enabled using the relevant APIs. This patch allows for
the Vdd power supply to be specified by either platform data or Device
Tree.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure_core.c | 28 ++++++++++++++++++++++++++++
 include/linux/iio/common/st_sensors.h   |  3 +++
 2 files changed, 31 insertions(+)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index b42614a..d52b487 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -23,6 +23,7 @@
 #include <linux/iio/sysfs.h>
 #include <linux/iio/trigger.h>
 #include <linux/iio/buffer.h>
+#include <linux/regulator/consumer.h>
 #include <asm/unaligned.h>
 
 #include <linux/iio/common/st_sensors.h>
@@ -313,6 +314,29 @@ static const struct iio_trigger_ops st_press_trigger_ops = {
 #define ST_PRESS_TRIGGER_OPS NULL
 #endif
 
+void st_press_power_enable(struct iio_dev *indio_dev)
+{
+	struct st_sensor_data *pdata = iio_priv(indio_dev);
+	int err;
+
+	/* Regulators not mandatory, but if requested we should enable it. */
+	pdata->vdd = devm_regulator_get_optional(&indio_dev->dev, "vdd");
+	if (!IS_ERR(pdata->vdd)) {
+		err = regulator_enable(pdata->vdd);
+		if (err != 0)
+			dev_warn(&indio_dev->dev,
+				 "Failed to enable specified Vdd supply\n");
+	}
+}
+
+void st_press_power_disable(struct iio_dev *indio_dev)
+{
+	struct st_sensor_data *pdata = iio_priv(indio_dev);
+
+	if (!IS_ERR(pdata->vdd))
+		regulator_disable(pdata->vdd);
+}
+
 int st_press_common_probe(struct iio_dev *indio_dev,
 				struct st_sensors_platform_data *plat_data)
 {
@@ -323,6 +347,8 @@ int st_press_common_probe(struct iio_dev *indio_dev,
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = &press_info;
 
+	st_press_power_enable(indio_dev);
+
 	err = st_sensors_check_device_support(indio_dev,
 					      ARRAY_SIZE(st_press_sensors),
 					      st_press_sensors);
@@ -382,6 +408,8 @@ void st_press_common_remove(struct iio_dev *indio_dev)
 {
 	struct st_sensor_data *pdata = iio_priv(indio_dev);
 
+	st_press_power_disable(indio_dev);
+
 	iio_device_unregister(indio_dev);
 	if (pdata->get_irq_data_ready(indio_dev) > 0) {
 		st_sensors_deallocate_trigger(indio_dev);
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index e732fda..968b84e 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -16,6 +16,7 @@
 #include <linux/irqreturn.h>
 #include <linux/iio/trigger.h>
 #include <linux/bitops.h>
+#include <linux/regulator/consumer.h>
 
 #include <linux/platform_data/st_sensors_pdata.h>
 
@@ -201,6 +202,7 @@ struct st_sensors {
  * @trig: The trigger in use by the core driver.
  * @sensor: Pointer to the current sensor struct in use.
  * @current_fullscale: Maximum range of measure by the sensor.
+ * @vdd: Pointer to sensor's Vdd power supply
  * @enabled: Status of the sensor (false->off, true->on).
  * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
  * @buffer_data: Data used by buffer part.
@@ -216,6 +218,7 @@ struct st_sensor_data {
 	struct iio_trigger *trig;
 	struct st_sensors *sensor;
 	struct st_sensor_fullscale_avl *current_fullscale;
+	struct regulator *vdd;
 
 	bool enabled;
 	bool multiread_bit;
-- 
1.8.1.2

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

* [PATCH 30/38] iio: pressure-core: st: Provide support for the Vdd_IO power supply
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

The power to some of the sensors are controlled by regulators. In most
cases these are 'always on', but if not they will fail to work until
the regulator is enabled using the relevant APIs. This patch allows for
the Vdd_IO power supply to be specified by either platform data or
Device Tree.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure_core.c | 13 ++++++++++++-
 include/linux/iio/common/st_sensors.h   |  2 ++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index d52b487..2db3b28 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -319,7 +319,7 @@ void st_press_power_enable(struct iio_dev *indio_dev)
 	struct st_sensor_data *pdata = iio_priv(indio_dev);
 	int err;
 
-	/* Regulators not mandatory, but if requested we should enable it. */
+	/* Regulators not mandatory, but if requested we should enable them. */
 	pdata->vdd = devm_regulator_get_optional(&indio_dev->dev, "vdd");
 	if (!IS_ERR(pdata->vdd)) {
 		err = regulator_enable(pdata->vdd);
@@ -327,6 +327,14 @@ void st_press_power_enable(struct iio_dev *indio_dev)
 			dev_warn(&indio_dev->dev,
 				 "Failed to enable specified Vdd supply\n");
 	}
+
+	pdata->vdd_io = devm_regulator_get_optional(&indio_dev->dev, "vddio");
+	if (!IS_ERR(pdata->vdd_io)) {
+		err = regulator_enable(pdata->vdd_io);
+		if (err != 0)
+			dev_warn(&indio_dev->dev,
+				 "Failed to enable specified Vdd_IO supply\n");
+	}
 }
 
 void st_press_power_disable(struct iio_dev *indio_dev)
@@ -335,6 +343,9 @@ void st_press_power_disable(struct iio_dev *indio_dev)
 
 	if (!IS_ERR(pdata->vdd))
 		regulator_disable(pdata->vdd);
+
+	if (!IS_ERR(pdata->vdd_io))
+		regulator_disable(pdata->vdd_io);
 }
 
 int st_press_common_probe(struct iio_dev *indio_dev,
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 968b84e..3c005eb 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -203,6 +203,7 @@ struct st_sensors {
  * @sensor: Pointer to the current sensor struct in use.
  * @current_fullscale: Maximum range of measure by the sensor.
  * @vdd: Pointer to sensor's Vdd power supply
+ * @vdd_io: Pointer to sensor's Vdd-IO power supply
  * @enabled: Status of the sensor (false->off, true->on).
  * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
  * @buffer_data: Data used by buffer part.
@@ -219,6 +220,7 @@ struct st_sensor_data {
 	struct st_sensors *sensor;
 	struct st_sensor_fullscale_avl *current_fullscale;
 	struct regulator *vdd;
+	struct regulator *vdd_io;
 
 	bool enabled;
 	bool multiread_bit;
-- 
1.8.1.2


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

* [PATCH 30/38] iio: pressure-core: st: Provide support for the Vdd_IO power supply
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

The power to some of the sensors are controlled by regulators. In most
cases these are 'always on', but if not they will fail to work until
the regulator is enabled using the relevant APIs. This patch allows for
the Vdd_IO power supply to be specified by either platform data or
Device Tree.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/pressure/st_pressure_core.c | 13 ++++++++++++-
 include/linux/iio/common/st_sensors.h   |  2 ++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index d52b487..2db3b28 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -319,7 +319,7 @@ void st_press_power_enable(struct iio_dev *indio_dev)
 	struct st_sensor_data *pdata = iio_priv(indio_dev);
 	int err;
 
-	/* Regulators not mandatory, but if requested we should enable it. */
+	/* Regulators not mandatory, but if requested we should enable them. */
 	pdata->vdd = devm_regulator_get_optional(&indio_dev->dev, "vdd");
 	if (!IS_ERR(pdata->vdd)) {
 		err = regulator_enable(pdata->vdd);
@@ -327,6 +327,14 @@ void st_press_power_enable(struct iio_dev *indio_dev)
 			dev_warn(&indio_dev->dev,
 				 "Failed to enable specified Vdd supply\n");
 	}
+
+	pdata->vdd_io = devm_regulator_get_optional(&indio_dev->dev, "vddio");
+	if (!IS_ERR(pdata->vdd_io)) {
+		err = regulator_enable(pdata->vdd_io);
+		if (err != 0)
+			dev_warn(&indio_dev->dev,
+				 "Failed to enable specified Vdd_IO supply\n");
+	}
 }
 
 void st_press_power_disable(struct iio_dev *indio_dev)
@@ -335,6 +343,9 @@ void st_press_power_disable(struct iio_dev *indio_dev)
 
 	if (!IS_ERR(pdata->vdd))
 		regulator_disable(pdata->vdd);
+
+	if (!IS_ERR(pdata->vdd_io))
+		regulator_disable(pdata->vdd_io);
 }
 
 int st_press_common_probe(struct iio_dev *indio_dev,
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 968b84e..3c005eb 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -203,6 +203,7 @@ struct st_sensors {
  * @sensor: Pointer to the current sensor struct in use.
  * @current_fullscale: Maximum range of measure by the sensor.
  * @vdd: Pointer to sensor's Vdd power supply
+ * @vdd_io: Pointer to sensor's Vdd-IO power supply
  * @enabled: Status of the sensor (false->off, true->on).
  * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
  * @buffer_data: Data used by buffer part.
@@ -219,6 +220,7 @@ struct st_sensor_data {
 	struct st_sensors *sensor;
 	struct st_sensor_fullscale_avl *current_fullscale;
 	struct regulator *vdd;
+	struct regulator *vdd_io;
 
 	bool enabled;
 	bool multiread_bit;
-- 
1.8.1.2

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

* [PATCH 31/38] iio: accel-core: st: Clean up error handling in probe()
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Reduce the amount of those unnecessary goto calls, as in most cases
we can simply return immediately. We also only call for the IRQ number
once and use that value throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/accel/st_accel_core.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index 1458343..ea62291 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -452,8 +452,9 @@ static const struct iio_trigger_ops st_accel_trigger_ops = {
 int st_accel_common_probe(struct iio_dev *indio_dev,
 				struct st_sensors_platform_data *plat_data)
 {
-	int err;
 	struct st_sensor_data *adata = iio_priv(indio_dev);
+	int irq = adata->get_irq_data_ready(indio_dev);
+	int err;
 
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = &accel_info;
@@ -461,7 +462,7 @@ int st_accel_common_probe(struct iio_dev *indio_dev,
 	err = st_sensors_check_device_support(indio_dev,
 				ARRAY_SIZE(st_accel_sensors), st_accel_sensors);
 	if (err < 0)
-		goto st_accel_common_probe_error;
+		return err;
 
 	adata->num_data_channels = ST_ACCEL_NUMBER_DATA_CHANNELS;
 	adata->multiread_bit = adata->sensor->multi_read_bit;
@@ -478,12 +479,12 @@ int st_accel_common_probe(struct iio_dev *indio_dev,
 
 	err = st_sensors_init_sensor(indio_dev, plat_data);
 	if (err < 0)
-		goto st_accel_common_probe_error;
+		return err;
 
-	if (adata->get_irq_data_ready(indio_dev) > 0) {
+	if (irq > 0) {
 		err = st_accel_allocate_ring(indio_dev);
 		if (err < 0)
-			goto st_accel_common_probe_error;
+			return err;
 
 		err = st_sensors_allocate_trigger(indio_dev,
 						 ST_ACCEL_TRIGGER_OPS);
@@ -492,18 +493,16 @@ int st_accel_common_probe(struct iio_dev *indio_dev,
 	}
 
 	err = iio_device_register(indio_dev);
-	if (err)
+	if (err && irq > 0)
 		goto st_accel_device_register_error;
 
 	return err;
 
 st_accel_device_register_error:
-	if (adata->get_irq_data_ready(indio_dev) > 0)
-		st_sensors_deallocate_trigger(indio_dev);
+	st_sensors_deallocate_trigger(indio_dev);
 st_accel_probe_trigger_error:
-	if (adata->get_irq_data_ready(indio_dev) > 0)
-		st_accel_deallocate_ring(indio_dev);
-st_accel_common_probe_error:
+	st_accel_deallocate_ring(indio_dev);
+
 	return err;
 }
 EXPORT_SYMBOL(st_accel_common_probe);
-- 
1.8.1.2


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

* [PATCH 31/38] iio: accel-core: st: Clean up error handling in probe()
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Reduce the amount of those unnecessary goto calls, as in most cases
we can simply return immediately. We also only call for the IRQ number
once and use that value throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/accel/st_accel_core.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index 1458343..ea62291 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -452,8 +452,9 @@ static const struct iio_trigger_ops st_accel_trigger_ops = {
 int st_accel_common_probe(struct iio_dev *indio_dev,
 				struct st_sensors_platform_data *plat_data)
 {
-	int err;
 	struct st_sensor_data *adata = iio_priv(indio_dev);
+	int irq = adata->get_irq_data_ready(indio_dev);
+	int err;
 
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = &accel_info;
@@ -461,7 +462,7 @@ int st_accel_common_probe(struct iio_dev *indio_dev,
 	err = st_sensors_check_device_support(indio_dev,
 				ARRAY_SIZE(st_accel_sensors), st_accel_sensors);
 	if (err < 0)
-		goto st_accel_common_probe_error;
+		return err;
 
 	adata->num_data_channels = ST_ACCEL_NUMBER_DATA_CHANNELS;
 	adata->multiread_bit = adata->sensor->multi_read_bit;
@@ -478,12 +479,12 @@ int st_accel_common_probe(struct iio_dev *indio_dev,
 
 	err = st_sensors_init_sensor(indio_dev, plat_data);
 	if (err < 0)
-		goto st_accel_common_probe_error;
+		return err;
 
-	if (adata->get_irq_data_ready(indio_dev) > 0) {
+	if (irq > 0) {
 		err = st_accel_allocate_ring(indio_dev);
 		if (err < 0)
-			goto st_accel_common_probe_error;
+			return err;
 
 		err = st_sensors_allocate_trigger(indio_dev,
 						 ST_ACCEL_TRIGGER_OPS);
@@ -492,18 +493,16 @@ int st_accel_common_probe(struct iio_dev *indio_dev,
 	}
 
 	err = iio_device_register(indio_dev);
-	if (err)
+	if (err && irq > 0)
 		goto st_accel_device_register_error;
 
 	return err;
 
 st_accel_device_register_error:
-	if (adata->get_irq_data_ready(indio_dev) > 0)
-		st_sensors_deallocate_trigger(indio_dev);
+	st_sensors_deallocate_trigger(indio_dev);
 st_accel_probe_trigger_error:
-	if (adata->get_irq_data_ready(indio_dev) > 0)
-		st_accel_deallocate_ring(indio_dev);
-st_accel_common_probe_error:
+	st_accel_deallocate_ring(indio_dev);
+
 	return err;
 }
 EXPORT_SYMBOL(st_accel_common_probe);
-- 
1.8.1.2

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

* [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

The LSM303DLH's WAI (WhoAmI) is 0x33, meaning it should be enabled by
Accel Sensor group one. For the device to probe without error, we'll
need to ensure it's registered with the correct WAI.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/accel/st_accel_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index ea62291..03a2b6b 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -170,6 +170,7 @@ static const struct st_sensors st_accel_sensors[] = {
 			[2] = LSM330D_ACCEL_DEV_NAME,
 			[3] = LSM330DL_ACCEL_DEV_NAME,
 			[4] = LSM330DLC_ACCEL_DEV_NAME,
+			[5] = LSM303DLH_ACCEL_DEV_NAME,
 		},
 		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
 		.odr = {
@@ -238,8 +239,7 @@ static const struct st_sensors st_accel_sensors[] = {
 		.sensors_supported = {
 			[0] = LIS331DLH_ACCEL_DEV_NAME,
 			[1] = LSM303DL_ACCEL_DEV_NAME,
-			[2] = LSM303DLH_ACCEL_DEV_NAME,
-			[3] = LSM303DLM_ACCEL_DEV_NAME,
+			[2] = LSM303DLM_ACCEL_DEV_NAME,
 		},
 		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
 		.odr = {
-- 
1.8.1.2


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

* [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

The LSM303DLH's WAI (WhoAmI) is 0x33, meaning it should be enabled by
Accel Sensor group one. For the device to probe without error, we'll
need to ensure it's registered with the correct WAI.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/accel/st_accel_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index ea62291..03a2b6b 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -170,6 +170,7 @@ static const struct st_sensors st_accel_sensors[] = {
 			[2] = LSM330D_ACCEL_DEV_NAME,
 			[3] = LSM330DL_ACCEL_DEV_NAME,
 			[4] = LSM330DLC_ACCEL_DEV_NAME,
+			[5] = LSM303DLH_ACCEL_DEV_NAME,
 		},
 		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
 		.odr = {
@@ -238,8 +239,7 @@ static const struct st_sensors st_accel_sensors[] = {
 		.sensors_supported = {
 			[0] = LIS331DLH_ACCEL_DEV_NAME,
 			[1] = LSM303DL_ACCEL_DEV_NAME,
-			[2] = LSM303DLH_ACCEL_DEV_NAME,
-			[3] = LSM303DLM_ACCEL_DEV_NAME,
+			[2] = LSM303DLM_ACCEL_DEV_NAME,
 		},
 		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
 		.odr = {
-- 
1.8.1.2

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

* [PATCH 33/38] iio: accel-core: st: Give some indication if device probing was successful
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

At the moment the driver is silent in some error cases and if successful.
Prior to this patch there was no clear way to know if the driver succeeded
or not without looking deep into sysfs.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/accel/st_accel_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index 03a2b6b..a003f3b 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -496,6 +496,9 @@ int st_accel_common_probe(struct iio_dev *indio_dev,
 	if (err && irq > 0)
 		goto st_accel_device_register_error;
 
+	if (!err)
+		dev_info(&indio_dev->dev, "Successfully registered\n");
+
 	return err;
 
 st_accel_device_register_error:
-- 
1.8.1.2


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

* [PATCH 33/38] iio: accel-core: st: Give some indication if device probing was successful
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

At the moment the driver is silent in some error cases and if successful.
Prior to this patch there was no clear way to know if the driver succeeded
or not without looking deep into sysfs.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/accel/st_accel_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index 03a2b6b..a003f3b 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -496,6 +496,9 @@ int st_accel_common_probe(struct iio_dev *indio_dev,
 	if (err && irq > 0)
 		goto st_accel_device_register_error;
 
+	if (!err)
+		dev_info(&indio_dev->dev, "Successfully registered\n");
+
 	return err;
 
 st_accel_device_register_error:
-- 
1.8.1.2

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

* [PATCH 34/38] iio: gyro-core: st: Clean up error handling in probe()
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Reduce the amount of those unnecessary goto calls, as in most cases
we can simply return immediately. We also only call for the IRQ number
once and use that value throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/gyro/st_gyro_core.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c
index e13c2b0..09e24f9 100644
--- a/drivers/iio/gyro/st_gyro_core.c
+++ b/drivers/iio/gyro/st_gyro_core.c
@@ -305,8 +305,9 @@ static const struct iio_trigger_ops st_gyro_trigger_ops = {
 int st_gyro_common_probe(struct iio_dev *indio_dev,
 					struct st_sensors_platform_data *pdata)
 {
-	int err;
 	struct st_sensor_data *gdata = iio_priv(indio_dev);
+	int irq = gdata->get_irq_data_ready(indio_dev);
+	int err;
 
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = &gyro_info;
@@ -314,7 +315,7 @@ int st_gyro_common_probe(struct iio_dev *indio_dev,
 	err = st_sensors_check_device_support(indio_dev,
 				ARRAY_SIZE(st_gyro_sensors), st_gyro_sensors);
 	if (err < 0)
-		goto st_gyro_common_probe_error;
+		return err;
 
 	gdata->num_data_channels = ST_GYRO_NUMBER_DATA_CHANNELS;
 	gdata->multiread_bit = gdata->sensor->multi_read_bit;
@@ -327,12 +328,12 @@ int st_gyro_common_probe(struct iio_dev *indio_dev,
 
 	err = st_sensors_init_sensor(indio_dev, pdata);
 	if (err < 0)
-		goto st_gyro_common_probe_error;
+		return err;
 
-	if (gdata->get_irq_data_ready(indio_dev) > 0) {
+	if (irq > 0) {
 		err = st_gyro_allocate_ring(indio_dev);
 		if (err < 0)
-			goto st_gyro_common_probe_error;
+			return err;
 
 		err = st_sensors_allocate_trigger(indio_dev,
 						  ST_GYRO_TRIGGER_OPS);
@@ -341,18 +342,16 @@ int st_gyro_common_probe(struct iio_dev *indio_dev,
 	}
 
 	err = iio_device_register(indio_dev);
-	if (err)
+	if (err && irq > 0)
 		goto st_gyro_device_register_error;
 
 	return err;
 
 st_gyro_device_register_error:
-	if (gdata->get_irq_data_ready(indio_dev) > 0)
-		st_sensors_deallocate_trigger(indio_dev);
+	st_sensors_deallocate_trigger(indio_dev);
 st_gyro_probe_trigger_error:
-	if (gdata->get_irq_data_ready(indio_dev) > 0)
-		st_gyro_deallocate_ring(indio_dev);
-st_gyro_common_probe_error:
+	st_gyro_deallocate_ring(indio_dev);
+
 	return err;
 }
 EXPORT_SYMBOL(st_gyro_common_probe);
-- 
1.8.1.2


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

* [PATCH 34/38] iio: gyro-core: st: Clean up error handling in probe()
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Reduce the amount of those unnecessary goto calls, as in most cases
we can simply return immediately. We also only call for the IRQ number
once and use that value throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/gyro/st_gyro_core.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c
index e13c2b0..09e24f9 100644
--- a/drivers/iio/gyro/st_gyro_core.c
+++ b/drivers/iio/gyro/st_gyro_core.c
@@ -305,8 +305,9 @@ static const struct iio_trigger_ops st_gyro_trigger_ops = {
 int st_gyro_common_probe(struct iio_dev *indio_dev,
 					struct st_sensors_platform_data *pdata)
 {
-	int err;
 	struct st_sensor_data *gdata = iio_priv(indio_dev);
+	int irq = gdata->get_irq_data_ready(indio_dev);
+	int err;
 
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = &gyro_info;
@@ -314,7 +315,7 @@ int st_gyro_common_probe(struct iio_dev *indio_dev,
 	err = st_sensors_check_device_support(indio_dev,
 				ARRAY_SIZE(st_gyro_sensors), st_gyro_sensors);
 	if (err < 0)
-		goto st_gyro_common_probe_error;
+		return err;
 
 	gdata->num_data_channels = ST_GYRO_NUMBER_DATA_CHANNELS;
 	gdata->multiread_bit = gdata->sensor->multi_read_bit;
@@ -327,12 +328,12 @@ int st_gyro_common_probe(struct iio_dev *indio_dev,
 
 	err = st_sensors_init_sensor(indio_dev, pdata);
 	if (err < 0)
-		goto st_gyro_common_probe_error;
+		return err;
 
-	if (gdata->get_irq_data_ready(indio_dev) > 0) {
+	if (irq > 0) {
 		err = st_gyro_allocate_ring(indio_dev);
 		if (err < 0)
-			goto st_gyro_common_probe_error;
+			return err;
 
 		err = st_sensors_allocate_trigger(indio_dev,
 						  ST_GYRO_TRIGGER_OPS);
@@ -341,18 +342,16 @@ int st_gyro_common_probe(struct iio_dev *indio_dev,
 	}
 
 	err = iio_device_register(indio_dev);
-	if (err)
+	if (err && irq > 0)
 		goto st_gyro_device_register_error;
 
 	return err;
 
 st_gyro_device_register_error:
-	if (gdata->get_irq_data_ready(indio_dev) > 0)
-		st_sensors_deallocate_trigger(indio_dev);
+	st_sensors_deallocate_trigger(indio_dev);
 st_gyro_probe_trigger_error:
-	if (gdata->get_irq_data_ready(indio_dev) > 0)
-		st_gyro_deallocate_ring(indio_dev);
-st_gyro_common_probe_error:
+	st_gyro_deallocate_ring(indio_dev);
+
 	return err;
 }
 EXPORT_SYMBOL(st_gyro_common_probe);
-- 
1.8.1.2

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

* [PATCH 35/38] iio: gyro-core: st: Give some indication if device probing was successful
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

At the moment the driver is silent in some error cases and if successful.
Prior to this patch there was no clear way to know if the driver succeeded
or not without looking deep into sysfs.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/gyro/st_gyro_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c
index 09e24f9..e93b94c 100644
--- a/drivers/iio/gyro/st_gyro_core.c
+++ b/drivers/iio/gyro/st_gyro_core.c
@@ -345,6 +345,9 @@ int st_gyro_common_probe(struct iio_dev *indio_dev,
 	if (err && irq > 0)
 		goto st_gyro_device_register_error;
 
+	if (!err)
+		dev_info(&indio_dev->dev, "Successfully registered\n");
+
 	return err;
 
 st_gyro_device_register_error:
-- 
1.8.1.2


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

* [PATCH 35/38] iio: gyro-core: st: Give some indication if device probing was successful
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

At the moment the driver is silent in some error cases and if successful.
Prior to this patch there was no clear way to know if the driver succeeded
or not without looking deep into sysfs.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/gyro/st_gyro_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c
index 09e24f9..e93b94c 100644
--- a/drivers/iio/gyro/st_gyro_core.c
+++ b/drivers/iio/gyro/st_gyro_core.c
@@ -345,6 +345,9 @@ int st_gyro_common_probe(struct iio_dev *indio_dev,
 	if (err && irq > 0)
 		goto st_gyro_device_register_error;
 
+	if (!err)
+		dev_info(&indio_dev->dev, "Successfully registered\n");
+
 	return err;
 
 st_gyro_device_register_error:
-- 
1.8.1.2

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

* [PATCH 36/38] iio: magn-core: st: Clean up error handling in probe()
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Reduce the amount of those unnecessary goto calls, as in most cases
we can simply return immediately. We also only call for the IRQ number
once and use that value throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/magnetometer/st_magn_core.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
index e8d2849..c252659 100644
--- a/drivers/iio/magnetometer/st_magn_core.c
+++ b/drivers/iio/magnetometer/st_magn_core.c
@@ -348,8 +348,9 @@ static const struct iio_info magn_info = {
 int st_magn_common_probe(struct iio_dev *indio_dev,
 					struct st_sensors_platform_data *pdata)
 {
-	int err;
 	struct st_sensor_data *mdata = iio_priv(indio_dev);
+	int irq = mdata->get_irq_data_ready(indio_dev);
+	int err;
 
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = &magn_info;
@@ -357,7 +358,7 @@ int st_magn_common_probe(struct iio_dev *indio_dev,
 	err = st_sensors_check_device_support(indio_dev,
 				ARRAY_SIZE(st_magn_sensors), st_magn_sensors);
 	if (err < 0)
-		goto st_magn_common_probe_error;
+		return err;
 
 	mdata->num_data_channels = ST_MAGN_NUMBER_DATA_CHANNELS;
 	mdata->multiread_bit = mdata->sensor->multi_read_bit;
@@ -370,30 +371,28 @@ int st_magn_common_probe(struct iio_dev *indio_dev,
 
 	err = st_sensors_init_sensor(indio_dev, pdata);
 	if (err < 0)
-		goto st_magn_common_probe_error;
+		return err;
 
-	if (mdata->get_irq_data_ready(indio_dev) > 0) {
+	if (irq > 0) {
 		err = st_magn_allocate_ring(indio_dev);
 		if (err < 0)
-			goto st_magn_common_probe_error;
+			return err;
 		err = st_sensors_allocate_trigger(indio_dev, NULL);
 		if (err < 0)
 			goto st_magn_probe_trigger_error;
 	}
 
 	err = iio_device_register(indio_dev);
-	if (err)
+	if (err && irq > 0)
 		goto st_magn_device_register_error;
 
 	return err;
 
 st_magn_device_register_error:
-	if (mdata->get_irq_data_ready(indio_dev) > 0)
-		st_sensors_deallocate_trigger(indio_dev);
+	st_sensors_deallocate_trigger(indio_dev);
 st_magn_probe_trigger_error:
-	if (mdata->get_irq_data_ready(indio_dev) > 0)
-		st_magn_deallocate_ring(indio_dev);
-st_magn_common_probe_error:
+	st_magn_deallocate_ring(indio_dev);
+
 	return err;
 }
 EXPORT_SYMBOL(st_magn_common_probe);
-- 
1.8.1.2


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

* [PATCH 36/38] iio: magn-core: st: Clean up error handling in probe()
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Reduce the amount of those unnecessary goto calls, as in most cases
we can simply return immediately. We also only call for the IRQ number
once and use that value throughout.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/magnetometer/st_magn_core.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
index e8d2849..c252659 100644
--- a/drivers/iio/magnetometer/st_magn_core.c
+++ b/drivers/iio/magnetometer/st_magn_core.c
@@ -348,8 +348,9 @@ static const struct iio_info magn_info = {
 int st_magn_common_probe(struct iio_dev *indio_dev,
 					struct st_sensors_platform_data *pdata)
 {
-	int err;
 	struct st_sensor_data *mdata = iio_priv(indio_dev);
+	int irq = mdata->get_irq_data_ready(indio_dev);
+	int err;
 
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = &magn_info;
@@ -357,7 +358,7 @@ int st_magn_common_probe(struct iio_dev *indio_dev,
 	err = st_sensors_check_device_support(indio_dev,
 				ARRAY_SIZE(st_magn_sensors), st_magn_sensors);
 	if (err < 0)
-		goto st_magn_common_probe_error;
+		return err;
 
 	mdata->num_data_channels = ST_MAGN_NUMBER_DATA_CHANNELS;
 	mdata->multiread_bit = mdata->sensor->multi_read_bit;
@@ -370,30 +371,28 @@ int st_magn_common_probe(struct iio_dev *indio_dev,
 
 	err = st_sensors_init_sensor(indio_dev, pdata);
 	if (err < 0)
-		goto st_magn_common_probe_error;
+		return err;
 
-	if (mdata->get_irq_data_ready(indio_dev) > 0) {
+	if (irq > 0) {
 		err = st_magn_allocate_ring(indio_dev);
 		if (err < 0)
-			goto st_magn_common_probe_error;
+			return err;
 		err = st_sensors_allocate_trigger(indio_dev, NULL);
 		if (err < 0)
 			goto st_magn_probe_trigger_error;
 	}
 
 	err = iio_device_register(indio_dev);
-	if (err)
+	if (err && irq > 0)
 		goto st_magn_device_register_error;
 
 	return err;
 
 st_magn_device_register_error:
-	if (mdata->get_irq_data_ready(indio_dev) > 0)
-		st_sensors_deallocate_trigger(indio_dev);
+	st_sensors_deallocate_trigger(indio_dev);
 st_magn_probe_trigger_error:
-	if (mdata->get_irq_data_ready(indio_dev) > 0)
-		st_magn_deallocate_ring(indio_dev);
-st_magn_common_probe_error:
+	st_magn_deallocate_ring(indio_dev);
+
 	return err;
 }
 EXPORT_SYMBOL(st_magn_common_probe);
-- 
1.8.1.2

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

* [PATCH 37/38] iio: magn-core: st: Give some indication if device probing was successful
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

At the moment the driver is silent in some error cases and if successful.
Prior to this patch there was no clear way to know if the driver succeeded
or not without looking deep into sysfs.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/magnetometer/st_magn_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
index c252659..12e7e79 100644
--- a/drivers/iio/magnetometer/st_magn_core.c
+++ b/drivers/iio/magnetometer/st_magn_core.c
@@ -386,6 +386,9 @@ int st_magn_common_probe(struct iio_dev *indio_dev,
 	if (err && irq > 0)
 		goto st_magn_device_register_error;
 
+	if (!err)
+		dev_info(&indio_dev->dev, "Successfully registered\n");
+
 	return err;
 
 st_magn_device_register_error:
-- 
1.8.1.2


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

* [PATCH 37/38] iio: magn-core: st: Give some indication if device probing was successful
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

At the moment the driver is silent in some error cases and if successful.
Prior to this patch there was no clear way to know if the driver succeeded
or not without looking deep into sysfs.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/magnetometer/st_magn_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
index c252659..12e7e79 100644
--- a/drivers/iio/magnetometer/st_magn_core.c
+++ b/drivers/iio/magnetometer/st_magn_core.c
@@ -386,6 +386,9 @@ int st_magn_common_probe(struct iio_dev *indio_dev,
 	if (err && irq > 0)
 		goto st_magn_device_register_error;
 
+	if (!err)
+		dev_info(&indio_dev->dev, "Successfully registered\n");
+
 	return err;
 
 st_magn_device_register_error:
-- 
1.8.1.2

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

* [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
  2013-09-10 12:49 ` Lee Jones
@ 2013-09-10 12:49   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio, Lee Jones

Trivial patch adding the LSM303DLH to the list of already supported
Magnetometer Sensors.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/magnetometer/st_magn.h      | 1 +
 drivers/iio/magnetometer/st_magn_core.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/magnetometer/st_magn.h b/drivers/iio/magnetometer/st_magn.h
index f185720..19b53e3 100644
--- a/drivers/iio/magnetometer/st_magn.h
+++ b/drivers/iio/magnetometer/st_magn.h
@@ -15,6 +15,7 @@
 #include <linux/iio/common/st_sensors.h>
 
 #define LSM303DLHC_MAGN_DEV_NAME	"lsm303dlhc_magn"
+#define LSM303DLH_MAGN_DEV_NAME		"lsm303dlh_magn"
 #define LSM303DLM_MAGN_DEV_NAME		"lsm303dlm_magn"
 #define LIS3MDL_MAGN_DEV_NAME		"lis3mdl_magn"
 
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
index 12e7e79..b2e2917 100644
--- a/drivers/iio/magnetometer/st_magn_core.c
+++ b/drivers/iio/magnetometer/st_magn_core.c
@@ -151,7 +151,8 @@ static const struct st_sensors st_magn_sensors[] = {
 		.wai = ST_MAGN_1_WAI_EXP,
 		.sensors_supported = {
 			[0] = LSM303DLHC_MAGN_DEV_NAME,
-			[1] = LSM303DLM_MAGN_DEV_NAME,
+			[1] = LSM303DLH_MAGN_DEV_NAME,
+			[0] = LSM303DLM_MAGN_DEV_NAME,
 		},
 		.ch = (struct iio_chan_spec *)st_magn_16bit_channels,
 		.odr = {
-- 
1.8.1.2


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

* [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
@ 2013-09-10 12:49   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

Trivial patch adding the LSM303DLH to the list of already supported
Magnetometer Sensors.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/iio/magnetometer/st_magn.h      | 1 +
 drivers/iio/magnetometer/st_magn_core.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/magnetometer/st_magn.h b/drivers/iio/magnetometer/st_magn.h
index f185720..19b53e3 100644
--- a/drivers/iio/magnetometer/st_magn.h
+++ b/drivers/iio/magnetometer/st_magn.h
@@ -15,6 +15,7 @@
 #include <linux/iio/common/st_sensors.h>
 
 #define LSM303DLHC_MAGN_DEV_NAME	"lsm303dlhc_magn"
+#define LSM303DLH_MAGN_DEV_NAME		"lsm303dlh_magn"
 #define LSM303DLM_MAGN_DEV_NAME		"lsm303dlm_magn"
 #define LIS3MDL_MAGN_DEV_NAME		"lis3mdl_magn"
 
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
index 12e7e79..b2e2917 100644
--- a/drivers/iio/magnetometer/st_magn_core.c
+++ b/drivers/iio/magnetometer/st_magn_core.c
@@ -151,7 +151,8 @@ static const struct st_sensors st_magn_sensors[] = {
 		.wai = ST_MAGN_1_WAI_EXP,
 		.sensors_supported = {
 			[0] = LSM303DLHC_MAGN_DEV_NAME,
-			[1] = LSM303DLM_MAGN_DEV_NAME,
+			[1] = LSM303DLH_MAGN_DEV_NAME,
+			[0] = LSM303DLM_MAGN_DEV_NAME,
 		},
 		.ch = (struct iio_chan_spec *)st_magn_16bit_channels,
 		.odr = {
-- 
1.8.1.2

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

* Re: [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
  2013-09-10 12:49   ` Lee Jones
  (?)
@ 2013-09-10 15:20     ` Olof Johansson
  -1 siblings, 0 replies; 246+ messages in thread
From: Olof Johansson @ 2013-09-10 15:20 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, jic23, Arnd Bergmann, LinusW,
	denis.ciocca, linux-iio

On Tue, Sep 10, 2013 at 5:49 AM, Lee Jones <lee.jones@linaro.org> wrote:
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  arch/arm/configs/u8500_defconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
> index 6b29109..24f88d6 100644
> --- a/arch/arm/configs/u8500_defconfig
> +++ b/arch/arm/configs/u8500_defconfig
> @@ -39,6 +39,7 @@ CONFIG_BLK_DEV_RAM_SIZE=65536
>  CONFIG_SENSORS_BH1780=y
>  CONFIG_IIO=y
>  CONFIG_IIO_ST_PRESS=y
> +CONFIG_IIO_ST_ACCEL_3AXIS=y
>  CONFIG_NETDEVICES=y
>  CONFIG_SMSC911X=y
>  CONFIG_SMSC_PHY=y

This is ridiculous.

I know lwn.net's patch author statistics are fun to be on, but
splitting this and the other config update into two patches? Really?


-Olof

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

* Re: [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
@ 2013-09-10 15:20     ` Olof Johansson
  0 siblings, 0 replies; 246+ messages in thread
From: Olof Johansson @ 2013-09-10 15:20 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, jic23, Arnd Bergmann, LinusW,
	denis.ciocca, linux-iio

On Tue, Sep 10, 2013 at 5:49 AM, Lee Jones <lee.jones@linaro.org> wrote:
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  arch/arm/configs/u8500_defconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
> index 6b29109..24f88d6 100644
> --- a/arch/arm/configs/u8500_defconfig
> +++ b/arch/arm/configs/u8500_defconfig
> @@ -39,6 +39,7 @@ CONFIG_BLK_DEV_RAM_SIZE=65536
>  CONFIG_SENSORS_BH1780=y
>  CONFIG_IIO=y
>  CONFIG_IIO_ST_PRESS=y
> +CONFIG_IIO_ST_ACCEL_3AXIS=y
>  CONFIG_NETDEVICES=y
>  CONFIG_SMSC911X=y
>  CONFIG_SMSC_PHY=y

This is ridiculous.

I know lwn.net's patch author statistics are fun to be on, but
splitting this and the other config update into two patches? Really?


-Olof

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

* [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
@ 2013-09-10 15:20     ` Olof Johansson
  0 siblings, 0 replies; 246+ messages in thread
From: Olof Johansson @ 2013-09-10 15:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Sep 10, 2013 at 5:49 AM, Lee Jones <lee.jones@linaro.org> wrote:
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  arch/arm/configs/u8500_defconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
> index 6b29109..24f88d6 100644
> --- a/arch/arm/configs/u8500_defconfig
> +++ b/arch/arm/configs/u8500_defconfig
> @@ -39,6 +39,7 @@ CONFIG_BLK_DEV_RAM_SIZE=65536
>  CONFIG_SENSORS_BH1780=y
>  CONFIG_IIO=y
>  CONFIG_IIO_ST_PRESS=y
> +CONFIG_IIO_ST_ACCEL_3AXIS=y
>  CONFIG_NETDEVICES=y
>  CONFIG_SMSC911X=y
>  CONFIG_SMSC_PHY=y

This is ridiculous.

I know lwn.net's patch author statistics are fun to be on, but
splitting this and the other config update into two patches? Really?


-Olof

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

* Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
  2013-09-10 12:49   ` Lee Jones
  (?)
@ 2013-09-10 15:23     ` Olof Johansson
  -1 siblings, 0 replies; 246+ messages in thread
From: Olof Johansson @ 2013-09-10 15:23 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, jic23, linux-iio, LinusW,
	denis.ciocca, Arnd Bergmann

Hi,

On Tue, Sep 10, 2013 at 5:49 AM, Lee Jones <lee.jones@linaro.org> wrote:
> Turns out that they're actually not required and the driver probes just
> fine without them. The ID is incorrect at the moment anyway. They actually
> currently specify the stn8815.
>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>

How did you test this patch? What hardware did you boot it on and with
what config?

Thanks!

-Olof

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

* Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
@ 2013-09-10 15:23     ` Olof Johansson
  0 siblings, 0 replies; 246+ messages in thread
From: Olof Johansson @ 2013-09-10 15:23 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, jic23, linux-iio, LinusW,
	denis.ciocca, Arnd Bergmann

Hi,

On Tue, Sep 10, 2013 at 5:49 AM, Lee Jones <lee.jones@linaro.org> wrote:
> Turns out that they're actually not required and the driver probes just
> fine without them. The ID is incorrect at the moment anyway. They actually
> currently specify the stn8815.
>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>

How did you test this patch? What hardware did you boot it on and with
what config?

Thanks!

-Olof

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

* [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
@ 2013-09-10 15:23     ` Olof Johansson
  0 siblings, 0 replies; 246+ messages in thread
From: Olof Johansson @ 2013-09-10 15:23 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Tue, Sep 10, 2013 at 5:49 AM, Lee Jones <lee.jones@linaro.org> wrote:
> Turns out that they're actually not required and the driver probes just
> fine without them. The ID is incorrect at the moment anyway. They actually
> currently specify the stn8815.
>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>

How did you test this patch? What hardware did you boot it on and with
what config?

Thanks!

-Olof

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

* Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
  2013-09-10 15:23     ` Olof Johansson
  (?)
@ 2013-09-10 15:30       ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 15:30 UTC (permalink / raw)
  To: Olof Johansson
  Cc: linux-arm-kernel, linux-kernel, jic23, linux-iio, LinusW,
	denis.ciocca, Arnd Bergmann

> On Tue, Sep 10, 2013 at 5:49 AM, Lee Jones <lee.jones@linaro.org> wrote:
> > Turns out that they're actually not required and the driver probes just
> > fine without them. The ID is incorrect at the moment anyway. They actually
> > currently specify the stn8815.
> >
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> 
> How did you test this patch? What hardware did you boot it on and with
> what config?

Snowball, u8500_defconfig.

Why? Don't you have the same result with yours?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
@ 2013-09-10 15:30       ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 15:30 UTC (permalink / raw)
  To: Olof Johansson
  Cc: linux-arm-kernel, linux-kernel, jic23, linux-iio, LinusW,
	denis.ciocca, Arnd Bergmann

> On Tue, Sep 10, 2013 at 5:49 AM, Lee Jones <lee.jones@linaro.org> wrote:
> > Turns out that they're actually not required and the driver probes just
> > fine without them. The ID is incorrect at the moment anyway. They actually
> > currently specify the stn8815.
> >
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> 
> How did you test this patch? What hardware did you boot it on and with
> what config?

Snowball, u8500_defconfig.

Why? Don't you have the same result with yours?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
@ 2013-09-10 15:30       ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 15:30 UTC (permalink / raw)
  To: linux-arm-kernel

> On Tue, Sep 10, 2013 at 5:49 AM, Lee Jones <lee.jones@linaro.org> wrote:
> > Turns out that they're actually not required and the driver probes just
> > fine without them. The ID is incorrect at the moment anyway. They actually
> > currently specify the stn8815.
> >
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> 
> How did you test this patch? What hardware did you boot it on and with
> what config?

Snowball, u8500_defconfig.

Why? Don't you have the same result with yours?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
  2013-09-10 15:20     ` Olof Johansson
  (?)
@ 2013-09-10 15:35       ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 15:35 UTC (permalink / raw)
  To: Olof Johansson
  Cc: linux-arm-kernel, linux-kernel, jic23, Arnd Bergmann, LinusW,
	denis.ciocca, linux-iio

On Tue, 10 Sep 2013, Olof Johansson wrote:

> On Tue, Sep 10, 2013 at 5:49 AM, Lee Jones <lee.jones@linaro.org> wrote:
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > ---
> >  arch/arm/configs/u8500_defconfig | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
> > index 6b29109..24f88d6 100644
> > --- a/arch/arm/configs/u8500_defconfig
> > +++ b/arch/arm/configs/u8500_defconfig
> > @@ -39,6 +39,7 @@ CONFIG_BLK_DEV_RAM_SIZE=65536
> >  CONFIG_SENSORS_BH1780=y
> >  CONFIG_IIO=y
> >  CONFIG_IIO_ST_PRESS=y
> > +CONFIG_IIO_ST_ACCEL_3AXIS=y
> >  CONFIG_NETDEVICES=y
> >  CONFIG_SMSC911X=y
> >  CONFIG_SMSC_PHY=y
> 
> This is ridiculous.
> 
> I know lwn.net's patch author statistics are fun to be on, but

Jealousy won't get you anywhere... ;)

> splitting this and the other config update into two patches? Really?

I haven't split anything. I created the patches as I was
enabling/testing the drivers, which was at completely different
times. The only reason they're close together in the set is because I
reorganised it and didn't think it was necessary to squash them
together.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
@ 2013-09-10 15:35       ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 15:35 UTC (permalink / raw)
  To: Olof Johansson
  Cc: linux-arm-kernel, linux-kernel, jic23, Arnd Bergmann, LinusW,
	denis.ciocca, linux-iio

On Tue, 10 Sep 2013, Olof Johansson wrote:

> On Tue, Sep 10, 2013 at 5:49 AM, Lee Jones <lee.jones@linaro.org> wrote:
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > ---
> >  arch/arm/configs/u8500_defconfig | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
> > index 6b29109..24f88d6 100644
> > --- a/arch/arm/configs/u8500_defconfig
> > +++ b/arch/arm/configs/u8500_defconfig
> > @@ -39,6 +39,7 @@ CONFIG_BLK_DEV_RAM_SIZE=65536
> >  CONFIG_SENSORS_BH1780=y
> >  CONFIG_IIO=y
> >  CONFIG_IIO_ST_PRESS=y
> > +CONFIG_IIO_ST_ACCEL_3AXIS=y
> >  CONFIG_NETDEVICES=y
> >  CONFIG_SMSC911X=y
> >  CONFIG_SMSC_PHY=y
> 
> This is ridiculous.
> 
> I know lwn.net's patch author statistics are fun to be on, but

Jealousy won't get you anywhere... ;)

> splitting this and the other config update into two patches? Really?

I haven't split anything. I created the patches as I was
enabling/testing the drivers, which was at completely different
times. The only reason they're close together in the set is because I
reorganised it and didn't think it was necessary to squash them
together.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
@ 2013-09-10 15:35       ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-10 15:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 10 Sep 2013, Olof Johansson wrote:

> On Tue, Sep 10, 2013 at 5:49 AM, Lee Jones <lee.jones@linaro.org> wrote:
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > ---
> >  arch/arm/configs/u8500_defconfig | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
> > index 6b29109..24f88d6 100644
> > --- a/arch/arm/configs/u8500_defconfig
> > +++ b/arch/arm/configs/u8500_defconfig
> > @@ -39,6 +39,7 @@ CONFIG_BLK_DEV_RAM_SIZE=65536
> >  CONFIG_SENSORS_BH1780=y
> >  CONFIG_IIO=y
> >  CONFIG_IIO_ST_PRESS=y
> > +CONFIG_IIO_ST_ACCEL_3AXIS=y
> >  CONFIG_NETDEVICES=y
> >  CONFIG_SMSC911X=y
> >  CONFIG_SMSC_PHY=y
> 
> This is ridiculous.
> 
> I know lwn.net's patch author statistics are fun to be on, but

Jealousy won't get you anywhere... ;)

> splitting this and the other config update into two patches? Really?

I haven't split anything. I created the patches as I was
enabling/testing the drivers, which was at completely different
times. The only reason they're close together in the set is because I
reorganised it and didn't think it was necessary to squash them
together.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 26/38] iio: pressure-core: st: Clean-up probe() function
  2013-09-10 12:49   ` Lee Jones
  (?)
@ 2013-09-10 16:23     ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-10 16:23 UTC (permalink / raw)
  To: Lee Jones, linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio



Lee Jones <lee.jones@linaro.org> wrote:
>This patch contains some pretty basic clean-ups in probe() pertaining
>to
>the simplification of error handling and a couple of readability
>adaptions.
>
>Signed-off-by: Lee Jones <lee.jones@linaro.org>
>---
>drivers/iio/pressure/st_pressure_core.c | 32
>++++++++++++++++----------------
> 1 file changed, 16 insertions(+), 16 deletions(-)
>
>diff --git a/drivers/iio/pressure/st_pressure_core.c
>b/drivers/iio/pressure/st_pressure_core.c
>index 3abada2..6ffd949 100644
>--- a/drivers/iio/pressure/st_pressure_core.c
>+++ b/drivers/iio/pressure/st_pressure_core.c
>@@ -232,21 +232,23 @@ static const struct iio_trigger_ops
>st_press_trigger_ops = {
> int st_press_common_probe(struct iio_dev *indio_dev,
> 				struct st_sensors_platform_data *plat_data)
> {
>-	int err;
> 	struct st_sensor_data *pdata = iio_priv(indio_dev);
>+	int irq = pdata->get_irq_data_ready(indio_dev);
>+	int err;
> 
> 	indio_dev->modes = INDIO_DIRECT_MODE;
> 	indio_dev->info = &press_info;
> 
> 	err = st_sensors_check_device_support(indio_dev,
>-				ARRAY_SIZE(st_press_sensors), st_press_sensors);
>+					      ARRAY_SIZE(st_press_sensors),
>+					      st_press_sensors);
> 	if (err < 0)
>-		goto st_press_common_probe_error;
>+		return err;
> 
> 	pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS;
>-	pdata->multiread_bit = pdata->sensor->multi_read_bit;
>-	indio_dev->channels = pdata->sensor->ch;
>-	indio_dev->num_channels = pdata->sensor->num_ch;
>+	pdata->multiread_bit     = pdata->sensor->multi_read_bit;
>+	indio_dev->channels      = pdata->sensor->ch;
>+	indio_dev->num_channels  = pdata->sensor->num_ch;
> 
> 	if (pdata->sensor->fs.addr != 0)
> 		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
>@@ -261,32 +263,30 @@ int st_press_common_probe(struct iio_dev
>*indio_dev,
> 
> 	err = st_sensors_init_sensor(indio_dev, plat_data);
> 	if (err < 0)
>-		goto st_press_common_probe_error;
>+		return err;
> 
>-	if (pdata->get_irq_data_ready(indio_dev) > 0) {
>+	if (irq > 0) {
> 		err = st_press_allocate_ring(indio_dev);
> 		if (err < 0)
>-			goto st_press_common_probe_error;
>+			return err;
> 
> 		err = st_sensors_allocate_trigger(indio_dev,
>-							ST_PRESS_TRIGGER_OPS);
>+						  ST_PRESS_TRIGGER_OPS);
> 		if (err < 0)
> 			goto st_press_probe_trigger_error;
> 	}
> 
> 	err = iio_device_register(indio_dev);
>-	if (err)

This bit of handling is confusing. I would much rather see the if IRQ at the goto. Here the first thought is why is it not an error if there is no IRQ! 
>+	if (err && irq > 0)
> 		goto st_press_device_register_error;
> 
> 	return err;
> 
> st_press_device_register_error:
>-	if (pdata->get_irq_data_ready(indio_dev) > 0)
>-		st_sensors_deallocate_trigger(indio_dev);
>+	st_sensors_deallocate_trigger(indio_dev);
> st_press_probe_trigger_error:
>-	if (pdata->get_irq_data_ready(indio_dev) > 0)
>-		st_press_deallocate_ring(indio_dev);
>-st_press_common_probe_error:
>+	st_press_deallocate_ring(indio_dev);
>+
> 	return err;
> }
> EXPORT_SYMBOL(st_press_common_probe);

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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

* Re: [PATCH 26/38] iio: pressure-core: st: Clean-up probe() function
@ 2013-09-10 16:23     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-10 16:23 UTC (permalink / raw)
  To: Lee Jones, linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio



Lee Jones <lee.jones@linaro.org> wrote:
>This patch contains some pretty basic clean-ups in probe() pertaining
>to
>the simplification of error handling and a couple of readability
>adaptions.
>
>Signed-off-by: Lee Jones <lee.jones@linaro.org>
>---
>drivers/iio/pressure/st_pressure_core.c | 32
>++++++++++++++++----------------
> 1 file changed, 16 insertions(+), 16 deletions(-)
>
>diff --git a/drivers/iio/pressure/st_pressure_core.c
>b/drivers/iio/pressure/st_pressure_core.c
>index 3abada2..6ffd949 100644
>--- a/drivers/iio/pressure/st_pressure_core.c
>+++ b/drivers/iio/pressure/st_pressure_core.c
>@@ -232,21 +232,23 @@ static const struct iio_trigger_ops
>st_press_trigger_ops = {
> int st_press_common_probe(struct iio_dev *indio_dev,
> 				struct st_sensors_platform_data *plat_data)
> {
>-	int err;
> 	struct st_sensor_data *pdata = iio_priv(indio_dev);
>+	int irq = pdata->get_irq_data_ready(indio_dev);
>+	int err;
> 
> 	indio_dev->modes = INDIO_DIRECT_MODE;
> 	indio_dev->info = &press_info;
> 
> 	err = st_sensors_check_device_support(indio_dev,
>-				ARRAY_SIZE(st_press_sensors), st_press_sensors);
>+					      ARRAY_SIZE(st_press_sensors),
>+					      st_press_sensors);
> 	if (err < 0)
>-		goto st_press_common_probe_error;
>+		return err;
> 
> 	pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS;
>-	pdata->multiread_bit = pdata->sensor->multi_read_bit;
>-	indio_dev->channels = pdata->sensor->ch;
>-	indio_dev->num_channels = pdata->sensor->num_ch;
>+	pdata->multiread_bit     = pdata->sensor->multi_read_bit;
>+	indio_dev->channels      = pdata->sensor->ch;
>+	indio_dev->num_channels  = pdata->sensor->num_ch;
> 
> 	if (pdata->sensor->fs.addr != 0)
> 		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
>@@ -261,32 +263,30 @@ int st_press_common_probe(struct iio_dev
>*indio_dev,
> 
> 	err = st_sensors_init_sensor(indio_dev, plat_data);
> 	if (err < 0)
>-		goto st_press_common_probe_error;
>+		return err;
> 
>-	if (pdata->get_irq_data_ready(indio_dev) > 0) {
>+	if (irq > 0) {
> 		err = st_press_allocate_ring(indio_dev);
> 		if (err < 0)
>-			goto st_press_common_probe_error;
>+			return err;
> 
> 		err = st_sensors_allocate_trigger(indio_dev,
>-							ST_PRESS_TRIGGER_OPS);
>+						  ST_PRESS_TRIGGER_OPS);
> 		if (err < 0)
> 			goto st_press_probe_trigger_error;
> 	}
> 
> 	err = iio_device_register(indio_dev);
>-	if (err)

This bit of handling is confusing. I would much rather see the if IRQ at the goto. Here the first thought is why is it not an error if there is no IRQ! 
>+	if (err && irq > 0)
> 		goto st_press_device_register_error;
> 
> 	return err;
> 
> st_press_device_register_error:
>-	if (pdata->get_irq_data_ready(indio_dev) > 0)
>-		st_sensors_deallocate_trigger(indio_dev);
>+	st_sensors_deallocate_trigger(indio_dev);
> st_press_probe_trigger_error:
>-	if (pdata->get_irq_data_ready(indio_dev) > 0)
>-		st_press_deallocate_ring(indio_dev);
>-st_press_common_probe_error:
>+	st_press_deallocate_ring(indio_dev);
>+
> 	return err;
> }
> EXPORT_SYMBOL(st_press_common_probe);

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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

* [PATCH 26/38] iio: pressure-core: st: Clean-up probe() function
@ 2013-09-10 16:23     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-10 16:23 UTC (permalink / raw)
  To: linux-arm-kernel



Lee Jones <lee.jones@linaro.org> wrote:
>This patch contains some pretty basic clean-ups in probe() pertaining
>to
>the simplification of error handling and a couple of readability
>adaptions.
>
>Signed-off-by: Lee Jones <lee.jones@linaro.org>
>---
>drivers/iio/pressure/st_pressure_core.c | 32
>++++++++++++++++----------------
> 1 file changed, 16 insertions(+), 16 deletions(-)
>
>diff --git a/drivers/iio/pressure/st_pressure_core.c
>b/drivers/iio/pressure/st_pressure_core.c
>index 3abada2..6ffd949 100644
>--- a/drivers/iio/pressure/st_pressure_core.c
>+++ b/drivers/iio/pressure/st_pressure_core.c
>@@ -232,21 +232,23 @@ static const struct iio_trigger_ops
>st_press_trigger_ops = {
> int st_press_common_probe(struct iio_dev *indio_dev,
> 				struct st_sensors_platform_data *plat_data)
> {
>-	int err;
> 	struct st_sensor_data *pdata = iio_priv(indio_dev);
>+	int irq = pdata->get_irq_data_ready(indio_dev);
>+	int err;
> 
> 	indio_dev->modes = INDIO_DIRECT_MODE;
> 	indio_dev->info = &press_info;
> 
> 	err = st_sensors_check_device_support(indio_dev,
>-				ARRAY_SIZE(st_press_sensors), st_press_sensors);
>+					      ARRAY_SIZE(st_press_sensors),
>+					      st_press_sensors);
> 	if (err < 0)
>-		goto st_press_common_probe_error;
>+		return err;
> 
> 	pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS;
>-	pdata->multiread_bit = pdata->sensor->multi_read_bit;
>-	indio_dev->channels = pdata->sensor->ch;
>-	indio_dev->num_channels = pdata->sensor->num_ch;
>+	pdata->multiread_bit     = pdata->sensor->multi_read_bit;
>+	indio_dev->channels      = pdata->sensor->ch;
>+	indio_dev->num_channels  = pdata->sensor->num_ch;
> 
> 	if (pdata->sensor->fs.addr != 0)
> 		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
>@@ -261,32 +263,30 @@ int st_press_common_probe(struct iio_dev
>*indio_dev,
> 
> 	err = st_sensors_init_sensor(indio_dev, plat_data);
> 	if (err < 0)
>-		goto st_press_common_probe_error;
>+		return err;
> 
>-	if (pdata->get_irq_data_ready(indio_dev) > 0) {
>+	if (irq > 0) {
> 		err = st_press_allocate_ring(indio_dev);
> 		if (err < 0)
>-			goto st_press_common_probe_error;
>+			return err;
> 
> 		err = st_sensors_allocate_trigger(indio_dev,
>-							ST_PRESS_TRIGGER_OPS);
>+						  ST_PRESS_TRIGGER_OPS);
> 		if (err < 0)
> 			goto st_press_probe_trigger_error;
> 	}
> 
> 	err = iio_device_register(indio_dev);
>-	if (err)

This bit of handling is confusing. I would much rather see the if IRQ at the goto. Here the first thought is why is it not an error if there is no IRQ! 
>+	if (err && irq > 0)
> 		goto st_press_device_register_error;
> 
> 	return err;
> 
> st_press_device_register_error:
>-	if (pdata->get_irq_data_ready(indio_dev) > 0)
>-		st_sensors_deallocate_trigger(indio_dev);
>+	st_sensors_deallocate_trigger(indio_dev);
> st_press_probe_trigger_error:
>-	if (pdata->get_irq_data_ready(indio_dev) > 0)
>-		st_press_deallocate_ring(indio_dev);
>-st_press_common_probe_error:
>+	st_press_deallocate_ring(indio_dev);
>+
> 	return err;
> }
> EXPORT_SYMBOL(st_press_common_probe);

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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

* Re: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
  2013-09-10 12:49   ` Lee Jones
  (?)
@ 2013-09-10 16:25     ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-10 16:25 UTC (permalink / raw)
  To: Lee Jones, linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio



Lee Jones <lee.jones@linaro.org> wrote:
>At the moment the driver is silent in some error cases and if
>successful.
>Prior to this patch there was no clear way to know if the driver
>succeeded
>or not without looking deep into sysfs.
>
>Signed-off-by: Lee Jones <lee.jones@linaro.org>
>---
> drivers/iio/pressure/st_pressure_core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
>diff --git a/drivers/iio/pressure/st_pressure_core.c
>b/drivers/iio/pressure/st_pressure_core.c
>index 6ffd949..34b3fb1 100644
>--- a/drivers/iio/pressure/st_pressure_core.c
>+++ b/drivers/iio/pressure/st_pressure_core.c
>@@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev
>*indio_dev,
> 	if (err && irq > 0)
> 		goto st_press_device_register_error;
> 
>+	if (!err)
>+		dev_info(&indio_dev->dev, "Successfully registered\n");
>+
Not keen. That to my mind is pointless noise. If this made sense then it would be in the driver core not here.
> 	return err;
> 
> st_press_device_register_error:

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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

* Re: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
@ 2013-09-10 16:25     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-10 16:25 UTC (permalink / raw)
  To: Lee Jones, linux-arm-kernel, linux-kernel, jic23
  Cc: arnd, linus.walleij, denis.ciocca, linux-iio



Lee Jones <lee.jones@linaro.org> wrote:
>At the moment the driver is silent in some error cases and if
>successful.
>Prior to this patch there was no clear way to know if the driver
>succeeded
>or not without looking deep into sysfs.
>
>Signed-off-by: Lee Jones <lee.jones@linaro.org>
>---
> drivers/iio/pressure/st_pressure_core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
>diff --git a/drivers/iio/pressure/st_pressure_core.c
>b/drivers/iio/pressure/st_pressure_core.c
>index 6ffd949..34b3fb1 100644
>--- a/drivers/iio/pressure/st_pressure_core.c
>+++ b/drivers/iio/pressure/st_pressure_core.c
>@@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev
>*indio_dev,
> 	if (err && irq > 0)
> 		goto st_press_device_register_error;
> 
>+	if (!err)
>+		dev_info(&indio_dev->dev, "Successfully registered\n");
>+
Not keen. That to my mind is pointless noise. If this made sense then it would be in the driver core not here.
> 	return err;
> 
> st_press_device_register_error:

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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

* [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
@ 2013-09-10 16:25     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-10 16:25 UTC (permalink / raw)
  To: linux-arm-kernel



Lee Jones <lee.jones@linaro.org> wrote:
>At the moment the driver is silent in some error cases and if
>successful.
>Prior to this patch there was no clear way to know if the driver
>succeeded
>or not without looking deep into sysfs.
>
>Signed-off-by: Lee Jones <lee.jones@linaro.org>
>---
> drivers/iio/pressure/st_pressure_core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
>diff --git a/drivers/iio/pressure/st_pressure_core.c
>b/drivers/iio/pressure/st_pressure_core.c
>index 6ffd949..34b3fb1 100644
>--- a/drivers/iio/pressure/st_pressure_core.c
>+++ b/drivers/iio/pressure/st_pressure_core.c
>@@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev
>*indio_dev,
> 	if (err && irq > 0)
> 		goto st_press_device_register_error;
> 
>+	if (!err)
>+		dev_info(&indio_dev->dev, "Successfully registered\n");
>+
Not keen. That to my mind is pointless noise. If this made sense then it would be in the driver core not here.
> 	return err;
> 
> st_press_device_register_error:

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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

* Re: [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
  2013-09-10 15:35       ` Lee Jones
  (?)
@ 2013-09-10 16:51         ` Olof Johansson
  -1 siblings, 0 replies; 246+ messages in thread
From: Olof Johansson @ 2013-09-10 16:51 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, jic23, Arnd Bergmann, LinusW,
	denis.ciocca, linux-iio

On Tue, Sep 10, 2013 at 8:35 AM, Lee Jones <lee.jones@linaro.org> wrote:

>> splitting this and the other config update into two patches? Really?
>
> I haven't split anything. I created the patches as I was
> enabling/testing the drivers, which was at completely different
> times. The only reason they're close together in the set is because I
> reorganised it and didn't think it was necessary to squash them
> together.

In this case, squashing makes a lot of sense. But you could even have
LinusW do that for you when he pulls in the various config updates for
next release.


-Olof

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

* Re: [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
@ 2013-09-10 16:51         ` Olof Johansson
  0 siblings, 0 replies; 246+ messages in thread
From: Olof Johansson @ 2013-09-10 16:51 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, jic23, Arnd Bergmann, LinusW,
	denis.ciocca, linux-iio

On Tue, Sep 10, 2013 at 8:35 AM, Lee Jones <lee.jones@linaro.org> wrote:

>> splitting this and the other config update into two patches? Really?
>
> I haven't split anything. I created the patches as I was
> enabling/testing the drivers, which was at completely different
> times. The only reason they're close together in the set is because I
> reorganised it and didn't think it was necessary to squash them
> together.

In this case, squashing makes a lot of sense. But you could even have
LinusW do that for you when he pulls in the various config updates for
next release.


-Olof

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

* [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
@ 2013-09-10 16:51         ` Olof Johansson
  0 siblings, 0 replies; 246+ messages in thread
From: Olof Johansson @ 2013-09-10 16:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Sep 10, 2013 at 8:35 AM, Lee Jones <lee.jones@linaro.org> wrote:

>> splitting this and the other config update into two patches? Really?
>
> I haven't split anything. I created the patches as I was
> enabling/testing the drivers, which was at completely different
> times. The only reason they're close together in the set is because I
> reorganised it and didn't think it was necessary to squash them
> together.

In this case, squashing makes a lot of sense. But you could even have
LinusW do that for you when he pulls in the various config updates for
next release.


-Olof

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

* Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
  2013-09-10 15:30       ` Lee Jones
@ 2013-09-10 16:57         ` Olof Johansson
  -1 siblings, 0 replies; 246+ messages in thread
From: Olof Johansson @ 2013-09-10 16:57 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-arm-kernel, linux-kernel, LinusW, Arnd Bergmann

[pruning out the iio list/people]

On Tue, Sep 10, 2013 at 8:30 AM, Lee Jones <lee.jones@linaro.org> wrote:
>> On Tue, Sep 10, 2013 at 5:49 AM, Lee Jones <lee.jones@linaro.org> wrote:
>> > Turns out that they're actually not required and the driver probes just
>> > fine without them. The ID is incorrect at the moment anyway. They actually
>> > currently specify the stn8815.
>> >
>> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
>>
>> How did you test this patch? What hardware did you boot it on and with
>> what config?
>
> Snowball, u8500_defconfig.
>
> Why? Don't you have the same result with yours?

I have a very weird experience with snowball right now. I noticed this
yesterday when I decided to look at why multi_v7_defconfig doesn't
boot on it:

* u8500_defconfig doesn't boot as a DT kernel, since the machine ID is
still enabled. If I disable the machine ID, it doesn't boot.
* Same for multi_v7_defconfig, since that is only DT: It doesn't boot.

Unfortunately I can't get to my home network right now to double-check
boot logs to see if this has changed behavior recently, I'll have to
do that later today. It'd be interesting to hear if you have the same
experience w.r.t. DT on u8500_defconfig though.



-Olof

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

* [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
@ 2013-09-10 16:57         ` Olof Johansson
  0 siblings, 0 replies; 246+ messages in thread
From: Olof Johansson @ 2013-09-10 16:57 UTC (permalink / raw)
  To: linux-arm-kernel

[pruning out the iio list/people]

On Tue, Sep 10, 2013 at 8:30 AM, Lee Jones <lee.jones@linaro.org> wrote:
>> On Tue, Sep 10, 2013 at 5:49 AM, Lee Jones <lee.jones@linaro.org> wrote:
>> > Turns out that they're actually not required and the driver probes just
>> > fine without them. The ID is incorrect at the moment anyway. They actually
>> > currently specify the stn8815.
>> >
>> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
>>
>> How did you test this patch? What hardware did you boot it on and with
>> what config?
>
> Snowball, u8500_defconfig.
>
> Why? Don't you have the same result with yours?

I have a very weird experience with snowball right now. I noticed this
yesterday when I decided to look at why multi_v7_defconfig doesn't
boot on it:

* u8500_defconfig doesn't boot as a DT kernel, since the machine ID is
still enabled. If I disable the machine ID, it doesn't boot.
* Same for multi_v7_defconfig, since that is only DT: It doesn't boot.

Unfortunately I can't get to my home network right now to double-check
boot logs to see if this has changed behavior recently, I'll have to
do that later today. It'd be interesting to hear if you have the same
experience w.r.t. DT on u8500_defconfig though.



-Olof

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

* Re: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
  2013-09-10 16:25     ` Jonathan Cameron
@ 2013-09-11  7:10       ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-11  7:10 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-arm-kernel, linux-kernel, jic23, arnd, linus.walleij,
	denis.ciocca, linux-iio

On Tue, 10 Sep 2013, Jonathan Cameron wrote:
> Lee Jones <lee.jones@linaro.org> wrote:
> >At the moment the driver is silent in some error cases and if
> >successful.
> >Prior to this patch there was no clear way to know if the driver
> >succeeded
> >or not without looking deep into sysfs.
> >
> >Signed-off-by: Lee Jones <lee.jones@linaro.org>
> >---
> > drivers/iio/pressure/st_pressure_core.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> >diff --git a/drivers/iio/pressure/st_pressure_core.c
> >b/drivers/iio/pressure/st_pressure_core.c
> >index 6ffd949..34b3fb1 100644
> >--- a/drivers/iio/pressure/st_pressure_core.c
> >+++ b/drivers/iio/pressure/st_pressure_core.c
> >@@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev
> >*indio_dev,
> > 	if (err && irq > 0)
> > 		goto st_press_device_register_error;
> > 
> >+	if (!err)
> >+		dev_info(&indio_dev->dev, "Successfully registered\n");
> >+
> Not keen. That to my mind is pointless noise.

I think it needs to be somewhere. IIO provides no indication whether
these chips are probed/registered/whathaveyou, or even if the
subsystem is in use. 

One line per hardware component is not noise, IMO it's indicative of
key functionality which is now available:

Bootlog:
<snip>
iio iio: lsm303dlh_accel: Successfully registered
iio iio: l3g4200d_gyro: Successfully registered
iio iio: lps001wp_press: Successfully registered
iio iio: lsm303dlhc_magn: Successfully registered
<snip>

> If this made sense then it would be in the driver core not here.

Also fine. Just anything but silence/NULL reporting.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
@ 2013-09-11  7:10       ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-11  7:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 10 Sep 2013, Jonathan Cameron wrote:
> Lee Jones <lee.jones@linaro.org> wrote:
> >At the moment the driver is silent in some error cases and if
> >successful.
> >Prior to this patch there was no clear way to know if the driver
> >succeeded
> >or not without looking deep into sysfs.
> >
> >Signed-off-by: Lee Jones <lee.jones@linaro.org>
> >---
> > drivers/iio/pressure/st_pressure_core.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> >diff --git a/drivers/iio/pressure/st_pressure_core.c
> >b/drivers/iio/pressure/st_pressure_core.c
> >index 6ffd949..34b3fb1 100644
> >--- a/drivers/iio/pressure/st_pressure_core.c
> >+++ b/drivers/iio/pressure/st_pressure_core.c
> >@@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev
> >*indio_dev,
> > 	if (err && irq > 0)
> > 		goto st_press_device_register_error;
> > 
> >+	if (!err)
> >+		dev_info(&indio_dev->dev, "Successfully registered\n");
> >+
> Not keen. That to my mind is pointless noise.

I think it needs to be somewhere. IIO provides no indication whether
these chips are probed/registered/whathaveyou, or even if the
subsystem is in use. 

One line per hardware component is not noise, IMO it's indicative of
key functionality which is now available:

Bootlog:
<snip>
iio iio: lsm303dlh_accel: Successfully registered
iio iio: l3g4200d_gyro: Successfully registered
iio iio: lps001wp_press: Successfully registered
iio iio: lsm303dlhc_magn: Successfully registered
<snip>

> If this made sense then it would be in the driver core not here.

Also fine. Just anything but silence/NULL reporting.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
  2013-09-11  7:10       ` Lee Jones
@ 2013-09-11  7:18         ` Lars-Peter Clausen
  -1 siblings, 0 replies; 246+ messages in thread
From: Lars-Peter Clausen @ 2013-09-11  7:18 UTC (permalink / raw)
  To: Lee Jones
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, denis.ciocca, linux-iio

On 09/11/2013 09:10 AM, Lee Jones wrote:
> On Tue, 10 Sep 2013, Jonathan Cameron wrote:
>> Lee Jones <lee.jones@linaro.org> wrote:
>>> At the moment the driver is silent in some error cases and if
>>> successful.
>>> Prior to this patch there was no clear way to know if the driver
>>> succeeded
>>> or not without looking deep into sysfs.
>>>
>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>>> ---
>>> drivers/iio/pressure/st_pressure_core.c | 3 +++
>>> 1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/iio/pressure/st_pressure_core.c
>>> b/drivers/iio/pressure/st_pressure_core.c
>>> index 6ffd949..34b3fb1 100644
>>> --- a/drivers/iio/pressure/st_pressure_core.c
>>> +++ b/drivers/iio/pressure/st_pressure_core.c
>>> @@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev
>>> *indio_dev,
>>> 	if (err && irq > 0)
>>> 		goto st_press_device_register_error;
>>>
>>> +	if (!err)
>>> +		dev_info(&indio_dev->dev, "Successfully registered\n");
>>> +
>> Not keen. That to my mind is pointless noise.
>
> I think it needs to be somewhere. IIO provides no indication whether
> these chips are probed/registered/whathaveyou, or even if the
> subsystem is in use.
>
> One line per hardware component is not noise, IMO it's indicative of
> key functionality which is now available:
>
> Bootlog:
> <snip>
> iio iio: lsm303dlh_accel: Successfully registered
> iio iio: l3g4200d_gyro: Successfully registered
> iio iio: lps001wp_press: Successfully registered
> iio iio: lsm303dlhc_magn: Successfully registered
> <snip>
>
>> If this made sense then it would be in the driver core not here.
>
> Also fine. Just anything but silence/NULL reporting.

Silence means everything is good, a message means there is an error. If every 
device that gets probed would spit out a message the log would be scrolling 
forever and you wouldn't be able to see the error messages.

- Lars


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

* [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
@ 2013-09-11  7:18         ` Lars-Peter Clausen
  0 siblings, 0 replies; 246+ messages in thread
From: Lars-Peter Clausen @ 2013-09-11  7:18 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/11/2013 09:10 AM, Lee Jones wrote:
> On Tue, 10 Sep 2013, Jonathan Cameron wrote:
>> Lee Jones <lee.jones@linaro.org> wrote:
>>> At the moment the driver is silent in some error cases and if
>>> successful.
>>> Prior to this patch there was no clear way to know if the driver
>>> succeeded
>>> or not without looking deep into sysfs.
>>>
>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>>> ---
>>> drivers/iio/pressure/st_pressure_core.c | 3 +++
>>> 1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/iio/pressure/st_pressure_core.c
>>> b/drivers/iio/pressure/st_pressure_core.c
>>> index 6ffd949..34b3fb1 100644
>>> --- a/drivers/iio/pressure/st_pressure_core.c
>>> +++ b/drivers/iio/pressure/st_pressure_core.c
>>> @@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev
>>> *indio_dev,
>>> 	if (err && irq > 0)
>>> 		goto st_press_device_register_error;
>>>
>>> +	if (!err)
>>> +		dev_info(&indio_dev->dev, "Successfully registered\n");
>>> +
>> Not keen. That to my mind is pointless noise.
>
> I think it needs to be somewhere. IIO provides no indication whether
> these chips are probed/registered/whathaveyou, or even if the
> subsystem is in use.
>
> One line per hardware component is not noise, IMO it's indicative of
> key functionality which is now available:
>
> Bootlog:
> <snip>
> iio iio: lsm303dlh_accel: Successfully registered
> iio iio: l3g4200d_gyro: Successfully registered
> iio iio: lps001wp_press: Successfully registered
> iio iio: lsm303dlhc_magn: Successfully registered
> <snip>
>
>> If this made sense then it would be in the driver core not here.
>
> Also fine. Just anything but silence/NULL reporting.

Silence means everything is good, a message means there is an error. If every 
device that gets probed would spit out a message the log would be scrolling 
forever and you wouldn't be able to see the error messages.

- Lars

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

* Re: [PATCH 26/38] iio: pressure-core: st: Clean-up probe() function
  2013-09-10 16:23     ` Jonathan Cameron
@ 2013-09-11  7:19       ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-11  7:19 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-arm-kernel, linux-kernel, jic23, arnd, linus.walleij,
	denis.ciocca, linux-iio

> > 	err = st_sensors_init_sensor(indio_dev, plat_data);
> > 	if (err < 0)
> >-		goto st_press_common_probe_error;
> >+		return err;
> > 
> >-	if (pdata->get_irq_data_ready(indio_dev) > 0) {
> >+	if (irq > 0) {
> > 		err = st_press_allocate_ring(indio_dev);
> > 		if (err < 0)
> >-			goto st_press_common_probe_error;
> >+			return err;
> > 
> > 		err = st_sensors_allocate_trigger(indio_dev,
> >-							ST_PRESS_TRIGGER_OPS);
> >+						  ST_PRESS_TRIGGER_OPS);
> > 		if (err < 0)
> > 			goto st_press_probe_trigger_error;
> > 	}
> > 
> > 	err = iio_device_register(indio_dev);
> >-	if (err)
> 
> This bit of handling is confusing. I would much rather see the if IRQ at the goto. Here the first thought is why is it not an error if there is no IRQ! 

I certainly see your point. But surely anyone would see after a second
or two that we're returning err and not 0 in this case, so the error
would still be returned, we're not ignoring it. Adding this extra
comparison saves several lines of code.

If you think it's 'too' confusing, I'll revert the change.

Or perhaps a comment:

/* Only deallocate_[trigger|ring] if they were allocated. */
or
/* Only deallocate_[trigger|ring] if we have an IRQ line. */
or
/* If no IRQ was specified, just return the error. */

> >+	if (err && irq > 0)
> > 		goto st_press_device_register_error;
> > 
> > 	return err;
> > 
> > st_press_device_register_error:
> >-	if (pdata->get_irq_data_ready(indio_dev) > 0)
> >-		st_sensors_deallocate_trigger(indio_dev);
> >+	st_sensors_deallocate_trigger(indio_dev);
> > st_press_probe_trigger_error:
> >-	if (pdata->get_irq_data_ready(indio_dev) > 0)
> >-		st_press_deallocate_ring(indio_dev);
> >-st_press_common_probe_error:
> >+	st_press_deallocate_ring(indio_dev);
> >+
> > 	return err;
> > }
> > EXPORT_SYMBOL(st_press_common_probe);
> 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 26/38] iio: pressure-core: st: Clean-up probe() function
@ 2013-09-11  7:19       ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-11  7:19 UTC (permalink / raw)
  To: linux-arm-kernel

> > 	err = st_sensors_init_sensor(indio_dev, plat_data);
> > 	if (err < 0)
> >-		goto st_press_common_probe_error;
> >+		return err;
> > 
> >-	if (pdata->get_irq_data_ready(indio_dev) > 0) {
> >+	if (irq > 0) {
> > 		err = st_press_allocate_ring(indio_dev);
> > 		if (err < 0)
> >-			goto st_press_common_probe_error;
> >+			return err;
> > 
> > 		err = st_sensors_allocate_trigger(indio_dev,
> >-							ST_PRESS_TRIGGER_OPS);
> >+						  ST_PRESS_TRIGGER_OPS);
> > 		if (err < 0)
> > 			goto st_press_probe_trigger_error;
> > 	}
> > 
> > 	err = iio_device_register(indio_dev);
> >-	if (err)
> 
> This bit of handling is confusing. I would much rather see the if IRQ at the goto. Here the first thought is why is it not an error if there is no IRQ! 

I certainly see your point. But surely anyone would see after a second
or two that we're returning err and not 0 in this case, so the error
would still be returned, we're not ignoring it. Adding this extra
comparison saves several lines of code.

If you think it's 'too' confusing, I'll revert the change.

Or perhaps a comment:

/* Only deallocate_[trigger|ring] if they were allocated. */
or
/* Only deallocate_[trigger|ring] if we have an IRQ line. */
or
/* If no IRQ was specified, just return the error. */

> >+	if (err && irq > 0)
> > 		goto st_press_device_register_error;
> > 
> > 	return err;
> > 
> > st_press_device_register_error:
> >-	if (pdata->get_irq_data_ready(indio_dev) > 0)
> >-		st_sensors_deallocate_trigger(indio_dev);
> >+	st_sensors_deallocate_trigger(indio_dev);
> > st_press_probe_trigger_error:
> >-	if (pdata->get_irq_data_ready(indio_dev) > 0)
> >-		st_press_deallocate_ring(indio_dev);
> >-st_press_common_probe_error:
> >+	st_press_deallocate_ring(indio_dev);
> >+
> > 	return err;
> > }
> > EXPORT_SYMBOL(st_press_common_probe);
> 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
  2013-09-10 16:51         ` Olof Johansson
  (?)
@ 2013-09-11  7:20           ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-11  7:20 UTC (permalink / raw)
  To: Olof Johansson
  Cc: linux-arm-kernel, linux-kernel, jic23, Arnd Bergmann, LinusW,
	denis.ciocca, linux-iio

On Tue, 10 Sep 2013, Olof Johansson wrote:

> On Tue, Sep 10, 2013 at 8:35 AM, Lee Jones <lee.jones@linaro.org> wrote:
> 
> >> splitting this and the other config update into two patches? Really?
> >
> > I haven't split anything. I created the patches as I was
> > enabling/testing the drivers, which was at completely different
> > times. The only reason they're close together in the set is because I
> > reorganised it and didn't think it was necessary to squash them
> > together.
> 
> In this case, squashing makes a lot of sense.

No problem. That's all you had to say. I'll do it right away.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
@ 2013-09-11  7:20           ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-11  7:20 UTC (permalink / raw)
  To: Olof Johansson
  Cc: linux-arm-kernel, linux-kernel, jic23, Arnd Bergmann, LinusW,
	denis.ciocca, linux-iio

On Tue, 10 Sep 2013, Olof Johansson wrote:

> On Tue, Sep 10, 2013 at 8:35 AM, Lee Jones <lee.jones@linaro.org> wrote:
> 
> >> splitting this and the other config update into two patches? Really?
> >
> > I haven't split anything. I created the patches as I was
> > enabling/testing the drivers, which was at completely different
> > times. The only reason they're close together in the set is because I
> > reorganised it and didn't think it was necessary to squash them
> > together.
> 
> In this case, squashing makes a lot of sense.

No problem. That's all you had to say. I'll do it right away.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
@ 2013-09-11  7:20           ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-11  7:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 10 Sep 2013, Olof Johansson wrote:

> On Tue, Sep 10, 2013 at 8:35 AM, Lee Jones <lee.jones@linaro.org> wrote:
> 
> >> splitting this and the other config update into two patches? Really?
> >
> > I haven't split anything. I created the patches as I was
> > enabling/testing the drivers, which was at completely different
> > times. The only reason they're close together in the set is because I
> > reorganised it and didn't think it was necessary to squash them
> > together.
> 
> In this case, squashing makes a lot of sense.

No problem. That's all you had to say. I'll do it right away.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
  2013-09-11  7:18         ` Lars-Peter Clausen
@ 2013-09-11  7:29           ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-11  7:29 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, denis.ciocca, linux-iio

On Wed, 11 Sep 2013, Lars-Peter Clausen wrote:

> On 09/11/2013 09:10 AM, Lee Jones wrote:
> >On Tue, 10 Sep 2013, Jonathan Cameron wrote:
> >>Lee Jones <lee.jones@linaro.org> wrote:
> >>>At the moment the driver is silent in some error cases and if
> >>>successful.
> >>>Prior to this patch there was no clear way to know if the driver
> >>>succeeded
> >>>or not without looking deep into sysfs.
> >>>
> >>>Signed-off-by: Lee Jones <lee.jones@linaro.org>
> >>>---
> >>>drivers/iio/pressure/st_pressure_core.c | 3 +++
> >>>1 file changed, 3 insertions(+)
> >>>
> >>>diff --git a/drivers/iio/pressure/st_pressure_core.c
> >>>b/drivers/iio/pressure/st_pressure_core.c
> >>>index 6ffd949..34b3fb1 100644
> >>>--- a/drivers/iio/pressure/st_pressure_core.c
> >>>+++ b/drivers/iio/pressure/st_pressure_core.c
> >>>@@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev
> >>>*indio_dev,
> >>>	if (err && irq > 0)
> >>>		goto st_press_device_register_error;
> >>>
> >>>+	if (!err)
> >>>+		dev_info(&indio_dev->dev, "Successfully registered\n");
> >>>+
> >>Not keen. That to my mind is pointless noise.
> >
> >I think it needs to be somewhere. IIO provides no indication whether
> >these chips are probed/registered/whathaveyou, or even if the
> >subsystem is in use.
> >
> >One line per hardware component is not noise, IMO it's indicative of
> >key functionality which is now available:
> >
> >Bootlog:
> ><snip>
> >iio iio: lsm303dlh_accel: Successfully registered
> >iio iio: l3g4200d_gyro: Successfully registered
> >iio iio: lps001wp_press: Successfully registered
> >iio iio: lsm303dlhc_magn: Successfully registered
> ><snip>
> >
> >>If this made sense then it would be in the driver core not here.
> >
> >Also fine. Just anything but silence/NULL reporting.
> 
> Silence means everything is good, a message means there is an error.
> If every device that gets probed would spit out a message the log
> would be scrolling forever and you wouldn't be able to see the error
> messages.

Only if you print out every regulator, clock, GPIO pin and things of
this nature. Key hardware blocks such as; SD, Flash, USB, Eth, HDMI,
Audio, UART, GPIO and I2C controllers and Sensors I think deserve a
one line "I'm here and working" message.

I'll not fight this for too long. This is based my experience as a
user. I tried to look at the bootlog for the sensors I'd just enabled
and there was nothing. Some of them had probed, some hadn't and there
was no clear way to distinguish between them without digging into
sysfs.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
@ 2013-09-11  7:29           ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-11  7:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 11 Sep 2013, Lars-Peter Clausen wrote:

> On 09/11/2013 09:10 AM, Lee Jones wrote:
> >On Tue, 10 Sep 2013, Jonathan Cameron wrote:
> >>Lee Jones <lee.jones@linaro.org> wrote:
> >>>At the moment the driver is silent in some error cases and if
> >>>successful.
> >>>Prior to this patch there was no clear way to know if the driver
> >>>succeeded
> >>>or not without looking deep into sysfs.
> >>>
> >>>Signed-off-by: Lee Jones <lee.jones@linaro.org>
> >>>---
> >>>drivers/iio/pressure/st_pressure_core.c | 3 +++
> >>>1 file changed, 3 insertions(+)
> >>>
> >>>diff --git a/drivers/iio/pressure/st_pressure_core.c
> >>>b/drivers/iio/pressure/st_pressure_core.c
> >>>index 6ffd949..34b3fb1 100644
> >>>--- a/drivers/iio/pressure/st_pressure_core.c
> >>>+++ b/drivers/iio/pressure/st_pressure_core.c
> >>>@@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev
> >>>*indio_dev,
> >>>	if (err && irq > 0)
> >>>		goto st_press_device_register_error;
> >>>
> >>>+	if (!err)
> >>>+		dev_info(&indio_dev->dev, "Successfully registered\n");
> >>>+
> >>Not keen. That to my mind is pointless noise.
> >
> >I think it needs to be somewhere. IIO provides no indication whether
> >these chips are probed/registered/whathaveyou, or even if the
> >subsystem is in use.
> >
> >One line per hardware component is not noise, IMO it's indicative of
> >key functionality which is now available:
> >
> >Bootlog:
> ><snip>
> >iio iio: lsm303dlh_accel: Successfully registered
> >iio iio: l3g4200d_gyro: Successfully registered
> >iio iio: lps001wp_press: Successfully registered
> >iio iio: lsm303dlhc_magn: Successfully registered
> ><snip>
> >
> >>If this made sense then it would be in the driver core not here.
> >
> >Also fine. Just anything but silence/NULL reporting.
> 
> Silence means everything is good, a message means there is an error.
> If every device that gets probed would spit out a message the log
> would be scrolling forever and you wouldn't be able to see the error
> messages.

Only if you print out every regulator, clock, GPIO pin and things of
this nature. Key hardware blocks such as; SD, Flash, USB, Eth, HDMI,
Audio, UART, GPIO and I2C controllers and Sensors I think deserve a
one line "I'm here and working" message.

I'll not fight this for too long. This is based my experience as a
user. I tried to look at the bootlog for the sensors I'd just enabled
and there was nothing. Some of them had probed, some hadn't and there
was no clear way to distinguish between them without digging into
sysfs.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
  2013-09-10 16:57         ` Olof Johansson
@ 2013-09-11  8:06           ` Linus Walleij
  -1 siblings, 0 replies; 246+ messages in thread
From: Linus Walleij @ 2013-09-11  8:06 UTC (permalink / raw)
  To: Olof Johansson; +Cc: Lee Jones, linux-arm-kernel, linux-kernel, Arnd Bergmann

On Tue, Sep 10, 2013 at 6:57 PM, Olof Johansson <olof@lixom.net> wrote:

> I have a very weird experience with snowball right now. I noticed this
> yesterday when I decided to look at why multi_v7_defconfig doesn't
> boot on it:
>
> * u8500_defconfig doesn't boot as a DT kernel, since the machine ID is
> still enabled. If I disable the machine ID, it doesn't boot.
> * Same for multi_v7_defconfig, since that is only DT: It doesn't boot.

Weird, yeah there is something wrong on Torvalds' HEAD, with
earlyprint it says:

Uncompressing Linux... done, booting the kernel.
Error: unrecognized/unsupported processor variant (0x412fc091).
This comes from arch/arm/kernel/head-common.S

I'm trying to bisect and find out what is causing this...

Yours,
Linus Walleij

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

* [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
@ 2013-09-11  8:06           ` Linus Walleij
  0 siblings, 0 replies; 246+ messages in thread
From: Linus Walleij @ 2013-09-11  8:06 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Sep 10, 2013 at 6:57 PM, Olof Johansson <olof@lixom.net> wrote:

> I have a very weird experience with snowball right now. I noticed this
> yesterday when I decided to look at why multi_v7_defconfig doesn't
> boot on it:
>
> * u8500_defconfig doesn't boot as a DT kernel, since the machine ID is
> still enabled. If I disable the machine ID, it doesn't boot.
> * Same for multi_v7_defconfig, since that is only DT: It doesn't boot.

Weird, yeah there is something wrong on Torvalds' HEAD, with
earlyprint it says:

Uncompressing Linux... done, booting the kernel.
Error: unrecognized/unsupported processor variant (0x412fc091).
This comes from arch/arm/kernel/head-common.S

I'm trying to bisect and find out what is causing this...

Yours,
Linus Walleij

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

* Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
  2013-09-10 16:57         ` Olof Johansson
@ 2013-09-11  8:17           ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-11  8:17 UTC (permalink / raw)
  To: Olof Johansson; +Cc: linux-arm-kernel, linux-kernel, LinusW, Arnd Bergmann

On Tue, 10 Sep 2013, Olof Johansson wrote:

> [pruning out the iio list/people]
> 
> On Tue, Sep 10, 2013 at 8:30 AM, Lee Jones <lee.jones@linaro.org> wrote:
> >> On Tue, Sep 10, 2013 at 5:49 AM, Lee Jones <lee.jones@linaro.org> wrote:
> >> > Turns out that they're actually not required and the driver probes just
> >> > fine without them. The ID is incorrect at the moment anyway. They actually
> >> > currently specify the stn8815.
> >> >
> >> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> >>
> >> How did you test this patch? What hardware did you boot it on and with
> >> what config?
> >
> > Snowball, u8500_defconfig.
> >
> > Why? Don't you have the same result with yours?
> 
> I have a very weird experience with snowball right now. I noticed this
> yesterday when I decided to look at why multi_v7_defconfig doesn't
> boot on it:
> 
> * u8500_defconfig doesn't boot as a DT kernel, since the machine ID is
> still enabled. If I disable the machine ID, it doesn't boot.
> * Same for multi_v7_defconfig, since that is only DT: It doesn't boot.

I'm not entirely sure what you mean by this, as I have Snowball
booting as a Device Tree only platform:

  http://www.spinics.net/lists/kernel/msg1590759.html

The Machine ID should be all F's for DT I think.

> Unfortunately I can't get to my home network right now to double-check
> boot logs to see if this has changed behavior recently, I'll have to
> do that later today. It'd be interesting to hear if you have the same
> experience w.r.t. DT on u8500_defconfig though.

I just changed SNOWBALL's machine ID to 9999 and it still boots just
fine with DT (ATAGs boot hangs). So what did you do? Can you send me
a patch of what you did, so I might reproduce your build please?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
@ 2013-09-11  8:17           ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-11  8:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 10 Sep 2013, Olof Johansson wrote:

> [pruning out the iio list/people]
> 
> On Tue, Sep 10, 2013 at 8:30 AM, Lee Jones <lee.jones@linaro.org> wrote:
> >> On Tue, Sep 10, 2013 at 5:49 AM, Lee Jones <lee.jones@linaro.org> wrote:
> >> > Turns out that they're actually not required and the driver probes just
> >> > fine without them. The ID is incorrect at the moment anyway. They actually
> >> > currently specify the stn8815.
> >> >
> >> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> >>
> >> How did you test this patch? What hardware did you boot it on and with
> >> what config?
> >
> > Snowball, u8500_defconfig.
> >
> > Why? Don't you have the same result with yours?
> 
> I have a very weird experience with snowball right now. I noticed this
> yesterday when I decided to look at why multi_v7_defconfig doesn't
> boot on it:
> 
> * u8500_defconfig doesn't boot as a DT kernel, since the machine ID is
> still enabled. If I disable the machine ID, it doesn't boot.
> * Same for multi_v7_defconfig, since that is only DT: It doesn't boot.

I'm not entirely sure what you mean by this, as I have Snowball
booting as a Device Tree only platform:

  http://www.spinics.net/lists/kernel/msg1590759.html

The Machine ID should be all F's for DT I think.

> Unfortunately I can't get to my home network right now to double-check
> boot logs to see if this has changed behavior recently, I'll have to
> do that later today. It'd be interesting to hear if you have the same
> experience w.r.t. DT on u8500_defconfig though.

I just changed SNOWBALL's machine ID to 9999 and it still boots just
fine with DT (ATAGs boot hangs). So what did you do? Can you send me
a patch of what you did, so I might reproduce your build please?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
  2013-09-11  8:06           ` Linus Walleij
@ 2013-09-11  8:19             ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-11  8:19 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Olof Johansson, linux-arm-kernel, linux-kernel, Arnd Bergmann

On Wed, 11 Sep 2013, Linus Walleij wrote:

> On Tue, Sep 10, 2013 at 6:57 PM, Olof Johansson <olof@lixom.net> wrote:
> 
> > I have a very weird experience with snowball right now. I noticed this
> > yesterday when I decided to look at why multi_v7_defconfig doesn't
> > boot on it:
> >
> > * u8500_defconfig doesn't boot as a DT kernel, since the machine ID is
> > still enabled. If I disable the machine ID, it doesn't boot.
> > * Same for multi_v7_defconfig, since that is only DT: It doesn't boot.
> 
> Weird, yeah there is something wrong on Torvalds' HEAD, with
> earlyprint it says:
> 
> Uncompressing Linux... done, booting the kernel.
> Error: unrecognized/unsupported processor variant (0x412fc091).
> This comes from arch/arm/kernel/head-common.S
> 
> I'm trying to bisect and find out what is causing this...

Ah nice. Keep us informed of any progress.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
@ 2013-09-11  8:19             ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-11  8:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 11 Sep 2013, Linus Walleij wrote:

> On Tue, Sep 10, 2013 at 6:57 PM, Olof Johansson <olof@lixom.net> wrote:
> 
> > I have a very weird experience with snowball right now. I noticed this
> > yesterday when I decided to look at why multi_v7_defconfig doesn't
> > boot on it:
> >
> > * u8500_defconfig doesn't boot as a DT kernel, since the machine ID is
> > still enabled. If I disable the machine ID, it doesn't boot.
> > * Same for multi_v7_defconfig, since that is only DT: It doesn't boot.
> 
> Weird, yeah there is something wrong on Torvalds' HEAD, with
> earlyprint it says:
> 
> Uncompressing Linux... done, booting the kernel.
> Error: unrecognized/unsupported processor variant (0x412fc091).
> This comes from arch/arm/kernel/head-common.S
> 
> I'm trying to bisect and find out what is causing this...

Ah nice. Keep us informed of any progress.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
  2013-09-11  8:19             ` Lee Jones
@ 2013-09-11  9:33               ` Linus Walleij
  -1 siblings, 0 replies; 246+ messages in thread
From: Linus Walleij @ 2013-09-11  9:33 UTC (permalink / raw)
  To: Lee Jones; +Cc: Olof Johansson, linux-arm-kernel, linux-kernel, Arnd Bergmann

On Wed, Sep 11, 2013 at 10:19 AM, Lee Jones <lee.jones@linaro.org> wrote:
> On Wed, 11 Sep 2013, Linus Walleij wrote:
>
>> Weird, yeah there is something wrong on Torvalds' HEAD, with
>> earlyprint it says:
>>
>> Uncompressing Linux... done, booting the kernel.
>> Error: unrecognized/unsupported processor variant (0x412fc091).
>> This comes from arch/arm/kernel/head-common.S
>>
>> I'm trying to bisect and find out what is causing this...
>
> Ah nice. Keep us informed of any progress.

No it was something transient, after a clean rebuild it boots
just fine. :-/

I'll see if I can boot the same uImage on the Snowball too.

Linus Walleij

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

* [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
@ 2013-09-11  9:33               ` Linus Walleij
  0 siblings, 0 replies; 246+ messages in thread
From: Linus Walleij @ 2013-09-11  9:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Sep 11, 2013 at 10:19 AM, Lee Jones <lee.jones@linaro.org> wrote:
> On Wed, 11 Sep 2013, Linus Walleij wrote:
>
>> Weird, yeah there is something wrong on Torvalds' HEAD, with
>> earlyprint it says:
>>
>> Uncompressing Linux... done, booting the kernel.
>> Error: unrecognized/unsupported processor variant (0x412fc091).
>> This comes from arch/arm/kernel/head-common.S
>>
>> I'm trying to bisect and find out what is causing this...
>
> Ah nice. Keep us informed of any progress.

No it was something transient, after a clean rebuild it boots
just fine. :-/

I'll see if I can boot the same uImage on the Snowball too.

Linus Walleij

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

* Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
       [not found]               ` <CAF2Aj3iPdqM-+FQ7R9MZ-6jV1Q1me9TG1P4cEGA7fSBBYH92zA@mail.gmail.com>
@ 2013-09-11 11:13                   ` Linus Walleij
  0 siblings, 0 replies; 246+ messages in thread
From: Linus Walleij @ 2013-09-11 11:13 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Olof Johansson, linux-arm-kernel, Arnd Bergmann

On Wed, Sep 11, 2013 at 11:39 AM, Lee Jones <lee.jones@linaro.org> wrote:
> On 11 Sep 2013 10:33, "Linus Walleij" <linus.walleij@linaro.org> wrote:

>> No it was something transient, after a clean rebuild it boots
>> just fine. :-/
>>
>> I'll see if I can boot the same uImage on the Snowball too.

Yeah Snowball boots the same DT image with just some random
dmesg noise from Torvalds HEAD:

U8500 $ mmc rescan 1 ; fat load mmc 1 0x0 /uImage ; bootm 0x0
Partition info retrieved
Reading /uImage

8997342 bytes read
## Booting kernel from Legacy Image at 00000000 ...
   Image Name:   Ux500 Device Tree kernel
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    8997278 Bytes =  8.6 MB
   Load Address: 00008000
   Entry Point:  00008000
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x300
Linux version 3.11.0-09031-ga22a0fd (linus@localhost.localdomain) (gcc
version 4.8.2 20130805 (prerelease) (crosstool-NG
linaro-1.13.1-4.8-2013.08 - Linaro GCC 2013.08) ) #48 SMP PREEMPT Wed
Sep 11 11:14:36 CEST 2013
CPU: ARMv7 Processor [412fc091] revision 1 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: ST-Ericsson Ux5x0 platform (Device Tree Support), model:
ST-Ericsson HREF (v60+) platform with Device Tree
Only cachepolicy=writeback supported on ARMv6 and later
Memory policy: ECC disabled, Data cache writealloc
DB8500 v2.1 [0x008500b1]
(...)

I don't know what is the problem with Olof's machine :-/

Olof do you want a copy of my uImage?

Yours,
Linus Walleij

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

* [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
@ 2013-09-11 11:13                   ` Linus Walleij
  0 siblings, 0 replies; 246+ messages in thread
From: Linus Walleij @ 2013-09-11 11:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Sep 11, 2013 at 11:39 AM, Lee Jones <lee.jones@linaro.org> wrote:
> On 11 Sep 2013 10:33, "Linus Walleij" <linus.walleij@linaro.org> wrote:

>> No it was something transient, after a clean rebuild it boots
>> just fine. :-/
>>
>> I'll see if I can boot the same uImage on the Snowball too.

Yeah Snowball boots the same DT image with just some random
dmesg noise from Torvalds HEAD:

U8500 $ mmc rescan 1 ; fat load mmc 1 0x0 /uImage ; bootm 0x0
Partition info retrieved
Reading /uImage

8997342 bytes read
## Booting kernel from Legacy Image at 00000000 ...
   Image Name:   Ux500 Device Tree kernel
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    8997278 Bytes =  8.6 MB
   Load Address: 00008000
   Entry Point:  00008000
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x300
Linux version 3.11.0-09031-ga22a0fd (linus at localhost.localdomain) (gcc
version 4.8.2 20130805 (prerelease) (crosstool-NG
linaro-1.13.1-4.8-2013.08 - Linaro GCC 2013.08) ) #48 SMP PREEMPT Wed
Sep 11 11:14:36 CEST 2013
CPU: ARMv7 Processor [412fc091] revision 1 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: ST-Ericsson Ux5x0 platform (Device Tree Support), model:
ST-Ericsson HREF (v60+) platform with Device Tree
Only cachepolicy=writeback supported on ARMv6 and later
Memory policy: ECC disabled, Data cache writealloc
DB8500 v2.1 [0x008500b1]
(...)

I don't know what is the problem with Olof's machine :-/

Olof do you want a copy of my uImage?

Yours,
Linus Walleij

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

* Re: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
  2013-09-11  7:29           ` Lee Jones
@ 2013-09-11 15:35             ` Mark Brown
  -1 siblings, 0 replies; 246+ messages in thread
From: Mark Brown @ 2013-09-11 15:35 UTC (permalink / raw)
  To: Lee Jones
  Cc: Lars-Peter Clausen, Jonathan Cameron, arnd, linux-iio,
	linus.walleij, linux-kernel, jic23, denis.ciocca,
	linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 664 bytes --]

On Wed, Sep 11, 2013 at 08:29:55AM +0100, Lee Jones wrote:

> Only if you print out every regulator, clock, GPIO pin and things of
> this nature. Key hardware blocks such as; SD, Flash, USB, Eth, HDMI,
> Audio, UART, GPIO and I2C controllers and Sensors I think deserve a
> one line "I'm here and working" message.

The usual rule people apply with this stuff is if the driver has read
back information it can display from the hardware (eg, a revision) then
that's OK.  Things that are likely to crash the system if they fail tend
to also be OK (this is why the regualtor API is quite chatty for
example, a lot of the things it does can cause an immediate crash).

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
@ 2013-09-11 15:35             ` Mark Brown
  0 siblings, 0 replies; 246+ messages in thread
From: Mark Brown @ 2013-09-11 15:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Sep 11, 2013 at 08:29:55AM +0100, Lee Jones wrote:

> Only if you print out every regulator, clock, GPIO pin and things of
> this nature. Key hardware blocks such as; SD, Flash, USB, Eth, HDMI,
> Audio, UART, GPIO and I2C controllers and Sensors I think deserve a
> one line "I'm here and working" message.

The usual rule people apply with this stuff is if the driver has read
back information it can display from the hardware (eg, a revision) then
that's OK.  Things that are likely to crash the system if they fail tend
to also be OK (this is why the regualtor API is quite chatty for
example, a lot of the things it does can cause an immediate crash).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130911/235abe2c/attachment.sig>

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

* Re: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
  2013-09-11  7:18         ` Lars-Peter Clausen
@ 2013-09-11 18:30           ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-11 18:30 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Lee Jones, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, denis.ciocca, linux-iio

On 09/11/13 08:18, Lars-Peter Clausen wrote:
> On 09/11/2013 09:10 AM, Lee Jones wrote:
>> On Tue, 10 Sep 2013, Jonathan Cameron wrote:
>>> Lee Jones <lee.jones@linaro.org> wrote:
>>>> At the moment the driver is silent in some error cases and if
>>>> successful.
>>>> Prior to this patch there was no clear way to know if the driver
>>>> succeeded
>>>> or not without looking deep into sysfs.
>>>>
>>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>>>> ---
>>>> drivers/iio/pressure/st_pressure_core.c | 3 +++
>>>> 1 file changed, 3 insertions(+)
>>>>
>>>> diff --git a/drivers/iio/pressure/st_pressure_core.c
>>>> b/drivers/iio/pressure/st_pressure_core.c
>>>> index 6ffd949..34b3fb1 100644
>>>> --- a/drivers/iio/pressure/st_pressure_core.c
>>>> +++ b/drivers/iio/pressure/st_pressure_core.c
>>>> @@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev
>>>> *indio_dev,
>>>>     if (err && irq > 0)
>>>>         goto st_press_device_register_error;
>>>>
>>>> +    if (!err)
>>>> +        dev_info(&indio_dev->dev, "Successfully registered\n");
>>>> +
>>> Not keen. That to my mind is pointless noise.
>>
>> I think it needs to be somewhere. IIO provides no indication whether
>> these chips are probed/registered/whathaveyou, or even if the
>> subsystem is in use.
>>
>> One line per hardware component is not noise, IMO it's indicative of
>> key functionality which is now available:
>>
>> Bootlog:
>> <snip>
>> iio iio: lsm303dlh_accel: Successfully registered
>> iio iio: l3g4200d_gyro: Successfully registered
>> iio iio: lps001wp_press: Successfully registered
>> iio iio: lsm303dlhc_magn: Successfully registered
>> <snip>
>>
>>> If this made sense then it would be in the driver core not here.
>>
>> Also fine. Just anything but silence/NULL reporting.
> 
> Silence means everything is good, a message means there is an error. If every device that gets probed would spit out a
> message the log would be scrolling forever and you wouldn't be able to see the error messages.

Exactly.  If you really think this is worthwhile, then propose it is added to the relevant
place in drivers/base/ (possibly bus.c)  I've just been lax in persuading people not
to put it in existing drivers rather than the other way around.

> 
> - Lars
> 

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

* [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
@ 2013-09-11 18:30           ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-11 18:30 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/11/13 08:18, Lars-Peter Clausen wrote:
> On 09/11/2013 09:10 AM, Lee Jones wrote:
>> On Tue, 10 Sep 2013, Jonathan Cameron wrote:
>>> Lee Jones <lee.jones@linaro.org> wrote:
>>>> At the moment the driver is silent in some error cases and if
>>>> successful.
>>>> Prior to this patch there was no clear way to know if the driver
>>>> succeeded
>>>> or not without looking deep into sysfs.
>>>>
>>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>>>> ---
>>>> drivers/iio/pressure/st_pressure_core.c | 3 +++
>>>> 1 file changed, 3 insertions(+)
>>>>
>>>> diff --git a/drivers/iio/pressure/st_pressure_core.c
>>>> b/drivers/iio/pressure/st_pressure_core.c
>>>> index 6ffd949..34b3fb1 100644
>>>> --- a/drivers/iio/pressure/st_pressure_core.c
>>>> +++ b/drivers/iio/pressure/st_pressure_core.c
>>>> @@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev
>>>> *indio_dev,
>>>>     if (err && irq > 0)
>>>>         goto st_press_device_register_error;
>>>>
>>>> +    if (!err)
>>>> +        dev_info(&indio_dev->dev, "Successfully registered\n");
>>>> +
>>> Not keen. That to my mind is pointless noise.
>>
>> I think it needs to be somewhere. IIO provides no indication whether
>> these chips are probed/registered/whathaveyou, or even if the
>> subsystem is in use.
>>
>> One line per hardware component is not noise, IMO it's indicative of
>> key functionality which is now available:
>>
>> Bootlog:
>> <snip>
>> iio iio: lsm303dlh_accel: Successfully registered
>> iio iio: l3g4200d_gyro: Successfully registered
>> iio iio: lps001wp_press: Successfully registered
>> iio iio: lsm303dlhc_magn: Successfully registered
>> <snip>
>>
>>> If this made sense then it would be in the driver core not here.
>>
>> Also fine. Just anything but silence/NULL reporting.
> 
> Silence means everything is good, a message means there is an error. If every device that gets probed would spit out a
> message the log would be scrolling forever and you wouldn't be able to see the error messages.

Exactly.  If you really think this is worthwhile, then propose it is added to the relevant
place in drivers/base/ (possibly bus.c)  I've just been lax in persuading people not
to put it in existing drivers rather than the other way around.

> 
> - Lars
> 

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

* Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
  2013-09-11 11:13                   ` Linus Walleij
@ 2013-09-11 20:36                     ` Olof Johansson
  -1 siblings, 0 replies; 246+ messages in thread
From: Olof Johansson @ 2013-09-11 20:36 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Lee Jones, linux-kernel, linux-arm-kernel, Arnd Bergmann

On Wed, Sep 11, 2013 at 4:13 AM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Wed, Sep 11, 2013 at 11:39 AM, Lee Jones <lee.jones@linaro.org> wrote:
>> On 11 Sep 2013 10:33, "Linus Walleij" <linus.walleij@linaro.org> wrote:
>
>>> No it was something transient, after a clean rebuild it boots
>>> just fine. :-/
>>>
>>> I'll see if I can boot the same uImage on the Snowball too.
>
> Yeah Snowball boots the same DT image with just some random
> dmesg noise from Torvalds HEAD:
>
> U8500 $ mmc rescan 1 ; fat load mmc 1 0x0 /uImage ; bootm 0x0
> Partition info retrieved
> Reading /uImage
>
> 8997342 bytes read
> ## Booting kernel from Legacy Image at 00000000 ...
>    Image Name:   Ux500 Device Tree kernel
>    Image Type:   ARM Linux Kernel Image (uncompressed)
>    Data Size:    8997278 Bytes =  8.6 MB
>    Load Address: 00008000
>    Entry Point:  00008000
>    Loading Kernel Image ... OK
> OK
>
> Starting kernel ...
>
> Uncompressing Linux... done, booting the kernel.
> Booting Linux on physical CPU 0x300
> Linux version 3.11.0-09031-ga22a0fd (linus@localhost.localdomain) (gcc
> version 4.8.2 20130805 (prerelease) (crosstool-NG
> linaro-1.13.1-4.8-2013.08 - Linaro GCC 2013.08) ) #48 SMP PREEMPT Wed
> Sep 11 11:14:36 CEST 2013
> CPU: ARMv7 Processor [412fc091] revision 1 (ARMv7), cr=10c5387d
> CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
> Machine: ST-Ericsson Ux5x0 platform (Device Tree Support), model:
> ST-Ericsson HREF (v60+) platform with Device Tree
> Only cachepolicy=writeback supported on ARMv6 and later
> Memory policy: ECC disabled, Data cache writealloc
> DB8500 v2.1 [0x008500b1]
> (...)
>
> I don't know what is the problem with Olof's machine :-/

Oh! Well, to start with apparantly u8500_defconfig doesn't have
APPENDED_DTB enabled, which explains some of the confusion here.

With that fixed (and the appropriate options to get the bootargs from
the atags), I get as far as console probing where output stops, if I
have DEBUG_LL on. With it disabled I get all the way up.

Not sure what was going on earlier here. Maybe just as in your case it
was a matter of cleaning out and starting fresh.

multi_v7_defconfig still doesn't boot though, but the failure seems to
be lower level than any of the others, no output with DEBUG_LL on.


-Olof

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

* [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
@ 2013-09-11 20:36                     ` Olof Johansson
  0 siblings, 0 replies; 246+ messages in thread
From: Olof Johansson @ 2013-09-11 20:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Sep 11, 2013 at 4:13 AM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Wed, Sep 11, 2013 at 11:39 AM, Lee Jones <lee.jones@linaro.org> wrote:
>> On 11 Sep 2013 10:33, "Linus Walleij" <linus.walleij@linaro.org> wrote:
>
>>> No it was something transient, after a clean rebuild it boots
>>> just fine. :-/
>>>
>>> I'll see if I can boot the same uImage on the Snowball too.
>
> Yeah Snowball boots the same DT image with just some random
> dmesg noise from Torvalds HEAD:
>
> U8500 $ mmc rescan 1 ; fat load mmc 1 0x0 /uImage ; bootm 0x0
> Partition info retrieved
> Reading /uImage
>
> 8997342 bytes read
> ## Booting kernel from Legacy Image at 00000000 ...
>    Image Name:   Ux500 Device Tree kernel
>    Image Type:   ARM Linux Kernel Image (uncompressed)
>    Data Size:    8997278 Bytes =  8.6 MB
>    Load Address: 00008000
>    Entry Point:  00008000
>    Loading Kernel Image ... OK
> OK
>
> Starting kernel ...
>
> Uncompressing Linux... done, booting the kernel.
> Booting Linux on physical CPU 0x300
> Linux version 3.11.0-09031-ga22a0fd (linus at localhost.localdomain) (gcc
> version 4.8.2 20130805 (prerelease) (crosstool-NG
> linaro-1.13.1-4.8-2013.08 - Linaro GCC 2013.08) ) #48 SMP PREEMPT Wed
> Sep 11 11:14:36 CEST 2013
> CPU: ARMv7 Processor [412fc091] revision 1 (ARMv7), cr=10c5387d
> CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
> Machine: ST-Ericsson Ux5x0 platform (Device Tree Support), model:
> ST-Ericsson HREF (v60+) platform with Device Tree
> Only cachepolicy=writeback supported on ARMv6 and later
> Memory policy: ECC disabled, Data cache writealloc
> DB8500 v2.1 [0x008500b1]
> (...)
>
> I don't know what is the problem with Olof's machine :-/

Oh! Well, to start with apparantly u8500_defconfig doesn't have
APPENDED_DTB enabled, which explains some of the confusion here.

With that fixed (and the appropriate options to get the bootargs from
the atags), I get as far as console probing where output stops, if I
have DEBUG_LL on. With it disabled I get all the way up.

Not sure what was going on earlier here. Maybe just as in your case it
was a matter of cleaning out and starting fresh.

multi_v7_defconfig still doesn't boot though, but the failure seems to
be lower level than any of the others, no output with DEBUG_LL on.


-Olof

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

* Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
  2013-09-11 20:36                     ` Olof Johansson
@ 2013-09-12 12:23                       ` Linus Walleij
  -1 siblings, 0 replies; 246+ messages in thread
From: Linus Walleij @ 2013-09-12 12:23 UTC (permalink / raw)
  To: Olof Johansson; +Cc: Lee Jones, linux-kernel, linux-arm-kernel, Arnd Bergmann

On Wed, Sep 11, 2013 at 10:36 PM, Olof Johansson <olof@lixom.net> wrote:
> [Me]
>> I don't know what is the problem with Olof's machine :-/
>
> Oh! Well, to start with apparantly u8500_defconfig doesn't have
> APPENDED_DTB enabled, which explains some of the confusion here.

Oh. Well honestly I think we will never be able to rewrite the
U8500 bootloaders, so maybe I should just send a patch adding
this to the defconfig by default.

> With that fixed (and the appropriate options to get the bootargs from
> the atags), I get as far as console probing where output stops, if I
> have DEBUG_LL on. With it disabled I get all the way up.

Yeah somewhere the bit-banging from the LL-prints that just
hammer the hardware start conflicting with the kernel control
over the same port. I guess it's the same for all users of the
PL011.

> Not sure what was going on earlier here. Maybe just as in your case it
> was a matter of cleaning out and starting fresh.

Yeah, it's scary :-/

> multi_v7_defconfig still doesn't boot though, but the failure seems to
> be lower level than any of the others, no output with DEBUG_LL on.

Probably the usual case where one system is screwing up for
another system. We'll need to look into this.

Yours,
Linus Walleij

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

* [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
@ 2013-09-12 12:23                       ` Linus Walleij
  0 siblings, 0 replies; 246+ messages in thread
From: Linus Walleij @ 2013-09-12 12:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Sep 11, 2013 at 10:36 PM, Olof Johansson <olof@lixom.net> wrote:
> [Me]
>> I don't know what is the problem with Olof's machine :-/
>
> Oh! Well, to start with apparantly u8500_defconfig doesn't have
> APPENDED_DTB enabled, which explains some of the confusion here.

Oh. Well honestly I think we will never be able to rewrite the
U8500 bootloaders, so maybe I should just send a patch adding
this to the defconfig by default.

> With that fixed (and the appropriate options to get the bootargs from
> the atags), I get as far as console probing where output stops, if I
> have DEBUG_LL on. With it disabled I get all the way up.

Yeah somewhere the bit-banging from the LL-prints that just
hammer the hardware start conflicting with the kernel control
over the same port. I guess it's the same for all users of the
PL011.

> Not sure what was going on earlier here. Maybe just as in your case it
> was a matter of cleaning out and starting fresh.

Yeah, it's scary :-/

> multi_v7_defconfig still doesn't boot though, but the failure seems to
> be lower level than any of the others, no output with DEBUG_LL on.

Probably the usual case where one system is screwing up for
another system. We'll need to look into this.

Yours,
Linus Walleij

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

* Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
  2013-09-12 12:23                       ` Linus Walleij
@ 2013-09-12 12:32                         ` Russell King - ARM Linux
  -1 siblings, 0 replies; 246+ messages in thread
From: Russell King - ARM Linux @ 2013-09-12 12:32 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Olof Johansson, Arnd Bergmann, Lee Jones, linux-kernel, linux-arm-kernel

On Thu, Sep 12, 2013 at 02:23:48PM +0200, Linus Walleij wrote:
> Yeah somewhere the bit-banging from the LL-prints that just
> hammer the hardware start conflicting with the kernel control
> over the same port. I guess it's the same for all users of the
> PL011.

That shouldn't happen, unless the port becomes disabled (eg, you're
not using the LL-debug port as your console, and its then placed into
a low power mode.)

Again, let me re-interate what LL-debug is for: it's there to assist
getting the early boot up and running.  Once the early boot is working,
it should *not* be used.

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

* [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
@ 2013-09-12 12:32                         ` Russell King - ARM Linux
  0 siblings, 0 replies; 246+ messages in thread
From: Russell King - ARM Linux @ 2013-09-12 12:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 12, 2013 at 02:23:48PM +0200, Linus Walleij wrote:
> Yeah somewhere the bit-banging from the LL-prints that just
> hammer the hardware start conflicting with the kernel control
> over the same port. I guess it's the same for all users of the
> PL011.

That shouldn't happen, unless the port becomes disabled (eg, you're
not using the LL-debug port as your console, and its then placed into
a low power mode.)

Again, let me re-interate what LL-debug is for: it's there to assist
getting the early boot up and running.  Once the early boot is working,
it should *not* be used.

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

* RE: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
  2013-09-11  7:29           ` Lee Jones
  (?)
@ 2013-09-13 20:57             ` Getz, Robin
  -1 siblings, 0 replies; 246+ messages in thread
From: Getz, Robin @ 2013-09-13 20:57 UTC (permalink / raw)
  To: Lee Jones, Lars-Peter Clausen
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, denis.ciocca, linux-iio

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1679 bytes --]

On Wednesday, September 11, 2013 3:30 AM Lee Jones wrote:
> On Wed, 11 Sep 2013, Lars-Peter Clausen wrote:
> > On 09/11/2013 09:10 AM, Lee Jones wrote:
> > >On Tue, 10 Sep 2013, Jonathan Cameron wrote:
> > >>Lee Jones <lee.jones@linaro.org> wrote:
> > Silence means everything is good, a message means there is an error.
> > If every device that gets probed would spit out a message the log
> > would be scrolling forever and you wouldn't be able to see the error
> > messages.
> 
> Only if you print out every regulator, clock, GPIO pin and things of this nature.
> Key hardware blocks such as; SD, Flash, USB, Eth, HDMI, Audio, UART, GPIO and
> I2C controllers and Sensors I think deserve a one line "I'm here and working"
> message.

In many embedded systems -- there are lots and lots of IIO devices, and I'm not sure 
I would consider very many "key". It really depends on the board.

To me it's a matter of boot time. Even memcpy to msgbuf takes time.
Sometimes unnecessary time.

> I'll not fight this for too long. This is based my experience as a user. I tried to
> look at the bootlog for the sensors I'd just enabled and there was nothing. Some
> of them had probed, some hadn't and there was no clear way to distinguish
> between them without digging into sysfs.

echo "working:"
cat /sys/bus/iio/devices/*/name

isn't too much digging. If you really want to do that on your machine - do so in rc.local

for many other subsystems, it's just not that easy, and printing from the driver is necessary.

-Robin
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* RE: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
@ 2013-09-13 20:57             ` Getz, Robin
  0 siblings, 0 replies; 246+ messages in thread
From: Getz, Robin @ 2013-09-13 20:57 UTC (permalink / raw)
  To: Lee Jones, Lars-Peter Clausen
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, denis.ciocca, linux-iio

T24gV2VkbmVzZGF5LCBTZXB0ZW1iZXIgMTEsIDIwMTMgMzozMCBBTSBMZWUgSm9uZXMgd3JvdGU6
DQo+IE9uIFdlZCwgMTEgU2VwIDIwMTMsIExhcnMtUGV0ZXIgQ2xhdXNlbiB3cm90ZToNCj4gPiBP
biAwOS8xMS8yMDEzIDA5OjEwIEFNLCBMZWUgSm9uZXMgd3JvdGU6DQo+ID4gPk9uIFR1ZSwgMTAg
U2VwIDIwMTMsIEpvbmF0aGFuIENhbWVyb24gd3JvdGU6DQo+ID4gPj5MZWUgSm9uZXMgPGxlZS5q
b25lc0BsaW5hcm8ub3JnPiB3cm90ZToNCj4gPiBTaWxlbmNlIG1lYW5zIGV2ZXJ5dGhpbmcgaXMg
Z29vZCwgYSBtZXNzYWdlIG1lYW5zIHRoZXJlIGlzIGFuIGVycm9yLg0KPiA+IElmIGV2ZXJ5IGRl
dmljZSB0aGF0IGdldHMgcHJvYmVkIHdvdWxkIHNwaXQgb3V0IGEgbWVzc2FnZSB0aGUgbG9nDQo+
ID4gd291bGQgYmUgc2Nyb2xsaW5nIGZvcmV2ZXIgYW5kIHlvdSB3b3VsZG4ndCBiZSBhYmxlIHRv
IHNlZSB0aGUgZXJyb3INCj4gPiBtZXNzYWdlcy4NCj4gDQo+IE9ubHkgaWYgeW91IHByaW50IG91
dCBldmVyeSByZWd1bGF0b3IsIGNsb2NrLCBHUElPIHBpbiBhbmQgdGhpbmdzIG9mIHRoaXMgbmF0
dXJlLg0KPiBLZXkgaGFyZHdhcmUgYmxvY2tzIHN1Y2ggYXM7IFNELCBGbGFzaCwgVVNCLCBFdGgs
IEhETUksIEF1ZGlvLCBVQVJULCBHUElPIGFuZA0KPiBJMkMgY29udHJvbGxlcnMgYW5kIFNlbnNv
cnMgSSB0aGluayBkZXNlcnZlIGEgb25lIGxpbmUgIkknbSBoZXJlIGFuZCB3b3JraW5nIg0KPiBt
ZXNzYWdlLg0KDQpJbiBtYW55IGVtYmVkZGVkIHN5c3RlbXMgLS0gdGhlcmUgYXJlIGxvdHMgYW5k
IGxvdHMgb2YgSUlPIGRldmljZXMsIGFuZCBJJ20gbm90IHN1cmUgDQpJIHdvdWxkIGNvbnNpZGVy
IHZlcnkgbWFueSAia2V5Ii4gSXQgcmVhbGx5IGRlcGVuZHMgb24gdGhlIGJvYXJkLg0KDQpUbyBt
ZSBpdCdzIGEgbWF0dGVyIG9mIGJvb3QgdGltZS4gRXZlbiBtZW1jcHkgdG8gbXNnYnVmIHRha2Vz
IHRpbWUuDQpTb21ldGltZXMgdW5uZWNlc3NhcnkgdGltZS4NCg0KPiBJJ2xsIG5vdCBmaWdodCB0
aGlzIGZvciB0b28gbG9uZy4gVGhpcyBpcyBiYXNlZCBteSBleHBlcmllbmNlIGFzIGEgdXNlci4g
SSB0cmllZCB0bw0KPiBsb29rIGF0IHRoZSBib290bG9nIGZvciB0aGUgc2Vuc29ycyBJJ2QganVz
dCBlbmFibGVkIGFuZCB0aGVyZSB3YXMgbm90aGluZy4gU29tZQ0KPiBvZiB0aGVtIGhhZCBwcm9i
ZWQsIHNvbWUgaGFkbid0IGFuZCB0aGVyZSB3YXMgbm8gY2xlYXIgd2F5IHRvIGRpc3Rpbmd1aXNo
DQo+IGJldHdlZW4gdGhlbSB3aXRob3V0IGRpZ2dpbmcgaW50byBzeXNmcy4NCg0KZWNobyAid29y
a2luZzoiDQpjYXQgL3N5cy9idXMvaWlvL2RldmljZXMvKi9uYW1lDQoNCmlzbid0IHRvbyBtdWNo
IGRpZ2dpbmcuIElmIHlvdSByZWFsbHkgd2FudCB0byBkbyB0aGF0IG9uIHlvdXIgbWFjaGluZSAt
IGRvIHNvIGluIHJjLmxvY2FsDQoNCmZvciBtYW55IG90aGVyIHN1YnN5c3RlbXMsIGl0J3MganVz
dCBub3QgdGhhdCBlYXN5LCBhbmQgcHJpbnRpbmcgZnJvbSB0aGUgZHJpdmVyIGlzIG5lY2Vzc2Fy
eS4NCg0KLVJvYmluDQo=

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

* [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
@ 2013-09-13 20:57             ` Getz, Robin
  0 siblings, 0 replies; 246+ messages in thread
From: Getz, Robin @ 2013-09-13 20:57 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday, September 11, 2013 3:30 AM Lee Jones wrote:
> On Wed, 11 Sep 2013, Lars-Peter Clausen wrote:
> > On 09/11/2013 09:10 AM, Lee Jones wrote:
> > >On Tue, 10 Sep 2013, Jonathan Cameron wrote:
> > >>Lee Jones <lee.jones@linaro.org> wrote:
> > Silence means everything is good, a message means there is an error.
> > If every device that gets probed would spit out a message the log
> > would be scrolling forever and you wouldn't be able to see the error
> > messages.
> 
> Only if you print out every regulator, clock, GPIO pin and things of this nature.
> Key hardware blocks such as; SD, Flash, USB, Eth, HDMI, Audio, UART, GPIO and
> I2C controllers and Sensors I think deserve a one line "I'm here and working"
> message.

In many embedded systems -- there are lots and lots of IIO devices, and I'm not sure 
I would consider very many "key". It really depends on the board.

To me it's a matter of boot time. Even memcpy to msgbuf takes time.
Sometimes unnecessary time.

> I'll not fight this for too long. This is based my experience as a user. I tried to
> look at the bootlog for the sensors I'd just enabled and there was nothing. Some
> of them had probed, some hadn't and there was no clear way to distinguish
> between them without digging into sysfs.

echo "working:"
cat /sys/bus/iio/devices/*/name

isn't too much digging. If you really want to do that on your machine - do so in rc.local

for many other subsystems, it's just not that easy, and printing from the driver is necessary.

-Robin

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

* Re: [PATCH 10/38] Documentation: dt: iio: Add binding for LPS001WP
  2013-09-10 12:49   ` Lee Jones
  (?)
@ 2013-09-14 12:08     ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 12:08 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, arnd, linus.walleij,
	denis.ciocca, linux-iio, devicetree

added devicetree list cc.
On 09/10/13 13:49, Lee Jones wrote:
> LPS001WP is a Pressure and Temperature sensor.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  .../devicetree/bindings/iio/pressure/lps001wp.txt   | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/pressure/lps001wp.txt
> 
> diff --git a/Documentation/devicetree/bindings/iio/pressure/lps001wp.txt b/Documentation/devicetree/bindings/iio/pressure/lps001wp.txt
> new file mode 100644
> index 0000000..3294a65c6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/pressure/lps001wp.txt
> @@ -0,0 +1,21 @@
> +* STMicroelectronics Pressure Sensor
> +
> +Required properties:
> +  - compatible: Should be "st,lps001wp_press"
> +  - reg: The I2C address of the sensor
> +
> +Optional properties:
> +  - vdd-supply: Phandle to the Vdd supply regulator
> +  - vddio-supply: Phandle to the Vdd-IO supply regulator
> +
> +Example:
> +
> +i2c@80128000 {
> +        lps001wp@5c {
> +                compatible = "st,lps001wp_press";
> +                reg = <0x5c>;
> +
> +                vdd-supply = <&ab8500_ldo_aux1_reg>;
> +                vddio-supply = <&db8500_vsmps2_reg>;
> +        };
> +};
> -- 1.8.1.2 -- 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] 246+ messages in thread

* Re: [PATCH 10/38] Documentation: dt: iio: Add binding for LPS001WP
@ 2013-09-14 12:08     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 12:08 UTC (permalink / raw)
  To: Lee Jones
  Cc: devicetree, arnd, linux-iio, linus.walleij, linux-kernel,
	denis.ciocca, linux-arm-kernel

added devicetree list cc.
On 09/10/13 13:49, Lee Jones wrote:
> LPS001WP is a Pressure and Temperature sensor.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  .../devicetree/bindings/iio/pressure/lps001wp.txt   | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/pressure/lps001wp.txt
> 
> diff --git a/Documentation/devicetree/bindings/iio/pressure/lps001wp.txt b/Documentation/devicetree/bindings/iio/pressure/lps001wp.txt
> new file mode 100644
> index 0000000..3294a65c6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/pressure/lps001wp.txt
> @@ -0,0 +1,21 @@
> +* STMicroelectronics Pressure Sensor
> +
> +Required properties:
> +  - compatible: Should be "st,lps001wp_press"
> +  - reg: The I2C address of the sensor
> +
> +Optional properties:
> +  - vdd-supply: Phandle to the Vdd supply regulator
> +  - vddio-supply: Phandle to the Vdd-IO supply regulator
> +
> +Example:
> +
> +i2c@80128000 {
> +        lps001wp@5c {
> +                compatible = "st,lps001wp_press";
> +                reg = <0x5c>;
> +
> +                vdd-supply = <&ab8500_ldo_aux1_reg>;
> +                vddio-supply = <&db8500_vsmps2_reg>;
> +        };
> +};
> -- 1.8.1.2 -- 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] 246+ messages in thread

* [PATCH 10/38] Documentation: dt: iio: Add binding for LPS001WP
@ 2013-09-14 12:08     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 12:08 UTC (permalink / raw)
  To: linux-arm-kernel

added devicetree list cc.
On 09/10/13 13:49, Lee Jones wrote:
> LPS001WP is a Pressure and Temperature sensor.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  .../devicetree/bindings/iio/pressure/lps001wp.txt   | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/pressure/lps001wp.txt
> 
> diff --git a/Documentation/devicetree/bindings/iio/pressure/lps001wp.txt b/Documentation/devicetree/bindings/iio/pressure/lps001wp.txt
> new file mode 100644
> index 0000000..3294a65c6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/pressure/lps001wp.txt
> @@ -0,0 +1,21 @@
> +* STMicroelectronics Pressure Sensor
> +
> +Required properties:
> +  - compatible: Should be "st,lps001wp_press"
> +  - reg: The I2C address of the sensor
> +
> +Optional properties:
> +  - vdd-supply: Phandle to the Vdd supply regulator
> +  - vddio-supply: Phandle to the Vdd-IO supply regulator
> +
> +Example:
> +
> +i2c at 80128000 {
> +        lps001wp at 5c {
> +                compatible = "st,lps001wp_press";
> +                reg = <0x5c>;
> +
> +                vdd-supply = <&ab8500_ldo_aux1_reg>;
> +                vddio-supply = <&db8500_vsmps2_reg>;
> +        };
> +};
> -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to
> majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 11/38] Documentation: dt: iio: Add binding for LSM303DLH
@ 2013-09-14 12:09     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 12:09 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, devicetree, arnd, linus.walleij,
	denis.ciocca, linux-iio

add devicetree list cc

On 09/10/13 13:49, Lee Jones wrote:
> LSM303DLH is a Accelerometer Sensor
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  .../devicetree/bindings/iio/accel/lsm303dlh.txt     | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt
> 
> diff --git a/Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt b/Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt
> new file mode 100644
> index 0000000..bb59363
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt
> @@ -0,0 +1,21 @@
> +* STMicroelectronics Accelerometer Sensor
> +
> +Required properties:
> +  - compatible: Should be "st,lsm303dlh_accel"
> +  - reg: The I2C address of the sensor
> +
> +Optional properties:
> +  - vdd-supply: Phandle to the Vdd supply regulator
> +  - vddio-supply: Phandle to the Vdd-IO supply regulator
> +
> +Example:
> +
> +i2c@80128000 {
> +	lsm303dlh_accel@19 {
> +		compatible = "st,lsm303dlh_accel";
> +		reg = <0x19>;
> +
> +		vdd-supply = <&ab8500_ldo_aux1_reg>;
> +		vddio-supply = <&db8500_vsmps2_reg>;
> +	};
> +};
> 

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

* Re: [PATCH 11/38] Documentation: dt: iio: Add binding for LSM303DLH
@ 2013-09-14 12:09     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 12:09 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, arnd-r2nGTMty4D4,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A, denis.ciocca-qxv4g6HH51o,
	linux-iio-u79uwXL29TY76Z2rM5mHXA

add devicetree list cc

On 09/10/13 13:49, Lee Jones wrote:
> LSM303DLH is a Accelerometer Sensor
> 
> Signed-off-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
>  .../devicetree/bindings/iio/accel/lsm303dlh.txt     | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt
> 
> diff --git a/Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt b/Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt
> new file mode 100644
> index 0000000..bb59363
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt
> @@ -0,0 +1,21 @@
> +* STMicroelectronics Accelerometer Sensor
> +
> +Required properties:
> +  - compatible: Should be "st,lsm303dlh_accel"
> +  - reg: The I2C address of the sensor
> +
> +Optional properties:
> +  - vdd-supply: Phandle to the Vdd supply regulator
> +  - vddio-supply: Phandle to the Vdd-IO supply regulator
> +
> +Example:
> +
> +i2c@80128000 {
> +	lsm303dlh_accel@19 {
> +		compatible = "st,lsm303dlh_accel";
> +		reg = <0x19>;
> +
> +		vdd-supply = <&ab8500_ldo_aux1_reg>;
> +		vddio-supply = <&db8500_vsmps2_reg>;
> +	};
> +};
> 

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

* [PATCH 11/38] Documentation: dt: iio: Add binding for LSM303DLH
@ 2013-09-14 12:09     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 12:09 UTC (permalink / raw)
  To: linux-arm-kernel

add devicetree list cc

On 09/10/13 13:49, Lee Jones wrote:
> LSM303DLH is a Accelerometer Sensor
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  .../devicetree/bindings/iio/accel/lsm303dlh.txt     | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt
> 
> diff --git a/Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt b/Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt
> new file mode 100644
> index 0000000..bb59363
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt
> @@ -0,0 +1,21 @@
> +* STMicroelectronics Accelerometer Sensor
> +
> +Required properties:
> +  - compatible: Should be "st,lsm303dlh_accel"
> +  - reg: The I2C address of the sensor
> +
> +Optional properties:
> +  - vdd-supply: Phandle to the Vdd supply regulator
> +  - vddio-supply: Phandle to the Vdd-IO supply regulator
> +
> +Example:
> +
> +i2c at 80128000 {
> +	lsm303dlh_accel at 19 {
> +		compatible = "st,lsm303dlh_accel";
> +		reg = <0x19>;
> +
> +		vdd-supply = <&ab8500_ldo_aux1_reg>;
> +		vddio-supply = <&db8500_vsmps2_reg>;
> +	};
> +};
> 

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

* Re: [PATCH 12/38] Documentation: dt: iio: Add binding for L3G4200D
@ 2013-09-14 12:09     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 12:09 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, devicetree, arnd, linus.walleij,
	denis.ciocca, linux-iio

Add devicetree list cc
On 09/10/13 13:49, Lee Jones wrote:
> L3G4200D is a Gyroscope Sensor
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  .../devicetree/bindings/iio/gyro/l3g4200d.txt       | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt
> 
> diff --git a/Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt b/Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt
> new file mode 100644
> index 0000000..29baf9d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt
> @@ -0,0 +1,21 @@
> +* STMicroelectronics Gyroscope Sensor
> +
> +Required properties:
> +  - compatible: Should be "st,l3g4200d_gyro"
> +  - reg: The I2C address of the sensor
> +
> +Optional properties:
> +  - vdd-supply: Phandle to the Vdd supply regulator
> +  - vddio-supply: Phandle to the Vdd-IO supply regulator
> +
> +Example:
> +
> +i2c@80128000 {
> +	l3g4200d_gyro@68 {
> +		compatible = "st,l3g4200d_gyro";
> +		reg = <0x68>;
> +
> +		vdd-supply = <&ab8500_ldo_aux1_reg>;
> +		vddio-supply = <&db8500_vsmps2_reg>;
> +	};
> +};
> 

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

* Re: [PATCH 12/38] Documentation: dt: iio: Add binding for L3G4200D
@ 2013-09-14 12:09     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 12:09 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, arnd-r2nGTMty4D4,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A, denis.ciocca-qxv4g6HH51o,
	linux-iio-u79uwXL29TY76Z2rM5mHXA

Add devicetree list cc
On 09/10/13 13:49, Lee Jones wrote:
> L3G4200D is a Gyroscope Sensor
> 
> Signed-off-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
>  .../devicetree/bindings/iio/gyro/l3g4200d.txt       | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt
> 
> diff --git a/Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt b/Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt
> new file mode 100644
> index 0000000..29baf9d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt
> @@ -0,0 +1,21 @@
> +* STMicroelectronics Gyroscope Sensor
> +
> +Required properties:
> +  - compatible: Should be "st,l3g4200d_gyro"
> +  - reg: The I2C address of the sensor
> +
> +Optional properties:
> +  - vdd-supply: Phandle to the Vdd supply regulator
> +  - vddio-supply: Phandle to the Vdd-IO supply regulator
> +
> +Example:
> +
> +i2c@80128000 {
> +	l3g4200d_gyro@68 {
> +		compatible = "st,l3g4200d_gyro";
> +		reg = <0x68>;
> +
> +		vdd-supply = <&ab8500_ldo_aux1_reg>;
> +		vddio-supply = <&db8500_vsmps2_reg>;
> +	};
> +};
> 

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

* [PATCH 12/38] Documentation: dt: iio: Add binding for L3G4200D
@ 2013-09-14 12:09     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 12:09 UTC (permalink / raw)
  To: linux-arm-kernel

Add devicetree list cc
On 09/10/13 13:49, Lee Jones wrote:
> L3G4200D is a Gyroscope Sensor
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  .../devicetree/bindings/iio/gyro/l3g4200d.txt       | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt
> 
> diff --git a/Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt b/Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt
> new file mode 100644
> index 0000000..29baf9d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt
> @@ -0,0 +1,21 @@
> +* STMicroelectronics Gyroscope Sensor
> +
> +Required properties:
> +  - compatible: Should be "st,l3g4200d_gyro"
> +  - reg: The I2C address of the sensor
> +
> +Optional properties:
> +  - vdd-supply: Phandle to the Vdd supply regulator
> +  - vddio-supply: Phandle to the Vdd-IO supply regulator
> +
> +Example:
> +
> +i2c at 80128000 {
> +	l3g4200d_gyro at 68 {
> +		compatible = "st,l3g4200d_gyro";
> +		reg = <0x68>;
> +
> +		vdd-supply = <&ab8500_ldo_aux1_reg>;
> +		vddio-supply = <&db8500_vsmps2_reg>;
> +	};
> +};
> 

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

* Re: [PATCH 13/38] Documentation: dt: iio: Add binding for LSM303DLH
@ 2013-09-14 12:09     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 12:09 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, devicetree, arnd, linus.walleij,
	denis.ciocca, linux-iio

Add devicetree list cc.
On 09/10/13 13:49, Lee Jones wrote:
> LSM303DLH is a Magnetometer Sensor
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  .../bindings/iio/magnetometer/lsm303dlh.txt         | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt
> 
> diff --git a/Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt b/Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt
> new file mode 100644
> index 0000000..5938369
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt
> @@ -0,0 +1,21 @@
> +* STMicroelectronics Magnetometer Sensor
> +
> +Required properties:
> +  - compatible: Should be "st,lsm303dlh_magn"
> +  - reg: The I2C address of the sensor
> +
> +Optional properties:
> +  - vdd-supply: Phandle to the Vdd supply regulator
> +  - vddio-supply: Phandle to the Vdd-IO supply regulator
> +
> +Example:
> +
> +i2c@80128000 {
> +	lsm303dlh_magn@1e {
> +		compatible = "st,lsm303dlh_magn";
> +		reg = <0x1e>;
> +
> +		vdd-supply = <&ab8500_ldo_aux1_reg>;
> +		vddio-supply = <&db8500_vsmps2_reg>;
> +	};
> +};
> 

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

* Re: [PATCH 13/38] Documentation: dt: iio: Add binding for LSM303DLH
@ 2013-09-14 12:09     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 12:09 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, arnd-r2nGTMty4D4,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A, denis.ciocca-qxv4g6HH51o,
	linux-iio-u79uwXL29TY76Z2rM5mHXA

Add devicetree list cc.
On 09/10/13 13:49, Lee Jones wrote:
> LSM303DLH is a Magnetometer Sensor
> 
> Signed-off-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
>  .../bindings/iio/magnetometer/lsm303dlh.txt         | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt
> 
> diff --git a/Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt b/Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt
> new file mode 100644
> index 0000000..5938369
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt
> @@ -0,0 +1,21 @@
> +* STMicroelectronics Magnetometer Sensor
> +
> +Required properties:
> +  - compatible: Should be "st,lsm303dlh_magn"
> +  - reg: The I2C address of the sensor
> +
> +Optional properties:
> +  - vdd-supply: Phandle to the Vdd supply regulator
> +  - vddio-supply: Phandle to the Vdd-IO supply regulator
> +
> +Example:
> +
> +i2c@80128000 {
> +	lsm303dlh_magn@1e {
> +		compatible = "st,lsm303dlh_magn";
> +		reg = <0x1e>;
> +
> +		vdd-supply = <&ab8500_ldo_aux1_reg>;
> +		vddio-supply = <&db8500_vsmps2_reg>;
> +	};
> +};
> 

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

* [PATCH 13/38] Documentation: dt: iio: Add binding for LSM303DLH
@ 2013-09-14 12:09     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 12:09 UTC (permalink / raw)
  To: linux-arm-kernel

Add devicetree list cc.
On 09/10/13 13:49, Lee Jones wrote:
> LSM303DLH is a Magnetometer Sensor
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  .../bindings/iio/magnetometer/lsm303dlh.txt         | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt
> 
> diff --git a/Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt b/Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt
> new file mode 100644
> index 0000000..5938369
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt
> @@ -0,0 +1,21 @@
> +* STMicroelectronics Magnetometer Sensor
> +
> +Required properties:
> +  - compatible: Should be "st,lsm303dlh_magn"
> +  - reg: The I2C address of the sensor
> +
> +Optional properties:
> +  - vdd-supply: Phandle to the Vdd supply regulator
> +  - vddio-supply: Phandle to the Vdd-IO supply regulator
> +
> +Example:
> +
> +i2c at 80128000 {
> +	lsm303dlh_magn at 1e {
> +		compatible = "st,lsm303dlh_magn";
> +		reg = <0x1e>;
> +
> +		vdd-supply = <&ab8500_ldo_aux1_reg>;
> +		vddio-supply = <&db8500_vsmps2_reg>;
> +	};
> +};
> 

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

* Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
  2013-09-10 12:49   ` Lee Jones
@ 2013-09-14 12:14     ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 12:14 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, jic23, arnd, linus.walleij,
	denis.ciocca, linux-iio

On 09/10/13 13:49, Lee Jones wrote:
> Some of ST's sensors are appended with their sensor type and some
> are not. For consistency we're extending the same naming convention
> throughout.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Honestly I don't care either way on these, but consistency would definitely
be good so applied to the togreg branch of iio.git

Thanks,
> ---
>  drivers/iio/accel/st_accel.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
> index c387763..d8d22e5 100644
> --- a/drivers/iio/accel/st_accel.h
> +++ b/drivers/iio/accel/st_accel.h
> @@ -15,11 +15,11 @@
>  #include <linux/iio/common/st_sensors.h>
>  
>  #define LSM303DLHC_ACCEL_DEV_NAME	"lsm303dlhc_accel"
> -#define LIS3DH_ACCEL_DEV_NAME		"lis3dh"
> +#define LIS3DH_ACCEL_DEV_NAME		"lis3dh_accel"
>  #define LSM330D_ACCEL_DEV_NAME		"lsm330d_accel"
>  #define LSM330DL_ACCEL_DEV_NAME		"lsm330dl_accel"
>  #define LSM330DLC_ACCEL_DEV_NAME	"lsm330dlc_accel"
> -#define LIS331DLH_ACCEL_DEV_NAME	"lis331dlh"
> +#define LIS331DLH_ACCEL_DEV_NAME	"lis331dlh_accel"
>  #define LSM303DL_ACCEL_DEV_NAME		"lsm303dl_accel"
>  #define LSM303DLH_ACCEL_DEV_NAME	"lsm303dlh_accel"
>  #define LSM303DLM_ACCEL_DEV_NAME	"lsm303dlm_accel"
> 

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

* [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
@ 2013-09-14 12:14     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 12:14 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/10/13 13:49, Lee Jones wrote:
> Some of ST's sensors are appended with their sensor type and some
> are not. For consistency we're extending the same naming convention
> throughout.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Honestly I don't care either way on these, but consistency would definitely
be good so applied to the togreg branch of iio.git

Thanks,
> ---
>  drivers/iio/accel/st_accel.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
> index c387763..d8d22e5 100644
> --- a/drivers/iio/accel/st_accel.h
> +++ b/drivers/iio/accel/st_accel.h
> @@ -15,11 +15,11 @@
>  #include <linux/iio/common/st_sensors.h>
>  
>  #define LSM303DLHC_ACCEL_DEV_NAME	"lsm303dlhc_accel"
> -#define LIS3DH_ACCEL_DEV_NAME		"lis3dh"
> +#define LIS3DH_ACCEL_DEV_NAME		"lis3dh_accel"
>  #define LSM330D_ACCEL_DEV_NAME		"lsm330d_accel"
>  #define LSM330DL_ACCEL_DEV_NAME		"lsm330dl_accel"
>  #define LSM330DLC_ACCEL_DEV_NAME	"lsm330dlc_accel"
> -#define LIS331DLH_ACCEL_DEV_NAME	"lis331dlh"
> +#define LIS331DLH_ACCEL_DEV_NAME	"lis331dlh_accel"
>  #define LSM303DL_ACCEL_DEV_NAME		"lsm303dl_accel"
>  #define LSM303DLH_ACCEL_DEV_NAME	"lsm303dlh_accel"
>  #define LSM303DLM_ACCEL_DEV_NAME	"lsm303dlm_accel"
> 

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

* Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
  2013-09-14 12:14     ` Jonathan Cameron
@ 2013-09-14 12:27       ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 12:27 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, jic23, arnd, linus.walleij,
	denis.ciocca, linux-iio

On 09/14/13 13:14, Jonathan Cameron wrote:
> On 09/10/13 13:49, Lee Jones wrote:
>> Some of ST's sensors are appended with their sensor type and some
>> are not. For consistency we're extending the same naming convention
>> throughout.
>>
>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> Honestly I don't care either way on these, but consistency would definitely
> be good so applied to the togreg branch of iio.git
> 
> Thanks,

Actually change of plan. I'm going to hold off on these as this an ABI change.
Iritating though having these as completely inconsistent is, changing this
will change device identification from userspace which is not a good idea.

Sorry Lee, but we really shouldn't do this. I should have picked up on this
in the original driver reviews but that's hindsight for you.

>> ---
>>  drivers/iio/accel/st_accel.h | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
>> index c387763..d8d22e5 100644
>> --- a/drivers/iio/accel/st_accel.h
>> +++ b/drivers/iio/accel/st_accel.h
>> @@ -15,11 +15,11 @@
>>  #include <linux/iio/common/st_sensors.h>
>>  
>>  #define LSM303DLHC_ACCEL_DEV_NAME	"lsm303dlhc_accel"
>> -#define LIS3DH_ACCEL_DEV_NAME		"lis3dh"
>> +#define LIS3DH_ACCEL_DEV_NAME		"lis3dh_accel"
>>  #define LSM330D_ACCEL_DEV_NAME		"lsm330d_accel"
>>  #define LSM330DL_ACCEL_DEV_NAME		"lsm330dl_accel"
>>  #define LSM330DLC_ACCEL_DEV_NAME	"lsm330dlc_accel"
>> -#define LIS331DLH_ACCEL_DEV_NAME	"lis331dlh"
>> +#define LIS331DLH_ACCEL_DEV_NAME	"lis331dlh_accel"
>>  #define LSM303DL_ACCEL_DEV_NAME		"lsm303dl_accel"
>>  #define LSM303DLH_ACCEL_DEV_NAME	"lsm303dlh_accel"
>>  #define LSM303DLM_ACCEL_DEV_NAME	"lsm303dlm_accel"
>>
> --
> 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] 246+ messages in thread

* [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
@ 2013-09-14 12:27       ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 12:27 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/14/13 13:14, Jonathan Cameron wrote:
> On 09/10/13 13:49, Lee Jones wrote:
>> Some of ST's sensors are appended with their sensor type and some
>> are not. For consistency we're extending the same naming convention
>> throughout.
>>
>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> Honestly I don't care either way on these, but consistency would definitely
> be good so applied to the togreg branch of iio.git
> 
> Thanks,

Actually change of plan. I'm going to hold off on these as this an ABI change.
Iritating though having these as completely inconsistent is, changing this
will change device identification from userspace which is not a good idea.

Sorry Lee, but we really shouldn't do this. I should have picked up on this
in the original driver reviews but that's hindsight for you.

>> ---
>>  drivers/iio/accel/st_accel.h | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
>> index c387763..d8d22e5 100644
>> --- a/drivers/iio/accel/st_accel.h
>> +++ b/drivers/iio/accel/st_accel.h
>> @@ -15,11 +15,11 @@
>>  #include <linux/iio/common/st_sensors.h>
>>  
>>  #define LSM303DLHC_ACCEL_DEV_NAME	"lsm303dlhc_accel"
>> -#define LIS3DH_ACCEL_DEV_NAME		"lis3dh"
>> +#define LIS3DH_ACCEL_DEV_NAME		"lis3dh_accel"
>>  #define LSM330D_ACCEL_DEV_NAME		"lsm330d_accel"
>>  #define LSM330DL_ACCEL_DEV_NAME		"lsm330dl_accel"
>>  #define LSM330DLC_ACCEL_DEV_NAME	"lsm330dlc_accel"
>> -#define LIS331DLH_ACCEL_DEV_NAME	"lis331dlh"
>> +#define LIS331DLH_ACCEL_DEV_NAME	"lis331dlh_accel"
>>  #define LSM303DL_ACCEL_DEV_NAME		"lsm303dl_accel"
>>  #define LSM303DLH_ACCEL_DEV_NAME	"lsm303dlh_accel"
>>  #define LSM303DLM_ACCEL_DEV_NAME	"lsm303dlm_accel"
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH 18/38] iio: sensors-core: st: Allow full-scale to be an optional feature
  2013-09-10 12:49   ` Lee Jones
@ 2013-09-14 16:45     ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 16:45 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, arnd, linus.walleij,
	denis.ciocca, linux-iio

On 09/10/13 13:49, Lee Jones wrote:
> Some chips either don't support it or fail to provide adequate documentation,
> so sometimes it's impossible to enable the feature even if it is supported.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Applied to the togreg branch of iio.git

Thanks
> ---
>  drivers/iio/common/st_sensors/st_sensors_core.c | 11 +++++++----
>  drivers/iio/pressure/st_pressure_core.c         |  6 ++++--
>  2 files changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index 965ee22..eb261a5 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -235,10 +235,13 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
>  	if (err < 0)
>  		goto init_error;
>  
> -	err = st_sensors_set_fullscale(indio_dev,
> -						sdata->current_fullscale->num);
> -	if (err < 0)
> -		goto init_error;
> +	if (sdata->current_fullscale) {
> +		err = st_sensors_set_fullscale(indio_dev,
> +					       sdata->current_fullscale->num);
> +		if (err < 0)
> +			goto init_error;
> +	} else
> +		dev_info(&indio_dev->dev, "Full-scale not possible\n");
>  
>  	err = st_sensors_set_odr(indio_dev, sdata->odr);
>  	if (err < 0)
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index ceebd3c..16cfbc5 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -226,8 +226,10 @@ int st_press_common_probe(struct iio_dev *indio_dev,
>  	indio_dev->channels = pdata->sensor->ch;
>  	indio_dev->num_channels = ARRAY_SIZE(st_press_channels);
>  
> -	pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
> -						&pdata->sensor->fs.fs_avl[0];
> +	if (pdata->sensor->fs.addr != 0)
> +		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
> +			&pdata->sensor->fs.fs_avl[0];
> +
>  	pdata->odr = pdata->sensor->odr.odr_avl[0].hz;
>  
>  	if (!plat_data)
> 

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

* [PATCH 18/38] iio: sensors-core: st: Allow full-scale to be an optional feature
@ 2013-09-14 16:45     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 16:45 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/10/13 13:49, Lee Jones wrote:
> Some chips either don't support it or fail to provide adequate documentation,
> so sometimes it's impossible to enable the feature even if it is supported.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Applied to the togreg branch of iio.git

Thanks
> ---
>  drivers/iio/common/st_sensors/st_sensors_core.c | 11 +++++++----
>  drivers/iio/pressure/st_pressure_core.c         |  6 ++++--
>  2 files changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index 965ee22..eb261a5 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -235,10 +235,13 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
>  	if (err < 0)
>  		goto init_error;
>  
> -	err = st_sensors_set_fullscale(indio_dev,
> -						sdata->current_fullscale->num);
> -	if (err < 0)
> -		goto init_error;
> +	if (sdata->current_fullscale) {
> +		err = st_sensors_set_fullscale(indio_dev,
> +					       sdata->current_fullscale->num);
> +		if (err < 0)
> +			goto init_error;
> +	} else
> +		dev_info(&indio_dev->dev, "Full-scale not possible\n");
>  
>  	err = st_sensors_set_odr(indio_dev, sdata->odr);
>  	if (err < 0)
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index ceebd3c..16cfbc5 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -226,8 +226,10 @@ int st_press_common_probe(struct iio_dev *indio_dev,
>  	indio_dev->channels = pdata->sensor->ch;
>  	indio_dev->num_channels = ARRAY_SIZE(st_press_channels);
>  
> -	pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
> -						&pdata->sensor->fs.fs_avl[0];
> +	if (pdata->sensor->fs.addr != 0)
> +		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
> +			&pdata->sensor->fs.fs_avl[0];
> +
>  	pdata->odr = pdata->sensor->odr.odr_avl[0].hz;
>  
>  	if (!plat_data)
> 

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

* Re: [PATCH 19/38] iio: sensors-core: st: Support sensors which don't have a Data Ready pin
  2013-09-10 12:49   ` Lee Jones
@ 2013-09-14 16:53     ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 16:53 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, arnd, linus.walleij,
	denis.ciocca, linux-iio

On 09/10/13 13:49, Lee Jones wrote:
> Not all ST's sensors support data ready, so let's make the declaration
> of one conditional.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>

Hi Lee,

This one doesn't actually build:

  CC [M]  drivers/iio/common/st_sensors/st_sensors_core.o
drivers/iio/common/st_sensors/st_sensors_core.c: In function 'st_sensors_set_drdy_int_pin':
drivers/iio/common/st_sensors/st_sensors_core.c:211:4: error: 'err' undeclared (first use in this function)
drivers/iio/common/st_sensors/st_sensors_core.c:211:4: note: each undeclared identifier is reported only once for each
function it appears in
drivers/iio/common/st_sensors/st_sensors_core.c:228:3: error: label 'init_error' used but not defined
make[4]: *** [drivers/iio/common/st_sensors/st_sensors_core.o] Error 1


The following patch gets rid of these lines so I'm guessing you reorganised your patch
series then didn't check buildling them in the new order.

Please fix this up before reposting the remainder of the series.

> ---
>  drivers/iio/common/st_sensors/st_sensors_core.c | 24 +++++++++++++++++++-----
>  drivers/iio/pressure/st_pressure_core.c         |  3 ++-
>  2 files changed, 21 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index eb261a5..b86cad2 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -198,14 +198,11 @@ int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable)
>  }
>  EXPORT_SYMBOL(st_sensors_set_axis_enable);
>  
> -int st_sensors_init_sensor(struct iio_dev *indio_dev,
> -					struct st_sensors_platform_data *pdata)
> +int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
> +				struct st_sensors_platform_data *pdata)
>  {
> -	int err;
>  	struct st_sensor_data *sdata = iio_priv(indio_dev);
>  
> -	mutex_init(&sdata->tb.buf_lock);
> -
>  	switch (pdata->drdy_int_pin) {
>  	case 1:
>  		if (sdata->sensor->drdy_irq.mask_int1 == 0) {
> @@ -231,6 +228,20 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
>  		goto init_error;
>  	}
>  
> +	return 0;
> +}
> +
> +int st_sensors_init_sensor(struct iio_dev *indio_dev,
> +					struct st_sensors_platform_data *pdata)
> +{
> +	int err = 0;
> +	struct st_sensor_data *sdata = iio_priv(indio_dev);
> +
> +	mutex_init(&sdata->tb.buf_lock);
> +
> +	if (pdata)
> +		err = st_sensors_set_drdy_int_pin(indio_dev, pdata);
> +
>  	err = st_sensors_set_enable(indio_dev, false);
>  	if (err < 0)
>  		goto init_error;
> @@ -266,6 +277,9 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)
>  	u8 drdy_mask;
>  	struct st_sensor_data *sdata = iio_priv(indio_dev);
>  
> +	if (!sdata->sensor->drdy_irq.addr)
> +		return 0;
> +
>  	/* Enable/Disable the interrupt generator 1. */
>  	if (sdata->sensor->drdy_irq.ig1.en_addr > 0) {
>  		err = st_sensors_write_data_with_mask(indio_dev,
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 16cfbc5..279aafd 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -232,7 +232,8 @@ int st_press_common_probe(struct iio_dev *indio_dev,
>  
>  	pdata->odr = pdata->sensor->odr.odr_avl[0].hz;
>  
> -	if (!plat_data)
> +	/* Some devices don't support a data ready pin. */
> +	if (!plat_data && pdata->sensor->drdy_irq.addr)
>  		plat_data =
>  			(struct st_sensors_platform_data *)&default_press_pdata;
>  
> 

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

* [PATCH 19/38] iio: sensors-core: st: Support sensors which don't have a Data Ready pin
@ 2013-09-14 16:53     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 16:53 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/10/13 13:49, Lee Jones wrote:
> Not all ST's sensors support data ready, so let's make the declaration
> of one conditional.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>

Hi Lee,

This one doesn't actually build:

  CC [M]  drivers/iio/common/st_sensors/st_sensors_core.o
drivers/iio/common/st_sensors/st_sensors_core.c: In function 'st_sensors_set_drdy_int_pin':
drivers/iio/common/st_sensors/st_sensors_core.c:211:4: error: 'err' undeclared (first use in this function)
drivers/iio/common/st_sensors/st_sensors_core.c:211:4: note: each undeclared identifier is reported only once for each
function it appears in
drivers/iio/common/st_sensors/st_sensors_core.c:228:3: error: label 'init_error' used but not defined
make[4]: *** [drivers/iio/common/st_sensors/st_sensors_core.o] Error 1


The following patch gets rid of these lines so I'm guessing you reorganised your patch
series then didn't check buildling them in the new order.

Please fix this up before reposting the remainder of the series.

> ---
>  drivers/iio/common/st_sensors/st_sensors_core.c | 24 +++++++++++++++++++-----
>  drivers/iio/pressure/st_pressure_core.c         |  3 ++-
>  2 files changed, 21 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index eb261a5..b86cad2 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -198,14 +198,11 @@ int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable)
>  }
>  EXPORT_SYMBOL(st_sensors_set_axis_enable);
>  
> -int st_sensors_init_sensor(struct iio_dev *indio_dev,
> -					struct st_sensors_platform_data *pdata)
> +int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
> +				struct st_sensors_platform_data *pdata)
>  {
> -	int err;
>  	struct st_sensor_data *sdata = iio_priv(indio_dev);
>  
> -	mutex_init(&sdata->tb.buf_lock);
> -
>  	switch (pdata->drdy_int_pin) {
>  	case 1:
>  		if (sdata->sensor->drdy_irq.mask_int1 == 0) {
> @@ -231,6 +228,20 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
>  		goto init_error;
>  	}
>  
> +	return 0;
> +}
> +
> +int st_sensors_init_sensor(struct iio_dev *indio_dev,
> +					struct st_sensors_platform_data *pdata)
> +{
> +	int err = 0;
> +	struct st_sensor_data *sdata = iio_priv(indio_dev);
> +
> +	mutex_init(&sdata->tb.buf_lock);
> +
> +	if (pdata)
> +		err = st_sensors_set_drdy_int_pin(indio_dev, pdata);
> +
>  	err = st_sensors_set_enable(indio_dev, false);
>  	if (err < 0)
>  		goto init_error;
> @@ -266,6 +277,9 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)
>  	u8 drdy_mask;
>  	struct st_sensor_data *sdata = iio_priv(indio_dev);
>  
> +	if (!sdata->sensor->drdy_irq.addr)
> +		return 0;
> +
>  	/* Enable/Disable the interrupt generator 1. */
>  	if (sdata->sensor->drdy_irq.ig1.en_addr > 0) {
>  		err = st_sensors_write_data_with_mask(indio_dev,
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 16cfbc5..279aafd 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -232,7 +232,8 @@ int st_press_common_probe(struct iio_dev *indio_dev,
>  
>  	pdata->odr = pdata->sensor->odr.odr_avl[0].hz;
>  
> -	if (!plat_data)
> +	/* Some devices don't support a data ready pin. */
> +	if (!plat_data && pdata->sensor->drdy_irq.addr)
>  		plat_data =
>  			(struct st_sensors_platform_data *)&default_press_pdata;
>  
> 

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

* Re: [PATCH 20/38] iio: sensors-core: st: Clean-up error handling in st_sensors_init_sensor()
  2013-09-10 12:49   ` Lee Jones
@ 2013-09-14 16:54     ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 16:54 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, jic23, arnd, linus.walleij,
	denis.ciocca, linux-iio

On 09/10/13 13:49, Lee Jones wrote:
> Strip out all those unnecessary gotos and just return the error right away.
> 
> Aids to simplicity and reduces code.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This is fine except in that it is intertwined with the previous patch.

> ---
>  drivers/iio/common/st_sensors/st_sensors_core.c | 18 +++++++-----------
>  1 file changed, 7 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index b86cad2..8c4c54c 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -208,8 +208,7 @@ int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
>  		if (sdata->sensor->drdy_irq.mask_int1 == 0) {
>  			dev_err(&indio_dev->dev,
>  					"DRDY on INT1 not available.\n");
> -			err = -EINVAL;
> -			goto init_error;
> +			return -EINVAL;
>  		}
>  		sdata->drdy_int_pin = 1;
>  		break;
> @@ -217,15 +216,13 @@ int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
>  		if (sdata->sensor->drdy_irq.mask_int2 == 0) {
>  			dev_err(&indio_dev->dev,
>  					"DRDY on INT2 not available.\n");
> -			err = -EINVAL;
> -			goto init_error;
> +			return -EINVAL;
>  		}
>  		sdata->drdy_int_pin = 2;
>  		break;
>  	default:
>  		dev_err(&indio_dev->dev, "DRDY on pdata not valid.\n");
> -		err = -EINVAL;
> -		goto init_error;
> +		return -EINVAL;
>  	}
>  
>  	return 0;
> @@ -244,29 +241,28 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
>  
>  	err = st_sensors_set_enable(indio_dev, false);
>  	if (err < 0)
> -		goto init_error;
> +		return err;
>  
>  	if (sdata->current_fullscale) {
>  		err = st_sensors_set_fullscale(indio_dev,
>  					       sdata->current_fullscale->num);
>  		if (err < 0)
> -			goto init_error;
> +			return err;
>  	} else
>  		dev_info(&indio_dev->dev, "Full-scale not possible\n");
>  
>  	err = st_sensors_set_odr(indio_dev, sdata->odr);
>  	if (err < 0)
> -		goto init_error;
> +		return err;
>  
>  	/* set BDU */
>  	err = st_sensors_write_data_with_mask(indio_dev,
>  			sdata->sensor->bdu.addr, sdata->sensor->bdu.mask, true);
>  	if (err < 0)
> -		goto init_error;
> +		return err;
>  
>  	err = st_sensors_set_axis_enable(indio_dev, ST_SENSORS_ENABLE_ALL_AXIS);
>  
> -init_error:
>  	return err;
>  }
>  EXPORT_SYMBOL(st_sensors_init_sensor);
> 

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

* [PATCH 20/38] iio: sensors-core: st: Clean-up error handling in st_sensors_init_sensor()
@ 2013-09-14 16:54     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 16:54 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/10/13 13:49, Lee Jones wrote:
> Strip out all those unnecessary gotos and just return the error right away.
> 
> Aids to simplicity and reduces code.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This is fine except in that it is intertwined with the previous patch.

> ---
>  drivers/iio/common/st_sensors/st_sensors_core.c | 18 +++++++-----------
>  1 file changed, 7 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index b86cad2..8c4c54c 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -208,8 +208,7 @@ int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
>  		if (sdata->sensor->drdy_irq.mask_int1 == 0) {
>  			dev_err(&indio_dev->dev,
>  					"DRDY on INT1 not available.\n");
> -			err = -EINVAL;
> -			goto init_error;
> +			return -EINVAL;
>  		}
>  		sdata->drdy_int_pin = 1;
>  		break;
> @@ -217,15 +216,13 @@ int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
>  		if (sdata->sensor->drdy_irq.mask_int2 == 0) {
>  			dev_err(&indio_dev->dev,
>  					"DRDY on INT2 not available.\n");
> -			err = -EINVAL;
> -			goto init_error;
> +			return -EINVAL;
>  		}
>  		sdata->drdy_int_pin = 2;
>  		break;
>  	default:
>  		dev_err(&indio_dev->dev, "DRDY on pdata not valid.\n");
> -		err = -EINVAL;
> -		goto init_error;
> +		return -EINVAL;
>  	}
>  
>  	return 0;
> @@ -244,29 +241,28 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
>  
>  	err = st_sensors_set_enable(indio_dev, false);
>  	if (err < 0)
> -		goto init_error;
> +		return err;
>  
>  	if (sdata->current_fullscale) {
>  		err = st_sensors_set_fullscale(indio_dev,
>  					       sdata->current_fullscale->num);
>  		if (err < 0)
> -			goto init_error;
> +			return err;
>  	} else
>  		dev_info(&indio_dev->dev, "Full-scale not possible\n");
>  
>  	err = st_sensors_set_odr(indio_dev, sdata->odr);
>  	if (err < 0)
> -		goto init_error;
> +		return err;
>  
>  	/* set BDU */
>  	err = st_sensors_write_data_with_mask(indio_dev,
>  			sdata->sensor->bdu.addr, sdata->sensor->bdu.mask, true);
>  	if (err < 0)
> -		goto init_error;
> +		return err;
>  
>  	err = st_sensors_set_axis_enable(indio_dev, ST_SENSORS_ENABLE_ALL_AXIS);
>  
> -init_error:
>  	return err;
>  }
>  EXPORT_SYMBOL(st_sensors_init_sensor);
> 

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

* Re: [PATCH 21/38] iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data()
  2013-09-10 12:49   ` Lee Jones
@ 2013-09-14 16:58     ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 16:58 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, arnd, linus.walleij,
	denis.ciocca, linux-iio

On 09/10/13 13:49, Lee Jones wrote:
> Gets rid of those unnecessary gotos.

Unfortunately it introduced a bug whilst it is at it.  Sometimes
those gotos are necessary and the 'right' way to do things.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  drivers/iio/common/st_sensors/st_sensors_core.c | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index 8c4c54c..148f0e5 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -331,26 +331,23 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev,
>  	unsigned int byte_for_channel = ch->scan_type.storagebits >> 3;
>  
>  	outdata = kmalloc(byte_for_channel, GFP_KERNEL);
> -	if (!outdata) {
> -		err = -EINVAL;
> -		goto st_sensors_read_axis_data_error;
> -	}
> +	if (!outdata)
> +		return -ENOMEM;
I agree this change makes complete sense.
>  
>  	err = sdata->tf->read_multiple_byte(&sdata->tb, sdata->dev,
>  				ch->address, byte_for_channel,
>  				outdata, sdata->multiread_bit);
> -	if (err < 0)
> -		goto st_sensors_free_memory;
> +	if (err < 0) {
> +		kfree(outdata);
> +		return err;
> +	}
I don't like this change as....
>  
>  	if (byte_for_channel == 2)
>  		*data = (s16)get_unaligned_le16(outdata);
>  	else if (byte_for_channel == 3)
>  		*data = (s32)st_sensors_get_unaligned_le24(outdata);
>  
> -st_sensors_free_memory:
> -	kfree(outdata);
you now don't free out data in the case of no error.  This is precisely the case
where a goto is the correct way to handle things as the free need to occur whether
or not the error occurs.

> -st_sensors_read_axis_data_error:
> -	return err;
> +	return 0;
>  }
>  
>  int st_sensors_read_info_raw(struct iio_dev *indio_dev,
> 

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

* [PATCH 21/38] iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data()
@ 2013-09-14 16:58     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 16:58 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/10/13 13:49, Lee Jones wrote:
> Gets rid of those unnecessary gotos.

Unfortunately it introduced a bug whilst it is at it.  Sometimes
those gotos are necessary and the 'right' way to do things.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  drivers/iio/common/st_sensors/st_sensors_core.c | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index 8c4c54c..148f0e5 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -331,26 +331,23 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev,
>  	unsigned int byte_for_channel = ch->scan_type.storagebits >> 3;
>  
>  	outdata = kmalloc(byte_for_channel, GFP_KERNEL);
> -	if (!outdata) {
> -		err = -EINVAL;
> -		goto st_sensors_read_axis_data_error;
> -	}
> +	if (!outdata)
> +		return -ENOMEM;
I agree this change makes complete sense.
>  
>  	err = sdata->tf->read_multiple_byte(&sdata->tb, sdata->dev,
>  				ch->address, byte_for_channel,
>  				outdata, sdata->multiread_bit);
> -	if (err < 0)
> -		goto st_sensors_free_memory;
> +	if (err < 0) {
> +		kfree(outdata);
> +		return err;
> +	}
I don't like this change as....
>  
>  	if (byte_for_channel == 2)
>  		*data = (s16)get_unaligned_le16(outdata);
>  	else if (byte_for_channel == 3)
>  		*data = (s32)st_sensors_get_unaligned_le24(outdata);
>  
> -st_sensors_free_memory:
> -	kfree(outdata);
you now don't free out data in the case of no error.  This is precisely the case
where a goto is the correct way to handle things as the free need to occur whether
or not the error occurs.

> -st_sensors_read_axis_data_error:
> -	return err;
> +	return 0;
>  }
>  
>  int st_sensors_read_info_raw(struct iio_dev *indio_dev,
> 

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

* Re: [PATCH 22/38] iio: sensors-core: st: Clean-up error handling in st_sensors_read_info_raw()
  2013-09-10 12:49   ` Lee Jones
@ 2013-09-14 17:01     ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:01 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, arnd, linus.walleij,
	denis.ciocca, linux-iio

On 09/10/13 13:49, Lee Jones wrote:
> Saving a few lines of code.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Applied to the togreg branch of iio.git.

To my mind the key thing here is that the error paths were previous
inconsistent in that all but the last one went via a separate cleanup path
whereas the last one went straight through.

Now they are consistent and that is more important than saving a few lines of code.

Thanks,
> ---
>  drivers/iio/common/st_sensors/st_sensors_core.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index 148f0e5..25d4c7e 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -359,28 +359,25 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev,
>  	mutex_lock(&indio_dev->mlock);
>  	if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) {
>  		err = -EBUSY;
> -		goto read_error;
> +		goto out;
>  	} else {
>  		err = st_sensors_set_enable(indio_dev, true);
>  		if (err < 0)
> -			goto read_error;
> +			goto out;
>  
>  		msleep((sdata->sensor->bootime * 1000) / sdata->odr);
>  		err = st_sensors_read_axis_data(indio_dev, ch, val);
>  		if (err < 0)
> -			goto read_error;
> +			goto out;
>  
>  		*val = *val >> ch->scan_type.shift;
>  
>  		err = st_sensors_set_enable(indio_dev, false);
>  	}
> +out:
>  	mutex_unlock(&indio_dev->mlock);
>  
>  	return err;
> -
> -read_error:
> -	mutex_unlock(&indio_dev->mlock);
> -	return err;
>  }
>  EXPORT_SYMBOL(st_sensors_read_info_raw);
>  
> 

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

* [PATCH 22/38] iio: sensors-core: st: Clean-up error handling in st_sensors_read_info_raw()
@ 2013-09-14 17:01     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:01 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/10/13 13:49, Lee Jones wrote:
> Saving a few lines of code.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Applied to the togreg branch of iio.git.

To my mind the key thing here is that the error paths were previous
inconsistent in that all but the last one went via a separate cleanup path
whereas the last one went straight through.

Now they are consistent and that is more important than saving a few lines of code.

Thanks,
> ---
>  drivers/iio/common/st_sensors/st_sensors_core.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index 148f0e5..25d4c7e 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -359,28 +359,25 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev,
>  	mutex_lock(&indio_dev->mlock);
>  	if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) {
>  		err = -EBUSY;
> -		goto read_error;
> +		goto out;
>  	} else {
>  		err = st_sensors_set_enable(indio_dev, true);
>  		if (err < 0)
> -			goto read_error;
> +			goto out;
>  
>  		msleep((sdata->sensor->bootime * 1000) / sdata->odr);
>  		err = st_sensors_read_axis_data(indio_dev, ch, val);
>  		if (err < 0)
> -			goto read_error;
> +			goto out;
>  
>  		*val = *val >> ch->scan_type.shift;
>  
>  		err = st_sensors_set_enable(indio_dev, false);
>  	}
> +out:
>  	mutex_unlock(&indio_dev->mlock);
>  
>  	return err;
> -
> -read_error:
> -	mutex_unlock(&indio_dev->mlock);
> -	return err;
>  }
>  EXPORT_SYMBOL(st_sensors_read_info_raw);
>  
> 

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

* Re: [PATCH 18/38] iio: sensors-core: st: Allow full-scale to be an optional feature
  2013-09-14 16:45     ` Jonathan Cameron
@ 2013-09-14 17:07       ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:07 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, arnd, linus.walleij,
	denis.ciocca, linux-iio

On 09/14/13 17:45, Jonathan Cameron wrote:
> On 09/10/13 13:49, Lee Jones wrote:
>> Some chips either don't support it or fail to provide adequate documentation,
>> so sometimes it's impossible to enable the feature even if it is supported.
>>
>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> Applied to the togreg branch of iio.git
> 
Note that Denis Acked this in v1 and it hasn't changed substantially that I can see.
Hence you should have added that ack to this reposting.  I nearly missed it.
> Thanks
>> ---
>>  drivers/iio/common/st_sensors/st_sensors_core.c | 11 +++++++----
>>  drivers/iio/pressure/st_pressure_core.c         |  6 ++++--
>>  2 files changed, 11 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
>> index 965ee22..eb261a5 100644
>> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
>> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
>> @@ -235,10 +235,13 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
>>  	if (err < 0)
>>  		goto init_error;
>>  
>> -	err = st_sensors_set_fullscale(indio_dev,
>> -						sdata->current_fullscale->num);
>> -	if (err < 0)
>> -		goto init_error;
>> +	if (sdata->current_fullscale) {
>> +		err = st_sensors_set_fullscale(indio_dev,
>> +					       sdata->current_fullscale->num);
>> +		if (err < 0)
>> +			goto init_error;
>> +	} else
>> +		dev_info(&indio_dev->dev, "Full-scale not possible\n");
>>  
>>  	err = st_sensors_set_odr(indio_dev, sdata->odr);
>>  	if (err < 0)
>> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
>> index ceebd3c..16cfbc5 100644
>> --- a/drivers/iio/pressure/st_pressure_core.c
>> +++ b/drivers/iio/pressure/st_pressure_core.c
>> @@ -226,8 +226,10 @@ int st_press_common_probe(struct iio_dev *indio_dev,
>>  	indio_dev->channels = pdata->sensor->ch;
>>  	indio_dev->num_channels = ARRAY_SIZE(st_press_channels);
>>  
>> -	pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
>> -						&pdata->sensor->fs.fs_avl[0];
>> +	if (pdata->sensor->fs.addr != 0)
>> +		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
>> +			&pdata->sensor->fs.fs_avl[0];
>> +
>>  	pdata->odr = pdata->sensor->odr.odr_avl[0].hz;
>>  
>>  	if (!plat_data)
>>
> --
> 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] 246+ messages in thread

* [PATCH 18/38] iio: sensors-core: st: Allow full-scale to be an optional feature
@ 2013-09-14 17:07       ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:07 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/14/13 17:45, Jonathan Cameron wrote:
> On 09/10/13 13:49, Lee Jones wrote:
>> Some chips either don't support it or fail to provide adequate documentation,
>> so sometimes it's impossible to enable the feature even if it is supported.
>>
>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> Applied to the togreg branch of iio.git
> 
Note that Denis Acked this in v1 and it hasn't changed substantially that I can see.
Hence you should have added that ack to this reposting.  I nearly missed it.
> Thanks
>> ---
>>  drivers/iio/common/st_sensors/st_sensors_core.c | 11 +++++++----
>>  drivers/iio/pressure/st_pressure_core.c         |  6 ++++--
>>  2 files changed, 11 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
>> index 965ee22..eb261a5 100644
>> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
>> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
>> @@ -235,10 +235,13 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
>>  	if (err < 0)
>>  		goto init_error;
>>  
>> -	err = st_sensors_set_fullscale(indio_dev,
>> -						sdata->current_fullscale->num);
>> -	if (err < 0)
>> -		goto init_error;
>> +	if (sdata->current_fullscale) {
>> +		err = st_sensors_set_fullscale(indio_dev,
>> +					       sdata->current_fullscale->num);
>> +		if (err < 0)
>> +			goto init_error;
>> +	} else
>> +		dev_info(&indio_dev->dev, "Full-scale not possible\n");
>>  
>>  	err = st_sensors_set_odr(indio_dev, sdata->odr);
>>  	if (err < 0)
>> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
>> index ceebd3c..16cfbc5 100644
>> --- a/drivers/iio/pressure/st_pressure_core.c
>> +++ b/drivers/iio/pressure/st_pressure_core.c
>> @@ -226,8 +226,10 @@ int st_press_common_probe(struct iio_dev *indio_dev,
>>  	indio_dev->channels = pdata->sensor->ch;
>>  	indio_dev->num_channels = ARRAY_SIZE(st_press_channels);
>>  
>> -	pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
>> -						&pdata->sensor->fs.fs_avl[0];
>> +	if (pdata->sensor->fs.addr != 0)
>> +		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
>> +			&pdata->sensor->fs.fs_avl[0];
>> +
>>  	pdata->odr = pdata->sensor->odr.odr_avl[0].hz;
>>  
>>  	if (!plat_data)
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH 23/38] iio: pressure-core: st: Describe LPS331AP defines by name
  2013-09-10 12:49   ` Lee Jones
@ 2013-09-14 17:09     ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:09 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, jic23, arnd, linus.walleij,
	denis.ciocca, linux-iio

On 09/10/13 13:49, Lee Jones wrote:
> They're currently named *_1_*, for 'Sensor 1', but the code will be much
> more readable if we use the naming convention *_LPS331AP_* instead.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Very happy to see this patch.  The _1_ stuff should never have gotten through
the initial review of the driver (oops).  Even in cases where it might be shared
by multiple devices, it is better to have it named after one choice.

Anyhow, applied to the togreg branch of iio.git

Thanks
> ---
>  drivers/iio/pressure/st_pressure_core.c | 94 ++++++++++++++++-----------------
>  1 file changed, 46 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 279aafd..2ee4bcd 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -36,94 +36,92 @@
>  						 ST_PRESS_LSB_PER_CELSIUS)
>  #define ST_PRESS_NUMBER_DATA_CHANNELS		1
>  
> -/* DEFAULT VALUE FOR SENSORS */
> -#define ST_PRESS_DEFAULT_OUT_XL_ADDR		0x28
> -#define ST_TEMP_DEFAULT_OUT_L_ADDR		0x2b
> -
>  /* FULLSCALE */
>  #define ST_PRESS_FS_AVL_1260MB			1260
>  
> -/* CUSTOM VALUES FOR SENSOR 1 */
> -#define ST_PRESS_1_WAI_EXP			0xbb
> -#define ST_PRESS_1_ODR_ADDR			0x20
> -#define ST_PRESS_1_ODR_MASK			0x70
> -#define ST_PRESS_1_ODR_AVL_1HZ_VAL		0x01
> -#define ST_PRESS_1_ODR_AVL_7HZ_VAL		0x05
> -#define ST_PRESS_1_ODR_AVL_13HZ_VAL		0x06
> -#define ST_PRESS_1_ODR_AVL_25HZ_VAL		0x07
> -#define ST_PRESS_1_PW_ADDR			0x20
> -#define ST_PRESS_1_PW_MASK			0x80
> -#define ST_PRESS_1_FS_ADDR			0x23
> -#define ST_PRESS_1_FS_MASK			0x30
> -#define ST_PRESS_1_FS_AVL_1260_VAL		0x00
> -#define ST_PRESS_1_FS_AVL_1260_GAIN		ST_PRESS_KPASCAL_NANO_SCALE
> -#define ST_PRESS_1_FS_AVL_TEMP_GAIN		ST_PRESS_CELSIUS_NANO_SCALE
> -#define ST_PRESS_1_BDU_ADDR			0x20
> -#define ST_PRESS_1_BDU_MASK			0x04
> -#define ST_PRESS_1_DRDY_IRQ_ADDR		0x22
> -#define ST_PRESS_1_DRDY_IRQ_INT1_MASK		0x04
> -#define ST_PRESS_1_DRDY_IRQ_INT2_MASK		0x20
> -#define ST_PRESS_1_MULTIREAD_BIT		true
> -#define ST_PRESS_1_TEMP_OFFSET			42500
> +/* CUSTOM VALUES FOR LPS331AP SENSOR */
> +#define ST_PRESS_LPS331AP_WAI_EXP		0xbb
> +#define ST_PRESS_LPS331AP_ODR_ADDR		0x20
> +#define ST_PRESS_LPS331AP_ODR_MASK		0x70
> +#define ST_PRESS_LPS331AP_ODR_AVL_1HZ_VAL	0x01
> +#define ST_PRESS_LPS331AP_ODR_AVL_7HZ_VAL	0x05
> +#define ST_PRESS_LPS331AP_ODR_AVL_13HZ_VAL	0x06
> +#define ST_PRESS_LPS331AP_ODR_AVL_25HZ_VAL	0x07
> +#define ST_PRESS_LPS331AP_PW_ADDR		0x20
> +#define ST_PRESS_LPS331AP_PW_MASK		0x80
> +#define ST_PRESS_LPS331AP_FS_ADDR		0x23
> +#define ST_PRESS_LPS331AP_FS_MASK		0x30
> +#define ST_PRESS_LPS331AP_FS_AVL_1260_VAL	0x00
> +#define ST_PRESS_LPS331AP_FS_AVL_1260_GAIN	ST_PRESS_KPASCAL_NANO_SCALE
> +#define ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN	ST_PRESS_CELSIUS_NANO_SCALE
> +#define ST_PRESS_LPS331AP_BDU_ADDR		0x20
> +#define ST_PRESS_LPS331AP_BDU_MASK		0x04
> +#define ST_PRESS_LPS331AP_DRDY_IRQ_ADDR		0x22
> +#define ST_PRESS_LPS331AP_DRDY_IRQ_INT1_MASK	0x04
> +#define ST_PRESS_LPS331AP_DRDY_IRQ_INT2_MASK	0x20
> +#define ST_PRESS_LPS331AP_MULTIREAD_BIT		true
> +#define ST_PRESS_LPS331AP_TEMP_OFFSET		42500
> +#define ST_PRESS_LPS331AP_OUT_XL_ADDR		0x28
> +#define ST_TEMP_LPS331AP_OUT_L_ADDR		0x2b
>  
>  static const struct iio_chan_spec st_press_channels[] = {
>  	ST_SENSORS_LSM_CHANNELS(IIO_PRESSURE,
>  			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
>  			ST_SENSORS_SCAN_X, 0, IIO_NO_MOD, 'u', IIO_LE, 24, 24,
> -			ST_PRESS_DEFAULT_OUT_XL_ADDR),
> +			ST_PRESS_LPS331AP_OUT_XL_ADDR),
>  	ST_SENSORS_LSM_CHANNELS(IIO_TEMP,
>  			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) |
>  						BIT(IIO_CHAN_INFO_OFFSET),
>  			-1, 0, IIO_NO_MOD, 's', IIO_LE, 16, 16,
> -			ST_TEMP_DEFAULT_OUT_L_ADDR),
> +			ST_TEMP_LPS331AP_OUT_L_ADDR),
>  	IIO_CHAN_SOFT_TIMESTAMP(1)
>  };
>  
>  static const struct st_sensors st_press_sensors[] = {
>  	{
> -		.wai = ST_PRESS_1_WAI_EXP,
> +		.wai = ST_PRESS_LPS331AP_WAI_EXP,
>  		.sensors_supported = {
>  			[0] = LPS331AP_PRESS_DEV_NAME,
>  		},
>  		.ch = (struct iio_chan_spec *)st_press_channels,
>  		.odr = {
> -			.addr = ST_PRESS_1_ODR_ADDR,
> -			.mask = ST_PRESS_1_ODR_MASK,
> +			.addr = ST_PRESS_LPS331AP_ODR_ADDR,
> +			.mask = ST_PRESS_LPS331AP_ODR_MASK,
>  			.odr_avl = {
> -				{ 1, ST_PRESS_1_ODR_AVL_1HZ_VAL, },
> -				{ 7, ST_PRESS_1_ODR_AVL_7HZ_VAL, },
> -				{ 13, ST_PRESS_1_ODR_AVL_13HZ_VAL, },
> -				{ 25, ST_PRESS_1_ODR_AVL_25HZ_VAL, },
> +				{ 1, ST_PRESS_LPS331AP_ODR_AVL_1HZ_VAL, },
> +				{ 7, ST_PRESS_LPS331AP_ODR_AVL_7HZ_VAL, },
> +				{ 13, ST_PRESS_LPS331AP_ODR_AVL_13HZ_VAL, },
> +				{ 25, ST_PRESS_LPS331AP_ODR_AVL_25HZ_VAL, },
>  			},
>  		},
>  		.pw = {
> -			.addr = ST_PRESS_1_PW_ADDR,
> -			.mask = ST_PRESS_1_PW_MASK,
> +			.addr = ST_PRESS_LPS331AP_PW_ADDR,
> +			.mask = ST_PRESS_LPS331AP_PW_MASK,
>  			.value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE,
>  			.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
>  		},
>  		.fs = {
> -			.addr = ST_PRESS_1_FS_ADDR,
> -			.mask = ST_PRESS_1_FS_MASK,
> +			.addr = ST_PRESS_LPS331AP_FS_ADDR,
> +			.mask = ST_PRESS_LPS331AP_FS_MASK,
>  			.fs_avl = {
>  				[0] = {
>  					.num = ST_PRESS_FS_AVL_1260MB,
> -					.value = ST_PRESS_1_FS_AVL_1260_VAL,
> -					.gain = ST_PRESS_1_FS_AVL_1260_GAIN,
> -					.gain2 = ST_PRESS_1_FS_AVL_TEMP_GAIN,
> +					.value = ST_PRESS_LPS331AP_FS_AVL_1260_VAL,
> +					.gain = ST_PRESS_LPS331AP_FS_AVL_1260_GAIN,
> +					.gain2 = ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN,
>  				},
>  			},
>  		},
>  		.bdu = {
> -			.addr = ST_PRESS_1_BDU_ADDR,
> -			.mask = ST_PRESS_1_BDU_MASK,
> +			.addr = ST_PRESS_LPS331AP_BDU_ADDR,
> +			.mask = ST_PRESS_LPS331AP_BDU_MASK,
>  		},
>  		.drdy_irq = {
> -			.addr = ST_PRESS_1_DRDY_IRQ_ADDR,
> -			.mask_int1 = ST_PRESS_1_DRDY_IRQ_INT1_MASK,
> -			.mask_int2 = ST_PRESS_1_DRDY_IRQ_INT2_MASK,
> +			.addr = ST_PRESS_LPS331AP_DRDY_IRQ_ADDR,
> +			.mask_int1 = ST_PRESS_LPS331AP_DRDY_IRQ_INT1_MASK,
> +			.mask_int2 = ST_PRESS_LPS331AP_DRDY_IRQ_INT2_MASK,
>  		},
> -		.multi_read_bit = ST_PRESS_1_MULTIREAD_BIT,
> +		.multi_read_bit = ST_PRESS_LPS331AP_MULTIREAD_BIT,
>  		.bootime = 2,
>  	},
>  };
> 

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

* [PATCH 23/38] iio: pressure-core: st: Describe LPS331AP defines by name
@ 2013-09-14 17:09     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:09 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/10/13 13:49, Lee Jones wrote:
> They're currently named *_1_*, for 'Sensor 1', but the code will be much
> more readable if we use the naming convention *_LPS331AP_* instead.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Very happy to see this patch.  The _1_ stuff should never have gotten through
the initial review of the driver (oops).  Even in cases where it might be shared
by multiple devices, it is better to have it named after one choice.

Anyhow, applied to the togreg branch of iio.git

Thanks
> ---
>  drivers/iio/pressure/st_pressure_core.c | 94 ++++++++++++++++-----------------
>  1 file changed, 46 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 279aafd..2ee4bcd 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -36,94 +36,92 @@
>  						 ST_PRESS_LSB_PER_CELSIUS)
>  #define ST_PRESS_NUMBER_DATA_CHANNELS		1
>  
> -/* DEFAULT VALUE FOR SENSORS */
> -#define ST_PRESS_DEFAULT_OUT_XL_ADDR		0x28
> -#define ST_TEMP_DEFAULT_OUT_L_ADDR		0x2b
> -
>  /* FULLSCALE */
>  #define ST_PRESS_FS_AVL_1260MB			1260
>  
> -/* CUSTOM VALUES FOR SENSOR 1 */
> -#define ST_PRESS_1_WAI_EXP			0xbb
> -#define ST_PRESS_1_ODR_ADDR			0x20
> -#define ST_PRESS_1_ODR_MASK			0x70
> -#define ST_PRESS_1_ODR_AVL_1HZ_VAL		0x01
> -#define ST_PRESS_1_ODR_AVL_7HZ_VAL		0x05
> -#define ST_PRESS_1_ODR_AVL_13HZ_VAL		0x06
> -#define ST_PRESS_1_ODR_AVL_25HZ_VAL		0x07
> -#define ST_PRESS_1_PW_ADDR			0x20
> -#define ST_PRESS_1_PW_MASK			0x80
> -#define ST_PRESS_1_FS_ADDR			0x23
> -#define ST_PRESS_1_FS_MASK			0x30
> -#define ST_PRESS_1_FS_AVL_1260_VAL		0x00
> -#define ST_PRESS_1_FS_AVL_1260_GAIN		ST_PRESS_KPASCAL_NANO_SCALE
> -#define ST_PRESS_1_FS_AVL_TEMP_GAIN		ST_PRESS_CELSIUS_NANO_SCALE
> -#define ST_PRESS_1_BDU_ADDR			0x20
> -#define ST_PRESS_1_BDU_MASK			0x04
> -#define ST_PRESS_1_DRDY_IRQ_ADDR		0x22
> -#define ST_PRESS_1_DRDY_IRQ_INT1_MASK		0x04
> -#define ST_PRESS_1_DRDY_IRQ_INT2_MASK		0x20
> -#define ST_PRESS_1_MULTIREAD_BIT		true
> -#define ST_PRESS_1_TEMP_OFFSET			42500
> +/* CUSTOM VALUES FOR LPS331AP SENSOR */
> +#define ST_PRESS_LPS331AP_WAI_EXP		0xbb
> +#define ST_PRESS_LPS331AP_ODR_ADDR		0x20
> +#define ST_PRESS_LPS331AP_ODR_MASK		0x70
> +#define ST_PRESS_LPS331AP_ODR_AVL_1HZ_VAL	0x01
> +#define ST_PRESS_LPS331AP_ODR_AVL_7HZ_VAL	0x05
> +#define ST_PRESS_LPS331AP_ODR_AVL_13HZ_VAL	0x06
> +#define ST_PRESS_LPS331AP_ODR_AVL_25HZ_VAL	0x07
> +#define ST_PRESS_LPS331AP_PW_ADDR		0x20
> +#define ST_PRESS_LPS331AP_PW_MASK		0x80
> +#define ST_PRESS_LPS331AP_FS_ADDR		0x23
> +#define ST_PRESS_LPS331AP_FS_MASK		0x30
> +#define ST_PRESS_LPS331AP_FS_AVL_1260_VAL	0x00
> +#define ST_PRESS_LPS331AP_FS_AVL_1260_GAIN	ST_PRESS_KPASCAL_NANO_SCALE
> +#define ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN	ST_PRESS_CELSIUS_NANO_SCALE
> +#define ST_PRESS_LPS331AP_BDU_ADDR		0x20
> +#define ST_PRESS_LPS331AP_BDU_MASK		0x04
> +#define ST_PRESS_LPS331AP_DRDY_IRQ_ADDR		0x22
> +#define ST_PRESS_LPS331AP_DRDY_IRQ_INT1_MASK	0x04
> +#define ST_PRESS_LPS331AP_DRDY_IRQ_INT2_MASK	0x20
> +#define ST_PRESS_LPS331AP_MULTIREAD_BIT		true
> +#define ST_PRESS_LPS331AP_TEMP_OFFSET		42500
> +#define ST_PRESS_LPS331AP_OUT_XL_ADDR		0x28
> +#define ST_TEMP_LPS331AP_OUT_L_ADDR		0x2b
>  
>  static const struct iio_chan_spec st_press_channels[] = {
>  	ST_SENSORS_LSM_CHANNELS(IIO_PRESSURE,
>  			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
>  			ST_SENSORS_SCAN_X, 0, IIO_NO_MOD, 'u', IIO_LE, 24, 24,
> -			ST_PRESS_DEFAULT_OUT_XL_ADDR),
> +			ST_PRESS_LPS331AP_OUT_XL_ADDR),
>  	ST_SENSORS_LSM_CHANNELS(IIO_TEMP,
>  			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) |
>  						BIT(IIO_CHAN_INFO_OFFSET),
>  			-1, 0, IIO_NO_MOD, 's', IIO_LE, 16, 16,
> -			ST_TEMP_DEFAULT_OUT_L_ADDR),
> +			ST_TEMP_LPS331AP_OUT_L_ADDR),
>  	IIO_CHAN_SOFT_TIMESTAMP(1)
>  };
>  
>  static const struct st_sensors st_press_sensors[] = {
>  	{
> -		.wai = ST_PRESS_1_WAI_EXP,
> +		.wai = ST_PRESS_LPS331AP_WAI_EXP,
>  		.sensors_supported = {
>  			[0] = LPS331AP_PRESS_DEV_NAME,
>  		},
>  		.ch = (struct iio_chan_spec *)st_press_channels,
>  		.odr = {
> -			.addr = ST_PRESS_1_ODR_ADDR,
> -			.mask = ST_PRESS_1_ODR_MASK,
> +			.addr = ST_PRESS_LPS331AP_ODR_ADDR,
> +			.mask = ST_PRESS_LPS331AP_ODR_MASK,
>  			.odr_avl = {
> -				{ 1, ST_PRESS_1_ODR_AVL_1HZ_VAL, },
> -				{ 7, ST_PRESS_1_ODR_AVL_7HZ_VAL, },
> -				{ 13, ST_PRESS_1_ODR_AVL_13HZ_VAL, },
> -				{ 25, ST_PRESS_1_ODR_AVL_25HZ_VAL, },
> +				{ 1, ST_PRESS_LPS331AP_ODR_AVL_1HZ_VAL, },
> +				{ 7, ST_PRESS_LPS331AP_ODR_AVL_7HZ_VAL, },
> +				{ 13, ST_PRESS_LPS331AP_ODR_AVL_13HZ_VAL, },
> +				{ 25, ST_PRESS_LPS331AP_ODR_AVL_25HZ_VAL, },
>  			},
>  		},
>  		.pw = {
> -			.addr = ST_PRESS_1_PW_ADDR,
> -			.mask = ST_PRESS_1_PW_MASK,
> +			.addr = ST_PRESS_LPS331AP_PW_ADDR,
> +			.mask = ST_PRESS_LPS331AP_PW_MASK,
>  			.value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE,
>  			.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
>  		},
>  		.fs = {
> -			.addr = ST_PRESS_1_FS_ADDR,
> -			.mask = ST_PRESS_1_FS_MASK,
> +			.addr = ST_PRESS_LPS331AP_FS_ADDR,
> +			.mask = ST_PRESS_LPS331AP_FS_MASK,
>  			.fs_avl = {
>  				[0] = {
>  					.num = ST_PRESS_FS_AVL_1260MB,
> -					.value = ST_PRESS_1_FS_AVL_1260_VAL,
> -					.gain = ST_PRESS_1_FS_AVL_1260_GAIN,
> -					.gain2 = ST_PRESS_1_FS_AVL_TEMP_GAIN,
> +					.value = ST_PRESS_LPS331AP_FS_AVL_1260_VAL,
> +					.gain = ST_PRESS_LPS331AP_FS_AVL_1260_GAIN,
> +					.gain2 = ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN,
>  				},
>  			},
>  		},
>  		.bdu = {
> -			.addr = ST_PRESS_1_BDU_ADDR,
> -			.mask = ST_PRESS_1_BDU_MASK,
> +			.addr = ST_PRESS_LPS331AP_BDU_ADDR,
> +			.mask = ST_PRESS_LPS331AP_BDU_MASK,
>  		},
>  		.drdy_irq = {
> -			.addr = ST_PRESS_1_DRDY_IRQ_ADDR,
> -			.mask_int1 = ST_PRESS_1_DRDY_IRQ_INT1_MASK,
> -			.mask_int2 = ST_PRESS_1_DRDY_IRQ_INT2_MASK,
> +			.addr = ST_PRESS_LPS331AP_DRDY_IRQ_ADDR,
> +			.mask_int1 = ST_PRESS_LPS331AP_DRDY_IRQ_INT1_MASK,
> +			.mask_int2 = ST_PRESS_LPS331AP_DRDY_IRQ_INT2_MASK,
>  		},
> -		.multi_read_bit = ST_PRESS_1_MULTIREAD_BIT,
> +		.multi_read_bit = ST_PRESS_LPS331AP_MULTIREAD_BIT,
>  		.bootime = 2,
>  	},
>  };
> 

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

* Re: [PATCH 24/38] iio: pressure-core: st: Expand and rename LPS331AP's channel descriptor
  2013-09-10 12:49   ` Lee Jones
@ 2013-09-14 17:14     ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:14 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, jic23, arnd, linus.walleij,
	denis.ciocca, linux-iio

On 09/10/13 13:49, Lee Jones wrote:
> Due to the MACRO used, the task of reading, understanding and maintaining
> the LPS331AP's channel descriptor is substantially difficult. This patch
> is based on the view that it's better to have easy to read, maintainable
> code than to save a few lines here and there. For that reason we're
> expanding the array so initialisation is completed in full.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Agreed that in this case it is clearer not to use a macro.  When you have lots
of repeats (e.g. an adc with 16 channels) they can make sense, but here as
you say a few extra lines of code make it much easier to follow.
My only slight addition here would be to drop the IIO_NO_MOD and modified=0 bits
on the basis those are both the obvious defaults (and happen to be equal to 0).
Perhaps worth leaving them in this case as it makes the patch more obviously correct.

Applied to the togreg branch of iio.git

Thanks,

Jonathan
> ---
>  drivers/iio/pressure/st_pressure_core.c | 45 +++++++++++++++++++++++++--------
>  1 file changed, 34 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 2ee4bcd..60c2ee4 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -64,16 +64,39 @@
>  #define ST_PRESS_LPS331AP_OUT_XL_ADDR		0x28
>  #define ST_TEMP_LPS331AP_OUT_L_ADDR		0x2b
>  
> -static const struct iio_chan_spec st_press_channels[] = {
> -	ST_SENSORS_LSM_CHANNELS(IIO_PRESSURE,
> +static const struct iio_chan_spec st_press_lps331ap_channels[] = {
> +	{
> +		.type = IIO_PRESSURE,
> +		.channel2 = IIO_NO_MOD,
> +		.address = ST_PRESS_LPS331AP_OUT_XL_ADDR,
> +		.scan_index = ST_SENSORS_SCAN_X,
> +		.scan_type = {
> +			.sign = 'u',
> +			.realbits = 24,
> +			.storagebits = 24,
> +			.endianness = IIO_LE,
> +		},
> +		.info_mask_separate =
>  			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
> -			ST_SENSORS_SCAN_X, 0, IIO_NO_MOD, 'u', IIO_LE, 24, 24,
> -			ST_PRESS_LPS331AP_OUT_XL_ADDR),
> -	ST_SENSORS_LSM_CHANNELS(IIO_TEMP,
> -			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) |
> -						BIT(IIO_CHAN_INFO_OFFSET),
> -			-1, 0, IIO_NO_MOD, 's', IIO_LE, 16, 16,
> -			ST_TEMP_LPS331AP_OUT_L_ADDR),
> +		.modified = 0,
> +	},
> +	{
> +		.type = IIO_TEMP,
> +		.channel2 = IIO_NO_MOD,
> +		.address = ST_TEMP_LPS331AP_OUT_L_ADDR,
> +		.scan_index = -1,
> +		.scan_type = {
> +			.sign = 'u',
> +			.realbits = 16,
> +			.storagebits = 16,
> +			.endianness = IIO_LE,
> +		},
> +		.info_mask_separate =
> +			BIT(IIO_CHAN_INFO_RAW) |
> +			BIT(IIO_CHAN_INFO_SCALE) |
> +			BIT(IIO_CHAN_INFO_OFFSET),
> +		.modified = 0,
> +	},
>  	IIO_CHAN_SOFT_TIMESTAMP(1)
>  };
>  
> @@ -83,7 +106,7 @@ static const struct st_sensors st_press_sensors[] = {
>  		.sensors_supported = {
>  			[0] = LPS331AP_PRESS_DEV_NAME,
>  		},
> -		.ch = (struct iio_chan_spec *)st_press_channels,
> +		.ch = (struct iio_chan_spec *)st_press_lps331ap_channels,
>  		.odr = {
>  			.addr = ST_PRESS_LPS331AP_ODR_ADDR,
>  			.mask = ST_PRESS_LPS331AP_ODR_MASK,
> @@ -222,7 +245,7 @@ int st_press_common_probe(struct iio_dev *indio_dev,
>  	pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS;
>  	pdata->multiread_bit = pdata->sensor->multi_read_bit;
>  	indio_dev->channels = pdata->sensor->ch;
> -	indio_dev->num_channels = ARRAY_SIZE(st_press_channels);
> +	indio_dev->num_channels = ARRAY_SIZE(st_press_lps331ap_channels);
>  
>  	if (pdata->sensor->fs.addr != 0)
>  		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
> 

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

* [PATCH 24/38] iio: pressure-core: st: Expand and rename LPS331AP's channel descriptor
@ 2013-09-14 17:14     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:14 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/10/13 13:49, Lee Jones wrote:
> Due to the MACRO used, the task of reading, understanding and maintaining
> the LPS331AP's channel descriptor is substantially difficult. This patch
> is based on the view that it's better to have easy to read, maintainable
> code than to save a few lines here and there. For that reason we're
> expanding the array so initialisation is completed in full.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Agreed that in this case it is clearer not to use a macro.  When you have lots
of repeats (e.g. an adc with 16 channels) they can make sense, but here as
you say a few extra lines of code make it much easier to follow.
My only slight addition here would be to drop the IIO_NO_MOD and modified=0 bits
on the basis those are both the obvious defaults (and happen to be equal to 0).
Perhaps worth leaving them in this case as it makes the patch more obviously correct.

Applied to the togreg branch of iio.git

Thanks,

Jonathan
> ---
>  drivers/iio/pressure/st_pressure_core.c | 45 +++++++++++++++++++++++++--------
>  1 file changed, 34 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 2ee4bcd..60c2ee4 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -64,16 +64,39 @@
>  #define ST_PRESS_LPS331AP_OUT_XL_ADDR		0x28
>  #define ST_TEMP_LPS331AP_OUT_L_ADDR		0x2b
>  
> -static const struct iio_chan_spec st_press_channels[] = {
> -	ST_SENSORS_LSM_CHANNELS(IIO_PRESSURE,
> +static const struct iio_chan_spec st_press_lps331ap_channels[] = {
> +	{
> +		.type = IIO_PRESSURE,
> +		.channel2 = IIO_NO_MOD,
> +		.address = ST_PRESS_LPS331AP_OUT_XL_ADDR,
> +		.scan_index = ST_SENSORS_SCAN_X,
> +		.scan_type = {
> +			.sign = 'u',
> +			.realbits = 24,
> +			.storagebits = 24,
> +			.endianness = IIO_LE,
> +		},
> +		.info_mask_separate =
>  			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
> -			ST_SENSORS_SCAN_X, 0, IIO_NO_MOD, 'u', IIO_LE, 24, 24,
> -			ST_PRESS_LPS331AP_OUT_XL_ADDR),
> -	ST_SENSORS_LSM_CHANNELS(IIO_TEMP,
> -			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) |
> -						BIT(IIO_CHAN_INFO_OFFSET),
> -			-1, 0, IIO_NO_MOD, 's', IIO_LE, 16, 16,
> -			ST_TEMP_LPS331AP_OUT_L_ADDR),
> +		.modified = 0,
> +	},
> +	{
> +		.type = IIO_TEMP,
> +		.channel2 = IIO_NO_MOD,
> +		.address = ST_TEMP_LPS331AP_OUT_L_ADDR,
> +		.scan_index = -1,
> +		.scan_type = {
> +			.sign = 'u',
> +			.realbits = 16,
> +			.storagebits = 16,
> +			.endianness = IIO_LE,
> +		},
> +		.info_mask_separate =
> +			BIT(IIO_CHAN_INFO_RAW) |
> +			BIT(IIO_CHAN_INFO_SCALE) |
> +			BIT(IIO_CHAN_INFO_OFFSET),
> +		.modified = 0,
> +	},
>  	IIO_CHAN_SOFT_TIMESTAMP(1)
>  };
>  
> @@ -83,7 +106,7 @@ static const struct st_sensors st_press_sensors[] = {
>  		.sensors_supported = {
>  			[0] = LPS331AP_PRESS_DEV_NAME,
>  		},
> -		.ch = (struct iio_chan_spec *)st_press_channels,
> +		.ch = (struct iio_chan_spec *)st_press_lps331ap_channels,
>  		.odr = {
>  			.addr = ST_PRESS_LPS331AP_ODR_ADDR,
>  			.mask = ST_PRESS_LPS331AP_ODR_MASK,
> @@ -222,7 +245,7 @@ int st_press_common_probe(struct iio_dev *indio_dev,
>  	pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS;
>  	pdata->multiread_bit = pdata->sensor->multi_read_bit;
>  	indio_dev->channels = pdata->sensor->ch;
> -	indio_dev->num_channels = ARRAY_SIZE(st_press_channels);
> +	indio_dev->num_channels = ARRAY_SIZE(st_press_lps331ap_channels);
>  
>  	if (pdata->sensor->fs.addr != 0)
>  		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
> 

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

* Re: [PATCH 25/38] iio: pressure-core: st: Allow for number of channels to vary
  2013-09-10 12:49   ` Lee Jones
@ 2013-09-14 17:18     ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:18 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, jic23, arnd, linus.walleij,
	denis.ciocca, linux-iio

On 09/10/13 13:49, Lee Jones wrote:
> At the moment the number of channels specified is dictated by the first
> sensor supported by the driver. As we add support for more sensors this
> is likely to vary. Instead of using the ARRAY_SIZE() of the LPS331AP's
> channel specifier we'll use a new adaptable 'struct st_sensors' element
> instead.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Applied with Denis ack (again it should have been here)
> ---
>  drivers/iio/pressure/st_pressure_core.c | 3 ++-
>  include/linux/iio/common/st_sensors.h   | 1 +
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 60c2ee4..3abada2 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -107,6 +107,7 @@ static const struct st_sensors st_press_sensors[] = {
>  			[0] = LPS331AP_PRESS_DEV_NAME,
>  		},
>  		.ch = (struct iio_chan_spec *)st_press_lps331ap_channels,
> +		.num_ch = ARRAY_SIZE(st_press_lps331ap_channels),
>  		.odr = {
>  			.addr = ST_PRESS_LPS331AP_ODR_ADDR,
>  			.mask = ST_PRESS_LPS331AP_ODR_MASK,
> @@ -245,7 +246,7 @@ int st_press_common_probe(struct iio_dev *indio_dev,
>  	pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS;
>  	pdata->multiread_bit = pdata->sensor->multi_read_bit;
>  	indio_dev->channels = pdata->sensor->ch;
> -	indio_dev->num_channels = ARRAY_SIZE(st_press_lps331ap_channels);
> +	indio_dev->num_channels = pdata->sensor->num_ch;
>  
>  	if (pdata->sensor->fs.addr != 0)
>  		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
> diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
> index e51f654..e732fda 100644
> --- a/include/linux/iio/common/st_sensors.h
> +++ b/include/linux/iio/common/st_sensors.h
> @@ -184,6 +184,7 @@ struct st_sensors {
>  	u8 wai;
>  	char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME];
>  	struct iio_chan_spec *ch;
> +	int num_ch;
>  	struct st_sensor_odr odr;
>  	struct st_sensor_power pw;
>  	struct st_sensor_axis enable_axis;
> 

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

* [PATCH 25/38] iio: pressure-core: st: Allow for number of channels to vary
@ 2013-09-14 17:18     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:18 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/10/13 13:49, Lee Jones wrote:
> At the moment the number of channels specified is dictated by the first
> sensor supported by the driver. As we add support for more sensors this
> is likely to vary. Instead of using the ARRAY_SIZE() of the LPS331AP's
> channel specifier we'll use a new adaptable 'struct st_sensors' element
> instead.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Applied with Denis ack (again it should have been here)
> ---
>  drivers/iio/pressure/st_pressure_core.c | 3 ++-
>  include/linux/iio/common/st_sensors.h   | 1 +
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 60c2ee4..3abada2 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -107,6 +107,7 @@ static const struct st_sensors st_press_sensors[] = {
>  			[0] = LPS331AP_PRESS_DEV_NAME,
>  		},
>  		.ch = (struct iio_chan_spec *)st_press_lps331ap_channels,
> +		.num_ch = ARRAY_SIZE(st_press_lps331ap_channels),
>  		.odr = {
>  			.addr = ST_PRESS_LPS331AP_ODR_ADDR,
>  			.mask = ST_PRESS_LPS331AP_ODR_MASK,
> @@ -245,7 +246,7 @@ int st_press_common_probe(struct iio_dev *indio_dev,
>  	pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS;
>  	pdata->multiread_bit = pdata->sensor->multi_read_bit;
>  	indio_dev->channels = pdata->sensor->ch;
> -	indio_dev->num_channels = ARRAY_SIZE(st_press_lps331ap_channels);
> +	indio_dev->num_channels = pdata->sensor->num_ch;
>  
>  	if (pdata->sensor->fs.addr != 0)
>  		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
> diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
> index e51f654..e732fda 100644
> --- a/include/linux/iio/common/st_sensors.h
> +++ b/include/linux/iio/common/st_sensors.h
> @@ -184,6 +184,7 @@ struct st_sensors {
>  	u8 wai;
>  	char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME];
>  	struct iio_chan_spec *ch;
> +	int num_ch;
>  	struct st_sensor_odr odr;
>  	struct st_sensor_power pw;
>  	struct st_sensor_axis enable_axis;
> 

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

* Re: [PATCH 26/38] iio: pressure-core: st: Clean-up probe() function
  2013-09-11  7:19       ` Lee Jones
@ 2013-09-14 17:21         ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:21 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, jic23, arnd, linus.walleij,
	denis.ciocca, linux-iio

On 09/11/13 08:19, Lee Jones wrote:
>>> 	err = st_sensors_init_sensor(indio_dev, plat_data);
>>> 	if (err < 0)
>>> -		goto st_press_common_probe_error;
>>> +		return err;
>>>
>>> -	if (pdata->get_irq_data_ready(indio_dev) > 0) {
>>> +	if (irq > 0) {
>>> 		err = st_press_allocate_ring(indio_dev);
>>> 		if (err < 0)
>>> -			goto st_press_common_probe_error;
>>> +			return err;
>>>
>>> 		err = st_sensors_allocate_trigger(indio_dev,
>>> -							ST_PRESS_TRIGGER_OPS);
>>> +						  ST_PRESS_TRIGGER_OPS);
>>> 		if (err < 0)
>>> 			goto st_press_probe_trigger_error;
>>> 	}
>>>
>>> 	err = iio_device_register(indio_dev);
>>> -	if (err)
>>
>> This bit of handling is confusing. I would much rather see the if IRQ at the goto. Here the first thought is why is it not an error if there is no IRQ! 
> 
> I certainly see your point. But surely anyone would see after a second
> or two that we're returning err and not 0 in this case, so the error
> would still be returned, we're not ignoring it. Adding this extra
> comparison saves several lines of code.
> 
> If you think it's 'too' confusing, I'll revert the change.
> 
> Or perhaps a comment:
> 
> /* Only deallocate_[trigger|ring] if they were allocated. */
> or
> /* Only deallocate_[trigger|ring] if we have an IRQ line. */
> or
> /* If no IRQ was specified, just return the error. */
> 

Revert the change.  Whilst not complex to follow it is non obvious to save only
a couple of lines. Adding a comment would take almost as much space as just doing
it the 'easy way'.

>>> +	if (err && irq > 0)
>>> 		goto st_press_device_register_error;
>>>
>>> 	return err;
>>>
>>> st_press_device_register_error:
>>> -	if (pdata->get_irq_data_ready(indio_dev) > 0)
>>> -		st_sensors_deallocate_trigger(indio_dev);
>>> +	st_sensors_deallocate_trigger(indio_dev);
>>> st_press_probe_trigger_error:
>>> -	if (pdata->get_irq_data_ready(indio_dev) > 0)
>>> -		st_press_deallocate_ring(indio_dev);
>>> -st_press_common_probe_error:
>>> +	st_press_deallocate_ring(indio_dev);
>>> +
>>> 	return err;
>>> }
>>> EXPORT_SYMBOL(st_press_common_probe);
>>
> 

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

* [PATCH 26/38] iio: pressure-core: st: Clean-up probe() function
@ 2013-09-14 17:21         ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:21 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/11/13 08:19, Lee Jones wrote:
>>> 	err = st_sensors_init_sensor(indio_dev, plat_data);
>>> 	if (err < 0)
>>> -		goto st_press_common_probe_error;
>>> +		return err;
>>>
>>> -	if (pdata->get_irq_data_ready(indio_dev) > 0) {
>>> +	if (irq > 0) {
>>> 		err = st_press_allocate_ring(indio_dev);
>>> 		if (err < 0)
>>> -			goto st_press_common_probe_error;
>>> +			return err;
>>>
>>> 		err = st_sensors_allocate_trigger(indio_dev,
>>> -							ST_PRESS_TRIGGER_OPS);
>>> +						  ST_PRESS_TRIGGER_OPS);
>>> 		if (err < 0)
>>> 			goto st_press_probe_trigger_error;
>>> 	}
>>>
>>> 	err = iio_device_register(indio_dev);
>>> -	if (err)
>>
>> This bit of handling is confusing. I would much rather see the if IRQ at the goto. Here the first thought is why is it not an error if there is no IRQ! 
> 
> I certainly see your point. But surely anyone would see after a second
> or two that we're returning err and not 0 in this case, so the error
> would still be returned, we're not ignoring it. Adding this extra
> comparison saves several lines of code.
> 
> If you think it's 'too' confusing, I'll revert the change.
> 
> Or perhaps a comment:
> 
> /* Only deallocate_[trigger|ring] if they were allocated. */
> or
> /* Only deallocate_[trigger|ring] if we have an IRQ line. */
> or
> /* If no IRQ was specified, just return the error. */
> 

Revert the change.  Whilst not complex to follow it is non obvious to save only
a couple of lines. Adding a comment would take almost as much space as just doing
it the 'easy way'.

>>> +	if (err && irq > 0)
>>> 		goto st_press_device_register_error;
>>>
>>> 	return err;
>>>
>>> st_press_device_register_error:
>>> -	if (pdata->get_irq_data_ready(indio_dev) > 0)
>>> -		st_sensors_deallocate_trigger(indio_dev);
>>> +	st_sensors_deallocate_trigger(indio_dev);
>>> st_press_probe_trigger_error:
>>> -	if (pdata->get_irq_data_ready(indio_dev) > 0)
>>> -		st_press_deallocate_ring(indio_dev);
>>> -st_press_common_probe_error:
>>> +	st_press_deallocate_ring(indio_dev);
>>> +
>>> 	return err;
>>> }
>>> EXPORT_SYMBOL(st_press_common_probe);
>>
> 

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

* Re: [PATCH 28/38] iio: pressure: st: Add support for new LPS001WP pressure sensor
  2013-09-10 12:49   ` Lee Jones
@ 2013-09-14 17:26     ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:26 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, arnd, linus.walleij,
	denis.ciocca, linux-iio

On 09/10/13 13:49, Lee Jones wrote:
> Here we use existing practices to introduce support for another
> pressure/temperature sensor, the LPS001WP.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Looks fine to me, will pick this up when the precursors are all sorted.
> ---
>  drivers/iio/pressure/st_pressure.h      |  1 +
>  drivers/iio/pressure/st_pressure_core.c | 84 +++++++++++++++++++++++++++++++++
>  drivers/iio/pressure/st_pressure_i2c.c  |  1 +
>  3 files changed, 86 insertions(+)
> 
> diff --git a/drivers/iio/pressure/st_pressure.h b/drivers/iio/pressure/st_pressure.h
> index f1bebce..36b1cc6 100644
> --- a/drivers/iio/pressure/st_pressure.h
> +++ b/drivers/iio/pressure/st_pressure.h
> @@ -15,6 +15,7 @@
>  #include <linux/iio/common/st_sensors.h>
>  
>  #define LPS331AP_PRESS_DEV_NAME		"lps331ap_press"
> +#define LPS001WP_PRESS_DEV_NAME		"lps001wp_press"
>  
>  /**
>   * struct st_sensors_platform_data - default press platform data
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 34b3fb1..b42614a 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -64,6 +64,21 @@
>  #define ST_PRESS_LPS331AP_OUT_XL_ADDR		0x28
>  #define ST_TEMP_LPS331AP_OUT_L_ADDR		0x2b
>  
> +/* CUSTOM VALUES FOR LPS001WP SENSOR */
> +#define ST_PRESS_LPS001WP_WAI_EXP		0xba
> +#define ST_PRESS_LPS001WP_ODR_ADDR		0x20
> +#define ST_PRESS_LPS001WP_ODR_MASK		0x30
> +#define ST_PRESS_LPS001WP_ODR_AVL_1HZ_VAL	0x01
> +#define ST_PRESS_LPS001WP_ODR_AVL_7HZ_VAL	0x02
> +#define ST_PRESS_LPS001WP_ODR_AVL_13HZ_VAL	0x03
> +#define ST_PRESS_LPS001WP_PW_ADDR		0x20
> +#define ST_PRESS_LPS001WP_PW_MASK		0x40
> +#define ST_PRESS_LPS001WP_BDU_ADDR		0x20
> +#define ST_PRESS_LPS001WP_BDU_MASK		0x04
> +#define ST_PRESS_LPS001WP_MULTIREAD_BIT		true
> +#define ST_PRESS_LPS001WP_OUT_L_ADDR		0x28
> +#define ST_TEMP_LPS001WP_OUT_L_ADDR		0x2a
> +
>  static const struct iio_chan_spec st_press_lps331ap_channels[] = {
>  	{
>  		.type = IIO_PRESSURE,
> @@ -100,6 +115,40 @@ static const struct iio_chan_spec st_press_lps331ap_channels[] = {
>  	IIO_CHAN_SOFT_TIMESTAMP(1)
>  };
>  
> +static const struct iio_chan_spec st_press_lps001wp_channels[] = {
> +	{
> +		.type = IIO_PRESSURE,
> +		.channel2 = IIO_NO_MOD,
> +		.address = ST_PRESS_LPS001WP_OUT_L_ADDR,
> +		.scan_index = ST_SENSORS_SCAN_X,
> +		.scan_type = {
> +			.sign = 'u',
> +			.realbits = 16,
> +			.storagebits = 16,
> +			.endianness = IIO_LE,
> +		},
> +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
> +		.modified = 0,
> +	},
> +	{
> +		.type = IIO_TEMP,
> +		.channel2 = IIO_NO_MOD,
> +		.address = ST_TEMP_LPS001WP_OUT_L_ADDR,
> +		.scan_index = -1,
> +		.scan_type = {
> +			.sign = 'u',
> +			.realbits = 16,
> +			.storagebits = 16,
> +			.endianness = IIO_LE,
> +		},
> +		.info_mask_separate =
> +			BIT(IIO_CHAN_INFO_RAW) |
> +			BIT(IIO_CHAN_INFO_OFFSET),
> +		.modified = 0,
> +	},
> +	IIO_CHAN_SOFT_TIMESTAMP(1)
> +};
> +
>  static const struct st_sensors st_press_sensors[] = {
>  	{
>  		.wai = ST_PRESS_LPS331AP_WAI_EXP,
> @@ -148,6 +197,41 @@ static const struct st_sensors st_press_sensors[] = {
>  		.multi_read_bit = ST_PRESS_LPS331AP_MULTIREAD_BIT,
>  		.bootime = 2,
>  	},
> +	{
> +		.wai = ST_PRESS_LPS001WP_WAI_EXP,
> +		.sensors_supported = {
> +			[0] = LPS001WP_PRESS_DEV_NAME,
> +		},
> +		.ch = (struct iio_chan_spec *)st_press_lps001wp_channels,
> +		.num_ch = ARRAY_SIZE(st_press_lps001wp_channels),
> +		.odr = {
> +			.addr = ST_PRESS_LPS001WP_ODR_ADDR,
> +			.mask = ST_PRESS_LPS001WP_ODR_MASK,
> +			.odr_avl = {
> +				{ 1, ST_PRESS_LPS001WP_ODR_AVL_1HZ_VAL, },
> +				{ 7, ST_PRESS_LPS001WP_ODR_AVL_7HZ_VAL, },
> +				{ 13, ST_PRESS_LPS001WP_ODR_AVL_13HZ_VAL, },
> +			},
> +		},
> +		.pw = {
> +			.addr = ST_PRESS_LPS001WP_PW_ADDR,
> +			.mask = ST_PRESS_LPS001WP_PW_MASK,
> +			.value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE,
> +			.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
> +		},
> +		.fs = {
> +			.addr = 0,
> +		},
> +		.bdu = {
> +			.addr = ST_PRESS_LPS001WP_BDU_ADDR,
> +			.mask = ST_PRESS_LPS001WP_BDU_MASK,
> +		},
> +		.drdy_irq = {
> +			.addr = 0,
> +		},
> +		.multi_read_bit = ST_PRESS_LPS001WP_MULTIREAD_BIT,
> +		.bootime = 2,
> +	},
>  };
>  
>  static int st_press_read_raw(struct iio_dev *indio_dev,
> diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c
> index 08aac5e..ada5cbd 100644
> --- a/drivers/iio/pressure/st_pressure_i2c.c
> +++ b/drivers/iio/pressure/st_pressure_i2c.c
> @@ -50,6 +50,7 @@ static int st_press_i2c_remove(struct i2c_client *client)
>  
>  static const struct i2c_device_id st_press_id_table[] = {
>  	{ LPS331AP_PRESS_DEV_NAME },
> +	{ LPS001WP_PRESS_DEV_NAME },
>  	{},
>  };
>  MODULE_DEVICE_TABLE(i2c, st_press_id_table);
> 

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

* [PATCH 28/38] iio: pressure: st: Add support for new LPS001WP pressure sensor
@ 2013-09-14 17:26     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:26 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/10/13 13:49, Lee Jones wrote:
> Here we use existing practices to introduce support for another
> pressure/temperature sensor, the LPS001WP.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Looks fine to me, will pick this up when the precursors are all sorted.
> ---
>  drivers/iio/pressure/st_pressure.h      |  1 +
>  drivers/iio/pressure/st_pressure_core.c | 84 +++++++++++++++++++++++++++++++++
>  drivers/iio/pressure/st_pressure_i2c.c  |  1 +
>  3 files changed, 86 insertions(+)
> 
> diff --git a/drivers/iio/pressure/st_pressure.h b/drivers/iio/pressure/st_pressure.h
> index f1bebce..36b1cc6 100644
> --- a/drivers/iio/pressure/st_pressure.h
> +++ b/drivers/iio/pressure/st_pressure.h
> @@ -15,6 +15,7 @@
>  #include <linux/iio/common/st_sensors.h>
>  
>  #define LPS331AP_PRESS_DEV_NAME		"lps331ap_press"
> +#define LPS001WP_PRESS_DEV_NAME		"lps001wp_press"
>  
>  /**
>   * struct st_sensors_platform_data - default press platform data
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 34b3fb1..b42614a 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -64,6 +64,21 @@
>  #define ST_PRESS_LPS331AP_OUT_XL_ADDR		0x28
>  #define ST_TEMP_LPS331AP_OUT_L_ADDR		0x2b
>  
> +/* CUSTOM VALUES FOR LPS001WP SENSOR */
> +#define ST_PRESS_LPS001WP_WAI_EXP		0xba
> +#define ST_PRESS_LPS001WP_ODR_ADDR		0x20
> +#define ST_PRESS_LPS001WP_ODR_MASK		0x30
> +#define ST_PRESS_LPS001WP_ODR_AVL_1HZ_VAL	0x01
> +#define ST_PRESS_LPS001WP_ODR_AVL_7HZ_VAL	0x02
> +#define ST_PRESS_LPS001WP_ODR_AVL_13HZ_VAL	0x03
> +#define ST_PRESS_LPS001WP_PW_ADDR		0x20
> +#define ST_PRESS_LPS001WP_PW_MASK		0x40
> +#define ST_PRESS_LPS001WP_BDU_ADDR		0x20
> +#define ST_PRESS_LPS001WP_BDU_MASK		0x04
> +#define ST_PRESS_LPS001WP_MULTIREAD_BIT		true
> +#define ST_PRESS_LPS001WP_OUT_L_ADDR		0x28
> +#define ST_TEMP_LPS001WP_OUT_L_ADDR		0x2a
> +
>  static const struct iio_chan_spec st_press_lps331ap_channels[] = {
>  	{
>  		.type = IIO_PRESSURE,
> @@ -100,6 +115,40 @@ static const struct iio_chan_spec st_press_lps331ap_channels[] = {
>  	IIO_CHAN_SOFT_TIMESTAMP(1)
>  };
>  
> +static const struct iio_chan_spec st_press_lps001wp_channels[] = {
> +	{
> +		.type = IIO_PRESSURE,
> +		.channel2 = IIO_NO_MOD,
> +		.address = ST_PRESS_LPS001WP_OUT_L_ADDR,
> +		.scan_index = ST_SENSORS_SCAN_X,
> +		.scan_type = {
> +			.sign = 'u',
> +			.realbits = 16,
> +			.storagebits = 16,
> +			.endianness = IIO_LE,
> +		},
> +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
> +		.modified = 0,
> +	},
> +	{
> +		.type = IIO_TEMP,
> +		.channel2 = IIO_NO_MOD,
> +		.address = ST_TEMP_LPS001WP_OUT_L_ADDR,
> +		.scan_index = -1,
> +		.scan_type = {
> +			.sign = 'u',
> +			.realbits = 16,
> +			.storagebits = 16,
> +			.endianness = IIO_LE,
> +		},
> +		.info_mask_separate =
> +			BIT(IIO_CHAN_INFO_RAW) |
> +			BIT(IIO_CHAN_INFO_OFFSET),
> +		.modified = 0,
> +	},
> +	IIO_CHAN_SOFT_TIMESTAMP(1)
> +};
> +
>  static const struct st_sensors st_press_sensors[] = {
>  	{
>  		.wai = ST_PRESS_LPS331AP_WAI_EXP,
> @@ -148,6 +197,41 @@ static const struct st_sensors st_press_sensors[] = {
>  		.multi_read_bit = ST_PRESS_LPS331AP_MULTIREAD_BIT,
>  		.bootime = 2,
>  	},
> +	{
> +		.wai = ST_PRESS_LPS001WP_WAI_EXP,
> +		.sensors_supported = {
> +			[0] = LPS001WP_PRESS_DEV_NAME,
> +		},
> +		.ch = (struct iio_chan_spec *)st_press_lps001wp_channels,
> +		.num_ch = ARRAY_SIZE(st_press_lps001wp_channels),
> +		.odr = {
> +			.addr = ST_PRESS_LPS001WP_ODR_ADDR,
> +			.mask = ST_PRESS_LPS001WP_ODR_MASK,
> +			.odr_avl = {
> +				{ 1, ST_PRESS_LPS001WP_ODR_AVL_1HZ_VAL, },
> +				{ 7, ST_PRESS_LPS001WP_ODR_AVL_7HZ_VAL, },
> +				{ 13, ST_PRESS_LPS001WP_ODR_AVL_13HZ_VAL, },
> +			},
> +		},
> +		.pw = {
> +			.addr = ST_PRESS_LPS001WP_PW_ADDR,
> +			.mask = ST_PRESS_LPS001WP_PW_MASK,
> +			.value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE,
> +			.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
> +		},
> +		.fs = {
> +			.addr = 0,
> +		},
> +		.bdu = {
> +			.addr = ST_PRESS_LPS001WP_BDU_ADDR,
> +			.mask = ST_PRESS_LPS001WP_BDU_MASK,
> +		},
> +		.drdy_irq = {
> +			.addr = 0,
> +		},
> +		.multi_read_bit = ST_PRESS_LPS001WP_MULTIREAD_BIT,
> +		.bootime = 2,
> +	},
>  };
>  
>  static int st_press_read_raw(struct iio_dev *indio_dev,
> diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c
> index 08aac5e..ada5cbd 100644
> --- a/drivers/iio/pressure/st_pressure_i2c.c
> +++ b/drivers/iio/pressure/st_pressure_i2c.c
> @@ -50,6 +50,7 @@ static int st_press_i2c_remove(struct i2c_client *client)
>  
>  static const struct i2c_device_id st_press_id_table[] = {
>  	{ LPS331AP_PRESS_DEV_NAME },
> +	{ LPS001WP_PRESS_DEV_NAME },
>  	{},
>  };
>  MODULE_DEVICE_TABLE(i2c, st_press_id_table);
> 

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

* Re: [PATCH 29/38] iio: pressure-core: st: Provide support for the Vdd power supply
  2013-09-10 12:49   ` Lee Jones
@ 2013-09-14 17:28     ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:28 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, arnd, linus.walleij,
	denis.ciocca, linux-iio

On 09/10/13 13:49, Lee Jones wrote:
> The power to some of the sensors are controlled by regulators. In most
> cases these are 'always on', but if not they will fail to work until
> the regulator is enabled using the relevant APIs. This patch allows for
> the Vdd power supply to be specified by either platform data or Device
> Tree.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Fine, will pick up with the rest.  This optional regulator stuff is nice as
it gets around the annoying platform specific callbacks that tend to do stuff
like this.

If anyone is bored, I suspect there are quite a few cases where this makes sense
in other IIO drivers!
> ---
>  drivers/iio/pressure/st_pressure_core.c | 28 ++++++++++++++++++++++++++++
>  include/linux/iio/common/st_sensors.h   |  3 +++
>  2 files changed, 31 insertions(+)
> 
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index b42614a..d52b487 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -23,6 +23,7 @@
>  #include <linux/iio/sysfs.h>
>  #include <linux/iio/trigger.h>
>  #include <linux/iio/buffer.h>
> +#include <linux/regulator/consumer.h>
>  #include <asm/unaligned.h>
>  
>  #include <linux/iio/common/st_sensors.h>
> @@ -313,6 +314,29 @@ static const struct iio_trigger_ops st_press_trigger_ops = {
>  #define ST_PRESS_TRIGGER_OPS NULL
>  #endif
>  
> +void st_press_power_enable(struct iio_dev *indio_dev)
> +{
> +	struct st_sensor_data *pdata = iio_priv(indio_dev);
> +	int err;
> +
> +	/* Regulators not mandatory, but if requested we should enable it. */
> +	pdata->vdd = devm_regulator_get_optional(&indio_dev->dev, "vdd");
> +	if (!IS_ERR(pdata->vdd)) {
> +		err = regulator_enable(pdata->vdd);
> +		if (err != 0)
> +			dev_warn(&indio_dev->dev,
> +				 "Failed to enable specified Vdd supply\n");
> +	}
> +}
> +
> +void st_press_power_disable(struct iio_dev *indio_dev)
> +{
> +	struct st_sensor_data *pdata = iio_priv(indio_dev);
> +
> +	if (!IS_ERR(pdata->vdd))
> +		regulator_disable(pdata->vdd);
> +}
> +
>  int st_press_common_probe(struct iio_dev *indio_dev,
>  				struct st_sensors_platform_data *plat_data)
>  {
> @@ -323,6 +347,8 @@ int st_press_common_probe(struct iio_dev *indio_dev,
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  	indio_dev->info = &press_info;
>  
> +	st_press_power_enable(indio_dev);
> +
>  	err = st_sensors_check_device_support(indio_dev,
>  					      ARRAY_SIZE(st_press_sensors),
>  					      st_press_sensors);
> @@ -382,6 +408,8 @@ void st_press_common_remove(struct iio_dev *indio_dev)
>  {
>  	struct st_sensor_data *pdata = iio_priv(indio_dev);
>  
> +	st_press_power_disable(indio_dev);
> +
>  	iio_device_unregister(indio_dev);
>  	if (pdata->get_irq_data_ready(indio_dev) > 0) {
>  		st_sensors_deallocate_trigger(indio_dev);
> diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
> index e732fda..968b84e 100644
> --- a/include/linux/iio/common/st_sensors.h
> +++ b/include/linux/iio/common/st_sensors.h
> @@ -16,6 +16,7 @@
>  #include <linux/irqreturn.h>
>  #include <linux/iio/trigger.h>
>  #include <linux/bitops.h>
> +#include <linux/regulator/consumer.h>
>  
>  #include <linux/platform_data/st_sensors_pdata.h>
>  
> @@ -201,6 +202,7 @@ struct st_sensors {
>   * @trig: The trigger in use by the core driver.
>   * @sensor: Pointer to the current sensor struct in use.
>   * @current_fullscale: Maximum range of measure by the sensor.
> + * @vdd: Pointer to sensor's Vdd power supply
>   * @enabled: Status of the sensor (false->off, true->on).
>   * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
>   * @buffer_data: Data used by buffer part.
> @@ -216,6 +218,7 @@ struct st_sensor_data {
>  	struct iio_trigger *trig;
>  	struct st_sensors *sensor;
>  	struct st_sensor_fullscale_avl *current_fullscale;
> +	struct regulator *vdd;
>  
>  	bool enabled;
>  	bool multiread_bit;
> 

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

* [PATCH 29/38] iio: pressure-core: st: Provide support for the Vdd power supply
@ 2013-09-14 17:28     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:28 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/10/13 13:49, Lee Jones wrote:
> The power to some of the sensors are controlled by regulators. In most
> cases these are 'always on', but if not they will fail to work until
> the regulator is enabled using the relevant APIs. This patch allows for
> the Vdd power supply to be specified by either platform data or Device
> Tree.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Fine, will pick up with the rest.  This optional regulator stuff is nice as
it gets around the annoying platform specific callbacks that tend to do stuff
like this.

If anyone is bored, I suspect there are quite a few cases where this makes sense
in other IIO drivers!
> ---
>  drivers/iio/pressure/st_pressure_core.c | 28 ++++++++++++++++++++++++++++
>  include/linux/iio/common/st_sensors.h   |  3 +++
>  2 files changed, 31 insertions(+)
> 
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index b42614a..d52b487 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -23,6 +23,7 @@
>  #include <linux/iio/sysfs.h>
>  #include <linux/iio/trigger.h>
>  #include <linux/iio/buffer.h>
> +#include <linux/regulator/consumer.h>
>  #include <asm/unaligned.h>
>  
>  #include <linux/iio/common/st_sensors.h>
> @@ -313,6 +314,29 @@ static const struct iio_trigger_ops st_press_trigger_ops = {
>  #define ST_PRESS_TRIGGER_OPS NULL
>  #endif
>  
> +void st_press_power_enable(struct iio_dev *indio_dev)
> +{
> +	struct st_sensor_data *pdata = iio_priv(indio_dev);
> +	int err;
> +
> +	/* Regulators not mandatory, but if requested we should enable it. */
> +	pdata->vdd = devm_regulator_get_optional(&indio_dev->dev, "vdd");
> +	if (!IS_ERR(pdata->vdd)) {
> +		err = regulator_enable(pdata->vdd);
> +		if (err != 0)
> +			dev_warn(&indio_dev->dev,
> +				 "Failed to enable specified Vdd supply\n");
> +	}
> +}
> +
> +void st_press_power_disable(struct iio_dev *indio_dev)
> +{
> +	struct st_sensor_data *pdata = iio_priv(indio_dev);
> +
> +	if (!IS_ERR(pdata->vdd))
> +		regulator_disable(pdata->vdd);
> +}
> +
>  int st_press_common_probe(struct iio_dev *indio_dev,
>  				struct st_sensors_platform_data *plat_data)
>  {
> @@ -323,6 +347,8 @@ int st_press_common_probe(struct iio_dev *indio_dev,
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  	indio_dev->info = &press_info;
>  
> +	st_press_power_enable(indio_dev);
> +
>  	err = st_sensors_check_device_support(indio_dev,
>  					      ARRAY_SIZE(st_press_sensors),
>  					      st_press_sensors);
> @@ -382,6 +408,8 @@ void st_press_common_remove(struct iio_dev *indio_dev)
>  {
>  	struct st_sensor_data *pdata = iio_priv(indio_dev);
>  
> +	st_press_power_disable(indio_dev);
> +
>  	iio_device_unregister(indio_dev);
>  	if (pdata->get_irq_data_ready(indio_dev) > 0) {
>  		st_sensors_deallocate_trigger(indio_dev);
> diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
> index e732fda..968b84e 100644
> --- a/include/linux/iio/common/st_sensors.h
> +++ b/include/linux/iio/common/st_sensors.h
> @@ -16,6 +16,7 @@
>  #include <linux/irqreturn.h>
>  #include <linux/iio/trigger.h>
>  #include <linux/bitops.h>
> +#include <linux/regulator/consumer.h>
>  
>  #include <linux/platform_data/st_sensors_pdata.h>
>  
> @@ -201,6 +202,7 @@ struct st_sensors {
>   * @trig: The trigger in use by the core driver.
>   * @sensor: Pointer to the current sensor struct in use.
>   * @current_fullscale: Maximum range of measure by the sensor.
> + * @vdd: Pointer to sensor's Vdd power supply
>   * @enabled: Status of the sensor (false->off, true->on).
>   * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
>   * @buffer_data: Data used by buffer part.
> @@ -216,6 +218,7 @@ struct st_sensor_data {
>  	struct iio_trigger *trig;
>  	struct st_sensors *sensor;
>  	struct st_sensor_fullscale_avl *current_fullscale;
> +	struct regulator *vdd;
>  
>  	bool enabled;
>  	bool multiread_bit;
> 

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

* Re: [PATCH 31/38] iio: accel-core: st: Clean up error handling in probe()
  2013-09-10 12:49   ` Lee Jones
@ 2013-09-14 17:31     ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:31 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, arnd, linus.walleij,
	denis.ciocca, linux-iio

On 09/10/13 13:49, Lee Jones wrote:
> Reduce the amount of those unnecessary goto calls, as in most cases
> we can simply return immediately. We also only call for the IRQ number
> once and use that value throughout.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
...
> -	if (adata->get_irq_data_ready(indio_dev) > 0) {
> +	if (irq > 0) {
>  		err = st_accel_allocate_ring(indio_dev);
>  		if (err < 0)
> -			goto st_accel_common_probe_error;
> +			return err;
>  
>  		err = st_sensors_allocate_trigger(indio_dev,
>  						 ST_ACCEL_TRIGGER_OPS);
> @@ -492,18 +493,16 @@ int st_accel_common_probe(struct iio_dev *indio_dev,
>  	}
>  
>  	err = iio_device_register(indio_dev);
> -	if (err)
> +	if (err && irq > 0)
>  		goto st_accel_device_register_error;
This is the same structure I moaned about earlier. Again, put the if (irq > 0) in the error handling
not here.
>  
>  	return err;
>  
>  st_accel_device_register_error:
> -	if (adata->get_irq_data_ready(indio_dev) > 0)
> -		st_sensors_deallocate_trigger(indio_dev);
> +	st_sensors_deallocate_trigger(indio_dev);
>  st_accel_probe_trigger_error:
> -	if (adata->get_irq_data_ready(indio_dev) > 0)
> -		st_accel_deallocate_ring(indio_dev);
> -st_accel_common_probe_error:
> +	st_accel_deallocate_ring(indio_dev);
> +
>  	return err;
>  }
>  EXPORT_SYMBOL(st_accel_common_probe);
> 

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

* [PATCH 31/38] iio: accel-core: st: Clean up error handling in probe()
@ 2013-09-14 17:31     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:31 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/10/13 13:49, Lee Jones wrote:
> Reduce the amount of those unnecessary goto calls, as in most cases
> we can simply return immediately. We also only call for the IRQ number
> once and use that value throughout.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
...
> -	if (adata->get_irq_data_ready(indio_dev) > 0) {
> +	if (irq > 0) {
>  		err = st_accel_allocate_ring(indio_dev);
>  		if (err < 0)
> -			goto st_accel_common_probe_error;
> +			return err;
>  
>  		err = st_sensors_allocate_trigger(indio_dev,
>  						 ST_ACCEL_TRIGGER_OPS);
> @@ -492,18 +493,16 @@ int st_accel_common_probe(struct iio_dev *indio_dev,
>  	}
>  
>  	err = iio_device_register(indio_dev);
> -	if (err)
> +	if (err && irq > 0)
>  		goto st_accel_device_register_error;
This is the same structure I moaned about earlier. Again, put the if (irq > 0) in the error handling
not here.
>  
>  	return err;
>  
>  st_accel_device_register_error:
> -	if (adata->get_irq_data_ready(indio_dev) > 0)
> -		st_sensors_deallocate_trigger(indio_dev);
> +	st_sensors_deallocate_trigger(indio_dev);
>  st_accel_probe_trigger_error:
> -	if (adata->get_irq_data_ready(indio_dev) > 0)
> -		st_accel_deallocate_ring(indio_dev);
> -st_accel_common_probe_error:
> +	st_accel_deallocate_ring(indio_dev);
> +
>  	return err;
>  }
>  EXPORT_SYMBOL(st_accel_common_probe);
> 

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

* Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
  2013-09-10 12:49   ` Lee Jones
@ 2013-09-14 17:51     ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:51 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, arnd, linus.walleij,
	denis.ciocca, linux-iio

On 09/10/13 13:49, Lee Jones wrote:
> The LSM303DLH's WAI (WhoAmI) is 0x33, meaning it should be enabled by
> Accel Sensor group one. For the device to probe without error, we'll
> need to ensure it's registered with the correct WAI.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
You clearly have a better datasheet than I have as for that part it doesn't even claim to
have the relevant register to read a who am I from.

Now that datasheet does list odr values as 50, 100, 400 1000 which would put it where it originally
was in these tables.

http://www.st.com/web/en/resource/technical/document/datasheet/CD00260288.pdf

I haven't checked other elements...

I'm confused but suspect we may need another type entry to deal with this one.

> ---
>  drivers/iio/accel/st_accel_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
> index ea62291..03a2b6b 100644
> --- a/drivers/iio/accel/st_accel_core.c
> +++ b/drivers/iio/accel/st_accel_core.c
> @@ -170,6 +170,7 @@ static const struct st_sensors st_accel_sensors[] = {
>  			[2] = LSM330D_ACCEL_DEV_NAME,
>  			[3] = LSM330DL_ACCEL_DEV_NAME,
>  			[4] = LSM330DLC_ACCEL_DEV_NAME,
> +			[5] = LSM303DLH_ACCEL_DEV_NAME,
>  		},
>  		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
>  		.odr = {
> @@ -238,8 +239,7 @@ static const struct st_sensors st_accel_sensors[] = {
>  		.sensors_supported = {
>  			[0] = LIS331DLH_ACCEL_DEV_NAME,
>  			[1] = LSM303DL_ACCEL_DEV_NAME,
> -			[2] = LSM303DLH_ACCEL_DEV_NAME,
> -			[3] = LSM303DLM_ACCEL_DEV_NAME,
> +			[2] = LSM303DLM_ACCEL_DEV_NAME,
>  		},
>  		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
>  		.odr = {
> 

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

* [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
@ 2013-09-14 17:51     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:51 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/10/13 13:49, Lee Jones wrote:
> The LSM303DLH's WAI (WhoAmI) is 0x33, meaning it should be enabled by
> Accel Sensor group one. For the device to probe without error, we'll
> need to ensure it's registered with the correct WAI.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
You clearly have a better datasheet than I have as for that part it doesn't even claim to
have the relevant register to read a who am I from.

Now that datasheet does list odr values as 50, 100, 400 1000 which would put it where it originally
was in these tables.

http://www.st.com/web/en/resource/technical/document/datasheet/CD00260288.pdf

I haven't checked other elements...

I'm confused but suspect we may need another type entry to deal with this one.

> ---
>  drivers/iio/accel/st_accel_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
> index ea62291..03a2b6b 100644
> --- a/drivers/iio/accel/st_accel_core.c
> +++ b/drivers/iio/accel/st_accel_core.c
> @@ -170,6 +170,7 @@ static const struct st_sensors st_accel_sensors[] = {
>  			[2] = LSM330D_ACCEL_DEV_NAME,
>  			[3] = LSM330DL_ACCEL_DEV_NAME,
>  			[4] = LSM330DLC_ACCEL_DEV_NAME,
> +			[5] = LSM303DLH_ACCEL_DEV_NAME,
>  		},
>  		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
>  		.odr = {
> @@ -238,8 +239,7 @@ static const struct st_sensors st_accel_sensors[] = {
>  		.sensors_supported = {
>  			[0] = LIS331DLH_ACCEL_DEV_NAME,
>  			[1] = LSM303DL_ACCEL_DEV_NAME,
> -			[2] = LSM303DLH_ACCEL_DEV_NAME,
> -			[3] = LSM303DLM_ACCEL_DEV_NAME,
> +			[2] = LSM303DLM_ACCEL_DEV_NAME,
>  		},
>  		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
>  		.odr = {
> 

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

* Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
  2013-09-10 12:49   ` Lee Jones
@ 2013-09-14 17:53     ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:53 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, jic23, arnd, linus.walleij,
	denis.ciocca, linux-iio

On 09/10/13 13:49, Lee Jones wrote:
> Trivial patch adding the LSM303DLH to the list of already supported
> Magnetometer Sensors.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
err.
> index 12e7e79..b2e2917 100644
> --- a/drivers/iio/magnetometer/st_magn_core.c
> +++ b/drivers/iio/magnetometer/st_magn_core.c
> @@ -151,7 +151,8 @@ static const struct st_sensors st_magn_sensors[] = {
>  		.wai = ST_MAGN_1_WAI_EXP,
>  		.sensors_supported = {
>  			[0] = LSM303DLHC_MAGN_DEV_NAME,
> -			[1] = LSM303DLM_MAGN_DEV_NAME,
> +			[1] = LSM303DLH_MAGN_DEV_NAME,
> +			[0] = LSM303DLM_MAGN_DEV_NAME,
[2]?
>  		},
>  		.ch = (struct iio_chan_spec *)st_magn_16bit_channels,
>  		.odr = {
> 

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

* [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
@ 2013-09-14 17:53     ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-14 17:53 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/10/13 13:49, Lee Jones wrote:
> Trivial patch adding the LSM303DLH to the list of already supported
> Magnetometer Sensors.
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
err.
> index 12e7e79..b2e2917 100644
> --- a/drivers/iio/magnetometer/st_magn_core.c
> +++ b/drivers/iio/magnetometer/st_magn_core.c
> @@ -151,7 +151,8 @@ static const struct st_sensors st_magn_sensors[] = {
>  		.wai = ST_MAGN_1_WAI_EXP,
>  		.sensors_supported = {
>  			[0] = LSM303DLHC_MAGN_DEV_NAME,
> -			[1] = LSM303DLM_MAGN_DEV_NAME,
> +			[1] = LSM303DLH_MAGN_DEV_NAME,
> +			[0] = LSM303DLM_MAGN_DEV_NAME,
[2]?
>  		},
>  		.ch = (struct iio_chan_spec *)st_magn_16bit_channels,
>  		.odr = {
> 

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

* Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
  2013-09-14 17:53     ` Jonathan Cameron
@ 2013-09-16  7:31       ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16  7:31 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-arm-kernel, linux-kernel, jic23, arnd, linus.walleij,
	denis.ciocca, linux-iio

On Sat, 14 Sep 2013, Jonathan Cameron wrote:

> On 09/10/13 13:49, Lee Jones wrote:
> > Trivial patch adding the LSM303DLH to the list of already supported
> > Magnetometer Sensors.
> > 
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> err.

?

> > index 12e7e79..b2e2917 100644
> > --- a/drivers/iio/magnetometer/st_magn_core.c
> > +++ b/drivers/iio/magnetometer/st_magn_core.c
> > @@ -151,7 +151,8 @@ static const struct st_sensors st_magn_sensors[] = {
> >  		.wai = ST_MAGN_1_WAI_EXP,
> >  		.sensors_supported = {
> >  			[0] = LSM303DLHC_MAGN_DEV_NAME,
> > -			[1] = LSM303DLM_MAGN_DEV_NAME,
> > +			[1] = LSM303DLH_MAGN_DEV_NAME,
> > +			[0] = LSM303DLM_MAGN_DEV_NAME,
> [2]?

Yes, good spot, thanks.

> >  		},
> >  		.ch = (struct iio_chan_spec *)st_magn_16bit_channels,
> >  		.odr = {
> > 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
@ 2013-09-16  7:31       ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16  7:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, 14 Sep 2013, Jonathan Cameron wrote:

> On 09/10/13 13:49, Lee Jones wrote:
> > Trivial patch adding the LSM303DLH to the list of already supported
> > Magnetometer Sensors.
> > 
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> err.

?

> > index 12e7e79..b2e2917 100644
> > --- a/drivers/iio/magnetometer/st_magn_core.c
> > +++ b/drivers/iio/magnetometer/st_magn_core.c
> > @@ -151,7 +151,8 @@ static const struct st_sensors st_magn_sensors[] = {
> >  		.wai = ST_MAGN_1_WAI_EXP,
> >  		.sensors_supported = {
> >  			[0] = LSM303DLHC_MAGN_DEV_NAME,
> > -			[1] = LSM303DLM_MAGN_DEV_NAME,
> > +			[1] = LSM303DLH_MAGN_DEV_NAME,
> > +			[0] = LSM303DLM_MAGN_DEV_NAME,
> [2]?

Yes, good spot, thanks.

> >  		},
> >  		.ch = (struct iio_chan_spec *)st_magn_16bit_channels,
> >  		.odr = {
> > 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
  2013-09-14 17:51     ` Jonathan Cameron
@ 2013-09-16  8:05       ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16  8:05 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-arm-kernel, linux-kernel, arnd, linus.walleij,
	denis.ciocca, linux-iio

On Sat, 14 Sep 2013, Jonathan Cameron wrote:

> On 09/10/13 13:49, Lee Jones wrote:
> > The LSM303DLH's WAI (WhoAmI) is 0x33, meaning it should be enabled by
> > Accel Sensor group one. For the device to probe without error, we'll
> > need to ensure it's registered with the correct WAI.
> > 
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> You clearly have a better datasheet than I have as for that part it doesn't even claim to
> have the relevant register to read a who am I from.
> 
> Now that datasheet does list odr values as 50, 100, 400 1000 which would put it where it originally
> was in these tables.
> 
> http://www.st.com/web/en/resource/technical/document/datasheet/CD00260288.pdf
> 
> I haven't checked other elements...
> 
> I'm confused but suspect we may need another type entry to deal with this one.

Hmmm... on initial thought, I don't know how we can handle this one. I
assumed the WAIs were a one-stop-shop for device identification. I also
thought that they would only match if the functionality and register
maps would be the same.

I'll touch base with Denis on this, perhaps he can shed some light.

> > ---
> >  drivers/iio/accel/st_accel_core.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
> > index ea62291..03a2b6b 100644
> > --- a/drivers/iio/accel/st_accel_core.c
> > +++ b/drivers/iio/accel/st_accel_core.c
> > @@ -170,6 +170,7 @@ static const struct st_sensors st_accel_sensors[] = {
> >  			[2] = LSM330D_ACCEL_DEV_NAME,
> >  			[3] = LSM330DL_ACCEL_DEV_NAME,
> >  			[4] = LSM330DLC_ACCEL_DEV_NAME,
> > +			[5] = LSM303DLH_ACCEL_DEV_NAME,
> >  		},
> >  		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
> >  		.odr = {
> > @@ -238,8 +239,7 @@ static const struct st_sensors st_accel_sensors[] = {
> >  		.sensors_supported = {
> >  			[0] = LIS331DLH_ACCEL_DEV_NAME,
> >  			[1] = LSM303DL_ACCEL_DEV_NAME,
> > -			[2] = LSM303DLH_ACCEL_DEV_NAME,
> > -			[3] = LSM303DLM_ACCEL_DEV_NAME,
> > +			[2] = LSM303DLM_ACCEL_DEV_NAME,
> >  		},
> >  		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
> >  		.odr = {
> > 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
@ 2013-09-16  8:05       ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16  8:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, 14 Sep 2013, Jonathan Cameron wrote:

> On 09/10/13 13:49, Lee Jones wrote:
> > The LSM303DLH's WAI (WhoAmI) is 0x33, meaning it should be enabled by
> > Accel Sensor group one. For the device to probe without error, we'll
> > need to ensure it's registered with the correct WAI.
> > 
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> You clearly have a better datasheet than I have as for that part it doesn't even claim to
> have the relevant register to read a who am I from.
> 
> Now that datasheet does list odr values as 50, 100, 400 1000 which would put it where it originally
> was in these tables.
> 
> http://www.st.com/web/en/resource/technical/document/datasheet/CD00260288.pdf
> 
> I haven't checked other elements...
> 
> I'm confused but suspect we may need another type entry to deal with this one.

Hmmm... on initial thought, I don't know how we can handle this one. I
assumed the WAIs were a one-stop-shop for device identification. I also
thought that they would only match if the functionality and register
maps would be the same.

I'll touch base with Denis on this, perhaps he can shed some light.

> > ---
> >  drivers/iio/accel/st_accel_core.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
> > index ea62291..03a2b6b 100644
> > --- a/drivers/iio/accel/st_accel_core.c
> > +++ b/drivers/iio/accel/st_accel_core.c
> > @@ -170,6 +170,7 @@ static const struct st_sensors st_accel_sensors[] = {
> >  			[2] = LSM330D_ACCEL_DEV_NAME,
> >  			[3] = LSM330DL_ACCEL_DEV_NAME,
> >  			[4] = LSM330DLC_ACCEL_DEV_NAME,
> > +			[5] = LSM303DLH_ACCEL_DEV_NAME,
> >  		},
> >  		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
> >  		.odr = {
> > @@ -238,8 +239,7 @@ static const struct st_sensors st_accel_sensors[] = {
> >  		.sensors_supported = {
> >  			[0] = LIS331DLH_ACCEL_DEV_NAME,
> >  			[1] = LSM303DL_ACCEL_DEV_NAME,
> > -			[2] = LSM303DLH_ACCEL_DEV_NAME,
> > -			[3] = LSM303DLM_ACCEL_DEV_NAME,
> > +			[2] = LSM303DLM_ACCEL_DEV_NAME,
> >  		},
> >  		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
> >  		.odr = {
> > 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 25/38] iio: pressure-core: st: Allow for number of channels to vary
  2013-09-14 17:18     ` Jonathan Cameron
@ 2013-09-16  8:17       ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16  8:17 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-arm-kernel, linux-kernel, jic23, arnd, linus.walleij,
	denis.ciocca, linux-iio

On Sat, 14 Sep 2013, Jonathan Cameron wrote:

> On 09/10/13 13:49, Lee Jones wrote:
> > At the moment the number of channels specified is dictated by the first
> > sensor supported by the driver. As we add support for more sensors this
> > is likely to vary. Instead of using the ARRAY_SIZE() of the LPS331AP's
> > channel specifier we'll use a new adaptable 'struct st_sensors' element
> > instead.
> > 
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> Applied with Denis ack (again it should have been here)

Ah, you're going to take the patches one-by-one?

After amending the drivers as per your review I was going to send a
final time with all Acks applied. Then, once all maintainer Acks were
obtained I was going to send you a pull-request.

Perhaps I should have communicated the intent sooner.

Future submissions will have all Acks applied in this case.

> > ---
> >  drivers/iio/pressure/st_pressure_core.c | 3 ++-
> >  include/linux/iio/common/st_sensors.h   | 1 +
> >  2 files changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> > index 60c2ee4..3abada2 100644
> > --- a/drivers/iio/pressure/st_pressure_core.c
> > +++ b/drivers/iio/pressure/st_pressure_core.c
> > @@ -107,6 +107,7 @@ static const struct st_sensors st_press_sensors[] = {
> >  			[0] = LPS331AP_PRESS_DEV_NAME,
> >  		},
> >  		.ch = (struct iio_chan_spec *)st_press_lps331ap_channels,
> > +		.num_ch = ARRAY_SIZE(st_press_lps331ap_channels),
> >  		.odr = {
> >  			.addr = ST_PRESS_LPS331AP_ODR_ADDR,
> >  			.mask = ST_PRESS_LPS331AP_ODR_MASK,
> > @@ -245,7 +246,7 @@ int st_press_common_probe(struct iio_dev *indio_dev,
> >  	pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS;
> >  	pdata->multiread_bit = pdata->sensor->multi_read_bit;
> >  	indio_dev->channels = pdata->sensor->ch;
> > -	indio_dev->num_channels = ARRAY_SIZE(st_press_lps331ap_channels);
> > +	indio_dev->num_channels = pdata->sensor->num_ch;
> >  
> >  	if (pdata->sensor->fs.addr != 0)
> >  		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
> > diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
> > index e51f654..e732fda 100644
> > --- a/include/linux/iio/common/st_sensors.h
> > +++ b/include/linux/iio/common/st_sensors.h
> > @@ -184,6 +184,7 @@ struct st_sensors {
> >  	u8 wai;
> >  	char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME];
> >  	struct iio_chan_spec *ch;
> > +	int num_ch;
> >  	struct st_sensor_odr odr;
> >  	struct st_sensor_power pw;
> >  	struct st_sensor_axis enable_axis;
> > 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 25/38] iio: pressure-core: st: Allow for number of channels to vary
@ 2013-09-16  8:17       ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16  8:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, 14 Sep 2013, Jonathan Cameron wrote:

> On 09/10/13 13:49, Lee Jones wrote:
> > At the moment the number of channels specified is dictated by the first
> > sensor supported by the driver. As we add support for more sensors this
> > is likely to vary. Instead of using the ARRAY_SIZE() of the LPS331AP's
> > channel specifier we'll use a new adaptable 'struct st_sensors' element
> > instead.
> > 
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> Applied with Denis ack (again it should have been here)

Ah, you're going to take the patches one-by-one?

After amending the drivers as per your review I was going to send a
final time with all Acks applied. Then, once all maintainer Acks were
obtained I was going to send you a pull-request.

Perhaps I should have communicated the intent sooner.

Future submissions will have all Acks applied in this case.

> > ---
> >  drivers/iio/pressure/st_pressure_core.c | 3 ++-
> >  include/linux/iio/common/st_sensors.h   | 1 +
> >  2 files changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> > index 60c2ee4..3abada2 100644
> > --- a/drivers/iio/pressure/st_pressure_core.c
> > +++ b/drivers/iio/pressure/st_pressure_core.c
> > @@ -107,6 +107,7 @@ static const struct st_sensors st_press_sensors[] = {
> >  			[0] = LPS331AP_PRESS_DEV_NAME,
> >  		},
> >  		.ch = (struct iio_chan_spec *)st_press_lps331ap_channels,
> > +		.num_ch = ARRAY_SIZE(st_press_lps331ap_channels),
> >  		.odr = {
> >  			.addr = ST_PRESS_LPS331AP_ODR_ADDR,
> >  			.mask = ST_PRESS_LPS331AP_ODR_MASK,
> > @@ -245,7 +246,7 @@ int st_press_common_probe(struct iio_dev *indio_dev,
> >  	pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS;
> >  	pdata->multiread_bit = pdata->sensor->multi_read_bit;
> >  	indio_dev->channels = pdata->sensor->ch;
> > -	indio_dev->num_channels = ARRAY_SIZE(st_press_lps331ap_channels);
> > +	indio_dev->num_channels = pdata->sensor->num_ch;
> >  
> >  	if (pdata->sensor->fs.addr != 0)
> >  		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
> > diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
> > index e51f654..e732fda 100644
> > --- a/include/linux/iio/common/st_sensors.h
> > +++ b/include/linux/iio/common/st_sensors.h
> > @@ -184,6 +184,7 @@ struct st_sensors {
> >  	u8 wai;
> >  	char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME];
> >  	struct iio_chan_spec *ch;
> > +	int num_ch;
> >  	struct st_sensor_odr odr;
> >  	struct st_sensor_power pw;
> >  	struct st_sensor_axis enable_axis;
> > 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 21/38] iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data()
  2013-09-14 16:58     ` Jonathan Cameron
@ 2013-09-16  8:22       ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16  8:22 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-arm-kernel, linux-kernel, arnd, linus.walleij,
	denis.ciocca, linux-iio

On Sat, 14 Sep 2013, Jonathan Cameron wrote:

> On 09/10/13 13:49, Lee Jones wrote:
> > Gets rid of those unnecessary gotos.
> 
> Unfortunately it introduced a bug whilst it is at it.  Sometimes
> those gotos are necessary and the 'right' way to do things.
> > 
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > ---
> >  drivers/iio/common/st_sensors/st_sensors_core.c | 17 +++++++----------
> >  1 file changed, 7 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> > index 8c4c54c..148f0e5 100644
> > --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> > +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> > @@ -331,26 +331,23 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev,
> >  	unsigned int byte_for_channel = ch->scan_type.storagebits >> 3;
> >  
> >  	outdata = kmalloc(byte_for_channel, GFP_KERNEL);
> > -	if (!outdata) {
> > -		err = -EINVAL;
> > -		goto st_sensors_read_axis_data_error;
> > -	}
> > +	if (!outdata)
> > +		return -ENOMEM;
> I agree this change makes complete sense.
> >  
> >  	err = sdata->tf->read_multiple_byte(&sdata->tb, sdata->dev,
> >  				ch->address, byte_for_channel,
> >  				outdata, sdata->multiread_bit);
> > -	if (err < 0)
> > -		goto st_sensors_free_memory;
> > +	if (err < 0) {
> > +		kfree(outdata);
> > +		return err;
> > +	}
> I don't like this change as....
> >  
> >  	if (byte_for_channel == 2)
> >  		*data = (s16)get_unaligned_le16(outdata);
> >  	else if (byte_for_channel == 3)
> >  		*data = (s32)st_sensors_get_unaligned_le24(outdata);
> >  
> > -st_sensors_free_memory:
> > -	kfree(outdata);
> you now don't free out data in the case of no error.  This is precisely the case
> where a goto is the correct way to handle things as the free need to occur whether
> or not the error occurs.

Ah, you're quite right. I'll fix up.

> > -st_sensors_read_axis_data_error:
> > -	return err;
> > +	return 0;
> >  }
> >  
> >  int st_sensors_read_info_raw(struct iio_dev *indio_dev,
> > 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 21/38] iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data()
@ 2013-09-16  8:22       ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16  8:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, 14 Sep 2013, Jonathan Cameron wrote:

> On 09/10/13 13:49, Lee Jones wrote:
> > Gets rid of those unnecessary gotos.
> 
> Unfortunately it introduced a bug whilst it is at it.  Sometimes
> those gotos are necessary and the 'right' way to do things.
> > 
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > ---
> >  drivers/iio/common/st_sensors/st_sensors_core.c | 17 +++++++----------
> >  1 file changed, 7 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> > index 8c4c54c..148f0e5 100644
> > --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> > +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> > @@ -331,26 +331,23 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev,
> >  	unsigned int byte_for_channel = ch->scan_type.storagebits >> 3;
> >  
> >  	outdata = kmalloc(byte_for_channel, GFP_KERNEL);
> > -	if (!outdata) {
> > -		err = -EINVAL;
> > -		goto st_sensors_read_axis_data_error;
> > -	}
> > +	if (!outdata)
> > +		return -ENOMEM;
> I agree this change makes complete sense.
> >  
> >  	err = sdata->tf->read_multiple_byte(&sdata->tb, sdata->dev,
> >  				ch->address, byte_for_channel,
> >  				outdata, sdata->multiread_bit);
> > -	if (err < 0)
> > -		goto st_sensors_free_memory;
> > +	if (err < 0) {
> > +		kfree(outdata);
> > +		return err;
> > +	}
> I don't like this change as....
> >  
> >  	if (byte_for_channel == 2)
> >  		*data = (s16)get_unaligned_le16(outdata);
> >  	else if (byte_for_channel == 3)
> >  		*data = (s32)st_sensors_get_unaligned_le24(outdata);
> >  
> > -st_sensors_free_memory:
> > -	kfree(outdata);
> you now don't free out data in the case of no error.  This is precisely the case
> where a goto is the correct way to handle things as the free need to occur whether
> or not the error occurs.

Ah, you're quite right. I'll fix up.

> > -st_sensors_read_axis_data_error:
> > -	return err;
> > +	return 0;
> >  }
> >  
> >  int st_sensors_read_info_raw(struct iio_dev *indio_dev,
> > 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
  2013-09-14 12:27       ` Jonathan Cameron
@ 2013-09-16  8:33         ` Lars-Peter Clausen
  -1 siblings, 0 replies; 246+ messages in thread
From: Lars-Peter Clausen @ 2013-09-16  8:33 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Lee Jones, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, denis.ciocca, linux-iio

On 09/14/2013 02:27 PM, Jonathan Cameron wrote:
> On 09/14/13 13:14, Jonathan Cameron wrote:
>> On 09/10/13 13:49, Lee Jones wrote:
>>> Some of ST's sensors are appended with their sensor type and some
>>> are not. For consistency we're extending the same naming convention
>>> throughout.
>>>
>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>> Honestly I don't care either way on these, but consistency would definitely
>> be good so applied to the togreg branch of iio.git
>>
>> Thanks,
> 
> Actually change of plan. I'm going to hold off on these as this an ABI change.
> Iritating though having these as completely inconsistent is, changing this
> will change device identification from userspace which is not a good idea.
> 
> Sorry Lee, but we really shouldn't do this. I should have picked up on this
> in the original driver reviews but that's hindsight for you.

I think those with the suffix are the ones where you have accel and gyro in
the same package, the ones without the suffix are pure accelerometers.

- Lars


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

* [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
@ 2013-09-16  8:33         ` Lars-Peter Clausen
  0 siblings, 0 replies; 246+ messages in thread
From: Lars-Peter Clausen @ 2013-09-16  8:33 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/14/2013 02:27 PM, Jonathan Cameron wrote:
> On 09/14/13 13:14, Jonathan Cameron wrote:
>> On 09/10/13 13:49, Lee Jones wrote:
>>> Some of ST's sensors are appended with their sensor type and some
>>> are not. For consistency we're extending the same naming convention
>>> throughout.
>>>
>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>> Honestly I don't care either way on these, but consistency would definitely
>> be good so applied to the togreg branch of iio.git
>>
>> Thanks,
> 
> Actually change of plan. I'm going to hold off on these as this an ABI change.
> Iritating though having these as completely inconsistent is, changing this
> will change device identification from userspace which is not a good idea.
> 
> Sorry Lee, but we really shouldn't do this. I should have picked up on this
> in the original driver reviews but that's hindsight for you.

I think those with the suffix are the ones where you have accel and gyro in
the same package, the ones without the suffix are pure accelerometers.

- Lars

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

* Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
  2013-09-16  8:05       ` Lee Jones
  (?)
@ 2013-09-16  9:19         ` Denis CIOCCA
  -1 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16  9:19 UTC (permalink / raw)
  To: Lee Jones
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, arnd,
	linus.walleij, linux-iio

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2437 bytes --]

Hi Lee,
>> On 09/10/13 13:49, Lee Jones wrote:
>>> The LSM303DLH's WAI (WhoAmI) is 0x33, meaning it should be enabled by
>>> Accel Sensor group one. For the device to probe without error, we'll
>>> need to ensure it's registered with the correct WAI.
>>>
>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>> You clearly have a better datasheet than I have as for that part it doesn't even claim to
>> have the relevant register to read a who am I from.
>>
>> Now that datasheet does list odr values as 50, 100, 400 1000 which would put it where it originally
>> was in these tables.
>>
>> http://www.st.com/web/en/resource/technical/document/datasheet/CD00260288.pdf
>>
>> I haven't checked other elements...
>>
>> I'm confused but suspect we may need another type entry to deal with this one.
> Hmmm... on initial thought, I don't know how we can handle this one. I
> assumed the WAIs were a one-stop-shop for device identification. I also
> thought that they would only match if the functionality and register
> maps would be the same.
>
> I'll touch base with Denis on this, perhaps he can shed some light.
>
I've just checked, the WAI is 0x32. It was correct...Are you sure that 
you use the LSM303DLH?

Denis



>>> ---
>>>   drivers/iio/accel/st_accel_core.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
>>> index ea62291..03a2b6b 100644
>>> --- a/drivers/iio/accel/st_accel_core.c
>>> +++ b/drivers/iio/accel/st_accel_core.c
>>> @@ -170,6 +170,7 @@ static const struct st_sensors st_accel_sensors[] = {
>>>   			[2] = LSM330D_ACCEL_DEV_NAME,
>>>   			[3] = LSM330DL_ACCEL_DEV_NAME,
>>>   			[4] = LSM330DLC_ACCEL_DEV_NAME,
>>> +			[5] = LSM303DLH_ACCEL_DEV_NAME,
>>>   		},
>>>   		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
>>>   		.odr = {
>>> @@ -238,8 +239,7 @@ static const struct st_sensors st_accel_sensors[] = {
>>>   		.sensors_supported = {
>>>   			[0] = LIS331DLH_ACCEL_DEV_NAME,
>>>   			[1] = LSM303DL_ACCEL_DEV_NAME,
>>> -			[2] = LSM303DLH_ACCEL_DEV_NAME,
>>> -			[3] = LSM303DLM_ACCEL_DEV_NAME,
>>> +			[2] = LSM303DLM_ACCEL_DEV_NAME,
>>>   		},
>>>   		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
>>>   		.odr = {
>>>
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
@ 2013-09-16  9:19         ` Denis CIOCCA
  0 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16  9:19 UTC (permalink / raw)
  To: Lee Jones
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, arnd,
	linus.walleij, linux-iio

SGkgTGVlLA0KPj4gT24gMDkvMTAvMTMgMTM6NDksIExlZSBKb25lcyB3cm90ZToNCj4+PiBUaGUg
TFNNMzAzRExIJ3MgV0FJIChXaG9BbUkpIGlzIDB4MzMsIG1lYW5pbmcgaXQgc2hvdWxkIGJlIGVu
YWJsZWQgYnkNCj4+PiBBY2NlbCBTZW5zb3IgZ3JvdXAgb25lLiBGb3IgdGhlIGRldmljZSB0byBw
cm9iZSB3aXRob3V0IGVycm9yLCB3ZSdsbA0KPj4+IG5lZWQgdG8gZW5zdXJlIGl0J3MgcmVnaXN0
ZXJlZCB3aXRoIHRoZSBjb3JyZWN0IFdBSS4NCj4+Pg0KPj4+IFNpZ25lZC1vZmYtYnk6IExlZSBK
b25lcyA8bGVlLmpvbmVzQGxpbmFyby5vcmc+DQo+PiBZb3UgY2xlYXJseSBoYXZlIGEgYmV0dGVy
IGRhdGFzaGVldCB0aGFuIEkgaGF2ZSBhcyBmb3IgdGhhdCBwYXJ0IGl0IGRvZXNuJ3QgZXZlbiBj
bGFpbSB0bw0KPj4gaGF2ZSB0aGUgcmVsZXZhbnQgcmVnaXN0ZXIgdG8gcmVhZCBhIHdobyBhbSBJ
IGZyb20uDQo+Pg0KPj4gTm93IHRoYXQgZGF0YXNoZWV0IGRvZXMgbGlzdCBvZHIgdmFsdWVzIGFz
IDUwLCAxMDAsIDQwMCAxMDAwIHdoaWNoIHdvdWxkIHB1dCBpdCB3aGVyZSBpdCBvcmlnaW5hbGx5
DQo+PiB3YXMgaW4gdGhlc2UgdGFibGVzLg0KPj4NCj4+IGh0dHA6Ly93d3cuc3QuY29tL3dlYi9l
bi9yZXNvdXJjZS90ZWNobmljYWwvZG9jdW1lbnQvZGF0YXNoZWV0L0NEMDAyNjAyODgucGRmDQo+
Pg0KPj4gSSBoYXZlbid0IGNoZWNrZWQgb3RoZXIgZWxlbWVudHMuLi4NCj4+DQo+PiBJJ20gY29u
ZnVzZWQgYnV0IHN1c3BlY3Qgd2UgbWF5IG5lZWQgYW5vdGhlciB0eXBlIGVudHJ5IHRvIGRlYWwg
d2l0aCB0aGlzIG9uZS4NCj4gSG1tbS4uLiBvbiBpbml0aWFsIHRob3VnaHQsIEkgZG9uJ3Qga25v
dyBob3cgd2UgY2FuIGhhbmRsZSB0aGlzIG9uZS4gSQ0KPiBhc3N1bWVkIHRoZSBXQUlzIHdlcmUg
YSBvbmUtc3RvcC1zaG9wIGZvciBkZXZpY2UgaWRlbnRpZmljYXRpb24uIEkgYWxzbw0KPiB0aG91
Z2h0IHRoYXQgdGhleSB3b3VsZCBvbmx5IG1hdGNoIGlmIHRoZSBmdW5jdGlvbmFsaXR5IGFuZCBy
ZWdpc3Rlcg0KPiBtYXBzIHdvdWxkIGJlIHRoZSBzYW1lLg0KPg0KPiBJJ2xsIHRvdWNoIGJhc2Ug
d2l0aCBEZW5pcyBvbiB0aGlzLCBwZXJoYXBzIGhlIGNhbiBzaGVkIHNvbWUgbGlnaHQuDQo+DQpJ
J3ZlIGp1c3QgY2hlY2tlZCwgdGhlIFdBSSBpcyAweDMyLiBJdCB3YXMgY29ycmVjdC4uLkFyZSB5
b3Ugc3VyZSB0aGF0IA0KeW91IHVzZSB0aGUgTFNNMzAzRExIPw0KDQpEZW5pcw0KDQoNCg0KPj4+
IC0tLQ0KPj4+ICAgZHJpdmVycy9paW8vYWNjZWwvc3RfYWNjZWxfY29yZS5jIHwgNCArKy0tDQo+
Pj4gICAxIGZpbGUgY2hhbmdlZCwgMiBpbnNlcnRpb25zKCspLCAyIGRlbGV0aW9ucygtKQ0KPj4+
DQo+Pj4gZGlmZiAtLWdpdCBhL2RyaXZlcnMvaWlvL2FjY2VsL3N0X2FjY2VsX2NvcmUuYyBiL2Ry
aXZlcnMvaWlvL2FjY2VsL3N0X2FjY2VsX2NvcmUuYw0KPj4+IGluZGV4IGVhNjIyOTEuLjAzYTJi
NmIgMTAwNjQ0DQo+Pj4gLS0tIGEvZHJpdmVycy9paW8vYWNjZWwvc3RfYWNjZWxfY29yZS5jDQo+
Pj4gKysrIGIvZHJpdmVycy9paW8vYWNjZWwvc3RfYWNjZWxfY29yZS5jDQo+Pj4gQEAgLTE3MCw2
ICsxNzAsNyBAQCBzdGF0aWMgY29uc3Qgc3RydWN0IHN0X3NlbnNvcnMgc3RfYWNjZWxfc2Vuc29y
c1tdID0gew0KPj4+ICAgCQkJWzJdID0gTFNNMzMwRF9BQ0NFTF9ERVZfTkFNRSwNCj4+PiAgIAkJ
CVszXSA9IExTTTMzMERMX0FDQ0VMX0RFVl9OQU1FLA0KPj4+ICAgCQkJWzRdID0gTFNNMzMwRExD
X0FDQ0VMX0RFVl9OQU1FLA0KPj4+ICsJCQlbNV0gPSBMU00zMDNETEhfQUNDRUxfREVWX05BTUUs
DQo+Pj4gICAJCX0sDQo+Pj4gICAJCS5jaCA9IChzdHJ1Y3QgaWlvX2NoYW5fc3BlYyAqKXN0X2Fj
Y2VsXzEyYml0X2NoYW5uZWxzLA0KPj4+ICAgCQkub2RyID0gew0KPj4+IEBAIC0yMzgsOCArMjM5
LDcgQEAgc3RhdGljIGNvbnN0IHN0cnVjdCBzdF9zZW5zb3JzIHN0X2FjY2VsX3NlbnNvcnNbXSA9
IHsNCj4+PiAgIAkJLnNlbnNvcnNfc3VwcG9ydGVkID0gew0KPj4+ICAgCQkJWzBdID0gTElTMzMx
RExIX0FDQ0VMX0RFVl9OQU1FLA0KPj4+ICAgCQkJWzFdID0gTFNNMzAzRExfQUNDRUxfREVWX05B
TUUsDQo+Pj4gLQkJCVsyXSA9IExTTTMwM0RMSF9BQ0NFTF9ERVZfTkFNRSwNCj4+PiAtCQkJWzNd
ID0gTFNNMzAzRExNX0FDQ0VMX0RFVl9OQU1FLA0KPj4+ICsJCQlbMl0gPSBMU00zMDNETE1fQUND
RUxfREVWX05BTUUsDQo+Pj4gICAJCX0sDQo+Pj4gICAJCS5jaCA9IChzdHJ1Y3QgaWlvX2NoYW5f
c3BlYyAqKXN0X2FjY2VsXzEyYml0X2NoYW5uZWxzLA0KPj4+ICAgCQkub2RyID0gew0KPj4+DQo=

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

* [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
@ 2013-09-16  9:19         ` Denis CIOCCA
  0 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16  9:19 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Lee,
>> On 09/10/13 13:49, Lee Jones wrote:
>>> The LSM303DLH's WAI (WhoAmI) is 0x33, meaning it should be enabled by
>>> Accel Sensor group one. For the device to probe without error, we'll
>>> need to ensure it's registered with the correct WAI.
>>>
>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>> You clearly have a better datasheet than I have as for that part it doesn't even claim to
>> have the relevant register to read a who am I from.
>>
>> Now that datasheet does list odr values as 50, 100, 400 1000 which would put it where it originally
>> was in these tables.
>>
>> http://www.st.com/web/en/resource/technical/document/datasheet/CD00260288.pdf
>>
>> I haven't checked other elements...
>>
>> I'm confused but suspect we may need another type entry to deal with this one.
> Hmmm... on initial thought, I don't know how we can handle this one. I
> assumed the WAIs were a one-stop-shop for device identification. I also
> thought that they would only match if the functionality and register
> maps would be the same.
>
> I'll touch base with Denis on this, perhaps he can shed some light.
>
I've just checked, the WAI is 0x32. It was correct...Are you sure that 
you use the LSM303DLH?

Denis



>>> ---
>>>   drivers/iio/accel/st_accel_core.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
>>> index ea62291..03a2b6b 100644
>>> --- a/drivers/iio/accel/st_accel_core.c
>>> +++ b/drivers/iio/accel/st_accel_core.c
>>> @@ -170,6 +170,7 @@ static const struct st_sensors st_accel_sensors[] = {
>>>   			[2] = LSM330D_ACCEL_DEV_NAME,
>>>   			[3] = LSM330DL_ACCEL_DEV_NAME,
>>>   			[4] = LSM330DLC_ACCEL_DEV_NAME,
>>> +			[5] = LSM303DLH_ACCEL_DEV_NAME,
>>>   		},
>>>   		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
>>>   		.odr = {
>>> @@ -238,8 +239,7 @@ static const struct st_sensors st_accel_sensors[] = {
>>>   		.sensors_supported = {
>>>   			[0] = LIS331DLH_ACCEL_DEV_NAME,
>>>   			[1] = LSM303DL_ACCEL_DEV_NAME,
>>> -			[2] = LSM303DLH_ACCEL_DEV_NAME,
>>> -			[3] = LSM303DLM_ACCEL_DEV_NAME,
>>> +			[2] = LSM303DLM_ACCEL_DEV_NAME,
>>>   		},
>>>   		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
>>>   		.odr = {
>>>

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

* Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
  2013-09-16  8:33         ` Lars-Peter Clausen
  (?)
@ 2013-09-16  9:21           ` Denis CIOCCA
  -1 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16  9:21 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Jonathan Cameron, Lee Jones, linux-arm-kernel, linux-kernel,
	jic23, arnd, linus.walleij, linux-iio

Hi Lars,
> On 09/14/2013 02:27 PM, Jonathan Cameron wrote:
>> On 09/14/13 13:14, Jonathan Cameron wrote:
>>> On 09/10/13 13:49, Lee Jones wrote:
>>>> Some of ST's sensors are appended with their sensor type and some
>>>> are not. For consistency we're extending the same naming convention
>>>> throughout.
>>>>
>>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>>> Honestly I don't care either way on these, but consistency would definitely
>>> be good so applied to the togreg branch of iio.git
>>>
>>> Thanks,
>> Actually change of plan. I'm going to hold off on these as this an ABI change.
>> Iritating though having these as completely inconsistent is, changing this
>> will change device identification from userspace which is not a good idea.
>>
>> Sorry Lee, but we really shouldn't do this. I should have picked up on this
>> in the original driver reviews but that's hindsight for you.
> I think those with the suffix are the ones where you have accel and gyro in
> the same package, the ones without the suffix are pure accelerometers.
Yes You are right. I've used this kind of logic... What do you think about?

Denis



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

* Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
@ 2013-09-16  9:21           ` Denis CIOCCA
  0 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16  9:21 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Jonathan Cameron, Lee Jones, linux-arm-kernel, linux-kernel,
	jic23, arnd, linus.walleij, linux-iio

Hi Lars,
> On 09/14/2013 02:27 PM, Jonathan Cameron wrote:
>> On 09/14/13 13:14, Jonathan Cameron wrote:
>>> On 09/10/13 13:49, Lee Jones wrote:
>>>> Some of ST's sensors are appended with their sensor type and some
>>>> are not. For consistency we're extending the same naming convention
>>>> throughout.
>>>>
>>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>>> Honestly I don't care either way on these, but consistency would defini=
tely
>>> be good so applied to the togreg branch of iio.git
>>>
>>> Thanks,
>> Actually change of plan. I'm going to hold off on these as this an ABI c=
hange.
>> Iritating though having these as completely inconsistent is, changing th=
is
>> will change device identification from userspace which is not a good ide=
a.
>>
>> Sorry Lee, but we really shouldn't do this. I should have picked up on t=
his
>> in the original driver reviews but that's hindsight for you.
> I think those with the suffix are the ones where you have accel and gyro =
in
> the same package, the ones without the suffix are pure accelerometers.
Yes You are right. I've used this kind of logic... What do you think about?

Denis

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

* [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
@ 2013-09-16  9:21           ` Denis CIOCCA
  0 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16  9:21 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Lars,
> On 09/14/2013 02:27 PM, Jonathan Cameron wrote:
>> On 09/14/13 13:14, Jonathan Cameron wrote:
>>> On 09/10/13 13:49, Lee Jones wrote:
>>>> Some of ST's sensors are appended with their sensor type and some
>>>> are not. For consistency we're extending the same naming convention
>>>> throughout.
>>>>
>>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>>> Honestly I don't care either way on these, but consistency would definitely
>>> be good so applied to the togreg branch of iio.git
>>>
>>> Thanks,
>> Actually change of plan. I'm going to hold off on these as this an ABI change.
>> Iritating though having these as completely inconsistent is, changing this
>> will change device identification from userspace which is not a good idea.
>>
>> Sorry Lee, but we really shouldn't do this. I should have picked up on this
>> in the original driver reviews but that's hindsight for you.
> I think those with the suffix are the ones where you have accel and gyro in
> the same package, the ones without the suffix are pure accelerometers.
Yes You are right. I've used this kind of logic... What do you think about?

Denis

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

* Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
  2013-09-16  7:31       ` Lee Jones
  (?)
@ 2013-09-16  9:32         ` Denis CIOCCA
  -1 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16  9:32 UTC (permalink / raw)
  To: Lee Jones
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, linux-iio

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 850 bytes --]

Hi Lee,
> index 12e7e79..b2e2917 100644
> --- a/drivers/iio/magnetometer/st_magn_core.c
> +++ b/drivers/iio/magnetometer/st_magn_core.c
> @@ -151,7 +151,8 @@ static const struct st_sensors st_magn_sensors[] = {
>   		.wai = ST_MAGN_1_WAI_EXP,
>   		.sensors_supported = {
>   			[0] = LSM303DLHC_MAGN_DEV_NAME,
> -			[1] = LSM303DLM_MAGN_DEV_NAME,
> +			[1] = LSM303DLH_MAGN_DEV_NAME,
> +			[0] = LSM303DLM_MAGN_DEV_NAME,
Are you sure that it works?
Because LSM303DLH magnetometer use different kind of WAI registers. This 
driver read 0x0f and in this case the value is 0 and the driver do not 
probe...You have to read the identification registers (0x0a, 0x0b, 0x0c) 
in that case.

Denisÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
@ 2013-09-16  9:32         ` Denis CIOCCA
  0 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16  9:32 UTC (permalink / raw)
  To: Lee Jones
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, linux-iio

SGkgTGVlLA0KPiBpbmRleCAxMmU3ZTc5Li5iMmUyOTE3IDEwMDY0NA0KPiAtLS0gYS9kcml2ZXJz
L2lpby9tYWduZXRvbWV0ZXIvc3RfbWFnbl9jb3JlLmMNCj4gKysrIGIvZHJpdmVycy9paW8vbWFn
bmV0b21ldGVyL3N0X21hZ25fY29yZS5jDQo+IEBAIC0xNTEsNyArMTUxLDggQEAgc3RhdGljIGNv
bnN0IHN0cnVjdCBzdF9zZW5zb3JzIHN0X21hZ25fc2Vuc29yc1tdID0gew0KPiAgIAkJLndhaSA9
IFNUX01BR05fMV9XQUlfRVhQLA0KPiAgIAkJLnNlbnNvcnNfc3VwcG9ydGVkID0gew0KPiAgIAkJ
CVswXSA9IExTTTMwM0RMSENfTUFHTl9ERVZfTkFNRSwNCj4gLQkJCVsxXSA9IExTTTMwM0RMTV9N
QUdOX0RFVl9OQU1FLA0KPiArCQkJWzFdID0gTFNNMzAzRExIX01BR05fREVWX05BTUUsDQo+ICsJ
CQlbMF0gPSBMU00zMDNETE1fTUFHTl9ERVZfTkFNRSwNCkFyZSB5b3Ugc3VyZSB0aGF0IGl0IHdv
cmtzPw0KQmVjYXVzZSBMU00zMDNETEggbWFnbmV0b21ldGVyIHVzZSBkaWZmZXJlbnQga2luZCBv
ZiBXQUkgcmVnaXN0ZXJzLiBUaGlzIA0KZHJpdmVyIHJlYWQgMHgwZiBhbmQgaW4gdGhpcyBjYXNl
IHRoZSB2YWx1ZSBpcyAwIGFuZCB0aGUgZHJpdmVyIGRvIG5vdCANCnByb2JlLi4uWW91IGhhdmUg
dG8gcmVhZCB0aGUgaWRlbnRpZmljYXRpb24gcmVnaXN0ZXJzICgweDBhLCAweDBiLCAweDBjKSAN
CmluIHRoYXQgY2FzZS4NCg0KRGVuaXM=

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

* [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
@ 2013-09-16  9:32         ` Denis CIOCCA
  0 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Lee,
> index 12e7e79..b2e2917 100644
> --- a/drivers/iio/magnetometer/st_magn_core.c
> +++ b/drivers/iio/magnetometer/st_magn_core.c
> @@ -151,7 +151,8 @@ static const struct st_sensors st_magn_sensors[] = {
>   		.wai = ST_MAGN_1_WAI_EXP,
>   		.sensors_supported = {
>   			[0] = LSM303DLHC_MAGN_DEV_NAME,
> -			[1] = LSM303DLM_MAGN_DEV_NAME,
> +			[1] = LSM303DLH_MAGN_DEV_NAME,
> +			[0] = LSM303DLM_MAGN_DEV_NAME,
Are you sure that it works?
Because LSM303DLH magnetometer use different kind of WAI registers. This 
driver read 0x0f and in this case the value is 0 and the driver do not 
probe...You have to read the identification registers (0x0a, 0x0b, 0x0c) 
in that case.

Denis

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

* Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
  2013-09-16  9:19         ` Denis CIOCCA
  (?)
@ 2013-09-16  9:38           ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16  9:38 UTC (permalink / raw)
  To: Denis CIOCCA
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, arnd,
	linus.walleij, linux-iio

On Mon, 16 Sep 2013, Denis CIOCCA wrote:

> Hi Lee,
> >> On 09/10/13 13:49, Lee Jones wrote:
> >>> The LSM303DLH's WAI (WhoAmI) is 0x33, meaning it should be enabled by
> >>> Accel Sensor group one. For the device to probe without error, we'll
> >>> need to ensure it's registered with the correct WAI.
> >>>
> >>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> >> You clearly have a better datasheet than I have as for that part it doesn't even claim to
> >> have the relevant register to read a who am I from.
> >>
> >> Now that datasheet does list odr values as 50, 100, 400 1000 which would put it where it originally
> >> was in these tables.
> >>
> >> http://www.st.com/web/en/resource/technical/document/datasheet/CD00260288.pdf
> >>
> >> I haven't checked other elements...
> >>
> >> I'm confused but suspect we may need another type entry to deal with this one.
> > Hmmm... on initial thought, I don't know how we can handle this one. I
> > assumed the WAIs were a one-stop-shop for device identification. I also
> > thought that they would only match if the functionality and register
> > maps would be the same.
> >
> > I'll touch base with Denis on this, perhaps he can shed some light.
> >
> I've just checked, the WAI is 0x32. It was correct...Are you sure that 
> you use the LSM303DLH?

That's what the datasheet for the board says. Perhaps it's that that's
incorrect? Annoyingly, instead of printing the device name on the
package, ST put some non-Googleable nonsense is there instead
(probably the serial number).

Nevertheless, I'll revert the patch and work something else out.

> >>> ---
> >>>   drivers/iio/accel/st_accel_core.c | 4 ++--
> >>>   1 file changed, 2 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
> >>> index ea62291..03a2b6b 100644
> >>> --- a/drivers/iio/accel/st_accel_core.c
> >>> +++ b/drivers/iio/accel/st_accel_core.c
> >>> @@ -170,6 +170,7 @@ static const struct st_sensors st_accel_sensors[] = {
> >>>   			[2] = LSM330D_ACCEL_DEV_NAME,
> >>>   			[3] = LSM330DL_ACCEL_DEV_NAME,
> >>>   			[4] = LSM330DLC_ACCEL_DEV_NAME,
> >>> +			[5] = LSM303DLH_ACCEL_DEV_NAME,
> >>>   		},
> >>>   		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
> >>>   		.odr = {
> >>> @@ -238,8 +239,7 @@ static const struct st_sensors st_accel_sensors[] = {
> >>>   		.sensors_supported = {
> >>>   			[0] = LIS331DLH_ACCEL_DEV_NAME,
> >>>   			[1] = LSM303DL_ACCEL_DEV_NAME,
> >>> -			[2] = LSM303DLH_ACCEL_DEV_NAME,
> >>> -			[3] = LSM303DLM_ACCEL_DEV_NAME,
> >>> +			[2] = LSM303DLM_ACCEL_DEV_NAME,
> >>>   		},
> >>>   		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
> >>>   		.odr = {
> >>>

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
@ 2013-09-16  9:38           ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16  9:38 UTC (permalink / raw)
  To: Denis CIOCCA
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, arnd,
	linus.walleij, linux-iio

On Mon, 16 Sep 2013, Denis CIOCCA wrote:

> Hi Lee,
> >> On 09/10/13 13:49, Lee Jones wrote:
> >>> The LSM303DLH's WAI (WhoAmI) is 0x33, meaning it should be enabled by
> >>> Accel Sensor group one. For the device to probe without error, we'll
> >>> need to ensure it's registered with the correct WAI.
> >>>
> >>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> >> You clearly have a better datasheet than I have as for that part it doesn't even claim to
> >> have the relevant register to read a who am I from.
> >>
> >> Now that datasheet does list odr values as 50, 100, 400 1000 which would put it where it originally
> >> was in these tables.
> >>
> >> http://www.st.com/web/en/resource/technical/document/datasheet/CD00260288.pdf
> >>
> >> I haven't checked other elements...
> >>
> >> I'm confused but suspect we may need another type entry to deal with this one.
> > Hmmm... on initial thought, I don't know how we can handle this one. I
> > assumed the WAIs were a one-stop-shop for device identification. I also
> > thought that they would only match if the functionality and register
> > maps would be the same.
> >
> > I'll touch base with Denis on this, perhaps he can shed some light.
> >
> I've just checked, the WAI is 0x32. It was correct...Are you sure that 
> you use the LSM303DLH?

That's what the datasheet for the board says. Perhaps it's that that's
incorrect? Annoyingly, instead of printing the device name on the
package, ST put some non-Googleable nonsense is there instead
(probably the serial number).

Nevertheless, I'll revert the patch and work something else out.

> >>> ---
> >>>   drivers/iio/accel/st_accel_core.c | 4 ++--
> >>>   1 file changed, 2 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
> >>> index ea62291..03a2b6b 100644
> >>> --- a/drivers/iio/accel/st_accel_core.c
> >>> +++ b/drivers/iio/accel/st_accel_core.c
> >>> @@ -170,6 +170,7 @@ static const struct st_sensors st_accel_sensors[] = {
> >>>   			[2] = LSM330D_ACCEL_DEV_NAME,
> >>>   			[3] = LSM330DL_ACCEL_DEV_NAME,
> >>>   			[4] = LSM330DLC_ACCEL_DEV_NAME,
> >>> +			[5] = LSM303DLH_ACCEL_DEV_NAME,
> >>>   		},
> >>>   		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
> >>>   		.odr = {
> >>> @@ -238,8 +239,7 @@ static const struct st_sensors st_accel_sensors[] = {
> >>>   		.sensors_supported = {
> >>>   			[0] = LIS331DLH_ACCEL_DEV_NAME,
> >>>   			[1] = LSM303DL_ACCEL_DEV_NAME,
> >>> -			[2] = LSM303DLH_ACCEL_DEV_NAME,
> >>> -			[3] = LSM303DLM_ACCEL_DEV_NAME,
> >>> +			[2] = LSM303DLM_ACCEL_DEV_NAME,
> >>>   		},
> >>>   		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
> >>>   		.odr = {
> >>>

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
@ 2013-09-16  9:38           ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16  9:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 16 Sep 2013, Denis CIOCCA wrote:

> Hi Lee,
> >> On 09/10/13 13:49, Lee Jones wrote:
> >>> The LSM303DLH's WAI (WhoAmI) is 0x33, meaning it should be enabled by
> >>> Accel Sensor group one. For the device to probe without error, we'll
> >>> need to ensure it's registered with the correct WAI.
> >>>
> >>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> >> You clearly have a better datasheet than I have as for that part it doesn't even claim to
> >> have the relevant register to read a who am I from.
> >>
> >> Now that datasheet does list odr values as 50, 100, 400 1000 which would put it where it originally
> >> was in these tables.
> >>
> >> http://www.st.com/web/en/resource/technical/document/datasheet/CD00260288.pdf
> >>
> >> I haven't checked other elements...
> >>
> >> I'm confused but suspect we may need another type entry to deal with this one.
> > Hmmm... on initial thought, I don't know how we can handle this one. I
> > assumed the WAIs were a one-stop-shop for device identification. I also
> > thought that they would only match if the functionality and register
> > maps would be the same.
> >
> > I'll touch base with Denis on this, perhaps he can shed some light.
> >
> I've just checked, the WAI is 0x32. It was correct...Are you sure that 
> you use the LSM303DLH?

That's what the datasheet for the board says. Perhaps it's that that's
incorrect? Annoyingly, instead of printing the device name on the
package, ST put some non-Googleable nonsense is there instead
(probably the serial number).

Nevertheless, I'll revert the patch and work something else out.

> >>> ---
> >>>   drivers/iio/accel/st_accel_core.c | 4 ++--
> >>>   1 file changed, 2 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
> >>> index ea62291..03a2b6b 100644
> >>> --- a/drivers/iio/accel/st_accel_core.c
> >>> +++ b/drivers/iio/accel/st_accel_core.c
> >>> @@ -170,6 +170,7 @@ static const struct st_sensors st_accel_sensors[] = {
> >>>   			[2] = LSM330D_ACCEL_DEV_NAME,
> >>>   			[3] = LSM330DL_ACCEL_DEV_NAME,
> >>>   			[4] = LSM330DLC_ACCEL_DEV_NAME,
> >>> +			[5] = LSM303DLH_ACCEL_DEV_NAME,
> >>>   		},
> >>>   		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
> >>>   		.odr = {
> >>> @@ -238,8 +239,7 @@ static const struct st_sensors st_accel_sensors[] = {
> >>>   		.sensors_supported = {
> >>>   			[0] = LIS331DLH_ACCEL_DEV_NAME,
> >>>   			[1] = LSM303DL_ACCEL_DEV_NAME,
> >>> -			[2] = LSM303DLH_ACCEL_DEV_NAME,
> >>> -			[3] = LSM303DLM_ACCEL_DEV_NAME,
> >>> +			[2] = LSM303DLM_ACCEL_DEV_NAME,
> >>>   		},
> >>>   		.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
> >>>   		.odr = {
> >>>

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
  2013-09-13 20:57             ` Getz, Robin
  (?)
@ 2013-09-16  9:47               ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16  9:47 UTC (permalink / raw)
  To: Getz, Robin
  Cc: Lars-Peter Clausen, Jonathan Cameron, linux-arm-kernel,
	linux-kernel, jic23, arnd, linus.walleij, denis.ciocca,
	linux-iio

> echo "working:"
> cat /sys/bus/iio/devices/*/name
> 
> isn't too much digging. If you really want to do that on your machine - do so in rc.local

Okay, I was going round the long way, which is why is was difficult:

  /sys/class/i2c-adapter/i2c-2/2-005c/iio\:device2/name

I will revert the "registered" patches.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
@ 2013-09-16  9:47               ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16  9:47 UTC (permalink / raw)
  To: Getz, Robin
  Cc: Lars-Peter Clausen, Jonathan Cameron, linux-arm-kernel,
	linux-kernel, jic23, arnd, linus.walleij, denis.ciocca,
	linux-iio

> echo "working:"
> cat /sys/bus/iio/devices/*/name
> 
> isn't too much digging. If you really want to do that on your machine - do so in rc.local

Okay, I was going round the long way, which is why is was difficult:

  /sys/class/i2c-adapter/i2c-2/2-005c/iio\:device2/name

I will revert the "registered" patches.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
@ 2013-09-16  9:47               ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16  9:47 UTC (permalink / raw)
  To: linux-arm-kernel

> echo "working:"
> cat /sys/bus/iio/devices/*/name
> 
> isn't too much digging. If you really want to do that on your machine - do so in rc.local

Okay, I was going round the long way, which is why is was difficult:

  /sys/class/i2c-adapter/i2c-2/2-005c/iio\:device2/name

I will revert the "registered" patches.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
  2013-09-16  9:38           ` Lee Jones
  (?)
@ 2013-09-16  9:57             ` Denis CIOCCA
  -1 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16  9:57 UTC (permalink / raw)
  To: Lee Jones
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, arnd,
	linus.walleij, linux-iio

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 605 bytes --]

Hi Lee,

> That's what the datasheet for the board says. Perhaps it's that that's 
> incorrect? Annoyingly, instead of printing the device name on the 
> package, ST put some non-Googleable nonsense is there instead 
> (probably the serial number). Nevertheless, I'll revert the patch and 
> work something else out.

I've tried with real device...Unfortunately, you are right for name on 
the package...
So, are you using the LSM303DLHC?

Denisÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
@ 2013-09-16  9:57             ` Denis CIOCCA
  0 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16  9:57 UTC (permalink / raw)
  To: Lee Jones
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, arnd,
	linus.walleij, linux-iio

SGkgTGVlLA0KDQo+IFRoYXQncyB3aGF0IHRoZSBkYXRhc2hlZXQgZm9yIHRoZSBib2FyZCBzYXlz
LiBQZXJoYXBzIGl0J3MgdGhhdCB0aGF0J3MgDQo+IGluY29ycmVjdD8gQW5ub3lpbmdseSwgaW5z
dGVhZCBvZiBwcmludGluZyB0aGUgZGV2aWNlIG5hbWUgb24gdGhlIA0KPiBwYWNrYWdlLCBTVCBw
dXQgc29tZSBub24tR29vZ2xlYWJsZSBub25zZW5zZSBpcyB0aGVyZSBpbnN0ZWFkIA0KPiAocHJv
YmFibHkgdGhlIHNlcmlhbCBudW1iZXIpLiBOZXZlcnRoZWxlc3MsIEknbGwgcmV2ZXJ0IHRoZSBw
YXRjaCBhbmQgDQo+IHdvcmsgc29tZXRoaW5nIGVsc2Ugb3V0Lg0KDQpJJ3ZlIHRyaWVkIHdpdGgg
cmVhbCBkZXZpY2UuLi5VbmZvcnR1bmF0ZWx5LCB5b3UgYXJlIHJpZ2h0IGZvciBuYW1lIG9uIA0K
dGhlIHBhY2thZ2UuLi4NClNvLCBhcmUgeW91IHVzaW5nIHRoZSBMU00zMDNETEhDPw0KDQpEZW5p
cw==

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

* [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
@ 2013-09-16  9:57             ` Denis CIOCCA
  0 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16  9:57 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Lee,

> That's what the datasheet for the board says. Perhaps it's that that's 
> incorrect? Annoyingly, instead of printing the device name on the 
> package, ST put some non-Googleable nonsense is there instead 
> (probably the serial number). Nevertheless, I'll revert the patch and 
> work something else out.

I've tried with real device...Unfortunately, you are right for name on 
the package...
So, are you using the LSM303DLHC?

Denis

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

* Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
  2013-09-16  9:32         ` Denis CIOCCA
  (?)
@ 2013-09-16 10:08           ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16 10:08 UTC (permalink / raw)
  To: Denis CIOCCA
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, linux-iio

On Mon, 16 Sep 2013, Denis CIOCCA wrote:

> Hi Lee,
> > index 12e7e79..b2e2917 100644
> > --- a/drivers/iio/magnetometer/st_magn_core.c
> > +++ b/drivers/iio/magnetometer/st_magn_core.c
> > @@ -151,7 +151,8 @@ static const struct st_sensors st_magn_sensors[] = {
> >   		.wai = ST_MAGN_1_WAI_EXP,
> >   		.sensors_supported = {
> >   			[0] = LSM303DLHC_MAGN_DEV_NAME,
> > -			[1] = LSM303DLM_MAGN_DEV_NAME,
> > +			[1] = LSM303DLH_MAGN_DEV_NAME,
> > +			[0] = LSM303DLM_MAGN_DEV_NAME,
> Are you sure that it works?

Well I have tested it working.

> Because LSM303DLH magnetometer use different kind of WAI registers. This 
> driver read 0x0f and in this case the value is 0 and the driver do not 
> probe...You have to read the identification registers (0x0a, 0x0b, 0x0c) 
> in that case.

The driver mentions that the first group of sensors have a WAI of 0x3c:

  #define ST_MAGN_1_WAI_EXP    0x3c

And when I print out the WAI read from the device: 
  
  Requested device: lsm303dlh_magn - read WAI: 0x3c

I guess I could have been lied to again by the board's datasheet again
and the attached device isn't actually a LSM303DLH, but how can I tell
for sure?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
@ 2013-09-16 10:08           ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16 10:08 UTC (permalink / raw)
  To: Denis CIOCCA
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, linux-iio

On Mon, 16 Sep 2013, Denis CIOCCA wrote:

> Hi Lee,
> > index 12e7e79..b2e2917 100644
> > --- a/drivers/iio/magnetometer/st_magn_core.c
> > +++ b/drivers/iio/magnetometer/st_magn_core.c
> > @@ -151,7 +151,8 @@ static const struct st_sensors st_magn_sensors[] = {
> >   		.wai = ST_MAGN_1_WAI_EXP,
> >   		.sensors_supported = {
> >   			[0] = LSM303DLHC_MAGN_DEV_NAME,
> > -			[1] = LSM303DLM_MAGN_DEV_NAME,
> > +			[1] = LSM303DLH_MAGN_DEV_NAME,
> > +			[0] = LSM303DLM_MAGN_DEV_NAME,
> Are you sure that it works?

Well I have tested it working.

> Because LSM303DLH magnetometer use different kind of WAI registers. This 
> driver read 0x0f and in this case the value is 0 and the driver do not 
> probe...You have to read the identification registers (0x0a, 0x0b, 0x0c) 
> in that case.

The driver mentions that the first group of sensors have a WAI of 0x3c:

  #define ST_MAGN_1_WAI_EXP    0x3c

And when I print out the WAI read from the device: 
  
  Requested device: lsm303dlh_magn - read WAI: 0x3c

I guess I could have been lied to again by the board's datasheet again
and the attached device isn't actually a LSM303DLH, but how can I tell
for sure?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
@ 2013-09-16 10:08           ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16 10:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 16 Sep 2013, Denis CIOCCA wrote:

> Hi Lee,
> > index 12e7e79..b2e2917 100644
> > --- a/drivers/iio/magnetometer/st_magn_core.c
> > +++ b/drivers/iio/magnetometer/st_magn_core.c
> > @@ -151,7 +151,8 @@ static const struct st_sensors st_magn_sensors[] = {
> >   		.wai = ST_MAGN_1_WAI_EXP,
> >   		.sensors_supported = {
> >   			[0] = LSM303DLHC_MAGN_DEV_NAME,
> > -			[1] = LSM303DLM_MAGN_DEV_NAME,
> > +			[1] = LSM303DLH_MAGN_DEV_NAME,
> > +			[0] = LSM303DLM_MAGN_DEV_NAME,
> Are you sure that it works?

Well I have tested it working.

> Because LSM303DLH magnetometer use different kind of WAI registers. This 
> driver read 0x0f and in this case the value is 0 and the driver do not 
> probe...You have to read the identification registers (0x0a, 0x0b, 0x0c) 
> in that case.

The driver mentions that the first group of sensors have a WAI of 0x3c:

  #define ST_MAGN_1_WAI_EXP    0x3c

And when I print out the WAI read from the device: 
  
  Requested device: lsm303dlh_magn - read WAI: 0x3c

I guess I could have been lied to again by the board's datasheet again
and the attached device isn't actually a LSM303DLH, but how can I tell
for sure?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
  2013-09-16 10:08           ` Lee Jones
  (?)
@ 2013-09-16 10:18             ` Denis CIOCCA
  -1 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16 10:18 UTC (permalink / raw)
  To: Lee Jones
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, linux-iio

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 697 bytes --]

Hi Lee,

> The driver mentions that the first group of sensors have a WAI of 
> 0x3c: #define ST_MAGN_1_WAI_EXP 0x3c And when I print out the WAI read 
> from the device: Requested device: lsm303dlh_magn - read WAI: 0x3c I 
> guess I could have been lied to again by the board's datasheet again 
> and the attached device isn't actually a LSM303DLH, but how can I tell 
> for sure? 
On LSM303DLH you have to read 0x0a 0x0b and 0x0c registers, you have to 
find 0x48, 0x34 and 0x33. I think in the snowball there is the LSM303DLHC.

Denisÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
@ 2013-09-16 10:18             ` Denis CIOCCA
  0 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16 10:18 UTC (permalink / raw)
  To: Lee Jones
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, linux-iio

SGkgTGVlLA0KDQo+IFRoZSBkcml2ZXIgbWVudGlvbnMgdGhhdCB0aGUgZmlyc3QgZ3JvdXAgb2Yg
c2Vuc29ycyBoYXZlIGEgV0FJIG9mIA0KPiAweDNjOiAjZGVmaW5lIFNUX01BR05fMV9XQUlfRVhQ
IDB4M2MgQW5kIHdoZW4gSSBwcmludCBvdXQgdGhlIFdBSSByZWFkIA0KPiBmcm9tIHRoZSBkZXZp
Y2U6IFJlcXVlc3RlZCBkZXZpY2U6IGxzbTMwM2RsaF9tYWduIC0gcmVhZCBXQUk6IDB4M2MgSSAN
Cj4gZ3Vlc3MgSSBjb3VsZCBoYXZlIGJlZW4gbGllZCB0byBhZ2FpbiBieSB0aGUgYm9hcmQncyBk
YXRhc2hlZXQgYWdhaW4gDQo+IGFuZCB0aGUgYXR0YWNoZWQgZGV2aWNlIGlzbid0IGFjdHVhbGx5
IGEgTFNNMzAzRExILCBidXQgaG93IGNhbiBJIHRlbGwgDQo+IGZvciBzdXJlPyANCk9uIExTTTMw
M0RMSCB5b3UgaGF2ZSB0byByZWFkIDB4MGEgMHgwYiBhbmQgMHgwYyByZWdpc3RlcnMsIHlvdSBo
YXZlIHRvIA0KZmluZCAweDQ4LCAweDM0IGFuZCAweDMzLiBJIHRoaW5rIGluIHRoZSBzbm93YmFs
bCB0aGVyZSBpcyB0aGUgTFNNMzAzRExIQy4NCg0KRGVuaXM=

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

* [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
@ 2013-09-16 10:18             ` Denis CIOCCA
  0 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16 10:18 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Lee,

> The driver mentions that the first group of sensors have a WAI of 
> 0x3c: #define ST_MAGN_1_WAI_EXP 0x3c And when I print out the WAI read 
> from the device: Requested device: lsm303dlh_magn - read WAI: 0x3c I 
> guess I could have been lied to again by the board's datasheet again 
> and the attached device isn't actually a LSM303DLH, but how can I tell 
> for sure? 
On LSM303DLH you have to read 0x0a 0x0b and 0x0c registers, you have to 
find 0x48, 0x34 and 0x33. I think in the snowball there is the LSM303DLHC.

Denis

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

* Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
  2013-09-16  9:57             ` Denis CIOCCA
  (?)
@ 2013-09-16 10:19               ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16 10:19 UTC (permalink / raw)
  To: Denis CIOCCA
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, arnd,
	linus.walleij, linux-iio

> > That's what the datasheet for the board says. Perhaps it's that that's 
> > incorrect? Annoyingly, instead of printing the device name on the 
> > package, ST put some non-Googleable nonsense is there instead 
> > (probably the serial number). Nevertheless, I'll revert the patch and 
> > work something else out.
> 
> I've tried with real device...Unfortunately, you are right for name on 
> the package...
> So, are you using the LSM303DLHC?

According to my datasheet [1], I have the LSM303DLH.

[1] http://www.calao-systems.com/repository/pub/EMBEDDED%20COMPUTERS/SKY-S9500-ULP-XXX/C12-SDK/SCH-00103-B11.pdf

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
@ 2013-09-16 10:19               ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16 10:19 UTC (permalink / raw)
  To: Denis CIOCCA
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, arnd,
	linus.walleij, linux-iio

> > That's what the datasheet for the board says. Perhaps it's that that's 
> > incorrect? Annoyingly, instead of printing the device name on the 
> > package, ST put some non-Googleable nonsense is there instead 
> > (probably the serial number). Nevertheless, I'll revert the patch and 
> > work something else out.
> 
> I've tried with real device...Unfortunately, you are right for name on 
> the package...
> So, are you using the LSM303DLHC?

According to my datasheet [1], I have the LSM303DLH.

[1] http://www.calao-systems.com/repository/pub/EMBEDDED%20COMPUTERS/SKY-S9500-ULP-XXX/C12-SDK/SCH-00103-B11.pdf

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
@ 2013-09-16 10:19               ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16 10:19 UTC (permalink / raw)
  To: linux-arm-kernel

> > That's what the datasheet for the board says. Perhaps it's that that's 
> > incorrect? Annoyingly, instead of printing the device name on the 
> > package, ST put some non-Googleable nonsense is there instead 
> > (probably the serial number). Nevertheless, I'll revert the patch and 
> > work something else out.
> 
> I've tried with real device...Unfortunately, you are right for name on 
> the package...
> So, are you using the LSM303DLHC?

According to my datasheet [1], I have the LSM303DLH.

[1] http://www.calao-systems.com/repository/pub/EMBEDDED%20COMPUTERS/SKY-S9500-ULP-XXX/C12-SDK/SCH-00103-B11.pdf

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
  2013-09-16 10:19               ` Lee Jones
  (?)
@ 2013-09-16 10:23                 ` Denis CIOCCA
  -1 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16 10:23 UTC (permalink / raw)
  To: Lee Jones
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, arnd,
	linus.walleij, linux-iio

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 583 bytes --]

>> I've tried with real device...Unfortunately, you are right for name on
>> the package...
>> So, are you using the LSM303DLHC?
> According to my datasheet [1], I have the LSM303DLH.
>
> [1] http://www.calao-systems.com/repository/pub/EMBEDDED%20COMPUTERS/SKY-S9500-ULP-XXX/C12-SDK/SCH-00103-B11.pdf
>
Mhh...I saw the LSM303DLHC...
The LSM303DLH is not populated, there is only the footprint but is not 
soldered...

Denisÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
@ 2013-09-16 10:23                 ` Denis CIOCCA
  0 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16 10:23 UTC (permalink / raw)
  To: Lee Jones
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, arnd,
	linus.walleij, linux-iio

Pj4gSSd2ZSB0cmllZCB3aXRoIHJlYWwgZGV2aWNlLi4uVW5mb3J0dW5hdGVseSwgeW91IGFyZSBy
aWdodCBmb3IgbmFtZSBvbg0KPj4gdGhlIHBhY2thZ2UuLi4NCj4+IFNvLCBhcmUgeW91IHVzaW5n
IHRoZSBMU00zMDNETEhDPw0KPiBBY2NvcmRpbmcgdG8gbXkgZGF0YXNoZWV0IFsxXSwgSSBoYXZl
IHRoZSBMU00zMDNETEguDQo+DQo+IFsxXSBodHRwOi8vd3d3LmNhbGFvLXN5c3RlbXMuY29tL3Jl
cG9zaXRvcnkvcHViL0VNQkVEREVEJTIwQ09NUFVURVJTL1NLWS1TOTUwMC1VTFAtWFhYL0MxMi1T
REsvU0NILTAwMTAzLUIxMS5wZGYNCj4NCk1oaC4uLkkgc2F3IHRoZSBMU00zMDNETEhDLi4uDQpU
aGUgTFNNMzAzRExIIGlzIG5vdCBwb3B1bGF0ZWQsIHRoZXJlIGlzIG9ubHkgdGhlIGZvb3Rwcmlu
dCBidXQgaXMgbm90IA0Kc29sZGVyZWQuLi4NCg0KRGVuaXM=

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

* [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
@ 2013-09-16 10:23                 ` Denis CIOCCA
  0 siblings, 0 replies; 246+ messages in thread
From: Denis CIOCCA @ 2013-09-16 10:23 UTC (permalink / raw)
  To: linux-arm-kernel

>> I've tried with real device...Unfortunately, you are right for name on
>> the package...
>> So, are you using the LSM303DLHC?
> According to my datasheet [1], I have the LSM303DLH.
>
> [1] http://www.calao-systems.com/repository/pub/EMBEDDED%20COMPUTERS/SKY-S9500-ULP-XXX/C12-SDK/SCH-00103-B11.pdf
>
Mhh...I saw the LSM303DLHC...
The LSM303DLH is not populated, there is only the footprint but is not 
soldered...

Denis

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

* Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
  2013-09-16 10:23                 ` Denis CIOCCA
  (?)
@ 2013-09-16 11:08                   ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16 11:08 UTC (permalink / raw)
  To: Denis CIOCCA
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, arnd,
	linus.walleij, linux-iio

On Mon, 16 Sep 2013, Denis CIOCCA wrote:

> >> I've tried with real device...Unfortunately, you are right for name on
> >> the package...
> >> So, are you using the LSM303DLHC?
> > According to my datasheet [1], I have the LSM303DLH.
> >
> > [1] http://www.calao-systems.com/repository/pub/EMBEDDED%20COMPUTERS/SKY-S9500-ULP-XXX/C12-SDK/SCH-00103-B11.pdf
> >
> Mhh...I saw the LSM303DLHC...
> The LSM303DLH is not populated, there is only the footprint but is not 
> soldered...

The documentation says is the other way round.

See the big "Not populated" box around the LSM303DLHC?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
@ 2013-09-16 11:08                   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16 11:08 UTC (permalink / raw)
  To: Denis CIOCCA
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, arnd,
	linus.walleij, linux-iio

On Mon, 16 Sep 2013, Denis CIOCCA wrote:

> >> I've tried with real device...Unfortunately, you are right for name on
> >> the package...
> >> So, are you using the LSM303DLHC?
> > According to my datasheet [1], I have the LSM303DLH.
> >
> > [1] http://www.calao-systems.com/repository/pub/EMBEDDED%20COMPUTERS/SKY-S9500-ULP-XXX/C12-SDK/SCH-00103-B11.pdf
> >
> Mhh...I saw the LSM303DLHC...
> The LSM303DLH is not populated, there is only the footprint but is not 
> soldered...

The documentation says is the other way round.

See the big "Not populated" box around the LSM303DLHC?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
@ 2013-09-16 11:08                   ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16 11:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 16 Sep 2013, Denis CIOCCA wrote:

> >> I've tried with real device...Unfortunately, you are right for name on
> >> the package...
> >> So, are you using the LSM303DLHC?
> > According to my datasheet [1], I have the LSM303DLH.
> >
> > [1] http://www.calao-systems.com/repository/pub/EMBEDDED%20COMPUTERS/SKY-S9500-ULP-XXX/C12-SDK/SCH-00103-B11.pdf
> >
> Mhh...I saw the LSM303DLHC...
> The LSM303DLH is not populated, there is only the footprint but is not 
> soldered...

The documentation says is the other way round.

See the big "Not populated" box around the LSM303DLHC?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
  2013-09-16 10:18             ` Denis CIOCCA
  (?)
@ 2013-09-16 11:11               ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16 11:11 UTC (permalink / raw)
  To: Denis CIOCCA
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, linux-iio

On Mon, 16 Sep 2013, Denis CIOCCA wrote:

> Hi Lee,
> 
> > The driver mentions that the first group of sensors have a WAI of 
> > 0x3c: #define ST_MAGN_1_WAI_EXP 0x3c And when I print out the WAI read 
> > from the device: Requested device: lsm303dlh_magn - read WAI: 0x3c I 
> > guess I could have been lied to again by the board's datasheet again 
> > and the attached device isn't actually a LSM303DLH, but how can I tell 
> > for sure? 
> On LSM303DLH you have to read 0x0a 0x0b and 0x0c registers, you have to 
> find 0x48, 0x34 and 0x33. I think in the snowball there is the LSM303DLHC.

I'm inclined to agree with you. I'll make the necessary changes.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
@ 2013-09-16 11:11               ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16 11:11 UTC (permalink / raw)
  To: Denis CIOCCA
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, linux-iio

On Mon, 16 Sep 2013, Denis CIOCCA wrote:

> Hi Lee,
> 
> > The driver mentions that the first group of sensors have a WAI of 
> > 0x3c: #define ST_MAGN_1_WAI_EXP 0x3c And when I print out the WAI read 
> > from the device: Requested device: lsm303dlh_magn - read WAI: 0x3c I 
> > guess I could have been lied to again by the board's datasheet again 
> > and the attached device isn't actually a LSM303DLH, but how can I tell 
> > for sure? 
> On LSM303DLH you have to read 0x0a 0x0b and 0x0c registers, you have to 
> find 0x48, 0x34 and 0x33. I think in the snowball there is the LSM303DLHC.

I'm inclined to agree with you. I'll make the necessary changes.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
@ 2013-09-16 11:11               ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16 11:11 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 16 Sep 2013, Denis CIOCCA wrote:

> Hi Lee,
> 
> > The driver mentions that the first group of sensors have a WAI of 
> > 0x3c: #define ST_MAGN_1_WAI_EXP 0x3c And when I print out the WAI read 
> > from the device: Requested device: lsm303dlh_magn - read WAI: 0x3c I 
> > guess I could have been lied to again by the board's datasheet again 
> > and the attached device isn't actually a LSM303DLH, but how can I tell 
> > for sure? 
> On LSM303DLH you have to read 0x0a 0x0b and 0x0c registers, you have to 
> find 0x48, 0x34 and 0x33. I think in the snowball there is the LSM303DLHC.

I'm inclined to agree with you. I'll make the necessary changes.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
  2013-09-16 10:18             ` Denis CIOCCA
  (?)
@ 2013-09-16 11:26               ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16 11:26 UTC (permalink / raw)
  To: Denis CIOCCA
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, linux-iio

On Mon, 16 Sep 2013, Denis CIOCCA wrote:

> Hi Lee,
> 
> > The driver mentions that the first group of sensors have a WAI of 
> > 0x3c: #define ST_MAGN_1_WAI_EXP 0x3c And when I print out the WAI read 
> > from the device: Requested device: lsm303dlh_magn - read WAI: 0x3c I 
> > guess I could have been lied to again by the board's datasheet again 
> > and the attached device isn't actually a LSM303DLH, but how can I tell 
> > for sure? 
> On LSM303DLH you have to read 0x0a 0x0b and 0x0c registers, you have to 
> find 0x48, 0x34 and 0x33. I think in the snowball there is the LSM303DLHC.

I just did that too:

  Device: lsm303dlh_magn: WAI: (0x3c)
  st_magn_common_probe():  IR: ID1 (0x48) ID2 (0x34) ID3 (0x33)

It appears the LSM303DLH does have a populated WAI register after all.

Now what? :)

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
@ 2013-09-16 11:26               ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16 11:26 UTC (permalink / raw)
  To: Denis CIOCCA
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, linux-iio

On Mon, 16 Sep 2013, Denis CIOCCA wrote:

> Hi Lee,
> 
> > The driver mentions that the first group of sensors have a WAI of 
> > 0x3c: #define ST_MAGN_1_WAI_EXP 0x3c And when I print out the WAI read 
> > from the device: Requested device: lsm303dlh_magn - read WAI: 0x3c I 
> > guess I could have been lied to again by the board's datasheet again 
> > and the attached device isn't actually a LSM303DLH, but how can I tell 
> > for sure? 
> On LSM303DLH you have to read 0x0a 0x0b and 0x0c registers, you have to 
> find 0x48, 0x34 and 0x33. I think in the snowball there is the LSM303DLHC.

I just did that too:

  Device: lsm303dlh_magn: WAI: (0x3c)
  st_magn_common_probe():  IR: ID1 (0x48) ID2 (0x34) ID3 (0x33)

It appears the LSM303DLH does have a populated WAI register after all.

Now what? :)

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
@ 2013-09-16 11:26               ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16 11:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 16 Sep 2013, Denis CIOCCA wrote:

> Hi Lee,
> 
> > The driver mentions that the first group of sensors have a WAI of 
> > 0x3c: #define ST_MAGN_1_WAI_EXP 0x3c And when I print out the WAI read 
> > from the device: Requested device: lsm303dlh_magn - read WAI: 0x3c I 
> > guess I could have been lied to again by the board's datasheet again 
> > and the attached device isn't actually a LSM303DLH, but how can I tell 
> > for sure? 
> On LSM303DLH you have to read 0x0a 0x0b and 0x0c registers, you have to 
> find 0x48, 0x34 and 0x33. I think in the snowball there is the LSM303DLHC.

I just did that too:

  Device: lsm303dlh_magn: WAI: (0x3c)
  st_magn_common_probe():  IR: ID1 (0x48) ID2 (0x34) ID3 (0x33)

It appears the LSM303DLH does have a populated WAI register after all.

Now what? :)

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
  2013-09-16  9:21           ` Denis CIOCCA
  (?)
@ 2013-09-16 12:03             ` Lars-Peter Clausen
  -1 siblings, 0 replies; 246+ messages in thread
From: Lars-Peter Clausen @ 2013-09-16 12:03 UTC (permalink / raw)
  To: Denis CIOCCA
  Cc: Jonathan Cameron, Lee Jones, linux-arm-kernel, linux-kernel,
	jic23, arnd, linus.walleij, linux-iio

On 09/16/2013 11:21 AM, Denis CIOCCA wrote:
> Hi Lars,
>> On 09/14/2013 02:27 PM, Jonathan Cameron wrote:
>>> On 09/14/13 13:14, Jonathan Cameron wrote:
>>>> On 09/10/13 13:49, Lee Jones wrote:
>>>>> Some of ST's sensors are appended with their sensor type and some
>>>>> are not. For consistency we're extending the same naming convention
>>>>> throughout.
>>>>>
>>>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>>>> Honestly I don't care either way on these, but consistency would definitely
>>>> be good so applied to the togreg branch of iio.git
>>>>
>>>> Thanks,
>>> Actually change of plan. I'm going to hold off on these as this an ABI change.
>>> Iritating though having these as completely inconsistent is, changing this
>>> will change device identification from userspace which is not a good idea.
>>>
>>> Sorry Lee, but we really shouldn't do this. I should have picked up on this
>>> in the original driver reviews but that's hindsight for you.
>> I think those with the suffix are the ones where you have accel and gyro in
>> the same package, the ones without the suffix are pure accelerometers.
> Yes You are right. I've used this kind of logic... What do you think about?
> 
> Denis

Seems sensible to me.


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

* Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
@ 2013-09-16 12:03             ` Lars-Peter Clausen
  0 siblings, 0 replies; 246+ messages in thread
From: Lars-Peter Clausen @ 2013-09-16 12:03 UTC (permalink / raw)
  To: Denis CIOCCA
  Cc: Jonathan Cameron, Lee Jones, linux-arm-kernel, linux-kernel,
	jic23, arnd, linus.walleij, linux-iio

On 09/16/2013 11:21 AM, Denis CIOCCA wrote:
> Hi Lars,
>> On 09/14/2013 02:27 PM, Jonathan Cameron wrote:
>>> On 09/14/13 13:14, Jonathan Cameron wrote:
>>>> On 09/10/13 13:49, Lee Jones wrote:
>>>>> Some of ST's sensors are appended with their sensor type and some
>>>>> are not. For consistency we're extending the same naming convention
>>>>> throughout.
>>>>>
>>>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>>>> Honestly I don't care either way on these, but consistency would definitely
>>>> be good so applied to the togreg branch of iio.git
>>>>
>>>> Thanks,
>>> Actually change of plan. I'm going to hold off on these as this an ABI change.
>>> Iritating though having these as completely inconsistent is, changing this
>>> will change device identification from userspace which is not a good idea.
>>>
>>> Sorry Lee, but we really shouldn't do this. I should have picked up on this
>>> in the original driver reviews but that's hindsight for you.
>> I think those with the suffix are the ones where you have accel and gyro in
>> the same package, the ones without the suffix are pure accelerometers.
> Yes You are right. I've used this kind of logic... What do you think about?
> 
> Denis

Seems sensible to me.

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

* [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
@ 2013-09-16 12:03             ` Lars-Peter Clausen
  0 siblings, 0 replies; 246+ messages in thread
From: Lars-Peter Clausen @ 2013-09-16 12:03 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/16/2013 11:21 AM, Denis CIOCCA wrote:
> Hi Lars,
>> On 09/14/2013 02:27 PM, Jonathan Cameron wrote:
>>> On 09/14/13 13:14, Jonathan Cameron wrote:
>>>> On 09/10/13 13:49, Lee Jones wrote:
>>>>> Some of ST's sensors are appended with their sensor type and some
>>>>> are not. For consistency we're extending the same naming convention
>>>>> throughout.
>>>>>
>>>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>>>> Honestly I don't care either way on these, but consistency would definitely
>>>> be good so applied to the togreg branch of iio.git
>>>>
>>>> Thanks,
>>> Actually change of plan. I'm going to hold off on these as this an ABI change.
>>> Iritating though having these as completely inconsistent is, changing this
>>> will change device identification from userspace which is not a good idea.
>>>
>>> Sorry Lee, but we really shouldn't do this. I should have picked up on this
>>> in the original driver reviews but that's hindsight for you.
>> I think those with the suffix are the ones where you have accel and gyro in
>> the same package, the ones without the suffix are pure accelerometers.
> Yes You are right. I've used this kind of logic... What do you think about?
> 
> Denis

Seems sensible to me.

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

* Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
  2013-09-14 12:14     ` Jonathan Cameron
@ 2013-09-16 13:31       ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16 13:31 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-arm-kernel, linux-kernel, jic23, arnd, linus.walleij,
	denis.ciocca, linux-iio

> Honestly I don't care either way on these, but consistency would definitely
> be good so applied to the togreg branch of iio.git

For clarification, is togreg due for the v3.12 merge window or will be
get a settling period in -next?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
@ 2013-09-16 13:31       ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-16 13:31 UTC (permalink / raw)
  To: linux-arm-kernel

> Honestly I don't care either way on these, but consistency would definitely
> be good so applied to the togreg branch of iio.git

For clarification, is togreg due for the v3.12 merge window or will be
get a settling period in -next?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
  2013-09-16 13:31       ` Lee Jones
@ 2013-09-16 13:43         ` Lars-Peter Clausen
  -1 siblings, 0 replies; 246+ messages in thread
From: Lars-Peter Clausen @ 2013-09-16 13:43 UTC (permalink / raw)
  To: Lee Jones
  Cc: Jonathan Cameron, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, denis.ciocca, linux-iio

On 09/16/2013 03:31 PM, Lee Jones wrote:
>> Honestly I don't care either way on these, but consistency would definitely
>> be good so applied to the togreg branch of iio.git
> 
> For clarification, is togreg due for the v3.12 merge window or will be
> get a settling period in -next?
> 

Well everything up to the 'iio-for-3.12c' tag will be in v3.12, everything
else not.

- Lars

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

* [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
@ 2013-09-16 13:43         ` Lars-Peter Clausen
  0 siblings, 0 replies; 246+ messages in thread
From: Lars-Peter Clausen @ 2013-09-16 13:43 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/16/2013 03:31 PM, Lee Jones wrote:
>> Honestly I don't care either way on these, but consistency would definitely
>> be good so applied to the togreg branch of iio.git
> 
> For clarification, is togreg due for the v3.12 merge window or will be
> get a settling period in -next?
> 

Well everything up to the 'iio-for-3.12c' tag will be in v3.12, everything
else not.

- Lars

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

* Re: [PATCH 25/38] iio: pressure-core: st: Allow for number of channels to vary
  2013-09-16  8:17       ` Lee Jones
@ 2013-09-16 15:32         ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-16 15:32 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, linux-kernel, jic23, arnd, linus.walleij,
	denis.ciocca, linux-iio



Lee Jones <lee.jones@linaro.org> wrote:
>On Sat, 14 Sep 2013, Jonathan Cameron wrote:
>
>> On 09/10/13 13:49, Lee Jones wrote:
>> > At the moment the number of channels specified is dictated by the
>first
>> > sensor supported by the driver. As we add support for more sensors
>this
>> > is likely to vary. Instead of using the ARRAY_SIZE() of the
>LPS331AP's
>> > channel specifier we'll use a new adaptable 'struct st_sensors'
>element
>> > instead.
>> > 
>> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
>> Applied with Denis ack (again it should have been here)
>
>Ah, you're going to take the patches one-by-one?
>
>After amending the drivers as per your review I was going to send a
>final time with all Acks applied. Then, once all maintainer Acks were
>obtained I was going to send you a pull-request.
>
>Perhaps I should have communicated the intent sooner.
>
>Future submissions will have all Acks applied in this case.

Quite a few of this series stood alone just fine so I grabbed them :)
>
>> > ---
>> >  drivers/iio/pressure/st_pressure_core.c | 3 ++-
>> >  include/linux/iio/common/st_sensors.h   | 1 +
>> >  2 files changed, 3 insertions(+), 1 deletion(-)
>> > 
>> > diff --git a/drivers/iio/pressure/st_pressure_core.c
>b/drivers/iio/pressure/st_pressure_core.c
>> > index 60c2ee4..3abada2 100644
>> > --- a/drivers/iio/pressure/st_pressure_core.c
>> > +++ b/drivers/iio/pressure/st_pressure_core.c
>> > @@ -107,6 +107,7 @@ static const struct st_sensors
>st_press_sensors[] = {
>> >  			[0] = LPS331AP_PRESS_DEV_NAME,
>> >  		},
>> >  		.ch = (struct iio_chan_spec *)st_press_lps331ap_channels,
>> > +		.num_ch = ARRAY_SIZE(st_press_lps331ap_channels),
>> >  		.odr = {
>> >  			.addr = ST_PRESS_LPS331AP_ODR_ADDR,
>> >  			.mask = ST_PRESS_LPS331AP_ODR_MASK,
>> > @@ -245,7 +246,7 @@ int st_press_common_probe(struct iio_dev
>*indio_dev,
>> >  	pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS;
>> >  	pdata->multiread_bit = pdata->sensor->multi_read_bit;
>> >  	indio_dev->channels = pdata->sensor->ch;
>> > -	indio_dev->num_channels = ARRAY_SIZE(st_press_lps331ap_channels);
>> > +	indio_dev->num_channels = pdata->sensor->num_ch;
>> >  
>> >  	if (pdata->sensor->fs.addr != 0)
>> >  		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
>> > diff --git a/include/linux/iio/common/st_sensors.h
>b/include/linux/iio/common/st_sensors.h
>> > index e51f654..e732fda 100644
>> > --- a/include/linux/iio/common/st_sensors.h
>> > +++ b/include/linux/iio/common/st_sensors.h
>> > @@ -184,6 +184,7 @@ struct st_sensors {
>> >  	u8 wai;
>> >  	char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME];
>> >  	struct iio_chan_spec *ch;
>> > +	int num_ch;
>> >  	struct st_sensor_odr odr;
>> >  	struct st_sensor_power pw;
>> >  	struct st_sensor_axis enable_axis;
>> > 

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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

* [PATCH 25/38] iio: pressure-core: st: Allow for number of channels to vary
@ 2013-09-16 15:32         ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-16 15:32 UTC (permalink / raw)
  To: linux-arm-kernel



Lee Jones <lee.jones@linaro.org> wrote:
>On Sat, 14 Sep 2013, Jonathan Cameron wrote:
>
>> On 09/10/13 13:49, Lee Jones wrote:
>> > At the moment the number of channels specified is dictated by the
>first
>> > sensor supported by the driver. As we add support for more sensors
>this
>> > is likely to vary. Instead of using the ARRAY_SIZE() of the
>LPS331AP's
>> > channel specifier we'll use a new adaptable 'struct st_sensors'
>element
>> > instead.
>> > 
>> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
>> Applied with Denis ack (again it should have been here)
>
>Ah, you're going to take the patches one-by-one?
>
>After amending the drivers as per your review I was going to send a
>final time with all Acks applied. Then, once all maintainer Acks were
>obtained I was going to send you a pull-request.
>
>Perhaps I should have communicated the intent sooner.
>
>Future submissions will have all Acks applied in this case.

Quite a few of this series stood alone just fine so I grabbed them :)
>
>> > ---
>> >  drivers/iio/pressure/st_pressure_core.c | 3 ++-
>> >  include/linux/iio/common/st_sensors.h   | 1 +
>> >  2 files changed, 3 insertions(+), 1 deletion(-)
>> > 
>> > diff --git a/drivers/iio/pressure/st_pressure_core.c
>b/drivers/iio/pressure/st_pressure_core.c
>> > index 60c2ee4..3abada2 100644
>> > --- a/drivers/iio/pressure/st_pressure_core.c
>> > +++ b/drivers/iio/pressure/st_pressure_core.c
>> > @@ -107,6 +107,7 @@ static const struct st_sensors
>st_press_sensors[] = {
>> >  			[0] = LPS331AP_PRESS_DEV_NAME,
>> >  		},
>> >  		.ch = (struct iio_chan_spec *)st_press_lps331ap_channels,
>> > +		.num_ch = ARRAY_SIZE(st_press_lps331ap_channels),
>> >  		.odr = {
>> >  			.addr = ST_PRESS_LPS331AP_ODR_ADDR,
>> >  			.mask = ST_PRESS_LPS331AP_ODR_MASK,
>> > @@ -245,7 +246,7 @@ int st_press_common_probe(struct iio_dev
>*indio_dev,
>> >  	pdata->num_data_channels = ST_PRESS_NUMBER_DATA_CHANNELS;
>> >  	pdata->multiread_bit = pdata->sensor->multi_read_bit;
>> >  	indio_dev->channels = pdata->sensor->ch;
>> > -	indio_dev->num_channels = ARRAY_SIZE(st_press_lps331ap_channels);
>> > +	indio_dev->num_channels = pdata->sensor->num_ch;
>> >  
>> >  	if (pdata->sensor->fs.addr != 0)
>> >  		pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
>> > diff --git a/include/linux/iio/common/st_sensors.h
>b/include/linux/iio/common/st_sensors.h
>> > index e51f654..e732fda 100644
>> > --- a/include/linux/iio/common/st_sensors.h
>> > +++ b/include/linux/iio/common/st_sensors.h
>> > @@ -184,6 +184,7 @@ struct st_sensors {
>> >  	u8 wai;
>> >  	char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME];
>> >  	struct iio_chan_spec *ch;
>> > +	int num_ch;
>> >  	struct st_sensor_odr odr;
>> >  	struct st_sensor_power pw;
>> >  	struct st_sensor_axis enable_axis;
>> > 

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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

* Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
  2013-09-16 12:03             ` Lars-Peter Clausen
  (?)
@ 2013-09-16 19:15               ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-16 19:15 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Denis CIOCCA, Lee Jones, linux-arm-kernel, linux-kernel, jic23,
	arnd, linus.walleij, linux-iio

On 09/16/13 13:03, Lars-Peter Clausen wrote:
> On 09/16/2013 11:21 AM, Denis CIOCCA wrote:
>> Hi Lars,
>>> On 09/14/2013 02:27 PM, Jonathan Cameron wrote:
>>>> On 09/14/13 13:14, Jonathan Cameron wrote:
>>>>> On 09/10/13 13:49, Lee Jones wrote:
>>>>>> Some of ST's sensors are appended with their sensor type and some
>>>>>> are not. For consistency we're extending the same naming convention
>>>>>> throughout.
>>>>>>
>>>>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>>>>> Honestly I don't care either way on these, but consistency would definitely
>>>>> be good so applied to the togreg branch of iio.git
>>>>>
>>>>> Thanks,
>>>> Actually change of plan. I'm going to hold off on these as this an ABI change.
>>>> Iritating though having these as completely inconsistent is, changing this
>>>> will change device identification from userspace which is not a good idea.
>>>>
>>>> Sorry Lee, but we really shouldn't do this. I should have picked up on this
>>>> in the original driver reviews but that's hindsight for you.
>>> I think those with the suffix are the ones where you have accel and gyro in
>>> the same package, the ones without the suffix are pure accelerometers.
>> Yes You are right. I've used this kind of logic... What do you think about?
>>
>> Denis
> 
> Seems sensible to me.

How about a comment to this effect in the code so that we keep it like this?

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

* Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
@ 2013-09-16 19:15               ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-16 19:15 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Denis CIOCCA, Lee Jones, linux-arm-kernel, linux-kernel, jic23,
	arnd, linus.walleij, linux-iio

On 09/16/13 13:03, Lars-Peter Clausen wrote:
> On 09/16/2013 11:21 AM, Denis CIOCCA wrote:
>> Hi Lars,
>>> On 09/14/2013 02:27 PM, Jonathan Cameron wrote:
>>>> On 09/14/13 13:14, Jonathan Cameron wrote:
>>>>> On 09/10/13 13:49, Lee Jones wrote:
>>>>>> Some of ST's sensors are appended with their sensor type and some
>>>>>> are not. For consistency we're extending the same naming convention
>>>>>> throughout.
>>>>>>
>>>>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>>>>> Honestly I don't care either way on these, but consistency would definitely
>>>>> be good so applied to the togreg branch of iio.git
>>>>>
>>>>> Thanks,
>>>> Actually change of plan. I'm going to hold off on these as this an ABI change.
>>>> Iritating though having these as completely inconsistent is, changing this
>>>> will change device identification from userspace which is not a good idea.
>>>>
>>>> Sorry Lee, but we really shouldn't do this. I should have picked up on this
>>>> in the original driver reviews but that's hindsight for you.
>>> I think those with the suffix are the ones where you have accel and gyro in
>>> the same package, the ones without the suffix are pure accelerometers.
>> Yes You are right. I've used this kind of logic... What do you think about?
>>
>> Denis
> 
> Seems sensible to me.

How about a comment to this effect in the code so that we keep it like this?

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

* [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
@ 2013-09-16 19:15               ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-16 19:15 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/16/13 13:03, Lars-Peter Clausen wrote:
> On 09/16/2013 11:21 AM, Denis CIOCCA wrote:
>> Hi Lars,
>>> On 09/14/2013 02:27 PM, Jonathan Cameron wrote:
>>>> On 09/14/13 13:14, Jonathan Cameron wrote:
>>>>> On 09/10/13 13:49, Lee Jones wrote:
>>>>>> Some of ST's sensors are appended with their sensor type and some
>>>>>> are not. For consistency we're extending the same naming convention
>>>>>> throughout.
>>>>>>
>>>>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>>>>> Honestly I don't care either way on these, but consistency would definitely
>>>>> be good so applied to the togreg branch of iio.git
>>>>>
>>>>> Thanks,
>>>> Actually change of plan. I'm going to hold off on these as this an ABI change.
>>>> Iritating though having these as completely inconsistent is, changing this
>>>> will change device identification from userspace which is not a good idea.
>>>>
>>>> Sorry Lee, but we really shouldn't do this. I should have picked up on this
>>>> in the original driver reviews but that's hindsight for you.
>>> I think those with the suffix are the ones where you have accel and gyro in
>>> the same package, the ones without the suffix are pure accelerometers.
>> Yes You are right. I've used this kind of logic... What do you think about?
>>
>> Denis
> 
> Seems sensible to me.

How about a comment to this effect in the code so that we keep it like this?

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

* Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
  2013-09-16 13:43         ` Lars-Peter Clausen
@ 2013-09-16 19:17           ` Jonathan Cameron
  -1 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-16 19:17 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Lee Jones, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, denis.ciocca, linux-iio

On 09/16/13 14:43, Lars-Peter Clausen wrote:
> On 09/16/2013 03:31 PM, Lee Jones wrote:
>>> Honestly I don't care either way on these, but consistency would definitely
>>> be good so applied to the togreg branch of iio.git
>>
>> For clarification, is togreg due for the v3.12 merge window or will be
>> get a settling period in -next?
>>
> 
> Well everything up to the 'iio-for-3.12c' tag will be in v3.12, everything
> else not.
> 
> - Lars
> 
Yes.  At the moment IIO is routed through Greg KHs staging tree.  His merge
window closes 1 week before Linus opens the main one (when Greg can figure
out what Linus is intending!)  Hence I close the IIO one whenever I manage
to get a last pull request in before that.

Hence all 3.13 for the current togreg branch.

Jonathan

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

* [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
@ 2013-09-16 19:17           ` Jonathan Cameron
  0 siblings, 0 replies; 246+ messages in thread
From: Jonathan Cameron @ 2013-09-16 19:17 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/16/13 14:43, Lars-Peter Clausen wrote:
> On 09/16/2013 03:31 PM, Lee Jones wrote:
>>> Honestly I don't care either way on these, but consistency would definitely
>>> be good so applied to the togreg branch of iio.git
>>
>> For clarification, is togreg due for the v3.12 merge window or will be
>> get a settling period in -next?
>>
> 
> Well everything up to the 'iio-for-3.12c' tag will be in v3.12, everything
> else not.
> 
> - Lars
> 
Yes.  At the moment IIO is routed through Greg KHs staging tree.  His merge
window closes 1 week before Linus opens the main one (when Greg can figure
out what Linus is intending!)  Hence I close the IIO one whenever I manage
to get a last pull request in before that.

Hence all 3.13 for the current togreg branch.

Jonathan

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

* Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
  2013-09-16 19:17           ` Jonathan Cameron
@ 2013-09-17  8:05             ` Lee Jones
  -1 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-17  8:05 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Lars-Peter Clausen, linux-arm-kernel, linux-kernel, jic23, arnd,
	linus.walleij, denis.ciocca, linux-iio

On Mon, 16 Sep 2013, Jonathan Cameron wrote:

> On 09/16/13 14:43, Lars-Peter Clausen wrote:
> > On 09/16/2013 03:31 PM, Lee Jones wrote:
> >>> Honestly I don't care either way on these, but consistency would definitely
> >>> be good so applied to the togreg branch of iio.git
> >>
> >> For clarification, is togreg due for the v3.12 merge window or will be
> >> get a settling period in -next?
> >>
> > 
> > Well everything up to the 'iio-for-3.12c' tag will be in v3.12, everything
> > else not.
> > 
> > - Lars
> > 
> Yes.  At the moment IIO is routed through Greg KHs staging tree.  His merge
> window closes 1 week before Linus opens the main one (when Greg can figure
> out what Linus is intending!)  Hence I close the IIO one whenever I manage
> to get a last pull request in before that.
> 
> Hence all 3.13 for the current togreg branch.

Perfect, thanks both of you.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
@ 2013-09-17  8:05             ` Lee Jones
  0 siblings, 0 replies; 246+ messages in thread
From: Lee Jones @ 2013-09-17  8:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 16 Sep 2013, Jonathan Cameron wrote:

> On 09/16/13 14:43, Lars-Peter Clausen wrote:
> > On 09/16/2013 03:31 PM, Lee Jones wrote:
> >>> Honestly I don't care either way on these, but consistency would definitely
> >>> be good so applied to the togreg branch of iio.git
> >>
> >> For clarification, is togreg due for the v3.12 merge window or will be
> >> get a settling period in -next?
> >>
> > 
> > Well everything up to the 'iio-for-3.12c' tag will be in v3.12, everything
> > else not.
> > 
> > - Lars
> > 
> Yes.  At the moment IIO is routed through Greg KHs staging tree.  His merge
> window closes 1 week before Linus opens the main one (when Greg can figure
> out what Linus is intending!)  Hence I close the IIO one whenever I manage
> to get a last pull request in before that.
> 
> Hence all 3.13 for the current togreg branch.

Perfect, thanks both of you.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

end of thread, other threads:[~2013-09-17  8:05 UTC | newest]

Thread overview: 246+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-10 12:49 [PATCH v3 00/38] iio: ST clean-ups and new sensor support Lee Jones
2013-09-10 12:49 ` Lee Jones
2013-09-10 12:49 ` [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 15:23   ` Olof Johansson
2013-09-10 15:23     ` Olof Johansson
2013-09-10 15:23     ` Olof Johansson
2013-09-10 15:30     ` Lee Jones
2013-09-10 15:30       ` Lee Jones
2013-09-10 15:30       ` Lee Jones
2013-09-10 16:57       ` Olof Johansson
2013-09-10 16:57         ` Olof Johansson
2013-09-11  8:06         ` Linus Walleij
2013-09-11  8:06           ` Linus Walleij
2013-09-11  8:19           ` Lee Jones
2013-09-11  8:19             ` Lee Jones
2013-09-11  9:33             ` Linus Walleij
2013-09-11  9:33               ` Linus Walleij
     [not found]               ` <CAF2Aj3iPdqM-+FQ7R9MZ-6jV1Q1me9TG1P4cEGA7fSBBYH92zA@mail.gmail.com>
2013-09-11 11:13                 ` Linus Walleij
2013-09-11 11:13                   ` Linus Walleij
2013-09-11 20:36                   ` Olof Johansson
2013-09-11 20:36                     ` Olof Johansson
2013-09-12 12:23                     ` Linus Walleij
2013-09-12 12:23                       ` Linus Walleij
2013-09-12 12:32                       ` Russell King - ARM Linux
2013-09-12 12:32                         ` Russell King - ARM Linux
2013-09-11  8:17         ` Lee Jones
2013-09-11  8:17           ` Lee Jones
2013-09-10 12:49 ` [PATCH 02/38] ARM: ux500: Enable the LPS001WP Pressure & Temperature sensor from DT Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 12:49 ` [PATCH 03/38] ARM: ux500: Enable the LSM303DLH Accelerator " Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 12:49 ` [PATCH 04/38] ARM: ux500: Enable the LSM303DLH Magnetometer " Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 12:49 ` [PATCH 05/38] ARM: ux500: Enable the L3G4200D Gyroscope " Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 12:49 ` [PATCH 06/38] ARM: ux500: CONFIG: Enable ST's IIO Pressure Sensors by default Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 12:49 ` [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer " Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 15:20   ` Olof Johansson
2013-09-10 15:20     ` Olof Johansson
2013-09-10 15:20     ` Olof Johansson
2013-09-10 15:35     ` Lee Jones
2013-09-10 15:35       ` Lee Jones
2013-09-10 15:35       ` Lee Jones
2013-09-10 16:51       ` Olof Johansson
2013-09-10 16:51         ` Olof Johansson
2013-09-10 16:51         ` Olof Johansson
2013-09-11  7:20         ` Lee Jones
2013-09-11  7:20           ` Lee Jones
2013-09-11  7:20           ` Lee Jones
2013-09-10 12:49 ` [PATCH 08/38] ARM: ux500: CONFIG: Enable ST's IIO Magnetometer " Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 12:49 ` [PATCH 09/38] ARM: ux500: CONFIG: Enable ST's IIO Gyroscope " Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 12:49 ` [PATCH 10/38] Documentation: dt: iio: Add binding for LPS001WP Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 12:08   ` Jonathan Cameron
2013-09-14 12:08     ` Jonathan Cameron
2013-09-14 12:08     ` Jonathan Cameron
2013-09-10 12:49 ` [PATCH 11/38] Documentation: dt: iio: Add binding for LSM303DLH Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 12:09   ` Jonathan Cameron
2013-09-14 12:09     ` Jonathan Cameron
2013-09-14 12:09     ` Jonathan Cameron
2013-09-10 12:49 ` [PATCH 12/38] Documentation: dt: iio: Add binding for L3G4200D Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 12:09   ` Jonathan Cameron
2013-09-14 12:09     ` Jonathan Cameron
2013-09-14 12:09     ` Jonathan Cameron
2013-09-10 12:49 ` [PATCH 13/38] Documentation: dt: iio: Add binding for LSM303DLH Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 12:09   ` Jonathan Cameron
2013-09-14 12:09     ` Jonathan Cameron
2013-09-14 12:09     ` Jonathan Cameron
2013-09-10 12:49 ` [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 12:14   ` Jonathan Cameron
2013-09-14 12:14     ` Jonathan Cameron
2013-09-14 12:27     ` Jonathan Cameron
2013-09-14 12:27       ` Jonathan Cameron
2013-09-16  8:33       ` Lars-Peter Clausen
2013-09-16  8:33         ` Lars-Peter Clausen
2013-09-16  9:21         ` Denis CIOCCA
2013-09-16  9:21           ` Denis CIOCCA
2013-09-16  9:21           ` Denis CIOCCA
2013-09-16 12:03           ` Lars-Peter Clausen
2013-09-16 12:03             ` Lars-Peter Clausen
2013-09-16 12:03             ` Lars-Peter Clausen
2013-09-16 19:15             ` Jonathan Cameron
2013-09-16 19:15               ` Jonathan Cameron
2013-09-16 19:15               ` Jonathan Cameron
2013-09-16 13:31     ` Lee Jones
2013-09-16 13:31       ` Lee Jones
2013-09-16 13:43       ` Lars-Peter Clausen
2013-09-16 13:43         ` Lars-Peter Clausen
2013-09-16 19:17         ` Jonathan Cameron
2013-09-16 19:17           ` Jonathan Cameron
2013-09-17  8:05           ` Lee Jones
2013-09-17  8:05             ` Lee Jones
2013-09-10 12:49 ` [PATCH 15/38] iio: gyro: st: Append _gyro to gyroscope " Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 12:49 ` [PATCH 16/38] iio: magn: st: Append _magn to magnetometer " Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 12:49 ` [PATCH 17/38] iio: press: st: Append _press to pressure " Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 12:49 ` [PATCH 18/38] iio: sensors-core: st: Allow full-scale to be an optional feature Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 16:45   ` Jonathan Cameron
2013-09-14 16:45     ` Jonathan Cameron
2013-09-14 17:07     ` Jonathan Cameron
2013-09-14 17:07       ` Jonathan Cameron
2013-09-10 12:49 ` [PATCH 19/38] iio: sensors-core: st: Support sensors which don't have a Data Ready pin Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 16:53   ` Jonathan Cameron
2013-09-14 16:53     ` Jonathan Cameron
2013-09-10 12:49 ` [PATCH 20/38] iio: sensors-core: st: Clean-up error handling in st_sensors_init_sensor() Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 16:54   ` Jonathan Cameron
2013-09-14 16:54     ` Jonathan Cameron
2013-09-10 12:49 ` [PATCH 21/38] iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data() Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 16:58   ` Jonathan Cameron
2013-09-14 16:58     ` Jonathan Cameron
2013-09-16  8:22     ` Lee Jones
2013-09-16  8:22       ` Lee Jones
2013-09-10 12:49 ` [PATCH 22/38] iio: sensors-core: st: Clean-up error handling in st_sensors_read_info_raw() Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 17:01   ` Jonathan Cameron
2013-09-14 17:01     ` Jonathan Cameron
2013-09-10 12:49 ` [PATCH 23/38] iio: pressure-core: st: Describe LPS331AP defines by name Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 17:09   ` Jonathan Cameron
2013-09-14 17:09     ` Jonathan Cameron
2013-09-10 12:49 ` [PATCH 24/38] iio: pressure-core: st: Expand and rename LPS331AP's channel descriptor Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 17:14   ` Jonathan Cameron
2013-09-14 17:14     ` Jonathan Cameron
2013-09-10 12:49 ` [PATCH 25/38] iio: pressure-core: st: Allow for number of channels to vary Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 17:18   ` Jonathan Cameron
2013-09-14 17:18     ` Jonathan Cameron
2013-09-16  8:17     ` Lee Jones
2013-09-16  8:17       ` Lee Jones
2013-09-16 15:32       ` Jonathan Cameron
2013-09-16 15:32         ` Jonathan Cameron
2013-09-10 12:49 ` [PATCH 26/38] iio: pressure-core: st: Clean-up probe() function Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 16:23   ` Jonathan Cameron
2013-09-10 16:23     ` Jonathan Cameron
2013-09-10 16:23     ` Jonathan Cameron
2013-09-11  7:19     ` Lee Jones
2013-09-11  7:19       ` Lee Jones
2013-09-14 17:21       ` Jonathan Cameron
2013-09-14 17:21         ` Jonathan Cameron
2013-09-10 12:49 ` [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 16:25   ` Jonathan Cameron
2013-09-10 16:25     ` Jonathan Cameron
2013-09-10 16:25     ` Jonathan Cameron
2013-09-11  7:10     ` Lee Jones
2013-09-11  7:10       ` Lee Jones
2013-09-11  7:18       ` Lars-Peter Clausen
2013-09-11  7:18         ` Lars-Peter Clausen
2013-09-11  7:29         ` Lee Jones
2013-09-11  7:29           ` Lee Jones
2013-09-11 15:35           ` Mark Brown
2013-09-11 15:35             ` Mark Brown
2013-09-13 20:57           ` Getz, Robin
2013-09-13 20:57             ` Getz, Robin
2013-09-13 20:57             ` Getz, Robin
2013-09-16  9:47             ` Lee Jones
2013-09-16  9:47               ` Lee Jones
2013-09-16  9:47               ` Lee Jones
2013-09-11 18:30         ` Jonathan Cameron
2013-09-11 18:30           ` Jonathan Cameron
2013-09-10 12:49 ` [PATCH 28/38] iio: pressure: st: Add support for new LPS001WP pressure sensor Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 17:26   ` Jonathan Cameron
2013-09-14 17:26     ` Jonathan Cameron
2013-09-10 12:49 ` [PATCH 29/38] iio: pressure-core: st: Provide support for the Vdd power supply Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 17:28   ` Jonathan Cameron
2013-09-14 17:28     ` Jonathan Cameron
2013-09-10 12:49 ` [PATCH 30/38] iio: pressure-core: st: Provide support for the Vdd_IO " Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 12:49 ` [PATCH 31/38] iio: accel-core: st: Clean up error handling in probe() Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 17:31   ` Jonathan Cameron
2013-09-14 17:31     ` Jonathan Cameron
2013-09-10 12:49 ` [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 17:51   ` Jonathan Cameron
2013-09-14 17:51     ` Jonathan Cameron
2013-09-16  8:05     ` Lee Jones
2013-09-16  8:05       ` Lee Jones
2013-09-16  9:19       ` Denis CIOCCA
2013-09-16  9:19         ` Denis CIOCCA
2013-09-16  9:19         ` Denis CIOCCA
2013-09-16  9:38         ` Lee Jones
2013-09-16  9:38           ` Lee Jones
2013-09-16  9:38           ` Lee Jones
2013-09-16  9:57           ` Denis CIOCCA
2013-09-16  9:57             ` Denis CIOCCA
2013-09-16  9:57             ` Denis CIOCCA
2013-09-16 10:19             ` Lee Jones
2013-09-16 10:19               ` Lee Jones
2013-09-16 10:19               ` Lee Jones
2013-09-16 10:23               ` Denis CIOCCA
2013-09-16 10:23                 ` Denis CIOCCA
2013-09-16 10:23                 ` Denis CIOCCA
2013-09-16 11:08                 ` Lee Jones
2013-09-16 11:08                   ` Lee Jones
2013-09-16 11:08                   ` Lee Jones
2013-09-10 12:49 ` [PATCH 33/38] iio: accel-core: st: Give some indication if device probing was successful Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 12:49 ` [PATCH 34/38] iio: gyro-core: st: Clean up error handling in probe() Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 12:49 ` [PATCH 35/38] iio: gyro-core: st: Give some indication if device probing was successful Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 12:49 ` [PATCH 36/38] iio: magn-core: st: Clean up error handling in probe() Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 12:49 ` [PATCH 37/38] iio: magn-core: st: Give some indication if device probing was successful Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-10 12:49 ` [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH Lee Jones
2013-09-10 12:49   ` Lee Jones
2013-09-14 17:53   ` Jonathan Cameron
2013-09-14 17:53     ` Jonathan Cameron
2013-09-16  7:31     ` Lee Jones
2013-09-16  7:31       ` Lee Jones
2013-09-16  9:32       ` Denis CIOCCA
2013-09-16  9:32         ` Denis CIOCCA
2013-09-16  9:32         ` Denis CIOCCA
2013-09-16 10:08         ` Lee Jones
2013-09-16 10:08           ` Lee Jones
2013-09-16 10:08           ` Lee Jones
2013-09-16 10:18           ` Denis CIOCCA
2013-09-16 10:18             ` Denis CIOCCA
2013-09-16 10:18             ` Denis CIOCCA
2013-09-16 11:11             ` Lee Jones
2013-09-16 11:11               ` Lee Jones
2013-09-16 11:11               ` Lee Jones
2013-09-16 11:26             ` Lee Jones
2013-09-16 11:26               ` Lee Jones
2013-09-16 11:26               ` Lee Jones

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.