Hello!
This patchset is based off on an earlier series of patches submitted
https://www.mail-archive.com/linux-kernel@vger.kernel.org/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
--
2.25.1
diff --git a/drivers/mfd/twl4030-power.c b/drivers/power/reset/twl4030-power.csimilarity index 100%rename from drivers/mfd/twl4030-power.crename to drivers/power/reset/twl4030-power.c
--
2.25.1
Move the documentation for twl4030-power from mfd to power/reset
Signed-off-by: Mithil Bavishi <redacted>
---
.../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%)
diff --git a/Documentation/devicetree/bindings/mfd/twl4030-power.txt b/Documentation/devicetree/bindings/power/reset/twl4030-power.txtsimilarity index 100%rename from Documentation/devicetree/bindings/mfd/twl4030-power.txtrename to Documentation/devicetree/bindings/power/reset/twl4030-power.txt
--
2.25.1
From: Paul Kocialkowski <redacted>
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.
Signed-off-by: Paul Kocialkowski <redacted>
Signed-off-by: Mithil Bavishi <redacted>
---
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
@@ -0,0 +1,93 @@+/*+*TWL6030power+*+*Copyright(C)2016PaulKocialkowski<contact@paulk.fr>+*+*ThisfileissubjecttothetermsandconditionsoftheGNUGeneral+*PublicLicense.Seethefile"COPYING"inthemaindirectoryofthis+*archiveformoredetails.+*+*Thisprogramisdistributedinthehopethatitwillbeuseful,+*butWITHOUTANYWARRANTY;withouteventheimpliedwarrantyof+*MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.Seethe+*GNUGeneralPublicLicenseformoredetails.+*/++#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)++voidtwl6030_power_off(void)+{+interr;++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");+}++staticbooltwl6030_power_use_poweroff(structdevice_node*node)+{+if(of_property_read_bool(node,"ti,system-power-controller"))+returntrue;++returnfalse;+}++#ifdef CONFIG_OF+staticconststructof_device_idtwl6030_power_of_match[]={+{+.compatible="ti,twl6030-power",+},+{},+};++MODULE_DEVICE_TABLE(of,twl6030_power_of_match);+#endif /* CONFIG_OF */++staticinttwl6030_power_probe(structplatform_device*pdev)+{+structdevice_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;++return0;+}++staticinttwl6030_power_remove(structplatform_device*pdev)+{+return0;+}++staticstructplatform_drivertwl6030_power_driver={+.driver={+.name="twl6030_power",+.of_match_table=of_match_ptr(twl6030_power_of_match),+},+.probe=twl6030_power_probe,+.remove=twl6030_power_remove,+};++module_platform_driver(twl6030_power_driver);++MODULE_AUTHOR("Paul Kocialkowski <contact@paulk.fr>");+MODULE_DESCRIPTION("Power management for TWL6030");+MODULE_LICENSE("GPL");
@@ -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
@@ -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;+ };+ };+};
From: Paul Kocialkowski <redacted>
The TWL4030 is generally used with the OMAP3, not with OMAP4.
The TWL6030 is generally used with the OMAP4 instead.
Signed-off-by: Paul Kocialkowski <redacted>
---
arch/arm/mach-omap2/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Paul Kocialkowski <redacted>
The TWL6030 is generally used with the OMAP4.
Signed-off-by: Paul Kocialkowski <redacted>
---
arch/arm/mach-omap2/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl-pwrbutton.csimilarity index 76%rename from drivers/input/misc/twl4030-pwrbutton.crename to drivers/input/misc/twl-pwrbutton.cindex b307cca17..5614c5003 100644--- a/drivers/input/misc/twl4030-pwrbutton.c+++ b/drivers/input/misc/twl-pwrbutton.c
@@ -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);returnerr;
@@ -90,24 +90,24 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)}#ifdef CONFIG_OF-staticconststructof_device_idtwl4030_pwrbutton_dt_match_table[]={-{.compatible="ti,twl4030-pwrbutton"},-{},+staticconststructof_device_idtwl_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-staticstructplatform_drivertwl4030_pwrbutton_driver={-.probe=twl4030_pwrbutton_probe,+staticstructplatform_drivertwl_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 <peter.de-schrijver@nokia.com>");MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>");
This changes the Documentation of the twl4030-pwrbutton to
make it more generic as it can support other chips than
twl4030 as well.
Signed-off-by: Mithil Bavishi <redacted>
---
.../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%)
diff --git a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt b/Documentation/devicetree/bindings/input/twl-pwrbutton.txtsimilarity index 81%rename from Documentation/devicetree/bindings/input/twl4030-pwrbutton.txtrename to Documentation/devicetree/bindings/input/twl-pwrbutton.txtindex 9a0b765d3..43addc04d 100644--- a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt+++ b/Documentation/devicetree/bindings/input/twl-pwrbutton.txt
@@ -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.
diff --git a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt b/Documentation/devicetree/bindings/input/twl-pwrbutton.txtsimilarity index 81%rename from Documentation/devicetree/bindings/input/twl4030-pwrbutton.txtrename to Documentation/devicetree/bindings/input/twl-pwrbutton.txtindex 9a0b765d3..43addc04d 100644--- a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt+++ b/Documentation/devicetree/bindings/input/twl-pwrbutton.txt
@@ -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.
From: Rob Herring <robh@kernel.org> Date: 2022-08-22 19:32:12
On Sat, Aug 20, 2022 at 12:46:55PM +0530, Mithil Bavishi wrote:
Adds documentation for the twl6030 power driver.
Signed-off-by: Paul Kocialkowski <redacted>
Signed-off-by: Mithil Bavishi <redacted>
---
.../bindings/power/reset/twl6030-power.txt | 31 +++++++++++++++++++
@@ -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
We have a generic property for this.
+ 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;
Why do you need a child node here? There aren't any resources for the
sub-block.
Rob
From: Lee Jones <lee@kernel.org> Date: 2022-09-06 15:57:17
On Sat, 20 Aug 2022, Mithil Bavishi wrote:
quoted hunk
Move the documentation for twl4030-power from mfd to power/reset
Signed-off-by: Mithil Bavishi <redacted>
---
.../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%)
diff --git a/Documentation/devicetree/bindings/mfd/twl4030-power.txt b/Documentation/devicetree/bindings/power/reset/twl4030-power.txtsimilarity index 100%rename from Documentation/devicetree/bindings/mfd/twl4030-power.txtrename to Documentation/devicetree/bindings/power/reset/twl4030-power.txt
Acked-by: Lee Jones <lee@kernel.org>
--
Lee Jones [李琼斯]
From: Sebastian Reichel <hidden> Date: 2022-09-12 10:28:51
Hi,
On Sat, Aug 20, 2022 at 12:46:53PM +0530, Mithil Bavishi wrote:
quoted hunk
From: Paul Kocialkowski <redacted>
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.
Signed-off-by: Paul Kocialkowski <redacted>
Signed-off-by: Mithil Bavishi <redacted>
---
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