Skip to contentSkip to conversation

ARM: dts: n900: switch accelerometer to iio driver

PATCH Superseded Sicelo A. Mhlongo 2 participants 11 messages Dec 27, 2022 – Dec 29, 2022 Device tree bindings

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

[PATCH] ARM: dts: n900: switch accelerometer to iio driver

The lis302dl accelerometer is now supported by an iio driver, so the N900 can work with modern iio-based userspace. This patch provides the required dts changes for the switch

#1 lore raw

PATCH 1/1 ARM: dts: n900: switch accelerometer to iio driver

Since 8a7449d68670a8f9033d57b9e7997af77a900d53, lis302dl is supported by an iio driver. Make the switch, to accommodate modern userspace, even though the iio interface lacks some of the extended features of the older driver

---
 arch/arm/boot/dts/omap3-n900.dts | 53 +++++---------------------------
 1 file changed, 8 insertions(+), 45 deletions(-)
arch/arm/boot/dts/omap3-n900.dts +8 -45
index 6ba2e8f81973..94fa1d492fb4 100644
@@ -767,56 +767,19 @@ &i2c3 {
 
 	clock-frequency = <400000>;
 
-	lis302dl: lis3lv02d@1d {
-		compatible = "st,lis3lv02d";
+	lis302dl: lis302dl@1d {
+		compatible = "st,lis302dl";
 		reg = <0x1d>;
 
-		Vdd-supply = <&vaux1>;
-		Vdd_IO-supply = <&vio>;
+		vdd-supply = <&vaux1>;
+		vddio-supply = <&vio>;
 
 		interrupt-parent = <&gpio6>;
-		interrupts = <21 20>; /* 181 and 180 */
-
-		/* click flags */
-		st,click-single-x;
-		st,click-single-y;
-		st,click-single-z;
-
-		/* Limits are 0.5g * value */
-		st,click-threshold-x = <8>;
-		st,click-threshold-y = <8>;
-		st,click-threshold-z = <10>;
-
-		/* Click must be longer than time limit */
-		st,click-time-limit = <9>;
-
-		/* Kind of debounce filter */
-		st,click-latency = <50>;
-
-		/* Interrupt line 2 for click detection */
-		st,irq2-click;
-
-		st,wakeup-x-hi;
-		st,wakeup-y-hi;
-		st,wakeup-threshold = <(800/18)>; /* millig-value / 18 to get HW values */
-
-		st,wakeup2-z-hi;
-		st,wakeup2-threshold = <(900/18)>; /* millig-value / 18 to get HW values */
-
-		st,hipass1-disable;
-		st,hipass2-disable;
-
-		st,axis-x = <1>;    /* LIS3_DEV_X */
-		st,axis-y = <(-2)>; /* LIS3_INV_DEV_Y */
-		st,axis-z = <(-3)>; /* LIS3_INV_DEV_Z */
-
-		st,min-limit-x = <(-32)>;
-		st,min-limit-y = <3>;
-		st,min-limit-z = <3>;
+		interrupts = <21 IRQ_TYPE_EDGE_RISING>, <20 IRQ_TYPE_EDGE_RISING>; /* 181 and 180 */
 
-		st,max-limit-x = <(-3)>;
-		st,max-limit-y = <32>;
-		st,max-limit-z = <32>;
+		mount-matrix =	 "-1",  "0",  "0",
+				  "0",  "1",  "0",
+				  "0",  "0",  "1";
 	};
 
 	cam1: camera@3e {
Signature · 1 line
2.39.0
#2 lore raw
Quoted 1 line · Sicelo A. Mhlongo

Since 8a7449d68670a8f9033d57b9e7997af77a900d53, lis302dl is supported by an iio

Use commit SHA ("title") format, as suggested by checkpatch.

Quoted 13 lines

driver. Make the switch, to accommodate modern userspace, even though the iio interface lacks some of the extended features of the older driver

---
 arch/arm/boot/dts/omap3-n900.dts | 53 +++++---------------------------
 1 file changed, 8 insertions(+), 45 deletions(-)
arch/arm/boot/dts/omap3-n900.dts +0 -0
index 6ba2e8f81973..94fa1d492fb4 100644

arch/arm/boot/dts/omap3-n900.dts &i2c3 { · line 770

Quoted 6 lines
arch/arm/boot/dts/omap3-n900.dts +1 -2
@@ -767,56 +767,19 @@ &i2c3 {
 
 	clock-frequency = <400000>;
 
-	lis302dl: lis3lv02d@1d {
-		compatible = "st,lis3lv02d";
+	lis302dl: lis302dl@1d {

That's not really explained in commit msg and does not look related to your goal. If changing - in separate patch - make the node name generic.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

arch/arm/boot/dts/omap3-n900.dts &i2c3 { · line 775

Quoted 7 lines
arch/arm/boot/dts/omap3-n900.dts +3 -2
+		compatible = "st,lis302dl";
 		reg = <0x1d>;
 
-		Vdd-supply = <&vaux1>;
-		Vdd_IO-supply = <&vio>;
+		vdd-supply = <&vaux1>;
+		vddio-supply = <&vio>;

Does not look related/explained in commit msg.

Quoted 31 lines
arch/arm/boot/dts/omap3-n900.dts +0 -29
 		interrupt-parent = <&gpio6>;
-		interrupts = <21 20>; /* 181 and 180 */
-
-		/* click flags */
-		st,click-single-x;
-		st,click-single-y;
-		st,click-single-z;
-
-		/* Limits are 0.5g * value */
-		st,click-threshold-x = <8>;
-		st,click-threshold-y = <8>;
-		st,click-threshold-z = <10>;
-
-		/* Click must be longer than time limit */
-		st,click-time-limit = <9>;
-
-		/* Kind of debounce filter */
-		st,click-latency = <50>;
-
-		/* Interrupt line 2 for click detection */
-		st,irq2-click;
-
-		st,wakeup-x-hi;
-		st,wakeup-y-hi;
-		st,wakeup-threshold = <(800/18)>; /* millig-value / 18 to get HW values */
-
-		st,wakeup2-z-hi;
-		st,wakeup2-threshold = <(900/18)>; /* millig-value / 18 to get HW values */
-
-		st,hipass1-disable;

arch/arm/boot/dts/omap3-n900.dts &i2c3 { · line 778

Quoted 10 lines
arch/arm/boot/dts/omap3-n900.dts +1 -9
-		st,hipass2-disable;
-
-		st,axis-x = <1>;    /* LIS3_DEV_X */
-		st,axis-y = <(-2)>; /* LIS3_INV_DEV_Y */
-		st,axis-z = <(-3)>; /* LIS3_INV_DEV_Z */
-
-		st,min-limit-x = <(-32)>;
-		st,min-limit-y = <3>;
-		st,min-limit-z = <3>;
+		interrupts = <21 IRQ_TYPE_EDGE_RISING>, <20 IRQ_TYPE_EDGE_RISING>; /* 181 and 180 */

Does not fit in 80-wrap length.

arch/arm/boot/dts/omap3-n900.dts &i2c3 { · line 785

Quoted 10 lines
arch/arm/boot/dts/omap3-n900.dts +3 -3
-		st,max-limit-x = <(-3)>;
-		st,max-limit-y = <32>;
-		st,max-limit-z = <32>;
+		mount-matrix =	 "-1",  "0",  "0",
+				  "0",  "1",  "0",
+				  "0",  "0",  "1";
 	};
 
 	cam1: camera@3e {

Best regards,
Krzysztof

author
#3 lore raw

Thank you for the review.

Quoted 5 lines

arch/arm/boot/dts/omap3-n900.dts &i2c3 { · line 770

Quoted 1 line
arch/arm/boot/dts/omap3-n900.dts +1 -0
+	lis302dl: lis302dl@1d {

That's not really explained in commit msg and does not look related to your goal. If changing - in separate patch - make the node name generic.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

Now I understand that it should just be accelerometer@1d. To be clear, are you saying this change should have a separate patch, i.e. not part of the switch to iio driver?

Quoted 6 lines

arch/arm/boot/dts/omap3-n900.dts &i2c3 { · line 775

Quoted 4 lines
arch/arm/boot/dts/omap3-n900.dts +2 -2
-		Vdd-supply = <&vaux1>;
-		Vdd_IO-supply = <&vio>;
+		vdd-supply = <&vaux1>;
+		vddio-supply = <&vio>;

Does not look related/explained in commit msg.

This is from Documentation/devicetree/bindings/iio/st,st-sensors.yaml, i.e. lowercase. I will look for a way to explain it in v2.

Sincerely
Sicelo

#4 lore raw
Quoted 11 lines · Sicelo

Thank you for the review.

Quoted 5 lines

arch/arm/boot/dts/omap3-n900.dts &i2c3 { · line 770

Quoted 1 line
arch/arm/boot/dts/omap3-n900.dts +1 -0
+	lis302dl: lis302dl@1d {

That's not really explained in commit msg and does not look related to your goal. If changing - in separate patch - make the node name generic.
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

Now I understand that it should just be accelerometer@1d. To be clear, are you saying this change should have a separate patch, i.e. not part of the switch to iio driver?

Yes, such cleanup is not related to changing compatible.

Quoted 10 lines
Quoted 7 lines

arch/arm/boot/dts/omap3-n900.dts &i2c3 { · line 775

Quoted 5 lines
arch/arm/boot/dts/omap3-n900.dts +2 -2
-		Vdd-supply = <&vaux1>;
-		Vdd_IO-supply = <&vio>;
+		vdd-supply = <&vaux1>;
+		vddio-supply = <&vio>;

Does not look related/explained in commit msg.

This is from Documentation/devicetree/bindings/iio/st,st-sensors.yaml, i.e. lowercase. I will look for a way to explain it in v2.

Ah, ok, then maybe mention in commit msg that you are changing properties to match bindings of new compatible.

Best regards,
Krzysztof

#5 lore raw
In reply to Sicelo A. Mhlongo
Quoted 1 line · Sicelo A. Mhlongo

[PATCH] ARM: dts: n900: switch accelerometer to iio driver

That's not correct placement of title. This should be in the subject.

Quoted 4 lines

The lis302dl accelerometer is now supported by an iio driver, so the N900 can work with modern iio-based userspace. This patch provides the required dts changes for the switch

You miss the actual patch here...

Best regards,
Krzysztof

#6 lore raw

v2 cover ARM: dts: n900: use iio driver for accelerometer

In reply to Sicelo A. Mhlongo

The accelerometer in the N900 is now supported by the iio framework. This patch series makes the switch to the new compatible.

The iio framework does not support some of the extended properties in the previous driver, but the change is useful for modern userspace, which expects accelerometers to be exposed via iio

Sicelo A. Mhlongo (2):
ARM: dts: n900: rename accelerometer node
ARM: dts: n900: use iio driver for accelerometer

 arch/arm/boot/dts/omap3-n900.dts | 54 ++++++--------------------------
 1 file changed, 9 insertions(+), 45 deletions(-)
Signature · 1 line
2.39.0
#7 lore raw

PATCH v2 1/2 ARM: dts: n900: rename accelerometer node

In reply to Sicelo A. Mhlongo

Use generic node naming for lis302dl accelerometer, and drop its label that is not used anywhere else

---
 arch/arm/boot/dts/omap3-n900.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/omap3-n900.dts +1 -1
index 6ba2e8f81973..20d7a7bb6b04 100644
@@ -767,7 +767,7 @@ &i2c3 {
 
 	clock-frequency = <400000>;
 
-	lis302dl: lis3lv02d@1d {
+	accelerometer@1d {
 		compatible = "st,lis3lv02d";
 		reg = <0x1d>;
 
Signature · 1 line
2.39.0
Acked-by on v2 1/2
#8 lore raw

Re: [PATCH v2 1/2] ARM: dts: n900: rename accelerometer node

Quoted 2 lines · Sicelo A. Mhlongo

Use generic node naming for lis302dl accelerometer, and drop its label that is not used anywhere else

Full stop.

Do not attach (thread) your patchsets to some other threads (unrelated or older versions). This buries them deep in the mailbox and might interfere with applying entire sets.

Quoted 2 lines

Best regards,
Krzysztof

#9 lore raw

PATCH v2 2/2 ARM: dts: n900: use iio driver for accelerometer

In reply to Sicelo A. Mhlongo

The accelerometer in the N900 is supported by the iio-framework since commit 8a7449d68670a8f9 ("iio: accel: add support for LIS302DL variant). This commit switches to it and updates node properties to match the bindings of the new compatible

---
 arch/arm/boot/dts/omap3-n900.dts | 52 +++++---------------------------
 1 file changed, 8 insertions(+), 44 deletions(-)
arch/arm/boot/dts/omap3-n900.dts +8 -44
index 20d7a7bb6b04..adee3da93421 100644
@@ -768,55 +768,19 @@ &i2c3 {
 	clock-frequency = <400000>;
 
 	accelerometer@1d {
-		compatible = "st,lis3lv02d";
+		compatible = "st,lis302dl";
 		reg = <0x1d>;
 
-		Vdd-supply = <&vaux1>;
-		Vdd_IO-supply = <&vio>;
+		vdd-supply = <&vaux1>;
+		vddio-supply = <&vio>;
 
 		interrupt-parent = <&gpio6>;
-		interrupts = <21 20>; /* 181 and 180 */
-
-		/* click flags */
-		st,click-single-x;
-		st,click-single-y;
-		st,click-single-z;
-
-		/* Limits are 0.5g * value */
-		st,click-threshold-x = <8>;
-		st,click-threshold-y = <8>;
-		st,click-threshold-z = <10>;
-
-		/* Click must be longer than time limit */
-		st,click-time-limit = <9>;
-
-		/* Kind of debounce filter */
-		st,click-latency = <50>;
-
-		/* Interrupt line 2 for click detection */
-		st,irq2-click;
-
-		st,wakeup-x-hi;
-		st,wakeup-y-hi;
-		st,wakeup-threshold = <(800/18)>; /* millig-value / 18 to get HW values */
-
-		st,wakeup2-z-hi;
-		st,wakeup2-threshold = <(900/18)>; /* millig-value / 18 to get HW values */
-
-		st,hipass1-disable;
-		st,hipass2-disable;
-
-		st,axis-x = <1>;    /* LIS3_DEV_X */
-		st,axis-y = <(-2)>; /* LIS3_INV_DEV_Y */
-		st,axis-z = <(-3)>; /* LIS3_INV_DEV_Z */
-
-		st,min-limit-x = <(-32)>;
-		st,min-limit-y = <3>;
-		st,min-limit-z = <3>;
+		interrupts = <21 IRQ_TYPE_EDGE_RISING>,
+			     <20 IRQ_TYPE_EDGE_RISING>; /* 181 and 180 */
 
-		st,max-limit-x = <(-3)>;
-		st,max-limit-y = <32>;
-		st,max-limit-z = <32>;
+		mount-matrix =	 "-1",  "0",  "0",
+				  "0",  "1",  "0",
+				  "0",  "0",  "1";
 	};
 
 	cam1: camera@3e {
Signature · 1 line
2.39.0
Acked-by on v2 2/2
#10 lore raw

Re: [PATCH v2 2/2] ARM: dts: n900: use iio driver for accelerometer

Quoted 10 lines · Sicelo A. Mhlongo

The accelerometer in the N900 is supported by the iio-framework since commit 8a7449d68670a8f9 ("iio: accel: add support for LIS302DL variant). This commit switches to it and updates node properties to match the bindings of the new compatible

---
 arch/arm/boot/dts/omap3-n900.dts | 52 +++++---------------------------
 1 file changed, 8 insertions(+), 44 deletions(-)

Best regards,
Krzysztof