summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/acer-wmi.c
AgeCommit message (Collapse)AuthorFilesLines
2023-12-02platform/x86: acer-wmi: add fan speed monitoring for Predator PHN16-71SungHwan Jung1-1/+107
Support CPU and GPU fan speed monitoring through WMI for Predator PHN16-71. Signed-off-by: SungHwan Jung <onenowy@gmail.com> Link: https://lore.kernel.org/r/20231124094122.100707-3-onenowy@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2023-12-02platform/x86: acer-wmi: Add platform profile and mode key support for ↵SungHwan Jung1-5/+266
Predator PHN16-71 The Acer Predator PHN16-71 has the mode key that is used to rotate thermal modes or toggle turbo mode with predator sense app (ver. 4) on windows. This patch includes platform profile and the mode key support for the device and also includes a small fix for "WMI_gaming_execute_u64" function. Signed-off-by: SungHwan Jung <onenowy@gmail.com> Link: https://lore.kernel.org/r/20231124094122.100707-2-onenowy@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2023-10-17platform/x86: acer-wmi: Remove void function returnEdson Juliano Drosdeck1-2/+0
Adhere to Linux kernel coding style. Reported by checkpatch: WARNING: void function return statements are not generally useful Signed-off-by: Edson Juliano Drosdeck <edson.drosdeck@gmail.com> Link: https://lore.kernel.org/r/20231016182910.3344-1-edson.drosdeck@gmail.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2023-03-07platform/x86: acer-wmi: Convert to platform remove callback returning voidUwe Kleine-König1-3/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230302144732.1903781-2-u.kleine-koenig@pengutronix.de Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2022-11-15platform/x86: acer-wmi: Enable SW_TABLET_MODE on Switch V 10 (SW5-017)Hans de Goede1-0/+9
Like the Acer Switch 10 (SW5-012) and Acer Switch 10 (S1003) models the Acer Switch V 10 (SW5-017) supports reporting SW_TABLET_MODE through acer-wmi. Add a DMI quirk for the SW5-017 setting force_caps to ACER_CAP_KBD_DOCK (these devices have no other acer-wmi based functionality). Cc: Rudolf Polzer <rpolzer@google.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20221111111639.35730-1-hdegoede@redhat.com
2022-10-03platform/x86: use PLATFORM_DEVID_NONE instead of -1Barnabás Pőcze1-1/+1
Use the `PLATFORM_DEVID_NONE` constant instead of hard-coding -1 when creating a platform device. No functional changes are intended. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Link: https://lore.kernel.org/r/20220930104857.2796923-1-pobrn@protonmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2022-09-05Merge tag 'backlight-detect-refactor-1' into review-hansHans de Goede1-66/+0
Immutable backlight-detect-refactor branch between acpi, drm-* and pdx86 Tag (immutable branch) with v6.0-rc1 + the (acpi/x86) backlight detect refactor work. For merging into the acpi, drm-* and pdx86 subsystems.
2022-09-03platform/x86: acer-wmi: Move backlight DMI quirks to acpi/video_detect.cHans de Goede1-66/+0
Move the backlight DMI quirks to acpi/video_detect.c, so that the driver no longer needs to call acpi_video_set_dmi_backlight_type(). acpi_video_set_dmi_backlight_type() is troublesome because it may end up getting called after other backlight drivers have already called acpi_video_get_backlight_type() resulting in the other drivers already being registered even though they should not. Note that even though the DMI quirk table name was video_vendor_dmi_table, 5/6 quirks were actually quirks to use the GPU native backlight. These 5 quirks also had a callback in their dmi_system_id entry which disabled the acer-wmi vendor driver; and any DMI match resulted in: acpi_video_set_dmi_backlight_type(acpi_backlight_vendor); which disabled the acpi_video driver, so only the native driver was left. The new entries for these 5/6 devices correctly marks these as needing the native backlight driver. Also note that other changes in this series change the native backlight drivers to no longer unconditionally register their backlight. Instead these drivers now do this check: if (acpi_video_get_backlight_type(false) != acpi_backlight_native) return 0; /* bail */ which without this patch would have broken these 5/6 "special" quirks. Since I had to look at all the commits adding the quirks anyways, to make sure that I understood the code correctly, I've also added links to the various original bugzillas for these quirks to the new entries. Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2022-08-29platform/x86: acer-wmi: Acer Aspire One AOD270/Packard Bell Dot keymap fixesHans de Goede1-1/+8
2 keymap fixes for the Acer Aspire One AOD270 and the same hardware rebranded as Packard Bell Dot SC: 1. The F2 key is marked with a big '?' symbol on the Packard Bell Dot SC, this sends WMID_HOTKEY_EVENTs with a scancode of 0x27 add a mapping for this. 2. Scancode 0x61 is KEY_SWITCHVIDEOMODE. Usually this is a duplicate input event with the "Video Bus" input device events. But on these devices the "Video Bus" does not send events for this key. Map 0x61 to KEY_UNKNOWN instead of using KE_IGNORE so that udev/hwdb can override it on these devs. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20220829163544.5288-1-hdegoede@redhat.com
2022-06-22platform/x86: acer-wmi: Use backlight helperStephen Kitt1-6/+1
Instead of retrieving the backlight brightness in struct backlight_properties manually, and then checking whether the backlight should be on at all, use backlight_get_brightness() which does all this and insulates this from future changes. Signed-off-by: Stephen Kitt <steve@sk2.org> Cc: "Lee, Chun-Yi" <jlee@suse.com> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Mark Gross <markgross@kernel.org> Cc: platform-driver-x86@vger.kernel.org Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20220607184635.1127913-2-steve@sk2.org Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-09-14platform/x86: acer-wmi: use __packed instead of __attribute__((packed))Jules Irenge1-7/+7
checkpatch.pl tool warns about using __attribute__((packed)) "WARNING: __packed is preferred over __attribute__((packed))" To fix this __attribute__((packed)) is replaced by __packed Signed-off-by: Jules Irenge <jbi.octave@gmail.com> Link: https://lore.kernel.org/r/20210912011741.30495-1-jbi.octave@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-08-13platform/x86: acer-wmi: Add Turbo Mode support for Acer PH315-53JafarAkhondali1-0/+179
The Acer Predator Helios series (usually denoted by PHxxx-yy) features a particular key above the keyboard named "TURBO". The turbo key does 3 things: 1. Set all fan's speeds to TURBO mode 2. Overclocks the CPU and GPU in the safe range 3. Turn on an LED just below the turbo button All the above actions are operating using WMI function calls, and there is no custom OC level for turbo. It acts as a flag for enabling turbo mode instead of telling processors to use a specific multiply of power (e.g. 1.3x of power). I've run some benchmark tests and it worked fine: GpuTest 0.7.0 http://www.geeks3d.com Module: FurMark Normal mode Score: 7289 points (FPS: 121) Turbo mode Score: 7675 points (FPS: 127) Settings: - 1920x1080 fullscreen - antialiasing: Off - duration: 60000 ms Renderer: - GeForce RTX 2060/PCIe/SSE2 - OpenGL: 4.6.0 NVIDIA 460.32.03 This feature is presented by Acer officially and should not harm hardware in any case. A challenging part of implementing this feature is that calling overclock function requires knowing the exact count of fans for CPU and GPU of each model, which to the best of my knowledge is not available in the kernel. So after checking the official PredatorSense application methods, it turned out they have provided the software the list of fans in each model. I have access to the mentioned list, and all similar PH-iii-jj can be added easily by matching "DMI_PRODUCT_NAME". Creating a specific file for the Acer gaming features is not possible because the current in use WMI event GUID is required for the turbo button and it's not possible to register multiple listeners on a single WMI event. Signed-off-by: JafarAkhondali <jafar.akhoondali@gmail.com> Link: https://lore.kernel.org/r/20210812125307.1749207-1-jafar.akhoondali@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-02-04platform/x86: acer-wmi: Don't use ACPI_EXCEPTION()Hans de Goede1-2/+2
ACPI_EXCEPTION is only intended for internal use by the ACPICA code. ACPI_EXCEPTION was being used here to change the apci_status code into something human-readable, use acpi_format_exception() for this instead, which is the proper way to do this outside of ACPICA. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20210204140205.268344-1-hdegoede@redhat.com
2020-11-24platform/x86: acer-wmi: Add ACER_CAP_KBD_DOCK quirk for the Aspire Switch ↵Hans de Goede1-0/+9
10E SW3-016 Add the Acer Aspire Switch 10E SW3-016 to the list of models which use the Acer Switch WMI interface for reporting SW_TABLET_MODE. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20201123151625.5530-1-hdegoede@redhat.com
2020-11-10platform/x86: acer-wmi: add automatic keyboard background light toggle key ↵Timo Witte1-0/+1
as KEY_LIGHTS_TOGGLE Got a dmesg message on my AMD Renoir based Acer laptop: "acer_wmi: Unknown key number - 0x84" when toggling keyboard background light Signed-off-by: Timo Witte <timo.witte@gmail.com> Reviewed-by: "Lee, Chun-Yi" <jlee@suse.com> Link: https://lore.kernel.org/r/20200804001423.36778-1-timo.witte@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-10-28platform/x86: acer-wmi: Add support for SW_TABLET_MODE on Switch devicesHans de Goede1-3/+106
Add support for SW_TABLET_MODE on the Acer Switch 10 (SW5-012) and the acer Switch 10 (S1003) models. There is no way to detect if this is supported, so this uses DMI based quirks setting force_caps to ACER_CAP_KBD_DOCK (these devices have no other acer-wmi based functionality). The new SW_TABLET_MODE functionality can be tested on devices which are not in the DMI table by passing acer_wmi.force_caps=0x40 on the kernel commandline. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20201019185628.264473-6-hdegoede@redhat.com
2020-10-28platform/x86: acer-wmi: Add ACER_CAP_SET_FUNCTION_MODE capability flagHans de Goede1-1/+6
Not all devices supporting WMID_GUID3 support the wmid3_set_function_mode() call, leading to errors like these: [ 60.138358] acer_wmi: Enabling RF Button failed: 0x1 - 0xff [ 60.140036] acer_wmi: Enabling Launch Manager failed: 0x1 - 0xff Add an ACER_CAP_SET_FUNCTION_MODE capability flag, so that these calls can be disabled through the new force_caps mechanism. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20201019185628.264473-5-hdegoede@redhat.com
2020-10-28platform/x86: acer-wmi: Add new force_caps module parameterHans de Goede1-1/+7
Add a new force_caps module parameter to allow overriding the drivers builtin capability detection mechanism. This can be used to for example: -Disable rfkill functionality on devices where there is an AA OEM DMI record advertising non functional rfkill switches -Force loading of the driver on devices with a missing AA OEM DMI record Note that force_caps is -1 when unset, this allows forcing the capability field to 0, which results in acer-wmi only providing WMI hotkey handling while disabling all other (led, rfkill, backlight) functionality. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20201019185628.264473-4-hdegoede@redhat.com
2020-10-28platform/x86: acer-wmi: Cleanup accelerometer device handlingHans de Goede1-14/+6
Cleanup accelerometer device handling: -Drop acer_wmi_accel_destroy instead directly call input_unregister_device. -The information tracked by the CAP_ACCEL flag mirrors acer_wmi_accel_dev being NULL. Drop the CAP flag, this is a preparation change for allowing users to override the capability flags. Dropping the flag stops users from causing a NULL pointer dereference by forcing the capability. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20201019185628.264473-3-hdegoede@redhat.com
2020-10-28platform/x86: acer-wmi: Cleanup ACER_CAP_FOO definesHans de Goede1-11/+7
Cleanup the ACER_CAP_FOO defines: -Switch to using BIT() macro. -The ACER_CAP_RFBTN flag is set, but it is never checked anywhere, drop it. -Drop the unused ACER_CAP_ANY define. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20201019185628.264473-2-hdegoede@redhat.com
2020-10-28platform/x86: acer-wmi: Drop no-op set_quirks call from find_quirksHans de Goede1-5/+0
set_quirks has a "if (!interface) return;" check at its beginning and interface always is NULL when set_quirks is called from find_quirks, so it is a no-op and we can drop it. This also allows dropping the "if (!interface) return;" from set_quirks since set_quirks now always is called with interface != NULL. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20201019185628.264473-1-hdegoede@redhat.com
2020-10-28platform/x86: remove unneeded breakTom Rix1-1/+0
A break is not needed if it is preceded by a return Signed-off-by: Tom Rix <trix@redhat.com> Link: https://lore.kernel.org/r/20201019133212.12671-1-trix@redhat.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-08-24treewide: Use fallthrough pseudo-keywordGustavo A. R. Silva1-4/+4
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
2019-07-30platform/x86: acer-wmi: Switch to acpi_dev_get_first_match_dev()Andy Shevchenko1-42/+7
The acpi_dev_get_first_match_dev() helper will find and return an ACPI device pointer of the first registered device in the system by its HID. Use it instead of open coded variant. Cc: Chun-Yi Lee <jlee@suse.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-15Merge tag 'platform-drivers-x86-v5.3-1' of ↵Linus Torvalds1-24/+9
git://git.infradead.org/linux-platform-drivers-x86 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-29platform/x86: acer-wmi: Mark expected switch fall-throughsGustavo A. R. Silva1-0/+4
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. This patch fixes the following warnings: drivers/platform/x86/acer-wmi.c: In function ‘set_u32’: drivers/platform/x86/acer-wmi.c:1378:33: warning: this statement may fall through [-Wimplicit-fallthrough=] if (cap == ACER_CAP_WIRELESS || ^ drivers/platform/x86/acer-wmi.c:1386:3: note: here case ACER_WMID: ^~~~ drivers/platform/x86/acer-wmi.c:1393:12: warning: this statement may fall through [-Wimplicit-fallthrough=] else if (wmi_has_guid(WMID_GUID2)) ^ drivers/platform/x86/acer-wmi.c:1395:3: note: here default: ^~~~~~~ drivers/platform/x86/acer-wmi.c: In function ‘get_u32’: drivers/platform/x86/acer-wmi.c:1340:6: warning: this statement may fall through [-Wimplicit-fallthrough=] if (cap == ACER_CAP_MAILLED) { ^ drivers/platform/x86/acer-wmi.c:1344:2: note: here case ACER_WMID: ^~~~ drivers/platform/x86/acer-wmi.c: In function ‘WMID_get_u32’: drivers/platform/x86/acer-wmi.c:1013:6: warning: this statement may fall through [-Wimplicit-fallthrough=] if (quirks->mailled == 1) { ^ drivers/platform/x86/acer-wmi.c:1018:2: note: here default: ^~~~~~~ Warning level 3 was used: -Wimplicit-fallthrough=3 This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: acer-wmi: no need to check return value of debugfs_create ↵Greg Kroah-Hartman1-24/+5
functions When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Also, because there is no need to save the file dentry, remove the variable that was saving it and just recursively delete the whole directory. Cc: "Lee, Chun-Yi" <jlee@suse.com> Cc: Darren Hart <dvhart@infradead.org> Cc: Andy Shevchenko <andy@infradead.org> Cc: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 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>
2018-08-22platform/x86: acer-wmi: Silence "unsupported" message a bitBenjamin Herrenschmidt1-1/+1
This driver prints that "Unsupported machine..." message on every boot on ThinkPad X1 Carbon laptops (and I assume a number of other systems), which causes graphical boots to "glitch" a bit and is rather annoying ... Make it a pr_debug instead. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-08-15platform/x86: acer-wmi: refactor function has_capGustavo A. R. Silva1-4/+1
Refactor function has_cap in order to avoid returning integer values, when instead it should return booleans. This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Reviewed-by: "Lee, Chun-Yi" <jlee@suse.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-05-22platform/x86: acer-wmi: add another KEY_POWER keycodeAntonio Rosario Intilisano1-0/+1
Now that we have informed the firmware that the Power Button driver is active, laptops such as the Acer Swift 3 will generate a WMI key event with code 0x87 when the power button key is pressed. Add this keycode to the table so that it is converted to an appropriate input event. Signed-off-by: Antonio Rosario Intilisano <antonio.intilisano@gmail.com> Acked-by: Gianfranco Costamagna <locutusofborg@debian.org> Tested-by: Antonio Rosario Intilisano <antonio.intilisano@gmail.com> Cc: Chris Chiu <chiu@endlessm.com> Cc: Daniel Drake <drake@endlessm.com> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.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-Yi1-4/+4
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-13platform/x86: acer-wmi: Detect RF Button capabilityJoão Paulo Rechi Vita1-0/+7
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-04-28platform/x86: acer-wmi: setup accelerometer when ACPI device was foundLee, Chun-Yi1-5/+4
The 98d610c3739a patch was introduced since v4.11-rc1 that it causes that the accelerometer input device will not be created on workable machines because the HID string comparing logic is wrong. And, the patch doesn't prevent that the accelerometer input device be created on the machines that have no BST0001. That's because the acpi_get_devices() returns success even it didn't find any match device. This patch fixed the HID string comparing logic of BST0001 device. And, it also makes sure that the acpi_get_devices() returns acpi_handle for BST0001. Fixes: 98d610c3739a ("acer-wmi: setup accelerometer when machine has appropriate notify event") Reference: https://bugzilla.kernel.org/show_bug.cgi?id=193761 Reported-by: Samuel Sieb <samuel-kbugs@sieb.net> Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-03-15platform/x86: acer-wmi: remove sparse_keymap_free() callsMichał Kępień1-4/+1
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(). Signed-off-by: Michał Kępień <kernel@kempniu.pl> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-25platform/x86: acer-wmi: add another KEY_WLAN keycodeChris Chiu1-0/+1
Now that we have informed the firmware that the RF Button driver is active, laptops such as the Acer TravelMate P238-M will generate a WMI key event with code 0x86 when the Fn+F3 airplane mode key is pressed. Add this keycode to the table so that it is converted to an appropriate input event. Signed-off-by: Chris Chiu <chiu@endlessm.com> Signed-off-by: Daniel Drake <drake@endlessm.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-25platform/x86: acer-wmi: Inform firmware that RF Button Driver is activeChris Chiu1-16/+58
The same method to activate LM(Launch Manager) can also be used to activate the RF Button driver with different bit toggled in the same lm_status. To express that many functions this byte field can achieve, rename the lm_status to app_status. And also the app_mask is the bit mask which specifically indicate which bits are going to be changed. This solves a problem where the AR9565 wifi included in the Acer Aspire ES1-421 is permanently hard blocked according to the rfkill GPIO read by ath9k. Signed-off-by: Chris Chiu <chiu@endlessm.com> Signed-off-by: Daniel Drake <drake@endlessm.com> Reviewed-by: Lee, Chun-Yi <jlee@suse.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-02-03platform/x86: acer-wmi: setup accelerometer when machine has appropriate ↵Lee, Chun-Yi1-4/+18
notify event The accelerometer event relies on the ACERWMID_EVENT_GUID notify. So, this patch changes the codes to setup accelerometer input device when detected ACERWMID_EVENT_GUID. It avoids that the accel input device created on every Acer machines. In addition, patch adds a clearly parsing logic of accelerometer hid to acer_wmi_get_handle_cb callback function. It is positive matching the "SENR" name with "BST0001" device to avoid non-supported hardware. Reported-by: Bjørn Mork <bjorn@mork.no> Cc: Darren Hart <dvhart@infradead.org> Signed-off-by: Lee, Chun-Yi <jlee@suse.com> [andy: slightly massage commit message] Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-12-13platform/x86: acer-wmi: Only supports AMW0_GUID1 on acer familyLee, Chun-Yi1-0/+56
The AMW0_GUID1 wmi is not only found on Acer family but also other machines like Lenovo, Fujitsu and Medion. In the past, acer-wmi handled those non-Acer machines by quirks list. But actually acer-wmi driver was loaded on any machine that had AMW0_GUID1. This behavior is strange because those machines should be supported by appropriate wmi drivers. e.g. fujitsu-laptop, ideapad-laptop. This patch adds the logic to check the machine that has AMW0_GUID1 should be in Acer/Packard Bell/Gateway white list. But, it still keeps the quirk list of those supported non-acer machines for backward compatibility. Tested-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: Lee, Chun-Yi <jlee@suse.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-04-09acer-wmi: Use acpi_dev_found()Lukas Wunner1-12/+4
Use shiny new acpi_dev_found() and remove all the boilerplate to search for a particular ACPI device. No functional change. Signed-off-by: Lukas Wunner <lukas@wunner.de> Reviewed-by: Lee, Chun-Yi <jlee@suse.com> Acked-by: Darren Hart <dvhart@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-10-07acer-wmi: remove threeg and interface sysfs interfacesLee, Chun-Yi1-92/+0
Since v3.0 kernel, acer-wmi driver auto detects internal 3G device and provides the threeg rfkill interface. So the sysfs interface of 3G is no longer necessary now. The 7b8aca65 patch added kernel information log to remind to user space for the threeg sysfs interface will be removed in 2012, then b58b9ffc patch updated the interface removing time to 2014. I think the 3 years lead time is enough for user space application to use rfkill instead of sysfs interface to control 3G device. This patch removes code about threeg sysfs interface. And it also removes the unused interface sysfs that exposes which ACPI-WMI method used by acer-wmi driver on the machine. The information is already exposed by the acer-wmi initial log. Cc: Carlos Corbacho <carlos@strangeworlds.co.uk> Cc: Matthew Garrett <mjg59@srcf.ucam.org> Cc: Dmitry Torokhov <dtor@mail.ru> Cc: Corentin Chary <corentincj@iksaif.net> Cc: Martin Kepplinger <martink@posteo.de> Cc: Darren Hart <dvhart@infradead.org> Signed-off-by: Lee, Chun-Yi <jlee@suse.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-08-28acer-wmi: No rfkill on HP Omen 15 wifiMichael Powell1-0/+1
Prevents acer-wmi from blocking wifi on HP Omen 15 laptops Signed-off-by: Michael Powell <michael_powell@mentor.com> [david.ward@ll.mit.edu: Resubmitted clean patch] Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-06-19acer-wmi: Port to new backlight interface selection APIHans de Goede1-7/+3
Port the backlight selection logic to the new backlight interface selection API. This commit also removes various obsolete pr_xxx messages related to backlight interface selection. These are obsolete because they assume there is only a vendor or acpi backlight driver and no other choice. Also they are not necessary, if the user wants to know which backlight interfaces are registered a simple "ls /sys/class/backlight" suffices. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Lee, Chun-Yi <jlee@suse.com> Acked-by: Darren Hart <dvhart@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-12-15Merge tag 'driver-core-3.19-rc1' of ↵Linus Torvalds1-1/+0
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core update from Greg KH: "Here's the set of driver core patches for 3.19-rc1. They are dominated by the removal of the .owner field in platform drivers. They touch a lot of files, but they are "simple" changes, just removing a line in a structure. Other than that, a few minor driver core and debugfs changes. There are some ath9k patches coming in through this tree that have been acked by the wireless maintainers as they relied on the debugfs changes. Everything has been in linux-next for a while" * tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits) Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries" fs: debugfs: add forward declaration for struct device type firmware class: Deletion of an unnecessary check before the function call "vunmap" firmware loader: fix hung task warning dump devcoredump: provide a one-way disable function device: Add dev_<level>_once variants ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries ath: use seq_file api for ath9k debugfs files debugfs: add helper function to create device related seq_file drivers/base: cacheinfo: remove noisy error boot message Revert "core: platform: add warning if driver has no owner" drivers: base: support cpu cache information interface to userspace via sysfs drivers: base: add cpu_device_create to support per-cpu devices topology: replace custom attribute macros with standard DEVICE_ATTR* cpumask: factor out show_cpumap into separate helper function driver core: Fix unbalanced device reference in drivers_probe driver core: fix race with userland in device_add() sysfs/kernfs: make read requests on pre-alloc files use the buffer. sysfs/kernfs: allow attributes to request write buffer be pre-allocated. fs: sysfs: return EGBIG on write if offset is larger than file size ...
2014-10-28acer-wmi: Add acpi_backlight=video quirk for the Acer KAV80Hans de Goede1-0/+11
The acpi-video backlight interface on the Acer KAV80 is broken, and worse it causes the entire machine to slow down significantly after a suspend/resume. Blacklist it, and use the acer-wmi backlight interface instead. Note that the KAV80 is somewhat unique in that it is the only Acer model where we fall back to acer-wmi after blacklisting, rather then using the native (e.g. intel) backlight driver. This is done because there is no native backlight interface on this model. BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1128309 Cc: stable@vger.kernel.org Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-10-20platform: x86: drop owner assignment from platform_driversWolfram Sang1-1/+0
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-08-16Fix log message about future removal of interfaceMartin Kepplinger1-3/+3
If this is going away, it won't be in 2012. Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-08-16acer-wmi: Mark init data and code as suchMathias Krause1-20/+21
Quite a lot of code and data of acer-wmi.c is only ever used during initialization. Mark those accordingly -- and constify, where appropriate -- so the memory can be released afterwards. All in all those changes move ~10 kB of code and data to the .init sections, marking them for release after initialization has finished. Signed-off-by: Mathias Krause <minipli@googlemail.com> Cc: "Lee, Chun-Yi" <jlee@suse.com> Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-08-16acer-wmi: Hide acer_{suspend,resume} for !CONFIG_PM_SLEEPMathias Krause1-0/+5
Encapsulate acer_suspend() and acer_resume with #ifdef CONFIG_PM_SLEEP to get rid of the following warnings: ../acer-wmi.c:2046:12: warning: ‘acer_suspend’ defined but not used [-Wunused-function] ../acer-wmi.c:2068:12: warning: ‘acer_resume’ defined but not used [-Wunused-function] Signed-off-by: Mathias Krause <minipli@googlemail.com> Cc: "Lee, Chun-Yi" <jlee@suse.com> Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-08-16acer-wmi: Mark acer_wmi_keymap[] as __initconstMathias Krause1-1/+1
sparse_keymap_setup() will make a copy of the keymap, so we can release the master copy after initialization. Signed-off-by: Mathias Krause <minipli@googlemail.com> Cc: "Lee, Chun-Yi" <jlee@suse.com> Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>