1 // SPDX-License-Identifier: GPL-2.0+
3 * Surface Serial Hub (SSH) driver for communication with the Surface/System
4 * Aggregator Module (SSAM/SAM).
6 * Provides access to a SAM-over-SSH connected EC via a controller device.
7 * Handles communication via requests as well as enabling, disabling, and
10 * Copyright (C) 2019-2022 Maximilian Luz <luzmaximilian@gmail.com>
13 #include <linux/acpi.h>
14 #include <linux/atomic.h>
15 #include <linux/completion.h>
16 #include <linux/gpio/consumer.h>
17 #include <linux/kernel.h>
18 #include <linux/kref.h>
19 #include <linux/module.h>
21 #include <linux/platform_device.h>
23 #include <linux/serdev.h>
24 #include <linux/sysfs.h>
25 #include <linux/units.h>
27 #include <linux/surface_aggregator/controller.h>
28 #include <linux/surface_aggregator/device.h>
31 #include "controller.h"
33 #define CREATE_TRACE_POINTS
37 /* -- Static controller reference. ------------------------------------------ */
40 * Main controller reference. The corresponding lock must be held while
41 * accessing (reading/writing) the reference.
43 static struct ssam_controller
*__ssam_controller
;
44 static DEFINE_SPINLOCK(__ssam_controller_lock
);
47 * ssam_get_controller() - Get reference to SSAM controller.
49 * Returns a reference to the SSAM controller of the system or %NULL if there
50 * is none, it hasn't been set up yet, or it has already been unregistered.
51 * This function automatically increments the reference count of the
52 * controller, thus the calling party must ensure that ssam_controller_put()
53 * is called when it doesn't need the controller any more.
55 struct ssam_controller
*ssam_get_controller(void)
57 struct ssam_controller
*ctrl
;
59 spin_lock(&__ssam_controller_lock
);
61 ctrl
= __ssam_controller
;
65 if (WARN_ON(!kref_get_unless_zero(&ctrl
->kref
)))
69 spin_unlock(&__ssam_controller_lock
);
72 EXPORT_SYMBOL_GPL(ssam_get_controller
);
75 * ssam_try_set_controller() - Try to set the main controller reference.
76 * @ctrl: The controller to which the reference should point.
78 * Set the main controller reference to the given pointer if the reference
79 * hasn't been set already.
81 * Return: Returns zero on success or %-EEXIST if the reference has already
84 static int ssam_try_set_controller(struct ssam_controller
*ctrl
)
88 spin_lock(&__ssam_controller_lock
);
89 if (!__ssam_controller
)
90 __ssam_controller
= ctrl
;
93 spin_unlock(&__ssam_controller_lock
);
99 * ssam_clear_controller() - Remove/clear the main controller reference.
101 * Clears the main controller reference, i.e. sets it to %NULL. This function
102 * should be called before the controller is shut down.
104 static void ssam_clear_controller(void)
106 spin_lock(&__ssam_controller_lock
);
107 __ssam_controller
= NULL
;
108 spin_unlock(&__ssam_controller_lock
);
112 * ssam_client_link() - Link an arbitrary client device to the controller.
113 * @c: The controller to link to.
114 * @client: The client device.
116 * Link an arbitrary client device to the controller by creating a device link
117 * between it as consumer and the controller device as provider. This function
118 * can be used for non-SSAM devices (or SSAM devices not registered as child
119 * under the controller) to guarantee that the controller is valid for as long
120 * as the driver of the client device is bound, and that proper suspend and
121 * resume ordering is guaranteed.
123 * The device link does not have to be destructed manually. It is removed
124 * automatically once the driver of the client device unbinds.
126 * Return: Returns zero on success, %-ENODEV if the controller is not ready or
127 * going to be removed soon, or %-ENOMEM if the device link could not be
128 * created for other reasons.
130 int ssam_client_link(struct ssam_controller
*c
, struct device
*client
)
132 const u32 flags
= DL_FLAG_PM_RUNTIME
| DL_FLAG_AUTOREMOVE_CONSUMER
;
133 struct device_link
*link
;
134 struct device
*ctrldev
;
136 ssam_controller_statelock(c
);
138 if (c
->state
!= SSAM_CONTROLLER_STARTED
) {
139 ssam_controller_stateunlock(c
);
143 ctrldev
= ssam_controller_device(c
);
145 ssam_controller_stateunlock(c
);
149 link
= device_link_add(client
, ctrldev
, flags
);
151 ssam_controller_stateunlock(c
);
156 * Return -ENODEV if supplier driver is on its way to be removed. In
157 * this case, the controller won't be around for much longer and the
158 * device link is not going to save us any more, as unbinding is
159 * already in progress.
161 if (READ_ONCE(link
->status
) == DL_STATE_SUPPLIER_UNBIND
) {
162 ssam_controller_stateunlock(c
);
166 ssam_controller_stateunlock(c
);
169 EXPORT_SYMBOL_GPL(ssam_client_link
);
172 * ssam_client_bind() - Bind an arbitrary client device to the controller.
173 * @client: The client device.
175 * Link an arbitrary client device to the controller by creating a device link
176 * between it as consumer and the main controller device as provider. This
177 * function can be used for non-SSAM devices to guarantee that the controller
178 * returned by this function is valid for as long as the driver of the client
179 * device is bound, and that proper suspend and resume ordering is guaranteed.
181 * This function does essentially the same as ssam_client_link(), except that
182 * it first fetches the main controller reference, then creates the link, and
183 * finally returns this reference. Note that this function does not increment
184 * the reference counter of the controller, as, due to the link, the
185 * controller lifetime is assured as long as the driver of the client device
188 * It is not valid to use the controller reference obtained by this method
189 * outside of the driver bound to the client device at the time of calling
190 * this function, without first incrementing the reference count of the
191 * controller via ssam_controller_get(). Even after doing this, care must be
192 * taken that requests are only submitted and notifiers are only
193 * (un-)registered when the controller is active and not suspended. In other
194 * words: The device link only lives as long as the client driver is bound and
195 * any guarantees enforced by this link (e.g. active controller state) can
196 * only be relied upon as long as this link exists and may need to be enforced
197 * in other ways afterwards.
199 * The created device link does not have to be destructed manually. It is
200 * removed automatically once the driver of the client device unbinds.
202 * Return: Returns the controller on success, an error pointer with %-ENODEV
203 * if the controller is not present, not ready or going to be removed soon, or
204 * %-ENOMEM if the device link could not be created for other reasons.
206 struct ssam_controller
*ssam_client_bind(struct device
*client
)
208 struct ssam_controller
*c
;
211 c
= ssam_get_controller();
213 return ERR_PTR(-ENODEV
);
215 status
= ssam_client_link(c
, client
);
218 * Note that we can drop our controller reference in both success and
219 * failure cases: On success, we have bound the controller lifetime
220 * inherently to the client driver lifetime, i.e. it the controller is
221 * now guaranteed to outlive the client driver. On failure, we're not
222 * going to use the controller any more.
224 ssam_controller_put(c
);
226 return status
>= 0 ? c
: ERR_PTR(status
);
228 EXPORT_SYMBOL_GPL(ssam_client_bind
);
231 /* -- Glue layer (serdev_device -> ssam_controller). ------------------------ */
233 static size_t ssam_receive_buf(struct serdev_device
*dev
, const u8
*buf
,
236 struct ssam_controller
*ctrl
;
239 ctrl
= serdev_device_get_drvdata(dev
);
240 ret
= ssam_controller_receive_buf(ctrl
, buf
, n
);
242 return ret
< 0 ? 0 : ret
;
245 static void ssam_write_wakeup(struct serdev_device
*dev
)
247 ssam_controller_write_wakeup(serdev_device_get_drvdata(dev
));
250 static const struct serdev_device_ops ssam_serdev_ops
= {
251 .receive_buf
= ssam_receive_buf
,
252 .write_wakeup
= ssam_write_wakeup
,
256 /* -- SysFS and misc. ------------------------------------------------------- */
258 static int ssam_log_firmware_version(struct ssam_controller
*ctrl
)
260 u32 version
, a
, b
, c
;
263 status
= ssam_get_firmware_version(ctrl
, &version
);
267 a
= (version
>> 24) & 0xff;
268 b
= ((version
>> 8) & 0xffff);
271 ssam_info(ctrl
, "SAM firmware version: %u.%u.%u\n", a
, b
, c
);
275 static ssize_t
firmware_version_show(struct device
*dev
,
276 struct device_attribute
*attr
, char *buf
)
278 struct ssam_controller
*ctrl
= dev_get_drvdata(dev
);
279 u32 version
, a
, b
, c
;
282 status
= ssam_get_firmware_version(ctrl
, &version
);
286 a
= (version
>> 24) & 0xff;
287 b
= ((version
>> 8) & 0xffff);
290 return sysfs_emit(buf
, "%u.%u.%u\n", a
, b
, c
);
292 static DEVICE_ATTR_RO(firmware_version
);
294 static struct attribute
*ssam_sam_attrs
[] = {
295 &dev_attr_firmware_version
.attr
,
299 static const struct attribute_group ssam_sam_group
= {
301 .attrs
= ssam_sam_attrs
,
305 /* -- Serial device setup. -------------------------------------------------- */
307 static acpi_status
ssam_serdev_setup_via_acpi_crs(struct acpi_resource
*rsc
,
310 struct serdev_device
*serdev
= ctx
;
311 struct acpi_resource_uart_serialbus
*uart
;
315 if (!serdev_acpi_get_uart_resource(rsc
, &uart
))
318 /* Set up serdev device. */
319 serdev_device_set_baudrate(serdev
, uart
->default_baud_rate
);
321 /* serdev currently only supports RTSCTS flow control. */
322 if (uart
->flow_control
& (~((u8
)ACPI_UART_FLOW_CONTROL_HW
))) {
323 dev_warn(&serdev
->dev
, "setup: unsupported flow control (value: %#04x)\n",
327 /* Set RTSCTS flow control. */
328 flow_control
= uart
->flow_control
& ACPI_UART_FLOW_CONTROL_HW
;
329 serdev_device_set_flow_control(serdev
, flow_control
);
331 /* serdev currently only supports EVEN/ODD parity. */
332 switch (uart
->parity
) {
333 case ACPI_UART_PARITY_NONE
:
334 status
= serdev_device_set_parity(serdev
, SERDEV_PARITY_NONE
);
336 case ACPI_UART_PARITY_EVEN
:
337 status
= serdev_device_set_parity(serdev
, SERDEV_PARITY_EVEN
);
339 case ACPI_UART_PARITY_ODD
:
340 status
= serdev_device_set_parity(serdev
, SERDEV_PARITY_ODD
);
343 dev_warn(&serdev
->dev
, "setup: unsupported parity (value: %#04x)\n",
349 dev_err(&serdev
->dev
, "setup: failed to set parity (value: %#04x, error: %d)\n",
350 uart
->parity
, status
);
354 /* We've found the resource and are done. */
355 return AE_CTRL_TERMINATE
;
358 static int ssam_serdev_setup_via_acpi(struct serdev_device
*serdev
, acpi_handle handle
)
362 status
= acpi_walk_resources(handle
, METHOD_NAME__CRS
,
363 ssam_serdev_setup_via_acpi_crs
, serdev
);
365 return status
? -ENXIO
: 0;
368 static int ssam_serdev_setup(struct acpi_device
*ssh
, struct serdev_device
*serdev
)
371 return ssam_serdev_setup_via_acpi(serdev
, ssh
->handle
);
373 /* TODO: these values may differ per board/implementation */
374 serdev_device_set_baudrate(serdev
, 4 * HZ_PER_MHZ
);
375 serdev_device_set_flow_control(serdev
, true);
376 serdev_device_set_parity(serdev
, SERDEV_PARITY_NONE
);
381 /* -- Power management. ----------------------------------------------------- */
383 static void ssam_serial_hub_shutdown(struct device
*dev
)
385 struct ssam_controller
*c
= dev_get_drvdata(dev
);
389 * Try to disable notifiers, signal display-off and D0-exit, ignore any
392 * Note: It has not been established yet if this is actually
393 * necessary/useful for shutdown.
396 status
= ssam_notifier_disable_registered(c
);
398 ssam_err(c
, "pm: failed to disable notifiers for shutdown: %d\n",
402 status
= ssam_ctrl_notif_display_off(c
);
404 ssam_err(c
, "pm: display-off notification failed: %d\n", status
);
406 status
= ssam_ctrl_notif_d0_exit(c
);
408 ssam_err(c
, "pm: D0-exit notification failed: %d\n", status
);
411 #ifdef CONFIG_PM_SLEEP
413 static int ssam_serial_hub_pm_prepare(struct device
*dev
)
415 struct ssam_controller
*c
= dev_get_drvdata(dev
);
419 * Try to signal display-off, This will quiesce events.
421 * Note: Signaling display-off/display-on should normally be done from
422 * some sort of display state notifier. As that is not available,
426 status
= ssam_ctrl_notif_display_off(c
);
428 ssam_err(c
, "pm: display-off notification failed: %d\n", status
);
433 static void ssam_serial_hub_pm_complete(struct device
*dev
)
435 struct ssam_controller
*c
= dev_get_drvdata(dev
);
439 * Try to signal display-on. This will restore events.
441 * Note: Signaling display-off/display-on should normally be done from
442 * some sort of display state notifier. As that is not available,
446 status
= ssam_ctrl_notif_display_on(c
);
448 ssam_err(c
, "pm: display-on notification failed: %d\n", status
);
451 static int ssam_serial_hub_pm_suspend(struct device
*dev
)
453 struct ssam_controller
*c
= dev_get_drvdata(dev
);
457 * Try to signal D0-exit, enable IRQ wakeup if specified. Abort on
461 status
= ssam_ctrl_notif_d0_exit(c
);
463 ssam_err(c
, "pm: D0-exit notification failed: %d\n", status
);
467 status
= ssam_irq_arm_for_wakeup(c
);
471 WARN_ON(ssam_controller_suspend(c
));
475 ssam_ctrl_notif_d0_entry(c
);
477 ssam_ctrl_notif_display_on(c
);
481 static int ssam_serial_hub_pm_resume(struct device
*dev
)
483 struct ssam_controller
*c
= dev_get_drvdata(dev
);
486 WARN_ON(ssam_controller_resume(c
));
489 * Try to disable IRQ wakeup (if specified) and signal D0-entry. In
490 * case of errors, log them and try to restore normal operation state
491 * as far as possible.
493 * Note: Signaling display-off/display-on should normally be done from
494 * some sort of display state notifier. As that is not available,
498 ssam_irq_disarm_wakeup(c
);
500 status
= ssam_ctrl_notif_d0_entry(c
);
502 ssam_err(c
, "pm: D0-entry notification failed: %d\n", status
);
507 static int ssam_serial_hub_pm_freeze(struct device
*dev
)
509 struct ssam_controller
*c
= dev_get_drvdata(dev
);
513 * During hibernation image creation, we only have to ensure that the
514 * EC doesn't send us any events. This is done via the display-off
515 * and D0-exit notifications. Note that this sets up the wakeup IRQ
516 * on the EC side, however, we have disabled it by default on our side
517 * and won't enable it here.
519 * See ssam_serial_hub_poweroff() for more details on the hibernation
523 status
= ssam_ctrl_notif_d0_exit(c
);
525 ssam_err(c
, "pm: D0-exit notification failed: %d\n", status
);
526 ssam_ctrl_notif_display_on(c
);
530 WARN_ON(ssam_controller_suspend(c
));
534 static int ssam_serial_hub_pm_thaw(struct device
*dev
)
536 struct ssam_controller
*c
= dev_get_drvdata(dev
);
539 WARN_ON(ssam_controller_resume(c
));
541 status
= ssam_ctrl_notif_d0_entry(c
);
543 ssam_err(c
, "pm: D0-exit notification failed: %d\n", status
);
548 static int ssam_serial_hub_pm_poweroff(struct device
*dev
)
550 struct ssam_controller
*c
= dev_get_drvdata(dev
);
554 * When entering hibernation and powering off the system, the EC, at
555 * least on some models, may disable events. Without us taking care of
556 * that, this leads to events not being enabled/restored when the
557 * system resumes from hibernation, resulting SAM-HID subsystem devices
558 * (i.e. keyboard, touchpad) not working, AC-plug/AC-unplug events being
561 * To avoid these issues, we disable all registered events here (this is
562 * likely not actually required) and restore them during the drivers PM
565 * Wakeup from the EC interrupt is not supported during hibernation,
566 * so don't arm the IRQ here.
569 status
= ssam_notifier_disable_registered(c
);
571 ssam_err(c
, "pm: failed to disable notifiers for hibernation: %d\n",
576 status
= ssam_ctrl_notif_d0_exit(c
);
578 ssam_err(c
, "pm: D0-exit notification failed: %d\n", status
);
579 ssam_notifier_restore_registered(c
);
583 WARN_ON(ssam_controller_suspend(c
));
587 static int ssam_serial_hub_pm_restore(struct device
*dev
)
589 struct ssam_controller
*c
= dev_get_drvdata(dev
);
593 * Ignore but log errors, try to restore state as much as possible in
594 * case of failures. See ssam_serial_hub_poweroff() for more details on
595 * the hibernation process.
598 WARN_ON(ssam_controller_resume(c
));
600 status
= ssam_ctrl_notif_d0_entry(c
);
602 ssam_err(c
, "pm: D0-entry notification failed: %d\n", status
);
604 ssam_notifier_restore_registered(c
);
608 static const struct dev_pm_ops ssam_serial_hub_pm_ops
= {
609 .prepare
= ssam_serial_hub_pm_prepare
,
610 .complete
= ssam_serial_hub_pm_complete
,
611 .suspend
= ssam_serial_hub_pm_suspend
,
612 .resume
= ssam_serial_hub_pm_resume
,
613 .freeze
= ssam_serial_hub_pm_freeze
,
614 .thaw
= ssam_serial_hub_pm_thaw
,
615 .poweroff
= ssam_serial_hub_pm_poweroff
,
616 .restore
= ssam_serial_hub_pm_restore
,
619 #else /* CONFIG_PM_SLEEP */
621 static const struct dev_pm_ops ssam_serial_hub_pm_ops
= { };
623 #endif /* CONFIG_PM_SLEEP */
626 /* -- Device/driver setup. -------------------------------------------------- */
628 static const struct acpi_gpio_params gpio_ssam_wakeup_int
= { 0, 0, false };
629 static const struct acpi_gpio_params gpio_ssam_wakeup
= { 1, 0, false };
631 static const struct acpi_gpio_mapping ssam_acpi_gpios
[] = {
632 { "ssam_wakeup-int-gpio", &gpio_ssam_wakeup_int
, 1 },
633 { "ssam_wakeup-gpio", &gpio_ssam_wakeup
, 1 },
637 static int ssam_serial_hub_probe(struct serdev_device
*serdev
)
639 struct device
*dev
= &serdev
->dev
;
640 struct acpi_device
*ssh
= ACPI_COMPANION(dev
);
641 struct ssam_controller
*ctrl
;
645 status
= gpiod_count(dev
, NULL
);
647 return dev_err_probe(dev
, status
, "no GPIO found\n");
649 status
= devm_acpi_dev_add_driver_gpios(dev
, ssam_acpi_gpios
);
654 /* Allocate controller. */
655 ctrl
= kzalloc(sizeof(*ctrl
), GFP_KERNEL
);
659 /* Initialize controller. */
660 status
= ssam_controller_init(ctrl
, serdev
);
662 dev_err_probe(dev
, status
, "failed to initialize ssam controller\n");
666 ssam_controller_lock(ctrl
);
668 /* Set up serdev device. */
669 serdev_device_set_drvdata(serdev
, ctrl
);
670 serdev_device_set_client_ops(serdev
, &ssam_serdev_ops
);
671 status
= serdev_device_open(serdev
);
673 dev_err_probe(dev
, status
, "failed to open serdev device\n");
677 status
= ssam_serdev_setup(ssh
, serdev
);
679 status
= dev_err_probe(dev
, status
, "failed to setup serdev\n");
683 /* Start controller. */
684 status
= ssam_controller_start(ctrl
);
688 ssam_controller_unlock(ctrl
);
691 * Initial SAM requests: Log version and notify default/init power
694 status
= ssam_log_firmware_version(ctrl
);
696 dev_err_probe(dev
, status
, "failed to get firmware version\n");
700 status
= ssam_ctrl_notif_d0_entry(ctrl
);
702 dev_err_probe(dev
, status
, "D0-entry notification failed\n");
706 status
= ssam_ctrl_notif_display_on(ctrl
);
708 dev_err_probe(dev
, status
, "display-on notification failed\n");
712 status
= sysfs_create_group(&dev
->kobj
, &ssam_sam_group
);
717 status
= ssam_irq_setup(ctrl
);
719 dev_err_probe(dev
, status
, "failed to setup IRQ\n");
723 /* Finally, set main controller reference. */
724 status
= ssam_try_set_controller(ctrl
);
725 if (WARN_ON(status
)) /* Currently, we're the only provider. */
729 * TODO: The EC can wake up the system via the associated GPIO interrupt
730 * in multiple situations. One of which is the remaining battery
731 * capacity falling below a certain threshold. Normally, we should
732 * use the device_init_wakeup function, however, the EC also seems
733 * to have other reasons for waking up the system and it seems
734 * that Windows has additional checks whether the system should be
735 * resumed. In short, this causes some spurious unwanted wake-ups.
736 * For now let's thus default power/wakeup to false.
738 device_set_wakeup_capable(dev
, true);
741 * When using DT, we have to register the platform hub driver manually,
742 * as it can't be matched based on top-level board compatible (like it
743 * does the ACPI case).
746 struct platform_device
*ph_pdev
=
747 platform_device_register_simple("surface_aggregator_platform_hub",
750 return dev_err_probe(dev
, PTR_ERR(ph_pdev
),
751 "Failed to register the platform hub driver\n");
755 acpi_dev_clear_dependencies(ssh
);
762 sysfs_remove_group(&dev
->kobj
, &ssam_sam_group
);
764 ssam_controller_lock(ctrl
);
765 ssam_controller_shutdown(ctrl
);
767 serdev_device_close(serdev
);
769 ssam_controller_destroy(ctrl
);
770 ssam_controller_unlock(ctrl
);
776 static void ssam_serial_hub_remove(struct serdev_device
*serdev
)
778 struct ssam_controller
*ctrl
= serdev_device_get_drvdata(serdev
);
781 /* Clear static reference so that no one else can get a new one. */
782 ssam_clear_controller();
784 /* Disable and free IRQ. */
787 sysfs_remove_group(&serdev
->dev
.kobj
, &ssam_sam_group
);
788 ssam_controller_lock(ctrl
);
790 /* Remove all client devices. */
791 ssam_remove_clients(&serdev
->dev
);
793 /* Act as if suspending to silence events. */
794 status
= ssam_ctrl_notif_display_off(ctrl
);
796 dev_err(&serdev
->dev
, "display-off notification failed: %d\n",
800 status
= ssam_ctrl_notif_d0_exit(ctrl
);
802 dev_err(&serdev
->dev
, "D0-exit notification failed: %d\n",
806 /* Shut down controller and remove serdev device reference from it. */
807 ssam_controller_shutdown(ctrl
);
809 /* Shut down actual transport. */
810 serdev_device_wait_until_sent(serdev
, 0);
811 serdev_device_close(serdev
);
813 /* Drop our controller reference. */
814 ssam_controller_unlock(ctrl
);
815 ssam_controller_put(ctrl
);
817 device_set_wakeup_capable(&serdev
->dev
, false);
820 static const struct acpi_device_id ssam_serial_hub_acpi_match
[] = {
824 MODULE_DEVICE_TABLE(acpi
, ssam_serial_hub_acpi_match
);
827 static const struct of_device_id ssam_serial_hub_of_match
[] = {
828 { .compatible
= "microsoft,surface-sam", },
831 MODULE_DEVICE_TABLE(of
, ssam_serial_hub_of_match
);
834 static struct serdev_device_driver ssam_serial_hub
= {
835 .probe
= ssam_serial_hub_probe
,
836 .remove
= ssam_serial_hub_remove
,
838 .name
= "surface_serial_hub",
839 .acpi_match_table
= ACPI_PTR(ssam_serial_hub_acpi_match
),
840 .of_match_table
= of_match_ptr(ssam_serial_hub_of_match
),
841 .pm
= &ssam_serial_hub_pm_ops
,
842 .shutdown
= ssam_serial_hub_shutdown
,
843 .probe_type
= PROBE_PREFER_ASYNCHRONOUS
,
848 /* -- Module setup. --------------------------------------------------------- */
850 static int __init
ssam_core_init(void)
854 status
= ssam_bus_register();
858 status
= ssh_ctrl_packet_cache_init();
862 status
= ssam_event_item_cache_init();
866 status
= serdev_device_driver_register(&ssam_serial_hub
);
873 ssam_event_item_cache_destroy();
875 ssh_ctrl_packet_cache_destroy();
877 ssam_bus_unregister();
881 subsys_initcall(ssam_core_init
);
883 static void __exit
ssam_core_exit(void)
885 serdev_device_driver_unregister(&ssam_serial_hub
);
886 ssam_event_item_cache_destroy();
887 ssh_ctrl_packet_cache_destroy();
888 ssam_bus_unregister();
890 module_exit(ssam_core_exit
);
892 MODULE_AUTHOR("Maximilian Luz <luzmaximilian@gmail.com>");
893 MODULE_DESCRIPTION("Subsystem and Surface Serial Hub driver for Surface System Aggregator Module");
894 MODULE_LICENSE("GPL");