serial_ctrl.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 <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 serial
  10. * port device.
  11. */
  12. #include <linux/device.h>
  13. #include <linux/module.h>
  14. #include <linux/pm_runtime.h>
  15. #include <linux/serial_core.h>
  16. #include <linux/spinlock.h>
  17. #include "serial_base.h"
  18. static int serial_ctrl_probe(struct device *dev)
  19. {
  20. pm_runtime_enable(dev);
  21. return 0;
  22. }
  23. static int serial_ctrl_remove(struct device *dev)
  24. {
  25. pm_runtime_disable(dev);
  26. return 0;
  27. }
  28. /*
  29. * Serial core controller device init functions. Note that the physical
  30. * serial port device driver may not have completed probe at this point.
  31. */
  32. int serial_ctrl_register_port(struct uart_driver *drv, struct uart_port *port)
  33. {
  34. return serial_core_register_port(drv, port);
  35. }
  36. void serial_ctrl_unregister_port(struct uart_driver *drv, struct uart_port *port)
  37. {
  38. serial_core_unregister_port(drv, port);
  39. }
  40. static struct device_driver serial_ctrl_driver = {
  41. .name = "ctrl",
  42. .suppress_bind_attrs = true,
  43. .probe = serial_ctrl_probe,
  44. .remove = serial_ctrl_remove,
  45. };
  46. int serial_base_ctrl_init(void)
  47. {
  48. return serial_base_driver_register(&serial_ctrl_driver);
  49. }
  50. void serial_base_ctrl_exit(void)
  51. {
  52. serial_base_driver_unregister(&serial_ctrl_driver);
  53. }
  54. MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
  55. MODULE_DESCRIPTION("Serial core controller driver");
  56. MODULE_LICENSE("GPL");