* [PATCH v2 0/9] Fix, extend and support OF to mc13xxx pwrbutton
@ 2025-08-23 14:44 Alexander Kurz
2025-08-23 14:44 ` [PATCH v2 1/9] Input: mc13783-pwrbutton: fix irq mixup Alexander Kurz
` (8 more replies)
0 siblings, 9 replies; 13+ messages in thread
From: Alexander Kurz @ 2025-08-23 14:44 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Dmitry Torokhov, Dzmitry Sankouski, Dr. David Alan Gilbert,
Heiko Stuebner, Uwe Kleine-König, devicetree, linux-input
Cc: linux-kernel, Alexander Kurz
Goal of this patch series is to make the mc13892 PWRON1 button usable,
found e.g. on amazon kindle D01100/D01200 readers.
A ten-year-old IRQ issue needed a fix, mc13783-pwrbutton had to be
extended to the other to mc13xxx PMIC as well (keeping the mc13892
PWRON3 key unsupported for simplicity) and adding OF support.
The implementation has been tested on amazon kindle D01100 and D01200
readers using PWRON1 of a mc13892.
V2:
- Convert dt-bindings from txt to fsl,mc13xxx.yaml and add vendor prefix
to led-control property, causing changes in dts and driver.
- Change node name from pwrbuttons to buttons
- Change property debounce-delay-value to debounce-delay-ms
- Fixed a section mismatch error
- Fixed https://lore.kernel.org/r/202508210551.VzAtE5re-lkp@intel.com/
(wrong index used when converting to array access)
- Usage of generic device properties API in mc13783-pwrbutton.c
- Provide chip-specific max button id via platform_device_id, therefore
swap patches 3 and 4.
Thanks in advance for the review effords,
Cheers, Alexnder
Alexander Kurz (9):
Input: mc13783-pwrbutton: fix irq mixup
Input: mc13783-pwrbutton: use managed resources
Input: mc13783-pwrbutton: convert pdata members to array
Input: mc13783-pwrbutton: enable other mc13xxx PMIC
dt-bindings: mfd: fsl,mc13xxx: convert txt to DT schema
dt-bindings: mfd: fsl,mc13xxx: add buttons node
ARM: dts: imx: Use fsl,led-control as mc13xxx node name
leds: mc13783: use fsl,led-control as node name
Input: mc13783-pwrbutton: add OF support
.../devicetree/bindings/mfd/fsl,mc13xxx.yaml | 272 ++++++++++++++++++
.../devicetree/bindings/mfd/mc13xxx.txt | 156 ----------
.../dts/nxp/imx/imx27-phytec-phycore-som.dtsi | 2 +-
arch/arm/boot/dts/nxp/imx/imx51-zii-rdu1.dts | 2 +-
.../boot/dts/nxp/imx/imx51-zii-scu2-mezz.dts | 2 +-
.../boot/dts/nxp/imx/imx51-zii-scu3-esb.dts | 2 +-
drivers/input/misc/Kconfig | 4 +-
drivers/input/misc/mc13783-pwrbutton.c | 235 +++++++++++----
drivers/leds/leds-mc13783.c | 2 +-
include/linux/mfd/mc13783.h | 4 +-
include/linux/mfd/mc13xxx.h | 10 +-
11 files changed, 461 insertions(+), 230 deletions(-)
create mode 100644 Documentation/devicetree/bindings/mfd/fsl,mc13xxx.yaml
delete mode 100644 Documentation/devicetree/bindings/mfd/mc13xxx.txt
--
2.39.5
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 1/9] Input: mc13783-pwrbutton: fix irq mixup
2025-08-23 14:44 [PATCH v2 0/9] Fix, extend and support OF to mc13xxx pwrbutton Alexander Kurz
@ 2025-08-23 14:44 ` Alexander Kurz
2025-08-23 14:44 ` [PATCH v2 2/9] Input: mc13783-pwrbutton: use managed resources Alexander Kurz
` (7 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Alexander Kurz @ 2025-08-23 14:44 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Dmitry Torokhov, Dzmitry Sankouski, Dr. David Alan Gilbert,
Heiko Stuebner, Uwe Kleine-König, devicetree, linux-input
Cc: linux-kernel, Alexander Kurz
The mfd mc13xxx interrupt handling was migrated to regmap with commit
10f9edaeaa30 ("mfd: mc13xxx: Use regmap irq framework for interrupts").
As a consequence, button_irq() will get called with virtual irq instead
of chip-internal irq now. Add wrappers for the three supported interrupts.
Signed-off-by: Alexander Kurz <akurz@blala.de>
---
drivers/input/misc/mc13783-pwrbutton.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
index 1c7faa9b7afe..4765b25bc9f6 100644
--- a/drivers/input/misc/mc13783-pwrbutton.c
+++ b/drivers/input/misc/mc13783-pwrbutton.c
@@ -88,6 +88,21 @@ static irqreturn_t button_irq(int irq, void *_priv)
return IRQ_HANDLED;
}
+static irqreturn_t button1_irq(int irq, void *_priv)
+{
+ return button_irq(MC13783_IRQ_ONOFD1, _priv);
+}
+
+static irqreturn_t button2_irq(int irq, void *_priv)
+{
+ return button_irq(MC13783_IRQ_ONOFD2, _priv);
+}
+
+static irqreturn_t button3_irq(int irq, void *_priv)
+{
+ return button_irq(MC13783_IRQ_ONOFD3, _priv);
+}
+
static int mc13783_pwrbutton_probe(struct platform_device *pdev)
{
const struct mc13xxx_buttons_platform_data *pdata;
@@ -137,7 +152,7 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
reg |= MC13783_POWER_CONTROL_2_ON1BRSTEN;
err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD1,
- button_irq, "b1on", priv);
+ button1_irq, "b1on", priv);
if (err) {
dev_dbg(&pdev->dev, "Can't request irq\n");
goto free_priv;
@@ -156,7 +171,7 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
reg |= MC13783_POWER_CONTROL_2_ON2BRSTEN;
err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD2,
- button_irq, "b2on", priv);
+ button2_irq, "b2on", priv);
if (err) {
dev_dbg(&pdev->dev, "Can't request irq\n");
goto free_irq_b1;
@@ -175,7 +190,7 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
reg |= MC13783_POWER_CONTROL_2_ON3BRSTEN;
err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD3,
- button_irq, "b3on", priv);
+ button3_irq, "b3on", priv);
if (err) {
dev_dbg(&pdev->dev, "Can't request irq: %d\n", err);
goto free_irq_b2;
--
2.39.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 2/9] Input: mc13783-pwrbutton: use managed resources
2025-08-23 14:44 [PATCH v2 0/9] Fix, extend and support OF to mc13xxx pwrbutton Alexander Kurz
2025-08-23 14:44 ` [PATCH v2 1/9] Input: mc13783-pwrbutton: fix irq mixup Alexander Kurz
@ 2025-08-23 14:44 ` Alexander Kurz
2025-08-23 14:44 ` [PATCH v2 3/9] Input: mc13783-pwrbutton: convert pdata members to array Alexander Kurz
` (6 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Alexander Kurz @ 2025-08-23 14:44 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Dmitry Torokhov, Dzmitry Sankouski, Dr. David Alan Gilbert,
Heiko Stuebner, Uwe Kleine-König, devicetree, linux-input
Cc: linux-kernel, Alexander Kurz
Use devres functionality to simplify resource freeing, dev.parent will
be set by devm_input_allocate_device().
Signed-off-by: Alexander Kurz <akurz@blala.de>
---
drivers/input/misc/mc13783-pwrbutton.c | 28 ++++++++------------------
1 file changed, 8 insertions(+), 20 deletions(-)
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
index 4765b25bc9f6..9fd84b8d163d 100644
--- a/drivers/input/misc/mc13783-pwrbutton.c
+++ b/drivers/input/misc/mc13783-pwrbutton.c
@@ -21,6 +21,7 @@
#include <linux/module.h>
#include <linux/kernel.h>
+#include <linux/device.h>
#include <linux/errno.h>
#include <linux/input.h>
#include <linux/interrupt.h>
@@ -118,18 +119,13 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
return -ENODEV;
}
- pwr = input_allocate_device();
- if (!pwr) {
- dev_dbg(&pdev->dev, "Can't allocate power button\n");
+ pwr = devm_input_allocate_device(&pdev->dev);
+ if (!pwr)
return -ENOMEM;
- }
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
- if (!priv) {
- err = -ENOMEM;
- dev_dbg(&pdev->dev, "Can't allocate power button\n");
- goto free_input_dev;
- }
+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
reg |= (pdata->b1on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON1BDBNC;
reg |= (pdata->b2on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON2BDBNC;
@@ -155,7 +151,7 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
button1_irq, "b1on", priv);
if (err) {
dev_dbg(&pdev->dev, "Can't request irq\n");
- goto free_priv;
+ goto free_mc13xxx_lock;
}
}
@@ -203,7 +199,6 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
pwr->name = "mc13783_pwrbutton";
pwr->phys = "mc13783_pwrbutton/input0";
- pwr->dev.parent = &pdev->dev;
pwr->keycode = priv->keymap;
pwr->keycodemax = ARRAY_SIZE(priv->keymap);
@@ -234,12 +229,8 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
if (pdata->b1on_flags & MC13783_BUTTON_ENABLE)
mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD1, priv);
-free_priv:
+free_mc13xxx_lock:
mc13xxx_unlock(mc13783);
- kfree(priv);
-
-free_input_dev:
- input_free_device(pwr);
return err;
}
@@ -261,9 +252,6 @@ static void mc13783_pwrbutton_remove(struct platform_device *pdev)
mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD1, priv);
mc13xxx_unlock(priv->mc13783);
-
- input_unregister_device(priv->pwr);
- kfree(priv);
}
static struct platform_driver mc13783_pwrbutton_driver = {
--
2.39.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 3/9] Input: mc13783-pwrbutton: convert pdata members to array
2025-08-23 14:44 [PATCH v2 0/9] Fix, extend and support OF to mc13xxx pwrbutton Alexander Kurz
2025-08-23 14:44 ` [PATCH v2 1/9] Input: mc13783-pwrbutton: fix irq mixup Alexander Kurz
2025-08-23 14:44 ` [PATCH v2 2/9] Input: mc13783-pwrbutton: use managed resources Alexander Kurz
@ 2025-08-23 14:44 ` Alexander Kurz
2025-08-23 14:44 ` [PATCH v2 4/9] Input: mc13783-pwrbutton: enable other mc13xxx PMIC Alexander Kurz
` (5 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Alexander Kurz @ 2025-08-23 14:44 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Dmitry Torokhov, Dzmitry Sankouski, Dr. David Alan Gilbert,
Heiko Stuebner, Uwe Kleine-König, devicetree, linux-input
Cc: linux-kernel, Alexander Kurz
As preparation for mc13783-pwrbutton OF support, convert the members of
mc13xxx_buttons_platform_data to arrays to allow index access within
the next commit.
Signed-off-by: Alexander Kurz <akurz@blala.de>
---
drivers/input/misc/mc13783-pwrbutton.c | 54 +++++++++++++-------------
include/linux/mfd/mc13xxx.h | 8 +---
2 files changed, 29 insertions(+), 33 deletions(-)
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
index 9fd84b8d163d..ace9f286fd24 100644
--- a/drivers/input/misc/mc13783-pwrbutton.c
+++ b/drivers/input/misc/mc13783-pwrbutton.c
@@ -127,24 +127,24 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;
- reg |= (pdata->b1on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON1BDBNC;
- reg |= (pdata->b2on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON2BDBNC;
- reg |= (pdata->b3on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON3BDBNC;
+ reg |= (pdata->b_on_flags[0] & 0x3) << MC13783_POWER_CONTROL_2_ON1BDBNC;
+ reg |= (pdata->b_on_flags[1] & 0x3) << MC13783_POWER_CONTROL_2_ON2BDBNC;
+ reg |= (pdata->b_on_flags[2] & 0x3) << MC13783_POWER_CONTROL_2_ON3BDBNC;
priv->pwr = pwr;
priv->mc13783 = mc13783;
mc13xxx_lock(mc13783);
- if (pdata->b1on_flags & MC13783_BUTTON_ENABLE) {
- priv->keymap[0] = pdata->b1on_key;
- if (pdata->b1on_key != KEY_RESERVED)
- __set_bit(pdata->b1on_key, pwr->keybit);
+ if (pdata->b_on_flags[0] & MC13783_BUTTON_ENABLE) {
+ priv->keymap[0] = pdata->b_on_key[0];
+ if (pdata->b_on_key[0] != KEY_RESERVED)
+ __set_bit(pdata->b_on_key[0], pwr->keybit);
- if (pdata->b1on_flags & MC13783_BUTTON_POL_INVERT)
+ if (pdata->b_on_flags[0] & MC13783_BUTTON_POL_INVERT)
priv->flags |= MC13783_PWRB_B1_POL_INVERT;
- if (pdata->b1on_flags & MC13783_BUTTON_RESET_EN)
+ if (pdata->b_on_flags[0] & MC13783_BUTTON_RESET_EN)
reg |= MC13783_POWER_CONTROL_2_ON1BRSTEN;
err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD1,
@@ -155,15 +155,15 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
}
}
- if (pdata->b2on_flags & MC13783_BUTTON_ENABLE) {
- priv->keymap[1] = pdata->b2on_key;
- if (pdata->b2on_key != KEY_RESERVED)
- __set_bit(pdata->b2on_key, pwr->keybit);
+ if (pdata->b_on_flags[1] & MC13783_BUTTON_ENABLE) {
+ priv->keymap[1] = pdata->b_on_key[1];
+ if (pdata->b_on_key[1] != KEY_RESERVED)
+ __set_bit(pdata->b_on_key[1], pwr->keybit);
- if (pdata->b2on_flags & MC13783_BUTTON_POL_INVERT)
+ if (pdata->b_on_flags[1] & MC13783_BUTTON_POL_INVERT)
priv->flags |= MC13783_PWRB_B2_POL_INVERT;
- if (pdata->b2on_flags & MC13783_BUTTON_RESET_EN)
+ if (pdata->b_on_flags[1] & MC13783_BUTTON_RESET_EN)
reg |= MC13783_POWER_CONTROL_2_ON2BRSTEN;
err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD2,
@@ -174,15 +174,15 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
}
}
- if (pdata->b3on_flags & MC13783_BUTTON_ENABLE) {
- priv->keymap[2] = pdata->b3on_key;
- if (pdata->b3on_key != KEY_RESERVED)
- __set_bit(pdata->b3on_key, pwr->keybit);
+ if (pdata->b_on_flags[2] & MC13783_BUTTON_ENABLE) {
+ priv->keymap[2] = pdata->b_on_key[2];
+ if (pdata->b_on_key[2] != KEY_RESERVED)
+ __set_bit(pdata->b_on_key[2], pwr->keybit);
- if (pdata->b3on_flags & MC13783_BUTTON_POL_INVERT)
+ if (pdata->b_on_flags[2] & MC13783_BUTTON_POL_INVERT)
priv->flags |= MC13783_PWRB_B3_POL_INVERT;
- if (pdata->b3on_flags & MC13783_BUTTON_RESET_EN)
+ if (pdata->b_on_flags[2] & MC13783_BUTTON_RESET_EN)
reg |= MC13783_POWER_CONTROL_2_ON3BRSTEN;
err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD3,
@@ -218,15 +218,15 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
free_irq:
mc13xxx_lock(mc13783);
- if (pdata->b3on_flags & MC13783_BUTTON_ENABLE)
+ if (pdata->b_on_flags[2] & MC13783_BUTTON_ENABLE)
mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD3, priv);
free_irq_b2:
- if (pdata->b2on_flags & MC13783_BUTTON_ENABLE)
+ if (pdata->b_on_flags[1] & MC13783_BUTTON_ENABLE)
mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD2, priv);
free_irq_b1:
- if (pdata->b1on_flags & MC13783_BUTTON_ENABLE)
+ if (pdata->b_on_flags[0] & MC13783_BUTTON_ENABLE)
mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD1, priv);
free_mc13xxx_lock:
@@ -244,11 +244,11 @@ static void mc13783_pwrbutton_remove(struct platform_device *pdev)
mc13xxx_lock(priv->mc13783);
- if (pdata->b3on_flags & MC13783_BUTTON_ENABLE)
+ if (pdata->b_on_flags[2] & MC13783_BUTTON_ENABLE)
mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD3, priv);
- if (pdata->b2on_flags & MC13783_BUTTON_ENABLE)
+ if (pdata->b_on_flags[1] & MC13783_BUTTON_ENABLE)
mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD2, priv);
- if (pdata->b1on_flags & MC13783_BUTTON_ENABLE)
+ if (pdata->b_on_flags[0] & MC13783_BUTTON_ENABLE)
mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD1, priv);
mc13xxx_unlock(priv->mc13783);
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index f372926d5894..0393083af28a 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -187,12 +187,8 @@ struct mc13xxx_leds_platform_data {
#define MC13783_BUTTON_RESET_EN (1 << 4)
struct mc13xxx_buttons_platform_data {
- int b1on_flags;
- unsigned short b1on_key;
- int b2on_flags;
- unsigned short b2on_key;
- int b3on_flags;
- unsigned short b3on_key;
+ int b_on_flags[3];
+ unsigned int b_on_key[3];
};
#define MC13783_TS_ATO_FIRST false
--
2.39.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 4/9] Input: mc13783-pwrbutton: enable other mc13xxx PMIC
2025-08-23 14:44 [PATCH v2 0/9] Fix, extend and support OF to mc13xxx pwrbutton Alexander Kurz
` (2 preceding siblings ...)
2025-08-23 14:44 ` [PATCH v2 3/9] Input: mc13783-pwrbutton: convert pdata members to array Alexander Kurz
@ 2025-08-23 14:44 ` Alexander Kurz
2025-08-23 14:44 ` [PATCH v2 5/9] dt-bindings: mfd: fsl,mc13xxx: convert txt to DT schema Alexander Kurz
` (4 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Alexander Kurz @ 2025-08-23 14:44 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Dmitry Torokhov, Dzmitry Sankouski, Dr. David Alan Gilbert,
Heiko Stuebner, Uwe Kleine-König, devicetree, linux-input
Cc: linux-kernel, Alexander Kurz
All three mc13xxx types do feature two common power buttons referred as
ONOFD[12] (mc13783) and PWRON[12] (mc13892/mc34708) in the SoC reference
manuals. Add support for PWRON[12] (mc13892/mc34708) but skip support for
button PWRON3 (mc13892) for sake of simplicity.
Signed-off-by: Alexander Kurz <akurz@blala.de>
---
drivers/input/misc/Kconfig | 4 +--
drivers/input/misc/mc13783-pwrbutton.c | 44 +++++++++++++++++++++++---
include/linux/mfd/mc13783.h | 4 +--
include/linux/mfd/mc13xxx.h | 2 ++
4 files changed, 46 insertions(+), 8 deletions(-)
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 0fb21c99a5e3..b66e920369f2 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -276,8 +276,8 @@ config INPUT_MC13783_PWRBUTTON
tristate "MC13783 ON buttons"
depends on MFD_MC13XXX
help
- Support the ON buttons of MC13783 PMIC as an input device
- reporting power button status.
+ Support the ON buttons of MC13783/MC13892/MC34708 PMIC as an input
+ device reporting power button status.
To compile this driver as a module, choose M here: the module
will be called mc13783-pwrbutton.
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
index ace9f286fd24..c9eea57ceedd 100644
--- a/drivers/input/misc/mc13783-pwrbutton.c
+++ b/drivers/input/misc/mc13783-pwrbutton.c
@@ -30,16 +30,21 @@
#include <linux/sched.h>
#include <linux/slab.h>
+struct mc13xxx_button_devtype {
+ int button_id_max;
+};
+
struct mc13783_pwrb {
struct input_dev *pwr;
struct mc13xxx *mc13783;
-#define MC13783_PWRB_B1_POL_INVERT (1 << 0)
-#define MC13783_PWRB_B2_POL_INVERT (1 << 1)
-#define MC13783_PWRB_B3_POL_INVERT (1 << 2)
int flags;
unsigned short keymap[3];
};
+#define MC13783_PWRB_B1_POL_INVERT (1 << 0)
+#define MC13783_PWRB_B2_POL_INVERT (1 << 1)
+#define MC13783_PWRB_B3_POL_INVERT (1 << 2)
+
#define MC13783_REG_INTERRUPT_SENSE_1 5
#define MC13783_IRQSENSE1_ONOFD1S (1 << 3)
#define MC13783_IRQSENSE1_ONOFD2S (1 << 4)
@@ -108,6 +113,8 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
{
const struct mc13xxx_buttons_platform_data *pdata;
struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent);
+ struct mc13xxx_button_devtype *devtype =
+ (struct mc13xxx_button_devtype *)pdev->id_entry->driver_data;
struct input_dev *pwr;
struct mc13783_pwrb *priv;
int err = 0;
@@ -127,6 +134,11 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;
+ if (devtype->button_id_max < 2 && pdata->b_on_flags[2] & 0x3) {
+ dev_err(&pdev->dev, "button not supported\n");
+ return -ENODEV;
+ }
+
reg |= (pdata->b_on_flags[0] & 0x3) << MC13783_POWER_CONTROL_2_ON1BDBNC;
reg |= (pdata->b_on_flags[1] & 0x3) << MC13783_POWER_CONTROL_2_ON2BDBNC;
reg |= (pdata->b_on_flags[2] & 0x3) << MC13783_POWER_CONTROL_2_ON3BDBNC;
@@ -239,12 +251,15 @@ static void mc13783_pwrbutton_remove(struct platform_device *pdev)
{
struct mc13783_pwrb *priv = platform_get_drvdata(pdev);
const struct mc13xxx_buttons_platform_data *pdata;
+ struct mc13xxx_button_devtype *devtype =
+ (struct mc13xxx_button_devtype *)pdev->id_entry->driver_data;
pdata = dev_get_platdata(&pdev->dev);
mc13xxx_lock(priv->mc13783);
- if (pdata->b_on_flags[2] & MC13783_BUTTON_ENABLE)
+ if (devtype->button_id_max >= 2 &&
+ pdata->b_on_flags[2] & MC13783_BUTTON_ENABLE)
mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD3, priv);
if (pdata->b_on_flags[1] & MC13783_BUTTON_ENABLE)
mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD2, priv);
@@ -254,7 +269,28 @@ static void mc13783_pwrbutton_remove(struct platform_device *pdev)
mc13xxx_unlock(priv->mc13783);
}
+static const struct mc13xxx_button_devtype mc13783_button_devtype = {
+ .button_id_max = 2,
+};
+
+static const struct mc13xxx_button_devtype mc13892_button_devtype = {
+ /* PWRON3 is not supported yet. */
+ .button_id_max = 1,
+};
+
+static const struct mc13xxx_button_devtype mc34708_button_devtype = {
+ .button_id_max = 1,
+};
+
+static const struct platform_device_id mc13xxx_pwrbutton_idtable[] = {
+ { "mc13783-pwrbutton", (kernel_ulong_t)&mc13783_button_devtype },
+ { "mc13892-pwrbutton", (kernel_ulong_t)&mc13892_button_devtype },
+ { "mc34708-pwrbutton", (kernel_ulong_t)&mc34708_button_devtype },
+ { /* sentinel */ }
+};
+
static struct platform_driver mc13783_pwrbutton_driver = {
+ .id_table = mc13xxx_pwrbutton_idtable,
.probe = mc13783_pwrbutton_probe,
.remove = mc13783_pwrbutton_remove,
.driver = {
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h
index c25b1676741b..ab6db774e1fa 100644
--- a/include/linux/mfd/mc13783.h
+++ b/include/linux/mfd/mc13783.h
@@ -65,8 +65,8 @@
#define MC13783_IRQ_UDM 23
#define MC13783_IRQ_1HZ MC13XXX_IRQ_1HZ
#define MC13783_IRQ_TODA MC13XXX_IRQ_TODA
-#define MC13783_IRQ_ONOFD1 27
-#define MC13783_IRQ_ONOFD2 28
+#define MC13783_IRQ_ONOFD1 MC13XXX_IRQ_PWRON1
+#define MC13783_IRQ_ONOFD2 MC13XXX_IRQ_PWRON2
#define MC13783_IRQ_ONOFD3 29
#define MC13783_IRQ_SYSRST MC13XXX_IRQ_SYSRST
#define MC13783_IRQ_RTCRST MC13XXX_IRQ_RTCRST
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index 0393083af28a..36e5e7de7cb2 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -67,6 +67,8 @@ int mc13xxx_irq_unmask(struct mc13xxx *mc13xxx, int irq);
#define MC13XXX_IRQ_LOBATH 14
#define MC13XXX_IRQ_1HZ 24
#define MC13XXX_IRQ_TODA 25
+#define MC13XXX_IRQ_PWRON1 27
+#define MC13XXX_IRQ_PWRON2 28
#define MC13XXX_IRQ_SYSRST 30
#define MC13XXX_IRQ_RTCRST 31
#define MC13XXX_IRQ_PC 32
--
2.39.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 5/9] dt-bindings: mfd: fsl,mc13xxx: convert txt to DT schema
2025-08-23 14:44 [PATCH v2 0/9] Fix, extend and support OF to mc13xxx pwrbutton Alexander Kurz
` (3 preceding siblings ...)
2025-08-23 14:44 ` [PATCH v2 4/9] Input: mc13783-pwrbutton: enable other mc13xxx PMIC Alexander Kurz
@ 2025-08-23 14:44 ` Alexander Kurz
2025-08-26 23:03 ` Rob Herring
2025-08-23 14:44 ` [PATCH v2 6/9] dt-bindings: mfd: fsl,mc13xxx: add buttons node Alexander Kurz
` (3 subsequent siblings)
8 siblings, 1 reply; 13+ messages in thread
From: Alexander Kurz @ 2025-08-23 14:44 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Dmitry Torokhov, Dzmitry Sankouski, Dr. David Alan Gilbert,
Heiko Stuebner, Uwe Kleine-König, devicetree, linux-input
Cc: linux-kernel, Alexander Kurz
Convert the txt mc13xxx bindings to DT schema attempting to keep most
information. The nodes codec and touchscreen are not part of the new
schema since it was only briefly mentioned before.
Following the convention, rename led-control to fsl,led-control.
Signed-off-by: Alexander Kurz <akurz@blala.de>
---
.../devicetree/bindings/mfd/fsl,mc13xxx.yaml | 214 ++++++++++++++++++
.../devicetree/bindings/mfd/mc13xxx.txt | 156 -------------
2 files changed, 214 insertions(+), 156 deletions(-)
create mode 100644 Documentation/devicetree/bindings/mfd/fsl,mc13xxx.yaml
delete mode 100644 Documentation/devicetree/bindings/mfd/mc13xxx.txt
diff --git a/Documentation/devicetree/bindings/mfd/fsl,mc13xxx.yaml b/Documentation/devicetree/bindings/mfd/fsl,mc13xxx.yaml
new file mode 100644
index 000000000000..94e2f6557376
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/fsl,mc13xxx.yaml
@@ -0,0 +1,214 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/fsl,mc13xxx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Freescale MC13xxx Power Management Integrated Circuits (PMIC)
+
+maintainers:
+ - Alexander Kurz <akurz@blala.de>
+
+description:
+ The MC13xxx PMIC series consists of the three models MC13783, MC13892
+ and MC34708 and provide regulators and other features like RTC, ADC,
+ LED, touchscreen, codec and input buttons.
+
+ Link to datasheets
+ https://www.nxp.com/docs/en/data-sheet/MC13783.pdf
+ https://www.nxp.com/docs/en/data-sheet/MC13892.pdf
+ https://www.nxp.com/docs/en/data-sheet/MC34708.pdf
+
+properties:
+ compatible:
+ enum:
+ - fsl,mc13783
+ - fsl,mc13892
+ - fsl,mc34708
+
+ reg:
+ description: I2C slave address or SPI chip select number.
+ maxItems: 1
+
+ spi-max-frequency: true
+
+ spi-cs-high: true
+
+ system-power-controller: true
+
+ interrupts:
+ maxItems: 1
+
+ leds:
+ type: object
+ $ref: /schemas/leds/common.yaml#
+ description: |
+ Leds
+ properties:
+ reg:
+ description: |
+ One of
+ MC13783 LED IDs
+ 0: Main display
+ 1: AUX display
+ 2: Keypad
+ 3: Red 1
+ 4: Green 1
+ 5: Blue 1
+ 6: Red 2
+ 7: Green 2
+ 8: Blue 2
+ 9: Red 3
+ 10: Green 3
+ 11: Blue 3
+ MC13892 LED IDs
+ 0: Main display
+ 1: AUX display
+ 2: Keypad
+ 3: Red
+ 4: Green
+ 5: Blue
+ MC34708 LED IDs
+ 0: Charger Red
+ 1: Charger Green
+ maxItems: 1
+ fsl,led-control:
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ description: |
+ Setting for LED-Control register array length depends on model,
+ mc13783: 6, mc13892: 4, mc34708: 1
+
+ regulators:
+ type: object
+ $ref: /schemas/regulator/regulator.yaml#
+ description: |
+ List of child nodes specifying the regulators, depending on chip variant:
+ * MC13783: gpo[1-4], pwgt[12]spi, sw[12][ab], sw3, vaudio, vcam, vdig,
+ vesim, vgen, viohi, violo, vmmc[12], vrf[12], vrfbg, vrfcp, vrfdig,
+ vrfref, vsim and vvib.
+ * MC13892: gpo[1-4], pwgt[12]spi, sw[1-4], swbst, vaudio, vcam, vcoincell,
+ vdig, vgen[1-3], viohi, vpll, vsd, vusb, vusb2, vvideo.
+ Each child node is defined using the standard binding for regulators and
+ the optional regulator properties defined below.
+
+ fsl,mc13xxx-uses-adc:
+ type: boolean
+ description: Indicate the ADC is being used
+
+ fsl,mc13xxx-uses-codec:
+ type: boolean
+ description: Indicate the Audio Codec is being used
+
+ fsl,mc13xxx-uses-rtc:
+ type: boolean
+ description: Indicate the RTC is being used
+
+ fsl,mc13xxx-uses-touch:
+ type: boolean
+ description: Indicate the touchscreen controller is being used
+
+required:
+ - compatible
+ - reg
+
+allOf:
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: fsl,mc13783
+ then:
+ properties:
+ leds:
+ properties:
+ fsl,led-control:
+ minItems: 6
+ maxItems: 6
+ regulators:
+ patternProperties:
+ "^gpo[1-4]|pwgt[12]spi|sw[12][ab]|sw3|vaudio|vcam|vdig|vesim|vgen|viohi|violo|vmmc[12]|vrf[12]|vrfbg|vrfcp|vrfdig|vrfref|vsim|vvib$":
+ type: object
+ $ref: /schemas/regulator/regulator.yaml#
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: fsl,mc13892
+ then:
+ properties:
+ leds:
+ properties:
+ fsl,led-control:
+ minItems: 4
+ maxItems: 4
+ regulators:
+ patternProperties:
+ "^gpo[1-4]|pwgt[12]spi|sw[1-4]|swbst|vaudio|vcam|vcoincell|vdig|vgen[1-3]|viohi|vpll|vsd|vusb|vusb2|vvideo$":
+ type: object
+ $ref: /schemas/regulator/regulator.yaml#
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: fsl,mc34708
+ then:
+ properties:
+ leds:
+ properties:
+ fsl,led-control:
+ minItems: 1
+ maxItems: 1
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+ #include <dt-bindings/interrupt-controller/irq.h>
+ #include <dt-bindings/leds/common.h>
+
+ spi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ pmic: mc13892@0 {
+ compatible = "fsl,mc13892";
+ reg = <0>;
+ spi-max-frequency = <1000000>;
+ spi-cs-high;
+ interrupt-parent = <&gpio0>;
+ interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
+ fsl,mc13xxx-uses-rtc;
+ fsl,mc13xxx-uses-adc;
+
+ leds {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ fsl,led-control = <0x000 0x000 0x0e0 0x000>;
+
+ sysled@3 {
+ reg = <3>;
+ label = "system:red:live";
+ linux,default-trigger = "heartbeat";
+ };
+ };
+
+ regulators {
+ sw1_reg: sw1 {
+ regulator-min-microvolt = <600000>;
+ regulator-max-microvolt = <1375000>;
+ regulator-boot-on;
+ regulator-always-on;
+ };
+
+ sw2_reg: sw2 {
+ regulator-min-microvolt = <900000>;
+ regulator-max-microvolt = <1850000>;
+ regulator-boot-on;
+ regulator-always-on;
+ };
+ };
+ };
+ };
diff --git a/Documentation/devicetree/bindings/mfd/mc13xxx.txt b/Documentation/devicetree/bindings/mfd/mc13xxx.txt
deleted file mode 100644
index 8261ea73278a..000000000000
--- a/Documentation/devicetree/bindings/mfd/mc13xxx.txt
+++ /dev/null
@@ -1,156 +0,0 @@
-* Freescale MC13783/MC13892 Power Management Integrated Circuit (PMIC)
-
-Required properties:
-- compatible : Should be "fsl,mc13783" or "fsl,mc13892"
-
-Optional properties:
-- fsl,mc13xxx-uses-adc : Indicate the ADC is being used
-- fsl,mc13xxx-uses-codec : Indicate the Audio Codec is being used
-- fsl,mc13xxx-uses-rtc : Indicate the RTC is being used
-- fsl,mc13xxx-uses-touch : Indicate the touchscreen controller is being used
-
-Sub-nodes:
-- codec: Contain the Audio Codec node.
- - adc-port: Contain PMIC SSI port number used for ADC.
- - dac-port: Contain PMIC SSI port number used for DAC.
-- leds : Contain the led nodes and initial register values in property
- "led-control". Number of register depends of used IC, for MC13783 is 6,
- for MC13892 is 4, for MC34708 is 1. See datasheet for bits definitions of
- these registers.
- - #address-cells: Must be 1.
- - #size-cells: Must be 0.
- Each led node should contain "reg", which used as LED ID (described below).
- Optional properties "label" and "linux,default-trigger" is described in
- Documentation/devicetree/bindings/leds/common.txt.
-- regulators : Contain the regulator nodes. The regulators are bound using
- their names as listed below with their registers and bits for enabling.
-
-MC13783 LED IDs:
- 0 : Main display
- 1 : AUX display
- 2 : Keypad
- 3 : Red 1
- 4 : Green 1
- 5 : Blue 1
- 6 : Red 2
- 7 : Green 2
- 8 : Blue 2
- 9 : Red 3
- 10 : Green 3
- 11 : Blue 3
-
-MC13892 LED IDs:
- 0 : Main display
- 1 : AUX display
- 2 : Keypad
- 3 : Red
- 4 : Green
- 5 : Blue
-
-MC34708 LED IDs:
- 0 : Charger Red
- 1 : Charger Green
-
-MC13783 regulators:
- sw1a : regulator SW1A (register 24, bit 0)
- sw1b : regulator SW1B (register 25, bit 0)
- sw2a : regulator SW2A (register 26, bit 0)
- sw2b : regulator SW2B (register 27, bit 0)
- sw3 : regulator SW3 (register 29, bit 20)
- vaudio : regulator VAUDIO (register 32, bit 0)
- viohi : regulator VIOHI (register 32, bit 3)
- violo : regulator VIOLO (register 32, bit 6)
- vdig : regulator VDIG (register 32, bit 9)
- vgen : regulator VGEN (register 32, bit 12)
- vrfdig : regulator VRFDIG (register 32, bit 15)
- vrfref : regulator VRFREF (register 32, bit 18)
- vrfcp : regulator VRFCP (register 32, bit 21)
- vsim : regulator VSIM (register 33, bit 0)
- vesim : regulator VESIM (register 33, bit 3)
- vcam : regulator VCAM (register 33, bit 6)
- vrfbg : regulator VRFBG (register 33, bit 9)
- vvib : regulator VVIB (register 33, bit 11)
- vrf1 : regulator VRF1 (register 33, bit 12)
- vrf2 : regulator VRF2 (register 33, bit 15)
- vmmc1 : regulator VMMC1 (register 33, bit 18)
- vmmc2 : regulator VMMC2 (register 33, bit 21)
- gpo1 : regulator GPO1 (register 34, bit 6)
- gpo2 : regulator GPO2 (register 34, bit 8)
- gpo3 : regulator GPO3 (register 34, bit 10)
- gpo4 : regulator GPO4 (register 34, bit 12)
- pwgt1spi : regulator PWGT1SPI (register 34, bit 15)
- pwgt2spi : regulator PWGT2SPI (register 34, bit 16)
-
-MC13892 regulators:
- vcoincell : regulator VCOINCELL (register 13, bit 23)
- sw1 : regulator SW1 (register 24, bit 0)
- sw2 : regulator SW2 (register 25, bit 0)
- sw3 : regulator SW3 (register 26, bit 0)
- sw4 : regulator SW4 (register 27, bit 0)
- swbst : regulator SWBST (register 29, bit 20)
- vgen1 : regulator VGEN1 (register 32, bit 0)
- viohi : regulator VIOHI (register 32, bit 3)
- vdig : regulator VDIG (register 32, bit 9)
- vgen2 : regulator VGEN2 (register 32, bit 12)
- vpll : regulator VPLL (register 32, bit 15)
- vusb2 : regulator VUSB2 (register 32, bit 18)
- vgen3 : regulator VGEN3 (register 33, bit 0)
- vcam : regulator VCAM (register 33, bit 6)
- vvideo : regulator VVIDEO (register 33, bit 12)
- vaudio : regulator VAUDIO (register 33, bit 15)
- vsd : regulator VSD (register 33, bit 18)
- gpo1 : regulator GPO1 (register 34, bit 6)
- gpo2 : regulator GPO2 (register 34, bit 8)
- gpo3 : regulator GPO3 (register 34, bit 10)
- gpo4 : regulator GPO4 (register 34, bit 12)
- pwgt1spi : regulator PWGT1SPI (register 34, bit 15)
- pwgt2spi : regulator PWGT2SPI (register 34, bit 16)
- vusb : regulator VUSB (register 50, bit 3)
-
- The bindings details of individual regulator device can be found in:
- Documentation/devicetree/bindings/regulator/regulator.txt
-
-Examples:
-
-ecspi@70010000 { /* ECSPI1 */
- cs-gpios = <&gpio4 24 0>, /* GPIO4_24 */
- <&gpio4 25 0>; /* GPIO4_25 */
-
- pmic: mc13892@0 {
- #address-cells = <1>;
- #size-cells = <0>;
- compatible = "fsl,mc13892";
- spi-max-frequency = <6000000>;
- reg = <0>;
- interrupt-parent = <&gpio0>;
- interrupts = <8>;
-
- leds {
- #address-cells = <1>;
- #size-cells = <0>;
- led-control = <0x000 0x000 0x0e0 0x000>;
-
- sysled@3 {
- reg = <3>;
- label = "system:red:live";
- linux,default-trigger = "heartbeat";
- };
- };
-
- regulators {
- sw1_reg: mc13892__sw1 {
- regulator-min-microvolt = <600000>;
- regulator-max-microvolt = <1375000>;
- regulator-boot-on;
- regulator-always-on;
- };
-
- sw2_reg: mc13892__sw2 {
- regulator-min-microvolt = <900000>;
- regulator-max-microvolt = <1850000>;
- regulator-boot-on;
- regulator-always-on;
- };
- };
- };
-};
--
2.39.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 6/9] dt-bindings: mfd: fsl,mc13xxx: add buttons node
2025-08-23 14:44 [PATCH v2 0/9] Fix, extend and support OF to mc13xxx pwrbutton Alexander Kurz
` (4 preceding siblings ...)
2025-08-23 14:44 ` [PATCH v2 5/9] dt-bindings: mfd: fsl,mc13xxx: convert txt to DT schema Alexander Kurz
@ 2025-08-23 14:44 ` Alexander Kurz
2025-08-26 23:08 ` Rob Herring
2025-08-23 14:44 ` [PATCH v2 7/9] ARM: dts: imx: Use fsl,led-control as mc13xxx node name Alexander Kurz
` (2 subsequent siblings)
8 siblings, 1 reply; 13+ messages in thread
From: Alexander Kurz @ 2025-08-23 14:44 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Dmitry Torokhov, Dzmitry Sankouski, Dr. David Alan Gilbert,
Heiko Stuebner, Uwe Kleine-König, devicetree, linux-input
Cc: linux-kernel, Alexander Kurz
Add a buttons node and properties describing the "ONOFD" (MC13783) and
"PWRON" (MC13892/MC34708) buttons available in the fsl,mc13xxx PMIC ICs.
Signed-off-by: Alexander Kurz <akurz@blala.de>
---
.../devicetree/bindings/mfd/fsl,mc13xxx.yaml | 58 +++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/Documentation/devicetree/bindings/mfd/fsl,mc13xxx.yaml b/Documentation/devicetree/bindings/mfd/fsl,mc13xxx.yaml
index 94e2f6557376..761267b42c85 100644
--- a/Documentation/devicetree/bindings/mfd/fsl,mc13xxx.yaml
+++ b/Documentation/devicetree/bindings/mfd/fsl,mc13xxx.yaml
@@ -39,6 +39,41 @@ properties:
interrupts:
maxItems: 1
+ buttons:
+ type: object
+ $ref: /schemas/input/input.yaml#
+ description: Buttons
+ properties:
+ reg:
+ description: |
+ One of
+ MC13783 BUTTON IDs:
+ 0: ONOFD1
+ 1: ONOFD2
+ 2: ONOFD3
+ MC13892 BUTTON IDs:
+ 0: PWRON1
+ 1: PWRON2
+ 2: PWRON3
+ MC34708 BUTTON IDs:
+ 0: PWRON1
+ 1: PWRON2
+
+ debounce-delay-ms:
+ enum: [0, 30, 150, 750]
+ default: 30
+ description: |
+ Sets the debouncing delay in milliseconds.
+ Valid values: 0, 30, 150 and 750ms.
+
+ active-low:
+ description: Set active when pin is pulled low.
+
+ fsl,enable-reset:
+ description: |
+ Setting of the global reset option.
+ type: boolean
+
leds:
type: object
$ref: /schemas/leds/common.yaml#
@@ -119,6 +154,10 @@ allOf:
const: fsl,mc13783
then:
properties:
+ buttons:
+ properties:
+ reg:
+ enum: [0, 1, 2]
leds:
properties:
fsl,led-control:
@@ -137,6 +176,10 @@ allOf:
const: fsl,mc13892
then:
properties:
+ buttons:
+ properties:
+ reg:
+ enum: [0, 1, 2]
leds:
properties:
fsl,led-control:
@@ -155,6 +198,10 @@ allOf:
const: fsl,mc34708
then:
properties:
+ buttons:
+ properties:
+ reg:
+ enum: [0, 1]
leds:
properties:
fsl,led-control:
@@ -183,6 +230,17 @@ examples:
fsl,mc13xxx-uses-rtc;
fsl,mc13xxx-uses-adc;
+ buttons {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ onkey1@0 {
+ reg = <0>;
+ debounce-delay-ms = <30>;
+ active-low;
+ fsl,enable-reset;
+ };
+ };
+
leds {
#address-cells = <1>;
#size-cells = <0>;
--
2.39.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 7/9] ARM: dts: imx: Use fsl,led-control as mc13xxx node name
2025-08-23 14:44 [PATCH v2 0/9] Fix, extend and support OF to mc13xxx pwrbutton Alexander Kurz
` (5 preceding siblings ...)
2025-08-23 14:44 ` [PATCH v2 6/9] dt-bindings: mfd: fsl,mc13xxx: add buttons node Alexander Kurz
@ 2025-08-23 14:44 ` Alexander Kurz
2025-08-23 14:44 ` [PATCH v2 8/9] leds: mc13783: use fsl,led-control as " Alexander Kurz
2025-08-23 14:44 ` [PATCH v2 9/9] Input: mc13783-pwrbutton: add OF support Alexander Kurz
8 siblings, 0 replies; 13+ messages in thread
From: Alexander Kurz @ 2025-08-23 14:44 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Dmitry Torokhov, Dzmitry Sankouski, Dr. David Alan Gilbert,
Heiko Stuebner, Uwe Kleine-König, devicetree, linux-input
Cc: linux-kernel, Alexander Kurz
According to fsl,mc13xxx.yaml, the node name for led-control is
vendor prefixed. Change it accordingly.
Signed-off-by: Alexander Kurz <akurz@blala.de>
---
arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-som.dtsi | 2 +-
arch/arm/boot/dts/nxp/imx/imx51-zii-rdu1.dts | 2 +-
arch/arm/boot/dts/nxp/imx/imx51-zii-scu2-mezz.dts | 2 +-
arch/arm/boot/dts/nxp/imx/imx51-zii-scu3-esb.dts | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-som.dtsi b/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-som.dtsi
index e958d7286ae9..7785eda84a5d 100644
--- a/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-som.dtsi
+++ b/arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-som.dtsi
@@ -75,7 +75,7 @@ pmic: mc13783@0 {
pmicleds: leds {
#address-cells = <1>;
#size-cells = <0>;
- led-control = <0x001 0x000 0x000 0x000 0x000 0x000>;
+ fsl,led-control = <0x001 0x000 0x000 0x000 0x000 0x000>;
};
regulators {
diff --git a/arch/arm/boot/dts/nxp/imx/imx51-zii-rdu1.dts b/arch/arm/boot/dts/nxp/imx/imx51-zii-rdu1.dts
index 06545a6052f7..6bc749c70a44 100644
--- a/arch/arm/boot/dts/nxp/imx/imx51-zii-rdu1.dts
+++ b/arch/arm/boot/dts/nxp/imx/imx51-zii-rdu1.dts
@@ -396,7 +396,7 @@ vgen3_reg: vgen3 {
leds {
#address-cells = <1>;
#size-cells = <0>;
- led-control = <0x0 0x0 0x3f83f8 0x0>;
+ fsl,led-control = <0x0 0x0 0x3f83f8 0x0>;
sysled0@3 {
reg = <3>;
diff --git a/arch/arm/boot/dts/nxp/imx/imx51-zii-scu2-mezz.dts b/arch/arm/boot/dts/nxp/imx/imx51-zii-scu2-mezz.dts
index 26eb7a9506e4..1bc78e88d2a9 100644
--- a/arch/arm/boot/dts/nxp/imx/imx51-zii-scu2-mezz.dts
+++ b/arch/arm/boot/dts/nxp/imx/imx51-zii-scu2-mezz.dts
@@ -223,7 +223,7 @@ vgen3_reg: vgen3 {
leds {
#address-cells = <1>;
#size-cells = <0>;
- led-control = <0x0 0x0 0x3f83f8 0x0>;
+ fsl,led-control = <0x0 0x0 0x3f83f8 0x0>;
sysled3: led3@3 {
reg = <3>;
diff --git a/arch/arm/boot/dts/nxp/imx/imx51-zii-scu3-esb.dts b/arch/arm/boot/dts/nxp/imx/imx51-zii-scu3-esb.dts
index 19a3b142c964..a4fbfaf532ed 100644
--- a/arch/arm/boot/dts/nxp/imx/imx51-zii-scu3-esb.dts
+++ b/arch/arm/boot/dts/nxp/imx/imx51-zii-scu3-esb.dts
@@ -151,7 +151,7 @@ vgen3_reg: vgen3 {
leds {
#address-cells = <1>;
#size-cells = <0>;
- led-control = <0x0 0x0 0x3f83f8 0x0>;
+ fsl,led-control = <0x0 0x0 0x3f83f8 0x0>;
sysled3: led3@3 {
reg = <3>;
--
2.39.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 8/9] leds: mc13783: use fsl,led-control as node name
2025-08-23 14:44 [PATCH v2 0/9] Fix, extend and support OF to mc13xxx pwrbutton Alexander Kurz
` (6 preceding siblings ...)
2025-08-23 14:44 ` [PATCH v2 7/9] ARM: dts: imx: Use fsl,led-control as mc13xxx node name Alexander Kurz
@ 2025-08-23 14:44 ` Alexander Kurz
2025-09-03 11:59 ` Lee Jones
2025-08-23 14:44 ` [PATCH v2 9/9] Input: mc13783-pwrbutton: add OF support Alexander Kurz
8 siblings, 1 reply; 13+ messages in thread
From: Alexander Kurz @ 2025-08-23 14:44 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Dmitry Torokhov, Dzmitry Sankouski, Dr. David Alan Gilbert,
Heiko Stuebner, Uwe Kleine-König, devicetree, linux-input
Cc: linux-kernel, Alexander Kurz
According to fsl,mc13xxx.yaml, the node name for led-control is
vendor prefixed. Change it accordingly.
Signed-off-by: Alexander Kurz <akurz@blala.de>
---
drivers/leds/leds-mc13783.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/leds/leds-mc13783.c b/drivers/leds/leds-mc13783.c
index e22f09d13798..11add1fd24ce 100644
--- a/drivers/leds/leds-mc13783.c
+++ b/drivers/leds/leds-mc13783.c
@@ -127,7 +127,7 @@ static struct mc13xxx_leds_platform_data __init *mc13xxx_led_probe_dt(
if (!parent)
return ERR_PTR(-ENODATA);
- ret = of_property_read_u32_array(parent, "led-control",
+ ret = of_property_read_u32_array(parent, "fsl,led-control",
pdata->led_control,
leds->devtype->num_regs);
if (ret)
--
2.39.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 9/9] Input: mc13783-pwrbutton: add OF support
2025-08-23 14:44 [PATCH v2 0/9] Fix, extend and support OF to mc13xxx pwrbutton Alexander Kurz
` (7 preceding siblings ...)
2025-08-23 14:44 ` [PATCH v2 8/9] leds: mc13783: use fsl,led-control as " Alexander Kurz
@ 2025-08-23 14:44 ` Alexander Kurz
8 siblings, 0 replies; 13+ messages in thread
From: Alexander Kurz @ 2025-08-23 14:44 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Dmitry Torokhov, Dzmitry Sankouski, Dr. David Alan Gilbert,
Heiko Stuebner, Uwe Kleine-König, devicetree, linux-input
Cc: linux-kernel, Alexander Kurz
Add OF support for the mc13783-pwrbutton so that it can be used with
modern DT based systems.
Signed-off-by: Alexander Kurz <akurz@blala.de>
---
drivers/input/misc/mc13783-pwrbutton.c | 94 +++++++++++++++++++++++---
1 file changed, 86 insertions(+), 8 deletions(-)
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
index c9eea57ceedd..f06d993b231c 100644
--- a/drivers/input/misc/mc13783-pwrbutton.c
+++ b/drivers/input/misc/mc13783-pwrbutton.c
@@ -27,6 +27,7 @@
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/mfd/mc13783.h>
+#include <linux/property.h>
#include <linux/sched.h>
#include <linux/slab.h>
@@ -109,8 +110,82 @@ static irqreturn_t button3_irq(int irq, void *_priv)
return button_irq(MC13783_IRQ_ONOFD3, _priv);
}
-static int mc13783_pwrbutton_probe(struct platform_device *pdev)
+#ifdef CONFIG_OF
+static struct mc13xxx_buttons_platform_data __init *mc13xxx_pwrbutton_probe_dt(
+ struct platform_device *pdev)
{
+ struct mc13xxx_buttons_platform_data *pdata;
+ struct fwnode_handle *child;
+ struct device *dev = &pdev->dev;
+ struct mc13xxx_button_devtype *devtype =
+ (struct mc13xxx_button_devtype *)platform_get_device_id(pdev)->driver_data;
+
+ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata)
+ return ERR_PTR(-ENOMEM);
+
+ struct fwnode_handle *parent __free(fwnode_handle) =
+ device_get_named_child_node(dev->parent, "buttons");
+ if (!parent)
+ return ERR_PTR(-ENODATA);
+
+ fwnode_for_each_child_node(parent, child) {
+ u32 idx;
+ u8 dbnc = MC13783_BUTTON_DBNC_30MS;
+ u16 dbnc_ms;
+
+ if (fwnode_property_read_u32(child, "reg", &idx))
+ continue;
+
+ if (idx > devtype->button_id_max) {
+ dev_warn(dev, "reg out of range\n");
+ continue;
+ }
+
+ fwnode_property_read_u16(child, "debounce-delay-ms", &dbnc_ms);
+ switch (dbnc_ms) {
+ case 0:
+ dbnc = MC13783_BUTTON_DBNC_0MS;
+ break;
+ case 30:
+ dbnc = MC13783_BUTTON_DBNC_30MS;
+ break;
+ case 150:
+ dbnc = MC13783_BUTTON_DBNC_150MS;
+ break;
+ case 750:
+ dbnc = MC13783_BUTTON_DBNC_750MS;
+ break;
+ default:
+ dev_warn(dev, "invalid debounce-delay-ms value\n");
+ continue;
+ }
+
+ if (fwnode_property_read_u32(child, "linux,code", &pdata->b_on_key[idx]))
+ continue;
+
+ if (fwnode_property_read_bool(child, "active-low"))
+ pdata->b_on_flags[idx] |= MC13783_BUTTON_POL_INVERT;
+
+ if (fwnode_property_read_bool(child, "fsl,enable-reset"))
+ pdata->b_on_flags[idx] |= MC13783_BUTTON_RESET_EN;
+
+ pdata->b_on_flags[idx] |= MC13783_BUTTON_ENABLE | dbnc;
+ }
+
+ return pdata;
+}
+#else
+static inline struct mc13xxx_buttons_platform_data __init *mc13xxx_pwrbutton_probe_dt(
+ struct platform_device *pdev)
+{
+ return ERR_PTR(-ENODEV);
+}
+#endif
+
+static int __init mc13783_pwrbutton_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
const struct mc13xxx_buttons_platform_data *pdata;
struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent);
struct mc13xxx_button_devtype *devtype =
@@ -121,9 +196,13 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
int reg = 0;
pdata = dev_get_platdata(&pdev->dev);
- if (!pdata) {
- dev_err(&pdev->dev, "missing platform data\n");
- return -ENODEV;
+ if (dev->parent->of_node) {
+ pdata = mc13xxx_pwrbutton_probe_dt(pdev);
+ if (IS_ERR(pdata))
+ return PTR_ERR(pdata);
+ } else if (!pdata) {
+ dev_err(dev, "missing platform data\n");
+ return -ENODATA;
}
pwr = devm_input_allocate_device(&pdev->dev);
@@ -290,15 +369,14 @@ static const struct platform_device_id mc13xxx_pwrbutton_idtable[] = {
};
static struct platform_driver mc13783_pwrbutton_driver = {
- .id_table = mc13xxx_pwrbutton_idtable,
- .probe = mc13783_pwrbutton_probe,
- .remove = mc13783_pwrbutton_remove,
.driver = {
.name = "mc13783-pwrbutton",
},
+ .id_table = mc13xxx_pwrbutton_idtable,
+ .remove = mc13783_pwrbutton_remove,
};
-module_platform_driver(mc13783_pwrbutton_driver);
+module_platform_driver_probe(mc13783_pwrbutton_driver, mc13783_pwrbutton_probe);
MODULE_ALIAS("platform:mc13783-pwrbutton");
MODULE_DESCRIPTION("MC13783 Power Button");
--
2.39.5
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 5/9] dt-bindings: mfd: fsl,mc13xxx: convert txt to DT schema
2025-08-23 14:44 ` [PATCH v2 5/9] dt-bindings: mfd: fsl,mc13xxx: convert txt to DT schema Alexander Kurz
@ 2025-08-26 23:03 ` Rob Herring
0 siblings, 0 replies; 13+ messages in thread
From: Rob Herring @ 2025-08-26 23:03 UTC (permalink / raw)
To: Alexander Kurz
Cc: Lee Jones, Krzysztof Kozlowski, Conor Dooley, Dmitry Torokhov,
Dzmitry Sankouski, Dr. David Alan Gilbert, Heiko Stuebner,
Uwe Kleine-König, devicetree, linux-input, linux-kernel
On Sat, Aug 23, 2025 at 02:44:37PM +0000, Alexander Kurz wrote:
> Convert the txt mc13xxx bindings to DT schema attempting to keep most
> information. The nodes codec and touchscreen are not part of the new
> schema since it was only briefly mentioned before.
> Following the convention, rename led-control to fsl,led-control.
If 'led-control' is already in use, then you can't do that. You could
support both, but then the driver has to support both forever which is
worse than not matching convention.
>
> Signed-off-by: Alexander Kurz <akurz@blala.de>
> ---
> .../devicetree/bindings/mfd/fsl,mc13xxx.yaml | 214 ++++++++++++++++++
> .../devicetree/bindings/mfd/mc13xxx.txt | 156 -------------
> 2 files changed, 214 insertions(+), 156 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/mfd/fsl,mc13xxx.yaml
> delete mode 100644 Documentation/devicetree/bindings/mfd/mc13xxx.txt
>
> diff --git a/Documentation/devicetree/bindings/mfd/fsl,mc13xxx.yaml b/Documentation/devicetree/bindings/mfd/fsl,mc13xxx.yaml
> new file mode 100644
> index 000000000000..94e2f6557376
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/fsl,mc13xxx.yaml
> @@ -0,0 +1,214 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mfd/fsl,mc13xxx.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Freescale MC13xxx Power Management Integrated Circuits (PMIC)
> +
> +maintainers:
> + - Alexander Kurz <akurz@blala.de>
> +
> +description:
Needs a '>' modifier to preserve formatting.
> + The MC13xxx PMIC series consists of the three models MC13783, MC13892
> + and MC34708 and provide regulators and other features like RTC, ADC,
> + LED, touchscreen, codec and input buttons.
> +
> + Link to datasheets
> + https://www.nxp.com/docs/en/data-sheet/MC13783.pdf
> + https://www.nxp.com/docs/en/data-sheet/MC13892.pdf
> + https://www.nxp.com/docs/en/data-sheet/MC34708.pdf
> +
> +properties:
> + compatible:
> + enum:
> + - fsl,mc13783
> + - fsl,mc13892
> + - fsl,mc34708
> +
> + reg:
> + description: I2C slave address or SPI chip select number.
> + maxItems: 1
> +
> + spi-max-frequency: true
> +
> + spi-cs-high: true
> +
> + system-power-controller: true
> +
> + interrupts:
> + maxItems: 1
> +
> + leds:
> + type: object
> + $ref: /schemas/leds/common.yaml#
> + description: |
> + Leds
Drop the description
blank line
> + properties:
> + reg:
> + description: |
> + One of
> + MC13783 LED IDs
> + 0: Main display
> + 1: AUX display
> + 2: Keypad
> + 3: Red 1
> + 4: Green 1
> + 5: Blue 1
> + 6: Red 2
> + 7: Green 2
> + 8: Blue 2
> + 9: Red 3
> + 10: Green 3
> + 11: Blue 3
blank line
> + MC13892 LED IDs
> + 0: Main display
> + 1: AUX display
> + 2: Keypad
> + 3: Red
> + 4: Green
> + 5: Blue
blank line
> + MC34708 LED IDs
> + 0: Charger Red
> + 1: Charger Green
> + maxItems: 1
blank line
> + fsl,led-control:
> + $ref: /schemas/types.yaml#/definitions/uint32-array
> + description: |
> + Setting for LED-Control register array length depends on model,
> + mc13783: 6, mc13892: 4, mc34708: 1
> +
> + regulators:
> + type: object
> + $ref: /schemas/regulator/regulator.yaml#
This schema applies to the child nodes, not this node. Drop.
additionalProperties:
type: object
> + description: |
> + List of child nodes specifying the regulators, depending on chip variant:
> + * MC13783: gpo[1-4], pwgt[12]spi, sw[12][ab], sw3, vaudio, vcam, vdig,
> + vesim, vgen, viohi, violo, vmmc[12], vrf[12], vrfbg, vrfcp, vrfdig,
> + vrfref, vsim and vvib.
> + * MC13892: gpo[1-4], pwgt[12]spi, sw[1-4], swbst, vaudio, vcam, vcoincell,
> + vdig, vgen[1-3], viohi, vpll, vsd, vusb, vusb2, vvideo.
> + Each child node is defined using the standard binding for regulators and
> + the optional regulator properties defined below.
Don't duplicate what the schema says below in free-form text.
> +
> + fsl,mc13xxx-uses-adc:
> + type: boolean
> + description: Indicate the ADC is being used
> +
> + fsl,mc13xxx-uses-codec:
> + type: boolean
> + description: Indicate the Audio Codec is being used
> +
> + fsl,mc13xxx-uses-rtc:
> + type: boolean
> + description: Indicate the RTC is being used
> +
> + fsl,mc13xxx-uses-touch:
> + type: boolean
> + description: Indicate the touchscreen controller is being used
> +
> +required:
> + - compatible
> + - reg
> +
> +allOf:
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: fsl,mc13783
> + then:
> + properties:
> + leds:
> + properties:
> + fsl,led-control:
> + minItems: 6
> + maxItems: 6
> + regulators:
> + patternProperties:
> + "^gpo[1-4]|pwgt[12]spi|sw[12][ab]|sw3|vaudio|vcam|vdig|vesim|vgen|viohi|violo|vmmc[12]|vrf[12]|vrfbg|vrfcp|vrfdig|vrfref|vsim|vvib$":
> + type: object
> + $ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
> +
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: fsl,mc13892
> + then:
> + properties:
> + leds:
> + properties:
> + fsl,led-control:
> + minItems: 4
> + maxItems: 4
> + regulators:
> + patternProperties:
> + "^gpo[1-4]|pwgt[12]spi|sw[1-4]|swbst|vaudio|vcam|vcoincell|vdig|vgen[1-3]|viohi|vpll|vsd|vusb|vusb2|vvideo$":
> + type: object
> + $ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
> +
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: fsl,mc34708
> + then:
> + properties:
> + leds:
> + properties:
> + fsl,led-control:
> + minItems: 1
> + maxItems: 1
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/gpio/gpio.h>
> + #include <dt-bindings/interrupt-controller/irq.h>
> + #include <dt-bindings/leds/common.h>
> +
> + spi {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + pmic: mc13892@0 {
> + compatible = "fsl,mc13892";
> + reg = <0>;
> + spi-max-frequency = <1000000>;
> + spi-cs-high;
> + interrupt-parent = <&gpio0>;
> + interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
> + fsl,mc13xxx-uses-rtc;
> + fsl,mc13xxx-uses-adc;
> +
> + leds {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + fsl,led-control = <0x000 0x000 0x0e0 0x000>;
> +
> + sysled@3 {
> + reg = <3>;
> + label = "system:red:live";
> + linux,default-trigger = "heartbeat";
> + };
> + };
> +
> + regulators {
> + sw1_reg: sw1 {
> + regulator-min-microvolt = <600000>;
> + regulator-max-microvolt = <1375000>;
> + regulator-boot-on;
> + regulator-always-on;
> + };
> +
> + sw2_reg: sw2 {
> + regulator-min-microvolt = <900000>;
> + regulator-max-microvolt = <1850000>;
> + regulator-boot-on;
> + regulator-always-on;
> + };
> + };
> + };
> + };
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 6/9] dt-bindings: mfd: fsl,mc13xxx: add buttons node
2025-08-23 14:44 ` [PATCH v2 6/9] dt-bindings: mfd: fsl,mc13xxx: add buttons node Alexander Kurz
@ 2025-08-26 23:08 ` Rob Herring
0 siblings, 0 replies; 13+ messages in thread
From: Rob Herring @ 2025-08-26 23:08 UTC (permalink / raw)
To: Alexander Kurz
Cc: Lee Jones, Krzysztof Kozlowski, Conor Dooley, Dmitry Torokhov,
Dzmitry Sankouski, Dr. David Alan Gilbert, Heiko Stuebner,
Uwe Kleine-König, devicetree, linux-input, linux-kernel
On Sat, Aug 23, 2025 at 02:44:38PM +0000, Alexander Kurz wrote:
> Add a buttons node and properties describing the "ONOFD" (MC13783) and
> "PWRON" (MC13892/MC34708) buttons available in the fsl,mc13xxx PMIC ICs.
>
> Signed-off-by: Alexander Kurz <akurz@blala.de>
> ---
> .../devicetree/bindings/mfd/fsl,mc13xxx.yaml | 58 +++++++++++++++++++
> 1 file changed, 58 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mfd/fsl,mc13xxx.yaml b/Documentation/devicetree/bindings/mfd/fsl,mc13xxx.yaml
> index 94e2f6557376..761267b42c85 100644
> --- a/Documentation/devicetree/bindings/mfd/fsl,mc13xxx.yaml
> +++ b/Documentation/devicetree/bindings/mfd/fsl,mc13xxx.yaml
> @@ -39,6 +39,41 @@ properties:
> interrupts:
> maxItems: 1
>
> + buttons:
> + type: object
> + $ref: /schemas/input/input.yaml#
unevaluatedProperties: false
(And then fix the errors in the example)
> + description: Buttons
Drop.
> + properties:
> + reg:
> + description: |
> + One of
> + MC13783 BUTTON IDs:
> + 0: ONOFD1
> + 1: ONOFD2
> + 2: ONOFD3
> + MC13892 BUTTON IDs:
> + 0: PWRON1
> + 1: PWRON2
> + 2: PWRON3
> + MC34708 BUTTON IDs:
> + 0: PWRON1
> + 1: PWRON2
'maximum: 2' here and then only need 'maximum: 1' in one spot below.
> +
> + debounce-delay-ms:
> + enum: [0, 30, 150, 750]
> + default: 30
> + description: |
> + Sets the debouncing delay in milliseconds.
> + Valid values: 0, 30, 150 and 750ms.
Don't repeat schema constraints in free-form text.
> +
> + active-low:
> + description: Set active when pin is pulled low.
> +
> + fsl,enable-reset:
> + description: |
Don't need '|'.
> + Setting of the global reset option.
> + type: boolean
> +
> leds:
> type: object
> $ref: /schemas/leds/common.yaml#
> @@ -119,6 +154,10 @@ allOf:
> const: fsl,mc13783
> then:
> properties:
> + buttons:
> + properties:
> + reg:
> + enum: [0, 1, 2]
> leds:
> properties:
> fsl,led-control:
> @@ -137,6 +176,10 @@ allOf:
> const: fsl,mc13892
> then:
> properties:
> + buttons:
> + properties:
> + reg:
> + enum: [0, 1, 2]
> leds:
> properties:
> fsl,led-control:
> @@ -155,6 +198,10 @@ allOf:
> const: fsl,mc34708
> then:
> properties:
> + buttons:
> + properties:
> + reg:
> + enum: [0, 1]
> leds:
> properties:
> fsl,led-control:
> @@ -183,6 +230,17 @@ examples:
> fsl,mc13xxx-uses-rtc;
> fsl,mc13xxx-uses-adc;
>
> + buttons {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + onkey1@0 {
> + reg = <0>;
> + debounce-delay-ms = <30>;
> + active-low;
> + fsl,enable-reset;
> + };
> + };
> +
> leds {
> #address-cells = <1>;
> #size-cells = <0>;
> --
> 2.39.5
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 8/9] leds: mc13783: use fsl,led-control as node name
2025-08-23 14:44 ` [PATCH v2 8/9] leds: mc13783: use fsl,led-control as " Alexander Kurz
@ 2025-09-03 11:59 ` Lee Jones
0 siblings, 0 replies; 13+ messages in thread
From: Lee Jones @ 2025-09-03 11:59 UTC (permalink / raw)
To: Alexander Kurz
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Dmitry Torokhov,
Dzmitry Sankouski, Dr. David Alan Gilbert, Heiko Stuebner,
Uwe Kleine-König, devicetree, linux-input, linux-kernel
Did you actually test this?
> According to fsl,mc13xxx.yaml, the node name for led-control is
> vendor prefixed. Change it accordingly.
According to what, now? I see:
% find . -name fsl,mc13xxx.yaml
<no results>
% git grep fsl,led-control
<no results>
% git grep led-control | grep -v led-controller
Documentation/devicetree/bindings/mfd/mc13xxx.txt: "led-control". Number of register depends of used IC, for MC13783 is 6,
Documentation/devicetree/bindings/mfd/mc13xxx.txt: led-control = <0x000 0x000 0x0e0 0x000>;
Documentation/netlink/specs/rt-link.yaml: name: coupled-control
arch/arm/boot/dts/nxp/imx/imx27-phytec-phycore-som.dtsi: led-control = <0x001 0x000 0x000 0x000 0x000 0x000>;
arch/arm/boot/dts/nxp/imx/imx51-zii-rdu1.dts: led-control = <0x0 0x0 0x3f83f8 0x0>;
arch/arm/boot/dts/nxp/imx/imx51-zii-scu2-mezz.dts: led-control = <0x0 0x0 0x3f83f8 0x0>;
arch/arm/boot/dts/nxp/imx/imx51-zii-scu3-esb.dts: led-control = <0x0 0x0 0x3f83f8 0x0>;
drivers/leds/leds-mc13783.c: ret = of_property_read_u32_array(parent, "led-control",
> Signed-off-by: Alexander Kurz <akurz@blala.de>
> ---
> drivers/leds/leds-mc13783.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/leds/leds-mc13783.c b/drivers/leds/leds-mc13783.c
> index e22f09d13798..11add1fd24ce 100644
> --- a/drivers/leds/leds-mc13783.c
> +++ b/drivers/leds/leds-mc13783.c
> @@ -127,7 +127,7 @@ static struct mc13xxx_leds_platform_data __init *mc13xxx_led_probe_dt(
> if (!parent)
> return ERR_PTR(-ENODATA);
>
> - ret = of_property_read_u32_array(parent, "led-control",
> + ret = of_property_read_u32_array(parent, "fsl,led-control",
> pdata->led_control,
> leds->devtype->num_regs);
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2025-09-03 11:59 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-23 14:44 [PATCH v2 0/9] Fix, extend and support OF to mc13xxx pwrbutton Alexander Kurz
2025-08-23 14:44 ` [PATCH v2 1/9] Input: mc13783-pwrbutton: fix irq mixup Alexander Kurz
2025-08-23 14:44 ` [PATCH v2 2/9] Input: mc13783-pwrbutton: use managed resources Alexander Kurz
2025-08-23 14:44 ` [PATCH v2 3/9] Input: mc13783-pwrbutton: convert pdata members to array Alexander Kurz
2025-08-23 14:44 ` [PATCH v2 4/9] Input: mc13783-pwrbutton: enable other mc13xxx PMIC Alexander Kurz
2025-08-23 14:44 ` [PATCH v2 5/9] dt-bindings: mfd: fsl,mc13xxx: convert txt to DT schema Alexander Kurz
2025-08-26 23:03 ` Rob Herring
2025-08-23 14:44 ` [PATCH v2 6/9] dt-bindings: mfd: fsl,mc13xxx: add buttons node Alexander Kurz
2025-08-26 23:08 ` Rob Herring
2025-08-23 14:44 ` [PATCH v2 7/9] ARM: dts: imx: Use fsl,led-control as mc13xxx node name Alexander Kurz
2025-08-23 14:44 ` [PATCH v2 8/9] leds: mc13783: use fsl,led-control as " Alexander Kurz
2025-09-03 11:59 ` Lee Jones
2025-08-23 14:44 ` [PATCH v2 9/9] Input: mc13783-pwrbutton: add OF support Alexander Kurz
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).