summaryrefslogtreecommitdiff
path: root/drivers/platform/x86
AgeCommit message (Collapse)Author
2017-06-30platform/x86: sony-laptop: constify attribute_group and input index arrayArvind Yadav
attribute_groups are not supposed to change at runtime. All functions working with attribute_groups provided by <linux/sysfs.h> work with const attribute_group. The content of sony_laptop_input_index does not change and is declared as a static global array. Constify spic_attribute_group and sony_laptop_input_index. File size before: text data bss dec hex filename 31273 5176 372 36821 8fd5 drivers/platform/x86/sony-laptop.o File size After adding 'const': text data bss dec hex filename 31337 5112 372 36821 8fd5 drivers/platform/x86/sony-laptop.o Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> [dvhart: updated commit message, includes fix suggested by Arnd Bergmann] Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-30platform/x86: fujitsu-laptop: rework debuggingMichał Kępień
Using a dedicated Kconfig option for enabling debugging means the user may be forced to recompile their kernel in order to gather debugging information, which is inconvenient. Replace custom debugging infrastructure with standard logging functions, taking advantage of dynamic debug. Replace a pr_info() call inside an ACPI callback with an acpi_handle_info() call. The following mapping was used: - FUJLAPTOP_DBG_ERROR -> acpi_handle_err() - FUJLAPTOP_DBG_WARN -> acpi_handle_info() / dev_info() - FUJLAPTOP_DBG_INFO -> acpi_handle_debug() - FUJLAPTOP_DBG_TRACE -> acpi_handle_debug() / dev_dbg() This means that some events which used to only be logged when the user explicitly requested it will now be logged by default: - ACPI method evaluation errors, - unknown ACPI notification codes, - unknown hotkey scancodes. The first type of events should happen rarely, if ever at all. The rest is interesting from driver development perspective as their presence in the logs will mean the driver is unaware of certain events, handling of which should be implemented. Signed-off-by: Michał Kępień <kernel@kempniu.pl> Reviewed-by: Jonathan Woithe <jwoithe@just42.net> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-30platform/x86: fujitsu-laptop: do not evaluate ACPI _INI methodsMichał Kępień
acpi_ns_initialize_devices(), which is called during system-wide ACPI initialization, already detects and calls all _INI methods belonging to objects present in ACPI tables. There is no need to call these methods again every time the module is loaded because they only initialize status flags and hotkey-related variables; status flags are effectively constants, hotkey-related variables may be assigned non-zero values before acpi_fujitsu_laptop_add() is called, but that does not really matter as we drain the scancodes queued in the firmware's ring buffer before doing anything else. Remove sections of code which invoke and check evaluation status of the _INI methods belonging to the ACPI devices handled by the driver. Signed-off-by: Michał Kępień <kernel@kempniu.pl> Reviewed-by: Jonathan Woithe <jwoithe@just42.net> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-30platform/x86: fujitsu-laptop: do not update ACPI device power statusMichał Kępień
Calling acpi_bus_update_power() for ACPI devices FUJ02B1 and FUJ02E3 is pointless as they are not power manageable (neither _PS0 nor _PR0 is defined for any of them), which causes their power state to be inherited from their parent devices. Given the ACPI paths of these two devices (\_SB.PCI0.LPCB.FJEX, \_SB.FEXT), their parent devices are also not power manageable. These parent devices will thus have their power state initialized to ACPI_STATE_D0, which in turn causes the power state for both FUJ02B1 and FUJ02E3 to always be ACPI_STATE_D0 ("on"). Remove relevant acpi_bus_update_power() calls along with parts of debug messages that they were supposed to have an effect on. Signed-off-by: Michał Kępień <kernel@kempniu.pl> Reviewed-by: Jonathan Woithe <jwoithe@just42.net> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-30platform/x86: fujitsu-laptop: sanitize hotkey input device identificationMichał Kępień
In the case of brightness-related FUJ02B1 ACPI device, initializing the input device associated with it identically as acpi-video initializes its input device makes sense. However, using the same data for the input device associated with the FUJ02E3 ACPI device makes little sense, because the latter has nothing to do with video and assigning an arbitrary product ID to it is redundant. Signed-off-by: Michał Kępień <kernel@kempniu.pl> Reviewed-by: Jonathan Woithe <jwoithe@just42.net> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-30platform/x86: fujitsu-laptop: use strcpy to set ACPI device names and classesMichał Kępień
No formatting is needed when setting ACPI device name and class, so switch to using strcpy() for this purpose. Signed-off-by: Michał Kępień <kernel@kempniu.pl> Reviewed-by: Jonathan Woithe <jwoithe@just42.net> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-30platform/x86: fujitsu-laptop: remove redundant safety checksMichał Kępień
Do not check whether the pointer passed to ACPI add callbacks is NULL as it is earlier dereferenced anyway in the bus-level probe callback, acpi_device_probe(). Do not check the value of acpi_disabled in fujitsu_init(), because it is already done by acpi_bus_register_driver(), which is the first function called by fujitsu_init(). Signed-off-by: Michał Kępień <kernel@kempniu.pl> Reviewed-by: Jonathan Woithe <jwoithe@just42.net> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-30platform/x86: msi-laptop: constify msipf*_attribute_groupArvind Yadav
File size before: text data bss dec hex filename 5396 5016 85 10497 2901 drivers/platform/x86/msi-laptop.o File size After adding 'const': text data bss dec hex filename 5524 4888 85 10497 2901 drivers/platform/x86/msi-laptop.o Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-06-30platform/x86: eeepc-laptop: constify platform_attribute_groupArvind Yadav
File size before: text data bss dec hex filename 9934 1136 2 11072 2b40 drivers/platform/x86/eeepc-laptop.o File size After adding 'const': text data bss dec hex filename 9998 1072 2 11072 2b40 drivers/platform/x86/eeepc-laptop.o Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-06-28platform/x86: toshiba_haps: constify haps_attr_groupArvind Yadav
File size before: text data bss dec hex filename 1471 528 8 2007 7d7 drivers/platform/x86/toshiba_haps.o File size After adding 'const': text data bss dec hex filename 1519 464 8 1991 7c7 drivers/platform/x86/toshiba_haps.o Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-06-28platform/x86: dell-wmi-led: Adjust instance of wmi_evaluate_method calls to 0Mario Limonciello
Pali recently noticed that WMI instances are zero indexed. The only reason that these calls all worked properly is because the ASL didn't verify the instance number. Signed-off-by: Louis Davis <louis.davis@dell.com> Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-28platform/x86: alienware-wmi: Adjust instance of wmi_evaluate_method calls to 0Mario Limonciello
Pali recently noticed that WMI instances are zero indexed. The only reason that these calls all worked properly is because the ASL didn't verify the instance number. Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-21platform/x86: intel_menlow: Add const to thermal_cooling_device_ops structureBhumika Goyal
Declare thermal_cooling_device_ops structure as const as it is only passed as an argument to the function thermal_cooling_device_register and this argument is of type const. So, declare the structure as const. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-21platform/x86: acerhdf: Add const to thermal_cooling_device_ops structureBhumika Goyal
Declare thermal_cooling_device_ops structure as const as it is only passed as an argument to the function thermal_cooling_device_register and this argument is of type const. So, declare the structure as const. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-20platform/x86: dell-laptop: Fix bogus keyboard backlight sysfs interfaceKai Heng Feng
Dell Latitude 3160 does not have keyboard backlight, but there is a sysfs interface for it, which does nothing at all. KBD_LED_ON_TOKEN is the only token can be found. Since it doesn't have KBD_LED_OFF_TOKEN or KBD_LED_AUTO_*_TOKEN, it should be safe to assume at least two tokens should be present to support keyboard backlight. Not all models have ON token - they may have multiple AUTO tokens instead. Models which do not use SMBIOS token to control keyboard backlight, also have this issue. Brightness level is 0 on these models. Verified on Dell Inspiron 3565. Reports keyboard backlight is supported only when at least two modes are present. 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>
2017-06-20platform/x86: acer-wmi: Using zero as first WMI instance numberLee, Chun-Yi
Pali Rohár found that there have some wmi query/evaluation code that they used 'one' as the first WMI instance number. But the number is indexed from zero that it's must less than the instance_count in _WDG. This patch changes those instance number from one to zero. Cc: Darren Hart <dvhart@infradead.org> Cc: Andy Shevchenko <andy@infradead.org> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-06-18platform/x86: ideapad-laptop: Add Y720-15IKBN to no_hw_rfkillOlle Liljenzin
Lenovo Legion Y720-15IKBN is yet another Lenovo model that does not have an hw rfkill switch, resulting in wifi always reported as hard blocked. Add the model to the list of models without rfkill switch. Signed-off-by: Olle Liljenzin <olle@liljenzin.se> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-06-18platform/x86: ideapad-laptop: Add Y520-15IKBN to no_hw_rfkillOlle Liljenzin
Lenovo Legion Y520-15IKBN is yet another Lenovo model that does not have an hw rfkill switch, resulting in wifi always reported as hard blocked. Add the model to the list of models without rfkill switch. Signed-off-by: Olle Liljenzin <olle@liljenzin.se> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-06-16platform/x86: silead_dmi: Add touchscreen info for PoV mobii wintab p800wHans de Goede
Add touchscreen info for the Point of View mobii wintab p800w tablet. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-15platform/x86: silead_dmi: Add touchscreen info for Pipo W2S tabletHans de Goede
Add touchscreen info for Pipo W2S tablet. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-13platform/x86: wmi: Fix printing info about WDG structurePali Rohár
object_id and notify_id are in one union structure and their meaning is defined by flags. Therefore do not print notify_id for non-event block and do not print object_id for event block. Remove also reserved member as it does not have any defined meaning or type yet. As object_id and notify_id union members overlaps and have different types, it caused that kernel print to dmesg binary data. This patch eliminates it. Signed-off-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-06-13platform/x86: dell-rbtn: constify rfkill_ops structuresBhumika Goyal
Add const to rfkill_ops structures that are only passed as an argument to the functions rfkill_alloc or samsung_new_rfkill. These arguments are of type const, so such structures can be annotated with const. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-06-13platform/x86: ideapad-laptop: constify rfkill_ops structureBhumika Goyal
Add const to rfkill_ops structure as it is only passed as an argument to the functions rfkill_alloc. This argument is of type const, so annotate the structure with const. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-06-13platform/x86: samsung-laptop: constify rfkill_ops structuresBhumika Goyal
Add const to rfkill_ops structures that are only passed as an argument to the functions rfkill_alloc or samsung_new_rfkill. These arguments are of type const, so such structures can be annotated with const. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-06-13platform/x86: wmi*: Add recent copyright statementsDarren Hart (VMware)
Add copyright statements for Andy Lutomirski and Darren Hart (VMware) for their contributions to the WMI bus infrastructure and the creation of the wmi-bmof driver. Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org> Cc: Andy Lutomirski <luto@kernel.org>
2017-06-13platform/x86: acer-wmi: Detect RF Button capabilityJoão Paulo Rechi Vita
If a machine reports a RF Button in the communication button device bitmap, we need to remove it before calling Get Device Status otherwise it will return the "Undefined device" (0xE2) error code. Although this may be a BIOS bug, we don't really need to get or set the RF Button status. The status indicator LED embedded in the button is controlled by firmware logic, depending on the status of the wireless radios present on the machine (WiFi || WWAN). This commit fixes the wireless status indicator LED on the Acer TravelMate P648-G2-MG, and cleans the following message from the kernel log: "Get Current Device Status failed: 0xe2 - 0x0". Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com> Reviewed-by: "Lee, Chun-Yi" <joeyli.kernel@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-06-13platform/x86: panasonic-laptop: remove unused codeAlex Hung
The struct pcc_keyinput is not used in panasonic-laptop and in anywhere in kernel, and it can be removed. Signed-off-by: Alex Hung <alex.hung@canonical.com> Acked-by: Harald Welte <laforge@gnumonks.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-06-13platform/x86: samsung-laptop: Initialize loca variableAndy Shevchenko
The variable is used uninitialized which might come into unexpected behaviour on some Samsung laptops. Initialize it to 0xffff which seems a proper value for non-supported feature. Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-06-06platform/x86: dell-wmi: Convert to the WMI bus infrastructureAndy Lutomirski
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-06platform/x86: wmi-bmof: New driver to expose embedded Binary WMI MOF metadataDarren Hart (VMware)
Many laptops (and maybe servers?) have embedded WMI Binary MOF metadata. We do not yet have open-source tools for processing the data, although one is in the works thanks to Pali: https://github.com/pali/bmfdec There is currently no interface to get the data in the first place. By exposing it, we facilitate the development of new tools. This is based on the original work of Andy Lutomirski <luto@kernel.org>, but contains several modifications in response to various reviews. Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org> 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> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
2017-06-06platform/x86: wmi: Require query for data blocks, rename writable to setableDarren Hart (VMware)
The Microsoft WMI documentation requires all data blocks to implement the Query Control Method (WQxx). If we encounter a data block not implementing this control method, issue a warning, and ignore the data block. Remove the "readable" attribute as all data blocks must be readable (query-able). Be consistent with the language in the documentation, replace the "writable" attribute with "setable". Simplify (flatten) the control flow of wmi_create_device a bit while we are updating it for the above changes. Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org> 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>
2017-06-06platform/x86: wmi: Add an interface for subdrivers to access sibling devicesAndy Lutomirski
Some subdrivers need to access sibling devices. This gives them a clean way to do so. Signed-off-by: Andy Lutomirski <luto@kernel.org> 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-06platform/x86: wmi: Bind the platform device, not the ACPI nodeAndy 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 <luto@kernel.org> 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-06platform/x86: wmi: Add a new interface to read block dataAndy 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 <luto@kernel.org> 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-06platform/x86: wmi: Incorporate acpi_install_notify_handlerAndy Lutomirski
As a platform driver, acpi_driver.notify will not be available, so use acpi_install_notify_handler as we will be converting to a platform driver. This gives event drivers a 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 <luto@kernel.org> [dvhart: merge two development commits and update commit message] 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-06platform/x86: wmi: Instantiate all devices before adding themDarren Hart (VMware)
At some point, we will want sub-drivers 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 fixing some leaks, too. This is based on the original work of Andy Lutomirski <luto@kernel.org>, but includes several modifications, many in response to review from Michał Kępień <kernel@kempniu.pl>: https://www.spinics.net/lists/platform-driver-x86/msg08201.html Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org> 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>
2017-06-06platform/x86: wmi: Probe data objects for read and write capabilitiesAndy Lutomirski
The Dell XPS 13 9350 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 warnings about mismatched signatures. Signed-off-by: Andy Lutomirski <luto@kernel.org> 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-06platform/x86: wmi: Split devices into types and add basic sysfs attributesAndy Lutomirski
Divide 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 <luto@kernel.org> 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-06platform/x86: wmi: Fix error handling when creating devicesAndy Lutomirski
We have two memory leaks. If guid_already_parsed returned true, we leak the wmi_block. If wmi_create_device failed, we leak the device. Simplify the logic and fix both of them. Signed-off-by: Andy Lutomirski <luto@kernel.org> 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-06platform/x86: wmi: Turn WMI into a bus driverAndy 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 bus itself is a device in the new "wmi_bus" class, and all of the individual WMI devices are slotted into the device hierarchy correctly. Signed-off-by: Andy Lutomirski <luto@kernel.org> 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-06platform/x86: wmi: Track wmi devices per ACPI deviceAndy 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 are at it, match up notifications with the device they came from correctly. This will make our behavior more straightforward on systems with more than one WMI node in the ACPI tables (e.g. the Dell XPS 13 9350). This also adds a warning when GUIDs are not unique. NB: The guid_string parameter in guid_already_parsed was a little-endian binary GUID, not a string. Signed-off-by: Andy Lutomirski <luto@kernel.org> 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-06platform/x86: wmi: Clean up acpi_wmi_addAndy Lutomirski
Rearrange acpi_wmi_add to use Linux's error handling conventions. Signed-off-by: Andy Lutomirski <luto@kernel.org> 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-06platform/x86: wmi: Pass the acpi_device through to parse_wdgAndy Lutomirski
We will need the device to convert to a bus architecture and bind WMI to the platform device. Signed-off-by: Andy Lutomirski <luto@kernel.org> 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-06platform/x86: wmi: Drop "Mapper (un)loaded" messagesAndy Lutomirski
WMI is just a driver. There is no need to announce when it is loaded. Signed-off-by: Andy Lutomirski <luto@kernel.org> 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-rbtn: Improve explanation about DELLABC6Andy Lutomirski
According to Mario at Dell, the DELLABC6 device should not be used on a Linux system. It also conflicts with Intel-HID and its interactions with Network Manager. Document that we are aware of the device, but that we are intentionally ignoring it. Signed-off-by: Andy Lutomirski <luto@kernel.org> [dvhart: New commit message and minor comment wording fixes] Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: "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-06-03platform/x86: dell-wmi: Add a better description for "stealth mode"Andy Lutomirski
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 Lutomirski
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-06-03platform/x86: fujitsu-laptop: use device-specific data in remaining module codeMichał Kępień
To avoid using module-wide data in remaining module code, employ acpi_driver_data() and dev_get_drvdata() to fetch device-specific data to work on in each function. This makes the input local variables in hotkey-related callbacks and the module-wide struct fujitsu_laptop redundant, so remove them. Adjust whitespace to make checkpatch happy. Signed-off-by: Michał Kępień <kernel@kempniu.pl> Reviewed-by: Jonathan Woithe <jwoithe@just42.net> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-03platform/x86: fujitsu-laptop: use device-specific data in LED-related codeMichał Kępień
In order to perform their duties, all LED callbacks need a pointer to the struct acpi_device representing the FUJ02E3 ACPI device. To limit the use of the module-wide pointer, the same pointer should be extracted from data that gets passed to LED callbacks as arguments. However, LED core does not currently support supplying driver-specific pointers to struct led_classdev callbacks, so the latter have to be implemented a bit differently than backlight device callbacks and platform device attribute callbacks. As the FUJ02E3 ACPI device is the parent device of all LED class devices registered by fujitsu-laptop, struct acpi_device representing the former can be extracted by following the parent link present inside the struct device belonging to the struct led_classdev passed as an argument to each LED callback. To get rid of module-wide structures defining LED class devices, allocate them dynamically using devm_kzalloc() and initialize them in acpi_fujitsu_laptop_leds_register(). Signed-off-by: Michał Kępień <kernel@kempniu.pl> Reviewed-by: Jonathan Woithe <jwoithe@just42.net> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-06-03platform/x86: fujitsu-laptop: explicitly pass ACPI device to call_fext_func()Michał Kępień
Prepare for not using module-wide data in call_fext_func() by explicitly passing it a pointer to struct acpi_device while still using a module-wide pointer in each call. Doing this enables call_fext_func() to fetch the ACPI handle from its argument, making the acpi_handle field of struct fujitsu_laptop useless, so remove that field. While we are at it, the dev field of the same structure is assigned in acpi_fujitsu_laptop_add() but not used for anything, so remove it as well. Signed-off-by: Michał Kępień <kernel@kempniu.pl> Reviewed-by: Jonathan Woithe <jwoithe@just42.net> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>