aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/dell-wmi.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-02-04platform/x86: Move all dell drivers to their own subdirectoryMario Limonciello1-764/+0
A user without a Dell system doesn't need to pick any of these drivers. Users with a Dell system can enable this submenu and all drivers behind it will be enabled. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Link: https://lore.kernel.org/r/20210203195832.2950605-1-mario.limonciello@dell.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-07-09platform/x86: dell-wmi: add new dmi mapping for keycode 0xffffY Paritcher1-1/+1
This keycode is used by Dell as a no-op for keys that should have no function. This keycode is never triggered by a keypress in practice, rather it is included from the 0xB2 DMI table at startup. This prevents the following messages from being logged at startup on a Dell Inspiron 5593: dell_wmi: firmware scancode 0x48 maps to unrecognized keycode 0xffff dell_wmi: firmware scancode 0x50 maps to unrecognized keycode 0xffff as per this code comment: Log if we find an entry in the DMI table that we don't understand. If this happens, we should figure out what the entry means and add it to bios_to_linux_keycode. Signed-off-by: Y Paritcher <y.linux@paritcher.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Pali Rohár <pali@kernel.org> Reviewed-by: Mario Limonciello <mario.limonciello@dell.com>
2020-07-09platform/x86: dell-wmi: add new keymap type 0x0012Y Paritcher1-2/+20
These are events with extended data. The extended data is currently ignored as userspace does not have a way to deal it. Ignore event with a type of 0x0012 and a code of 0xe035, as the keyboard controller takes care of Fn lock events by itself. This silences the following messages being logged when pressing the Fn-lock key on a Dell Inspiron 5593: dell_wmi: Unknown WMI event type 0x12 dell_wmi: Unknown key with type 0x0012 and code 0xe035 pressed This is consistent with the behavior for the Fn-lock key elsewhere in this file. Signed-off-by: Y Paritcher <y.linux@paritcher.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Pali Rohár <pali@kernel.org> Reviewed-by: Mario Limonciello <mario.limonciello@dell.com>
2020-07-09platform/x86: dell-wmi: add new backlight eventsY Paritcher1-0/+4
Add events with a type of 0x0010 and a code of 0x57 / 0x58, this silences the following messages being logged on a Dell Inspiron 5593: dell_wmi: Unknown key with type 0x0010 and code 0x0057 pressed dell_wmi: Unknown key with type 0x0010 and code 0x0058 pressed These are brightness events and will be handled by acpi-video Signed-off-by: Y Paritcher <y.linux@paritcher.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-05-15platform/x86: dell-wmi: Ignore keyboard attached / detached eventsHans de Goede1-0/+10
Ignore events with a type of 0x0011 and a code of 0xfff2 / 0xfff3, this silences the following messages being logged when the keyboard is detached / attached on a Dell Venue 11 Pro 7130: [ 63.621953] dell_wmi: Unknown key with type 0x0011 and code 0xfff2 pressed [ 70.240558] dell_wmi: Unknown key with type 0x0011 and code 0xfff3 pressed Note SW_TABLET_MODE is already reported through the intel_vbtn driver on this and other Dell devices, so dell_wmi should not report this too, to avoid duplicate events. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mario Limonciello <Mario.limonciello@dell.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-04-10change email address for Pali RohárPali Rohár1-2/+2
For security reasons I stopped using gmail account and kernel address is now up-to-date alias to my personal address. People periodically send me emails to address which they found in source code of drivers, so this change reflects state where people can contact me. [ Added .mailmap entry as per Joe Perches - Linus ] Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Joe Perches <joe@perches.com> Link: http://lkml.kernel.org/r/20200307104237.8199-1-pali@kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-07-30platform/x86: dell-wmi: Use existing defined KBD_LED_* magic valuesRhys Kidd1-7/+7
These values have already been defined in platform/x86/dell-smbios.h Signed-off-by: Rhys Kidd <rhyskidd@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-30platform/x86: dell-wmi: Ignore keyboard backlight change KBD_LED_AUTO_TOKENRhys Kidd1-0/+1
There's a wmi event generated by dell-wmi when pressing keyboard backlight toggle key: [1224178.355650] dell_wmi: Unknown key with type 0x0011 and code 0x01e3 pressed This event is for notification purposes, let's ignore it. Signed-off-by: Rhys Kidd <rhyskidd@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-30platform/x86: dell-wmi: Ignore keyboard backlight change KBD_LED_ON_TOKENRhys Kidd1-0/+1
There's a wmi event generated by dell-wmi when pressing keyboard backlight toggle key: [1224203.948894] dell_wmi: Unknown key with type 0x0011 and code 0x01e2 pressed This event is for notification purposes, let's ignore it. Signed-off-by: Rhys Kidd <rhyskidd@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-14Merge tag 'platform-drivers-x86-v5.3-1' of git://git.infradead.org/linux-platform-drivers-x86Linus Torvalds1-1/+1
Pull x86 platform driver updates from Andy Shevchenko: "Gathered a bunch of x86 platform driver changes. It's rather big, since includes two big refactors and completely new driver: - ASUS WMI driver got a big refactoring in order to support the TUF Gaming laptops. Besides that, the regression with backlight being permanently off on various EeePC laptops has been fixed. - Accelerometer on HP ProBook 450 G0 shows wrong measurements due to X axis being inverted. This has been fixed. - Intel PMC core driver has been extended to be ACPI enumerated if the DSDT provides device with _HID "INT33A1". This allows to convert the driver to be pure platform and support new hardware purely based on ACPI DSDT. - From now on the Intel Speed Select Technology is supported thru a corresponding driver. This driver provides an access to the features of the ISST, such as Performance Profile, Core Power, Base frequency and Turbo Frequency. - Mellanox platform drivers has been refactored and now extended to support more systems, including new coming ones. - The OLPC XO-1.75 platform is now supported. - CB4063 Beckhoff Automation board is using PMC clocks, provided via pmc_atom driver, for ethernet controllers in a way that they can't be managed by the clock driver. The quirk has been extended to cover this case. - Touchscreen on Chuwi Hi10 Plus tablet has been enabled. Meanwhile the information of Chuwi Hi10 Air has been fixed to cover more models based on the same platform. - Xiaomi notebooks have WMI interface enabled. Thus, the driver to support it has been provided. It required some extension of the generic WMI library, which allows to propagate opaque context to the ->probe() of the individual drivers. This release includes debugfs clean up from Greg KH for several drivers that drop return code check and make debugfs absence or failure non-fatal. Also miscellaneous fixes here and there, mostly for Acer WMI and various Intel drivers" * tag 'platform-drivers-x86-v5.3-1' of git://git.infradead.org/linux-platform-drivers-x86: (74 commits) platform/x86: Fix PCENGINES_APU2 Kconfig warning tools/power/x86/intel-speed-select: Add .gitignore file platform/x86: mlx-platform: Fix error handling in mlxplat_init() platform/x86: intel_pmc_core: Attach using APCI HID "INT33A1" platform/x86: intel_pmc_core: transform Pkg C-state residency from TSC ticks into microseconds platform/x86: asus-wmi: Use dev_get_drvdata() Documentation/ABI: Add new attribute for mlxreg-io sysfs interfaces platform/x86: mlx-platform: Add more reset cause attributes platform/x86: mlx-platform: Modify DMI matching order platform/x86: mlx-platform: Add regmap structure for the next generation systems platform/x86: mlx-platform: Change API for i2c-mlxcpld driver activation platform/x86: mlx-platform: Move regmap initialization before all drivers activation MAINTAINERS: Update for Intel Speed Select Technology tools/power/x86: A tool to validate Intel Speed Select commands platform/x86: ISST: Restore state on resume platform/x86: ISST: Add Intel Speed Select PUNIT MSR interface platform/x86: ISST: Add Intel Speed Select mailbox interface via MSRs platform/x86: ISST: Add Intel Speed Select mailbox interface via PCI platform/x86: ISST: Add Intel Speed Select mmio interface platform/x86: ISST: Add IOCTL to Translate Linux logical CPU to PUNIT CPU number ...
2019-06-17platform/x86: wmi: add context argument to the probe functionMattias Jacobsson1-1/+1
The struct wmi_device_id has a context pointer field, forward this pointer as an argument to the probe function in struct wmi_driver. Update existing users of the same probe function to accept this new context argument. Signed-off-by: Mattias Jacobsson <2pi@mok.nu> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156Thomas Gleixner1-14/+1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 59 temple place suite 330 boston ma 02111 1307 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1334 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-07platform/x86: dell-wmi: use MODULE_DEVICE_TABLE() instead of MODULE_ALIAS()Mattias Jacobsson1-2/+2
WMI drivers can if they have specified an array of struct wmi_device_id use the MODULE_DEVICE_TABLE() macro to automatically generate the appropriate MODULE_ALIAS() output. Thus avoiding to keep both the array of struct wmi_device_id and the MODULE_ALIAS() declaration(s) in sync. Change driver to use MODULE_DEVICE_TABLE() instead of MODULE_ALIAS(). Signed-off-by: Mattias Jacobsson <2pi@mok.nu> Reviewed-by: Mario Limonciello <mario.limonciello@dell.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2019-02-05platform/x86: dell-wmi: Ignore new keyboard backlight change eventKai-Heng Feng1-0/+3
There's a new wmi event generated by dell-wmi when pressing keyboard backlight hotkey: [ 3285.474172] dell_wmi: Unknown key with type 0x0010 and code 0x003f pressed This event is for notification purpose, let's ignore it. The keyboard backlight hotkey uses another event so it still works without event 0x3f. Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-06-04platform/x86: dell-wmi: Ignore new rfkill and fn-lock eventsKai Heng Feng1-0/+14
There are two new events generated by dell-wmi, rfkill and fn-lock, from Dell Systems. When Fn-lock hotkey gets pressed to switch to function mode: [85951.591542] dell_wmi: Unknown key with type 0x0010 and code 0xe035 pressed [85951.591546] dell_wmi: Unknown key with type 0x0010 and code 0x0000 pressed When Fn-lock hotkey gets pressed to switch to multimedia mode: [85956.667686] dell_wmi: Unknown key with type 0x0010 and code 0xe035 pressed [85956.667690] dell_wmi: Unknown key with type 0x0010 and code 0x0001 pressed When radio hotkey gets pressed: [85974.430220] dell_wmi: Unknown key with type 0x0010 and code 0xe008 pressed These events are for notification purpose, so we can ignore them. This patch is tested on XPS 9370. Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Reviewed-by: Mario Limonciello <mario.limonciello@dell.com> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-05-22platform/x86: dell-wmi: Set correct keycode for Fn + left arrowHenk1-1/+1
Fn + left arrow hotkey combination is used for enabling/disabling automatic display brightness based on integrated ALS sensor. For this purpose there is standard Linux key KEY_BRIGHTNESS_AUTO so use it instead of KEY_UNKNOWN. Tested on Dell Lattitude E6500. Signed-off-by: Henk Vergonet <henk.vergonet@gmail.com> Reviewed-By: Pali Rohár <pali.rohar@gmail.com> Reviewed-By: Mario Limonciello <mario.limonciello@dell.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-03-14platform/x86: Fix dell driver init orderDarren Hart (VMware)1-1/+1
Update the initcall ordering to satisfy the following dependency ordering: 1. DCDBAS, ACPI_WMI 2. DELL_SMBIOS, DELL_RBTN 3. DELL_LAPTOP, DELL_WMI By assigning them to the following initcall levels: subsys_initcall: DCDBAS, ACPI_WMI module_init: DELL_SMBIOS, DELL_RBTN late_initcall: DELL_LAPTOP, DELL_WMI Cc: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Mario.Limonciello@dell.com Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-12-21platform/x86: dell-wmi: Add an event created by Dell Latitude 5495Shih-Yuan Lee (FourDollars)1-0/+3
The Dell Latitude 5495 has the mic mute key. Signed-off-by: Shih-Yuan Lee (FourDollars) <sylee@canonical.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-12-11platform/x86: dell-wmi: check for kmalloc() errorsDan Carpenter1-0/+2
This allocation won't fail in the current kernel because it's small but not checking for kmalloc() failures introduces static checker warnings so let's fix it. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Mario Limonciello <mario.limonciello@dell.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-11-16platform/x86: dell-*wmi*: Relay failed initial probe to dependent driversMario Limonciello1-2/+4
dell-wmi and dell-smbios-wmi are dependent upon dell-wmi-descriptor finishing probe successfully to probe themselves. Currently if dell-wmi-descriptor fails probing in a non-recoverable way (such as invalid header) dell-wmi and dell-smbios-wmi will continue to try to redo probing due to deferred probing. To solve this have the dependent drivers query the dell-wmi-descriptor driver whether the descriptor has been determined valid. The possible results are: -ENODEV: Descriptor GUID missing from WMI bus -EPROBE_DEFER: Descriptor not yet probed, dependent driver should wait and use deferred probing < 0: Descriptor probed, invalid. Dependent driver should return an error. 0: Successful descriptor probe, dependent driver can continue Successful descriptor probe still doesn't mean that the descriptor driver is necessarily bound at the time of initialization of dependent driver. Userspace can unbind the driver, so all methods used from driver should still be verified to return success values otherwise deferred probing be used. Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-11-03platform/x86: dell-smbios: Introduce dispatcher for SMM callsMario Limonciello1-4/+7
This splits up the dell-smbios driver into two drivers: * dell-smbios * dell-smbios-smm dell-smbios can operate with multiple different dispatcher drivers to perform SMBIOS operations. Also modify the interface that dell-laptop and dell-wmi use align to this model more closely. Rather than a single global buffer being allocated for all drivers, each driver will allocate and be responsible for it's own buffer. The pointer will be passed to the calling function and each dispatcher driver will then internally copy it to the proper location to perform it's call. Add defines for calls used by these methods in the dell-smbios.h header for tracking purposes. Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Reviewed-by: Edward O'Callaghan <quasisec@google.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-11-03platform/x86: dell-wmi-descriptor: split WMI descriptor into it's own driverMario Limonciello1-74/+6
All communication on individual GUIDs should occur in separate drivers. Allowing a driver to communicate with the bus to another GUID is just a hack that discourages drivers to adopt the bus model. The information found from the WMI descriptor driver is now exported for use by other drivers. Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Reviewed-by: Edward O'Callaghan <quasisec@google.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-11-03platform/x86: dell-wmi: don't check length returnedMario Limonciello1-5/+1
This is intended to be variable and provided by the platform. Some platforms this year will be adopting a 32k WMI buffer, so don't complain when encountering those platforms or any other future changes. Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Reviewed-by: Edward O'Callaghan <quasisec@google.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-11-03platform/x86: dell-wmi: clean up wmi descriptor checkMario Limonciello1-5/+5
Some cases the wrong type was used for errors and checks can be done more cleanly. Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Reviewed-by: Edward O'Callaghan <quasisec@google.com> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-11-03platform/x86: dell-wmi: increase severity of some failuresMario Limonciello1-6/+7
There is a lot of error checking in place for the format of the WMI descriptor buffer, but some of the potentially raised issues should be considered critical failures. If the buffer size or header don't match, this is a good indication that the buffer format changed in a way that the rest of the data should not be relied upon. For the remaining data set vectors, continue to notate a warning in undefined results, but as those are fields that the descriptor intended to refer to other applications, don't fail if they're new values. Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Reviewed-by: Edward O'Callaghan <quasisec@google.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-09-27platform/x86: dell-wmi: Do not match on descriptor GUID modaliasMario Limonciello1-1/+0
The descriptor GUID is not used to indicate that WMI notifications in the dell-wmi driver work properly. As such a modalias should not be present that causes this driver to load on systems with this GUID. Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Reviewed-by: Pali Pohar <pali.rohar@gmail.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-08-18platform/x86: dell-wmi: Update dell_wmi_check_descriptor_buffer() to new modelAndy Lutomirski1-30/+39
This converts dell_wmi_check_descriptor_buffer() to the new driver model interface and puts the interface version in dell_wmi_priv where it belongs. Signed-off-by: Andy Lutomirski <luto@kernel.org> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-08-01platform/x86: dell-wmi: Fix driver interface version queryAndy Lutomirski1-5/+7
When I converted dell-wmi to the new bus infrastructure, I left the call to dell_wmi_check_descriptor_buffer() in dell_wmi_init(). This could cause two problems: - An error message when loading the driver on a system without dell-wmi. We'd try to read the event descriptor even if the WMI GUID wasn't there. - A possible race if dell-wmi was loaded manually before wmi was fully initialized. Fix it by moving the call to the probe function where it belongs. Fixes: bff589be59c5 ("platform/x86: dell-wmi: Convert to the WMI bus infrastructure") Signed-off-by: Andy Lutomirski <luto@kernel.org> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-06platform/x86: dell-wmi: Convert to the WMI bus infrastructureAndy Lutomirski1-66/+70
Move some initialization out of _init and into _probe. Update signatures and logic to use the wmi bus and device structures. Signed-off-by: Andy Lutomirski <luto@kernel.org> [dvhart: drop deprecated sparse_keymap_free, order declarations, add commit msg] Cc: Andy Lutomirski <luto@amacapital.net> Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: Pali Rohár <pali.rohar@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-acpi@vger.kernel.org Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-03platform/x86: dell-wmi: Add a better description for "stealth mode"Andy Lutomirski1-1/+6
This is based on Mario's explanation and observation of my laptop. Suggested-by: "Pali Rohár" <pali.rohar@gmail.com> Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: Matthew Garrett <mjg59@srcf.ucam.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-03platform/x86: dell-wmi: Add a comment explaining the 0xb2 magic numberAndy Lutomirski1-0/+1
The hotkey table is 0xb2, add a comment for clarity. Suggested-by: Darren Hart <dvhart@infradead.org> Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Matthew Garrett <mjg59@srcf.ucam.org> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-04-13platform/x86: dell-*: Call new led hw_changed API on kbd brightness changeHans de Goede1-0/+4
Make dell-wmi notify on hotkey kbd brightness changes, listen for this in dell-laptop and call led_classdev_notify_brightness_hw_changed. This will allow userspace to monitor (poll) for brightness changes on these LEDs caused by the hotkey. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-03-14platform/x86: dell-wmi: remove sparse_keymap_free() callsMichał Kępień1-12/+4
As sparse_keymap_setup() now uses a managed memory allocation for the keymap copy it creates, the latter is freed automatically. Remove all calls to sparse_keymap_free(). As this reduces dell_wmi_input_destroy() to one line, replace all calls to that function with direct calls to input_unregister_device(). Signed-off-by: Michał Kępień <kernel@kempniu.pl> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-13platform/x86: dell-wmi: Add events created by Dell Rugged 2-in-1sMario Limonciello1-0/+10
The Dell Rugged 7202 has 3 programmable buttons (labeled P1, P2, P3) and a detachable keyboard/mouse dock. Signed-off-by: Mario Limonciello <mario_limonciello@dell.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-13platform/x86: dell-wmi: Adjust wifi catcher to emit KEY_WLANMario Limonciello1-1/+1
Wifi catcher is a slider switch, that when slid past the on position will emit an event that is intended for launching a wifi application or applet when the machine is turned on. Signed-off-by: Mario Limonciello <mario_limonciello@dell.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-08-08dell-wmi: Ignore WMI event 0xe00ePali Rohár1-2/+2
WMI event 0xe00e is received when battery was removed or inserted. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-06-21dell-wmi: Add a WMI event code for display on/offAlex Hung1-0/+3
Some new Dell AIO systems have a button that generates a WMI event to turn the LCD on/off. Signed-off-by: Alex Hung <alex.hung@canonical.com> Acked-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-06-17dell-wmi: Generate one sparse keymap for all machinesPali Rohár1-111/+104
This patch reworks code for generating sparse keymap and processing WMI events. It unifies procedure for generating sparse keymap and also unifies big switch code for processing WMI events of different types. After this patch dell-wmi driver does not differ between "old" and "new" hotkey type. It constructs sparse keymap table with all WMI codes. It is because on some laptops (e.g. Dell Latitude E6440) ACPI/firmware send both event types (old and new). Each WMI code in sparse keymap table is prefixed by 16bit event type, so it does not change functionality on laptops with "old" hotkey support (those without scancodes in DMI). This allow us to distinguish between same WMI codes with different types in sparse keymap. Thanks to this WMI events of type 0x0011 were moved from big switch into sparse keymap table too. This patch also fixes possible bug in parsing WMI event buffer introduced in commit 5ea2559726b7 ("dell-wmi: Add support for new Dell systems"). That commit changed buffer type from int* to u16* without fixing code. More at: http://lkml.iu.edu/hypermail/linux/kernel/1507.0/01950.html Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Tested-by: Michał Kępień <kernel@kempniu.pl> Reviewed-by: Michał Kępień <kernel@kempniu.pl> Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-06-17dell-wmi: Add information about other WMI event codesPali Rohár1-0/+35
ACPI DSDT tables have defined other WMI codes, but does not contain any description when those codes are emitted. Some other codes can be found in logs on internet. In this patch are all which I saw, but lot of them are not tested properly (e.g. for duplicate events with AT keyboard). Now we have all WMI event codes at one place and in future after proper testing those codes can be correctly enabled or disabled... Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Tested-by: Michał Kępień <kernel@kempniu.pl> Reviewed-by: Michał Kępień <kernel@kempniu.pl> Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-06-17dell-wmi: Sort WMI event codes and update commentsPali Rohár1-13/+16
For better readability of keymap table, sort events by codes and also update comments for events to be more informative. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Tested-by: Michał Kępień <kernel@kempniu.pl> Reviewed-by: Michał Kępień <kernel@kempniu.pl> Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-06-17dell-wmi: Ignore WMI event code 0xe045Pali Rohár1-1/+12
>From Dell we know that WMI event code 0xe045 is for Num Lock key, but it is unclear due to message in commit 0b3f6109f0c9 ("dell-wmi: new driver for hotkey control"). Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Tested-by: Michał Kępień <kernel@kempniu.pl> Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Reviewed-by: Michał Kępień <kernel@kempniu.pl> Cc: Matthew Garrett <mjg@redhat.com> Cc: Mario Limonciello <mario_limonciello@dell.com> Link: https://lkml.org/lkml/2015/7/7/830 Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-03-23dell-wmi: support Dell Inspiron M5110Michał Kępień1-1/+12
Similarly to Dell Vostro V131, Dell Inspiron M5110 also requires an SMBIOS request to be issued in order for WMI events to be generated and does not raise an i8042 interrupt when the Dell Instant Launch hotkey is pressed. However, the event code for that hotkey on this machine is 0xe029, so add it to the legacy keymap. Signed-off-by: Michał Kępień <kernel@kempniu.pl> Tested-by: Darek Stojaczyk <darek.stojaczyk@gmail.com> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-03-23dell-wmi: properly process Dell Instant Launch hotkeyMichał Kępień1-1/+4
On models on which an SMBIOS request needs to be issued in order for WMI events to be generated, pressing the Dell Instant Launch hotkey does not raise an i8042 interrupt - only a WMI event is generated (0xe025 on Dell Vostro V131). As that WMI event is the only way the kernel will be notified about pressing the Dell Instant Launch hotkey on such machines, the relevant keymap entry has to be changed to a KE_KEY one. However, the same WMI event should still be ignored on machines which do not require an SMBIOS request for enabling WMI, so filter it conditionally in dell_wmi_process_key(). Signed-off-by: Michał Kępień <kernel@kempniu.pl> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-03-23dell-wmi: enable receiving WMI events on Dell Vostro V131Michał Kępień1-0/+66
On some laptop models (e.g. Dell Vostro V131), WMI events are not generated until a specific SMBIOS request is issued to register an event listener [1]. As there seems to be no ACPI method or SMBIOS request to determine without possible side effects whether a given machine needs to issue this SMBIOS request in order to receive WMI events, DMI matching is used to whitelist the models which need it. [1] https://lists.us.dell.com/pipermail/libsmbios-devel/2015-July/000612.html Signed-off-by: Michał Kępień <kernel@kempniu.pl> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-03-23dell-wmi: Support new hotkeys on the XPS 13 9350 (Skylake)Andy Lutomirski1-7/+64
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 thing and we might want to rethink how we handle events in general. As an example, a whole lot of things map to KEY_PROG3 via the DMI table. This doesn't send keypress events for any of the new events. They appear to all be handled by other means (keyboard illumination is handled automatically and rfkill is handled by intel-hid). Signed-off-by: Andy Lutomirski <luto@kernel.org> Acked-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-03-23dell-wmi: Clean up hotkey table size checkAndy Lutomirski1-2/+13
Checking the table for a minimum size of 7 bytes makes no sense: any valid hotkey table has a size that's a multiple of 4. Clean this up: replace the hardcoded header length with a sizeof and change the check to ignore an empty hotkey table. The only behavior change is that a 7-byte table (which is nonsensical) will now be treated as absent instead of as valid but empty. Reported-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Andy Lutomirski <luto@kernel.org> Acked-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-03-23dell-wmi: Stop storing pointers to DMI tablesAndy Lutomirski1-28/+46
The dmi_walk function maps the DMI table, walks it, and unmaps it. This means that the dell_bios_hotkey_table that find_hk_type stores points to unmapped memory by the time it gets read. I've been able to trigger crashes caused by the stale pointer a couple of times, but never on a stock kernel. Fix it by generating the keymap in the dmi_walk callback instead of storing a pointer. Signed-off-by: Andy Lutomirski <luto@kernel.org> Acked-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-01-19Merge tag 'platform-drivers-x86-v4.5-1' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86Linus Torvalds1-27/+155
Pull x86 platform driver updates from Darren Hart: "Add intel punit and telemetry driver for APL SoCs. Add intel-hid driver for various laptop hotkey support. Add asus-wireless radio control driver. Keyboard backlight support/improvements for ThinkPads, Vaio, and Toshiba. Several hotkey related fixes and improvements for dell and toshiba. Fix oops on dual GPU Macs in apple-gmux. A few new device IDs and quirks. Various minor config related build issues and cleanups. surface pro 4: - fix compare_const_fl.cocci warnings - Add support for Surface Pro 4 Buttons platform/x86: - Add Intel Telemetry Debugfs interfaces - Add Intel telemetry platform device - Add Intel telemetry platform driver - Add Intel Telemetry Core Driver - add NULL check for input parameters - add Intel P-Unit mailbox IPC driver - update acpi resource structure for Punit thinkpad_acpi: - Add support for keyboard backlight dell-wmi: - Process only one event on devices with interface version 0 - Check if Dell WMI descriptor structure is valid - Improve unknown hotkey handling - Use a C99-style array for bios_to_linux_keycode tc1100-wmi: - fix build warning when CONFIG_PM not enabled asus-wireless: - Add ACPI HID ATK4001 - Add Asus Wireless Radio Control driver asus-wmi: - drop to_platform_driver macro intel-hid: - new hid event driver for hotkeys sony-laptop: - Keyboard backlight control for some Vaio Fit models ideapad-laptop: - Add Lenovo ideapad Y700-17ISK to no_hw_rfkill dmi list apple-gmux: - Assign apple_gmux_data before registering toshiba_acpi: - Add rfkill dependency to ACPI_TOSHIBA entry - Fix keyboard backlight sysfs entries not being updated - Add WWAN RFKill support - Add support for WWAN devices - Fix blank screen at boot if transflective backlight is supported - Propagate the hotkey value via genetlink toshiba_bluetooth: - Add missing newline in toshiba_bluetooth_present function" * tag 'platform-drivers-x86-v4.5-1' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86: (29 commits) surface pro 4: fix compare_const_fl.cocci warnings surface pro 4: Add support for Surface Pro 4 Buttons platform:x86: Add Intel Telemetry Debugfs interfaces platform:x86: Add Intel telemetry platform device platform:x86: Add Intel telemetry platform driver platform/x86: Add Intel Telemetry Core Driver intel_punit_ipc: add NULL check for input parameters thinkpad_acpi: Add support for keyboard backlight dell-wmi: Process only one event on devices with interface version 0 dell-wmi: Check if Dell WMI descriptor structure is valid tc1100-wmi: fix build warning when CONFIG_PM not enabled asus-wireless: Add ACPI HID ATK4001 platform/x86: Add Asus Wireless Radio Control driver asus-wmi: drop to_platform_driver macro intel-hid: new hid event driver for hotkeys Keyboard backlight control for some Vaio Fit models platform/x86: Add rfkill dependency to ACPI_TOSHIBA entry platform:x86: add Intel P-Unit mailbox IPC driver intel_pmc_ipc: update acpi resource structure for Punit ideapad-laptop: Add Lenovo ideapad Y700-17ISK to no_hw_rfkill dmi list ...
2016-01-19dell-wmi: Process only one event on devices with interface version 0Pali Rohár1-0/+16
BIOS/ACPI on devices with WMI interface version 0 does not clear buffer before filling it. So next time when BIOS/ACPI send WMI event which is smaller as previous then it contains garbage in buffer from previous event. BIOS/ACPI on devices with WMI interface version 1 clears buffer and sometimes send more events in buffer at one call. Since commit 83fc44c32ad8 ("dell-wmi: Update code for processing WMI events") dell-wmi process all events in buffer (and not just first). To prevent reading garbage from the buffer we process only the first event on devices with WMI interface version 0. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-01-19dell-wmi: Check if Dell WMI descriptor structure is validPali Rohár1-2/+78
After examining existing DSDT ACPI tables of more laptops and looking into Dell WMI document mentioned in ML dicussion archived at http://www.spinics.net/lists/platform-driver-x86/msg07220.html we will parse and check WMI descriptor if contains expected data. It is because WMI descriptor contains interface version number and it is needed to know in next commit. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>