Re: [PATCH v3 1/2] serial: core: Start managing serial controllers to enable runtime PM

Tony Lindgren
2022-11-28T06:45:15Z

Hi,

* Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> [221125 14:02]:
> On Wed, 23 Nov 2022, Tony Lindgren wrote:
> > + /*
> > + * Keep the port device enabled unless autosuspend is supported.
> > + * Released on port shutdown.
> > + */
> > + if (!controller->supports_autosuspend) {
> > + ret = pm_runtime_resume_and_get(dev);
>
> Should this be done regardless of autosuspend if the port is console?

Well hopefully no need to check anything here for the console unless
enabled state needs to be inherited from the early console.

Note that with what Jiri is proposing, we can just unconditionally do the
pm_runtime_resume_and_get() here on the generic serial port controller
struct device. We can also leave out the tinkering of the serial port
hardware struct device.

The hardware serial port controller drivers that do support autosuspend
can just decrement the runtime PM usage count for the generic serial port
controller child device as needed to enable aggressive PM.

> There's a problem in the current place where this being called from
> though, uart_console_enabled() doesn't return the correct value with at
> least some devices this early:
>
> https://lore.kernel.org/linux-serial/AS8PR04MB84047F39CD10C00CEE29213F92219@AS8PR04MB8404.eurprd04.prod.outlook.com/

OK. Seems the issues with the boot console and early serial port struct
device or whatever might be missing are there even without runtime PM.

Regards,

Tony