aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-02-02platform/x86: thinkpad_acpi: fixed warning and incorporated review commentsNitin Joshi2-29/+19
The previous commit adding new sysfs for keyboard language has warning and few code correction has to be done as per new review comments. Below changes has been addressed in this version: - corrected warning. Many thanks to kernel test robot <[email protected]> for reporting and determining this warning. - used sysfs_emit_at() API instead of strcat. - sorted keyboard language array. - removed unwanted space and corrected sentences. Reported-by: kernel test robot <[email protected]> Signed-off-by: Nitin Joshi <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-02-02platform/x86: thinkpad_acpi: rectify length of title underlineLukas Bulwahn1-1/+1
Commit d7cbe2773aed ("platform/x86: thinkpad_acpi: set keyboard language") adds information on keyboard setting to the thinkpad documentation, but made the subsection title underline too short. Hence, make htmldocs warns: Documentation/admin-guide/laptops/thinkpad-acpi.rst:1472: \ WARNING: Title underline too short. Rectify length of subsection title underline. Signed-off-by: Lukas Bulwahn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-02-02platform/x86: thinkpad_acpi: Don't register keyboard_lang unnecessarilyHans de Goede1-0/+7
All recent ThinkPad BIOS-es support the GSKL method used to query the keyboard-layout used by the ECFW for the SHIFT + other-key key-press emulation for special keys such as e.g. the '=', '(' and ')' keys above the numpad on 15" models. So just checking for the method is not a good indicator of the model supporting getting/setting the keyboard_lang. On models where this is not supported GSKL succeeds, but it returns METHOD_ERR in the returned integer to indicate that this is not supported on this model. Add a check for METHOD_ERR and return -ENODEV if it is set to avoid registering a non-working keyboard_lang sysfs-attr on models where this is not supported. Cc: Nitin Joshi <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2021-01-31platform/x86: dell-wmi-sysman: fix a NULL pointer dereferenceMario Limonciello1-1/+5
An upcoming Dell platform is causing a NULL pointer dereference in dell-wmi-sysman initialization. Validate that the input from BIOS matches correct ACPI types and abort module initialization if it fails. Signed-off-by: Mario Limonciello <[email protected]> Tested-by: Perry Yuan <[email protected]> Link: https://lore.kernel.org/r/[email protected] [[email protected]: Drop redundant release_attributes_data() call] Signed-off-by: Hans de Goede <[email protected]>
2021-01-27ACPI: platform-profile: Fix possible deadlock in platform_profile_remove()Hans de Goede1-6/+2
After a rmmod thinkpad_acpi, lockdep pointed out this possible deadlock: Our _show and _store sysfs attr functions get called with the kn->active lock held for the sysfs attr and then take the profile_lock. sysfs_remove_group() also takes the kn->active lock for the sysfs attr, so if we call it with the profile_lock held, then we get an ABBA deadlock. platform_profile_remove() must only be called by drivers which have first *successfully* called platform_profile_register(). Anything else is a driver bug. So the check for cur_profile being set before calling sysfs_remove_group() is not necessary and it can be dropped. It is safe to call sysfs_remove_group() without holding the profile_lock since the attr-group group cannot be re-added until after we clear cur_profile. Change platform_profile_remove() to only hold the profile_lock while clearing the cur_profile, fixing the deadlock. Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2021-01-27ACPI: platform-profile: Introduce object pointers to callbacksJiaxun Yang2-4/+6
Add an object pointer to handler callbacks to avoid the need for drivers to have a global variable to get to their driver-data struct. Link: https://lore.kernel.org/linux-acpi/[email protected]/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jiaxun Yang <[email protected]> Suggested-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2021-01-25platform/x86: thinkpad_acpi: set keyboard languageNitin Joshi2-0/+205
This patch is to create sysfs entry for setting keyboard language using ASL method. Some thinkpads models like T580 , T590 , T15 Gen 1 etc. has "=", "(',")" numeric keys, which are not displaying correctly, when keyboard language is other than "english". This patch fixes this issue by setting keyboard language to ECFW. Signed-off-by: Nitin Joshi <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-25platform/x86: intel_mid_powerbtn: Remove driver for deprecated platformAndy Shevchenko3-242/+0
Intel Moorestown and Medfield are quite old Intel Atom based 32-bit platforms, which were in limited use in some Android phones, tablets and consumer electronics more than eight years ago. There are no bugs or problems ever reported outside from Intel for breaking any of that platforms for years. It seems no real users exists who run a more or less fresh kernel on it. Commit 05f4434bc130 ("ASoC: Intel: remove mfld_machine") which has been upstream for a while now confirms this theory. Due to above and to reduce a burden of supporting outdated drivers we remove the support of outdated platforms completely. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Acked-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-25platform/x86: intel_mid_thermal: Remove driver for deprecated platformAndy Shevchenko3-568/+0
Intel Moorestown and Medfield are quite old Intel Atom based 32-bit platforms, which were in limited use in some Android phones, tablets and consumer electronics more than eight years ago. There are no bugs or problems ever reported outside from Intel for breaking any of that platforms for years. It seems no real users exists who run a more or less fresh kernel on it. Commit 05f4434bc130 ("ASoC: Intel: remove mfld_machine") which has been upstream for a while now confirms this theory. Due to above and to reduce a burden of supporting outdated drivers we remove the support of outdated platforms completely. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Acked-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-25platform/x86: hp-wmi: Disable tablet-mode reporting by defaultHans de Goede1-4/+10
Recently userspace has started making more use of SW_TABLET_MODE (when an input-dev reports this). Specifically recent GNOME3 versions will: 1. When SW_TABLET_MODE is reported and is reporting 0: 1.1 Disable accelerometer-based screen auto-rotation 1.2 Disable automatically showing the on-screen keyboard when a text-input field is focussed 2. When SW_TABLET_MODE is reported and is reporting 1: 2.1 Ignore input-events from the builtin keyboard and touchpad (this is for 360° hinges style 2-in-1s where the keyboard and touchpads are accessible on the back of the tablet when folded into tablet-mode) This means that claiming to support SW_TABLET_MODE when it does not actually work / reports correct values has bad side-effects. The check in the hp-wmi code which is used to decide if the input-dev should claim SW_TABLET_MODE support, only checks if the HPWMI_HARDWARE_QUERY is supported. It does *not* check if the hardware actually is capable of reporting SW_TABLET_MODE. This leads to the hp-wmi input-dev claiming SW_TABLET_MODE support, while in reality it will always report 0 as SW_TABLET_MODE value. This has been seen on a "HP ENVY x360 Convertible 15-cp0xxx" and this likely is the case on a whole lot of other HP models. This problem causes both auto-rotation and on-screen keyboard support to not work on affected x360 models. There is no easy fix for this, but since userspace expects SW_TABLET_MODE reporting to be reliable when advertised it is better to not claim/report SW_TABLET_MODE support at all, then to claim to support it while it does not work. To avoid the mentioned problems, add a new enable_tablet_mode_sw module-parameter which defaults to false. Note I've made this an int using the standard -1=auto, 0=off, 1=on triplett, with the hope that in the future we can come up with a better way to detect SW_TABLET_MODE support. ATM the default auto option just does the same as off. BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1918255 Cc: Stefan Brüns <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Acked-by: Mark Gross <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2021-01-25platform/x86: intel-vbtn: Eval VBDL after registering our notifierHans de Goede1-9/+7
The VBDL ACPI method enables button/switch reporting through the intel-vbtn device. In some cases the embedded-controller (EC) might call Notify() on the intel-vbtn device immediately after the the VBDL call to make sure that the OS is synced with the EC's button and switch state. If we register our notify_handler after evaluating VBDL this means that we might miss the Notify() calls made by the EC to sync the state. E.g. the HP Stream x360 Convertible PC 11 has a VGBS method which always returns 0, independent of the actual SW_TABLET_MODE state of the device; and immediately after the VBDL call it calls Notify(0xCD) or Notify(0xCC) to report the actual state. Move the evaluation of VBDL to after registering our notify_handler so that we don't miss any events. Cc: Elia Devito <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2021-01-25platform/x86: intel-vbtn: Add alternative method to enable switchesHans de Goede1-2/+7
Some 2-in-1s have a broken VGBS method, so we cannot get an initial state for the switches from them. Reporting the wrong initial state for SW_TABLET_MODE causes serious problems (touchpad and/or keyboard events being ignored by userspace when reporting SW_TABLET_MODE=1), so on these devices we cannot register an input-dev for the switches at probe time. We can however register an input-dev for the switches as soon as we receive the first switches event, because then we will know the state. Note this mirrors the behavior of recent changs to the intel-hid driver which also registers a separate switches input-dev on receiving the first event on machines with a broken VGBS method. Cc: Elia Devito <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2021-01-25platform/x86: intel-vbtn: Create 2 separate input-devs for buttons and switchesHans de Goede1-36/+62
Create 2 separate input-devs for buttons and switches, this is a preparation for dynamically registering the switches-input device for devices which are not on the switches allow-list, but do make Notify() calls with an event value from the switches sparse-keymap. This also brings the intel-vbtn driver inline with the intel-hid driver which is doing the same thing. Cc: Elia Devito <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2021-01-25platform/x86: intel-vbtn: Rework wakeup handling in notify_handler()Hans de Goede1-15/+10
Rework the wakeup path inside notify_handler() to special case the buttons (KE_KEY) case instead of the switches case. In case of a button wake event we want to skip reporting this, mirroring how the drivers/acpi/button.c code skips the reporting in the wakeup case (suspended flag set) too. The reason to skip reporting in this case is that some Linux desktop-environments will immediately resuspend if we report an evdev event for the power-button press on wakeup. Before this commit the skipping of the button-press was done in a round-about way: In case of a wakeup the regular sparse_keymap_report_event() would always be skipped by an early return, and then to avoid not reporting switch changes on wakeup there was a special KE_SW path with a duplicate sparse_keymap_report_event() call. This commit refactors the wakeup handling to explicitly skip the reporting for button wake events, while using the regular reporting path for non button (switches) wakeup events. No intentional functional impact. Cc: Elia Devito <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2021-01-25platform/x86: intel_scu_wdt: Get rid of custom x86 model comparisonAndy Shevchenko1-2/+12
Switch the platform code to use x86_id_table and accompanying API instead of custom comparison against x86 CPU model. This is one of the last users of custom API for that and following changes will remove it for the good. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Guenter Roeck <[email protected]>
2021-01-25platform/x86: intel_scu_wdt: Drop SCU notificationAndy Shevchenko1-24/+7
Since SCU code along with the Intel MID watchdog driver has been refactored in a way that latter will be probed only after the former has been come to live, the notification code is bogus and not needed. Remove it for good. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Acked-by: Linus Walleij <[email protected]>
2021-01-25platform/x86: intel_scu_wdt: Move driver from arch/x86Andy Shevchenko4-1/+9
The ACPI-enabled Intel MID platforms neither have WDAT table nor proper IDs to instantiate watchdog device. In order to keep them working move the board code from arch/x86 to drivers/platform/x86. Note, the complete SFI support is going to be removed, that's why PDx86 has been chosen as a new home for it. This is the only device which needs additional code so far. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Acked-by: Linus Walleij <[email protected]>
2021-01-25watchdog: intel-mid_wdt: Postpone IRQ handler registration till SCU is readyAndy Shevchenko1-4/+4
When SCU is not ready and CONFIG_DEBUG_SHIRQ=y we got deferred probe followed by fired test IRQ which immediately makes kernel panic. Fix this by delaying IRQ handler registration till SCU is ready. Fixes: 80ae679b8f86 ("watchdog: intel-mid_wdt: Convert to use new SCU IPC API") Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Acked-by: Linus Walleij <[email protected]> Reviewed-by: Mika Westerberg <[email protected]>
2021-01-25watchdog: intel_scu_watchdog: Remove driver for deprecated platformAndy Shevchenko4-593/+0
Intel Moorestown and Medfield are quite old Intel Atom based 32-bit platforms, which were in limited use in some Android phones, tablets and consumer electronics more than eight years ago. There are no bugs or problems ever reported outside from Intel for breaking any of that platforms for years. It seems no real users exists who run more or less fresh kernel on it. The commit 05f4434bc130 ("ASoC: Intel: remove mfld_machine") also in align with this theory. Due to above and to reduce a burden of supporting outdated drivers we remove the support of outdated platforms completely. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Acked-by: Linus Walleij <[email protected]>
2021-01-25rtc: mrst: Remove driver for deprecated platformAndy Shevchenko3-534/+0
Intel Moorestown and Medfield are quite old Intel Atom based 32-bit platforms, which were in limited use in some Android phones, tablets and consumer electronics more than eight years ago. There are no bugs or problems ever reported outside from Intel for breaking any of that platforms for years. It seems no real users exists who run more or less fresh kernel on it. The commit 05f4434bc130 ("ASoC: Intel: remove mfld_machine") also in align with this theory. Due to above and to reduce a burden of supporting outdated drivers we remove the support of outdated platforms completely. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Alexandre Belloni <[email protected]> Acked-by: Linus Walleij <[email protected]>
2021-01-25platform/x86: intel_mid_powerbtn: Remove driver for deprecated platformAndy Shevchenko3-242/+0
Intel Moorestown and Medfield are quite old Intel Atom based 32-bit platforms, which were in limited use in some Android phones, tablets and consumer electronics more than eight years ago. There are no bugs or problems ever reported outside from Intel for breaking any of that platforms for years. It seems no real users exists who run more or less fresh kernel on it. The commit 05f4434bc130 ("ASoC: Intel: remove mfld_machine") also in align with this theory. Due to above and to reduce a burden of supporting outdated drivers we remove the support of outdated platforms completely. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Acked-by: Linus Walleij <[email protected]>
2021-01-25platform/x86: intel_mid_thermal: Remove driver for deprecated platformAndy Shevchenko3-568/+0
Intel Moorestown and Medfield are quite old Intel Atom based 32-bit platforms, which were in limited use in some Android phones, tablets and consumer electronics more than eight years ago. There are no bugs or problems ever reported outside from Intel for breaking any of that platforms for years. It seems no real users exists who run more or less fresh kernel on it. The commit 05f4434bc130 ("ASoC: Intel: remove mfld_machine") also in align with this theory. Due to above and to reduce a burden of supporting outdated drivers we remove the support of outdated platforms completely. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Acked-by: Linus Walleij <[email protected]>
2021-01-25gpio: msic: Remove driver for deprecated platformAndy Shevchenko3-322/+0
Intel Moorestown and Medfield are quite old Intel Atom based 32-bit platforms, which were in limited use in some Android phones, tablets and consumer electronics more than eight years ago. There are no bugs or problems ever reported outside from Intel for breaking any of that platforms for years. It seems no real users exists who run more or less fresh kernel on it. The commit 05f4434bc130 ("ASoC: Intel: remove mfld_machine") also in align with this theory. Due to above and to reduce a burden of supporting outdated drivers we remove the support of outdated platforms completely. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Linus Walleij <[email protected]>
2021-01-25gpio: intel-mid: Remove driver for deprecated platformAndy Shevchenko5-424/+1
Intel Moorestown and Medfield are quite old Intel Atom based 32-bit platforms, which were in limited use in some Android phones, tablets and consumer electronics more than eight years ago. There are no bugs or problems ever reported outside from Intel for breaking any of that platforms for years. It seems no real users exists who run more or less fresh kernel on it. The commit 05f4434bc130 ("ASoC: Intel: remove mfld_machine") also in align with this theory. Due to above and to reduce a burden of supporting outdated drivers we remove the support of outdated platforms completely. Moreover this code duplicates gpio-pxa since the IP has been derived from XScale implementation. If anybody wants to resurrect this it has to be part of gpio-pxa.c. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Linus Walleij <[email protected]>
2021-01-25drm/gma500: Get rid of duplicate NULL checksAndy Shevchenko1-12/+6
Since GPIOs are optional we don't need to repeat checks that are done in the GPIO API. Remove them for good. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Patrik Jakobsson <[email protected]> Acked-by: Linus Walleij <[email protected]>
2021-01-25drm/gma500: Convert to use new SCU IPC APIAndy Shevchenko7-14/+17
Convert the GMA500 driver to use the new SCU IPC API. This allows us to get rid of the duplicate PMC IPC implementation which is now covered in SCU IPC driver. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Patrik Jakobsson <[email protected]> Acked-by: Linus Walleij <[email protected]>
2021-01-25ACPI: platform-profile: Drop const qualifier for cur_profileJiaxun Yang2-3/+3
Drop the const qualifier from the static global cur_profile pointer declaration. This is a preparation patch for passing the cur_profile pointer as parameter to the profile_get() and profile_set() callbacks so that drivers dynamically allocating their driver-data struct, with their platform_profile_handler struct embedded, can use this pointer to get to their driver-data. Note this also requires dropping the const from the pprof platform_profile_register() function argument. Dropping this const is not a problem, non of the queued up consumers of platform_profile_register() actually pass in a const pointer. Link: https://lore.kernel.org/linux-acpi/[email protected]/ Link: https://lore.kernel.org/r/[email protected] Suggested-by: Hans de Goede <[email protected]> Signed-off-by: Jiaxun Yang <[email protected]> [ [email protected]: Also remove const from platform_profile_register() ] Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2021-01-18sony-laptop: Remove unneeded semicolonYue Zou1-1/+1
Remove a superfluous semicolon after function definition. Signed-off-by: Yue Zou <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-18platform/x86: thinkpad_acpi: Add P53/73 firmware to fan_quirk_table for dual ↵Jeannie Stevenson1-0/+1
fan control This commit enables dual fan control for the new Lenovo P53 and P73 laptop models. Signed-off-by: Jeannie Stevenson <[email protected]> Link: https://lore.kernel.org/r/Pn_Xii4XYpQRFtgkf4PbNgieE89BAkHgLI1kWIq-zFudwh2A1DY5J_DJVHK06rMW_hGPHx_mPE33gd8mg9-8BxqJTaSC6hhPqAsfZlcNGH0=@protonmail.com Signed-off-by: Hans de Goede <[email protected]>
2021-01-18MAINTAINERS: update email address for Henrique de Moraes HolschuhHenrique de Moraes Holschuh1-1/+1
Update my email address in MAINTAINERS to the one I have been using for commits, Signed-off-by and Acked-by tags. Only two ancient commits had the old [email protected], so it is unlikely to justify a .mailmap entry. Note that [email protected] does work as a way to contact me, but apparently it is best when MAINTAINERS entries match commit email addresses ;-) Signed-off-by: Henrique de Moraes Holschuh <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-18platform/x86: hp-wmi: Don't log a warning on HPWMI_RET_UNKNOWN_COMMAND errorsHans de Goede1-1/+2
The recently added thermal policy support makes a hp_wmi_perform_query(0x4c, ...) call on older devices which do not support thermal policies this causes the following warning to be logged (seen on a HP Stream x360 Convertible PC 11): [ 26.805305] hp_wmi: query 0x4c returned error 0x3 Error 0x3 is HPWMI_RET_UNKNOWN_COMMAND error. This commit silences the warning for unknown-command errors, silencing the new warning. Cc: Elia Devito <[email protected]> Fixes: 81c93798ef3e ("platform/x86: hp-wmi: add support for thermal policy") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-18platform/x86: intel-vbtn: Drop HP Stream x360 Convertible PC 11 from allow-listHans de Goede1-6/+0
THe HP Stream x360 Convertible PC 11 DSDT has the following VGBS function: Method (VGBS, 0, Serialized) { If ((^^PCI0.LPCB.EC0.ROLS == Zero)) { VBDS = Zero } Else { VBDS = Zero } Return (VBDS) /* \_SB_.VGBI.VBDS */ } Which is obviously wrong, because it always returns 0 independent of the 2-in-1 being in laptop or tablet mode. This causes the intel-vbtn driver to initially report SW_TABLET_MODE = 1 to userspace, which is known to cause problems when the 2-in-1 is actually in laptop mode. During earlier testing this turned out to not be a problem because the 2-in-1 would do a Notify(..., 0xCC) or Notify(..., 0xCD) soon after the intel-vbtn driver loaded, correcting the SW_TABLET_MODE state. Further testing however has shown that this Notify() soon after the intel-vbtn driver loads, does not always happen. When the Notify does not happen, then intel-vbtn reports SW_TABLET_MODE = 1 resulting in a non-working touchpad. IOW the tablet-mode reporting is not reliable on this device, so it should be dropped from the allow-list, fixing the touchpad sometimes not working. Fixes: 8169bd3e6e19 ("platform/x86: intel-vbtn: Switch to an allow-list for SW_TABLET_MODE reporting") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-18platform/surface: aggregator: Fix kernel-doc referencesMaximilian Luz1-3/+2
Both, ssh_rtl_rx_start() and ssh_rtl_tx_start() functions, do not exist and have been consolidated into ssh_rtl_start(). Nevertheless, kernel-doc references the former functions. Replace those references with references to ssh_rtl_start(). Signed-off-by: Maximilian Luz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-18platform/surface: aggregator: fix a kernel-doc markupMauro Carvalho Chehab1-1/+1
A function has a different name between their prototype and its kernel-doc markup: ../drivers/platform/surface/aggregator/ssh_request_layer.c:1065: warning: expecting prototype for ssh_rtl_tx_start(). Prototype was for ssh_rtl_start() instead Signed-off-by: Mauro Carvalho Chehab <[email protected]> Reviewed-by: Maximilian Luz <[email protected]> Link: https://lore.kernel.org/r/4a6bf33cfbd06654d78294127f2b6d354d073089.1610610937.git.mchehab+huawei@kernel.org Signed-off-by: Hans de Goede <[email protected]>
2021-01-13platform/surface: aggregator_cdev: Add comments regarding unchecked ↵Maximilian Luz1-0/+19
allocation size CI static analysis complains about the allocation size in payload and response buffers being unchecked. In general, these allocations should be safe as the user-input is u16 and thus limited to U16_MAX, which is only slightly larger than the theoretical maximum imposed by the underlying SSH protocol. All bounds on these values required by the underlying protocol are enforced in ssam_request_sync() (or rather the functions called by it), thus bounds here are only relevant for allocation. Add comments explaining that this should be safe. Reported-by: Colin Ian King <[email protected]> Fixes: 178f6ab77e61 ("platform/surface: Add Surface Aggregator user-space interface") Addresses-Coverity: ("Untrusted allocation size") Signed-off-by: Maximilian Luz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-13platform/surface: aggregator_cdev: Fix access of uninitialized variablesMaximilian Luz1-2/+2
When copy_struct_from_user() in ssam_cdev_request() fails, we directly jump to the 'out' label. In this case, however 'spec' and 'rsp' are not initialized, but we still access fields of those variables. Fix this by initializing them at the time of their declaration. Reported-by: Colin Ian King <[email protected]> Fixes: 178f6ab77e61 ("platform/surface: Add Surface Aggregator user-space interface") Addresses-Coverity: ("Uninitialized pointer read") Signed-off-by: Maximilian Luz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-13platform/surface: fix potential integer overflow on shift of a intColin Ian King1-1/+1
The left shift of int 32 bit integer constant 1 is evaluated using 32 bit arithmetic and then passed as a 64 bit function argument. In the case where func is 32 or more this can lead to an oveflow. Avoid this by shifting using the BIT_ULL macro instead. Addresses-Coverity: ("Unintentional integer overflow") Fixes: fc00bc8ac1da ("platform/surface: Add Surface ACPI Notify driver") Signed-off-by: Colin Ian King <[email protected]> Reviewed-by: Maximilian Luz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-13platform/x86: ideapad-laptop: Disable touchpad_switch for ELAN0634Jiaxun Yang1-1/+14
Newer ideapads (e.g.: Yoga 14s, 720S 14) come with ELAN0634 touchpad do not use EC to switch touchpad. Reading VPCCMD_R_TOUCHPAD will return zero thus touchpad may be blocked unexpectedly. Writing VPCCMD_W_TOUCHPAD may cause a spurious key press. Add has_touchpad_switch to workaround these machines. Signed-off-by: Jiaxun Yang <[email protected]> Cc: [email protected] # 5.4+ -- v2: Specify touchpad to ELAN0634 v3: Stupid missing ! in v2 v4: Correct acpi_dev_present usage (Hans) Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-07platform/surface: Add Surface ACPI Notify driverMaximilian Luz7-0/+992
The Surface ACPI Notify (SAN) device provides an ACPI interface to the Surface Aggregator EC, specifically the Surface Serial Hub interface. This interface allows EC requests to be made from ACPI code and can convert a subset of EC events back to ACPI notifications. Specifically, this interface provides a GenericSerialBus operation region ACPI code can execute a request by writing the request command data and payload to this operation region and reading back the corresponding response via a write-then-read operation. Furthermore, this interface provides a _DSM method to be called when certain events from the EC have been received, essentially turning them into ACPI notifications. The driver provided in this commit essentially takes care of translating the request data written to the operation region, executing the request, waiting for it to finish, and finally writing and translating back the response (if the request has one). Furthermore, this driver takes care of enabling the events handled via ACPI _DSM calls. Lastly, this driver also exposes an interface providing discrete GPU (dGPU) power-on notifications on the Surface Book 2, which are also received via the operation region interface (but not handled by the SAN driver directly), making them accessible to other drivers (such as a dGPU hot-plug driver that may be added later on). On 5th and 6th generation Surface devices (Surface Pro 5/2017, Pro 6, Book 2, Laptop 1 and 2), the SAN interface provides full battery and thermal subsystem access, as well as other EC based functionality. On those models, battery and thermal sensor devices are implemented as standard ACPI devices of that type, however, forward ACPI calls to the corresponding Surface Aggregator EC request via the SAN interface and receive corresponding notifications (e.g. battery information change) from it. This interface is therefore required to provide said functionality on those devices. Signed-off-by: Maximilian Luz <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-07platform/surface: Add Surface Aggregator user-space interfaceMaximilian Luz8-1/+501
Add a misc-device providing user-space access to the Surface Aggregator EC, mainly intended for debugging, testing, and reverse-engineering. This interface gives user-space applications the ability to send requests to the EC and receive the corresponding responses. The device-file is managed by a pseudo platform-device and corresponding driver to avoid dependence on the dedicated bus, allowing it to be loaded in a minimal configuration. A python library and scripts to access this device can be found at [1]. [1]: https://github.com/linux-surface/surface-aggregator-module/tree/master/scripts/ssam Signed-off-by: Maximilian Luz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-07docs: driver-api: Add Surface Aggregator subsystem documentationMaximilian Luz10-0/+1529
Add documentation for the Surface Aggregator subsystem and its client drivers, giving an overview of the subsystem, its use-cases, its internal structure and internal API, as well as its external API for writing client drivers. Signed-off-by: Maximilian Luz <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-07platform/surface: aggregator: Add dedicated bus and device typeMaximilian Luz9-0/+942
The Surface Aggregator EC provides varying functionality, depending on the Surface device. To manage this functionality, we use dedicated client devices for each subsystem or virtual device of the EC. While some of these clients are described as standard devices in ACPI and the corresponding client drivers can be implemented as platform drivers in the kernel (making use of the controller API already present), many devices, especially on newer Surface models, cannot be found there. To simplify management of these devices, we introduce a new bus and client device type for the Surface Aggregator subsystem. The new device type takes care of managing the controller reference, essentially guaranteeing its validity for as long as the client device exists, thus alleviating the need to manually establish device links for that purpose in the client driver (as has to be done with the platform devices). Signed-off-by: Maximilian Luz <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-07platform/surface: aggregator: Add error injection capabilitiesMaximilian Luz4-1/+375
This commit adds error injection hooks to the Surface Serial Hub communication protocol implementation, to: - simulate simple serial transmission errors, - drop packets, requests, and responses, simulating communication failures and potentially trigger retransmission timeouts, as well as - inject invalid data into submitted and received packets. Together with the trace points introduced in the previous commit, these facilities are intended to aid in testing, validation, and debugging of the Surface Aggregator communication layer. Signed-off-by: Maximilian Luz <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Acked-by: Steven Rostedt (VMware) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-07platform/surface: aggregator: Add trace pointsMaximilian Luz6-1/+655
Add trace points to the Surface Aggregator subsystem core. These trace points can be used to track packets, requests, and allocations. They are further intended for debugging and testing/validation, specifically in combination with the error injection capabilities introduced in the subsequent commit. Signed-off-by: Maximilian Luz <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Acked-by: Steven Rostedt (VMware) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-06platform/surface: aggregator: Add event item allocation cachingMaximilian Luz3-10/+101
Event items are used for completing Surface Aggregator EC events, i.e. placing event command data and payload on a workqueue for later processing to avoid doing said processing directly on the receiver thread. This means that event items are allocated for each incoming event, regardless of that event being transmitted via sequenced or unsequenced packets. On the Surface Book 3 and Surface Laptop 3, touchpad HID input events (unsequenced), can constitute a larger amount of traffic, and therefore allocation of event items. This warrants caching event items to reduce memory fragmentation. The size of the cached objects is specifically tuned to accommodate keyboard and touchpad input events and their payloads on those devices. As a result, this effectively also covers most other event types. In case of a larger event payload, event item allocation will fall back to kzalloc(). Signed-off-by: Maximilian Luz <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-06platform/surface: aggregator: Add control packet allocation cachingMaximilian Luz3-10/+67
Surface Serial Hub communication is, in its core, packet based. Each sequenced packet requires to be acknowledged, via an ACK-type control packet. In case invalid data has been received by the driver, a NAK-type (not-acknowledge/negative acknowledge) control packet is sent, triggering retransmission. Control packets are therefore a core communication primitive and used frequently enough (with every sequenced packet transmission sent by the embedded controller, including events and request responses) that it may warrant caching their allocations to reduce possible memory fragmentation. Signed-off-by: Maximilian Luz <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-06platform/surface: Add Surface Aggregator subsystemMaximilian Luz17-0/+8964
Add Surface System Aggregator Module core and Surface Serial Hub driver, required for the embedded controller found on Microsoft Surface devices. The Surface System Aggregator Module (SSAM, SAM or Surface Aggregator) is an embedded controller (EC) found on 4th and later generation Microsoft Surface devices, with the exception of the Surface Go series. This EC provides various functionality, depending on the device in question. This can include battery status and thermal reporting (5th and later generations), but also HID keyboard (6th+) and touchpad input (7th+) on Surface Laptop and Surface Book 3 series devices. This patch provides the basic necessities for communication with the SAM EC on 5th and later generation devices. On these devices, the EC provides an interface that acts as serial device, called the Surface Serial Hub (SSH). 4th generation devices, on which the EC interface is provided via an HID-over-I2C device, are not supported by this patch. Specifically, this patch adds a driver for the SSH device (device HID MSHW0084 in ACPI), as well as a controller structure and associated API. This represents the functional core of the Surface Aggregator kernel subsystem, introduced with this patch, and will be expanded upon in subsequent commits. The SSH driver acts as the main attachment point for this subsystem and sets-up and manages the controller structure. The controller in turn provides a basic communication interface, allowing to send requests from host to EC and receiving the corresponding responses, as well as managing and receiving events, sent from EC to host. It is structured into multiple layers, with the top layer presenting the API used by other kernel drivers and the lower layers modeled after the serial protocol used for communication. Said other drivers are then responsible for providing the (Surface model specific) functionality accessible through the EC (e.g. battery status reporting, thermal information, ...) via said controller structure and API, and will be added in future commits. Signed-off-by: Maximilian Luz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-04platform/x86: amd-pmc: Fix CONFIG_DEBUG_FS checkShyam Sundar S K1-1/+1
lkp reported that CONFIG_DEBUG_FS was not defined because of wrong usage if macro, correcting it now. Fixes: 156ec4731cb2 ("platform/x86: amd-pmc: Add AMD platform support for S2Idle") Reported-by: kernel test robot <[email protected]> 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]>
2021-01-04platform/x86: thinkpad_acpi: correct palmsensor error checkingMark Pearson1-2/+2
The previous commit adding functionality for the palm sensor had a mistake which meant the error conditions on initialisation was not checked correctly. On some older platforms this meant that if the sensor wasn't available an error would be returned and the driver would fail to load. This commit corrects the error condition. Many thanks to Mario Oenning for reporting and determining the issue Signed-off-by: Mark Pearson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
2021-01-04platform/x86: intel-vbtn: Support for tablet mode on Dell Inspiron 7352Arnold Gozum1-0/+6
The Dell Inspiron 7352 is a 2-in-1 model that has chassis-type "Notebook". Add this model to the dmi_switches_allow_list. Signed-off-by: Arnold Gozum <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>