summaryrefslogtreecommitdiff
path: root/drivers/platform
AgeCommit message (Collapse)AuthorFilesLines
2020-11-24platform/x86: touchscreen_dmi: Add info for the Irbis TW118 tabletHans de Goede1-0/+23
Add touchscreen info for the Irbis TW118 tablet. Reported-and-tested-by: russianneuromancer <russianneuromancer@ya.ru> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20201124110454.114286-1-hdegoede@redhat.com
2020-11-24platform/x86: intel-vbtn: Support for tablet mode on HP Pavilion 13 x360 PCMax Verevkin1-0/+6
The Pavilion 13 x360 PC has a chassis-type which does not indicate it is a convertible, while it is actually a convertible. Add it to the dmi_switches_allow_list. Signed-off-by: Max Verevkin <me@maxverevkin.tk> Link: https://lore.kernel.org/r/20201124131652.11165-1-me@maxverevkin.tk Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-24platform/x86: thinkpad_acpi: Send tablet mode switch at wakeup timeBenjamin Berg1-0/+1
The lid state may change while the machine is suspended. As such, we may need to re-check the state at wake-up time (at least when waking up from hibernation). Add the appropriate call to the resume handler in order to sync the SW_TABLET_MODE switch state with the hardware state. Fixes: dda3ec0aa631 ("platform/x86: thinkpad_acpi: Implement tablet mode using GMMS method") BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=210269 Signed-off-by: Benjamin Berg <bberg@redhat.com> Acked-by: Henrique de Moraes Holschuh <hnh@hmh.eng.br> Link: https://lore.kernel.org/r/20201123132157.866303-1-benjamin@sipsolutions.net Signed-off-by: Hans de Goede <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-24platform/x86: toshiba_acpi: Fix the wrong variable assignmentKaixu Xia1-2/+1
The commit 78429e55e4057 ("platform/x86: toshiba_acpi: Clean up variable declaration") cleans up variable declaration in video_proc_write(). Seems it does the variable assignment in the wrong place, this results in dead code and changes the source code logic. Fix it by doing the assignment at the beginning of the funciton. Fixes: 78429e55e4057 ("platform/x86: toshiba_acpi: Clean up variable declaration") Reported-by: Tosk Robot <tencent_os_robot@tencent.com> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com> Link: https://lore.kernel.org/r/1606024177-16481-1-git-send-email-kaixuxia@tencent.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-24platform/surface: gpe: Add support for 15" Intel version of Surface Laptop 3Maximilian Luz1-0/+12
In addition to a 13" version, there is also a 15" (business) version of the Surface Laptop 3 based on Intel CPUs. This version also handles wakeup by lid via (unmarked) GPEs, so add support for it as well. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20201113223935.2073847-1-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-24platform/x86: pmt: Fix a potential Oops on error in probeDan Carpenter1-1/+2
The "ns->attr_grp" pointer can be NULL so this error handling code needs to check for that to avoid an Oops. Fixes: e2729113ce66 ("platform/x86: Intel PMT class driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: David E. Box <david.e.box@linux.intel.com> Link: https://lore.kernel.org/r/20201117072251.GC1111239@mwanda Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-24platform/x86: i2c-multi-instantiate: Use device_get_match_data() to get ↵Andy Shevchenko1-4/+3
driver data Use device_get_match_data() to get driver data instead of boilerplate code. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20201105110530.27888-4-andriy.shevchenko@linux.intel.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-24platform/x86: i2c-multi-instantiate: Simplify with dev_err_probe()Andy Shevchenko1-3/+2
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20201105110530.27888-2-andriy.shevchenko@linux.intel.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-24platform/x86: i2c-multi-instantiate: Drop redundant ACPI_PTR()Andy Shevchenko1-1/+1
The driver depends on ACPI, ACPI_PTR() resolution is always the same. Otherwise a compiler may produce a warning. That said, the rule of thumb either ugly ifdeffery with ACPI_PTR or none should be used in a driver. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20201105110530.27888-1-andriy.shevchenko@linux.intel.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-18platform/chrome: cros_ec_typec: Correct the Thunderbolt rounded/non-rounded ↵Utkarsh Patel1-2/+1
cable support Thunderbolt rounded/non-rounded cable support is two bits value. Correcting it as per the Thunderbolt 3 cable discover mode VDO changes done in the Thunderbolt 3 alternate mode header. Signed-off-by: Utkarsh Patel <utkarsh.h.patel@intel.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> -- Changes in v2: - Removed the fixes tag as there is no functional implication. -- Link: https://lore.kernel.org/r/20201113202503.6559-3-utkarsh.h.patel@intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-12platform/chrome: cros_ec_typec: Register partner altmodesPrashant Malani1-0/+77
Use the discovery data from the Chrome EC to register parter altmodes with the Type C Connector Class framework. Also introduce a node struct to keep track of the list of registered alt modes. Signed-off-by: Prashant Malani <pmalani@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20201029222738.482366-8-pmalani@chromium.org
2020-11-12platform/chrome: cros_ec_typec: Parse partner PD ID VDOsPrashant Malani1-1/+59
Use EC_CMD_TYPE_DISCOVERY to retrieve and store the discovery data for the port partner. With that data, update the PD Identity VDO values for the partner, which were earlier not initialized. Signed-off-by: Prashant Malani <pmalani@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20201029222738.482366-7-pmalani@chromium.org
2020-11-12platform/chrome: cros_ec_typec: Introduce TYPEC_STATUSPrashant Malani1-0/+52
Make a call to the newly introduced EC_CMD_TYPEC_STATUS command. Currently we just check to see if the SOP (port-partner) discovery was done and emit a debug level print for it. Subsequent patches will retrieve and parse the discovery data and fill out the Type C connector class data structures. Also check the EC_FEATURE_TYPEC_CMD feature flag at probe, and only call the new TYPEC_STATUS command if the feature flag is supported. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Prashant Malani <pmalani@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Link: https://lore.kernel.org/r/20201029222738.482366-6-pmalani@chromium.org
2020-11-12platform/chrome: cros_ec_typec: Clear partner identity on device removalPrashant Malani1-0/+1
The partner identity struct isn't reset when a partner is removed, meaning a subsequent partner can inherit an old partner's identity VDOs before discovery is complete. So, clear that struct when a partner removal is detected. Signed-off-by: Prashant Malani <pmalani@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Link: https://lore.kernel.org/r/20201029222738.482366-4-pmalani@chromium.org
2020-11-12platform/chrome: cros_ec_typec: Fix remove partner logicPrashant Malani1-1/+4
The cros_unregister_ports() function can be called in situations where the partner has not been registered yet, and so its related data structures would not have been initialized. Calling cros_typec_remove_partner() in such a situation can lead to null pointer dereferences. So, only call cros_typec_remove_partner() if there is a valid registered partner pointer. Signed-off-by: Prashant Malani <pmalani@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Link: https://lore.kernel.org/r/20201029222738.482366-3-pmalani@chromium.org
2020-11-12platform/chrome: cros_ec_typec: Relocate set_port_params_v*() functionsPrashant Malani1-68/+68
Move the cros_typec_set_port_params_v0/v1() functions closer to the place where they are called, cros_typec_port_update(). While we are performing the relocation, also move cros_typec_get_mux_info() closer to its call-site. No functional changes are introduced by this commit. Signed-off-by: Prashant Malani <pmalani@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Link: https://lore.kernel.org/r/20201029222738.482366-2-pmalani@chromium.org
2020-11-12platform/chrome: Don't treat RTC events as wakeup sourcesStephen Boyd1-5/+9
The EC sends an RTC host event when the RTC fires, but we don't need to treat that as a wakeup event here. The RTC class already properly handles activating and deactivating a wakeup source in rtc_update_irq() by calling pm_stay_awake() at the start of processing and pm_relax() once all expired RTC timers have been processed. This reduces one wakeup increment but not much else. I noticed this while debugging RTC wakeups and how they always incremented the wakeup count by two instead of one because this is duplicated. Signed-off-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Cc: Guenter Roeck <groeck@chromium.org> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: <linux-rtc@vger.kernel.org> Link: https://lore.kernel.org/r/20201030232523.2654478-1-swboyd@chromium.org
2020-11-10platform/x86: panasonic-laptop: Add sysfs attributes for firmware brightness ↵Kenneth Chan1-0/+109
registers Panasonic laptops (at least from CF-W4 onwards) have dedicated firmware registers for saving ac/dc and current brightness. They are a bit confusing so here's some explanations: AC_MIN_BRIGHT, AC_MAX_BRIGHT, DC_MIN_BRIGHT, DC_MAX_BRIGHT: Read-only. Values: 0x01 and 0x15 respectively. AC_CUR_BRIGHT, DC_CUR_BRIGHT: Read-Write. 0x00-0xFF. Store user-defined AC/DC brightness. However, they do not represent current brightness so they should be named AC_BRIGHT and DC_BRIGHT instead. CUR_BRIGHT (present since CF-W4): Read-Write. 0x00-0xFF. It sets the current brightness. It won't update itself if brightness is changed via other means, e.g. acpi_video0. Another CUR_BRIGHT (added since CF-W5): Read-Write. 0x01-0x15. Its value always synchronizes with current brightness. Not implemented in this version. Currently the backlight API interacts with AC_CUR_BRIGHT (probably because it's the only bl register available in earlier models?). This patch adds sysfs attributes for AC_CUR_BRIGHT, DC_CUR_BRIGHT and CUR_BRIGHT. It also fixes the error of https://lkml.org/lkml/2020/8/19/1264. PS: I think the backlight API should interact with CUR_BRIGHT instead of AC_CUR_BRIGHT. But it involves complications like mapping between 0x01-0x15 or 0x00-0x14 (the backlight API) and 0x00-0xFF (CUR_BRIGHT). I'll leave the discussion for a later version. Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com> Link: https://lore.kernel.org/r/20200821181433.17653-10-kenneth.t.chan@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10platform/x86: panasonic-laptop: Add support for battery charging threshold ↵Kenneth Chan1-3/+83
(eco mode) Add battery charging threshold (aka ECO mode) support. NOTE: The state of ECO mode is persistent until the next POST cycle which reset it to previous state. Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com> Link: https://lore.kernel.org/r/20200821181433.17653-9-kenneth.t.chan@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10platform/x86: panasonic-laptop: Resolve hotkey double trigger bugKenneth Chan1-3/+6
Sometimes double ACPI events are triggered for brightness, vol and mute hotkeys. This patch fixes it. Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com> Link: https://lore.kernel.org/r/20200821181433.17653-8-kenneth.t.chan@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10platform/x86: panasonic-laptop: Add write support to muteKenneth Chan1-1/+24
Add write support to the mute platform device Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com> Link: https://lore.kernel.org/r/20200821181433.17653-7-kenneth.t.chan@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10platform/x86: panasonic-laptop: Fix sticky key init bugKenneth Chan1-9/+15
The return value of the sticky key on some models (e.g. CF-W5) do not reflect its state. How to retrieve its state from firmware is unknown. The safest bet is to reset it at module init and store its state in pcc struct. Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com> Link: https://lore.kernel.org/r/20200821181433.17653-6-kenneth.t.chan@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10platform/x86: panasonic-laptop: Fix naming of platform files for consistency ↵Kenneth Chan1-9/+11
with other modules Change platform device function names for consistency with other modules Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com> Link: https://lore.kernel.org/r/20200821181433.17653-5-kenneth.t.chan@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10platform/x86: panasonic-laptop: Split MODULE_AUTHOR() by one author per ↵Kenneth Chan1-1/+6
macro call In reply to https://lkml.org/lkml/2020/8/19/186 to split MODULE_AUTHOR() per macro call. Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com> Link: https://lore.kernel.org/r/20200821181433.17653-4-kenneth.t.chan@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10platform/x86: panasonic-laptop: Replace ACPI prints with pr_*() macrosKenneth Chan1-33/+14
Replace ACPI prints with pr_*() macros for consistency with other platform devices. Clean up obsolete ACPI_HOTKEY_COMPONENT code. Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com> Link: https://lore.kernel.org/r/20200821181433.17653-3-kenneth.t.chan@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-10platform/x86: panasonic-laptop: Add support for optical driver power in Y ↵Kenneth Chan1-0/+190
and W series The physical optical drive switch is present in Y and W series that switches on the drive but fails to turn it off. The idea is to be able to toggle the drive power by software and/or hardware. This patch merges Martin Lucina <mato@kotelna.sk>'s work that took care of the software part. Code is also added for the physical switch to power off the drive. Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com> Link: https://lore.kernel.org/r/20200821181433.17653-2-kenneth.t.chan@gmail.com Signed-off-by: Hans de Goede <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-11-09platform/x86: intel-hid: fix _DSM function index handlingZhen Gong1-2/+14
According to the ACPI spec 9.1.1 _DSM (Device Specific Method), intel_hid_dsm_fn_mask, acquired from function index 0, is "a buffer containing one bit for each function index". When validitaing fn_index, it should be compared with corresponding bit. This buffer is usually longer than a byte. Depending on whether INTEL_HID_DSM_HEBC_V2_FN exist, it could be either "Buffer (0x02) { 0xFF, 0x01 }" or "Buffer (0x02) { 0xFF, 0x03 }". Probably it won't grow larger according to the description. On older platforms, available functions could be fewer or not supported at all, i.e., "Buffer (One) { 0x00 }". Signed-off-by: Zhen Gong <zhengong@usc.edu> Link: https://lore.kernel.org/r/CAJCLVRCyp0ASdWTx-PxsrDC9zFBPw0U2AtPip+_Hpj2r5gUPwA@mail.gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-09platform/x86: intel_pmc_core: Assign boolean values to a bool variableKaixu Xia1-1/+1
Fix the following coccinelle warnings: ./drivers/platform/x86/intel_pmc_core.c:932:1-16: WARNING: Assignment of 0/1 to bool variable Signed-off-by: Kaixu Xia <kaixuxia@tencent.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/1604753621-7387-1-git-send-email-kaixuxia@tencent.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-09platform/x86: amd-pmc: Add AMD platform support for S2IdleShyam Sundar S K3-0/+303
AMD Power Management Controller driver a.k.a. amd-pmc driver is the controller which is meant for the final S2Idle transaction that goes to the PMFW running on the AMD SMU (System Management Unit) responsible for tuning of the VDD. Once all the monitored list or the idle constraints are met, this driver would go and set the OS_HINT (meaning all the devices have reached to their lowest state possible) via the SMU mailboxes. This driver would also provide some debug capabilities via debugfs. Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20201105140531.2955555-1-Shyam-sundar.S-k@amd.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-09platform/x86: thinkpad_acpi: Add BAT1 is primary battery quirk for Thinkpad ↵Hans de Goede1-0/+1
Yoga 11e 4th gen The Thinkpad Yoga 11e 4th gen with the N3450 / Celeron CPU only has one battery which is named BAT1 instead of the expected BAT0, add a quirk for this. This fixes not being able to set the charging tresholds on this model; and this alsoe fixes the following errors in dmesg: ACPI: \_SB_.PCI0.LPCB.EC__.HKEY: BCTG evaluated but flagged as error thinkpad_acpi: Error probing battery 2 battery: extension failed to load: ThinkPad Battery Extension battery: extension unregistered: ThinkPad Battery Extension Note that the added quirk is for the "R0K" BIOS versions which are used on the Thinkpad Yoga 11e 4th gen's with a Celeron CPU, there is a separate "R0L" BIOS for the i3/i5 based versions. This may also need the same quirk, but if that really is necessary is unknown. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20201109103550.16265-1-hdegoede@redhat.com
2020-11-09platform/x86: thinkpad_acpi: Do not report SW_TABLET_MODE on Yoga 11eHans de Goede1-1/+8
The Yoga 11e series has 2 accelerometers described by a BOSC0200 ACPI node. This setup relies on a Windows service which reads both accelerometers and then calculates the angle between the 2 halves to determine laptop / tent / tablet mode and then reports the calculated mode back to the EC by calling special ACPI methods on the BOSC0200 node. The bmc150 iio driver does not support this (it involves double calculations requiring sqrt and arccos so this really needs to be done in userspace), as a result of this on the Yoga 11e the thinkpad_acpi code always reports SW_TABLET_MODE=0, starting with GNOME 3.38 reporting SW_TABLET_MODE=0 causes GNOME to: 1. Not show the onscreen keyboard when a text-input field is focussed with the touchscreen. 2. Disable accelerometer based auto display-rotation. This makes sense when in laptop-mode but not when in tablet-mode. But since for the Yoga 11e the thinkpad_acpi code always reports SW_TABLET_MODE=0, GNOME does not know when the device is in tablet-mode. Stop reporting the broken (always 0) SW_TABLET_MODE on Yoga 11e models to fix this. Note there are plans for userspace to support 360 degree hinges style 2-in-1s with 2 accelerometers and figure out the mode by itself, see: https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/issues/216 Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20201106140130.46820-1-hdegoede@redhat.com
2020-11-09platform/x86: thinkpad_acpi: add P1 gen3 second fan supportIakov 'Jake' Kirilenko1-0/+1
Tested on my P1 gen3, works fine with `thinkfan`. Since thinkpad_acpi fan control is off by default, it is safe to add 2nd fan control for brave overclockers Signed-off-by: Iakov 'Jake' Kirilenko <jake.kirilenko@gmail.com> Link: https://lore.kernel.org/r/20201105152556.34073-1-jake.kirilenko@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-09platform/x86: dell-wmi-sysman: fix init_bios_attributes() error handlingDan Carpenter1-4/+6
Calling release_attributes_data() while holding the "wmi_priv.mutex" will lead to a dead lock. The other problem is that if kzalloc() fails then this should return -ENOMEM but currently it returns success. Fixes: e8a60aa7404b ("platform/x86: Introduce support for Systems Management Driver over WMI for Dell Systems") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20201103101735.GB1127762@mwanda Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-09platform/surface: Add Driver to set up lid GPEs on MS Surface deviceMaximilian Luz3-0/+320
Conventionally, wake-up events for a specific device, in our case the lid device, are managed via the ACPI _PRW field. While this does not seem strictly necessary based on ACPI spec, the kernel disables GPE wakeups to avoid non-wakeup interrupts preventing suspend by default and only enables GPEs associated via the _PRW field with a wake-up capable device. This behavior has been introduced in commit f941d3e41da7 ("ACPI: EC / PM: Disable non-wakeup GPEs for suspend-to-idle") and is described in more detail in its commit message. Unfortunately, on MS Surface devices, there is no _PRW field present on the lid device, thus no GPE is associated with it, and therefore the GPE responsible for sending the status-change notification to the lid gets disabled during suspend, making it impossible to wake the device via the lid. This patch introduces a pseudo-device and respective driver which, based on some DMI matching, marks the corresponding GPE of the lid device for wake and enables it during suspend. The behavior of this driver models the behavior of the ACPI/PM core for normal wakeup GPEs, properly declared via the _PRW field. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20201028105427.1593764-1-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-09Merge tag 'ib-mfd-x86-v5.11' into review-hansHans de Goede6-0/+874
Immutable branch between MFD and x86 due for the v5.11 merge window
2020-11-04platform/x86: Intel PMT Crashlog capability driverAlexander Duyck3-0/+340
Add support for the Intel Platform Monitoring Technology crashlog interface. This interface provides a few sysfs values to allow for controlling the crashlog telemetry interface as well as a character driver to allow for mapping the crashlog memory region so that it can be accessed after a crashlog has been recorded. This driver is meant to only support the server version of the crashlog which is identified as crash_type 1 with a version of zero. Currently no other types are supported. Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com> Signed-off-by: David E. Box <david.e.box@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-11-04platform/x86: Intel PMT Telemetry capability driverAlexander Duyck3-0/+172
PMT Telemetry is a capability of the Intel Platform Monitoring Technology. The Telemetry capability provides access to device telemetry metrics that provide hardware performance data to users from read-only register spaces. With this driver present the intel_pmt directory can be populated with telem<x> devices. These devices will contain the standard intel_pmt sysfs data and a "telem" binary sysfs attribute which can be used to access the telemetry data. Also create a PCI device id list for early telemetry hardware that require workarounds for known issues. Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com> Co-developed-by: David E. Box <david.e.box@linux.intel.com> Signed-off-by: David E. Box <david.e.box@linux.intel.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-11-04platform/x86: Intel PMT class driverAlexander Duyck4-0/+362
Intel Platform Monitoring Technology is meant to provide a common way to access telemetry and system metrics. Register mappings are not provided by the driver. Instead, a GUID is read from a header for each endpoint. The GUID identifies the device and is to be used with an XML, provided by the vendor, to discover the available set of metrics and their register mapping. This allows firmware updates to modify the register space without needing to update the driver every time with new mappings. Firmware writes a new GUID in this case to specify the new mapping. Software tools with access to the associated XML file can then interpret the changes. The module manages access to all Intel PMT endpoints on a system, independent of the device exporting them. It creates an intel_pmt class to manage the devices. For each telemetry endpoint, sysfs files provide GUID and size information as well as a pointer to the parent device the telemetry came from. Software may discover the association between endpoints and devices by iterating through the list in sysfs, or by looking for the existence of the class folder under the device of interest. A binary sysfs attribute of the same name allows software to then read or map the telemetry space for direct access. Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com> Signed-off-by: David E. Box <david.e.box@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-11-03platform/x86/dell-wmi-sysman: Make some symbols staticZou Wei1-14/+7
Fix the following sparse warnings: ./passobj-attributes.c:38:23: warning: symbol 'po_is_pass_set' was not declared. Should it be static? ./passobj-attributes.c:70:23: warning: symbol 'po_current_password' was not declared. Should it be static? ./passobj-attributes.c:99:23: warning: symbol 'po_new_password' was not declared. Should it be static? ./passobj-attributes.c:103:23: warning: symbol 'po_min_pass_length' was not declared. Should it be static? ./passobj-attributes.c:107:23: warning: symbol 'po_max_pass_length' was not declared. Should it be static? ./passobj-attributes.c:116:23: warning: symbol 'po_mechanism' was not declared. Should it be static? ./passobj-attributes.c:129:23: warning: symbol 'po_role' was not declared. Should it be static? Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Zou Wei <zou_wei@huawei.com> Link: https://lore.kernel.org/r/1604107922-14950-1-git-send-email-zou_wei@huawei.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-11-03platform/x86/dell-wmi-sysman: Make wmi_sysman_kobj_sysfs_ops staticZou Wei1-1/+1
Fix the following sparse warning: drivers/platform/x86/dell-wmi-sysman/sysman.c:258:24: warning: symbol 'wmi_sysman_kobj_sysfs_ops' was not declared. Should it be static? wmi_sysman_kobj_sysfs_ops has only call within sysman.c It should be static Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Zou Wei <zou_wei@huawei.com> Link: https://lore.kernel.org/r/1603971581-64135-1-git-send-email-zou_wei@huawei.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: asus-wmi: Add support for SW_TABLET_MODE on UX360Samuel Čavoj3-0/+56
The UX360CA has a WMI device id 0x00060062, which reports whether the lid is flipped in tablet mode (1) or in normal laptop mode (0). Add a quirk (quirk_asus_use_lid_flip_devid) for devices on which this WMI device should be used to figure out the SW_TABLET_MODE state, as opposed to the quirk_asus_use_kbd_dock_devid. Additionally, the device needs to be queried on resume and restore because the firmware does not generate an event if the laptop is put to sleep while in tablet mode, flipped to normal mode, and later awoken. It is assumed other UX360* models have the same WMI device. As such, the quirk is applied to devices with DMI_MATCH(DMI_PRODUCT_NAME, "UX360"). More devices with this feature need to be tested and added accordingly. The reason for using an allowlist via the quirk mechanism is that the new WMI device (0x00060062) is also present on some models which do not have a 360 degree hinge (at least FX503VD and GL503VD from Hans' DSTS collection) and therefore its presence cannot be relied on. Signed-off-by: Samuel Čavoj <samuel@cavoj.net> Cc: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20201020220944.1075530-1-samuel@cavoj.net Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-10-28platform/x86: remove unneeded breakTom Rix3-7/+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>