aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-05-14platform/x86: Add new Dell UART backlight driverHans de Goede3-0/+414
Dell All In One (AIO) models released after 2017 use a backlight controller board connected to an UART. In DSDT this uart port will be defined as: Name (_HID, "DELL0501") Name (_CID, EisaId ("PNP0501") Instead of having a separate ACPI device with an UartSerialBusV2() resource to model the backlight-controller, which would be the standard way to do this. The acpi_quirk_skip_serdev_enumeration() has special handling for this and it will make the serial port code create a serdev controller device for the UART instead of a /dev/ttyS0 char-dev. It will also create a dell-uart-backlight driver platform device for this driver to bind too. This new kernel module contains 2 drivers for this: 1. A simple platform driver which creates the actual serdev device (with the serdev controller device as parent) 2. A serdev driver for the created serdev device which exports the backlight functionality uses a standard backlight class device. Reported-by: Roman Bogoyev <[email protected]> Tested-by: Roman Bogoyev <[email protected]> Tested-by: Kai-Heng Feng <[email protected]> Co-developed-by: AceLan Kao <[email protected]> Signed-off-by: AceLan Kao <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2024-05-14platform/x86: x86-android-tablets: Create LED device for Xiaomi Pad 2 bottom ↵Hans de Goede1-0/+47
bezel touch buttons The Xiaomi [Mi]Pad 2 has 3 menu / home / back capacitive touch-buttons on its bottom bezel. These are backlit by LEDs attached to a TPS61158 LED controller which is controlled by the "pwm_soc_lpss_2" PWM output. Create a LED class device for this, using the new input-events trigger as default trigger so that the buttons automatically light up on any input activity. Note alternatively a "leds_pwm" platform device could be created together with the necessary fwnode_s_ and a fwnode link to the PWM controller. There are 2 downsides to this approach: 1. The code would still need to pwm_get() the PWM controller to get/attach a fwnode for the PWM controller fwnode link and setting up the necessary fwnodes is non-trivial. So this would likely require more code then simply registering the LED class device directly. 2. Currently the leds_pwm driver and its devicetree bindings do not support limiting the maximum dutycycle to less then 100% which is required in this case (the leds_pwm driver can probably be extended to allow this). Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Co-developed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
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 <[email protected]> Acked-by: Andy Shevchenko <[email protected]> Tested-by: Klara Modin <[email protected]> Reviewed-by: Shin'ichiro Kawasaki <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
2024-05-14platform/surface: aggregator: Log critical errors during SAM probingWeifeng Liu1-14/+28
Emits messages upon errors during probing of SAM. Hopefully this could provide useful context to user for the purpose of diagnosis when something miserable happen. Reviewed-by: Maximilian Luz <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Weifeng Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
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 <[email protected]> Reviewed-by: Zhang Rui <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Jonathan Woithe <[email protected]> Reviewed-by: Kuppuswamy Sathyanarayanan <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
2024-04-29tools/power/x86/intel-speed-select: v1.19 releaseSrinivas Pandruvada1-1/+1
This version addresses issues with: - Support of SST BF/TF support per level - Increase number of CPUs displayed - Present all TRL levels for turbo-freq - Fix display for unsupported levels - Support multiple dies - Increase die count - Change CPU display for non compute domain Signed-off-by: Srinivas Pandruvada <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
2024-04-29tools/power/x86/intel-speed-select: Display CPU as None for -1Srinivas Pandruvada1-5/+17
When there is no CPU in a power domain, display "None" instead of -1. Signed-off-by: Srinivas Pandruvada <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
2024-04-29tools/power/x86/intel-speed-select: SST BF/TF support per levelSrinivas Pandruvada3-3/+10
SST BF and TF can be enabled/disabled per level. So check the current level support from the mask of supported levels. This change from a single level to mask for info.sst_tf_support and info.sst_tf_support is indicated by API version change. Use as mask for API version above 2. In this way there is no change in behavior when running on older kernel with API version 2. Since the tool can support now API version 3, update the supported API version. Signed-off-by: Srinivas Pandruvada <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
2024-04-29tools/power/x86/intel-speed-select: Increase number of CPUs displayedSrinivas Pandruvada1-4/+4
Currently max 128 CPUs can be displayed in the enable CPU list. Double the range. Since the size is big for stack allocation, change to static. Here changing to static is fine as these functions are called in serial. Signed-off-by: Srinivas Pandruvada <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
2024-04-29tools/power/x86/intel-speed-select: Present all TRL levels for turbo-freqSrinivas Pandruvada1-1/+2
For turbo-freq feature, only 3 levels of frequencies are displayed even if platform support more. Present all levels based on the CPU model. Signed-off-by: Srinivas Pandruvada <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
2024-04-29tools/power/x86/intel-speed-select: Fix display for unsupported levelsSrinivas Pandruvada1-0/+1
During call to "intel-speed-select turbo-freq info" some junk values are reported for unsupported levels. Initialize the structure fact_info with 0s, so that isst_fact_display_information() will skip "0" values in the frequency. Signed-off-by: Srinivas Pandruvada <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
2024-04-29tools/power/x86/intel-speed-select: Support multiple diesSrinivas Pandruvada1-0/+20
When the die id is same as punit compute die ID, treat them same. In this case, when for_each_online_power_domain_in_set() is called, then don't loop for each punit in a die. Just loop for all punits in a package. Signed-off-by: Srinivas Pandruvada <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
2024-04-29tools/power/x86/intel-speed-select: Increase die countSrinivas Pandruvada1-1/+1
TPMI platform information supports up to 16 compute dies. So increase the range. Signed-off-by: Srinivas Pandruvada <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
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 <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
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 <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
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 <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
2024-04-29platform/x86: ISST: Add missing MODULE_DESCRIPTIONSrinivas Pandruvada2-0/+2
Add missing MODULE_DESCRIPTION() to ISST modules. Signed-off-by: Srinivas Pandruvada <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
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 <[email protected]> Suggested-by: Andy Shevchenko <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
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 <[email protected]> Suggested-by: Andy Shevchenko <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
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 <[email protected]> Reviewed-by: Zhang Rui <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
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 <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
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 <[email protected]> Suggested-by: Andy Shevchenko <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
2024-04-29platform/x86/intel/tpmi: Add additional TPMI header fieldsSrinivas Pandruvada2-1/+20
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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Zhang Rui <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
2024-04-29platform/x86/intel/tpmi: Align comments in kernel-docSrinivas Pandruvada1-3/+3
Align comments in kernel-doc for the struct intel_tpmi_plat_info. Signed-off-by: Srinivas Pandruvada <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
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 <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
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 <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Cc: [email protected] # v6.3+ Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
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 <[email protected]> Acked-by: Thadeu Lima de Souza Cascardo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
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 <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2024-04-29platform/x86: wmi: Add MSI WMI Platform driverArmin Wolf6-0/+656
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
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 <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Signed-off-by: Vishnu Sankar <[email protected]> Link: https://lore.kernel.org/r/[email protected] [[email protected]: Adjust for switch to sparse-keymap keymaps] [[email protected]: Do not log unknown event msg for doubletap when disabled] Tested-by: Mark Pearson <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Signed-off-by: Nitin Joshi <[email protected]> Link: https://lore.kernel.org/r/[email protected] [[email protected]: Adjust for switch to sparse-keymap keymaps] Tested-by: Mark Pearson <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Signed-off-by: Vishnu Sankar <[email protected]> Link: https://lore.kernel.org/r/[email protected] [[email protected]: Adjust for switch to sparse-keymap keymaps] Tested-by: Mark Pearson <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Tested-by: Mark Pearson <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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 <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Mark Pearson <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected]