diff options
author | Maximilian Luz <luzmaximilian@gmail.com> | 2020-12-21 21:39:56 +0300 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2021-01-07 02:06:39 +0300 |
commit | eb0e90a82098d4a48308abb87d2087578a83987f (patch) | |
tree | 01352b0c6f8426ff6c36743f31b05dd0eea79c87 /drivers/platform/surface/aggregator/core.c | |
parent | 02be44f6b5a9e4ff1215d337ac4d2a6fbafc7874 (diff) | |
download | linux-eb0e90a82098d4a48308abb87d2087578a83987f.tar.xz |
platform/surface: aggregator: Add dedicated bus and device type
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 <luzmaximilian@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201221183959.1186143-7-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/surface/aggregator/core.c')
-rw-r--r-- | drivers/platform/surface/aggregator/core.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/platform/surface/aggregator/core.c b/drivers/platform/surface/aggregator/core.c index b6a9dea53592..8dc2c267bcd6 100644 --- a/drivers/platform/surface/aggregator/core.c +++ b/drivers/platform/surface/aggregator/core.c @@ -22,6 +22,8 @@ #include <linux/sysfs.h> #include <linux/surface_aggregator/controller.h> + +#include "bus.h" #include "controller.h" #define CREATE_TRACE_POINTS @@ -739,6 +741,9 @@ static void ssam_serial_hub_remove(struct serdev_device *serdev) sysfs_remove_group(&serdev->dev.kobj, &ssam_sam_group); ssam_controller_lock(ctrl); + /* Remove all client devices. */ + ssam_controller_remove_clients(ctrl); + /* Act as if suspending to silence events. */ status = ssam_ctrl_notif_display_off(ctrl); if (status) { @@ -791,6 +796,10 @@ static int __init ssam_core_init(void) { int status; + status = ssam_bus_register(); + if (status) + goto err_bus; + status = ssh_ctrl_packet_cache_init(); if (status) goto err_cpkg; @@ -810,6 +819,8 @@ err_register: err_evitem: ssh_ctrl_packet_cache_destroy(); err_cpkg: + ssam_bus_unregister(); +err_bus: return status; } module_init(ssam_core_init); @@ -819,6 +830,7 @@ static void __exit ssam_core_exit(void) serdev_device_driver_unregister(&ssam_serial_hub); ssam_event_item_cache_destroy(); ssh_ctrl_packet_cache_destroy(); + ssam_bus_unregister(); } module_exit(ssam_core_exit); |