* Kevin Hilman <khilman@xxxxxxxxxx> [231024 18:36]: > Tony Lindgren <tony@xxxxxxxxxxx> writes: > > > * Kevin Hilman <khilman@xxxxxxxxxx> [231023 21:31]: > >> Instead, what should be happening is that when `no_console_suspend` is > >> set, there should be an extra pm_runtime_get() which increases the > >> device usecount such that the device never runtime suspends, and thus > >> the domain will not get powered off. > > > > We already have the runtime PM usage count kept in the driver (unless > > there's a bug somewhere). The issue is that on suspend the power domain > > still gets shut down. > > > > I suspect that some of the SoC power domains get > > force shut down on suspend somewhere? > > If setting GENPD_FLAG_ALWAYS_ON works as this patch proposes, then a > force shutdown would override that genpd flag also, so I suspect the > runtime PM usage count is not correct. OK good point. > I quick skim of 8250_omap.c, and I don't see any pm_runtime_get() calls > that are conditional on no_console_suspend, which is what I would > suspect for the domain to stay on. If a serial console is attached, we now have runtime PM usage count always kept. Users can detach the console via sysfs as needed. See these two earlier commits from Andy: a3cb39d258ef ("serial: core: Allow detach and attach serial device for console") bedb404e91bb ("serial: 8250_port: Don't use power management for kernel console") Sounds like there's a bug somewhere. It's worth verifying if the runtime PM usage count is kept for 8250_omap on suspend. Thomas, care to check your test case with the attached debug hack and by adding a call for pm_runtime_get_usage_count() on the suspend path? Regards, Tony 8< ------------------------------- diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -129,6 +129,11 @@ static inline void pm_runtime_get_noresume(struct device *dev) atomic_inc(&dev->power.usage_count); } +static inline int pm_runtime_get_usage_count(struct device *dev) +{ + return atomic_read(&dev->power.usage_count); +} + /** * pm_runtime_put_noidle - Drop runtime PM usage counter of a device. * @dev: Target device.