summaryrefslogtreecommitdiff
path: root/drivers/platform/x86
AgeCommit message (Collapse)AuthorFilesLines
2024-05-14platform/x86: x86-android-tablets: Xiaomi pad2 RGB LED fwnode updatesKate Hsuan1-3/+3
Xiaomi pad2 RGB LED fwnode updates: 1. Set "label" instead "function" to change the LED classdev name from "rgb:indicator" to "mipad2:rgb:indicator" to match the usual triplet name format for LED classdevs. 2. Set the trigger to the new "bq27520-0-charging-orange-full-green" powersupply trigger type for multi-color LEDs. 3. Put the fwnode link for red before green in ktd2026_node_group[] so that multi_index becomes "red green blue". Signed-off-by: Kate Hsuan <hpa@redhat.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Co-developed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20240504164105.114017-8-hdegoede@redhat.com
2024-05-14platform/x86: x86-android-tablets: Pass struct device to init()Hans de Goede4-10/+10
Pass a struct device pointer for x86_android_tablet_device to the board specific init() functions, so that these functions can use this for e.g. devm_*() functions. Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20240509141207.63570-1-hdegoede@redhat.com
2024-05-14platform/x86/amd: pmc: Add new ACPI ID AMDI000BShyam Sundar S K1-0/+1
Add new ACPI ID AMDI000B used by upcoming AMD platform to the PMC supported list of devices. Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> Link: https://lore.kernel.org/r/20240510103946.877307-1-Shyam-sundar.S-k@amd.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-05-14platform/x86/amd: pmf: Add new ACPI ID AMDI0105Shyam Sundar S K1-0/+1
Add new ACPI ID AMDI0105 used by upcoming AMD platform to the PMF supported list of devices. Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> Link: https://lore.kernel.org/r/20240510103519.876646-1-Shyam-sundar.S-k@amd.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-05-14platform/x86: p2sb: Don't init until unassigned resources have been assignedBen Fradella1-14/+15
The P2SB could get an invalid BAR from the BIOS, and that won't be fixed up until pcibios_assign_resources(), which is an fs_initcall(). - Move p2sb_fs_init() to an fs_initcall_sync(). This is still early enough to avoid a race with any dependent drivers. - Add a check for IORESOURCE_UNSET in p2sb_valid_resource() to catch unset BARs going forward. - Return error values from p2sb_fs_init() so that the 'initcall_debug' cmdline arg provides useful data. Signed-off-by: Ben Fradella <bfradell@netapp.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: Klara Modin <klarasmodin@gmail.com> Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Link: https://lore.kernel.org/r/20240509164905.41016-1-bcfradella@proton.me Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-05-01platform/x86: ISST: Support SST-BF and SST-TF per levelSrinivas Pandruvada1-7/+31
SST SST-BF and SST-TF can be enabled/disabled per SST-PP level. So return a mask of all levels, where the feature is supported, instead of just for level 0. Since the return value returns all levels mask, not just level 0, update API version. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reviewed-by: Zhang Rui <rui.zhang@intel.com> Link: https://lore.kernel.org/r/20240430221052.15825-1-srinivas.pandruvada@linux.intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86/fujitsu-laptop: Replace sprintf() with sysfs_emit()Szilard Fabian1-9/+9
As suggested by Documentation/filesystems/sysfs.rst sysfs_emit() should be used when formatting the value to be returned to user space. Signed-off-by: Szilard Fabian <szfabian@bluemarch.art> Link: https://lore.kernel.org/r/20240428192548.113261-1-szfabian@bluemarch.art Acked-by: Jonathan Woithe <jwoithe@just42.net> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86:intel/pmc: Enable S0ix blocker show in Lunar LakeXi Pardee2-226/+261
Update Lunar Lake lpm maps to include S0ix blocker information. Add Lunar Lake blocker maps to enable S0ix blocker show in pmc core debugfs. Signed-off-by: Xi Pardee <xi.pardee@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240426002752.2504282-4-xi.pardee@linux.intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86:intel/pmc: Add support to show S0ix blocker counterXi Pardee2-0/+44
S0ix blocker counter is available in PWRM space. Add support to read and show S0ix blocker counter value through debugfs. Signed-off-by: Xi Pardee <xi.pardee@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240426002752.2504282-3-xi.pardee@linux.intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86:intel/pmc: Update LNL signal status mapXi Pardee2-1/+22
Update Lunar Lake signal status map. This status map has been updated since the map was merged. This patch updates the signal status map to the lastest version. Signed-off-by: Xi Pardee <xi.pardee@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240426002752.2504282-2-xi.pardee@linux.intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86: ISST: Add missing MODULE_DESCRIPTIONSrinivas Pandruvada2-0/+2
Add missing MODULE_DESCRIPTION() to ISST modules. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240423204619.3946901-11-srinivas.pandruvada@linux.intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86: ISST: Add dev_fmtSrinivas Pandruvada1-0/+2
Add dev_fmt for formatting log messages. No functional impact is expected. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240423204619.3946901-10-srinivas.pandruvada@linux.intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86: ISST: Use in_range() to check package ID validitySrinivas Pandruvada1-2/+1
Use in_range() macro to simplify range check. No functional impact is expected. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240423204619.3946901-9-srinivas.pandruvada@linux.intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86: ISST: Support partitioned systemsSrinivas Pandruvada1-32/+267
A partitioned system has two different PCI VSEC devices per package. A non-partitioned device has only one PCI VSEC device per package. The current implementation only supports non partitioned systems. Each partition maps a set of power domains. Other than reading from different MMIO regions, there is no change in the SST functionality. The scope of SST control is still per power domain. Hence user space does not need to be aware of existence of partitions. With partitions, existing per package information defined using struct tpmi_sst_struct is enhanced to store information for both partitions. A mapping function map_partition_power_domain_id() is introduced, which maps to correct partition and index. This mapping function is called in get_instance() and isst_if_clos_assoc(), before indexing into tpmi_sst_struct->power_domain_info[]. The TPMI core platform info provides partition id and compute die ID mask for each partition. Use this information to order power domains, so that compute dies are presented before IO dies to match hardware defined compute die ID for each CPU. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reviewed-by: Zhang Rui <rui.zhang@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240423204619.3946901-8-srinivas.pandruvada@linux.intel.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86: ISST: Shorten the assignments for power_domain_infoSrinivas Pandruvada1-17/+16
Instead of long lines for assignment to tpmi_sst->power_domain_info, use a local variable pd_info and assign later. Also move the assignment of number of resources after the assignment of pd_info. No functional change is expected. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240423204619.3946901-7-srinivas.pandruvada@linux.intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86: ISST: Use local variable for auxdev->devSrinivas Pandruvada1-13/+14
Define a local variable for &auxdev->dev and use to shorten length of lines. No functional change is done. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240423204619.3946901-6-srinivas.pandruvada@linux.intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86/intel/tpmi: Add additional TPMI header fieldsSrinivas Pandruvada1-1/+14
TPMI information header added additional fields in version 2. Some of the reserved fields in version 1 are used to define new fields. Parse new fields and export as part of platform data. These fields include: - PCI segment ID - Partition ID of the package: If a package is represented by more than one PCI device, then partition ID along with cdie_mask, describes the scope. For example to update get/set properties for a compute die, one of the PCI MMIO region is selected from the partition ID. - cdie_mask: Mask of all compute dies in this partition. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Zhang Rui <rui.zhang@intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240423204619.3946901-5-srinivas.pandruvada@linux.intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86/intel/tpmi: Check major version change for TPMI InformationSrinivas Pandruvada1-4/+13
Check the major version from TPMI information header and fail to load driver if the version is not supported. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240423204619.3946901-3-srinivas.pandruvada@linux.intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86/intel/tpmi: Handle error from tpmi_process_info()Srinivas Pandruvada1-2/+5
When tpmi_process_info() returns error, fail to load the driver. This can happen if call to ioremap() returns error. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Cc: stable@vger.kernel.org # v6.3+ Link: https://lore.kernel.org/r/20240423204619.3946901-2-srinivas.pandruvada@linux.intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86: classmate-laptop: Add missing MODULE_DESCRIPTION()Andy Shevchenko1-2/+2
The modpost script is not happy WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/platform/x86/classmate-laptop.o because there is a missing module description. Add it to the module. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com> Link: https://lore.kernel.org/r/20240423161108.2636958-1-andriy.shevchenko@linux.intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86: Add lenovo-yoga-tab2-pro-1380-fastcharger driverHans de Goede3-0/+350
Add a new driver for the custom fast charging protocol found on Lenovo Yoga Tablet 2 1380F / 1380L models. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240422131649.46002-1-hdegoede@redhat.com
2024-04-29platform/x86: wmi: Add MSI WMI Platform driverArmin Wolf3-0/+440
Add a new driver for the MSI WMI Platform interface. The underlying ACPI WMI interface supports many features, but so far only reading of fan speed sensors is implemented. The driver was reverse-engineered based on a user request to the lm-sensors project, see the github issue for details. The ACPI WMI interface used by this driver seems to use the same embedded controller interface as the msi-ec driver, but supports automatic discovery of supported machines without relying on a DMI whitelist. The driver was tested by the user who created the github issue. Closes: https://github.com/lm-sensors/lm-sensors/issues/475 Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20240421191145.3189-1-W_Armin@gmx.de Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86: thinkpad_acpi: Use false to set acpi_send_ev to falseHans de Goede1-1/+1
acpi_send_ev is a bool and everywhere else true/false is used to set it. Replace the one instance using 0 with false. Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240429093446.130322-1-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Support hotkey to disable trackpoint doubletapMark Pearson1-1/+11
The hotkey combination Fn + G can be used to disable the trackpoint doubletap feature on Windows. Add matching functionality for Linux. Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Vishnu Sankar <vishnuocv@gmail.com> Link: https://lore.kernel.org/r/20240417173124.9953-4-mpearson-lenovo@squebb.ca [hdegoede@redhat.com: Adjust for switch to sparse-keymap keymaps] [hdegoede@redhat.com: Do not log unknown event msg for doubletap when disabled] Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-25-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Support for system debug info hotkeyMark Pearson1-0/+1
New Lenovo platforms are adding the FN+N key to generate system debug details that support can use for collecting important details on any customer cases for Windows. Add the infrastructure so we can do the same on Linux by sending a KEY_VENDOR keycode to userspace. Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Nitin Joshi <njoshi1@lenovo.com> Link: https://lore.kernel.org/r/20240417173124.9953-3-mpearson-lenovo@squebb.ca [hdegoede@redhat.com: Adjust for switch to sparse-keymap keymaps] Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-24-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Support for trackpoint doubletapMark Pearson1-0/+19
Lenovo trackpoints are adding the ability to generate a doubletap event. This handles the doubletap event and sends the KEY_PROG4 event to userspace. Despite the driver itself not using KEY_PROG1 - KEY_PROG3 this still uses KEY_PROG4 because of some keys being remapped to KEY_PROG1 - KEY_PROG3 by default by the upstream udev hwdb containing: evdev:name:ThinkPad Extra Buttons:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*:* ... KEYBOARD_KEY_17=prog1 KEYBOARD_KEY_1a=f20 # Microphone mute button KEYBOARD_KEY_45=bookmarks KEYBOARD_KEY_46=prog2 # Fn + PrtSc, on Windows: Snipping tool KEYBOARD_KEY_4a=prog3 # Fn + Right shift, on Windows: No idea Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Vishnu Sankar <vishnuocv@gmail.com> Link: https://lore.kernel.org/r/20240417173124.9953-2-mpearson-lenovo@squebb.ca [hdegoede@redhat.com: Adjust for switch to sparse-keymap keymaps] Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-23-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Simplify known_ev handlingMark Pearson1-6/+2
Modify how known_ev event is handled in preparation for adding new hkey event range. Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca> Link: https://lore.kernel.org/r/20240417173124.9953-1-mpearson-lenovo@squebb.ca Reviewed-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-22-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Add mappings for adaptive kbd clipping-tool and ↵Hans de Goede1-2/+2
cloud keys The X1 carbon 2014 / 2nd gen's adaptive keyboard top row's "Home" mode, which is 1 of the 2 modes Linux supports, has clipping-tool and cloud buttons which so far are not mapped. I assume these were left as KEY_RESERVED because no suitable KEY_FOO codes were available when support was added. In the mean time we have gotten KEY_SELECTIVE_SCREENSHOT and this has been used for the clipping-tool function under Fn + PrtSc on more traditional ThinkPad keyboards already. Finding a KEY_FOO code for the cloud key is harder looking at the symbol it seems to refer to cloud-storage which made me think of file syncing, or file transfer which has let me to pick KEY_XFER for this. Note this is based on looking at a picture of the adaptive top row in Home mode and has not been tested on an actual adaptive keyboard. Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-21-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Switch to using sparse-keymap helpersHans de Goede1-259/+145
Switch the hotkey keymap handling over to the sparse-keymap helpers, there should be no functional changes from this. Note all the mappings to KEY_UNKNOWN are removed since that is the default behavior of sparse_keymap_report_event() for unknown scancodes. Also drop the big comment about making changes to the keymaps since the contents of that comment are mostly obsolete. Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-20-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Drop KEY_RESERVED special handlingHans de Goede1-10/+8
The input core already filters out EV_KEY events for KEY_RESERVED, remove the check for this in tpacpi_input_send_key() and rely on the input core filtering instead. Also change tpacpi_input_send_key() to only report the scancode once instead of reporting it on both press and release. Together these 2 changes make tpacpi_input_send_key() behave the same as sparse_keymap_report_event(). The goal of this patch is to have a separate commit with the slightly different behavior from sparse_keymap_report_event() before switching over to using the sparse-keymap helpers. Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-19-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Use correct keycodes for volume and brightness keysHans de Goede1-24/+21
Change the default keymap to report the correct keycodes for the volume and brightness keys. Reporting key events for these is already filtered out by the hotkey_reserved_mask which masks these keys out of hotkey_user_mask at initialization time, so there is no need to also map them to KEY_RESERVED. This avoids users, who want these to be reported, having to also remap the keycodes on top of overriding hotkey_user_mask to report these and Linux userspace has already been overriding the KEY_RESERVED mappings with the correct keycodes through udev/hwdb/60-keyboard.hwdb for years now. Also drop hotkey_unmap() it was only used to dynamically map the brightness keys to KEY_RESERVED and after removing that it has no remaining users. Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-18-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Change hotkey_reserved_mask initializationHans de Goede1-6/+15
Change the hotkey_reserved_mask initialization to hardcode the list of reserved keys. There are only a few reserved keys and the code to iterate over the keymap will be removed when moving to sparse-keymaps. Note only the 32 original hotkeys are affected by the hotkey_*_mask values: if (i < sizeof(hotkey_reserved_mask)*8) hotkey_reserved_mask |= 1 << i; The (i < sizeof(hotkey_reserved_mask)*8) condition translates to (i < 32) so this code only ever set bits in hotkey_reserved_mask for the 32 original hotkeys. Therefor this patch does not set any bits in hotkey_reserved_mask for the KEY_RESERVED mappings for the adaptive keyboard scancodes. Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-17-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Do not send ACPI netlink events for unknown hotkeysHans de Goede1-3/+11
Do not send ACPI netlink events for unknown hotkeys, to avoid userspace starting to rely on them. Instead these should be added to the keymap to send evdev events. This should not cause a behavior change for existing laptop models since all currently known 0x1xxx events have a mapping. In hindsight the ACPI netlink events should have been suppressed for the adaptive keyboard and extended hotkeys events too. But the kernel has been sending ACPI netlink events for those for a long time now, so we cannot just stop sending them without potentially causing issues for existing users who may depend on these. Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-16-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Move tpacpi_driver_event() call to ↵Hans de Goede1-4/+3
tpacpi_input_send_key() All callers of tpacpi_input_send_key() first call tpacpi_driver_event(), move the tpacpi_driver_event() inside tpacpi_input_send_key() to avoid code duplication. For the original hotkey codes 0x1001 - 0x1020 tpacpi_driver_event() never returns true. So the added "return true;" inside tpacpi_input_send_key() never happens when called from tpacpi_hotkey_send_key() so behavior does not change. Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-15-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Move hkey > scancode mapping to ↵Hans de Goede1-59/+26
tpacpi_input_send_key() Move the mapping of hkey events to scancodes to tpacpi_input_send_key(), this results in a nice cleanup and prepares things for adding sparse-keymap support. Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-14-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Drop tpacpi_input_send_key_masked() and ↵Hans de Goede1-14/+2
hotkey_driver_event() Both are only 1 / 2 lines and both only have 1 caller fold the contents into tpacpi_hotkey_send_key() which is their single caller. Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-13-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Always call tpacpi_driver_event() for hotkeysHans de Goede1-7/+4
Call tpacpi_driver_event() at the top of hotkey_notify_hotkey() for all (orig / adaptive / extended) hotkey types, rather then having the orig code path call tpacpi_input_send_key_masked() which calls it through hotkey_driver_event() and having the adaptive / extended helpers call it separately. Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-12-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Move hotkey_user_mask check to ↵Hans de Goede1-2/+5
tpacpi_input_send_key() Move hotkey_user_mask check to tpacpi_input_send_key(), this is a preparation patch for further refactoring. Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-11-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Move special original hotkeys handling out of ↵Hans de Goede1-4/+10
switch-case Move the special handling (send_acpi_ev = false, hotkey_source_mask check) for original hotkeys out of the switch-case in hotkey_notify_hotkey(). This is a preparation patch for further refactoring. Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-10-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Move adaptive kbd event handling to ↵Hans de Goede1-35/+41
tpacpi_driver_event() Factor out the adaptive kbd non hotkey event handling into adaptive_keyboard_change_row() and adaptive_keyboard_s_quickview_row() helpers and move the handling of TP_HKEY_EV_DFR_CHANGE_ROW and TP_HKEY_EV_DFR_S_QUICKVIEW_ROW to tpacpi_driver_event(). This groups all the handling of hotkey events which do not emit a key press event together in tpacpi_driver_event(). This also drops the returning of false as known-event value when adaptive_keyboard_get_mode() / adaptive_keyboard_set_mode() fail. These functions already log an error on failure, returning false just leads to an extra messgae being logged about the hkey event being unknown, which is wrong as the event is not unknown. Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-9-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Make tpacpi_driver_event() return if it handled ↵Hans de Goede1-54/+61
the event tpacpi_driver_event() already only responds to hkey events which it knows about. Make it return a bool and return true when it has handled the event. This avoids the need to list TP_HKEY_EV_foo values to which it responds both in its caller and in the function itself. Instead callers can now call it unconditionally and check the return value. Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-8-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Do hkey to scancode translation laterHans de Goede1-35/+36
Modify hotkey_notify_hotkey() and it helpers to mostly directly operate on hkey codes (TP_HKEY_EV_* returned by "MHKP") instead of on the 0 - TPACPI_HOTKEY_MAP_LEN scancodes used for scancode -> keycode translation. Keeping things in the hkey format as long a possible is a bit cleaner and this patch prepares things for moving to sparse-keymaps. Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-7-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Use tpacpi_input_send_key() in adaptive kbd codeHans de Goede1-14/+2
Use tpacpi_input_send_key() in adaptive_keyboard_hotkey_notify_hotkey() instead of re-implementing it there. Note this change will also result in a behavioral change, key presses on the adaptive keyboard will now also send a EV_MSC event with the scancode, just like all other hotkey presses already do. This is not a bug but a feature. Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Link: https://lore.kernel.org/r/20240424122834.19801-6-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Drop ignore_acpi_evHans de Goede1-39/+17
Setting ignore_acpi_ev to true has the same result as setting send_acpi_ev to false, so there is no need to have both. Drop ignore_acpi_ev. Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-5-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Drop setting send_/ignore_acpi_ev defaults twiceHans de Goede1-19/+5
send_acpi_ev and ignore_acpi_ev are already initialized to true and false respectively by hotkey_notify() before calling the various helpers. Drop the needless re-initialization from the helpers. Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Link: https://lore.kernel.org/r/20240424122834.19801-4-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Provide hotkey_poll_stop_sync() dummyHans de Goede1-2/+3
Provide a hotkey_poll_stop_sync() dummy implementation when CONFIG_THINKPAD_ACPI_HOTKEY_POLL, so that the #ifdef-ery around hotkey_poll_stop_sync() can be removed from hotkey_exit(). Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-3-hdegoede@redhat.com
2024-04-29platform/x86: thinkpad_acpi: Take hotkey_mutex during hotkey_exit()Hans de Goede1-2/+3
hotkey_exit() already takes the mutex around the hotkey_poll_stop_sync() call, but not around the other calls. commit 38831eaf7d4c ("platform/x86: thinkpad_acpi: use lockdep annotations") has added lockdep_assert_held() checks to various hotkey functions. These lockdep_assert_held() checks fail causing WARN() backtraces in dmesg due to missing locking in hotkey_exit(), fix this. Fixes: 38831eaf7d4c ("platform/x86: thinkpad_acpi: use lockdep annotations") Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240424122834.19801-2-hdegoede@redhat.com
2024-04-29platform/x86: asus-laptop: Use sysfs_emit() and sysfs_emit_at() to replace ↵yunshui1-22/+22
sprintf() As Documentation/filesystems/sysfs.rst suggested, show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: yunshui <jiangyunshui@kylinos.cn> Reviewed-by: Ai Chao <aichao@kylinos.cn> Link: https://lore.kernel.org/r/20240422062915.3393480-1-jiangyunshui@kylinos.cn Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86: samsung-laptop: Use sysfs_emit() to replace the old interface ↵yunshui1-5/+5
sprintf() As Documentation/filesystems/sysfs.rst suggested, show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: yunshui <jiangyunshui@kylinos.cn> Reviewed-by: Ai Chao <aichao@kylinos.cn> Link: https://lore.kernel.org/r/20240419064106.2396705-1-jiangyunshui@kylinos.cn Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-04-29platform/x86: msi-laptop: Use sysfs_emit() to replace sprintf()yunshui1-10/+10
As Documentation/filesystems/sysfs.rst suggested, show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: yunshui <jiangyunshui@kylinos.cn> Reviewed-by: Ai Chao <aichao@kylinos.cn> Link: https://lore.kernel.org/r/20240419063649.2396461-1-jiangyunshui@kylinos.cn Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>