serial: core: Start managing serial controllers to enable runtime PM
authorTony Lindgren <tony@atomide.com>
Thu, 25 May 2023 11:30:30 +0000 (14:30 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 May 2023 09:46:59 +0000 (10:46 +0100)
commit84a9582fd203063cd4d301204971ff2cd8327f1a
treed636cedba8d6f7f7f1c8cf1cce34e0be6139a78d
parentae62c49c0ceff20dc7c1fad4a5b8f91d64b4f628
serial: core: Start managing serial controllers to enable runtime PM

We want to enable runtime PM for serial port device drivers in a generic
way. To do this, we want to have the serial core layer manage the
registered physical serial controller devices.

To manage serial controllers, let's set up a struct bus and struct device
for the serial core controller as suggested by Greg and Jiri. The serial
core controller devices are children of the physical serial port device.
The serial core controller device is needed to support multiple different
kind of ports connected to single physical serial port device.

Let's also set up a struct device for the serial core port. The serial
core port instances are children of the serial core controller device.

With the serial core port device we can now flush pending TX on the
runtime PM resume as suggested by Johan.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Jiri Slaby <jirislaby@kernel.org>
Suggested-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230525113034.46880-1-tony@atomide.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_core.c
drivers/tty/serial/8250/8250_port.c
drivers/tty/serial/Makefile
drivers/tty/serial/serial_base.h [new file with mode: 0644]
drivers/tty/serial/serial_base_bus.c [new file with mode: 0644]
drivers/tty/serial/serial_core.c
drivers/tty/serial/serial_ctrl.c [new file with mode: 0644]
drivers/tty/serial/serial_port.c [new file with mode: 0644]
include/linux/serial_core.h