X86 platform drivers
 help / color / mirror / Atom feed
From: Mikalai Ramanovich <nikolay.romanovich.00@gmail.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Mark Gross <markgross@kernel.org>,
	platform-driver-x86@vger.kernel.org,
	Mikalai Ramanovich <nikolay.romanovich.00@gmail.com>
Subject: Re: [PATCH] platform/x86: wmi: change notification handler type
Date: Thu, 21 Oct 2021 20:25:41 +0300	[thread overview]
Message-ID: <YXGild+Pr90PMBe2@mikalai-laptop> (raw)
In-Reply-To: <2deb56e0-24a6-6615-d95e-e0efb7f86db2@redhat.com>

Hi, 
thank you for your reply.

On Tue, Oct 19, 2021 at 05:11:51PM +0200, Hans de Goede wrote:
> Hi,
> 
> On 10/15/21 21:13, Mikalai Ramanovich wrote:
> > Since AML code on some Xiaomi laptops notifies the WMI hotkey with
> > 0x20 event, we need ACPI_ALL_NOTIFY here to be able to handle it.
> > 
> > Signed-off-by: Mikalai Ramanovich <nikolay.romanovich.00@gmail.com>
> 
> Hmm, this is a rather unusual change and I'm worried that it may have
> some bad side-effects.

I think it can't lead to bad side effects: this driver ignores events 
which are not described in the _WDG section (doesn't have GUID assiciated).

But if it's described it should be handled by this driver even if it
is less than 0x80. But this driver handles only 0x80-0xFF events.

> Can you provide the model-number and an acpidump for the laptop where
> you need this ? And maybe also point out which bit (which lines after
> disassembling) of the DSDT needs this ?

It's Xiaomi Mi Notebook Pro 14 2021. (TIMI A34 by DMI).

Here is a dump of interesting files: 
https://gist.github.com/MikalaiR/eee783cc0b1efdbe2aab158653e84935
(sorry for the link, i don't know it's good to attach files here or not).

The most interesting part is ssdt8.dsl file which contains only one
WMI device. Method \_SB.PC00.LPCB.EC0.XWEV (in ssdt10.dsl, line 2495) 
generates events for this device.

And this is a part of decompiled BMOF from this device:

[WMI, Dynamic, Provider("WmiProv"), Locale("MS\\0x40A"), 
 Description("Root/WMI/HID_EVENT20"), 
 guid("{46c93e13-ee9b-4262-8488-563bca757fef}")]
class HID_EVENT20 : WmiEvent {
  [key, read] string InstanceName;
  [read] boolean Active;
  [WmiDataId(1), read, write, Description("Package Data")] uint8 EventDetail[8];
};

ACPI event 0x20 associated with GUID 46c93e13-ee9b-4262-8488-563bca757fef.

> ATM I'm thinking that it might be best to do something like this:
> 
> static u32 acpi_wmi_get_handler_type(void)
> {
> 	if (dmi_name_in_vendors("XIAOMI"))
> 		return ACPI_ALL_NOTIFY;
> 	else
> 		return ACPI_DEVICE_NOTIFY;
> }
> 
> 	status = acpi_install_notify_handler(acpi_device->handle,
> 					     acpi_wmi_get_handler_type(),
> 					     acpi_wmi_notify_handler,
> 					     NULL);
> 
> (and the same for the remove)
> 
> So that we limit this behavior to the Xiaomi case.

In general i don't think it's a good idea, but if it's the only 
acceptable solution, why not.


Regards, 

Mikalai

  reply	other threads:[~2021-10-21 17:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15 19:13 [PATCH] platform/x86: wmi: change notification handler type Mikalai Ramanovich
2021-10-19 15:11 ` Hans de Goede
2021-10-21 17:25   ` Mikalai Ramanovich [this message]
2021-10-21 18:35     ` Hans de Goede

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=YXGild+Pr90PMBe2@mikalai-laptop \
    --to=nikolay.romanovich.00@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /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