* [PATCH v2 0/3] mfd: twl603x: add power button
@ 2025-10-30 19:10 akemnade
2025-10-30 19:10 ` [PATCH v2 1/3] dt-bindings: mfd: twl: enable power button also for twl603x akemnade
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: akemnade @ 2025-10-30 19:10 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andreas Kemnade, Dmitry Torokhov, Tony Lindgren, Kevin Hilman
Cc: devicetree, linux-kernel, linux-input, linux-omap,
Andreas Kemnade
Like the TWL4030, the TWL603x also has a power button feature,
so extend the TWL4030 power button driver to support TWL603x.
Signed-off-by: Andreas Kemnade <akemnade@kernel.org>
---
Changes in v2:
- integrate driver into existing TWL4030 driver
- improve commit messages
- Link to v1: https://lore.kernel.org/r/20251020-twl6030-button-v1-0-93e4644ac974@kernel.org
---
Andreas Kemnade (3):
dt-bindings: mfd: twl: enable power button also for twl603x
Input: twl4030 - add TWL603x power button
ARM: dts: ti/omap: omap4-epson-embt2ws: add powerbutton
Documentation/devicetree/bindings/mfd/ti,twl.yaml | 40 ++++++++++++---
arch/arm/boot/dts/ti/omap/omap4-epson-embt2ws.dts | 5 ++
drivers/input/misc/twl4030-pwrbutton.c | 61 +++++++++++++++++++++--
3 files changed, 94 insertions(+), 12 deletions(-)
---
base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
change-id: 20251020-twl6030-button-83d759b060e6
Best regards,
--
Andreas Kemnade <akemnade@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/3] dt-bindings: mfd: twl: enable power button also for twl603x
2025-10-30 19:10 [PATCH v2 0/3] mfd: twl603x: add power button akemnade
@ 2025-10-30 19:10 ` akemnade
2025-10-30 19:59 ` Conor Dooley
2025-10-30 19:10 ` [PATCH v2 2/3] Input: twl4030 - add TWL603x power button akemnade
2025-10-30 19:10 ` [PATCH v2 3/3] ARM: dts: ti/omap: omap4-epson-embt2ws: add powerbutton akemnade
2 siblings, 1 reply; 6+ messages in thread
From: akemnade @ 2025-10-30 19:10 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andreas Kemnade, Dmitry Torokhov, Tony Lindgren, Kevin Hilman
Cc: devicetree, linux-kernel, linux-input, linux-omap,
Andreas Kemnade
From: Andreas Kemnade <andreas@kemnade.info>
TWL603x has also a power button function, so add the corresponding subnode.
As not in all cases there is a power button connected to the corresponding
pad of the TWL603x, the functionality can be disabled by
status = "disabled" or simply not adding the subnode.
To keep things simple, follow the established design pattern of using const
interrupts as used also by the other subdevices.
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
Documentation/devicetree/bindings/mfd/ti,twl.yaml | 40 ++++++++++++++++++-----
1 file changed, 32 insertions(+), 8 deletions(-)
diff --git a/Documentation/devicetree/bindings/mfd/ti,twl.yaml b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
index 776b04e182cb..3527fee32cb0 100644
--- a/Documentation/devicetree/bindings/mfd/ti,twl.yaml
+++ b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
@@ -55,6 +55,15 @@ allOf:
gpadc: false
+ pwrbutton:
+ properties:
+ compatible:
+ const: ti,twl4030-pwrbutton
+ interrupts:
+ items:
+ - items:
+ const: 8
+
usb-comparator: false
- if:
@@ -95,7 +104,14 @@ allOf:
compatible:
const: ti,twl6030-gpadc
- pwrbutton: false
+ pwrbutton:
+ properties:
+ compatible:
+ const: ti,twl6030-pwrbutton
+ interrupts:
+ items:
+ - items:
+ const: 0
madc: false
@@ -146,7 +162,14 @@ allOf:
compatible:
const: ti,twl6032-gpadc
- pwrbutton: false
+ pwrbutton:
+ properties:
+ compatible:
+ const: ti,twl6030-pwrbutton
+ interrupts:
+ items:
+ - items:
+ const: 0
madc: false
@@ -225,12 +248,8 @@ properties:
additionalProperties: false
properties:
- compatible:
- const: ti,twl4030-pwrbutton
- interrupts:
- items:
- - items:
- const: 8
+ compatible: true
+ interrupts: true
watchdog:
type: object
@@ -459,6 +478,11 @@ examples:
#io-channel-cells = <1>;
};
+ pwrbutton {
+ compatible = "ti,twl6030-pwrbutton";
+ interrupts = <0>;
+ };
+
rtc {
compatible = "ti,twl4030-rtc";
interrupts = <8>;
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] Input: twl4030 - add TWL603x power button
2025-10-30 19:10 [PATCH v2 0/3] mfd: twl603x: add power button akemnade
2025-10-30 19:10 ` [PATCH v2 1/3] dt-bindings: mfd: twl: enable power button also for twl603x akemnade
@ 2025-10-30 19:10 ` akemnade
2025-10-31 17:02 ` kernel test robot
2025-10-30 19:10 ` [PATCH v2 3/3] ARM: dts: ti/omap: omap4-epson-embt2ws: add powerbutton akemnade
2 siblings, 1 reply; 6+ messages in thread
From: akemnade @ 2025-10-30 19:10 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andreas Kemnade, Dmitry Torokhov, Tony Lindgren, Kevin Hilman
Cc: devicetree, linux-kernel, linux-input, linux-omap,
Andreas Kemnade
From: Andreas Kemnade <andreas@kemnade.info>
Like the TWL4030, these PMICs also have a power button feature, so extend
the TWL4030 power button driver. As the irqchip of the TWL6030 mfd driver
does not provide mask, unmask finctions, do it manually.
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
drivers/input/misc/twl4030-pwrbutton.c | 61 +++++++++++++++++++++++++++++++---
1 file changed, 57 insertions(+), 4 deletions(-)
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index f85cc289c053..f8c337f62393 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -25,22 +25,40 @@
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/input.h>
+#include <linux/bits.h>
#include <linux/interrupt.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/mfd/twl.h>
-#define PWR_PWRON_IRQ (1 << 0)
+#define PWR_PWRON_IRQ BIT(0)
-#define STS_HW_CONDITIONS 0xf
+#define STS_HW_CONDITIONS_4030 0xf
+#define STS_HW_CONDITIONS_6030 0x2
+
+struct twl_pwrbutton_chipdata {
+ u8 status_reg;
+ bool need_manual_irq;
+};
+
+struct twl_pwrbutton_chipdata twl4030_chipdata = {
+ STS_HW_CONDITIONS_4030,
+ false,
+};
+
+struct twl_pwrbutton_chipdata twl6030_chipdata = {
+ STS_HW_CONDITIONS_6030,
+ true,
+};
static irqreturn_t powerbutton_irq(int irq, void *_pwr)
{
struct input_dev *pwr = _pwr;
+ const struct twl_pwrbutton_chipdata *pdata = dev_get_drvdata(pwr->dev.parent);
int err;
u8 value;
- err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value, STS_HW_CONDITIONS);
+ err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value, pdata->status_reg);
if (!err) {
pm_wakeup_event(pwr->dev.parent, 0);
input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ);
@@ -55,10 +73,17 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
static int twl4030_pwrbutton_probe(struct platform_device *pdev)
{
+ const struct twl_pwrbutton_chipdata *pdata;
struct input_dev *pwr;
int irq = platform_get_irq(pdev, 0);
int err;
+ pdata = device_get_match_data(&pdev->dev);
+ if (!pdata)
+ return -EINVAL;
+
+ platform_set_drvdata(pdev, (void *)pdata);
+
pwr = devm_input_allocate_device(&pdev->dev);
if (!pwr) {
dev_err(&pdev->dev, "Can't allocate power button\n");
@@ -85,14 +110,41 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
return err;
}
+ if (pdata->need_manual_irq) {
+ err = twl6030_interrupt_unmask(0x01, REG_INT_MSK_LINE_A);
+ if (err < 0)
+ return err;
+
+ err = twl6030_interrupt_unmask(0x01, REG_INT_MSK_STS_A);
+ if (err < 0)
+ return err;
+ }
+
device_init_wakeup(&pdev->dev, true);
return 0;
}
+static void twl4030_pwrbutton_remove(struct platform_device *pdev)
+{
+ const struct twl_pwrbutton_chipdata *pdata = platform_get_drvdata(pdev);
+
+ if (pdata->need_manual_irq) {
+ twl6030_interrupt_mask(0x01, REG_INT_MSK_LINE_A);
+ twl6030_interrupt_mask(0x01, REG_INT_MSK_STS_A);
+ }
+}
+
#ifdef CONFIG_OF
static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
- { .compatible = "ti,twl4030-pwrbutton" },
+ {
+ .compatible = "ti,twl4030-pwrbutton",
+ .data = &twl4030_chipdata,
+ },
+ {
+ .compatible = "ti,twl6030-pwrbutton",
+ .data = &twl6030_chipdata,
+ },
{},
};
MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
@@ -100,6 +152,7 @@ MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
static struct platform_driver twl4030_pwrbutton_driver = {
.probe = twl4030_pwrbutton_probe,
+ .remove = twl4030_pwrbutton_remove,
.driver = {
.name = "twl4030_pwrbutton",
.of_match_table = of_match_ptr(twl4030_pwrbutton_dt_match_table),
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] ARM: dts: ti/omap: omap4-epson-embt2ws: add powerbutton
2025-10-30 19:10 [PATCH v2 0/3] mfd: twl603x: add power button akemnade
2025-10-30 19:10 ` [PATCH v2 1/3] dt-bindings: mfd: twl: enable power button also for twl603x akemnade
2025-10-30 19:10 ` [PATCH v2 2/3] Input: twl4030 - add TWL603x power button akemnade
@ 2025-10-30 19:10 ` akemnade
2 siblings, 0 replies; 6+ messages in thread
From: akemnade @ 2025-10-30 19:10 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andreas Kemnade, Dmitry Torokhov, Tony Lindgren, Kevin Hilman
Cc: devicetree, linux-kernel, linux-input, linux-omap,
Andreas Kemnade
From: Andreas Kemnade <andreas@kemnade.info>
There is a power button connected to the PMIC, so describe it to be able
to power off the device in a convenient manner.
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
arch/arm/boot/dts/ti/omap/omap4-epson-embt2ws.dts | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/boot/dts/ti/omap/omap4-epson-embt2ws.dts b/arch/arm/boot/dts/ti/omap/omap4-epson-embt2ws.dts
index c90f43cc2fae..673df1b693f2 100644
--- a/arch/arm/boot/dts/ti/omap/omap4-epson-embt2ws.dts
+++ b/arch/arm/boot/dts/ti/omap/omap4-epson-embt2ws.dts
@@ -229,6 +229,11 @@ rtc {
interrupts = <11>;
};
+ pwrbutton {
+ compatible = "ti,twl6030-pwrbutton";
+ interrupts = <0>;
+ };
+
ldo2: regulator-ldo2 {
compatible = "ti,twl6032-ldo2";
regulator-min-microvolt = <1000000>;
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/3] dt-bindings: mfd: twl: enable power button also for twl603x
2025-10-30 19:10 ` [PATCH v2 1/3] dt-bindings: mfd: twl: enable power button also for twl603x akemnade
@ 2025-10-30 19:59 ` Conor Dooley
0 siblings, 0 replies; 6+ messages in thread
From: Conor Dooley @ 2025-10-30 19:59 UTC (permalink / raw)
To: akemnade
Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andreas Kemnade, Dmitry Torokhov, Tony Lindgren, Kevin Hilman,
devicetree, linux-kernel, linux-input, linux-omap
[-- Attachment #1: Type: text/plain, Size: 1636 bytes --]
On Thu, Oct 30, 2025 at 08:10:34PM +0100, akemnade@kernel.org wrote:
> From: Andreas Kemnade <andreas@kemnade.info>
>
> TWL603x has also a power button function, so add the corresponding subnode.
> As not in all cases there is a power button connected to the corresponding
> pad of the TWL603x, the functionality can be disabled by
> status = "disabled" or simply not adding the subnode.
> To keep things simple, follow the established design pattern of using const
> interrupts as used also by the other subdevices.
>
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> @@ -225,12 +248,8 @@ properties:
> additionalProperties: false
>
> properties:
> - compatible:
> - const: ti,twl4030-pwrbutton
> - interrupts:
> - items:
> - - items:
> - const: 8
> + compatible: true
> + interrupts: true
I think this should be
properties:
compatible:
enum:
- ti,twl4030-pwrbutton
- ti,twl6030-pwrbutton
interrupts:
maxItems: 1
since we want to keep the widest constraints that apply at the outer
level, rather than removing the constraints entirely.
pw-bot: changes-requested
Cheers,
Conor.
>
> watchdog:
> type: object
> @@ -459,6 +478,11 @@ examples:
> #io-channel-cells = <1>;
> };
>
> + pwrbutton {
> + compatible = "ti,twl6030-pwrbutton";
> + interrupts = <0>;
> + };
> +
> rtc {
> compatible = "ti,twl4030-rtc";
> interrupts = <8>;
>
> --
> 2.47.3
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/3] Input: twl4030 - add TWL603x power button
2025-10-30 19:10 ` [PATCH v2 2/3] Input: twl4030 - add TWL603x power button akemnade
@ 2025-10-31 17:02 ` kernel test robot
0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2025-10-31 17:02 UTC (permalink / raw)
To: akemnade, Lee Jones, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Andreas Kemnade, Dmitry Torokhov, Tony Lindgren,
Kevin Hilman
Cc: oe-kbuild-all, devicetree, linux-kernel, linux-input, linux-omap
Hi,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 3a8660878839faadb4f1a6dd72c3179c1df56787]
url: https://github.com/intel-lab-lkp/linux/commits/akemnade-kernel-org/dt-bindings-mfd-twl-enable-power-button-also-for-twl603x/20251031-031300
base: 3a8660878839faadb4f1a6dd72c3179c1df56787
patch link: https://lore.kernel.org/r/20251030-twl6030-button-v2-2-09653d05a2b1%40kernel.org
patch subject: [PATCH v2 2/3] Input: twl4030 - add TWL603x power button
config: x86_64-randconfig-123-20251031 (https://download.01.org/0day-ci/archive/20251101/202511010024.4O4b58oK-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251101/202511010024.4O4b58oK-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511010024.4O4b58oK-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/input/misc/twl4030-pwrbutton.c:44:31: sparse: sparse: symbol 'twl4030_chipdata' was not declared. Should it be static?
>> drivers/input/misc/twl4030-pwrbutton.c:49:31: sparse: sparse: symbol 'twl6030_chipdata' was not declared. Should it be static?
vim +/twl4030_chipdata +44 drivers/input/misc/twl4030-pwrbutton.c
43
> 44 struct twl_pwrbutton_chipdata twl4030_chipdata = {
45 STS_HW_CONDITIONS_4030,
46 false,
47 };
48
> 49 struct twl_pwrbutton_chipdata twl6030_chipdata = {
50 STS_HW_CONDITIONS_6030,
51 true,
52 };
53
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-10-31 17:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-30 19:10 [PATCH v2 0/3] mfd: twl603x: add power button akemnade
2025-10-30 19:10 ` [PATCH v2 1/3] dt-bindings: mfd: twl: enable power button also for twl603x akemnade
2025-10-30 19:59 ` Conor Dooley
2025-10-30 19:10 ` [PATCH v2 2/3] Input: twl4030 - add TWL603x power button akemnade
2025-10-31 17:02 ` kernel test robot
2025-10-30 19:10 ` [PATCH v2 3/3] ARM: dts: ti/omap: omap4-epson-embt2ws: add powerbutton akemnade
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).