summaryrefslogtreecommitdiffstats
path: root/drivers/platform/surface
AgeCommit message (Collapse)AuthorFilesLines
2021-12-07platform: surface: Propagate ACPI DependencyJarrett Schultz2-1/+7
Since the Surface XBL Driver does not depend on ACPI, the platform/surface directory as a whole no longer depends on ACPI. With respect to this, the ACPI dependency is moved into each config that depends on ACPI individually. Signed-off-by: Jarrett Schultz <jaschultz@microsoft.com> Link: https://lore.kernel.org/r/20211202191630.12450-3-jaschultz@microsoft.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-11-16platform/surface: aggregator_registry: Rename device registration functionMaximilian Luz1-4/+4
Rename the device registration function to better align names with the newly introduced device removal function. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20211028002243.1586083-4-luzmaximilian@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-11-16platform/surface: aggregator_registry: Use generic client removal functionMaximilian Luz1-19/+5
Use generic client removal function introduced in the previous commit instead of defining our own one. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20211028002243.1586083-3-luzmaximilian@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-11-16platform/surface: aggregator: Make client device removal more genericMaximilian Luz3-20/+10
Currently, there are similar functions defined in the Aggregator Registry and the controller core. Make client device removal more generic and export it. We can then use this function later on to remove client devices from device hubs as well as the controller and avoid re-defining similar things. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20211028002243.1586083-2-luzmaximilian@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-10-28platform/surface: aggregator_registry: Add initial support for Surface Pro 8Maximilian Luz1-0/+12
Add preliminary support for the Surface Pro 8 to the Surface Aggregator registry. This includes battery/charger status and platform profile support. In contrast to earlier Surface Pro generations, the keyboard cover is now also connected via the Surface Aggregator Module (whereas it was previously connected via USB or HID-over-I2C). To properly support the HID devices of that cover, however, more changes regarding hot-removal of Surface Aggregator client devices as well as a new device hub driver are required. We will address those things in a follow-up series, so do not add any HID device IDs just yet. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20211028012845.1887219-1-luzmaximilian@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-10-21platform/surface: aggregator_registry: Add support for Surface Laptop StudioMaximilian Luz1-0/+54
Add support for the Surface Laptop Studio. In contrast to previous Surface Laptop models, this one has its HID devices attached to target ID 1 (instead of 2). It also has a couple more of them, including a new notifier for when the pen is stashed / taken out of its place, a "Sys Control" device, and two other unidentified HID devices with unknown usages. Battery and performance profile interfaces remain the same. Cc: stable@vger.kernel.org # 5.14+ Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20211021130904.862610-2-luzmaximilian@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-10-21platform/surface: gpe: Add support for Surface Laptop StudioMaximilian Luz1-0/+13
The new Surface Laptop Studio uses GPEs for lid events as well. Add an entry for that so that the lid can be used to wake the device. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20211021111053.564133-1-luzmaximilian@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-10-19surface: surface3_power: Drop redundant acpi_bus_get_device() callRafael J. Wysocki1-2/+1
If the ACPI companion of a given device is not present, the result of the ACPI_HANDLE() evaluation for it will be NULL, so calling acpi_bus_get_device() on ACPI_HANDLE() result in order to validate it is redundant. Drop the redundant acpi_bus_get_device() call from mshw0011_notify() along with a local variable related to it. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/3160001.aeNJFYEL58@kreacher Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-10-19surface: surface3-wmi: Use ACPI_COMPANION() directlyRafael J. Wysocki1-5/+4
The ACPI_HANDLE() macro is a wrapper arond the ACPI_COMPANION() macro and the ACPI handle produced by the former comes from the ACPI device object produced by the latter, so it is way more straightforward to evaluate the latter directly instead of passing the handle produced by the former to acpi_bus_get_device(). Modify s3_wmi_check_platform_device() accordingly (no intentional functional impact). Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/12896717.uLZWGnKmhe@kreacher Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-09-02Merge tag 'platform-drivers-x86-v5.15-1' of ↵Linus Torvalds2-16/+7
git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86 Pull x86 platform driver updates from Hans de Goede: "Highlights: - Move all the Intel drivers into their own subdir(s) (mostly Kate's work) - New meraki-mx100 platform driver - Asus WMI driver enhancements, including support for /sys/firmware/acpi/platform_profile - New BIOS SAR driver for Intel M.2 WWAM modems - Alder Lake support for the Intel PMC driver - A whole bunch of cleanups + fixes all over the place" * tag 'platform-drivers-x86-v5.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (65 commits) platform/x86: dell-smbios-wmi: Add missing kfree in error-exit from run_smbios_call platform/x86: dell-smbios-wmi: Avoid false-positive memcpy() warning platform/x86: ISST: use semi-colons instead of commas platform/x86: asus-wmi: Fix "unsigned 'retval' is never less than zero" smatch warning platform/x86: asus-wmi: Delete impossible condition platform/x86: hp_accel: Convert to be a platform driver platform/x86: hp_accel: Remove _INI method call platform/mellanox: mlxbf-pmc: fix kernel-doc notation platform/x86/intel: pmc/core: Add GBE Package C10 fix for Alder Lake PCH platform/x86/intel: pmc/core: Add Alder Lake low power mode support for pmc core platform/x86/intel: pmc/core: Add Latency Tolerance Reporting (LTR) support to Alder Lake platform/x86/intel: pmc/core: Add Alderlake support to pmc core driver platform/x86: intel-wmi-thunderbolt: Move to intel sub-directory platform/x86: intel-wmi-sbl-fw-update: Move to intel sub-directory platform/x86: intel-vbtn: Move to intel sub-directory platform/x86: intel_oaktrail: Move to intel sub-directory platform/x86: intel_int0002_vgpio: Move to intel sub-directory platform/x86: intel-hid: Move to intel sub-directory platform/x86: intel_atomisp2: Move to intel sub-directory platform/x86: intel_speed_select_if: Move to intel sub-directory ...
2021-09-01Merge tag 'tty-5.15-rc1' of ↵Linus Torvalds1-8/+1
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty Pull tty / serial updates from Greg KH: "Here is the "big" set of tty/serial driver patches for 5.15-rc1 Nothing major in here at all, just some driver updates and more cleanups on old tty apis and code that needed it that includes: - tty.h cleanup of things that didn't belong in it - other tty cleanups by Jiri - driver cleanups - rs485 support added to amba-pl011 driver - dts updates - stm32 serial driver updates - other minor fixes and driver updates All have been in linux-next for a while with no reported problems" * tag 'tty-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (83 commits) tty: serial: uartlite: Use read_poll_timeout for a polling loop tty: serial: uartlite: Use constants in early_uartlite_putc tty: Fix data race between tiocsti() and flush_to_ldisc() serial: vt8500: Use of_device_get_match_data serial: tegra: Use of_device_get_match_data serial: 8250_ingenic: Use of_device_get_match_data tty: serial: linflexuart: Remove redundant check to simplify the code tty: serial: fsl_lpuart: do software reset for imx7ulp and imx8qxp tty: serial: fsl_lpuart: enable two stop bits for lpuart32 tty: serial: fsl_lpuart: fix the wrong mapbase value mxser: use semi-colons instead of commas tty: moxa: use semi-colons instead of commas tty: serial: fsl_lpuart: check dma_tx_in_progress in tx dma callback tty: replace in_irq() with in_hardirq() serial: sh-sci: fix break handling for sysrq serial: stm32: use devm_platform_get_and_ioremap_resource() serial: stm32: use the defined variable to simplify code Revert "arm pl011 serial: support multi-irq request" tty: serial: samsung: Add Exynos850 SoC data tty: serial: samsung: Fix driver data macros style ...
2021-08-13platform/surface: aggregator: Use serdev_acpi_get_uart_resource() helperAndy Shevchenko1-8/+1
serdev provides a generic helper to get UART Serial Bus resources. Use it instead of an open coded variant. Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20210806111736.66591-2-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-12platform/surface: aggregator: Use y instead of objs in MakefileAndy Shevchenko1-9/+6
The 'objs' is for user space tools, for the kernel modules we should use 'y'. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210803192524.67031-1-andriy.shevchenko@linux.intel.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-08-12platform/surface: surface3_power: Use i2c_acpi_get_i2c_resource() helperAndy Shevchenko1-7/+1
ACPI provides a generic helper to get I²C Serial Bus resources. Use it instead of open coded variant. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210803163252.60141-1-andriy.shevchenko@linux.intel.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-07-21bus: Make remove callback return voidUwe Kleine-König1-3/+1
The driver core ignores the return value of this callback because there is only little it can do when a device disappears. This is the final bit of a long lasting cleanup quest where several buses were converted to also return void from their remove callback. Additionally some resource leaks were fixed that were caused by drivers returning an error code in the expectation that the driver won't go away. With struct bus_type::remove returning void it's prevented that newly implemented buses return an ignored error code and so don't anticipate wrong expectations for driver authors. Reviewed-by: Tom Rix <trix@redhat.com> (For fpga) Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Cornelia Huck <cohuck@redhat.com> (For drivers/s390 and drivers/vfio) Acked-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> (For ARM, Amba and related parts) Acked-by: Mark Brown <broonie@kernel.org> Acked-by: Chen-Yu Tsai <wens@csie.org> (for sunxi-rsb) Acked-by: Pali Rohár <pali@kernel.org> Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org> (for media) Acked-by: Hans de Goede <hdegoede@redhat.com> (For drivers/platform) Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-By: Vinod Koul <vkoul@kernel.org> Acked-by: Juergen Gross <jgross@suse.com> (For xen) Acked-by: Lee Jones <lee.jones@linaro.org> (For mfd) Acked-by: Johannes Thumshirn <jth@kernel.org> (For mcb) Acked-by: Johan Hovold <johan@kernel.org> Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> (For slimbus) Acked-by: Kirti Wankhede <kwankhede@nvidia.com> (For vfio) Acked-by: Maximilian Luz <luzmaximilian@gmail.com> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> (For ulpi and typec) Acked-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> (For ipack) Acked-by: Geoff Levand <geoff@infradead.org> (For ps3) Acked-by: Yehezkel Bernat <YehezkelShB@gmail.com> (For thunderbolt) Acked-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> (For intel_th) Acked-by: Dominik Brodowski <linux@dominikbrodowski.net> (For pcmcia) Acked-by: Rafael J. Wysocki <rafael@kernel.org> (For ACPI) Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> (rpmsg and apr) Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> (For intel-ish-hid) Acked-by: Dan Williams <dan.j.williams@intel.com> (For CXL, DAX, and NVDIMM) Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com> (For isa) Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (For firewire) Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> (For hid) Acked-by: Thorsten Scherer <t.scherer@eckelmann.de> (For siox) Acked-by: Sven Van Asbroeck <TheSven73@gmail.com> (For anybuss) Acked-by: Ulf Hansson <ulf.hansson@linaro.org> (For MMC) Acked-by: Wolfram Sang <wsa@kernel.org> # for I2C Acked-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Finn Thain <fthain@linux-m68k.org> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20210713193522.1770306-6-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-16Merge remote-tracking branch 'linux-pm/acpi-scan' into review-hansHans de Goede3-17/+18
2021-06-16platform/surface: aggregator: Use list_move_tail instead of ↵Baokun Li1-7/+3
list_del/list_add_tail in ssh_packet_layer.c Using list_move_tail() instead of list_del() + list_add_tail() in ssh_packet_layer.c. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Baokun Li <libaokun1@huawei.com> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210609072448.1357524-1-libaokun1@huawei.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-06-16platform/surface: aggregator: Use list_move_tail instead of ↵Baokun Li1-7/+3
list_del/list_add_tail in ssh_request_layer.c Using list_move_tail() instead of list_del() + list_add_tail() in ssh_request_layer.c. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Baokun Li <libaokun1@huawei.com> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210609072638.1358174-1-libaokun1@huawei.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-06-16platform/surface: aggregator: Drop unnecessary variable initializationMaximilian Luz1-1/+1
The status variable in ssam_controller_event_disable() is always set, no need to initialize it. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210604210907.25738-3-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-06-16platform/surface: aggregator: Do not return uninitialized valueMaximilian Luz1-1/+1
The status variable in ssam_nf_refcount_disable_free() is only set when the reference count equals zero. Otherwise, it is returned uninitialized. Fix this by always initializing status to zero. Reported-by: kernel test robot <lkp@intel.com> Fixes: 640ee17199e4 ("platform/surface: aggregator: Allow enabling of events without notifiers") Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210604210907.25738-2-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-06-16platform/surface: aggregator_cdev: Add lockdep supportMaximilian Luz1-0/+16
Mark functions with locking requirements via the corresponding lockdep calls for debugging and documentary purposes. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20210604134755.535590-7-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-06-16platform/surface: aggregator_cdev: Allow enabling of events from user-spaceMaximilian Luz1-0/+58
While events can already be enabled and disabled via the generic request IOCTL, this bypasses the internal reference counting mechanism of the controller. Due to that, disabling an event will turn it off regardless of any other client having requested said event, which may break functionality of that client. To solve this, add IOCTLs wrapping the ssam_controller_event_enable() and ssam_controller_event_disable() functions, which have been previously introduced for this specific purpose. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20210604134755.535590-6-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-06-16platform/surface: aggregator_cdev: Add support for forwarding events to ↵Maximilian Luz1-23/+437
user-space Currently, debugging unknown events requires writing a custom driver. This is somewhat difficult, slow to adapt, and not entirely user-friendly for quickly trying to figure out things on devices of some third-party user. We can do better. We already have a user-space interface intended for debugging SAM EC requests, so let's add support for receiving events to that. This commit provides support for receiving events by reading from the controller file. It additionally introduces two new IOCTLs to control which event categories will be forwarded. Specifically, a user-space client can specify which target categories it wants to receive events from by registering the corresponding notifier(s) via the IOCTLs and after that, read the received events by reading from the controller device. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20210604134755.535590-5-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-06-16platform/surface: aggregator: Update copyrightMaximilian Luz15-15/+15
It's 2021, update the copyright accordingly. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20210604134755.535590-4-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-06-16platform/surface: aggregator: Allow enabling of events without notifiersMaximilian Luz1-48/+245
We can already enable and disable SAM events via one of two ways: either via a (non-observer) notifier tied to a specific event group, or a generic event enable/disable request. In some instances, however, neither method may be desirable. The first method will tie the event enable request to a specific notifier, however, when we want to receive notifications for multiple event groups of the same target category and forward this to the same notifier callback, we may receive duplicate events, i.e. one event per registered notifier. The second method will bypass the internal reference counting mechanism, meaning that a disable request will disable the event regardless of any other client driver using it, which may break the functionality of that driver. To address this problem, add new functions that allow enabling and disabling of events via the event reference counting mechanism built into the controller, without needing to register a notifier. This can then be used in combination with observer notifiers to process multiple events of the same target category without duplication in the same callback function. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210604134755.535590-3-luzmaximilian@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-06-16platform/surface: aggregator: Allow registering notifiers without enabling ↵Maximilian Luz1-28/+41
events Currently, each SSAM event notifier is directly tied to one group of events. This makes sense as registering a notifier will automatically take care of enabling the corresponding event group and normally drivers only need notifications for a very limited number of events, associated with different callbacks for each group. However, there are rare cases, especially for debugging, when we want to get notifications for a whole event target category instead of just a single group of events in that category. Registering multiple notifiers, i.e. one per group, may be infeasible due to two issues: a) we might not know every event enable/disable specification as some events are auto-enabled by the EC and b) forwarding this to the same callback will lead to duplicate events as we might not know the full event specification to perform the appropriate filtering. This commit introduces observer-notifiers, which are notifiers that are not tied to a specific event group and do not attempt to manage any events. In other words, they can be registered without enabling any event group or incrementing the corresponding reference count and just act as silent observers, listening to all currently/previously enabled events based on their match-specification. Essentially, this allows us to register one single notifier for a full event target category, meaning that we can process all events of that target category in a single callback without duplication. Specifically, this will be used in the cdev debug interface to forward events to user-space via a device file from which the events can be read. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20210604134755.535590-2-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-06-16platform/surface: dtx: Add missing mutex_destroy() call in failure pathMaximilian Luz1-0/+1
When we fail to open the device file due to DTX being shut down, the mutex is initialized but never destroyed. We are destroying it when releasing the file, so add the missing call in the failure path as well. Fixes: 1d609992832e ("platform/surface: Add DTX driver") Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210604132540.533036-1-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-06-16platform/surface: aggregator: Fix event disable functionMaximilian Luz1-1/+1
Disabling events silently fails due to the wrong command ID being used. Instead of the command ID for the disable call, the command ID for the enable call was being used. This causes the disable call to enable the event instead. As the event is already enabled when we call this function, the EC silently drops this command and does nothing. Use the correct command ID for disabling the event to fix this. Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem") Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210603000636.568846-1-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-06-16platform/surface: aggregator_registry: Consolidate node groups for 5th- and ↵Maximilian Luz1-35/+12
6th-gen devices 5th- and 6th-generation Surface devices have all SAM clients defined in ACPI, except for the platform profile/performance mode which his handled via the WSID (Windows Surface Integration Device). Thus, the node groups for those devices are the same and we can just use a single one instead of re-defining the same one over and over again. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210523134528.798887-4-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-06-16platform/surface: aggregator_registry: Add support for 13" Intel Surface ↵Maximilian Luz1-0/+3
Laptop 4 Add support for the 13" Intel version of the Surface Laptop 4. Use the existing node group for the Surface Laptop 3 since the 15" AMD version already shares its WSID HID with its predecessor and there don't seem to be any significant differences with regards to SAM. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210523134528.798887-3-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-06-16platform/surface: aggregator_registry: Update comments for 15" AMD Surface ↵Maximilian Luz1-2/+2
Laptop 4 The 15" AMD version of the Surface Laptop 4 shares its WSID HID with the 15" AMD version of the Surface Laptop 3. Update the comments accordingly. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210523134528.798887-2-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-06-07ACPI: scan: Extend acpi_walk_dep_device_list()Daniel Scally3-17/+18
The acpi_walk_dep_device_list() function is not as generic as its name implies, serving only to decrement the dependency count for each dependent device of the input. Extend it to accept a callback which can be applied to all the dependencies in acpi_dep_list. Replace all existing calls to the function with calls to a wrapper, passing a callback that applies the same dependency reduction. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Maximilian Luz <luzmaximilian@gmail.com> # for platform/surface parts Signed-off-by: Daniel Scally <djrscally@gmail.com> [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2021-05-19platform/surface: dtx: Fix poll functionMaximilian Luz1-7/+1
The poll function should not return -ERESTARTSYS. Furthermore, locking in this function is completely unnecessary. The ddev->lock protects access to the main device and controller (ddev->dev and ddev->ctrl), ensuring that both are and remain valid while being accessed by clients. Both are, however, never accessed in the poll function. The shutdown test (via atomic bit flags) be safely done without locking, so drop locking here entirely. Reported-by: kernel test robot <lkp@intel.com> Fixes: 1d609992832e ("platform/surface: Add DTX driver) Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210513134437.2431022-1-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-05-19platform/surface: aggregator: Do not mark interrupt as sharedMaximilian Luz1-2/+1
Having both IRQF_NO_AUTOEN and IRQF_SHARED set causes request_threaded_irq() to return with -EINVAL (see comment in flag validation in that function). As the interrupt is currently not shared between multiple devices, drop the IRQF_SHARED flag. Fixes: 507cf5a2f1e2 ("platform/surface: aggregator: move to use request_irq by IRQF_NO_AUTOEN flag") Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210505133635.1499703-1-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-04-20platform/surface: aggregator: fix a bit testDan Carpenter1-1/+1
The "funcs" variable is a u64. If "func" is more than 31 then the BIT() shift will wrap instead of testing the high bits. Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/YH6UUhJhGk3mk13b@mwanda Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-04-08platform/surface: aggregator: move to use request_irq by IRQF_NO_AUTOEN flagTian Tao1-2/+2
disable_irq() after request_irq() still has a time gap in which interrupts can come. request_irq() with IRQF_NO_AUTOEN flag will disable IRQ auto-enable because of requesting. this patch is made base on "add IRQF_NO_AUTOEN for request_irq" which is being merged: https://lore.kernel.org/patchwork/patch/1388765/ Signed-off-by: Tian Tao <tiantao6@hisilicon.com> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/1617778852-26492-1-git-send-email-tiantao6@hisilicon.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-04-07platform/surface: aggregator_registry: Give devices time to set up when ↵Maximilian Luz1-58/+40
connecting Sometimes, the "base connected" event that we rely on to (re-)attach the device connected to the base is sent a bit too early. When this happens, some devices may not be completely ready yet. Specifically, the battery has been observed to report zero-values for things like full charge capacity, which, however, is only loaded once when the driver for that device probes. This can thus result in battery readings being unavailable. As we cannot easily and reliably discern between devices that are not ready yet and devices that are not connected (i.e. will never be ready), delay adding these devices. This should give them enough time to set up. The delay is set to 2.5 seconds, which should give us a good safety margin based on testing and still be fairly responsive for users. To achieve that delay switch to updating via a delayed work struct, which means that we can also get rid of some locking. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210405231222.358113-1-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-04-07platform/surface: clean up a variable in surface_dtx_read()Dan Carpenter1-1/+1
The "&client->ddev->lock" and "&ddev->lock" are the same thing. Let's use "&ddev->lock" consistently. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/YF3TgCcpcCYl3a//@mwanda Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-03-23platform/surface: fix semicolon.cocci warningskernel test robot1-1/+1
drivers/platform/surface/surface_dtx.c:651:2-3: Unneeded semicolon Remove unneeded semicolon. Generated by: scripts/coccinelle/misc/semicolon.cocci Fixes: 1d609992832e ("platform/surface: Add DTX driver") CC: Maximilian Luz <luzmaximilian@gmail.com> Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: kernel test robot <lkp@intel.com> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210319051919.GA39801@ae4f36e4f012 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-03-17platform/surface: aggregator_registry: Add support for Surface Pro 7+Maximilian Luz1-1/+4
The Surface Pro 7+ is essentially a refresh of the Surface Pro 7 with updated hardware and a new WSID identifier. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210309162550.302161-1-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-03-17platform/surface: aggregator_registry: Make symbol 'ssam_base_hub_group' staticWei Yongjun1-1/+1
The sparse tool complains as follows: drivers/platform/surface/surface_aggregator_registry.c:355:30: warning: symbol 'ssam_base_hub_group' was not declared. Should it be static? This symbol is not used outside of surface_aggregator_registry.c, so this commit marks it static. Fixes: 797e78564634 ("platform/surface: aggregator_registry: Add base device hub") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210309131500.1885772-1-weiyongjun1@huawei.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-03-17platform/surface: dtx: Add support for native SSAM devicesMaximilian Luz2-1/+93
Add support for native SSAM devices to the DTX driver. This allows support for the Surface Book 3, on which the DTX device is not present in ACPI. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210308184819.437438-3-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-03-17platform/surface: Add DTX driverMaximilian Luz3-0/+1218
The Microsoft Surface Book series devices consist of a so-called clipboard part (containing the CPU, touchscreen, and primary battery) and a base part (containing keyboard, secondary battery, and optional discrete GPU). These parts can be separated, i.e. the clipboard can be detached and used as tablet. This detachment process is initiated by pressing a button. On the Surface Book 2 and 3 (targeted with this commit), the Surface Aggregator Module (i.e. the embedded controller on those devices) attempts to send a notification to any listening client driver and waits for further instructions (i.e. whether the detachment process should continue or be aborted). If it does not receive a response in a certain time-frame, the detachment process (by default) continues and the clipboard can be physically separated. In other words, (by default and) without a driver, the detachment process takes about 10 seconds to complete. This commit introduces a driver for this detachment system (called DTX). This driver allows a user-space daemon to control and influence the detachment behavior. Specifically, it forwards any detachment requests to user-space, allows user-space to make such requests itself, and allows handling of those requests. Requests can be handled by either aborting, continuing/allowing, or delaying (i.e. resetting the timeout via a heartbeat commend). The user-space API is implemented via the /dev/surface/dtx miscdevice. In addition, user-space can change the default behavior on timeout from allowing detachment to disallowing it, which is useful if the (optional) discrete GPU is in use. Furthermore, this driver allows user-space to receive notifications about the state of the base, specifically when it is physically removed (as opposed to detachment requested), in what manner it is connected (i.e. in reverse-/tent-/studio- or laptop-mode), and what type of base is connected. Based on this information, the driver also provides a simple tablet-mode switch (aliasing all modes without keyboard access, i.e. tablet-mode and studio-mode to its reported tablet-mode). An implementation of such a user-space daemon, allowing configuration of detachment behavior via scripts (e.g. safely unmounting USB devices connected to the base before continuing) can be found at [1]. [1]: https://github.com/linux-surface/surface-dtx-daemon Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210308184819.437438-2-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-03-08platform: x86: ACPI: Get rid of ACPICA message printingRafael J. Wysocki1-2/+0
A few x86 platform drivers use ACPI_DEBUG_PRINT() or ACPI_EXCEPTION() for printing messages, but that is questionable, because those macros belong to ACPICA and they should not be used elsewhere. In addition, ACPI_DEBUG_PRINT() requires special enabling to allow it to actually print the message, which is a nuisance, and the _COMPONENT symbol generally needed for that is not defined in any of the files in question. For this reason, replace the ACPI_DEBUG_PRINT() in lg-laptop.c with pr_debug() and the one in xo15-ebook.c with acpi_handle_debug() (with the additional benefit that the source object can be identified more easily after this change). Also drop the ACPI_MODULE_NAME() definitions that are only used by the ACPICA message printing macros from those files and from wmi.c and surfacepro3_button.c (while at it). Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://lore.kernel.org/r/2074665.VPHYfYaQb6@kreacher [hdegoede@redhat.com: Drop acer-wmi.c chunk, a similar patch was already merged] Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-03-08platform/surface: aggregator: Make SSAM_DEFINE_SYNC_REQUEST_x define static ↵Maximilian Luz3-8/+8
functions The SSAM_DEFINE_SYNC_REQUEST_x() macros are intended to reduce boiler-plate code for SSAM request definitions by defining a wrapper function for the specified request. The client device variants of those macros, i.e. SSAM_DEFINE_SYNC_REQUEST_CL_x() in particular rely on the multi-device (MD) variants, e.g.: #define SSAM_DEFINE_SYNC_REQUEST_CL_R(name, rtype, spec...) \ SSAM_DEFINE_SYNC_REQUEST_MD_R(__raw_##name, rtype, spec) \ int name(struct ssam_device *sdev, rtype *ret) \ { \ return __raw_##name(sdev->ctrl, sdev->uid.target, \ sdev->uid.instance, ret); \ } This now creates the problem that it is not possible to declare the generated functions static via static SSAM_DEFINE_SYNC_REQUEST_CL_R(...) as this will only apply to the function defined by the multi-device macro, i.e. SSAM_DEFINE_SYNC_REQUEST_MD_R(). Thus compiling with `-Wmissing-prototypes' rightfully complains that there is a 'static' keyword missing. To solve this, make all SSAM_DEFINE_SYNC_REQUEST_x() macros define static functions. Non-client-device macros are also changed for consistency. In general, we expect those functions to be only used locally in the respective drivers for the corresponding interfaces, so having to define a wrapper function to be able to export this should be the odd case out. Reported-by: kernel test robot <lkp@intel.com> Fixes: b78b4982d763 ("platform/surface: Add platform profile driver") Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210304190524.1172197-1-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-03-06platform/surface: Add platform profile driverMaximilian Luz3-0/+213
Add a driver to provide platform profile support on 5th- and later generation Microsoft Surface devices with a Surface System Aggregator Module. On those devices, the platform profile can be used to influence cooling behavior and power consumption. For example, the default 'quiet' profile limits fan noise and in turn sacrifices performance of the discrete GPU found on Surface Books. Its full performance can only be unlocked on the 'performance' profile. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20210211201703.658240-5-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-03-06platform/surface: aggregator_registry: Add HID subsystem devicesMaximilian Luz1-0/+49
Add HID subsystem (TC=0x15) devices. These devices need to be registered for 7th-generation Surface models. On previous generations, these devices are either provided as platform devices via ACPI (Surface Laptop 1 and 2) or implemented as standard USB device. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210212115439.1525216-7-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-03-06platform/surface: aggregator_registry: Add DTX deviceMaximilian Luz1-0/+7
Add the detachment system (DTX) SSAM device for the Surface Book 3. This device is accessible under the base (TC=0x11) subsystem. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210212115439.1525216-6-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-03-06platform/surface: aggregator_registry: Add platform profile deviceMaximilian Luz1-0/+15
Add the SSAM platform profile device to the SSAM device registry. This device is accessible under the thermal subsystem (TC=0x03) and needs to be registered for all Surface models. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210212115439.1525216-5-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2021-03-06platform/surface: aggregator_registry: Add battery subsystem devicesMaximilian Luz1-0/+27
Add battery subsystem (TC=0x02) devices (battery and AC) to the SSAM device registry. These devices need to be registered for 7th-generation Surface models. On 5th- and 6th-generation models, these devices are handled via the standard ACPI battery/AC interface, which in turn accesses the same SSAM interface via the Surface ACPI Notify (SAN) driver. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20210212115439.1525216-4-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>