Skip to contentSkip to conversation

dt-bindings: mfd: Improve readability for TPS65217 interrupt sources

PATCH In review Milo Kim 3 participants 7 messages Nov 21, 2016 – Nov 23, 2016

Subsystems (2)
lore
Share & tools
lore

Milo Kim

author
#0 lore raw

PATCH 1/1 dt-bindings: mfd: Improve readability for TPS65217 interrupt sources

AC and USB interrupts are related with external power input. PB interrupt means push button pressed or released event. Use better human readable definitions.

---
 arch/arm/boot/dts/am335x-bone-common.dtsi | 4 ++--
 include/dt-bindings/mfd/tps65217.h        | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/boot/dts/am335x-bone-common.dtsi +2 -2
index dc561d5..1848d58 100644
@@ -319,13 +319,13 @@
 	ti,pmic-shutdown-controller;
 
 	charger {
-		interrupts = <TPS65217_IRQ_AC>, <TPS65217_IRQ_USB>;
+		interrupts = <TPS65217_IRQ_AC_POWER>, <TPS65217_IRQ_USB_POWER>;
 		interrupts-names = "AC", "USB";
 		status = "okay";
 	};
 
 	pwrbutton {
-		interrupts = <TPS65217_IRQ_PB>;
+		interrupts = <TPS65217_IRQ_PUSHBUTTON>;
 		status = "okay";
 	};
 
include/dt-bindings/mfd/tps65217.h +3 -3
index cafb9e6..0293fdd 100644
@@ -19,8 +19,8 @@
 #ifndef __DT_BINDINGS_TPS65217_H__
 #define __DT_BINDINGS_TPS65217_H__
 
-#define TPS65217_IRQ_USB	0
-#define TPS65217_IRQ_AC		1
-#define TPS65217_IRQ_PB		2
+#define TPS65217_IRQ_USB_POWER		0	/* USB power state change */
+#define TPS65217_IRQ_AC_POWER		1	/* AC power state change */
+#define TPS65217_IRQ_PUSHBUTTON		2	/* Push button state change */
 
 #endif
Signature · 1 line
2.9.3
#1 lore raw
Quoted 17 lines · Milo Kim

AC and USB interrupts are related with external power input. PB interrupt means push button pressed or released event. Use better human readable definitions.

---
 arch/arm/boot/dts/am335x-bone-common.dtsi | 4 ++--
 include/dt-bindings/mfd/tps65217.h        | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/boot/dts/am335x-bone-common.dtsi +0 -0
index dc561d5..1848d58 100644
@@ -319,13 +319,13 @@
 	ti,pmic-shutdown-controller;
 

arch/arm/boot/dts/am335x-bone-common.dtsi line 328

Quoted 10 lines
arch/arm/boot/dts/am335x-bone-common.dtsi +2 -2
 	charger {
-		interrupts = <TPS65217_IRQ_AC>, <TPS65217_IRQ_USB>;
+		interrupts = <TPS65217_IRQ_AC_POWER>, <TPS65217_IRQ_USB_POWER>;
 		interrupts-names = "AC", "USB";
 		status = "okay";
 	};
 
 	pwrbutton {
-		interrupts = <TPS65217_IRQ_PB>;
+		interrupts = <TPS65217_IRQ_PUSHBUTTON>;

Push button or power button?

Quoted 8 lines
arch/arm/boot/dts/am335x-bone-common.dtsi +0 -0
 		status = "okay";
 	};
 
include/dt-bindings/mfd/tps65217.h +0 -0
index cafb9e6..0293fdd 100644

include/dt-bindings/mfd/tps65217.h line 24

Quoted 9 lines
include/dt-bindings/mfd/tps65217.h +3 -3
@@ -19,8 +19,8 @@
 #ifndef __DT_BINDINGS_TPS65217_H__
 #define __DT_BINDINGS_TPS65217_H__
 
-#define TPS65217_IRQ_USB	0
-#define TPS65217_IRQ_AC		1
-#define TPS65217_IRQ_PB		2
+#define TPS65217_IRQ_USB_POWER		0	/* USB power state change */
+#define TPS65217_IRQ_AC_POWER		1	/* AC power state change */
+#define TPS65217_IRQ_PUSHBUTTON		2	/* Push button state change */

This changes the ABI.

It will require a DT Ack.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#2 lore raw
Quoted 52 lines · Lee Jones
Quoted 17 lines · Milo Kim

AC and USB interrupts are related with external power input. PB interrupt means push button pressed or released event. Use better human readable definitions.

---
 arch/arm/boot/dts/am335x-bone-common.dtsi | 4 ++--
 include/dt-bindings/mfd/tps65217.h        | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/boot/dts/am335x-bone-common.dtsi +0 -0
index dc561d5..1848d58 100644
@@ -319,13 +319,13 @@
 	ti,pmic-shutdown-controller;
 

arch/arm/boot/dts/am335x-bone-common.dtsi line 328

Quoted 10 lines
arch/arm/boot/dts/am335x-bone-common.dtsi +2 -2
 	charger {
-		interrupts = <TPS65217_IRQ_AC>, <TPS65217_IRQ_USB>;
+		interrupts = <TPS65217_IRQ_AC_POWER>, <TPS65217_IRQ_USB_POWER>;
 		interrupts-names = "AC", "USB";
 		status = "okay";
 	};
 
 	pwrbutton {
-		interrupts = <TPS65217_IRQ_PB>;
+		interrupts = <TPS65217_IRQ_PUSHBUTTON>;

Push button or power button?

Quoted 8 lines
arch/arm/boot/dts/am335x-bone-common.dtsi +0 -0
 		status = "okay";
 	};
 
include/dt-bindings/mfd/tps65217.h +0 -0
index cafb9e6..0293fdd 100644

include/dt-bindings/mfd/tps65217.h line 24

Quoted 9 lines
include/dt-bindings/mfd/tps65217.h +3 -3
@@ -19,8 +19,8 @@
 #ifndef __DT_BINDINGS_TPS65217_H__
 #define __DT_BINDINGS_TPS65217_H__
 
-#define TPS65217_IRQ_USB	0
-#define TPS65217_IRQ_AC		1
-#define TPS65217_IRQ_PB		2
+#define TPS65217_IRQ_USB_POWER		0	/* USB power state change */
+#define TPS65217_IRQ_AC_POWER		1	/* AC power state change */
+#define TPS65217_IRQ_PUSHBUTTON		2	/* Push button state change */

This changes the ABI.

Quoted 1 line

It will require a DT Ack.

Tell a lie. Sorry, I was getting false positives from my grep. It looks like you use the same scheme from within include/linux. I suggest that you probable don't want to do that.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#3 lore raw
Quoted 17 lines · CET Lee Jones
Quoted 17 lines
Quoted 5 lines
include/dt-bindings/mfd/tps65217.h +0 -0
index cafb9e6..0293fdd 100644

include/dt-bindings/mfd/tps65217.h line 24

Quoted 9 lines
include/dt-bindings/mfd/tps65217.h +3 -3
@@ -19,8 +19,8 @@
 #ifndef __DT_BINDINGS_TPS65217_H__
 #define __DT_BINDINGS_TPS65217_H__
 
-#define TPS65217_IRQ_USB   0
-#define TPS65217_IRQ_AC            1
-#define TPS65217_IRQ_PB            2
+#define TPS65217_IRQ_USB_POWER             0       /* USB power state change */
+#define TPS65217_IRQ_AC_POWER              1       /* AC power state change */
+#define TPS65217_IRQ_PUSHBUTTON            2       /* Push button state change */

This changes the ABI.

Quoted 5 lines
Quoted 1 line

It will require a DT Ack.

Tell a lie. Sorry, I was getting false positives from my grep. It looks like you use the same scheme from within include/linux. I suggest that you probable don't want to do that.

Doing this change however would cause a bisection problem: you can't rename just the constants in the header or just the driver using those constants.

Arnd

author
#4 lore raw
In reply to Lee Jones
Quoted 5 lines · Lee Jones
Quoted 3 lines

pwrbutton {

arch/arm/boot/dts/am335x-bone-common.dtsi line 328

Quoted 2 lines
arch/arm/boot/dts/am335x-bone-common.dtsi +1 -1
-		interrupts = <TPS65217_IRQ_PB>;
+		interrupts = <TPS65217_IRQ_PUSHBUTTON>;

Push button or power button?

According to the datasheet, push button interrupt is correct.

	http://www.ti.com/lit/ds/symlink/tps65217.pdf

This is used for a power button input in Beaglebone boards. In other words, the power button is one of push button usages.

So, I'd like to keep general name for the interrupt.

Best regards,
Milo

#5 lore raw
Quoted 7 lines · CET Milo Kim
Quoted 5 lines · Lee Jones
Quoted 3 lines
     pwrbutton {
Quoted 2 lines
arch/arm/boot/dts/am335x-bone-common.dtsi +1 -1
-          interrupts = <TPS65217_IRQ_PB>;
+          interrupts = <TPS65217_IRQ_PUSHBUTTON>;

Push button or power button?

Quoted 8 lines

According to the datasheet, push button interrupt is correct.

        http://www.ti.com/lit/ds/symlink/tps65217.pdf

This is used for a power button input in Beaglebone boards. In other words, the power button is one of push button usages.

So, I'd like to keep general name for the interrupt.

Ah, the numbers come from the data sheet. Please just remove the header then, there is no need to keep them as an ABI, in particular when the driver doesn't even include that header today.

I see you even have names for them in the node:

        charger {
-               interrupts = <TPS65217_IRQ_AC>, <TPS65217_IRQ_USB>;
+               interrupts = <TPS65217_IRQ_AC_POWER>, <TPS65217_IRQ_USB_POWER>;
                interrupts-names = "AC", "USB";
                status = "okay";

What matters here is the binding documentation in Documentation/devicetree/bindings/power/supply/tps65217_charger.txt

Please fix that instead to mandate that the two interrupts are required, what their functions are, and what the interrupt-names (not interrupts-names) property must list.

Arnd

author
#6 lore raw
Quoted 3 lines · Arnd Bergmann

Ah, the numbers come from the data sheet. Please just remove the header then, there is no need to keep them as an ABI, in particular when the driver doesn't even include that header today.

Got it.

Quoted 2 lines

What matters here is the binding documentation in Documentation/devicetree/bindings/power/supply/tps65217_charger.txt

OK, in addition to this, the interrupt specifier needs to be added in Documentation/devicetree/bindings/input/tps65218-pwrbutton.txt.

Quoted 3 lines

Please fix that instead to mandate that the two interrupts are required, what their functions are, and what the interrupt-names (not interrupts-names) property must list.

Oops, wrong interrupt name property - my bad.

Thanks for all your feedback.

Best regards,
Milo