mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Armin Wolf <W_Armin@gmx.de>
Cc: Hans de Goede <hansg@kernel.org>,
	platform-driver-x86@vger.kernel.org,
	 LKML <linux-kernel@vger.kernel.org>,
	teolyub@gmail.com
Subject: Re: [PATCH 1/2] platform/x86: dell: Add new dell-wmi-pega driver
Date: Wed, 18 Nov 2026 01:09:17 +0200 (EET)	[thread overview]
Message-ID: <25490090-1d6e-725b-04e1-659faec01db2@linux.intel.com> (raw)
In-Reply-To: <848ebb18-b9bf-4747-9403-fa8da4fba2ad@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 12671 bytes --]

On Tue, 17 Nov 2026, Armin Wolf wrote:

> Am 17.11.26 um 23:17 schrieb Ilpo Järvinen:
> > On Tue, 17 Nov 2026, Armin Wolf wrote:
> > 
> > > A user has reported that the WMI hotkey events on Dell All-In-One
> > > machines need to be manually enabled on some models thru a separate
> > > WMI device. This WMI device seems to be present on many other models
> > > but has no effect on them.
> > 
> > Can you rephrase this to not textually depend on "user" or "user's
> > report", just state what the problem is, not how you became aware of it.
> > 
> > > Add a small driver for enabling support for this WMI device. This
> > > enables the HDMI Input key on the Dell OptiPlex 7400 All-in-One
> > > machine.
> > > 
> > > Reported-by: Teodora <teolyub@gmail.com>
> > > Closes:
> > > https://lore.kernel.org/platform-driver-x86/0TZENT.54P2IBFQRED22@gmail.com
> > > Tested-by: Teodora <teolyub@gmail.com>
> > > Signed-off-by: Armin Wolf <W_Armin@gmx.de>
> > > ---
> > >   Documentation/wmi/devices/dell-wmi-pega.rst | 82 ++++++++++++++++++
> > >   MAINTAINERS                                 |  6 ++
> > >   drivers/platform/x86/dell/Kconfig           | 13 +++
> > >   drivers/platform/x86/dell/Makefile          |  1 +
> > >   drivers/platform/x86/dell/dell-wmi-pega.c   | 93 +++++++++++++++++++++
> > >   5 files changed, 195 insertions(+)
> > >   create mode 100644 Documentation/wmi/devices/dell-wmi-pega.rst
> > >   create mode 100644 drivers/platform/x86/dell/dell-wmi-pega.c
> > > 
> > > diff --git a/Documentation/wmi/devices/dell-wmi-pega.rst
> > > b/Documentation/wmi/devices/dell-wmi-pega.rst
> > > new file mode 100644
> > > index 000000000000..935c8511594b
> > > --- /dev/null
> > > +++ b/Documentation/wmi/devices/dell-wmi-pega.rst
> > > @@ -0,0 +1,82 @@
> > > +.. SPDX-License-Identifier: GPL-2.0-or-later
> > > +
> > > +===========================================================
> > > +Dell All-In-One Series Platform Integration (dell-wmi-pega)
> > > +===========================================================
> > > +
> > > +Introduction
> > > +------------
> > > +
> > > +Many Dell All-In-One devices contain a WMI device for notifying the
> > > underlying platform
> > > +of various OS-specific events like power up, shutdown and backlight
> > > brightness control.
> > > +
> > > +Not implementing support for this WMI device might prevent hotkeys
> > > exposed over WMI from
> > > +working on some models.
> > > +
> > > +WMI interface description
> > > +=========================
> > > +
> > > +The WMI interface description can be decoded from the embedded binary MOF
> > > (bmof)
> > > +data using the `bmfdec <https://github.com/pali/bmfdec>`_ utility:
> > > +
> > > +::
> > > +
> > > + [WMI, Dynamic, Provider("WmiProv"), Locale("MS\\0x409"),
> > > +  Description("Class used to operate method - WMBC"),
> > > +  guid("{2D703EE8-36AC-4F88-BDB5-7556CE6B2946}") : ToInstance]
> > > + class AcpiOSD_WMBC_method : WMIMethod {
> > > +
> > > +   [key, read]
> > > +   string InstanceName;
> > > +
> > > +   [read]
> > > +   boolean Active;
> > > +
> > > +   [WmiMethodId(1), Implemented, read, write,
> > > +    Description("Invoked by AP when system up.")]
> > > +   void PegaOemNotificationStartUp([out, Description("Return Value")]
> > > uint32 RetVal);
> > > +
> > > +   [WmiMethodId(2), Implemented, read, write,
> > > +    Description("Invoked by AP when system is going to off state.")]
> > > +   void PegaOemNotificationStop([out, Description("Return Value")] uint32
> > > RetVal);
> > > +
> > > +   [WmiMethodId(3), Implemented, read, write,
> > > +    Description("Invoked by Application to tune up brightness.")]
> > > +   void PegaOemNotificationBrightnessUP([out, Description("Return
> > > Value")] uint32 RetVal);
> > > +
> > > +   [WmiMethodId(4), Implemented, read, write,
> > > +    Description("Invoked by Application to tune down brightness.")]
> > > +   void PegaOemNotificationBrightnessDown([out, Description("Return
> > > Value")] uint32 RetVal);
> > > +
> > > +   [WmiMethodId(5), Implemented, read, write, Description("Reserved.")]
> > > +   void PegaOemNotificationRSVD1([out, Description("Return Value")]
> > > uint32 RetVal);
> > > +
> > > +   [WmiMethodId(6), Implemented, read, write, Description("Reserved.")]
> > > +   void PegaOemNotificationRSVD2([out, Description("Return Value")]
> > > uint32 RetVal);
> > > + };
> > > +
> > > +The return value of each WMI method should be equal to the WMI method ID.
> > > +
> > > +WMI method PegaOemNotificationStartUp()
> > > +---------------------------------------
> > > +
> > > +Notifies the platform that the OS is operational. On some models this WMI
> > > method also enables
> > > +reporting of hotkey events over WMI.
> > > +
> > > +WMI method PegaOemNotificationStop()
> > > +------------------------------------
> > > +
> > > +Notifies the platform that the OS is shutting down.
> > > +
> > > +WMI method PegaOemNotificationBrightnessUP()
> > > +--------------------------------------------
> > > +
> > > +Notifies the platform that the user wants to increase the backlight
> > > brightness. This WMI method
> > > +usually only forwards this request to the acpi-video driver, so the
> > > dell-wmi-pega driver does
> > > +not use it.
> > 
> > Could these paragraphs be reflowed to 80 chars as long textual lines are
> > harder to read (eye movement required).
> 
> Sure, will do.
> 
> > > +WMI method PegaOemNotificationBrightnessDown()
> > > +----------------------------------------------
> > > +
> > > +Notifies the platform that the user wants to decrease the backlight
> > > brightness. See
> > > +``PegaOemNotificationBrightnessUP()`` for details.
> > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > index bd31e734669e..fb9a80f96900 100644
> > > --- a/MAINTAINERS
> > > +++ b/MAINTAINERS
> > > @@ -7534,6 +7534,12 @@ M:	Pali Rohár <pali@kernel.org>
> > >   S:	Maintained
> > >   F:	drivers/platform/x86/dell/dell-wmi-base.c
> > >   +DELL WMI PEGA DRIVER
> > > +M:	Armin Wolf <W_Armin@gmx.de>
> > > +S:	Odd Fixes
> > > +F:	Documentation/wmi/devices/dell-wmi-pega.rst
> > > +F:	drivers/platform/x86/dell/dell-wmi-pega.c
> > > +
> > >   DELL WMI SYSMAN DRIVER
> > >   M:	Prasanth Ksr <prasanth.ksr@dell.com>
> > >   L:	Dell.Client.Kernel@dell.com
> > > diff --git a/drivers/platform/x86/dell/Kconfig
> > > b/drivers/platform/x86/dell/Kconfig
> > > index 9f0016056d7e..289379383ccb 100644
> > > --- a/drivers/platform/x86/dell/Kconfig
> > > +++ b/drivers/platform/x86/dell/Kconfig
> > > @@ -228,6 +228,7 @@ config DELL_WMI_AIO
> > >   	depends on ACPI_WMI
> > >   	depends on INPUT
> > >   	select INPUT_SPARSEKMAP
> > > +	imply DELL_WMI_PEGA
> > >   	help
> > >   	  Say Y here if you want to support WMI-based hotkeys on Dell
> > >   	  All-In-One machines.
> > > @@ -262,6 +263,18 @@ config DELL_WMI_LED
> > >   	  This adds support for the Latitude 2100 and similar
> > >   	  notebooks that have an external LED.
> > >   +config DELL_WMI_PEGA
> > > +	tristate "Dell WMI AIO Platform Support"
> > > +	default m
> > > +	depends on ACPI_WMI
> > > +	help
> > > +	  This option adds support for WMI-based platform integration on Dell
> > > All-In-One machines.
> > > +	  This driver is necessary for enabling the delivery of hotkey events
> > > to the dell-wmi-aio
> > > +	  driver on some machines.
> > > +
> > > +	  To compile this drivers as a module, choose M here: the module will
> > > be called
> > > +	  dell-wmi-pega.
> > > +
> > >   config DELL_WMI_SYSMAN
> > >   	tristate "Dell WMI-based Systems management driver"
> > >   	default m
> > > diff --git a/drivers/platform/x86/dell/Makefile
> > > b/drivers/platform/x86/dell/Makefile
> > > index 470874c6e6e6..46c91c240a2c 100644
> > > --- a/drivers/platform/x86/dell/Makefile
> > > +++ b/drivers/platform/x86/dell/Makefile
> > > @@ -27,5 +27,6 @@ obj-$(CONFIG_DELL_WMI_AIO)			+=
> > > dell-wmi-aio.o
> > >   obj-$(CONFIG_DELL_WMI_DESCRIPTOR)		+= dell-wmi-descriptor.o
> > >   obj-$(CONFIG_DELL_WMI_DDV)			+= dell-wmi-ddv.o
> > >   obj-$(CONFIG_DELL_WMI_LED)			+= dell-wmi-led.o
> > > +obj-$(CONFIG_DELL_WMI_PEGA)			+= dell-wmi-pega.o
> > >   obj-$(CONFIG_DELL_WMI_SYSMAN)			+= dell-wmi-sysman/
> > >   obj-$(CONFIG_DELL_DW5826E_RESET)		+= dell-dw5826e-reset.o
> > > diff --git a/drivers/platform/x86/dell/dell-wmi-pega.c
> > > b/drivers/platform/x86/dell/dell-wmi-pega.c
> > > new file mode 100644
> > > index 000000000000..ddb1b6cc6b1c
> > > --- /dev/null
> > > +++ b/drivers/platform/x86/dell/dell-wmi-pega.c
> > > @@ -0,0 +1,93 @@
> > > +// SPDX-License-Identifier: GPL-2.0-or-later
> > > +/*
> > > + * WMI platform integration for Dell All-In-One series.
> > > + *
> > > + * Copyright (C) 2026 Armin Wolf <W_Armin@gmx.de>
> > > + *
> > > + * Based on earlier work by Teodora <teolyub@gmail.com>.
> > > + */
> > > +
> > > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> > > +
> > > +#include <linux/cleanup.h>
> > > +#include <linux/device.h>
> > > +#include <linux/device/driver.h>
> > > +#include <linux/dev_printk.h>
> > > +#include <linux/kernel.h>
> > 
> > What for is this?
> > 
> > I suspect direct device.h include isn't necessary either (and it's
> > anyway guaranteed to come through wmi.h).
> 
> Good question, i copied it from one of the other WMI drivers.

Thanks how they usually end up everywhere. kernel.h is very rarely 
needed these days.

> I will remove both includes in the next revision.
> 
> > 
> > > +#include <linux/module.h>
> > > +#include <linux/slab.h>
> > > +#include <linux/types.h>
> > > +#include <linux/wmi.h>
> > > +
> > > +#define PEGA_GUID	"2D703EE8-36AC-4F88-BDB5-7556CE6B2946"
> > > +
> > > +enum dell_pega_method {
> > > +	DELL_PEGA_NOTIFICATION_STARTUP		= 0x01,
> > > +	DELL_PEGA_NOTIFICATION_STOP		= 0x02,
> > > +	DELL_PEGA_NOTIFICATION_BRIGHTNESS_UP	= 0x03,
> > > +	DELL_PEGA_NOTIFICATION_BRIGHTNESS_DOWN	= 0x04,
> > > +	DELL_PEGA_NOTIFICATION_RESERVED_1	= 0x05,
> > > +	DELL_PEGA_NOTIFICATION_RESERVED_2	= 0x06,
> > > +};
> > > +
> > > +static int dell_wmi_pega_invoke(struct wmi_device *wdev, enum
> > > dell_pega_method method)
> > > +{
> > > +	struct wmi_buffer input = { };
> > > +	struct wmi_buffer output;
> > > +	int ret;
> > > +
> > > +	ret = wmidev_invoke_method(wdev, 0x0, method, &input, &output,
> > > sizeof(__le32));
> > > +	if (ret < 0)
> > > +		return ret;
> > > +
> > > +	__le32 *result __free(kfree) = output.data;
> > > +	/* The return value should always be equal to the WMI method ID */
> > > +	if (le32_to_cpu(*result) != method)
> > 
> > Include for le32_to_cpu()
> 
> What would be the correct include for this?

linux/byteorder/generic.h

-- 
 i.

> > > +		return -EIO;
> > > +
> > > +	return 0;
> > > +}
> > > +
> > > +static int dell_wmi_pega_probe(struct wmi_device *wdev, const void
> > > *context)
> > > +{
> > > +	int ret;
> > > +
> > > +	ret = dell_wmi_pega_invoke(wdev, DELL_PEGA_NOTIFICATION_STARTUP);
> > > +	if (ret < 0)
> > > +		dev_err(&wdev->dev,
> > > +			"Failed to notify platform of startup, some hotkeys
> > > might not work\n");
> > 
> > braces for multiline constructs.
> > 
> > > +
> > > +	return ret;
> > > +}
> > > +
> > > +static void dell_wmi_pega_shutdown(struct wmi_device *wdev)
> > > +{
> > > +	int ret;
> > > +
> > > +	ret = dell_wmi_pega_invoke(wdev, DELL_PEGA_NOTIFICATION_STOP);
> > > +	if (ret < 0)
> > > +		dev_warn(&wdev->dev, "Failed to notify platform of
> > > shutdown\n");
> > > +}
> > > +
> > > +static const struct wmi_device_id dell_wmi_pega_id_table[] = {
> > > +	{ PEGA_GUID, NULL },
> > > +	{ }
> > > +};
> > > +MODULE_DEVICE_TABLE(wmi, dell_wmi_pega_id_table);
> > > +
> > > +static struct wmi_driver dell_wmi_pega_driver = {
> > > +	.driver = {
> > > +		.name = "dell-wmi-pega",
> > > +		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
> > > +	},
> > > +	.id_table = dell_wmi_pega_id_table,
> > > +	.probe = dell_wmi_pega_probe,
> > > +	.remove = dell_wmi_pega_shutdown,
> > > +	.shutdown = dell_wmi_pega_shutdown,
> > > +	.no_singleton = true,
> > > +};
> > > +module_wmi_driver(dell_wmi_pega_driver);
> > > +
> > > +MODULE_AUTHOR("Armin Wolf <W_Armin@gmx.de>");
> > > +MODULE_DESCRIPTION("Dell All-In-One series platform integration");
> > > +MODULE_LICENSE("GPL");
> > 
> > Just the mandatory nitpicking :-), seems fine otherwise.
> 
> Thanks,
> 
> i will wait with sending a v2 until Teodora has tested the second patch.
> 
> Thanks,
> Armin Wolf
> 

      reply	other threads:[~2026-11-17 23:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 21:45 Armin Wolf
2026-11-17 21:45 ` [PATCH 2/2] platform/x86: dell-wmi-aio: Ignore HDMI Input event Armin Wolf
2026-11-17 21:52   ` Armin Wolf
2026-11-17 22:17 ` [PATCH 1/2] platform/x86: dell: Add new dell-wmi-pega driver Ilpo Järvinen
2026-11-17 22:30   ` Armin Wolf
2026-11-17 23:09     ` Ilpo Järvinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25490090-1d6e-725b-04e1-659faec01db2@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=W_Armin@gmx.de \
    --cc=hansg@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=teolyub@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®