Skip to contentSkip to conversation

Add TWL6030 power off and powerbutton support

PATCH In review Mithil Bavishi 4 participants 17 messages Aug 20, 2022 – Sep 12, 2022

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

cover Add TWL6030 power off and powerbutton support

Hello!

This patchset is based off on an earlier series of patches submitted
https://www.mail-archive.com/[email protected]/msg1110053.html
It adds support for power off to the TWL6030 chipset, adds power button support to the TWL6030 chipset, moves power driver to the correct location, clean up in code from the original patch.

Thanks, Mithil

Mithil Bavishi (6):
power: reset: Move TWL4030 power driver from mfd
dt-bindings: power: reset: Move twl4030-power from mfd to power/reset
dt-bindings: input: twl-pwrbutton: Add support for twl6030-pwrbutton
dt-bindings: power: reset: Add bindings for twl6030-power
input: misc: Rename twl4030_pwrbutton to twl_pwrbutton
dt-bindings: input: Rename twl4030-pwrbutton to twl-pwrbutton

Paul Kocialkowski (4):
power: reset: Add TWL6030 power driver, with minimal support for power
off
ARM: OMAP2+: Only select TWL4030_POWER for OMAP3
ARM: OMAP2+: Select TWL6030_POWER for OMAP4
input: misc: Add TWL6030 power button support to twl-pwrbutton

 ...wl4030-pwrbutton.txt => twl-pwrbutton.txt} |  5 +-
 .../{mfd => power/reset}/twl4030-power.txt    |  0
 .../bindings/power/reset/twl6030-power.txt    | 31 +++++++
 arch/arm/boot/dts/twl6030.dtsi                |  5 +
 arch/arm/configs/omap2plus_defconfig          |  2 +-
 arch/arm/mach-omap2/Kconfig                   |  3 +-
 drivers/input/misc/Kconfig                    |  8 +-
 drivers/input/misc/Makefile                   |  2 +-
 .../{twl4030-pwrbutton.c => twl-pwrbutton.c}  | 75 ++++++++++-----
 drivers/mfd/Kconfig                           | 13 ---
 drivers/mfd/Makefile                          |  1 -
 drivers/power/reset/Kconfig                   | 22 +++++
 drivers/power/reset/Makefile                  |  2 +
 drivers/{mfd => power/reset}/twl4030-power.c  |  0
 drivers/power/reset/twl6030-power.c           | 93 +++++++++++++++++++
 include/linux/mfd/twl.h                       |  1 +
 16 files changed, 217 insertions(+), 46 deletions(-)
 rename Documentation/devicetree/bindings/input/{twl4030-pwrbutton.txt => twl-pwrbutton.txt} (72%)
 rename Documentation/devicetree/bindings/{mfd => power/reset}/twl4030-power.txt (100%)
 create mode 100644 Documentation/devicetree/bindings/power/reset/twl6030-power.txt
 rename drivers/input/misc/{twl4030-pwrbutton.c => twl-pwrbutton.c} (55%)
 rename drivers/{mfd => power/reset}/twl4030-power.c (100%)
 create mode 100644 drivers/power/reset/twl6030-power.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/10 power: reset: Move TWL4030 power driver from mfd

The power/reset folder seems like a more appropriate place for twl4030-power.c

---
 drivers/mfd/Kconfig                          | 13 -------------
 drivers/mfd/Makefile                         |  1 -
 drivers/power/reset/Kconfig                  | 12 ++++++++++++
 drivers/power/reset/Makefile                 |  1 +
 drivers/{mfd => power/reset}/twl4030-power.c |  0
 5 files changed, 13 insertions(+), 14 deletions(-)
 rename drivers/{mfd => power/reset}/twl4030-power.c (100%)
drivers/mfd/Kconfig +0 -13
index abb58ab1a..6a409bb2a 100644
@@ -1643,19 +1643,6 @@ config TWL4030_CORE
 	  high speed USB OTG transceiver, an audio codec (on most
 	  versions) and many other features.
 
-config TWL4030_POWER
-	bool "TI TWL4030 power resources"
-	depends on TWL4030_CORE && ARM
-	help
-	  Say yes here if you want to use the power resources on the
-	  TWL4030 family chips.  Most of these resources are regulators,
-	  which have a separate driver; some are control signals, such
-	  as clock request handshaking.
-
-	  This driver uses board-specific data to initialize the resources
-	  and load scripts controlling which resources are switched off/on
-	  or reset when a sleep, wakeup or warm reset event occurs.
-
 config MFD_TWL4030_AUDIO
 	bool "TI TWL4030 Audio"
 	depends on TWL4030_CORE
drivers/mfd/Makefile +0 -1
index 858cacf65..bd7bf95e6 100644
@@ -108,7 +108,6 @@ obj-$(CONFIG_MFD_TPS65912_SPI)  += tps65912-spi.o
 obj-$(CONFIG_MENELAUS)		+= menelaus.o
 
 obj-$(CONFIG_TWL4030_CORE)	+= twl-core.o twl4030-irq.o twl6030-irq.o
-obj-$(CONFIG_TWL4030_POWER)    += twl4030-power.o
 obj-$(CONFIG_MFD_TWL4030_AUDIO)	+= twl4030-audio.o
 obj-$(CONFIG_TWL6040_CORE)	+= twl6040.o
 
drivers/power/reset/Kconfig +12 -0
index a8c46ba58..39117b697 100644
@@ -303,4 +303,16 @@ config POWER_MLXBF
 	help
 	  This driver supports reset or low power mode handling for Mellanox BlueField.
 
+config TWL4030_POWER
+        bool "TI TWL4030 power resources"
+        depends on TWL4030_CORE && ARM
+        help
+          Say yes here if you want to use the power resources on the
+          TWL4030 family chips.  Most of these resources are regulators,
+          which have a separate driver; some are control signals, such
+          as clock request handshaking.
+
+          This driver uses board-specific data to initialize the resources
+          and load scripts controlling which resources are switched off/on
+          or reset when a sleep, wakeup or warm reset event occurs.
 endif
drivers/power/reset/Makefile +1 -0
index 0a39424fc..e9db25b09 100644
@@ -36,3 +36,4 @@ obj-$(CONFIG_SYSCON_REBOOT_MODE) += syscon-reboot-mode.o
 obj-$(CONFIG_POWER_RESET_SC27XX) += sc27xx-poweroff.o
 obj-$(CONFIG_NVMEM_REBOOT_MODE) += nvmem-reboot-mode.o
 obj-$(CONFIG_POWER_MLXBF) += pwr-mlxbf.o
+obj-$(CONFIG_TWL4030_POWER) += twl4030-power.o
drivers/power/reset/twl4030-power.c renamed from drivers/mfd/twl4030-power.c +0 -0
similarity index 100%
rename from drivers/mfd/twl4030-power.c
rename to drivers/power/reset/twl4030-power.c
Signature · 1 line
2.25.1
#3 lore raw

PATCH 2/10 dt-bindings: power: reset: Move twl4030-power from mfd to power/reset

In reply to Mithil Bavishi

Move the documentation for twl4030-power from mfd to power/reset

---
 .../devicetree/bindings/{mfd => power/reset}/twl4030-power.txt    | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename Documentation/devicetree/bindings/{mfd => power/reset}/twl4030-power.txt (100%)
Documentation/devicetree/bindings/power/reset/twl4030-power.txt renamed from Documentation/devicetree/bindings/mfd/twl4030-power.txt +0 -0
similarity index 100%
rename from Documentation/devicetree/bindings/mfd/twl4030-power.txt
rename to Documentation/devicetree/bindings/power/reset/twl4030-power.txt
Signature · 1 line
2.25.1
#6 lore raw

PATCH 3/10 power: reset: Add TWL6030 power driver, with minimal support for power off

In reply to Mithil Bavishi

From: Paul Kocialkowski <[email protected]>

This adds a TWL6030 power driver, that currently only supports powering off the device when the TWL is used as system power controller.

This driver might be extended to support more power-related features of the TWL6030.

---
 drivers/power/reset/Kconfig         | 10 ++++
 drivers/power/reset/Makefile        |  1 +
 drivers/power/reset/twl6030-power.c | 93 +++++++++++++++++++++++++++++
 3 files changed, 104 insertions(+)
 create mode 100644 drivers/power/reset/twl6030-power.c
drivers/power/reset/Kconfig +10 -0
index 39117b697..5156b1613 100644
@@ -316,3 +316,13 @@ config TWL4030_POWER
           and load scripts controlling which resources are switched off/on
           or reset when a sleep, wakeup or warm reset event occurs.
 endif
+
+config TWL6030_POWER
+	bool "TI TWL6030 power resources"
+	depends on TWL4030_CORE && ARM
+	help
+	  Say yes here if you want to use the power resources on the
+	  TWL6030 family chips.
+
+	  When used as system power controller, this driver allows turning off
+	  the main power supply.
drivers/power/reset/Makefile +1 -0
index e9db25b09..692d51cef 100644
@@ -37,3 +37,4 @@ obj-$(CONFIG_POWER_RESET_SC27XX) += sc27xx-poweroff.o
 obj-$(CONFIG_NVMEM_REBOOT_MODE) += nvmem-reboot-mode.o
 obj-$(CONFIG_POWER_MLXBF) += pwr-mlxbf.o
 obj-$(CONFIG_TWL4030_POWER) += twl4030-power.o
+obj-$(CONFIG_TWL6030_POWER) += twl6030-power.o
drivers/power/reset/twl6030-power.c new file +93 -0

93 lines not on this page · raw message

Signature · 1 line
2.25.1
#8 lore raw

PATCH 4/10 dt-bindings: input: twl-pwrbutton: Add support for twl6030-pwrbutton

In reply to Mithil Bavishi

Adds documentation for the compatible string for twl6030 powerbutton support.

---
 Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt +1 -0
index f5021214e..9a0b765d3 100644
@@ -8,6 +8,7 @@ This module provides a simple power button event via an Interrupt.
 Required properties:
 - compatible: should be one of the following
    - "ti,twl4030-pwrbutton": For controllers compatible with twl4030
+   - "ti,twl6030-pwrbutton": For controllers compatible with twl6030
 - interrupts: should be one of the following
    - <8>: For controllers compatible with twl4030
 
Signature · 1 line
2.25.1
#10 lore raw

PATCH 5/10 dt-bindings: power: reset: Add bindings for twl6030-power

In reply to Mithil Bavishi

Adds documentation for the twl6030 power driver.

---
 .../bindings/power/reset/twl6030-power.txt    | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/reset/twl6030-power.txt
Documentation/devicetree/bindings/power/reset/twl6030-power.txt new file +31 -0
new file mode 100644
index 000000000..946bb3d9f
@@ -0,0 +1,31 @@
+Texas Instruments TWL family (twl6030) reset and power management module
+
+For now, the binding only supports the complete shutdown of the system after
+poweroff.
+
+Required properties:
+- compatible : must be
+       "ti,twl6030-power"
+
+Optional properties:
+
+- ti,system-power-controller: This indicates that TWL6030 is the
+  power supply master of the system. With this flag, the chip will
+  initiate an ACTIVE-to-OFF or SLEEP-to-OFF transition when the
+  system poweroffs.
+
+Example:
+&i2c1 {
+       clock-frequency = <2600000>;
+
+       twl: twl@48 {
+               reg = <0x48>;
+               interrupts = <7>; /* SYS_NIRQ cascaded to intc */
+               interrupt-parent = <&intc>;
+
+               twl_power: power {
+                       compatible = "ti,twl6030-power";
+                       ti,system-power-controller;
+               };
+       };
+};
Signature · 1 line
2.25.1
#12 lore raw

PATCH 6/10 ARM: OMAP2+: Only select TWL4030_POWER for OMAP3

In reply to Mithil Bavishi

From: Paul Kocialkowski <[email protected]>

The TWL4030 is generally used with the OMAP3, not with OMAP4. The TWL6030 is generally used with the OMAP4 instead.

---
 arch/arm/mach-omap2/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/Kconfig +1 -1
index 3b53dda9e..e4fea50c3 100644
@@ -143,7 +143,7 @@ config ARCH_OMAP2PLUS_TYPICAL
 	select REGULATOR
 	select REGULATOR_FIXED_VOLTAGE
 	select TWL4030_CORE if ARCH_OMAP3 || ARCH_OMAP4
-	select TWL4030_POWER if ARCH_OMAP3 || ARCH_OMAP4
+	select TWL4030_POWER if ARCH_OMAP3
 	select VFP
 	help
 	  Compile a kernel suitable for booting most boards
Signature · 1 line
2.25.1
#13 lore raw

PATCH 7/10 ARM: OMAP2+: Select TWL6030_POWER for OMAP4

In reply to Mithil Bavishi

From: Paul Kocialkowski <[email protected]>

The TWL6030 is generally used with the OMAP4.

---
 arch/arm/mach-omap2/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-omap2/Kconfig +1 -0
index e4fea50c3..9af3bd488 100644
@@ -144,6 +144,7 @@ config ARCH_OMAP2PLUS_TYPICAL
 	select REGULATOR_FIXED_VOLTAGE
 	select TWL4030_CORE if ARCH_OMAP3 || ARCH_OMAP4
 	select TWL4030_POWER if ARCH_OMAP3
+	select TWL6030_POWER if ARCH_OMAP4
 	select VFP
 	help
 	  Compile a kernel suitable for booting most boards
Signature · 1 line
2.25.1
#14 lore raw

PATCH 8/10 input: misc: Rename twl4030_pwrbutton to twl_pwrbutton

In reply to Mithil Bavishi

This renames the twl4030-pwrbutton driver to twl-pwrbutton, since power button handling is very similar on most TWL chips.

---
 arch/arm/configs/omap2plus_defconfig          |  2 +-
 drivers/input/misc/Kconfig                    |  8 ++---
 drivers/input/misc/Makefile                   |  2 +-
 .../{twl4030-pwrbutton.c => twl-pwrbutton.c}  | 32 +++++++++----------
 4 files changed, 22 insertions(+), 22 deletions(-)
 rename drivers/input/misc/{twl4030-pwrbutton.c => twl-pwrbutton.c} (76%)
arch/arm/configs/omap2plus_defconfig +1 -1
index 99d015cf8..621fd8b7e 100644
@@ -402,7 +402,7 @@ CONFIG_TOUCHSCREEN_TSC2007=m
 CONFIG_INPUT_MISC=y
 CONFIG_INPUT_CPCAP_PWRBUTTON=m
 CONFIG_INPUT_TPS65218_PWRBUTTON=m
-CONFIG_INPUT_TWL4030_PWRBUTTON=m
+CONFIG_INPUT_TWL_PWRBUTTON=m
 CONFIG_INPUT_UINPUT=m
 CONFIG_INPUT_PALMAS_PWRBUTTON=m
 CONFIG_INPUT_PWM_VIBRA=m
drivers/input/misc/Kconfig +4 -4
index a18ab7358..2c50459c7 100644
@@ -479,15 +479,15 @@ config INPUT_AXP20X_PEK
 	  be called axp20x-pek.
 
 
-config INPUT_TWL4030_PWRBUTTON
-	tristate "TWL4030 Power button Driver"
+config INPUT_TWL_PWRBUTTON
+	tristate "TWL Power button Driver"
 	depends on TWL4030_CORE
 	help
 	  Say Y here if you want to enable power key reporting via the
-	  TWL4030 family of chips.
+	  TWL family of chips.
 
 	  To compile this driver as a module, choose M here. The module will
-	  be called twl4030_pwrbutton.
+	  be called twl_pwrbutton.
 
 config INPUT_TWL4030_VIBRA
 	tristate "Support for TWL4030 Vibrator"
drivers/input/misc/Makefile +1 -1
index 28dfc444f..3eddb8cbd 100644
@@ -78,7 +78,7 @@ obj-$(CONFIG_INPUT_SOC_BUTTON_ARRAY)	+= soc_button_array.o
 obj-$(CONFIG_INPUT_SPARCSPKR)		+= sparcspkr.o
 obj-$(CONFIG_INPUT_STPMIC1_ONKEY)  	+= stpmic1_onkey.o
 obj-$(CONFIG_INPUT_TPS65218_PWRBUTTON)	+= tps65218-pwrbutton.o
-obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON)	+= twl4030-pwrbutton.o
+obj-$(CONFIG_INPUT_TWL_PWRBUTTON)	+= twl-pwrbutton.o
 obj-$(CONFIG_INPUT_TWL4030_VIBRA)	+= twl4030-vibra.o
 obj-$(CONFIG_INPUT_TWL6040_VIBRA)	+= twl6040-vibra.o
 obj-$(CONFIG_INPUT_UINPUT)		+= uinput.o
drivers/input/misc/twl-pwrbutton.c renamed from drivers/input/misc/twl4030-pwrbutton.c +16 -16
similarity index 76%
rename from drivers/input/misc/twl4030-pwrbutton.c
rename to drivers/input/misc/twl-pwrbutton.c
index b307cca17..5614c5003 100644
@@ -1,5 +1,5 @@
 /**
- * twl4030-pwrbutton.c - TWL4030 Power Button Input Driver
+ * twl-pwrbutton.c - TWL4030 Power Button Input Driver
  *
  * Copyright (C) 2008-2009 Nokia Corporation
  *
@@ -52,7 +52,7 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
 	return IRQ_HANDLED;
 }
 
-static int twl4030_pwrbutton_probe(struct platform_device *pdev)
+static int twl_pwrbutton_probe(struct platform_device *pdev)
 {
 	struct input_dev *pwr;
 	int irq = platform_get_irq(pdev, 0);
@@ -65,14 +65,14 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
 	}
 
 	input_set_capability(pwr, EV_KEY, KEY_POWER);
-	pwr->name = "twl4030_pwrbutton";
-	pwr->phys = "twl4030_pwrbutton/input0";
+	pwr->name = "twl_pwrbutton";
+	pwr->phys = "twl_pwrbutton/input0";
 	pwr->dev.parent = &pdev->dev;
 
 	err = devm_request_threaded_irq(&pdev->dev, irq, NULL, powerbutton_irq,
 			IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING |
 			IRQF_ONESHOT,
-			"twl4030_pwrbutton", pwr);
+			"twl_pwrbutton", pwr);
 	if (err < 0) {
 		dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
 		return err;
@@ -90,24 +90,24 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_OF
-static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
-       { .compatible = "ti,twl4030-pwrbutton" },
-       {},
+static const struct of_device_id twl_pwrbutton_dt_match_table[] = {
+	{ .compatible = "ti,twl4030-pwrbutton" },
+	{},
 };
-MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
+MODULE_DEVICE_TABLE(of, twl_pwrbutton_dt_match_table);
 #endif
 
-static struct platform_driver twl4030_pwrbutton_driver = {
-	.probe		= twl4030_pwrbutton_probe,
+static struct platform_driver twl_pwrbutton_driver = {
+	.probe		= twl_pwrbutton_probe,
 	.driver		= {
-		.name	= "twl4030_pwrbutton",
-		.of_match_table = of_match_ptr(twl4030_pwrbutton_dt_match_table),
+		.name	= "twl_pwrbutton",
+		.of_match_table = of_match_ptr(twl_pwrbutton_dt_match_table),
 	},
 };
-module_platform_driver(twl4030_pwrbutton_driver);
+module_platform_driver(twl_pwrbutton_driver);
 
-MODULE_ALIAS("platform:twl4030_pwrbutton");
-MODULE_DESCRIPTION("Triton2 Power Button");
+MODULE_ALIAS("platform:twl_pwrbutton");
+MODULE_DESCRIPTION("TWL Power Button");
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Peter De Schrijver <[email protected]>");
 MODULE_AUTHOR("Felipe Balbi <[email protected]>");
Signature · 1 line
2.25.1
#15 lore raw

PATCH 9/10 dt-bindings: input: Rename twl4030-pwrbutton to twl-pwrbutton

In reply to Mithil Bavishi

This changes the Documentation of the twl4030-pwrbutton to make it more generic as it can support other chips than twl4030 as well.

---
 .../input/{twl4030-pwrbutton.txt => twl-pwrbutton.txt}        | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 rename Documentation/devicetree/bindings/input/{twl4030-pwrbutton.txt => twl-pwrbutton.txt} (81%)
Documentation/devicetree/bindings/input/twl-pwrbutton.txt renamed from Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt +2 -2
similarity index 81%
rename from Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
rename to Documentation/devicetree/bindings/input/twl-pwrbutton.txt
index 9a0b765d3..43addc04d 100644
@@ -1,6 +1,6 @@
-Texas Instruments TWL family (twl4030) pwrbutton module
+Texas Instruments TWL family pwrbutton module
 
-This module is part of the TWL4030. For more details about the whole
+This module is part of a TWL chip. For more details about the whole
 chip see Documentation/devicetree/bindings/mfd/twl-family.txt.
 
 This module provides a simple power button event via an Interrupt.
Signature · 1 line
2.25.1
maintainer Acked-by on v1 2/10
#4 lore raw

Re: [PATCH 02/10] dt-bindings: power: reset: Move twl4030-power from mfd to power/reset

In reply to Mithil Bavishi
Quoted 8 lines · Mithil Bavishi

Move the documentation for twl4030-power from mfd to power/reset

---
 .../devicetree/bindings/{mfd => power/reset}/twl4030-power.txt    | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename Documentation/devicetree/bindings/{mfd => power/reset}/twl4030-power.txt (100%)
maintainer
#11 lore raw

Re: [PATCH 05/10] dt-bindings: power: reset: Add bindings for twl6030-power

In reply to Mithil Bavishi
Quoted 6 lines · Mithil Bavishi

Adds documentation for the twl6030 power driver.

---
 .../bindings/power/reset/twl6030-power.txt    | 31 +++++++++++++++++++

New bindings must be DT schema format.

Quoted 11 lines
 1 file changed, 31 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/reset/twl6030-power.txt
Documentation/devicetree/bindings/power/reset/twl6030-power.txt new file +2 -0
new file mode 100644
index 000000000..946bb3d9f
@@ -0,0 +1,31 @@
+Texas Instruments TWL family (twl6030) reset and power management module
+

Documentation/devicetree/bindings/power/reset/twl6030-power.txt line 12

Quoted 10 lines
Documentation/devicetree/bindings/power/reset/twl6030-power.txt new file +10 -0
+For now, the binding only supports the complete shutdown of the system after
+poweroff.
+
+Required properties:
+- compatible : must be
+       "ti,twl6030-power"
+
+Optional properties:
+
+- ti,system-power-controller: This indicates that TWL6030 is the

We have a generic property for this.

Quoted 6 lines
Documentation/devicetree/bindings/power/reset/twl6030-power.txt new file +6 -0
+  power supply master of the system. With this flag, the chip will
+  initiate an ACTIVE-to-OFF or SLEEP-to-OFF transition when the
+  system poweroffs.
+
+Example:
+&i2c1 {

Documentation/devicetree/bindings/power/reset/twl6030-power.txt line 28

Quoted 10 lines
Documentation/devicetree/bindings/power/reset/twl6030-power.txt new file +10 -0
+       clock-frequency = <2600000>;
+
+       twl: twl@48 {
+               reg = <0x48>;
+               interrupts = <7>; /* SYS_NIRQ cascaded to intc */
+               interrupt-parent = <&intc>;
+
+               twl_power: power {
+                       compatible = "ti,twl6030-power";
+                       ti,system-power-controller;

Why do you need a child node here? There aren't any resources for the sub-block.

Rob

maintainer Acked-by on v1 4/10
#9 lore raw

Re: [PATCH 04/10] dt-bindings: input: twl-pwrbutton: Add support for twl6030-pwrbutton

In reply to Mithil Bavishi
Quoted 9 lines · Mithil Bavishi

Adds documentation for the compatible string for twl6030 powerbutton support.

---
 Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt | 1 +
 1 file changed, 1 insertion(+)
maintainer
#16 lore raw

Re: [PATCH 09/10] dt-bindings: input: Rename twl4030-pwrbutton to twl-pwrbutton

In reply to Mithil Bavishi
Quoted 3 lines · Mithil Bavishi

This changes the Documentation of the twl4030-pwrbutton to make it more generic as it can support other chips than twl4030 as well.

This should be part of patch 4.

Quoted 27 lines
---
 .../input/{twl4030-pwrbutton.txt => twl-pwrbutton.txt}        | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 rename Documentation/devicetree/bindings/input/{twl4030-pwrbutton.txt => twl-pwrbutton.txt} (81%)
Documentation/devicetree/bindings/input/twl-pwrbutton.txt renamed from Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt +2 -2
similarity index 81%
rename from Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
rename to Documentation/devicetree/bindings/input/twl-pwrbutton.txt
index 9a0b765d3..43addc04d 100644
@@ -1,6 +1,6 @@
-Texas Instruments TWL family (twl4030) pwrbutton module
+Texas Instruments TWL family pwrbutton module
 
-This module is part of the TWL4030. For more details about the whole
+This module is part of a TWL chip. For more details about the whole
 chip see Documentation/devicetree/bindings/mfd/twl-family.txt.
 
 This module provides a simple power button event via an Interrupt.
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/10
#2 lore raw

Re: [PATCH 01/10] power: reset: Move TWL4030 power driver from mfd

In reply to Mithil Bavishi
Quoted 4 lines · Mithil Bavishi

The power/reset folder seems like a more appropriate place for twl4030-power.c

Quoted 8 lines
---
 drivers/mfd/Kconfig                          | 13 -------------
 drivers/mfd/Makefile                         |  1 -
 drivers/power/reset/Kconfig                  | 12 ++++++++++++
 drivers/power/reset/Makefile                 |  1 +
 drivers/{mfd => power/reset}/twl4030-power.c |  0
 5 files changed, 13 insertions(+), 14 deletions(-)
 rename drivers/{mfd => power/reset}/twl4030-power.c (100%)
Signature · 6 lines
Lee Jones [李琼斯]

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer Acked-by on v1 2/10
#5 lore raw

Re: [PATCH 02/10] dt-bindings: power: reset: Move twl4030-power from mfd to power/reset

In reply to Mithil Bavishi

Documentation/devicetree/bindings/power/reset/twl4030-power.txt

Quoted 12 lines · Mithil Bavishi

Move the documentation for twl4030-power from mfd to power/reset

---
 .../devicetree/bindings/{mfd => power/reset}/twl4030-power.txt    | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename Documentation/devicetree/bindings/{mfd => power/reset}/twl4030-power.txt (100%)
Documentation/devicetree/bindings/power/reset/twl4030-power.txt renamed from Documentation/devicetree/bindings/mfd/twl4030-power.txt +0 -0
similarity index 100%
rename from Documentation/devicetree/bindings/mfd/twl4030-power.txt
rename to Documentation/devicetree/bindings/power/reset/twl4030-power.txt
Signature · 6 lines
Lee Jones [李琼斯]

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#7 lore raw

Re: [PATCH 03/10] power: reset: Add TWL6030 power driver, with minimal support for power off

In reply to Mithil Bavishi

Hi,

Quoted 54 lines · Mithil Bavishi

From: Paul Kocialkowski <[email protected]>

This adds a TWL6030 power driver, that currently only supports powering off the device when the TWL is used as system power controller.

This driver might be extended to support more power-related features of the TWL6030.

---
 drivers/power/reset/Kconfig         | 10 ++++
 drivers/power/reset/Makefile        |  1 +
 drivers/power/reset/twl6030-power.c | 93 +++++++++++++++++++++++++++++
 3 files changed, 104 insertions(+)
 create mode 100644 drivers/power/reset/twl6030-power.c
drivers/power/reset/Kconfig +10 -0
index 39117b697..5156b1613 100644
@@ -316,3 +316,13 @@ config TWL4030_POWER
           and load scripts controlling which resources are switched off/on
           or reset when a sleep, wakeup or warm reset event occurs.
 endif
+
+config TWL6030_POWER
+	bool "TI TWL6030 power resources"
+	depends on TWL4030_CORE && ARM
+	help
+	  Say yes here if you want to use the power resources on the
+	  TWL6030 family chips.
+
+	  When used as system power controller, this driver allows turning off
+	  the main power supply.
drivers/power/reset/Makefile +1 -0
index e9db25b09..692d51cef 100644
@@ -37,3 +37,4 @@ obj-$(CONFIG_POWER_RESET_SC27XX) += sc27xx-poweroff.o
 obj-$(CONFIG_NVMEM_REBOOT_MODE) += nvmem-reboot-mode.o
 obj-$(CONFIG_POWER_MLXBF) += pwr-mlxbf.o
 obj-$(CONFIG_TWL4030_POWER) += twl4030-power.o
+obj-$(CONFIG_TWL6030_POWER) += twl6030-power.o
drivers/power/reset/twl6030-power.c new file +4 -0
new file mode 100644
index 000000000..78c8a02a3
@@ -0,0 +1,93 @@
+/*
+ * TWL6030 power
+ *
+ * Copyright (C) 2016 Paul Kocialkowski <[email protected]>

drivers/power/reset/twl6030-power.c line 14

Quoted 10 lines
drivers/power/reset/twl6030-power.c new file +10 -0
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */

Please use SPDX format for license.

Quoted 46 lines
drivers/power/reset/twl6030-power.c new file +46 -0
+
+#include <linux/module.h>
+#include <linux/pm.h>
+#include <linux/mfd/twl.h>
+#include <linux/platform_device.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+
+#define TWL6030_PHOENIX_DEV_ON		0x25
+
+#define TWL6030_PHOENIX_APP_DEVOFF	BIT(0)
+#define TWL6030_PHOENIX_CON_DEVOFF	BIT(1)
+#define TWL6030_PHOENIX_MOD_DEVOFF	BIT(2)
+
+void twl6030_power_off(void)
+{
+	int err;
+
+	err = twl_i2c_write_u8(TWL6030_MODULE_ID0, TWL6030_PHOENIX_APP_DEVOFF |
+		TWL6030_PHOENIX_CON_DEVOFF | TWL6030_PHOENIX_MOD_DEVOFF,
+		TWL6030_PHOENIX_DEV_ON);
+	if (err)
+		pr_err("TWL6030 Unable to power off\n");
+}
+
+static bool twl6030_power_use_poweroff(struct device_node *node)
+{
+	if (of_property_read_bool(node, "ti,system-power-controller"))
+		return true;
+
+	return false;
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id twl6030_power_of_match[] = {
+	{
+		.compatible = "ti,twl6030-power",
+	},
+	{ },
+};
+
+MODULE_DEVICE_TABLE(of, twl6030_power_of_match);
+#endif	/* CONFIG_OF */
+
+static int twl6030_power_probe(struct platform_device *pdev)
+{

drivers/power/reset/twl6030-power.c line 70

Quoted 10 lines
drivers/power/reset/twl6030-power.c new file +10 -0
+	struct device_node *node = pdev->dev.of_node;
+
+	if (!node) {
+		dev_err(&pdev->dev, "Platform data is missing\n");
+		return -EINVAL;
+	}
+
+	/* Board has to be wired properly to use this feature */
+	if (twl6030_power_use_poweroff(node) && !pm_power_off)
+		pm_power_off = twl6030_power_off;

Please devm_register_sys_off_handler or devm_register_power_off_handler().

drivers/power/reset/twl6030-power.c line 78

Quoted 8 lines
drivers/power/reset/twl6030-power.c new file +8 -0
+
+	return 0;
+}
+
+static int twl6030_power_remove(struct platform_device *pdev)
+{
+	return 0;
+}

Empty remove function can be removed.

drivers/power/reset/twl6030-power.c line 83

Quoted 5 lines
drivers/power/reset/twl6030-power.c new file +5 -0
+
+static struct platform_driver twl6030_power_driver = {
+	.driver = {
+		.name	= "twl6030_power",
+		.of_match_table = of_match_ptr(twl6030_power_of_match),

The driver is not useful without CONFIG_OF, so you can just remove the #ifdef around twl6030_power_of_match and drop of_match_ptr here.

-- Sebastian

Quoted 13 lines
drivers/power/reset/twl6030-power.c new file +10 -0
+	},
+	.probe		= twl6030_power_probe,
+	.remove		= twl6030_power_remove,
+};
+
+module_platform_driver(twl6030_power_driver);
+
+MODULE_AUTHOR("Paul Kocialkowski <[email protected]>");
+MODULE_DESCRIPTION("Power management for TWL6030");
+MODULE_LICENSE("GPL");
Signature · 1 line
2.25.1