* [PATCH v8 00/10] HID: asus: Fix ASUS ROG Laptop's Keyboard backlight handling
From: Antheas Kapenekakis @ 2025-11-01 10:47 UTC (permalink / raw)
To: platform-driver-x86, linux-input
Cc: linux-kernel, Jiri Kosina, Benjamin Tissoires, Corentin Chary,
Luke D . Jones, Hans de Goede, Ilpo Järvinen, Denis Benato,
Antheas Kapenekakis
This is a two part series which does the following:
- Clean-up init sequence
- Unify backlight handling to happen under asus-wmi so that all Aura
devices have synced brightness controls and the backlight button works
properly when it is on a USB laptop keyboard instead of one w/ WMI.
For more context, see cover letter of V1. Since V5, I removed some patches
to make this easier to merge.
---
V7: https://lore.kernel.org/all/20251018101759.4089-1-lkml@antheas.dev/
V6: https://lore.kernel.org/all/20251013201535.6737-1-lkml@antheas.dev/
V5: https://lore.kernel.org/all/20250325184601.10990-1-lkml@antheas.dev/
V4: https://lore.kernel.org/lkml/20250324210151.6042-1-lkml@antheas.dev/
V3: https://lore.kernel.org/lkml/20250322102804.418000-1-lkml@antheas.dev/
V2: https://lore.kernel.org/all/20250320220924.5023-1-lkml@antheas.dev/
V1: https://lore.kernel.org/all/20250319191320.10092-1-lkml@antheas.dev/
Changes since V7:
- Readd legacy init quirk for Dennis
- Remove HID_QUIRK_INPUT_PER_APP as a courtesy to asusctl
- Fix warning due to enum_backlight receiving negative values
Changes since V6:
- Split initialization refactor into three patches, update commit text
to be clearer in what it does
- Replace spinlock accesses with guard and scoped guard in all patches
- Add missing includes mentioned by Ilpo
- Reflow, tweak comment in prevent binding to all HID devices on ROG
- Replace asus_ref.asus with local reference in all patches
- Add missing kernel doc comments
- Other minor nits from Ilpo
- User reported warning due to scheduling work while holding a spinlock.
Restructure patch for multiple handlers to limit when spinlock is held to
variable access only. In parallel, setup a workqueue to handle registration
of led device and setting brightness. This is required as registering the
led device triggers kbd_led_get which needs to hold the spinlock to
protect the led_wk value. The workqueue is also required for the hid
event passthrough to avoid scheduling work while holding the spinlock.
Apply the workqueue to wmi brightness buttons as well, as that was
omitted before this series and WMI access was performed.
- On "HID: asus: prevent binding to all HID devices on ROG", rename
quirk HANDLE_GENERIC to SKIP_REPORT_FIXUP and only skip report fixup.
This allows other quirks to apply (applies quirk that fixes keyboard
being named as a pointer device).
Changes since V5:
- It's been a long time
- Remove addition of RGB as that had some comments I need to work on
- Remove folio patch (already merged)
- Remove legacy fix patch 11 from V4. There is a small chance that
without this patch, some old NKEY keyboards might not respond to
RGB commands according to Luke, but the kernel driver does not do
RGB currently. The 0x5d init is done by Armoury crate software in
Windows. If an issue is found, we can re-add it or just remove patches
1/2 before merging. However, init could use the cleanup.
Changes since V4:
- Fix KConfig (reported by kernel robot)
- Fix Ilpo's nits, if I missed anything lmk
Changes since V3:
- Add initializer for 0x5d for old NKEY keyboards until it is verified
that it is not needed for their media keys to function.
- Cover init in asus-wmi with spinlock as per Hans
- If asus-wmi registers WMI handler with brightness, init the brightness
in USB Asus keyboards, per Hans.
- Change hid handler name to asus-UNIQ:rgb:peripheral to match led class
- Fix oops when unregistering asus-wmi by moving unregister outside of
the spin lock (but after the asus reference is set to null)
Changes since V2:
- Check lazy init succeds in asus-wmi before setting register variable
- make explicit check in asus_hid_register_listener for listener existing
to avoid re-init
- rename asus_brt to asus_hid in most places and harmonize everything
- switch to a spinlock instead of a mutex to avoid kernel ooops
- fixup hid device quirks to avoid multiple RGB devices while still exposing
all input vendor devices. This includes moving rgb init to probe
instead of the input_configured callbacks.
- Remove fan key (during retest it appears to be 0xae that is already
supported by hid-asus)
- Never unregister asus::kbd_backlight while asus-wmi is active, as that
- removes fds from userspace and breaks backlight functionality. All
- current mainline drivers do not support backlight hotplugging, so most
userspace software (e.g., KDE, UPower) is built with that assumption.
For the Ally, since it disconnects its controller during sleep, this
caused the backlight slider to not work in KDE.
Changes since V1:
- Add basic RGB support on hid-asus, (Z13/Ally) tested in KDE/Z13
- Fix ifdef else having an invalid signature (reported by kernel robot)
- Restore input arguments to init and keyboard function so they can
be re-used for RGB controls.
- Remove Z13 delay (it did not work to fix the touchpad) and replace it
with a HID_GROUP_GENERIC quirk to allow hid-multitouch to load. Squash
keyboard rename into it.
- Unregister brightness listener before removing work queue to avoid
a race condition causing corruption
- Remove spurious mutex unlock in asus_brt_event
- Place mutex lock in kbd_led_set after LED_UNREGISTERING check to avoid
relocking the mutex and causing a deadlock when unregistering leds
- Add extra check during unregistering to avoid calling unregister when
no led device is registered.
- Temporarily HID_QUIRK_INPUT_PER_APP from the ROG endpoint as it causes
the driver to create 4 RGB handlers per device. I also suspect some
extra events sneak through (KDE had the @@@@@@).
Antheas Kapenekakis (10):
HID: asus: simplify RGB init sequence
HID: asus: use same report_id in response
HID: asus: fortify keyboard handshake
HID: asus: prevent binding to all HID devices on ROG
HID: asus: initialize LED endpoint early for old NKEY keyboards
platform/x86: asus-wmi: Add support for multiple kbd led handlers
HID: asus: listen to the asus-wmi brightness device instead of
creating one
platform/x86: asus-wmi: remove unused keyboard backlight quirk
platform/x86: asus-wmi: add keyboard brightness event handler
HID: asus: add support for the asus-wmi brightness handler
drivers/hid/hid-asus.c | 222 +++++++++++----------
drivers/platform/x86/asus-wmi.c | 214 +++++++++++++++++---
include/linux/platform_data/x86/asus-wmi.h | 70 +++----
3 files changed, 331 insertions(+), 175 deletions(-)
base-commit: 211ddde0823f1442e4ad052a2f30f050145ccada
--
2.51.2
^ permalink raw reply
* [PATCH v8 01/10] HID: asus: simplify RGB init sequence
From: Antheas Kapenekakis @ 2025-11-01 10:47 UTC (permalink / raw)
To: platform-driver-x86, linux-input
Cc: linux-kernel, Jiri Kosina, Benjamin Tissoires, Corentin Chary,
Luke D . Jones, Hans de Goede, Ilpo Järvinen, Denis Benato,
Antheas Kapenekakis
In-Reply-To: <20251101104712.8011-1-lkml@antheas.dev>
Currently, RGB initialization forks depending on whether a device is
NKEY. Then, NKEY devices are initialized using 0x5a, 0x5d, 0x5e
endpoints, and non-NKEY devices with 0x5a and then a
backlight check, which is omitted for NKEY devices.
Remove the fork, using a common initialization sequence for both,
where they are both only initialized with 0x5a, then checked for
backlight support. This patch should not affect existing functionality.
0x5d and 0x5e endpoint initializations are performed by Windows
userspace programs associated with different usages that reside under
the vendor HID. Specifically, 0x5d is used by Armoury Crate, which
controls RGB and 0x5e by an animation program for certain Asus laptops.
Neither is used currently in the driver.
Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
---
drivers/hid/hid-asus.c | 56 ++++++++++++++----------------------------
1 file changed, 19 insertions(+), 37 deletions(-)
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index a444d41e53b6..7ea1037c3979 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -638,50 +638,32 @@ static int asus_kbd_register_leds(struct hid_device *hdev)
unsigned char kbd_func;
int ret;
- if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
- /* Initialize keyboard */
- ret = asus_kbd_init(hdev, FEATURE_KBD_REPORT_ID);
- if (ret < 0)
- return ret;
-
- /* The LED endpoint is initialised in two HID */
- ret = asus_kbd_init(hdev, FEATURE_KBD_LED_REPORT_ID1);
- if (ret < 0)
- return ret;
-
- ret = asus_kbd_init(hdev, FEATURE_KBD_LED_REPORT_ID2);
- if (ret < 0)
- return ret;
-
- if (dmi_match(DMI_PRODUCT_FAMILY, "ProArt P16")) {
- ret = asus_kbd_disable_oobe(hdev);
- if (ret < 0)
- return ret;
- }
-
- if (drvdata->quirks & QUIRK_ROG_ALLY_XPAD) {
- intf = to_usb_interface(hdev->dev.parent);
- udev = interface_to_usbdev(intf);
- validate_mcu_fw_version(hdev,
- le16_to_cpu(udev->descriptor.idProduct));
- }
+ ret = asus_kbd_init(hdev, FEATURE_KBD_REPORT_ID);
+ if (ret < 0)
+ return ret;
- } else {
- /* Initialize keyboard */
- ret = asus_kbd_init(hdev, FEATURE_KBD_REPORT_ID);
- if (ret < 0)
- return ret;
+ /* Get keyboard functions */
+ ret = asus_kbd_get_functions(hdev, &kbd_func, FEATURE_KBD_REPORT_ID);
+ if (ret < 0)
+ return ret;
- /* Get keyboard functions */
- ret = asus_kbd_get_functions(hdev, &kbd_func, FEATURE_KBD_REPORT_ID);
+ if (dmi_match(DMI_PRODUCT_FAMILY, "ProArt P16")) {
+ ret = asus_kbd_disable_oobe(hdev);
if (ret < 0)
return ret;
+ }
- /* Check for backlight support */
- if (!(kbd_func & SUPPORT_KBD_BACKLIGHT))
- return -ENODEV;
+ if (drvdata->quirks & QUIRK_ROG_ALLY_XPAD) {
+ intf = to_usb_interface(hdev->dev.parent);
+ udev = interface_to_usbdev(intf);
+ validate_mcu_fw_version(
+ hdev, le16_to_cpu(udev->descriptor.idProduct));
}
+ /* Check for backlight support */
+ if (!(kbd_func & SUPPORT_KBD_BACKLIGHT))
+ return -ENODEV;
+
drvdata->kbd_backlight = devm_kzalloc(&hdev->dev,
sizeof(struct asus_kbd_leds),
GFP_KERNEL);
--
2.51.2
^ permalink raw reply related
* Re: [PATCH] Input: xpad - Change buttons the D-Pad gets mapped as to BTN_DPAD_*
From: Vicki Pfau @ 2025-11-01 5:52 UTC (permalink / raw)
To: Cameron Gutman, Dmitry Torokhov; +Cc: linux-input
In-Reply-To: <CAAfxzZ0p=2REL8fhnxe5HwpPK6U7Cat7euMcRnWvUnknrok3sA@mail.gmail.com>
On 10/31/25 8:18 PM, Cameron Gutman wrote:
> On Sun, Jul 27, 2025 at 3:23 AM Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
>>
>> On Tue, Jul 01, 2025 at 08:47:40PM -0700, Vicki Pfau wrote:
>>> Since dance pads can have both up/down or left/right pressed at the same time,
>>> by design, they are not suitable for mapping the buttons to axes. Historically,
>>> this driver mapped the D-pad to BTN_TRIGGER_HAPPY1-4 in these cases, and before
>>> that as mouse buttons. However, BTN_DPAD_* exists for this and makes far more
>>> sense than the arbitrary mapping it was before.
>>>
>>> Signed-off-by: Vicki Pfau <vi@endrift.com>
>>
>> This unfortunately changes existing mappings, but I guess new events are
>> better than old ones...
>>
>> Applied, thank you.
>
> Unfortunately this mapping change caused major userspace breakages.
This is unfortunate, however,>
> I think it needs to be reverted.
>
> [0]: https://blog.dwickham.me.uk/why-your-xbox-360-wireless-controllers-d-pad-is-now-wrong-and-how-to-fix-it
> [1]: https://github.com/libsdl-org/SDL/issues/14324
> [2]: https://github.com/libsdl-org/SDL/pull/14339
None of these pages suggest reverting the changes. The blog post suggests that these mappings are correct, and that the libraries need to be fixed. Reverting it is mentioned as an absolute last case scenario. The SDL issues say they need more testing, not an outright reversion.
Reverting this is solely reverting to an old, uncomfortable status quo instead of actually fixing the things that broke. If this gets reverted, presumably more stuff will ship this broken code that will break if we ever fix this issue again, instead of things getting progressively fixed.
The abandonware being broken is unfortunate, but things like Steam Input exist specifically to work around issues like that.
>
>>
>> --
>> Dmitry
>>
Vicki
^ permalink raw reply
* Re: [PATCH] Input: xpad - Change buttons the D-Pad gets mapped as to BTN_DPAD_*
From: Cameron Gutman @ 2025-11-01 3:18 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Vicki Pfau, linux-input
In-Reply-To: <bwun7yd3uwp3cqicg2euq5swxespqjiizxlioohgdk43emzwue@hzyz7gn4vfqb>
On Sun, Jul 27, 2025 at 3:23 AM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
>
> On Tue, Jul 01, 2025 at 08:47:40PM -0700, Vicki Pfau wrote:
> > Since dance pads can have both up/down or left/right pressed at the same time,
> > by design, they are not suitable for mapping the buttons to axes. Historically,
> > this driver mapped the D-pad to BTN_TRIGGER_HAPPY1-4 in these cases, and before
> > that as mouse buttons. However, BTN_DPAD_* exists for this and makes far more
> > sense than the arbitrary mapping it was before.
> >
> > Signed-off-by: Vicki Pfau <vi@endrift.com>
>
> This unfortunately changes existing mappings, but I guess new events are
> better than old ones...
>
> Applied, thank you.
Unfortunately this mapping change caused major userspace breakages.
I think it needs to be reverted.
[0]: https://blog.dwickham.me.uk/why-your-xbox-360-wireless-controllers-d-pad-is-now-wrong-and-how-to-fix-it
[1]: https://github.com/libsdl-org/SDL/issues/14324
[2]: https://github.com/libsdl-org/SDL/pull/14339
>
> --
> Dmitry
>
^ permalink raw reply
* [PATCH RESEND] Input: xpad - Add support for CRKD LP Guitars
From: Sanjay Govind @ 2025-10-31 20:13 UTC (permalink / raw)
To: Dmitry Torokhov, Vicki Pfau, Pavel Rojtberg, Antheas Kapenekakis,
Nilton Perim Neto, Mario Limonciello, Pierre-Loup A. Griffais
Cc: winston.tan, Sanjay Govind, linux-input, linux-kernel
This commit adds support for CRKD LP Guitar Controllers
Signed-off-by: Sanjay Govind <sanjay.govind9@gmail.com>
---
drivers/input/joystick/xpad.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index d72e89c25e50..33b0ad041247 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -133,6 +133,8 @@ static const struct xpad_device {
} xpad_device[] = {
/* Please keep this list sorted by vendor and product ID. */
{ 0x0079, 0x18d4, "GPD Win 2 X-Box Controller", 0, XTYPE_XBOX360 },
+ { 0x0351, 0x1000, "CRKD LP Blueberry Burst Pro Edition (Xbox)", 0, XTYPE_XBOX360 },
+ { 0x0351, 0x2000, "CRKD LP Black Tribal Edition (Xbox) ", 0, XTYPE_XBOX360 },
{ 0x03eb, 0xff01, "Wooting One (Legacy)", 0, XTYPE_XBOX360 },
{ 0x03eb, 0xff02, "Wooting Two (Legacy)", 0, XTYPE_XBOX360 },
{ 0x03f0, 0x038D, "HyperX Clutch", 0, XTYPE_XBOX360 }, /* wired */
@@ -518,6 +520,7 @@ static const struct usb_device_id xpad_table[] = {
*/
{ USB_INTERFACE_INFO('X', 'B', 0) }, /* Xbox USB-IF not-approved class */
XPAD_XBOX360_VENDOR(0x0079), /* GPD Win 2 controller */
+ XPAD_XBOX360_VENDOR(0x0351), /* CRKD Controllers */
XPAD_XBOX360_VENDOR(0x03eb), /* Wooting Keyboards (Legacy) */
XPAD_XBOX360_VENDOR(0x03f0), /* HP HyperX Xbox 360 controllers */
XPAD_XBOXONE_VENDOR(0x03f0), /* HP HyperX Xbox One controllers */
--
2.51.2
^ permalink raw reply related
* [PATCH v7 4/6] Input: mc13783-pwrbutton: enable other mc13xxx PMIC
From: Alexander Kurz @ 2025-10-31 19:57 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Dmitry Torokhov, Lee Jones, Dzmitry Sankouski,
Griffin Kroah-Hartman, Mathieu Dubois-Briand, Heiko Stuebner,
Dr . David Alan Gilbert, Job Sava, Alexandre Belloni,
Uwe Kleine-König
Cc: devicetree, imx, linux-arm-kernel, linux-kernel, linux-input,
Alexander Kurz
In-Reply-To: <20251031195718.1586-1-akurz@blala.de>
All three mc13xxx types feature two common power buttons referred in
the datasheets as ONOFD[12] (mc13783) and PWRON[12] (mc13892/mc34708).
A third button is available on the mc13783 and mc13892 models, which
however uses distinct interrupt register bits.
Add support for mc13892/mc34708 to support all available power buttons
in the mc13xxx series.
Signed-off-by: Alexander Kurz <akurz@blala.de>
---
drivers/input/misc/Kconfig | 4 +-
drivers/input/misc/mc13783-pwrbutton.c | 131 +++++++++++--------------
drivers/mfd/mc13xxx-core.c | 22 ++++-
include/linux/mfd/mc13783.h | 4 +-
include/linux/mfd/mc13892.h | 1 +
include/linux/mfd/mc13xxx.h | 2 +
6 files changed, 84 insertions(+), 80 deletions(-)
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index cc2558630797..c967daa0388a 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -297,8 +297,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 2ee115d77b1c..08618c59197f 100644
--- a/drivers/input/misc/mc13783-pwrbutton.c
+++ b/drivers/input/misc/mc13783-pwrbutton.c
@@ -30,9 +30,16 @@
#include <linux/sched.h>
#include <linux/slab.h>
+struct mc13xxx_button_devtype {
+ int button_id_max;
+ const char *irq_name[3];
+ int irq_sense_reg[3];
+};
+
struct mc13783_pwrb {
struct input_dev *pwr;
struct mc13xxx *mc13783;
+ const struct mc13xxx_button_devtype *devtype;
int flags;
unsigned short keymap[3];
int irq[3];
@@ -43,9 +50,6 @@ struct mc13783_pwrb {
#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)
-#define MC13783_IRQSENSE1_ONOFD3S (1 << 5)
#define MC13783_REG_POWER_CONTROL_2 15
#define MC13783_POWER_CONTROL_2_ON1BDBNC 4
@@ -63,17 +67,17 @@ static irqreturn_t button_irq(int irq, void *_priv)
mc13xxx_reg_read(priv->mc13783, MC13783_REG_INTERRUPT_SENSE_1, &val);
if (irq == priv->irq[0]) {
- val = val & MC13783_IRQSENSE1_ONOFD1S ? 1 : 0;
+ val = val & (1 << priv->devtype->irq_sense_reg[0]) ? 1 : 0;
if (priv->flags & MC13783_PWRB_B1_POL_INVERT)
val ^= 1;
input_report_key(priv->pwr, priv->keymap[0], val);
} else if (irq == priv->irq[1]) {
- val = val & MC13783_IRQSENSE1_ONOFD2S ? 1 : 0;
+ val = val & (1 << priv->devtype->irq_sense_reg[1]) ? 1 : 0;
if (priv->flags & MC13783_PWRB_B2_POL_INVERT)
val ^= 1;
input_report_key(priv->pwr, priv->keymap[1], val);
- } else if (irq == priv->irq[2]) {
- val = val & MC13783_IRQSENSE1_ONOFD3S ? 1 : 0;
+ } else if (irq == priv->irq[2] && priv->devtype->button_id_max >= 2) {
+ val = val & (1 << priv->devtype->irq_sense_reg[2]) ? 1 : 0;
if (priv->flags & MC13783_PWRB_B3_POL_INVERT)
val ^= 1;
input_report_key(priv->pwr, priv->keymap[2], val);
@@ -88,6 +92,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;
@@ -108,54 +114,36 @@ 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;
priv->pwr = pwr;
priv->mc13783 = mc13783;
+ priv->devtype = devtype;
mc13xxx_lock(mc13783);
- 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);
+ for (int i = 0; i < devtype->button_id_max; i++) {
+ if ((pdata->b_on_flags[i] & MC13783_BUTTON_ENABLE) == 0)
+ continue;
- if (pdata->b_on_flags[0] & MC13783_BUTTON_POL_INVERT)
- priv->flags |= MC13783_PWRB_B1_POL_INVERT;
+ priv->keymap[i] = pdata->b_on_key[i];
+ if (pdata->b_on_key[i] != KEY_RESERVED)
+ __set_bit(pdata->b_on_key[i], pwr->keybit);
- if (pdata->b_on_flags[0] & MC13783_BUTTON_RESET_EN)
- reg |= MC13783_POWER_CONTROL_2_ON1BRSTEN;
+ if (pdata->b_on_flags[i] & MC13783_BUTTON_POL_INVERT)
+ priv->flags |= (MC13783_PWRB_B1_POL_INVERT << i);
- irq = platform_get_irq_byname(pdev, "b1on");
+ if (pdata->b_on_flags[i] & MC13783_BUTTON_RESET_EN)
+ reg |= (MC13783_POWER_CONTROL_2_ON1BRSTEN << i);
- if (irq < 0) {
- dev_dbg(&pdev->dev, "Can't request irq\n");
- goto free_mc13xxx_lock;
- }
-
- err = devm_request_any_context_irq(&pdev->dev, irq, button_irq,
- IRQF_ONESHOT, "b1on",
- priv);
- if (err < 0)
- goto free_mc13xxx_lock;
-
- priv->irq[0] = irq;
- }
-
- 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->b_on_flags[1] & MC13783_BUTTON_POL_INVERT)
- priv->flags |= MC13783_PWRB_B2_POL_INVERT;
-
- if (pdata->b_on_flags[1] & MC13783_BUTTON_RESET_EN)
- reg |= MC13783_POWER_CONTROL_2_ON2BRSTEN;
-
- irq = platform_get_irq_byname(pdev, "b2on");
+ irq = platform_get_irq_byname(pdev, devtype->irq_name[i]);
if (irq < 0) {
dev_dbg(&pdev->dev, "Can't request irq\n");
@@ -163,39 +151,12 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
}
err = devm_request_any_context_irq(&pdev->dev, irq, button_irq,
- IRQF_ONESHOT, "b2on",
- priv);
+ IRQF_ONESHOT, devtype->irq_name[i],
+ priv);
if (err < 0)
goto free_mc13xxx_lock;
- priv->irq[1] = irq;
- }
-
- 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->b_on_flags[2] & MC13783_BUTTON_POL_INVERT)
- priv->flags |= MC13783_PWRB_B3_POL_INVERT;
-
- if (pdata->b_on_flags[2] & MC13783_BUTTON_RESET_EN)
- reg |= MC13783_POWER_CONTROL_2_ON3BRSTEN;
-
- irq = platform_get_irq_byname(pdev, "b3on");
-
- if (irq < 0) {
- dev_dbg(&pdev->dev, "Can't request irq: %d\n", err);
- goto free_mc13xxx_lock;
- }
-
- err = devm_request_any_context_irq(&pdev->dev, irq, button_irq,
- IRQF_ONESHOT, "b3on",
- priv);
- if (err < 0)
- goto free_mc13xxx_lock;
-
- priv->irq[2] = irq;
+ priv->irq[i] = irq;
}
mc13xxx_reg_rmw(mc13783, MC13783_REG_POWER_CONTROL_2, 0x3FE, reg);
@@ -226,7 +187,33 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
return err;
}
+static const struct mc13xxx_button_devtype mc13783_button_devtype = {
+ .button_id_max = 2,
+ .irq_name = { "b1on", "b2on", "b3on" },
+ .irq_sense_reg = { 3, 4, 5 },
+};
+
+static const struct mc13xxx_button_devtype mc13892_button_devtype = {
+ .button_id_max = 2,
+ .irq_name = { "b1on", "b2on", "b3on" },
+ .irq_sense_reg = { 3, 4, 2 },
+};
+
+static const struct mc13xxx_button_devtype mc34708_button_devtype = {
+ .button_id_max = 1,
+ .irq_name = { "b1on", "b2on" },
+ .irq_sense_reg = { 3, 4 },
+};
+
+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,
.driver = {
.name = "mc13783-pwrbutton",
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 1756c8d47d5e..c29974722704 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -14,6 +14,7 @@
#include <linux/platform_device.h>
#include <linux/mfd/core.h>
#include <linux/mfd/mc13783.h>
+#include <linux/mfd/mc13892.h>
#include "mc13xxx.h"
@@ -48,11 +49,22 @@
#define MC13XXX_ADC2 45
static const struct resource mc13783_button_resources[] = {
- DEFINE_RES_IRQ_NAMED(MC13783_IRQ_ONOFD1, "b1on"),
- DEFINE_RES_IRQ_NAMED(MC13783_IRQ_ONOFD2, "b2on"),
+ DEFINE_RES_IRQ_NAMED(MC13XXX_IRQ_PWRON1, "b1on"),
+ DEFINE_RES_IRQ_NAMED(MC13XXX_IRQ_PWRON2, "b2on"),
DEFINE_RES_IRQ_NAMED(MC13783_IRQ_ONOFD3, "b3on"),
};
+static const struct resource mc13892_button_resources[] = {
+ DEFINE_RES_IRQ_NAMED(MC13XXX_IRQ_PWRON1, "b1on"),
+ DEFINE_RES_IRQ_NAMED(MC13XXX_IRQ_PWRON2, "b2on"),
+ DEFINE_RES_IRQ_NAMED(MC13892_IRQ_PWRON3, "b3on"),
+};
+
+static const struct resource mc34708_button_resources[] = {
+ DEFINE_RES_IRQ_NAMED(MC13XXX_IRQ_PWRON1, "b1on"),
+ DEFINE_RES_IRQ_NAMED(MC13XXX_IRQ_PWRON2, "b2on"),
+};
+
void mc13xxx_lock(struct mc13xxx *mc13xxx)
{
if (!mutex_trylock(&mc13xxx->lock)) {
@@ -216,14 +228,16 @@ EXPORT_SYMBOL_GPL(mc13xxx_variant_mc13783);
struct mc13xxx_variant mc13xxx_variant_mc13892 = {
.name = "mc13892",
- .button_resources_size = 0,
+ .button_resources = mc13892_button_resources,
+ .button_resources_size = ARRAY_SIZE(mc13892_button_resources),
.print_revision = mc13xxx_print_revision,
};
EXPORT_SYMBOL_GPL(mc13xxx_variant_mc13892);
struct mc13xxx_variant mc13xxx_variant_mc34708 = {
.name = "mc34708",
- .button_resources_size = 0,
+ .button_resources = mc34708_button_resources,
+ .button_resources_size = ARRAY_SIZE(mc34708_button_resources),
.print_revision = mc34708_print_revision,
};
EXPORT_SYMBOL_GPL(mc13xxx_variant_mc34708);
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/mc13892.h b/include/linux/mfd/mc13892.h
index 880cd949d12a..567d527825df 100644
--- a/include/linux/mfd/mc13892.h
+++ b/include/linux/mfd/mc13892.h
@@ -33,4 +33,5 @@
#define MC13892_PWGT2SPI 22
#define MC13892_VCOINCELL 23
+#define MC13892_IRQ_PWRON3 26
#endif
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index 4437ab80fcf8..71c7d3614d4c 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -61,6 +61,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
* [PATCH v7 5/6] Input: mc13783-pwrbutton: add OF support and drop platform_data
From: Alexander Kurz @ 2025-10-31 19:57 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Dmitry Torokhov, Lee Jones, Dzmitry Sankouski,
Griffin Kroah-Hartman, Mathieu Dubois-Briand, Heiko Stuebner,
Dr . David Alan Gilbert, Job Sava, Alexandre Belloni,
Uwe Kleine-König
Cc: devicetree, imx, linux-arm-kernel, linux-kernel, linux-input,
Alexander Kurz
In-Reply-To: <20251031195718.1586-1-akurz@blala.de>
Add OF support for the mc13783-pwrbutton so that it can be used with
modern DT based systems, dropping support for platform_data.
Signed-off-by: Alexander Kurz <akurz@blala.de>
---
drivers/input/misc/mc13783-pwrbutton.c | 104 +++++++++++++++++++++----
drivers/mfd/mc13xxx-core.c | 4 -
include/linux/mfd/mc13xxx.h | 14 ----
3 files changed, 88 insertions(+), 34 deletions(-)
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
index 08618c59197f..0fa630adff19 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>
@@ -41,10 +42,20 @@ struct mc13783_pwrb {
struct mc13xxx *mc13783;
const struct mc13xxx_button_devtype *devtype;
int flags;
+ int b_on_flags[3];
+ unsigned int b_on_key[3];
unsigned short keymap[3];
int irq[3];
};
+#define MC13783_BUTTON_DBNC_0MS 0
+#define MC13783_BUTTON_DBNC_30MS 1
+#define MC13783_BUTTON_DBNC_150MS 2
+#define MC13783_BUTTON_DBNC_750MS 3
+#define MC13783_BUTTON_ENABLE (1 << 2)
+#define MC13783_BUTTON_POL_INVERT (1 << 3)
+#define MC13783_BUTTON_RESET_EN (1 << 4)
+
#define MC13783_PWRB_B1_POL_INVERT (1 << 0)
#define MC13783_PWRB_B2_POL_INVERT (1 << 1)
#define MC13783_PWRB_B3_POL_INVERT (1 << 2)
@@ -88,9 +99,69 @@ static irqreturn_t button_irq(int irq, void *_priv)
return IRQ_HANDLED;
}
+static int mc13xxx_pwrbutton_parse_properties(struct platform_device *pdev,
+ struct mc13783_pwrb *priv)
+{
+ 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;
+
+ struct fwnode_handle *parent __free(fwnode_handle) =
+ device_get_named_child_node(dev->parent, "buttons");
+ if (!parent)
+ return -ENODATA;
+
+ fwnode_for_each_named_child_node(parent, child, "onkey") {
+ 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", &priv->b_on_key[idx]))
+ continue;
+
+ if (fwnode_property_read_bool(child, "active-low"))
+ priv->b_on_flags[idx] |= MC13783_BUTTON_POL_INVERT;
+
+ if (fwnode_property_read_bool(child, "fsl,enable-reset"))
+ priv->b_on_flags[idx] |= MC13783_BUTTON_RESET_EN;
+
+ priv->b_on_flags[idx] |= MC13783_BUTTON_ENABLE | dbnc;
+ }
+
+ return 0;
+}
+
static int mc13783_pwrbutton_probe(struct platform_device *pdev)
{
- const struct mc13xxx_buttons_platform_data *pdata;
+ struct device *dev = &pdev->dev;
struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent);
struct mc13xxx_button_devtype *devtype =
(struct mc13xxx_button_devtype *)pdev->id_entry->driver_data;
@@ -100,11 +171,8 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
int reg = 0;
int irq = 0;
- pdata = dev_get_platdata(&pdev->dev);
- if (!pdata) {
- dev_err(&pdev->dev, "missing platform data\n");
- return -ENODEV;
- }
+ if (!dev->parent->of_node)
+ return -ENODATA;
pwr = devm_input_allocate_device(&pdev->dev);
if (!pwr)
@@ -114,14 +182,18 @@ 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) {
+ err = mc13xxx_pwrbutton_parse_properties(pdev, priv);
+ if (err)
+ return err;
+
+ if (devtype->button_id_max < 2 && priv->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;
+ reg |= (priv->b_on_flags[0] & 0x3) << MC13783_POWER_CONTROL_2_ON1BDBNC;
+ reg |= (priv->b_on_flags[1] & 0x3) << MC13783_POWER_CONTROL_2_ON2BDBNC;
+ reg |= (priv->b_on_flags[2] & 0x3) << MC13783_POWER_CONTROL_2_ON3BDBNC;
priv->pwr = pwr;
priv->mc13783 = mc13783;
@@ -130,17 +202,17 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
mc13xxx_lock(mc13783);
for (int i = 0; i < devtype->button_id_max; i++) {
- if ((pdata->b_on_flags[i] & MC13783_BUTTON_ENABLE) == 0)
+ if ((priv->b_on_flags[i] & MC13783_BUTTON_ENABLE) == 0)
continue;
- priv->keymap[i] = pdata->b_on_key[i];
- if (pdata->b_on_key[i] != KEY_RESERVED)
- __set_bit(pdata->b_on_key[i], pwr->keybit);
+ priv->keymap[i] = priv->b_on_key[i];
+ if (priv->b_on_key[i] != KEY_RESERVED)
+ __set_bit(priv->b_on_key[i], pwr->keybit);
- if (pdata->b_on_flags[i] & MC13783_BUTTON_POL_INVERT)
+ if (priv->b_on_flags[i] & MC13783_BUTTON_POL_INVERT)
priv->flags |= (MC13783_PWRB_B1_POL_INVERT << i);
- if (pdata->b_on_flags[i] & MC13783_BUTTON_RESET_EN)
+ if (priv->b_on_flags[i] & MC13783_BUTTON_RESET_EN)
reg |= (MC13783_POWER_CONTROL_2_ON1BRSTEN << i);
irq = platform_get_irq_byname(pdev, devtype->irq_name[i]);
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index c29974722704..9512136e821b 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -504,10 +504,6 @@ int mc13xxx_common_init(struct device *dev)
&pdata->regulators, sizeof(pdata->regulators));
mc13xxx_add_subdevice_pdata(mc13xxx, "%s-led",
pdata->leds, sizeof(*pdata->leds));
- mc13xxx_add_subdevice_pdata_res(mc13xxx, "%s-pwrbutton",
- pdata->buttons, sizeof(*pdata->buttons),
- mc13xxx->variant->button_resources,
- mc13xxx->variant->button_resources_size);
if (mc13xxx->flags & MC13XXX_USE_CODEC)
mc13xxx_add_subdevice_pdata(mc13xxx, "%s-codec",
pdata->codec, sizeof(*pdata->codec));
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index 71c7d3614d4c..ac3765df341d 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -174,19 +174,6 @@ struct mc13xxx_leds_platform_data {
u32 led_control[MAX_LED_CONTROL_REGS];
};
-#define MC13783_BUTTON_DBNC_0MS 0
-#define MC13783_BUTTON_DBNC_30MS 1
-#define MC13783_BUTTON_DBNC_150MS 2
-#define MC13783_BUTTON_DBNC_750MS 3
-#define MC13783_BUTTON_ENABLE (1 << 2)
-#define MC13783_BUTTON_POL_INVERT (1 << 3)
-#define MC13783_BUTTON_RESET_EN (1 << 4)
-
-struct mc13xxx_buttons_platform_data {
- int b_on_flags[3];
- unsigned int b_on_key[3];
-};
-
#define MC13783_TS_ATO_FIRST false
#define MC13783_TS_ATO_EACH true
@@ -219,7 +206,6 @@ struct mc13xxx_platform_data {
struct mc13xxx_regulator_platform_data regulators;
struct mc13xxx_leds_platform_data *leds;
- struct mc13xxx_buttons_platform_data *buttons;
struct mc13xxx_ts_platform_data touch;
struct mc13xxx_codec_platform_data *codec;
};
--
2.39.5
^ permalink raw reply related
* [PATCH v7 6/6] ARM: dts: imx53: add imx53-qsrb PMIC power button
From: Alexander Kurz @ 2025-10-31 19:57 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Dmitry Torokhov, Lee Jones, Dzmitry Sankouski,
Griffin Kroah-Hartman, Mathieu Dubois-Briand, Heiko Stuebner,
Dr . David Alan Gilbert, Job Sava, Alexandre Belloni,
Uwe Kleine-König
Cc: devicetree, imx, linux-arm-kernel, linux-kernel, linux-input,
Alexander Kurz
In-Reply-To: <20251031195718.1586-1-akurz@blala.de>
As described in the board hardware user guide IMX53RQSBRM-R.pdf, the
mc34708 pin PWRON1 is connected to a button "SW6"/"POWER", connecting
this line to GND.
Add support for the imx53-qsrb "POWER" button.
Signed-off-by: Alexander Kurz <akurz@blala.de>
---
arch/arm/boot/dts/nxp/imx/imx53-qsrb.dts | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/arm/boot/dts/nxp/imx/imx53-qsrb.dts b/arch/arm/boot/dts/nxp/imx/imx53-qsrb.dts
index 2f06ad61a766..977dff72b9e2 100644
--- a/arch/arm/boot/dts/nxp/imx/imx53-qsrb.dts
+++ b/arch/arm/boot/dts/nxp/imx/imx53-qsrb.dts
@@ -139,6 +139,19 @@ vgen2_reg: vgen2 {
regulator-always-on;
};
};
+
+ buttons {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ onkey@0 {
+ reg = <0>;
+ linux,code = <KEY_POWER>;
+ debounce-delay-ms = <30>;
+ active-low;
+ fsl,enable-reset;
+ };
+ };
};
};
--
2.39.5
^ permalink raw reply related
* [PATCH v7 2/6] Input: mc13783-pwrbutton: fix irq mixup and use resources
From: Alexander Kurz @ 2025-10-31 19:57 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Dmitry Torokhov, Lee Jones, Dzmitry Sankouski,
Griffin Kroah-Hartman, Mathieu Dubois-Briand, Heiko Stuebner,
Dr . David Alan Gilbert, Job Sava, Alexandre Belloni,
Uwe Kleine-König
Cc: devicetree, imx, linux-arm-kernel, linux-kernel, linux-input,
Alexander Kurz
In-Reply-To: <20251031195718.1586-1-akurz@blala.de>
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() got get called with virtual irq instead
of chip-internal irq.
Make use of mfd_cell resources to pass interrupts from mfd so that
platform_get_irq_byname() can be used in mc13783-pwrbutton. The
amount of required interrupt related cleanup can be reduced this way.
Note, that mc13783-pwrbutton is still considered to support only the
model mc13783.
Signed-off-by: Alexander Kurz <akurz@blala.de>
---
drivers/input/misc/mc13783-pwrbutton.c | 103 +++++++++++--------------
drivers/mfd/mc13xxx-core.c | 39 ++++++++--
drivers/mfd/mc13xxx.h | 2 +
3 files changed, 79 insertions(+), 65 deletions(-)
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
index 82434ea9cca5..20f68aab6edf 100644
--- a/drivers/input/misc/mc13783-pwrbutton.c
+++ b/drivers/input/misc/mc13783-pwrbutton.c
@@ -33,13 +33,15 @@
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];
+ int irq[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)
@@ -60,27 +62,21 @@ static irqreturn_t button_irq(int irq, void *_priv)
mc13xxx_reg_read(priv->mc13783, MC13783_REG_INTERRUPT_SENSE_1, &val);
- switch (irq) {
- case MC13783_IRQ_ONOFD1:
+ if (irq == priv->irq[0]) {
val = val & MC13783_IRQSENSE1_ONOFD1S ? 1 : 0;
if (priv->flags & MC13783_PWRB_B1_POL_INVERT)
val ^= 1;
input_report_key(priv->pwr, priv->keymap[0], val);
- break;
-
- case MC13783_IRQ_ONOFD2:
+ } else if (irq == priv->irq[1]) {
val = val & MC13783_IRQSENSE1_ONOFD2S ? 1 : 0;
if (priv->flags & MC13783_PWRB_B2_POL_INVERT)
val ^= 1;
input_report_key(priv->pwr, priv->keymap[1], val);
- break;
-
- case MC13783_IRQ_ONOFD3:
+ } else if (irq == priv->irq[2]) {
val = val & MC13783_IRQSENSE1_ONOFD3S ? 1 : 0;
if (priv->flags & MC13783_PWRB_B3_POL_INVERT)
val ^= 1;
input_report_key(priv->pwr, priv->keymap[2], val);
- break;
}
input_sync(priv->pwr);
@@ -96,6 +92,7 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
struct mc13783_pwrb *priv;
int err = 0;
int reg = 0;
+ int irq = 0;
pdata = dev_get_platdata(&pdev->dev);
if (!pdata) {
@@ -131,12 +128,20 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
if (pdata->b1on_flags & MC13783_BUTTON_RESET_EN)
reg |= MC13783_POWER_CONTROL_2_ON1BRSTEN;
- err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD1,
- button_irq, "b1on", priv);
- if (err) {
+ irq = platform_get_irq_byname(pdev, "b1on");
+
+ if (irq < 0) {
dev_dbg(&pdev->dev, "Can't request irq\n");
goto free_mc13xxx_lock;
}
+
+ err = devm_request_any_context_irq(&pdev->dev, irq, button_irq,
+ IRQF_ONESHOT, "b1on",
+ priv);
+ if (err < 0)
+ goto free_mc13xxx_lock;
+
+ priv->irq[0] = irq;
}
if (pdata->b2on_flags & MC13783_BUTTON_ENABLE) {
@@ -150,12 +155,20 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
if (pdata->b2on_flags & MC13783_BUTTON_RESET_EN)
reg |= MC13783_POWER_CONTROL_2_ON2BRSTEN;
- err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD2,
- button_irq, "b2on", priv);
- if (err) {
+ irq = platform_get_irq_byname(pdev, "b2on");
+
+ if (irq < 0) {
dev_dbg(&pdev->dev, "Can't request irq\n");
- goto free_irq_b1;
+ goto free_mc13xxx_lock;
}
+
+ err = devm_request_any_context_irq(&pdev->dev, irq, button_irq,
+ IRQF_ONESHOT, "b2on",
+ priv);
+ if (err < 0)
+ goto free_mc13xxx_lock;
+
+ priv->irq[1] = irq;
}
if (pdata->b3on_flags & MC13783_BUTTON_ENABLE) {
@@ -169,12 +182,20 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
if (pdata->b3on_flags & MC13783_BUTTON_RESET_EN)
reg |= MC13783_POWER_CONTROL_2_ON3BRSTEN;
- err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD3,
- button_irq, "b3on", priv);
- if (err) {
+ irq = platform_get_irq_byname(pdev, "b3on");
+
+ if (irq < 0) {
dev_dbg(&pdev->dev, "Can't request irq: %d\n", err);
- goto free_irq_b2;
+ goto free_mc13xxx_lock;
}
+
+ err = devm_request_any_context_irq(&pdev->dev, irq, button_irq,
+ IRQF_ONESHOT, "b3on",
+ priv);
+ if (err < 0)
+ goto free_mc13xxx_lock;
+
+ priv->irq[2] = irq;
}
mc13xxx_reg_rmw(mc13783, MC13783_REG_POWER_CONTROL_2, 0x3FE, reg);
@@ -192,55 +213,21 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
err = input_register_device(pwr);
if (err) {
dev_dbg(&pdev->dev, "Can't register power button: %d\n", err);
- goto free_irq;
+ return err;
}
platform_set_drvdata(pdev, priv);
return 0;
-free_irq:
- mc13xxx_lock(mc13783);
-
- if (pdata->b3on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD3, priv);
-
-free_irq_b2:
- if (pdata->b2on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD2, priv);
-
-free_irq_b1:
- if (pdata->b1on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD1, priv);
-
free_mc13xxx_lock:
mc13xxx_unlock(mc13783);
return err;
}
-static void mc13783_pwrbutton_remove(struct platform_device *pdev)
-{
- struct mc13783_pwrb *priv = platform_get_drvdata(pdev);
- const struct mc13xxx_buttons_platform_data *pdata;
-
- pdata = dev_get_platdata(&pdev->dev);
-
- mc13xxx_lock(priv->mc13783);
-
- if (pdata->b3on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD3, priv);
- if (pdata->b2on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD2, priv);
- if (pdata->b1on_flags & MC13783_BUTTON_ENABLE)
- mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD1, priv);
-
- mc13xxx_unlock(priv->mc13783);
-}
-
static struct platform_driver mc13783_pwrbutton_driver = {
.probe = mc13783_pwrbutton_probe,
- .remove = mc13783_pwrbutton_remove,
.driver = {
.name = "mc13783-pwrbutton",
},
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 920797b806ce..1756c8d47d5e 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -13,6 +13,7 @@
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/mfd/core.h>
+#include <linux/mfd/mc13783.h>
#include "mc13xxx.h"
@@ -46,6 +47,12 @@
#define MC13XXX_ADC2 45
+static const struct resource mc13783_button_resources[] = {
+ DEFINE_RES_IRQ_NAMED(MC13783_IRQ_ONOFD1, "b1on"),
+ DEFINE_RES_IRQ_NAMED(MC13783_IRQ_ONOFD2, "b2on"),
+ DEFINE_RES_IRQ_NAMED(MC13783_IRQ_ONOFD3, "b3on"),
+};
+
void mc13xxx_lock(struct mc13xxx *mc13xxx)
{
if (!mutex_trylock(&mc13xxx->lock)) {
@@ -201,18 +208,22 @@ static void mc34708_print_revision(struct mc13xxx *mc13xxx, u32 revision)
/* These are only exported for mc13xxx-i2c and mc13xxx-spi */
struct mc13xxx_variant mc13xxx_variant_mc13783 = {
.name = "mc13783",
+ .button_resources = mc13783_button_resources,
+ .button_resources_size = ARRAY_SIZE(mc13783_button_resources),
.print_revision = mc13xxx_print_revision,
};
EXPORT_SYMBOL_GPL(mc13xxx_variant_mc13783);
struct mc13xxx_variant mc13xxx_variant_mc13892 = {
.name = "mc13892",
+ .button_resources_size = 0,
.print_revision = mc13xxx_print_revision,
};
EXPORT_SYMBOL_GPL(mc13xxx_variant_mc13892);
struct mc13xxx_variant mc13xxx_variant_mc34708 = {
.name = "mc34708",
+ .button_resources_size = 0,
.print_revision = mc34708_print_revision,
};
EXPORT_SYMBOL_GPL(mc13xxx_variant_mc34708);
@@ -362,15 +373,18 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode,
}
EXPORT_SYMBOL_GPL(mc13xxx_adc_do_conversion);
-static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx,
- const char *format, void *pdata, size_t pdata_size)
+static int mc13xxx_add_subdevice_pdata_res(struct mc13xxx *mc13xxx,
+ const char *format, void *pdata, size_t pdata_size,
+ const struct resource *resources, int num_resources)
{
char buf[30];
const char *name = mc13xxx_get_chipname(mc13xxx);
struct mfd_cell cell = {
- .platform_data = pdata,
- .pdata_size = pdata_size,
+ .platform_data = pdata,
+ .pdata_size = pdata_size,
+ .resources = resources,
+ .num_resources = num_resources,
};
/* there is no asnprintf in the kernel :-( */
@@ -385,6 +399,12 @@ static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx,
regmap_irq_get_domain(mc13xxx->irq_data));
}
+static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx,
+ const char *format, void *pdata, size_t pdata_size)
+{
+ return mc13xxx_add_subdevice_pdata_res(mc13xxx, format, pdata, pdata_size, NULL, 0);
+}
+
static int mc13xxx_add_subdevice(struct mc13xxx *mc13xxx, const char *format)
{
return mc13xxx_add_subdevice_pdata(mc13xxx, format, NULL, 0);
@@ -470,8 +490,10 @@ int mc13xxx_common_init(struct device *dev)
&pdata->regulators, sizeof(pdata->regulators));
mc13xxx_add_subdevice_pdata(mc13xxx, "%s-led",
pdata->leds, sizeof(*pdata->leds));
- mc13xxx_add_subdevice_pdata(mc13xxx, "%s-pwrbutton",
- pdata->buttons, sizeof(*pdata->buttons));
+ mc13xxx_add_subdevice_pdata_res(mc13xxx, "%s-pwrbutton",
+ pdata->buttons, sizeof(*pdata->buttons),
+ mc13xxx->variant->button_resources,
+ mc13xxx->variant->button_resources_size);
if (mc13xxx->flags & MC13XXX_USE_CODEC)
mc13xxx_add_subdevice_pdata(mc13xxx, "%s-codec",
pdata->codec, sizeof(*pdata->codec));
@@ -481,7 +503,10 @@ int mc13xxx_common_init(struct device *dev)
} else {
mc13xxx_add_subdevice(mc13xxx, "%s-regulator");
mc13xxx_add_subdevice(mc13xxx, "%s-led");
- mc13xxx_add_subdevice(mc13xxx, "%s-pwrbutton");
+ mc13xxx_add_subdevice_pdata_res(mc13xxx, "%s-pwrbutton",
+ NULL, 0,
+ mc13xxx->variant->button_resources,
+ mc13xxx->variant->button_resources_size);
if (mc13xxx->flags & MC13XXX_USE_CODEC)
mc13xxx_add_subdevice(mc13xxx, "%s-codec");
if (mc13xxx->flags & MC13XXX_USE_TOUCHSCREEN)
diff --git a/drivers/mfd/mc13xxx.h b/drivers/mfd/mc13xxx.h
index bd5ba9a0e14f..b13ae652f4ec 100644
--- a/drivers/mfd/mc13xxx.h
+++ b/drivers/mfd/mc13xxx.h
@@ -18,6 +18,8 @@ struct mc13xxx;
struct mc13xxx_variant {
const char *name;
+ const struct resource *button_resources;
+ int button_resources_size;
void (*print_revision)(struct mc13xxx *mc13xxx, u32 revision);
};
--
2.39.5
^ permalink raw reply related
* [PATCH v7 0/6] Fix, extend and support OF to mc13xxx pwrbutton
From: Alexander Kurz @ 2025-10-31 19:57 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Dmitry Torokhov, Lee Jones, Dzmitry Sankouski,
Griffin Kroah-Hartman, Mathieu Dubois-Briand, Heiko Stuebner,
Dr . David Alan Gilbert, Job Sava, Alexandre Belloni,
Uwe Kleine-König
Cc: devicetree, imx, linux-arm-kernel, linux-kernel, linux-input,
Alexander Kurz
Goal of this patch series is to make mx13xxx power buttons usable
on DT based systems.
A ten-year-old IRQ issue needed a fix, mc13783-pwrbutton had to be
extended to the other to mc13xxx PMIC as well and adding OF support.
The implementation has been tested with PWRON1 on mc13892 found e.g.
in amazon kindle D01100/D01200/EY21 readers and also in on mc34708
in the imx53-qsrb "i.MX53 Quick start board".
Changes in v7:
- Link to v6: https://lore.kernel.org/linux-input/20251030195654.20142-1-akurz@blala.de/
- Fixed missing empty line for imx53-qsrb dts patch, thanks Frank.
Changes in v6:
- Link to v5: https://lore.kernel.org/linux-input/20251008064401.13863-1-akurz@blala.de/
- Rebase to v6.18-rc1
- Add a imx53-qsrb dts patch to enable the "power" button on the
i.MX53 Quick start board.
Changes in v5:
- Link to v4: https://lore.kernel.org/linux-input/20250914193723.10544-1-akurz@blala.de/
- Rebase to current to include already merged dt-schema patches and
a different mc13xxx related patch.
- Drop patch to use devm_mfd_add_devices and devm_regmap_add_irq_chip -
won't like to do the proposed mutex-cleanup now.
- While adding OF support, remove the platform_data configuration
interface as proposed by Dmitry Torokhov. Also drop the change
to use module_platform_driver_probe.
Changes in v4:
- Link to v3: https://lore.kernel.org/linux-input/20250829201517.15374-1-akurz@blala.de/
- Rebase to git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git
tags/ib-mfd-input-rtc-v6.18 in order to include a different mc13xxx
related patch (sorry for that).
- Re-ordered commits since dt-bindings changes already go reviewes by
Rob Herring.
- Following Dmitrys suggestions, resources for irq are now passed from
mfd to input allowing a more simple implementation. Work on other mfd
cells with irq usage might still be a future project.
- Input-related differences between the mc13xxx variants are encoded
in data structures, making the implementation of mc13892 PWRON3 a
simple task.
Changes in v3:
- Link to v2: https://lore.kernel.org/linux-input/20250823144441.12654-1-akurz@blala.de/
- Undo all changes to led-control (rename to fsl,led-control), thanks Rob
- Restructured the new buttons node for unevaluatedProperties: false
- Various other remarks from Rob
- Rebase to current state
Changes in v2:
- Link to v1: https://lore.kernel.org/linux-input/20250817102751.29709-1-akurz@blala.de/
- 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.
Alexander Kurz (6):
Input: mc13783-pwrbutton: use managed resources
Input: mc13783-pwrbutton: fix irq mixup and use resources
Input: mc13783-pwrbutton: convert pdata members to array
Input: mc13783-pwrbutton: enable other mc13xxx PMIC
Input: mc13783-pwrbutton: add OF support and drop platform_data
ARM: dts: imx53: add imx53-qsrb PMIC power button
arch/arm/boot/dts/nxp/imx/imx53-qsrb.dts | 13 ++
drivers/input/misc/Kconfig | 4 +-
drivers/input/misc/mc13783-pwrbutton.c | 278 +++++++++++++----------
drivers/mfd/mc13xxx-core.c | 49 +++-
drivers/mfd/mc13xxx.h | 2 +
include/linux/mfd/mc13783.h | 4 +-
include/linux/mfd/mc13892.h | 1 +
include/linux/mfd/mc13xxx.h | 20 +-
8 files changed, 220 insertions(+), 151 deletions(-)
--
2.39.5
^ permalink raw reply
* [PATCH v7 3/6] Input: mc13783-pwrbutton: convert pdata members to array
From: Alexander Kurz @ 2025-10-31 19:57 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Dmitry Torokhov, Lee Jones, Dzmitry Sankouski,
Griffin Kroah-Hartman, Mathieu Dubois-Briand, Heiko Stuebner,
Dr . David Alan Gilbert, Job Sava, Alexandre Belloni,
Uwe Kleine-König
Cc: devicetree, imx, linux-arm-kernel, linux-kernel, linux-input,
Alexander Kurz
In-Reply-To: <20251031195718.1586-1-akurz@blala.de>
As preparation for the extension of support for all three mc13xxx
variants, 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 | 42 +++++++++++++-------------
include/linux/mfd/mc13xxx.h | 8 ++---
2 files changed, 23 insertions(+), 27 deletions(-)
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
index 20f68aab6edf..2ee115d77b1c 100644
--- a/drivers/input/misc/mc13783-pwrbutton.c
+++ b/drivers/input/misc/mc13783-pwrbutton.c
@@ -108,24 +108,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;
irq = platform_get_irq_byname(pdev, "b1on");
@@ -144,15 +144,15 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
priv->irq[0] = irq;
}
- 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;
irq = platform_get_irq_byname(pdev, "b2on");
@@ -171,15 +171,15 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
priv->irq[1] = irq;
}
- 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;
irq = platform_get_irq_byname(pdev, "b3on");
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index dd46fe424a80..4437ab80fcf8 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -181,12 +181,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
* [PATCH v7 1/6] Input: mc13783-pwrbutton: use managed resources
From: Alexander Kurz @ 2025-10-31 19:57 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Dmitry Torokhov, Lee Jones, Dzmitry Sankouski,
Griffin Kroah-Hartman, Mathieu Dubois-Briand, Heiko Stuebner,
Dr . David Alan Gilbert, Job Sava, Alexandre Belloni,
Uwe Kleine-König
Cc: devicetree, imx, linux-arm-kernel, linux-kernel, linux-input,
Alexander Kurz
In-Reply-To: <20251031195718.1586-1-akurz@blala.de>
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 b83d762ae2e9..82434ea9cca5 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>
@@ -102,18 +103,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;
@@ -139,7 +135,7 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
button_irq, "b1on", priv);
if (err) {
dev_dbg(&pdev->dev, "Can't request irq\n");
- goto free_priv;
+ goto free_mc13xxx_lock;
}
}
@@ -187,7 +183,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);
@@ -218,12 +213,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;
}
@@ -245,9 +236,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
* Re: [PATCH v6 6/6] ARM: dts: imx53: add imx53-qsrb PMIC power button
From: Frank Li @ 2025-10-31 19:32 UTC (permalink / raw)
To: Alexander Kurz
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Dmitry Torokhov, Lee Jones, Dzmitry Sankouski,
Griffin Kroah-Hartman, Mathieu Dubois-Briand, Heiko Stuebner,
Dr . David Alan Gilbert, Job Sava, Alexandre Belloni,
Uwe Kleine-König, devicetree, imx, linux-arm-kernel,
linux-kernel, linux-input
In-Reply-To: <20251030195654.20142-7-akurz@blala.de>
On Thu, Oct 30, 2025 at 07:56:54PM +0000, Alexander Kurz wrote:
> As described in the board hardware user guide IMX53RQSBRM-R.pdf, the
> mc34708 pin PWRON1 is connected to a button "SW6"/"POWER", connecting
> this line to GND.
> Add support for the imx53-qsrb "POWER" button.
>
> Signed-off-by: Alexander Kurz <akurz@blala.de>
> ---
> arch/arm/boot/dts/nxp/imx/imx53-qsrb.dts | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/arch/arm/boot/dts/nxp/imx/imx53-qsrb.dts b/arch/arm/boot/dts/nxp/imx/imx53-qsrb.dts
> index 2f06ad61a766..2a6d28e9e8f8 100644
> --- a/arch/arm/boot/dts/nxp/imx/imx53-qsrb.dts
> +++ b/arch/arm/boot/dts/nxp/imx/imx53-qsrb.dts
> @@ -139,6 +139,18 @@ vgen2_reg: vgen2 {
> regulator-always-on;
> };
> };
> +
> + buttons {
> + #address-cells = <1>;
> + #size-cells = <0>;
Need empty line here
Frank
> + onkey@0 {
> + reg = <0>;
> + linux,code = <KEY_POWER>;
> + debounce-delay-ms = <30>;
> + active-low;
> + fsl,enable-reset;
> + };
> + };
> };
> };
>
> --
> 2.39.5
>
^ permalink raw reply
* Re: [PATCH v2 2/3] Input: twl4030 - add TWL603x power button
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
In-Reply-To: <20251030-twl6030-button-v2-2-09653d05a2b1@kernel.org>
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
* Re: [PATCH] HID: hid-input: Extend Elan ignore battery quirk to USB
From: Dmitry Torokhov @ 2025-10-31 14:47 UTC (permalink / raw)
To: Hans de Goede
Cc: Jiri Kosina, Mario Limonciello (AMD), mario.limonciello, bentiss,
André Barata, linux-input, Kenneth Albanowski
In-Reply-To: <17f02b01-c71e-4e2e-9e91-757731f3fc2e@kernel.org>
Hi Hans,
On Fri, Oct 31, 2025 at 2:13 AM Hans de Goede <hansg@kernel.org> wrote:
>
> Hi Jiri,
>
> On 31-Oct-25 10:07 AM, Jiri Kosina wrote:
> > On Thu, 30 Oct 2025, Mario Limonciello (AMD) wrote:
> >
> >> USB Elan devices have the same problem as the I2C ones with a fake
> >> battery device showing up.
> >>
> >> Reviewed-by: Hans de Goede <hansg@kernel.org>
> >> Reported-by: André Barata <andretiagob@protonmail.com>
> >> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220722
> >> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
> >
> > Now applied.
> >
> > We'll have to come up with something more sophisticated once/if Elan ever
> > starts producing devices with real battery ...
>
> Actually the provided HID battery is intended to be for
> when a stylus is used and to report the stylus battery
> values then.
>
> There is an email thread somewhere with some of the ChromeOS folks
> talking about dropping the ELAN quirk for I2C touchscreens and
> indeed replacing it with something more sophisticated. IIRC
> the ChromeOS folks mentioned they would work on / provide patches.
>
> +To: Dmitry, Dmitry do you have any input on the ChromeOs issue ?
+Kenneth Albanowski has been wrangling with support of Elan and other
vendor styli, I'll let him comment.
>
> In the mean time I do believe these quirks are the lesser of
> 2 evils. Most people don't have a stylus (which is typically not
> bundled with these devices) and even if people have a stylus
> not having battery reporting for that is less of a problem then
> the false positive low-battery *notifications* which e.g. GNOME
> shows due to the battery reporting 0% (rather then not present)
> when there is no stylus.
Thanks,
Dmitry
^ permalink raw reply
* Re: [PATCH v7 5/9] platform/x86: asus-wmi: Add support for multiple kbd led handlers
From: Antheas Kapenekakis @ 2025-10-31 12:13 UTC (permalink / raw)
To: Jiri Kosina
Cc: kernel test robot, platform-driver-x86, linux-input,
oe-kbuild-all, linux-kernel, Benjamin Tissoires, Corentin Chary,
Luke D . Jones, Hans de Goede, Ilpo Järvinen, Denis Benato
In-Reply-To: <39n24387-0o0n-50p8-s2rn-9qoqs6sq8336@xreary.bet>
On Fri, 31 Oct 2025 at 09:27, Jiri Kosina <jikos@kernel.org> wrote:
>
> On Thu, 23 Oct 2025, Antheas Kapenekakis wrote:
>
> > > 1589
> > > 1590 static void kbd_led_update_all(struct work_struct *work)
> > > 1591 {
> > > 1592 enum led_brightness value;
> > > 1593 struct asus_wmi *asus;
> > > 1594 bool registered, notify;
> > > 1595 int ret;
> > /\ value should have been an int and
> > placed here. It can take the value -1 hence the check
>
> Thanks, that needs to be fixed before the final merge.
>
> > Are there any other comments on the series?
> >
> > The only issue I am aware of is that Denis identified a bug in asusd
> > (asusctl userspace program daemon) in certain Asus G14/G16 laptops
> > that cause laptop keys to become sticky, I have had users also report
> > that bug in previous versions of the series. WIthout asusd running,
> > keyboards work fine incl. with brightness control (did not work
> > before). Given it will take two months for this to reach mainline, I
> > think it is a fair amount of time to address the bug.
>
> One thing that is not clear to me about this -- is this causing a visible
> user-space behavior regression before vs. after the patchset with asusctl?
>
> If so, I am afraid this needs to be root-caused and fixed before the set
> can be considered for inclusion.
Commit 591ba2074337 ("HID: asus: prevent binding to all HID devices on
ROG") adds HID_QUIRK_INPUT_PER_APP and the extra devices seem to
confuse asusd. Since the devices are the same as with hid-asus not
loaded, it is specific to that program.
We can delay that patch until Denis who took over maintenance of the
program can have a deeper look. I will still keep the last part of
that patch that skips the input check, because that causes errors in
devices that do not create an input device (e.g., lightbar).
Antheas
> Thanks,
>
> --
> Jiri Kosina
> SUSE Labs
>
>
^ permalink raw reply
* Re: [PATCH] HID: mcp2221: fix slab-out-of-bounds in mcp2221_raw_event() Inbox
From: Jiri Kosina @ 2025-10-31 9:19 UTC (permalink / raw)
To: Atharv Dubey; +Cc: Benjamin Tissoires, linux-input, linux-kernel
In-Reply-To: <CAKTQj-6bWMxzFaUa89KC83vF0u1qUKd-RbLOLcyYOD+16+5rjQ@mail.gmail.com>
On Sun, 26 Oct 2025, Atharv Dubey wrote:
> From: Atharv Dubey <atharvd440@gmail.com <athrvd440@gmail.com>>
>
> A negative idx value could cause a slab-out-of-bounds access
> when indexing the report buffer in mcp2221_raw_event().
>
> Add a check to ensure that idx is greater than or equal to zero
> before accessing the buffer, preventing invalid memory access
> and potential kernel crashes.
>
> Fixes: 3a8660878839 ("KASAN: slab-out-of-bounds Read in mcp2221_raw_event
> (2)")
> Reported-by: syzbot+1018672fe70298606e5f@syzkaller.appspotmail.com
> Signed-off-by: Atharv Dubey <atharvd440@gmail.com>
Thanks a lot for the fix.
The patch has however been line-wrapped and damaged by yolur mail client.
Could you please look [1] into fixing that and resubmit?
[1] https://docs.kernel.org/process/email-clients.html
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH] HID: hid-input: Extend Elan ignore battery quirk to USB
From: Hans de Goede @ 2025-10-31 9:13 UTC (permalink / raw)
To: Jiri Kosina, Mario Limonciello (AMD), Dmitry Torokhov
Cc: mario.limonciello, bentiss, André Barata, linux-input
In-Reply-To: <s0qn1098-s856-1942-48q7-n3691sn109qs@xreary.bet>
Hi Jiri,
On 31-Oct-25 10:07 AM, Jiri Kosina wrote:
> On Thu, 30 Oct 2025, Mario Limonciello (AMD) wrote:
>
>> USB Elan devices have the same problem as the I2C ones with a fake
>> battery device showing up.
>>
>> Reviewed-by: Hans de Goede <hansg@kernel.org>
>> Reported-by: André Barata <andretiagob@protonmail.com>
>> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220722
>> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
>
> Now applied.
>
> We'll have to come up with something more sophisticated once/if Elan ever
> starts producing devices with real battery ...
Actually the provided HID battery is intended to be for
when a stylus is used and to report the stylus battery
values then.
There is an email thread somewhere with some of the ChromeOS folks
talking about dropping the ELAN quirk for I2C touchscreens and
indeed replacing it with something more sophisticated. IIRC
the ChromeOS folks mentioned they would work on / provide patches.
+To: Dmitry, Dmitry do you have any input on the ChromeOs issue ?
In the mean time I do believe these quirks are the lesser of
2 evils. Most people don't have a stylus (which is typically not
bundled with these devices) and even if people have a stylus
not having battery reporting for that is less of a problem then
the false positive low-battery *notifications* which e.g. GNOME
shows due to the battery reporting 0% (rather then not present)
when there is no stylus.
Regards,
Hans
^ permalink raw reply
* Re: [PATCH] HID: nintendo: Reduce JC_SUBCMD_RATE_MAX_ATTEMPTS
From: Jiri Kosina @ 2025-10-31 9:12 UTC (permalink / raw)
To: Willy Huang
Cc: Daniel J . Ogorchock, Benjamin Tissoires, linux-input,
linux-kernel
In-Reply-To: <20251030063704.903998-1-willyhuang@google.com>
On Thu, 30 Oct 2025, Willy Huang wrote:
> The JC_SUBCMD_RATE_MAX_ATTEMPTS constant is currently set to 500.
> In a worst-case scenario where all attempts consistently fail, this could
> cause the loop to block for up to 60000 ms (500 * 60ms * 2, including the
> additional retry after a timeout).
>
> This change lowers the maximum potential blocking time to 3000 ms
> (25 * 60ms * 2), improving system responsiveness and efficiency.
>
> Signed-off-by: Willy Huang <willyhuang@google.com>
Applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH] HID: hid-input: Extend Elan ignore battery quirk to USB
From: Jiri Kosina @ 2025-10-31 9:07 UTC (permalink / raw)
To: Mario Limonciello (AMD)
Cc: mario.limonciello, bentiss, Hans de Goede, André Barata,
linux-input
In-Reply-To: <20251030160643.3775606-1-superm1@kernel.org>
On Thu, 30 Oct 2025, Mario Limonciello (AMD) wrote:
> USB Elan devices have the same problem as the I2C ones with a fake
> battery device showing up.
>
> Reviewed-by: Hans de Goede <hansg@kernel.org>
> Reported-by: André Barata <andretiagob@protonmail.com>
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220722
> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Now applied.
We'll have to come up with something more sophisticated once/if Elan ever
starts producing devices with real battery ...
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH] HID: playstation: Remap joystick axes to be centered at 0
From: Jiri Kosina @ 2025-10-31 9:00 UTC (permalink / raw)
To: Siarhei Vishniakou
Cc: Benjamin Tissoires, Roderick Colenbrander, linux-input,
linux-kernel
In-Reply-To: <20251010012006.2282321-1-svv@google.com>
On Fri, 10 Oct 2025, Siarhei Vishniakou wrote:
> The joystick axes (ABS_X, ABS_Y, ABS_RX, ABS_RY) for PlayStation
> gamepads report a neutral state of 128 over HID, with a full range of
> [0, 255]. The driver previously mapped this directly, resulting in an
> evdev range of [0, 255] with a resting point of 128.
>
> This approach is unconventional for Linux gamepad drivers and has several
> drawbacks: it requires userspace applications to be aware of the
> non-zero resting state, and it is incompatible with the input
> subsystem's 'flat' (deadzone) logic, which assumes a resting point of 0.
>
> This patch remaps the four joystick axes to the conventional signed
> 8-bit range of [-128, 127], with 0 as the neutral state. This is
> accomplished by changing their evdev range in ps_gamepad_create() and
> translating the incoming hardware value in the report parsing functions
> by subtracting 128.
>
> The analog trigger axes (ABS_Z, ABS_RZ) are handled separately. Their
> resting state is 0 (un-pressed), and their hardware range of [0, 255]
> is already the conventional representation. They are left unmodified by
> this patch.
>
> This makes the joystick behavior consistent with other gamepad drivers
> while preserving the standard behavior for the triggers.
>
> Signed-off-by: Siarhei Vishniakou <svv@google.com>
Hmmm ... as I am rather unaware of the existing playstation userspace
ecosystem -- is there any way how we could now be breaking existing
playstation-specific userspace assumptions that have already developed
based on asumptions that we're centered at 128?
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH v2] HID: hid-ntrig: Prevent memory leak in ntrig_report_version()
From: Jiri Kosina @ 2025-10-31 8:59 UTC (permalink / raw)
To: Masami Ichikawa; +Cc: bentiss, minbell.kim, linux-input, linux-kernel
In-Reply-To: <20250921053102.150182-1-masami256@gmail.com>
On Sun, 21 Sep 2025, Masami Ichikawa wrote:
> Use a scope-based cleanup helper for the buffer allocated with kmalloc()
> in ntrig_report_version() to simplify the cleanup logic and prevent
> memory leaks.
>
> Fixes: 185c926283da ("HID: hid-ntrig: fix unable to handle page fault in ntrig_report_version()")
> Signed-off-by: Masami Ichikawa <masami256@gmail.com>
I have added an explicit reference to the real actual leak being fixed
into the changelog, and applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH v7 5/9] platform/x86: asus-wmi: Add support for multiple kbd led handlers
From: Jiri Kosina @ 2025-10-31 8:26 UTC (permalink / raw)
To: Antheas Kapenekakis
Cc: kernel test robot, platform-driver-x86, linux-input,
oe-kbuild-all, linux-kernel, Benjamin Tissoires, Corentin Chary,
Luke D . Jones, Hans de Goede, Ilpo Järvinen, Denis Benato
In-Reply-To: <CAGwozwGDBj2e83JBW71G_z6hMD5PsOXTQLqFVdPKZ6sU54tsGw@mail.gmail.com>
On Thu, 23 Oct 2025, Antheas Kapenekakis wrote:
> > 1589
> > 1590 static void kbd_led_update_all(struct work_struct *work)
> > 1591 {
> > 1592 enum led_brightness value;
> > 1593 struct asus_wmi *asus;
> > 1594 bool registered, notify;
> > 1595 int ret;
> /\ value should have been an int and
> placed here. It can take the value -1 hence the check
Thanks, that needs to be fixed before the final merge.
> Are there any other comments on the series?
>
> The only issue I am aware of is that Denis identified a bug in asusd
> (asusctl userspace program daemon) in certain Asus G14/G16 laptops
> that cause laptop keys to become sticky, I have had users also report
> that bug in previous versions of the series. WIthout asusd running,
> keyboards work fine incl. with brightness control (did not work
> before). Given it will take two months for this to reach mainline, I
> think it is a fair amount of time to address the bug.
One thing that is not clear to me about this -- is this causing a visible
user-space behavior regression before vs. after the patchset with asusctl?
If so, I am afraid this needs to be root-caused and fixed before the set
can be considered for inclusion.
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH] dt-bindings: Remove extra blank lines
From: Hal Feng @ 2025-10-31 6:46 UTC (permalink / raw)
To: Rob Herring (Arm), Krzysztof Kozlowski, Conor Dooley,
Stephen Boyd, David Airlie, Simona Vetter, Maarten Lankhorst,
Thomas Zimmermann, Andrzej Hajda, Robert Foss, Vinod Koul,
Moritz Fischer, Xu Yilun, Bartosz Golaszewski, Guenter Roeck,
Andi Shyti, Jonathan Cameron, Dmitry Torokhov, Georgi Djakov,
Thomas Gleixner, Joerg Roedel, Jassi Brar, Mauro Carvalho Chehab,
Lee Jones, Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Johannes Berg, Krzysztof Wilczyński,
Manivannan Sadhasivam, Bjorn Helgaas, Kishon Vijay Abraham I,
Sebastian Reichel, Uwe Kleine-König, Mark Brown,
Mathieu Poirier, Philipp Zabel, Olivia Mackall, Herbert Xu,
Daniel Lezcano, Greg Kroah-Hartman
Cc: devicetree, linux-kernel, linux-clk, dri-devel, linux-fbdev,
dmaengine, linux-fpga, linux-gpio, linux-hwmon, linux-i2c,
linux-iio, linux-input, linux-pm, iommu, linux-media, linux-mtd,
netdev, linux-wireless, linux-pci, linux-phy, linux-pwm,
linux-remoteproc, linux-crypto, linux-sound, linux-usb
In-Reply-To: <20251023143957.2899600-1-robh@kernel.org>
On 10/23/2025 10:37 PM, Rob Herring (Arm) wrote:
> Generally at most 1 blank line is the standard style for DT schema
> files. Remove the few cases with more than 1 so that the yamllint check
> for this can be enabled.
>
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
> ---
> Documentation/devicetree/bindings/.yamllint | 2 +-
> Documentation/devicetree/bindings/arm/psci.yaml | 1 -
> .../bindings/clock/allwinner,sun4i-a10-gates-clk.yaml | 1 -
> .../devicetree/bindings/clock/renesas,cpg-mssr.yaml | 1 -
> .../devicetree/bindings/clock/xlnx,clocking-wizard.yaml | 1 -
> .../display/allwinner,sun4i-a10-display-frontend.yaml | 1 -
> .../devicetree/bindings/display/allwinner,sun6i-a31-drc.yaml | 1 -
> .../bindings/display/allwinner,sun8i-a83t-dw-hdmi.yaml | 1 -
> .../devicetree/bindings/display/amlogic,meson-vpu.yaml | 1 -
> .../devicetree/bindings/display/bridge/adi,adv7511.yaml | 1 -
> .../devicetree/bindings/display/bridge/lvds-codec.yaml | 1 -
> .../devicetree/bindings/display/bridge/toshiba,tc358767.yaml | 1 -
> .../devicetree/bindings/display/ilitek,ili9486.yaml | 1 -
> Documentation/devicetree/bindings/display/msm/gpu.yaml | 1 -
> .../devicetree/bindings/display/panel/panel-timing.yaml | 1 -
> .../devicetree/bindings/display/panel/tpo,tpg110.yaml | 1 -
> .../devicetree/bindings/display/rockchip/rockchip,dw-dp.yaml | 1 -
> .../devicetree/bindings/display/simple-framebuffer.yaml | 1 -
> .../devicetree/bindings/dma/snps,dma-spear1340.yaml | 1 -
> Documentation/devicetree/bindings/dma/stericsson,dma40.yaml | 1 -
> .../devicetree/bindings/dma/stm32/st,stm32-dma.yaml | 1 -
> Documentation/devicetree/bindings/edac/apm,xgene-edac.yaml | 1 -
> .../devicetree/bindings/firmware/qemu,fw-cfg-mmio.yaml | 1 -
> Documentation/devicetree/bindings/fpga/fpga-region.yaml | 5 -----
> .../devicetree/bindings/gpio/brcm,xgs-iproc-gpio.yaml | 1 -
> .../devicetree/bindings/gpio/fairchild,74hc595.yaml | 1 -
> Documentation/devicetree/bindings/hwmon/adi,ltc2947.yaml | 1 -
> Documentation/devicetree/bindings/hwmon/adi,max31827.yaml | 1 -
> Documentation/devicetree/bindings/hwmon/national,lm90.yaml | 1 -
> Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml | 1 -
> Documentation/devicetree/bindings/hwmon/ti,tps23861.yaml | 1 -
> Documentation/devicetree/bindings/i2c/i2c-mux-gpmux.yaml | 1 -
> .../devicetree/bindings/i2c/realtek,rtl9301-i2c.yaml | 1 -
> Documentation/devicetree/bindings/i2c/tsd,mule-i2c-mux.yaml | 2 --
> Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml | 1 -
> Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml | 1 -
> Documentation/devicetree/bindings/iio/adc/adi,ad7949.yaml | 1 -
> Documentation/devicetree/bindings/iio/adc/adi,ade9000.yaml | 1 -
> .../devicetree/bindings/iio/adc/cosmic,10001-adc.yaml | 1 -
> Documentation/devicetree/bindings/iio/adc/st,stm32-adc.yaml | 1 -
> .../devicetree/bindings/iio/adc/x-powers,axp209-adc.yaml | 1 -
> .../devicetree/bindings/iio/afe/voltage-divider.yaml | 1 -
> .../devicetree/bindings/iio/frequency/adi,admv4420.yaml | 1 -
> .../devicetree/bindings/iio/pressure/murata,zpa2326.yaml | 1 -
> .../devicetree/bindings/iio/proximity/semtech,sx9324.yaml | 1 -
> .../devicetree/bindings/iio/temperature/adi,ltc2983.yaml | 1 -
> Documentation/devicetree/bindings/input/ti,drv266x.yaml | 1 -
> .../devicetree/bindings/interconnect/qcom,rpmh.yaml | 1 -
> .../devicetree/bindings/interrupt-controller/arm,gic-v3.yaml | 1 -
> .../bindings/interrupt-controller/aspeed,ast2700-intc.yaml | 1 -
> .../bindings/interrupt-controller/fsl,vf610-mscm-ir.yaml | 1 -
> .../bindings/interrupt-controller/loongson,liointc.yaml | 1 -
> .../bindings/interrupt-controller/mediatek,mtk-cirq.yaml | 1 -
> .../bindings/interrupt-controller/mscc,ocelot-icpu-intr.yaml | 1 -
> Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 4 ----
> Documentation/devicetree/bindings/mailbox/arm,mhu.yaml | 1 -
> Documentation/devicetree/bindings/mailbox/arm,mhuv2.yaml | 1 -
> Documentation/devicetree/bindings/mailbox/mtk,adsp-mbox.yaml | 1 -
> Documentation/devicetree/bindings/media/amphion,vpu.yaml | 1 -
> Documentation/devicetree/bindings/media/i2c/adi,adv7604.yaml | 2 --
> .../devicetree/bindings/media/i2c/techwell,tw9900.yaml | 1 -
> Documentation/devicetree/bindings/media/nxp,imx8-jpeg.yaml | 1 -
> .../devicetree/bindings/media/qcom,sc8280xp-camss.yaml | 1 -
> .../bindings/media/samsung,exynos4212-fimc-is.yaml | 1 -
> .../devicetree/bindings/media/samsung,s5pv210-jpeg.yaml | 1 -
> Documentation/devicetree/bindings/media/st,stm32-dma2d.yaml | 1 -
> .../devicetree/bindings/media/video-interface-devices.yaml | 4 ----
> .../memory-controllers/qcom,ebi2-peripheral-props.yaml | 1 -
> Documentation/devicetree/bindings/mfd/stericsson,ab8500.yaml | 1 -
> .../devicetree/bindings/mtd/amlogic,meson-nand.yaml | 1 -
> .../devicetree/bindings/mtd/marvell,nand-controller.yaml | 1 -
> Documentation/devicetree/bindings/mux/mux-controller.yaml | 1 -
> .../devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml | 2 --
> Documentation/devicetree/bindings/net/brcm,bcmgenet.yaml | 1 -
> .../devicetree/bindings/net/brcm,mdio-mux-iproc.yaml | 1 -
> .../devicetree/bindings/net/cortina,gemini-ethernet.yaml | 1 -
> Documentation/devicetree/bindings/net/fsl,gianfar.yaml | 2 --
> .../devicetree/bindings/net/mdio-mux-multiplexer.yaml | 1 -
> Documentation/devicetree/bindings/net/qcom,ipa.yaml | 1 -
> Documentation/devicetree/bindings/net/ti,cpsw-switch.yaml | 1 -
> .../devicetree/bindings/net/wireless/ti,wlcore.yaml | 1 -
> .../devicetree/bindings/pci/altr,pcie-root-port.yaml | 1 -
> Documentation/devicetree/bindings/pci/loongson.yaml | 1 -
> Documentation/devicetree/bindings/pci/rockchip-dw-pcie.yaml | 1 -
> .../devicetree/bindings/pci/starfive,jh7110-pcie.yaml | 1 -
> Documentation/devicetree/bindings/pci/versatile.yaml | 1 -
> .../bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml | 1 -
> .../devicetree/bindings/pinctrl/brcm,bcm21664-pinctrl.yaml | 1 -
> .../devicetree/bindings/pinctrl/fsl,imx9-pinctrl.yaml | 1 -
> .../devicetree/bindings/pinctrl/qcom,qcs404-pinctrl.yaml | 1 -
> .../bindings/pinctrl/qcom,sm6115-lpass-lpi-pinctrl.yaml | 1 -
> .../devicetree/bindings/pinctrl/qcom,sm6125-tlmm.yaml | 1 -
> .../devicetree/bindings/pinctrl/renesas,rza1-ports.yaml | 3 ---
> .../devicetree/bindings/pinctrl/starfive,jh7100-pinctrl.yaml | 1 -
> .../devicetree/bindings/power/supply/mt6360_charger.yaml | 1 -
> .../bindings/power/supply/stericsson,ab8500-charger.yaml | 1 -
> .../devicetree/bindings/pwm/allwinner,sun4i-a10-pwm.yaml | 1 -
> .../bindings/regulator/richtek,rt6245-regulator.yaml | 1 -
> .../devicetree/bindings/remoteproc/ti,k3-r5f-rproc.yaml | 2 --
> Documentation/devicetree/bindings/reset/ti,sci-reset.yaml | 1 -
> .../bindings/rng/inside-secure,safexcel-eip76.yaml | 2 --
> .../devicetree/bindings/soc/fsl/cpm_qe/fsl,qe-muram.yaml | 1 -
> .../devicetree/bindings/soc/mediatek/mediatek,mutex.yaml | 1 -
> .../bindings/soc/microchip/atmel,at91rm9200-tcb.yaml | 1 -
> Documentation/devicetree/bindings/soc/rockchip/grf.yaml | 1 -
> Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml | 3 ---
> Documentation/devicetree/bindings/sound/adi,adau1372.yaml | 1 -
> Documentation/devicetree/bindings/sound/adi,adau7118.yaml | 1 -
> .../devicetree/bindings/sound/rockchip,i2s-tdm.yaml | 1 -
> .../devicetree/bindings/sound/rockchip,rk3328-codec.yaml | 2 +-
> Documentation/devicetree/bindings/sound/samsung,tm2.yaml | 1 -
> .../devicetree/bindings/sound/ti,tlv320dac3100.yaml | 1 -
> Documentation/devicetree/bindings/sound/wlf,wm8903.yaml | 1 -
> .../devicetree/bindings/timer/nvidia,tegra-timer.yaml | 1 -
> .../devicetree/bindings/timer/nvidia,tegra186-timer.yaml | 1 -
> Documentation/devicetree/bindings/usb/qcom,pmic-typec.yaml | 1 -
> 116 files changed, 2 insertions(+), 136 deletions(-)
>
...
> diff --git a/Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml b/Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml
> index 5f432452c815..33c80626e8ec 100644
> --- a/Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml
> +++ b/Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml
> @@ -16,7 +16,6 @@ properties:
> compatible:
> const: starfive,jh7110-pcie
>
> -
> reg:
> maxItems: 2
>
...
> diff --git a/Documentation/devicetree/bindings/pinctrl/starfive,jh7100-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/starfive,jh7100-pinctrl.yaml
> index f3258f2fd3a4..3f14eab01c54 100644
> --- a/Documentation/devicetree/bindings/pinctrl/starfive,jh7100-pinctrl.yaml
> +++ b/Documentation/devicetree/bindings/pinctrl/starfive,jh7100-pinctrl.yaml
> @@ -32,7 +32,6 @@ description: |
> | | | | | | -------
> UART0 UART1 --
>
> -
> The big MUX in the diagram only has 7 different ways of mapping peripherals
> on the left to pins on the right. StarFive calls the 7 configurations "signal
> groups".
Reviewed-by: Hal Feng <hal.feng@starfivetech.com>
Best regards,
Hal
^ permalink raw reply
* [PATCH v2] Documentation: input: expand INPUT_PROP_HAPTIC_TOUCHPAD to all pressure pads
From: Peter Hutterer @ 2025-10-31 4:12 UTC (permalink / raw)
To: Jonathan Denose, Jiri Kosina, Benjamin Tissoires, Dmitry Torokhov,
Jonathan Corbet, Henrik Rydberg
Cc: linux-input, linux-kernel, linux-doc, Angela Czubak,
Sean O'Brien, Randy Dunlap
In-Reply-To: <20251030011735.GA969565@quokka>
Definition: "pressure pad" used here as all touchpads that use physical
pressure to convert to click without physical hinges. Also called haptic
touchpads in general parlance, Synaptics calls them ForcePads.
Most (all?) pressure pads are currently advertised as
INPUT_PROP_BUTTONPAD. The suggestion to identify them as pressure pads
by defining the resolution on ABS_MT_PRESSURE has been in the docs since
commit 20ccc8dd38a3 ("Documentation: input: define
ABS_PRESSURE/ABS_MT_PRESSURE resolution as grams") but few devices
provide this information.
In userspace it's thus impossible to determine whether a device is a
true pressure pad (pressure equals pressure) or a normal clickpad with
(pressure equals finger size).
Commit 7075ae4ac9db ("Input: add INPUT_PROP_HAPTIC_TOUCHPAD") introduces
INPUT_PROP_HAPTIC_TOUCHPAD but restricted it to those touchpads that
have support for userspace-controlled effects. Let's expand that
definition to include all haptic touchpads (pressure pads) since those
that do support FF effects can be identified by the presence of the
FF_HAPTIC bit.
This means:
- clickpad: INPUT_PROP_BUTTONPAD
- pressurepad: INPUT_PROP_BUTTONPAD + INPUT_PROP_HAPTIC_TOUCHPAD
- pressurepad with haptics:
INPUT_PROP_BUTTONPAD + INPUT_PROP_HAPTIC_TOUCHPAD + FF_HAPTIC
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
---
Changes to v1: extra empty lines to render the lists as lists
Link to v1: https://lore.kernel.org/linux-input/20251030011735.GA969565@quokka/T/#u
Side-note: typo in my v1 comment, the HID usage ID that tells us whether
it's a clickpad or pressurepad is 0x59, not 0x55.
Documentation/input/event-codes.rst | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git ./Documentation/input/event-codes.rst ../Documentation/input/event-codes.rst
index 1ead9bb8d9c6..bb4c68871e94 100644
--- a/Documentation/input/event-codes.rst
+++ b/Documentation/input/event-codes.rst
@@ -403,16 +403,27 @@ regular directional axes and accelerometer axes on the same event node.
INPUT_PROP_HAPTIC_TOUCHPAD
--------------------------
-The INPUT_PROP_HAPTIC_TOUCHPAD property indicates that device:
-- supports simple haptic auto and manual triggering
+The INPUT_PROP_HAPTIC_TOUCHPAD property indicates that the device provides
+simulated haptic feedback (e.g. a vibrator motor situated below the surface)
+instead of physical haptic feedback (e.g. a hinge). This property is only set
+if the device:
+
- can differentiate between at least 5 fingers
- uses correct resolution for the X/Y (units and value)
-- reports correct force per touch, and correct units for them (newtons or grams)
- follows the MT protocol type B
+If the simulated haptic feedback is controllable by userspace the device must:
+
+- support simple haptic auto and manual triggering, and
+- report correct force per touch, and correct units for them (newtons or grams), and
+- provide the EV_FF FF_HAPTIC force feedback effect.
+
Summing up, such devices follow the MS spec for input devices in
-Win8 and Win8.1, and in addition support the Simple haptic controller HID table,
-and report correct units for the pressure.
+Win8 and Win8.1, and in addition may support the Simple haptic controller HID
+table, and report correct units for the pressure.
+
+Where applicable, this property is set in addition to INPUT_PROP_BUTTONPAD, it
+does not replace that property.
Guidelines
==========
--
2.51.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox