Skip to content

RFC alienware-wmi driver rework

Kurt Borja lkml llvm oe-kbuild-all platform-driver-x86 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest21 patches 18 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/21alienware-wmi: Modify parse_rgb() signaturedrivers/platform/x86/dell/alienware-wmi.c+3 -30 replies
2/21alienware-wmi: Move Lighting Control Statedrivers/platform/x86/dell/alienware-wmi.c+38 -350 replies
3/21alienware-wmi: Remove unnecessary check at module exitdrivers/platform/x86/dell/alienware-wmi.c+5 -70 replies
4/21alienware-wmi: Improve sysfs groups creationdrivers/platform/x86/dell/alienware-wmi.c+38 -760 replies
5/21alienware-wmi: Refactor rgb-zones sysfs group creationdrivers/platform/x86/dell/alienware-wmi.c+60 -774 replies
6/21alienware-wmi: Add state container and alienfx_probe()drivers/platform/x86/dell/alienware-wmi.c+35 -00 replies
7/21alienware-wmi: Migrate to state container patterndrivers/platform/x86/dell/alienware-wmi.c+47 -760 replies
8/21alienware-wmi: Add WMI Driversdrivers/platform/x86/dell/alienware-wmi.c+113 -20 replies
9/21alienware-wmi: Initialize WMI driversdrivers/platform/x86/dell/alienware-wmi.c+8 -400 replies
10/21alienware-wmi: Add alienfx OPs to platdatadrivers/platform/x86/dell/alienware-wmi.c+110 -02 replies
11/21alienware-wmi: Refactor LED control methodsdrivers/platform/x86/dell/alienware-wmi.c+8 -620 replies
12/21alienware-wmi: Refactor hdmi, amplifier, deepslpdrivers/platform/x86/dell/alienware-wmi.c+36 -150 replies
13/21alienware-wmi: Add a state container for AWCCdrivers/platform/x86/dell/alienware-wmi.c+25 -140 replies
14/21alienware-wmi: Migrate thermal methods to wmidevdrivers/platform/x86/dell/alienware-wmi.c+25 -460 replies
15/21alienware-wmi: Refactor sysfs visibility methodsdrivers/platform/x86/dell/alienware-wmi.c+47 -50 replies
16/21alienware-wmi: Make running control state part of platdatadrivers/platform/x86/dell/alienware-wmi.c+6 -34 replies
17/21alienware-wmi: Drop thermal methods dependency on quirksdrivers/platform/x86/dell/alienware-wmi.c+7 -62 replies
18/21platform-x86: Add header file for alienware-wmidrivers/platform/x86/dell/alienware-wmi.c drivers/platform/x86/dell/alienware-wmi.h+126 -990 replies
19/21platform-x86: Rename alienare-wmiMAINTAINERS drivers/platform/x86/dell/Makefile drivers/platform/x86/dell/alienware-wmi-base.c+3 -12 replies
20/21platform-x86: Split the alienware-wmi moduledrivers/platform/x86/dell/Makefile drivers/platform/x86/dell/alienware-wmi-alienfx.c drivers/platform/x86/dell/alienware-wmi-awcc.c +1 more+815 -7940 replies
21/21platform-x86: Add config entries to alienware-wmidrivers/platform/x86/dell/Kconfig drivers/platform/x86/dell/Makefile drivers/platform/x86/dell/alienware-wmi.h+46 -90 replies

Reviews trailers per patch

2 of 21 patches have a Reviewed-by or Acked-by.

PatchMario Limonciello
1/21
2/21
3/21R-b
4/21R-b
5/21
6/21
7/21
8/21
9/21
10/21
11/21
12/21
13/21
14/21
15/21
16/21
17/21
18/21
19/21
20/21
21/21

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC PATCH 00/21] alienware-wmi driver rework

Hi :)

This series are a follow-up to this discussion [1], in which I proposed migrating the alienware-wmi driver to use:

1. State container driver model
2. Modern WMI driver design
3. Drop use of deprecated WMI methods

Of course, this was much harder than expected to do cleanly. Main problem was that this driver "drives" two completely different devices (I'm not referring to the WMI devices, which also happen to be two).

Throughout these series we will call these devices AlienFX and AWCC.

As a preamble
=============

AlienFX exposes a LED, hdmi, amplifier and deepsleep interface to userspace through a platform device named "alienware-wmi". Historically this driver handled this by leveraging on two WMI devices as a backend. This devices named LEGACY and WMAX were very similar, the only difference was that WMAX had more features, but share all features LEGACY had. Although it's a stretch, it could be argued this WMI devices are the "same", just different GUID.

Later Dell repurposed the WMAX WMI device to serve as a thermal control interface for all newer "gaming" laptops. This new WMAX device has an ACPI UID = "AWCC" (I discovered this recently). So it could also be argued that old WMAX and AWCC WMAX are not the same device, just same GUID.

This drivers manages all these features using deprecated WMI methods.

Approach I took for the rework
==============================

Parts 1-7 sort of containerize all AlienFX functionality under the "alienware-wmi" platform driver so WMI drivers can prepare and register a matching platform device from the probe.

Parts 8-12 create and register two WMI drivers for the LEGACY and WMAX devices respectively. The code for these probes is VERY similar and all "differences" are passed to the platform device via platform specific data (platdata). Also AlienFX functionality is refactored to use non-deprecated WMI methods.

Parts 13-17 migrate all AWCC methods to use non-deprecated WMI methods and the state container driver model.

Parts 18-21 I splitted the alienware-wmi.c module into the different features this driver manages.

alienware-wmi-base.c is in charge of initializing WMI drivers and define some platform specific data, like operations (Part 10 for more info). alienware-wmi-alienfx.c has all AlienFX functionality and alienware-wmi-awcc.c has all AWCC functionality.

Coments
=======

This is still kind of a draft, but I did some testing and it works!

Of course I will do thorough testing and cleanup when I send the non-RFC version. I just want to get some comments on the general approach before proceeding further.

I think this is quite messy in it's current state so I apollogize.

@Mario Limonciello: I included the reviews you gave me on [2]. I included some of those patches here, and dropped the ones that did not make sense with this design. As this is another series let me know if you want me to drop the tags!

@Armin Wolf: I don't like the amount of files I made. As the maintainer of the wmi module, what do you think about making two independent modules, one for AlienFX and one for AWCC. In order to not register two drivers for the WMAX device the module init would check if the "AWCC" UID is present.

The approach for that would be basically the same, and I think the series would change very little.

I would like this a lot because I still think old and new WMAX devices are different, but I couldn't find another example of where an OEM repurposed a WMI device.

@Everyone: I know this is VERY long. Thank you so much for your time in advance!

This series were made on top of the 'for-next' branch:

Commit c712e8fd9bf4 ("MAINTAINERS: Change AMD PMC driver status to "Supported"")

~ Kurt

[1] https://lore.kernel.org/platform-driver-x86/6m66cuivkzhcsvpjv4nunjyddqhr42bmjdhptu4bqm6rm7fvxf@qjwove4hg6gb/T/#u
[2] https://lore.kernel.org/platform-driver-x86/[email protected]/

Kurt Borja (21):
alienware-wmi: Modify parse_rgb() signature
alienware-wmi: Move Lighting Control State
alienware-wmi: Remove unnecessary check at module exit
alienware-wmi: Improve sysfs groups creation
alienware-wmi: Refactor rgb-zones sysfs group creation
alienware-wmi: Add state container and alienfx_probe()
alienware-wmi: Migrate to state container pattern
alienware-wmi: Add WMI Drivers
alienware-wmi: Initialize WMI drivers
alienware-wmi: Add alienfx OPs to platdata
alienware-wmi: Refactor LED control methods
alienware-wmi: Refactor hdmi, amplifier, deepslp
alienware-wmi: Add a state container for AWCC
alienware-wmi: Migrate thermal methods to wmidev
alienware-wmi: Refactor sysfs visibility methods
alienware-wmi: Make running control state part of platdata
alienware-wmi: Drop thermal methods dependency on quirks
platform-x86: Add header file for alienware-wmi
platform-x86: Rename alienare-wmi
platform-x86: Split the alienware-wmi module
platform-x86: Add config entries to alienware-wmi

 MAINTAINERS                                   |    3 +-
 drivers/platform/x86/dell/Kconfig             |   25 +-
 drivers/platform/x86/dell/Makefile            |    5 +-
 .../platform/x86/dell/alienware-wmi-alienfx.c |  531 +++++++
 .../platform/x86/dell/alienware-wmi-awcc.c    |  282 ++++
 .../platform/x86/dell/alienware-wmi-base.c    |  525 +++++++
 drivers/platform/x86/dell/alienware-wmi.c     | 1267 -----------------
 drivers/platform/x86/dell/alienware-wmi.h     |  141 ++
 8 files changed, 1505 insertions(+), 1274 deletions(-)
 create mode 100644 drivers/platform/x86/dell/alienware-wmi-alienfx.c
 create mode 100644 drivers/platform/x86/dell/alienware-wmi-awcc.c
 create mode 100644 drivers/platform/x86/dell/alienware-wmi-base.c
 delete mode 100644 drivers/platform/x86/dell/alienware-wmi.c
 create mode 100644 drivers/platform/x86/dell/alienware-wmi.h
Signature · 1 line
2.47.1