On 09/06/2020 18:26, Tomi Valkeinen wrote:
On 09/06/2020 18:19, Tony Lindgren wrote:
But there's an extra runtime PM reference (dev.power.usage_count) that seems
to come out of nowhere. So when omap_drm_suspend is finished, there's still
usage_count of 1, and dispc never suspends fully.
Hmm no idea about that. My guess is that there might be an issue that was
masked earlier with omap_device calling the child runtime_suspend.
Yes. It's how PM works. It calls pm_runtime_get_noresume() before starting the suspend of a device. So I guess omapdrm's suspend has been broken all the time, but it was "fixed" by omap_device.
I think I might have an idea what is going wrong.
Before:
+----------------------+
|omap_device_pm_domain |
+---------------+------+------+
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ | deviceÂÂÂÂÂ |
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ +-------------+
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ | omap_device |
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ +-------------+
omap_device is embedded in DD device and PM handled by omap_device_pm_domain.
static int _od_suspend_noirq(struct device *dev)
{
...
ÂÂÂÂret = pm_generic_suspend_noirq(dev);
[1] ^^ device suspend_noirq call
ÂÂÂÂif (!ret && !pm_runtime_status_suspended(dev)) {
ÂÂÂÂÂÂÂ if (pm_generic_runtime_suspend(dev) == 0) {
[2] ^^ device pm_runtime_suspend force call
ÂÂÂÂÂÂÂÂÂÂÂ omap_device_idle(pdev);
[3] ^^ omap_device disable
ÂÂÂÂÂÂÂÂÂÂÂ od->flags |= OMAP_DEVICE_SUSPENDED;
ÂÂÂÂÂÂÂ }
ÂÂÂÂ}
ÂÂÂÂreturn ret;
}
Now:
+------------+
|ti sysc dev |
+-+----------+
 |
 |
 | +-------------+
 | | device |
 +-->+ |
ÂÂÂÂÂ +-------------+
With new approach the omap_device is not embedded in DD Device anymore,
instead ti-sysc (hwmod replacement) became parent of DD Device.
As result suspend sequence became the following
(Note. All PM runtime PUT calls became NOP during suspend by design):
device
|-> suspend() - in case of dss omap_drm_suspend() and Co if defined
|-> suspend_noirq() - in case of dss *not defined", equal to step [1] above
..
ti sysc dev (ti-sysc is parent, so called after device)
|-> sysc_noirq_suspend
ÂÂ |-> pm_runtime_force_suspend()
ÂÂÂÂ|-> sysc_runtime_suspend() - equal to step [3] above
And step [2] is missing as of now!
I think, suspend might be fixed if all devices, which are now child of ti-sysc, will do
pm_runtime_force_xxx() calls at noirq suspend stage by adding:
ÂÂÂÂSET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ pm_runtime_force_resume)
Am I missing smth?