* [PATCH 1/7] ARM: dts: tps65217: Specify the interrupt controller
2016-10-21 14:00 [PATCH 0/7] Support TPS65217 PMIC interrupt in DT Milo Kim
@ 2016-10-21 14:01 ` Milo Kim
2016-10-21 14:01 ` [PATCH 2/7] ARM: dts: tps65217: Add the charger device Milo Kim
` (5 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Milo Kim @ 2016-10-21 14:01 UTC (permalink / raw)
To: linux-arm-kernel
TPS65217 MFD driver supports the IRQ domain to handle the charger input
interrupts and push button status event. The interrupt controller enables
corresponding IRQ handling in the charger[*] and power button driver[**].
[*] drivers/power/supply/tps65217_charger.c
[**] drivers/input/misc/tps65218-pwrbutton.c
Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
---
arch/arm/boot/dts/tps65217.dtsi | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/boot/dts/tps65217.dtsi b/arch/arm/boot/dts/tps65217.dtsi
index a632724..27935f8 100644
--- a/arch/arm/boot/dts/tps65217.dtsi
+++ b/arch/arm/boot/dts/tps65217.dtsi
@@ -13,6 +13,8 @@
&tps {
compatible = "ti,tps65217";
+ interrupt-controller;
+ #interrupt-cells = <1>;
regulators {
#address-cells = <1>;
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/7] ARM: dts: tps65217: Add the charger device
2016-10-21 14:00 [PATCH 0/7] Support TPS65217 PMIC interrupt in DT Milo Kim
2016-10-21 14:01 ` [PATCH 1/7] ARM: dts: tps65217: Specify the interrupt controller Milo Kim
@ 2016-10-21 14:01 ` Milo Kim
2016-10-21 14:01 ` [PATCH 3/7] ARM: dts: tps65217: Add the power button device Milo Kim
` (4 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Milo Kim @ 2016-10-21 14:01 UTC (permalink / raw)
To: linux-arm-kernel
Support the charger driver and disable it by default.
Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
---
arch/arm/boot/dts/tps65217.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/boot/dts/tps65217.dtsi b/arch/arm/boot/dts/tps65217.dtsi
index 27935f8..8f77d0d 100644
--- a/arch/arm/boot/dts/tps65217.dtsi
+++ b/arch/arm/boot/dts/tps65217.dtsi
@@ -16,6 +16,11 @@
interrupt-controller;
#interrupt-cells = <1>;
+ charger {
+ compatible = "ti,tps65217-charger";
+ status = "disabled";
+ };
+
regulators {
#address-cells = <1>;
#size-cells = <0>;
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/7] ARM: dts: tps65217: Add the power button device
2016-10-21 14:00 [PATCH 0/7] Support TPS65217 PMIC interrupt in DT Milo Kim
2016-10-21 14:01 ` [PATCH 1/7] ARM: dts: tps65217: Specify the interrupt controller Milo Kim
2016-10-21 14:01 ` [PATCH 2/7] ARM: dts: tps65217: Add the charger device Milo Kim
@ 2016-10-21 14:01 ` Milo Kim
2016-10-21 14:01 ` [PATCH 4/7] ARM: dts: am335x: Support the PMIC interrupt Milo Kim
` (3 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Milo Kim @ 2016-10-21 14:01 UTC (permalink / raw)
To: linux-arm-kernel
Support the power button driver and disable it by default.
Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
---
arch/arm/boot/dts/tps65217.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/boot/dts/tps65217.dtsi b/arch/arm/boot/dts/tps65217.dtsi
index 8f77d0d..02de56b 100644
--- a/arch/arm/boot/dts/tps65217.dtsi
+++ b/arch/arm/boot/dts/tps65217.dtsi
@@ -21,6 +21,11 @@
status = "disabled";
};
+ pwrbutton {
+ compatible = "ti,tps65217-pwrbutton";
+ status = "disabled";
+ };
+
regulators {
#address-cells = <1>;
#size-cells = <0>;
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/7] ARM: dts: am335x: Support the PMIC interrupt
2016-10-21 14:00 [PATCH 0/7] Support TPS65217 PMIC interrupt in DT Milo Kim
` (2 preceding siblings ...)
2016-10-21 14:01 ` [PATCH 3/7] ARM: dts: tps65217: Add the power button device Milo Kim
@ 2016-10-21 14:01 ` Milo Kim
2016-10-21 14:01 ` [PATCH 5/7] ARM: dts: am335x: Add the charger interrupt Milo Kim
` (2 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Milo Kim @ 2016-10-21 14:01 UTC (permalink / raw)
To: linux-arm-kernel
AM335x bone based boards have the PMIC interrupt named NMI which is
connected to TPS65217 device. AM335x main interrupt controller provides it
and the number is 7.
Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
---
arch/arm/boot/dts/am335x-bone-common.dtsi | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
index 007b5e5..25303d9 100644
--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
+++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
@@ -310,6 +310,10 @@
* by the hardware problems. (Tip: double-check by performing a current
* measurement after shutdown: it should be less than 1 mA.)
*/
+
+ interrupts = <7>; /* NMI */
+ interrupt-parent = <&intc>;
+
ti,pmic-shutdown-controller;
regulators {
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/7] ARM: dts: am335x: Add the charger interrupt
2016-10-21 14:00 [PATCH 0/7] Support TPS65217 PMIC interrupt in DT Milo Kim
` (3 preceding siblings ...)
2016-10-21 14:01 ` [PATCH 4/7] ARM: dts: am335x: Support the PMIC interrupt Milo Kim
@ 2016-10-21 14:01 ` Milo Kim
2016-10-21 20:47 ` Robert Nelson
2016-10-21 14:01 ` [PATCH 6/7] ARM: dts: am335x: Add the power button interrupt Milo Kim
2016-10-21 14:01 ` [PATCH 7/7] mfd: tps65217: Fix mismatched interrupt number Milo Kim
6 siblings, 1 reply; 13+ messages in thread
From: Milo Kim @ 2016-10-21 14:01 UTC (permalink / raw)
To: linux-arm-kernel
This enables the charger driver gets corresponding IRQ number by using
platform_get_irq_byname() helper.
Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
---
arch/arm/boot/dts/am335x-bone-common.dtsi | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
index 25303d9..cec9d91 100644
--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
+++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
@@ -6,6 +6,8 @@
* published by the Free Software Foundation.
*/
+#include <dt-bindings/mfd/tps65217.h>
+
/ {
cpus {
cpu at 0 {
@@ -316,6 +318,12 @@
ti,pmic-shutdown-controller;
+ charger {
+ interrupts = <TPS65217_IRQ_AC>, <TPS65217_IRQ_USB>;
+ interrupts-names = "AC", "USB";
+ status = "okay";
+ };
+
regulators {
dcdc1_reg: regulator at 0 {
regulator-name = "vdds_dpr";
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/7] ARM: dts: am335x: Add the charger interrupt
2016-10-21 14:01 ` [PATCH 5/7] ARM: dts: am335x: Add the charger interrupt Milo Kim
@ 2016-10-21 20:47 ` Robert Nelson
2016-10-21 21:01 ` Robert Nelson
2016-10-28 4:01 ` Milo Kim
0 siblings, 2 replies; 13+ messages in thread
From: Robert Nelson @ 2016-10-21 20:47 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Oct 21, 2016 at 9:01 AM, Milo Kim <woogyom.kim@gmail.com> wrote:
> This enables the charger driver gets corresponding IRQ number by using
> platform_get_irq_byname() helper.
>
> Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
> ---
> arch/arm/boot/dts/am335x-bone-common.dtsi | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
> index 25303d9..cec9d91 100644
> --- a/arch/arm/boot/dts/am335x-bone-common.dtsi
> +++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
> @@ -6,6 +6,8 @@
> * published by the Free Software Foundation.
> */
>
> +#include <dt-bindings/mfd/tps65217.h>
^ this hasn't been posted nor pushed to mainline yet.. ;)
> +
> / {
> cpus {
> cpu at 0 {
> @@ -316,6 +318,12 @@
>
> ti,pmic-shutdown-controller;
>
> + charger {
> + interrupts = <TPS65217_IRQ_AC>, <TPS65217_IRQ_USB>;
> + interrupts-names = "AC", "USB";
> + status = "okay";
> + };
> +
> regulators {
> dcdc1_reg: regulator at 0 {
> regulator-name = "vdds_dpr";
> --
> 2.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Robert Nelson
https://rcn-ee.com/
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 5/7] ARM: dts: am335x: Add the charger interrupt
2016-10-21 20:47 ` Robert Nelson
@ 2016-10-21 21:01 ` Robert Nelson
2016-10-28 4:01 ` Milo Kim
1 sibling, 0 replies; 13+ messages in thread
From: Robert Nelson @ 2016-10-21 21:01 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Oct 21, 2016 at 3:47 PM, Robert Nelson <robertcnelson@gmail.com> wrote:
> On Fri, Oct 21, 2016 at 9:01 AM, Milo Kim <woogyom.kim@gmail.com> wrote:
>> This enables the charger driver gets corresponding IRQ number by using
>> platform_get_irq_byname() helper.
>>
>> Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
>> ---
>> arch/arm/boot/dts/am335x-bone-common.dtsi | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
>> index 25303d9..cec9d91 100644
>> --- a/arch/arm/boot/dts/am335x-bone-common.dtsi
>> +++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
>> @@ -6,6 +6,8 @@
>> * published by the Free Software Foundation.
>> */
>>
>> +#include <dt-bindings/mfd/tps65217.h>
>
> ^ this hasn't been posted nor pushed to mainline yet.. ;)
So, with this patchset + Keerthy's [RESEND PATCH v8 0/5] mfd:
tps65218: Clean ups:
https://www.mail-archive.com/linux-kernel at vger.kernel.org/msg1250918.html
and this patch, as systemd is looking for "tps65217_pwr_but"..
https://github.com/systemd/systemd/blob/master/src/login/70-power-switch.rules#L13
Shutdown is working on my BBB/BBG/BBGW/BBBW's...
diff --git a/drivers/input/misc/tps65218-pwrbutton.c
b/drivers/input/misc/tps65218-pwrbutton.c
index cc74a41..f7e5492 100644
--- a/drivers/input/misc/tps65218-pwrbutton.c
+++ b/drivers/input/misc/tps65218-pwrbutton.c
@@ -36,7 +36,7 @@ struct tps6521x_data {
static const struct tps6521x_data tps65217_data = {
.reg_status = TPS65217_REG_STATUS,
.pb_mask = TPS65217_STATUS_PB,
- .name = "tps65217_pwrbutton",
+ .name = "tps65217_pwr_but",
};
static const struct tps6521x_data tps65218_data = {
diff --git a/include/dt-bindings/mfd/tps65217.h
b/include/dt-bindings/mfd/tps65217.h
new file mode 100644
index 0000000..26b2ba8
--- /dev/null
+++ b/include/dt-bindings/mfd/tps65217.h
@@ -0,0 +1,9 @@
+#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_NUM_IRQ 3
+
+#endif /* __DT_BINDINGS_TPS65217_H */
Regards,
--
Robert Nelson
https://rcn-ee.com/
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/7] ARM: dts: am335x: Add the charger interrupt
2016-10-21 20:47 ` Robert Nelson
2016-10-21 21:01 ` Robert Nelson
@ 2016-10-28 4:01 ` Milo Kim
1 sibling, 0 replies; 13+ messages in thread
From: Milo Kim @ 2016-10-28 4:01 UTC (permalink / raw)
To: linux-arm-kernel
On 10/22/2016 05:47 AM, Robert Nelson wrote:
>> +#include <dt-bindings/mfd/tps65217.h>
> ^ this hasn't been posted nor pushed to mainline yet.. ;)
>
Oops! I've created this file but not captured not only in my git tree
but also in my head! Thanks for your review.
Best regards,
Milo
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 6/7] ARM: dts: am335x: Add the power button interrupt
2016-10-21 14:00 [PATCH 0/7] Support TPS65217 PMIC interrupt in DT Milo Kim
` (4 preceding siblings ...)
2016-10-21 14:01 ` [PATCH 5/7] ARM: dts: am335x: Add the charger interrupt Milo Kim
@ 2016-10-21 14:01 ` Milo Kim
2016-10-21 14:01 ` [PATCH 7/7] mfd: tps65217: Fix mismatched interrupt number Milo Kim
6 siblings, 0 replies; 13+ messages in thread
From: Milo Kim @ 2016-10-21 14:01 UTC (permalink / raw)
To: linux-arm-kernel
This enables the power button driver gets corresponding IRQ number by
using platform_get_irq().
Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
---
arch/arm/boot/dts/am335x-bone-common.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
index cec9d91..0c0a90c 100644
--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
+++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
@@ -324,6 +324,11 @@
status = "okay";
};
+ pwrbutton {
+ interrupts = <TPS65217_IRQ_PB>;
+ status = "okay";
+ };
+
regulators {
dcdc1_reg: regulator at 0 {
regulator-name = "vdds_dpr";
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 7/7] mfd: tps65217: Fix mismatched interrupt number
2016-10-21 14:00 [PATCH 0/7] Support TPS65217 PMIC interrupt in DT Milo Kim
` (5 preceding siblings ...)
2016-10-21 14:01 ` [PATCH 6/7] ARM: dts: am335x: Add the power button interrupt Milo Kim
@ 2016-10-21 14:01 ` Milo Kim
2016-10-26 13:56 ` Lee Jones
6 siblings, 1 reply; 13+ messages in thread
From: Milo Kim @ 2016-10-21 14:01 UTC (permalink / raw)
To: linux-arm-kernel
Enum value of 'tps65217_irq_type' is not matched with DT parsed hwirq
number[*].
The MFD driver gets the IRQ data by referencing hwirq, but the value is
different. So, irq_to_tps65217_irq() returns mismatched IRQ data.
Eventually, the power button driver enables not PB but USB interrupt
when it is probed.
According to the TPS65217 register map[**], USB interrupt is the LSB.
This patch synchronizes TPS65217 IRQ index.
[*] include/dt-bindings/mfd/tps65217.h
[**] http://www.ti.com/lit/ds/symlink/tps65217.pdf
Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
---
include/linux/mfd/tps65217.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h
index 4ccda89..75a3a5f 100644
--- a/include/linux/mfd/tps65217.h
+++ b/include/linux/mfd/tps65217.h
@@ -235,9 +235,9 @@ struct tps65217_bl_pdata {
};
enum tps65217_irq_type {
- TPS65217_IRQ_PB,
- TPS65217_IRQ_AC,
TPS65217_IRQ_USB,
+ TPS65217_IRQ_AC,
+ TPS65217_IRQ_PB,
TPS65217_NUM_IRQ
};
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 7/7] mfd: tps65217: Fix mismatched interrupt number
2016-10-21 14:01 ` [PATCH 7/7] mfd: tps65217: Fix mismatched interrupt number Milo Kim
@ 2016-10-26 13:56 ` Lee Jones
2016-10-28 4:04 ` Milo Kim
0 siblings, 1 reply; 13+ messages in thread
From: Lee Jones @ 2016-10-26 13:56 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, 21 Oct 2016, Milo Kim wrote:
> Enum value of 'tps65217_irq_type' is not matched with DT parsed hwirq
> number[*].
>
> The MFD driver gets the IRQ data by referencing hwirq, but the value is
> different. So, irq_to_tps65217_irq() returns mismatched IRQ data.
> Eventually, the power button driver enables not PB but USB interrupt
> when it is probed.
>
> According to the TPS65217 register map[**], USB interrupt is the LSB.
> This patch synchronizes TPS65217 IRQ index.
>
> [*] include/dt-bindings/mfd/tps65217.h
> [**] http://www.ti.com/lit/ds/symlink/tps65217.pdf
>
> Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
> ---
> include/linux/mfd/tps65217.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h
> index 4ccda89..75a3a5f 100644
> --- a/include/linux/mfd/tps65217.h
> +++ b/include/linux/mfd/tps65217.h
> @@ -235,9 +235,9 @@ struct tps65217_bl_pdata {
> };
>
> enum tps65217_irq_type {
> - TPS65217_IRQ_PB,
> - TPS65217_IRQ_AC,
> TPS65217_IRQ_USB,
> + TPS65217_IRQ_AC,
> + TPS65217_IRQ_PB,
> TPS65217_NUM_IRQ
> };
This is why using enum for these types of assignments is sometimes
dangerous. It's probably best to be explicit.
--
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] 13+ messages in thread
* [PATCH 7/7] mfd: tps65217: Fix mismatched interrupt number
2016-10-26 13:56 ` Lee Jones
@ 2016-10-28 4:04 ` Milo Kim
0 siblings, 0 replies; 13+ messages in thread
From: Milo Kim @ 2016-10-28 4:04 UTC (permalink / raw)
To: linux-arm-kernel
On 10/26/2016 10:56 PM, Lee Jones wrote:
>> diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h
>> > index 4ccda89..75a3a5f 100644
>> > --- a/include/linux/mfd/tps65217.h
>> > +++ b/include/linux/mfd/tps65217.h
>> > @@ -235,9 +235,9 @@ struct tps65217_bl_pdata {
>> > };
>> >
>> > enum tps65217_irq_type {
>> > - TPS65217_IRQ_PB,
>> > - TPS65217_IRQ_AC,
>> > TPS65217_IRQ_USB,
>> > + TPS65217_IRQ_AC,
>> > + TPS65217_IRQ_PB,
>> > TPS65217_NUM_IRQ
>> > };
> This is why using enum for these types of assignments is sometimes
> dangerous. It's probably best to be explicit.
I agree with you. Let me fix in v2 - use #define instead of enum type.
Best regards,
Milo
^ permalink raw reply [flat|nested] 13+ messages in thread