[PATCH 09/14] wmi: Instantiate all devices before adding them

2015-11-30 Thread Andy Lutomirski
At some point, we'll want to subdrivers to get references to other devices on the same WMI bus. This change is needed to avoid races. This ends up simplifying the setup code and fixng some leaks, too. Signed-off-by: Andy Lutomirski --- drivers/platform/x86/wmi.c | 49 ++

[PATCH 12/14] wmi: Switch from acpi_driver.notify to acpi_install_notify_handler

2015-11-30 Thread Andy Lutomirski
Arguably wmi should attach to the PNP platform device, not the ACPI device. As a platform driver, acpi_driver.notify won't be available, so stop using it. Signed-off-by: Andy Lutomirski --- drivers/platform/x86/wmi.c | 29 ++--- 1 file changed, 22 insertions(+), 7 deleti

[PATCH 11/14] wmi: Add a new interface to read block data

2015-11-30 Thread Andy Lutomirski
wmi_query_block is unnecessarily indirect. Add a straightforward method for wmi bus drivers to use to read block data. Signed-off-by: Andy Lutomirski --- drivers/platform/x86/wmi.c | 52 +- include/linux/wmi.h| 4 2 files changed, 41 ins

[PATCH 10/14] wmi: Add a driver .notify function

2015-11-30 Thread Andy Lutomirski
This gives event drivers a very simple way to handle events. It also seems closer to what the Windows docs suggest that Windows does: it sounds like, in Windows, the mapper is responsible for called _WED before dispatching to the subdriver. Signed-off-by: Andy Lutomirski --- drivers/platform/x8

[PATCH 14/14] dell-wmi: Convert to the WMI bus infrastructure

2015-11-30 Thread Andy Lutomirski
Signed-off-by: Andy Lutomirski --- drivers/platform/x86/dell-wmi.c | 132 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c index 7c3ebda811ca..48423e53bf94 100644 --- a/driver

[PATCH 13/14] wmi: Bind the platform device, not the ACPI node

2015-11-30 Thread Andy Lutomirski
We already have the PNP glue to instantiate platform devices for the ACPI devices that WMI drives. WMI should therefore attach to the platform device, not the ACPI node. Signed-off-by: Andy Lutomirski --- drivers/platform/x86/wmi.c | 57 +++--- 1 file cha

[PATCH 08/14] wmi: Probe data objects for read and write capabilities

2015-11-30 Thread Andy Lutomirski
My laptop has one RW data object, one RO data object, and one totally inaccessible data object. Check for the existence of the accessor methods and report in sysfs. The docs also permit WQxx getters for single-instance objects to take no parameters. Probe for that as well to avoid ACPICA warning

[PATCH 04/14] wmi: Track wmi devices per ACPI device

2015-11-30 Thread Andy Lutomirski
Currently we free all devices when we detach from any ACPI node. Instead, keep track of which node WMI devices are attached to and free them only as needed. While we're at it, match up notifications with the device they came from correctly. This will make our behavior more straightforward on syst

[PATCH 02/14] wmi: Pass the acpi_device through to parse_wdg

2015-11-30 Thread Andy Lutomirski
Signed-off-by: Andy Lutomirski --- drivers/platform/x86/wmi.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index a17c3d5effe4..383efb8260c7 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x

[PATCH 07/14] wmi: Split devices into types and add basic sysfs attributes

2015-11-30 Thread Andy Lutomirski
This devices the "data", "method" and "event" types. All devices get "instance_count" and "expensive" attributes, data and method devices get "object_id" attributes, and event devices get "notify_id" attributes. Signed-off-by: Andy Lutomirski --- drivers/platform/x86/wmi.c | 78

[PATCH 03/14] wmi: Clean up acpi_wmi_add

2015-11-30 Thread Andy Lutomirski
Rearrange acpi_wmi_add to use Linux's error handling conventions. Signed-off-by: Andy Lutomirski --- drivers/platform/x86/wmi.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 383efb8260c7..fc1f339b7

[PATCH 06/14] wmi: Fix error handling when creating devices

2015-11-30 Thread Andy Lutomirski
We had two memory leaks. If guid_already_parsed returned true, we'd leak the wmi_block. If wmi_create_device failed, we'd leak the device. Simplify the logic and fix both of them. Signed-off-by: Andy Lutomirski --- drivers/platform/x86/wmi.c | 28 +++- 1 file changed,

[PATCH 01/14] wmi: Drop "Mapper (un)loaded" messages

2015-11-30 Thread Andy Lutomirski
WMI is just a driver. There's no need to announce when it's loaded. Signed-off-by: Andy Lutomirski --- drivers/platform/x86/wmi.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index eb391a281833..a17c3d5effe4 100644 --- a/drivers/p

[PATCH 05/14] wmi: Turn WMI into a bus driver

2015-11-30 Thread Andy Lutomirski
WMI is logically a bus: the WMI driver binds to an ACPI node (or more than one), and each instance of the WMI driver enumerates its children and hopes that drivers will attach to the children that are useful. This patch gives WMI a driver model bus type and the ability to match to drivers. The bu

[PATCH 00/14] Big WMI driver rework

2015-11-30 Thread Andy Lutomirski
Here's v1. I'm sure it still needs work. Thoughts? Andy Lutomirski (14): wmi: Drop "Mapper (un)loaded" messages wmi: Pass the acpi_device through to parse_wdg wmi: Clean up acpi_wmi_add wmi: Track wmi devices per ACPI device wmi: Turn WMI into a bus driver wmi: Fix error handling whe

[PATCH v2 2/3] dell-wmi: Support new hotkeys on the XPS 13 9350 (Skylake)

2015-11-30 Thread Andy Lutomirski
The XPS 13 9350 sends WMI keypress events that aren't enumerated in the DMI table. Add a table listing them. To avoid breaking things that worked before, these un-enumerated hotkeys won't be used if the DMI table maps them to something else. FWIW, it appears that the DMI table may be a legacy th

[PATCH v2 3/3] dell-wmi: Improve unknown hotkey handling

2015-11-30 Thread Andy Lutomirski
If DMI lists a hotkey that we don't recognize, log and ignore it instead of trying to map it to keycode 0. I haven't seen this happen, but it will help maintain the key map in the future and it will help avoid sending bogus events. This also improves the message that we log when we get an unknown

[PATCH v2 0/3] dell platform driver tweaks v2

2015-11-30 Thread Andy Lutomirski
Here's v2. I'm still hoping to hear more details about the rfkill button. Meanwhile, let's at least wire up the WMI decoding stuff and get the rest in. Changes from v1: - The new hotkey code matches reality better. - Don't send key events for the new hotkeys (yet?) - Improve warning formatting

[PATCH v2 1/3] dell-wmi: Use a C99-style array for bios_to_linux_keycode

2015-11-30 Thread Andy Lutomirski
It's currently hard to follow what maps to what, and it's hard to edit the array. Redo it as a C99-style array. I generated this using emacs regexes and a python one-liner. objdump says this didn't change the table. Acked-by: Pali Rohár Signed-off-by: Andy Lutomirski --- drivers/platform/x86/

Re: [PATCH] dell-wmi: add module param to control Dell Instant Launch hotkey processing

2015-11-30 Thread Darren Hart
On Thu, Nov 26, 2015 at 03:18:32PM +0100, Michał Kępień wrote: > On some laptop models (e.g. Dell Vostro V131), pressing the Dell Instant > Launch hotkey does not raise an i8042 interrupt - only WMI event 0xe025 > is generated. As there is no flawless way to determine whether a given > machine is

Re: [PATCH] dell-wmi: add module param to control Dell Instant Launch hotkey processing

2015-11-30 Thread Darren Hart
On Mon, Nov 30, 2015 at 03:54:58PM +0100, Michał Kępień wrote: > > The best would be if embedded controller could be configured to send > > events via i8042 bus... > > Yes, but if I correctly understand Mario's message back from July [1], > V131's EC simply does not support generating scancodes at

Re: [PATCH] wmi: Set wmi devices' parents

2015-11-30 Thread Darren Hart
On Wed, Nov 25, 2015 at 05:28:54PM -0800, Andy Lutomirski wrote: > On Mon, Nov 23, 2015 at 11:37 AM, Darren Hart wrote: > > On Mon, Nov 23, 2015 at 11:25:30AM -0800, Andy Lutomirski wrote: > >> Without this patch, wmi devices are in /sys/virtual/wmi. They're > >> logically children of the ACPI WM

Re: [PATCH] wmi: Set wmi devices' parents

2015-11-30 Thread Andy Lutomirski
On Mon, Nov 30, 2015 at 10:51 AM, Darren Hart wrote: > On Thu, Nov 26, 2015 at 03:09:29PM +0100, Rafael Wysocki wrote: >> On Wednesday, November 25, 2015 05:28:54 PM Andy Lutomirski wrote: >> > On Mon, Nov 23, 2015 at 11:37 AM, Darren Hart wrote: >> > > On Mon, Nov 23, 2015 at 11:25:30AM -0800, A

Re: [PATCH] wmi: Set wmi devices' parents

2015-11-30 Thread Darren Hart
On Thu, Nov 26, 2015 at 03:09:29PM +0100, Rafael Wysocki wrote: > On Wednesday, November 25, 2015 05:28:54 PM Andy Lutomirski wrote: > > On Mon, Nov 23, 2015 at 11:37 AM, Darren Hart wrote: > > > On Mon, Nov 23, 2015 at 11:25:30AM -0800, Andy Lutomirski wrote: > > >> Without this patch, wmi device

Re: [PATCH v2] dell-wmi: Improve unknown hotkey handling

2015-11-30 Thread Andy Lutomirski
On Mon, Nov 30, 2015 at 10:27 AM, Darren Hart wrote: > On Mon, Nov 23, 2015 at 08:47:10PM +0100, Pali Rohár wrote: >> On Friday 20 November 2015 17:27:00 Andy Lutomirski wrote: >> > + if (keycode == KEY_RESERVED) { >> > + pr_info("firmware scancode %d maps to unrecogniz

Re: [PATCH v2] dell-wmi: Improve unknown hotkey handling

2015-11-30 Thread Darren Hart
On Mon, Nov 23, 2015 at 08:47:10PM +0100, Pali Rohár wrote: > On Friday 20 November 2015 17:27:00 Andy Lutomirski wrote: > > + if (keycode == KEY_RESERVED) { > > + pr_info("firmware scancode %d maps to unrecognized > > keycode %d\n", > > + bios

Re: [PATCH] dell-wmi: add module param to control Dell Instant Launch hotkey processing

2015-11-30 Thread Michał Kępień
> The best would be if embedded controller could be configured to send > events via i8042 bus... Yes, but if I correctly understand Mario's message back from July [1], V131's EC simply does not support generating scancodes at all. > I'm starting to thing that blacklist or whitelist of machines is

Re: [PATCH] dell-wmi: add module param to control Dell Instant Launch hotkey processing

2015-11-30 Thread Pali Rohár
On Monday 30 November 2015 15:14:00 Michał Kępień wrote: > Hi Pali, > > Thanks again for your efforts. > > > $ sudo /usr/bin/input-events 4 > > /dev/input/event4 > > bustype : BUS_I8042 > > vendor : 0x1 > > product : 0x1 > > version : 43841 > > name: "AT Translated Set 2

Re: [PATCH] dell-wmi: add module param to control Dell Instant Launch hotkey processing

2015-11-30 Thread Michał Kępień
Hi Pali, Thanks again for your efforts. > $ sudo /usr/bin/input-events 4 > /dev/input/event4 > bustype : BUS_I8042 > vendor : 0x1 > product : 0x1 > version : 43841 > name: "AT Translated Set 2 keyboard" > phys: "isa0060/serio0/input0" > bits ev : EV_SYN EV_KEY