Line data Source code
1 : // SPDX-License-Identifier: GPL-2.0+
2 : /*
3 : * Serial core controller driver
4 : *
5 : * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
6 : * Author: Tony Lindgren <[email protected]>
7 : *
8 : * This driver manages the serial core controller struct device instances.
9 : * The serial core controller devices are children of the physical serial
10 : * port device.
11 : */
12 :
13 : #include <linux/device.h>
14 : #include <linux/module.h>
15 : #include <linux/pm_runtime.h>
16 : #include <linux/serial_core.h>
17 : #include <linux/spinlock.h>
18 :
19 : #include "serial_base.h"
20 :
21 0 : static int serial_ctrl_probe(struct device *dev)
22 : {
23 0 : pm_runtime_enable(dev);
24 :
25 0 : return 0;
26 : }
27 :
28 0 : static int serial_ctrl_remove(struct device *dev)
29 : {
30 0 : pm_runtime_disable(dev);
31 :
32 0 : return 0;
33 : }
34 :
35 : /*
36 : * Serial core controller device init functions. Note that the physical
37 : * serial port device driver may not have completed probe at this point.
38 : */
39 0 : int serial_ctrl_register_port(struct uart_driver *drv, struct uart_port *port)
40 : {
41 0 : return serial_core_register_port(drv, port);
42 : }
43 :
44 0 : void serial_ctrl_unregister_port(struct uart_driver *drv, struct uart_port *port)
45 : {
46 0 : serial_core_unregister_port(drv, port);
47 0 : }
48 :
49 : static struct device_driver serial_ctrl_driver = {
50 : .name = "ctrl",
51 : .suppress_bind_attrs = true,
52 : .probe = serial_ctrl_probe,
53 : .remove = serial_ctrl_remove,
54 : };
55 :
56 0 : int serial_base_ctrl_init(void)
57 : {
58 0 : return serial_base_driver_register(&serial_ctrl_driver);
59 : }
60 :
61 0 : void serial_base_ctrl_exit(void)
62 : {
63 0 : serial_base_driver_unregister(&serial_ctrl_driver);
64 0 : }
65 :
66 : MODULE_AUTHOR("Tony Lindgren <[email protected]>");
67 : MODULE_DESCRIPTION("Serial core controller driver");
68 : MODULE_LICENSE("GPL");
|