69 lines · c
1// SPDX-License-Identifier: GPL-2.0+2/*3 * Serial core controller driver4 *5 * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/6 * Author: Tony Lindgren <tony@atomide.com>7 *8 * This driver manages the serial core controller struct device instances.9 * The serial core controller devices are children of the physical serial10 * 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 21static int serial_ctrl_probe(struct device *dev)22{23 pm_runtime_enable(dev);24 25 return 0;26}27 28static int serial_ctrl_remove(struct device *dev)29{30 pm_runtime_disable(dev);31 32 return 0;33}34 35/*36 * Serial core controller device init functions. Note that the physical37 * serial port device driver may not have completed probe at this point.38 */39int serial_ctrl_register_port(struct uart_driver *drv, struct uart_port *port)40{41 return serial_core_register_port(drv, port);42}43 44void serial_ctrl_unregister_port(struct uart_driver *drv, struct uart_port *port)45{46 serial_core_unregister_port(drv, port);47}48 49static 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 56int serial_base_ctrl_init(void)57{58 return serial_base_driver_register(&serial_ctrl_driver);59}60 61void serial_base_ctrl_exit(void)62{63 serial_base_driver_unregister(&serial_ctrl_driver);64}65 66MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");67MODULE_DESCRIPTION("Serial core controller driver");68MODULE_LICENSE("GPL");69