diff mbox series

[v2] drm/omap: force runtime PM suspend on system suspend

Message ID 20200618095153.611071-1-tomi.valkeinen@ti.com (mailing list archive)
State New, archived
Headers show
Series [v2] drm/omap: force runtime PM suspend on system suspend | expand

Commit Message

Tomi Valkeinen June 18, 2020, 9:51 a.m. UTC
Use SET_LATE_SYSTEM_SLEEP_PM_OPS in DSS submodules to force runtime PM
suspend and resume.

We use suspend late version so that omapdrm's system suspend callback is
called first, as that will disable all the display outputs after which
it's safe to force DSS into suspend.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dispc.c | 1 +
 drivers/gpu/drm/omapdrm/dss/dsi.c   | 1 +
 drivers/gpu/drm/omapdrm/dss/dss.c   | 1 +
 drivers/gpu/drm/omapdrm/dss/venc.c  | 1 +
 4 files changed, 4 insertions(+)

Comments

Tony Lindgren June 18, 2020, 1:16 p.m. UTC | #1
* Tomi Valkeinen <tomi.valkeinen@ti.com> [200618 09:53]:
> Use SET_LATE_SYSTEM_SLEEP_PM_OPS in DSS submodules to force runtime PM
> suspend and resume.
> 
> We use suspend late version so that omapdrm's system suspend callback is
> called first, as that will disable all the display outputs after which
> it's safe to force DSS into suspend.

This looks like a nice way of doing it, would be good to have as a
regression fix for the -rc cycle:

Acked-by: Tony Lindgren <tony@atomide.com>
Tomi Valkeinen June 18, 2020, 2:01 p.m. UTC | #2
On 18/06/2020 16:16, Tony Lindgren wrote:
> * Tomi Valkeinen <tomi.valkeinen@ti.com> [200618 09:53]:
>> Use SET_LATE_SYSTEM_SLEEP_PM_OPS in DSS submodules to force runtime PM
>> suspend and resume.
>>
>> We use suspend late version so that omapdrm's system suspend callback is
>> called first, as that will disable all the display outputs after which
>> it's safe to force DSS into suspend.
> 
> This looks like a nice way of doing it, would be good to have as a
> regression fix for the -rc cycle:
> 
> Acked-by: Tony Lindgren <tony@atomide.com>

Thanks. Did you get the full suspend working? I still can't resume, unless I use pm_test to avoid 
the full suspend. So I'm still not sure if things really work.

  Tomi
Tony Lindgren June 18, 2020, 2:41 p.m. UTC | #3
* Tomi Valkeinen <tomi.valkeinen@ti.com> [200618 14:03]:
> On 18/06/2020 16:16, Tony Lindgren wrote:
> > * Tomi Valkeinen <tomi.valkeinen@ti.com> [200618 09:53]:
> > > Use SET_LATE_SYSTEM_SLEEP_PM_OPS in DSS submodules to force runtime PM
> > > suspend and resume.
> > > 
> > > We use suspend late version so that omapdrm's system suspend callback is
> > > called first, as that will disable all the display outputs after which
> > > it's safe to force DSS into suspend.
> > 
> > This looks like a nice way of doing it, would be good to have as a
> > regression fix for the -rc cycle:
> > 
> > Acked-by: Tony Lindgren <tony@atomide.com>
> 
> Thanks. Did you get the full suspend working? I still can't resume, unless I
> use pm_test to avoid the full suspend. So I'm still not sure if things
> really work.

I just tested my fixes branch at commit 80bf72598663 ("ARM: dts: am5729:
beaglebone-ai: fix rgmii phy-mode") with your patch and HDMI cable
attached and suspend and resume works for me:

Tested-by: Tony Lindgren <tony@atomide.com>

I did not have luck the last time I tried am437x-sk-evm, but that
seems like some separate regression that's been around for awhile.
I recall testing it successfully last fall at some point.

Regards,

Tony
Tony Lindgren June 18, 2020, 4:24 p.m. UTC | #4
* Tony Lindgren <tony@atomide.com> [200618 07:42]:
> I did not have luck the last time I tried am437x-sk-evm, but that
> seems like some separate regression that's been around for awhile.
> I recall testing it successfully last fall at some point.

OK I got am437x-sk-evm suspend and resume working again and
LCD console comes back after resume. I also had to apply the
panel-simple fix "drm/panel-simple: fix connector type for
newhaven_nhd_43_480272ef_atxl" to get LCD working again.

I was missing /lib/firmware/am335x-pm-firmware.elf after updating
my NFSroot file system. And FYI, here are the modules I now load
with my test script:

modprobe omap-mailbox
modprobe omap_remoteproc
modprobe wkup_m3_rproc
modprobe wkup_m3_ipc
modprobe pm33xx
modprobe rtc-omap
modprobe pwm-omap-dmtimer
modprobe pwm-tiecap
modprobe pwm_bl
modprobe edt-ft5x06		# on am437x-sk-evm
modprobe pixcir_i2c_ts		# NOT on am437x-sk-evm, only on am437x-gp-evm.dts
modprobe omapdrm
modprobe panel-simple
modprobe display-connector	# starting with v5.7-rc1
modprobe omapdss
modprobe panel-dpi
modprobe omap-dss

And then I get the following with rtcwake -m mem -s 5.

Sometimes cps and NFSroot seems to take few tens of seconds to
recover though.

Regards,

Tony

8< ------------------
[   33.481400] omapdss_dss 4832a000.dss: supply vdda_video not found, using dummy regulator
[   33.481573] DSS: OMAP DSS rev 2.0
[   33.485412] omapdss_dss 4832a000.dss: bound 4832a400.dispc (ops dispc_component_ops [omapdss])
[   33.485932] omapdrm omapdrm.0: DMM not available, disable DMM support
[   33.486322] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[   33.525740] Console: switching to colour frame buffer device 60x34
[   33.543690] omapdrm omapdrm.0: fb0: omapdrmdrmfb frame buffer device
[   33.544563] [drm] Initialized omapdrm 1.0.0 20110917 for omapdrm.0 on minor 0
[   40.196247] vmmcwl_fixed: disabling
[  124.230087] PM: suspend entry (deep)
[  124.230152] Filesystems sync: 0.000 seconds
[  124.233068] Freezing user space processes ... (elapsed 0.001 seconds) done.
[  124.234420] OOM killer disabled.
[  124.234424] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[  124.235607] WARNING: This platform does not support off-mode, entering DeepSleep suspend.
[  124.235623] printk: Suspending console(s) (use no_console_suspend to debug)
[  124.255315] cpsw 4a100000.ethernet eth0: Link is Down
[  124.260828] Disabling non-boot CPUs ...
[  124.260839] WARNING: This platform does not support off-mode, entering DeepSleep suspend.
[  124.260839] WARNING: This platform does not support off-mode, entering DeepSleep suspend.
[  124.260839] pm33xx pm33xx: PM: Could not transition all powerdomains to target state
[  124.260839] PM: Wakeup source RTC Alarm
[  124.260839] WARNING: This platform does not support off-mode, entering DeepSleep suspend.
[  124.271744] ti-sysc 4a101200.target-module: OCP softreset timed out
[  124.274498] cpsw 4a100000.ethernet: initializing cpsw version 1.15 (0)
[  124.415839] Micrel KSZ9031 Gigabit PHY 4a101000.mdio:04: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=4a101000.mdio:04, irq=POLL)
[  124.493879] OOM killer enabled.
[  124.493885] Restarting tasks ... done.
[  124.502993] PM: suspend exit
[  132.757778] cpsw 4a100000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
Tony Lindgren July 17, 2020, 4:28 p.m. UTC | #5
* Tomi Valkeinen <tomi.valkeinen@ti.com> [200618 09:53]:
> Use SET_LATE_SYSTEM_SLEEP_PM_OPS in DSS submodules to force runtime PM
> suspend and resume.
> 
> We use suspend late version so that omapdrm's system suspend callback is
> called first, as that will disable all the display outputs after which
> it's safe to force DSS into suspend.

This would be great to have merged as a fix for v5.8 as it fixes a
suspend and resume regression:

Fixes: cef766300353 ("drm/omap: Prepare DSS for probing without legacy platform data")
Tested-by: Tony Lindgren <tonY@atomide.com>
Tomi Valkeinen Aug. 4, 2020, 8:22 a.m. UTC | #6
Hi,

On 17/07/2020 19:28, Tony Lindgren wrote:
> * Tomi Valkeinen <tomi.valkeinen@ti.com> [200618 09:53]:
>> Use SET_LATE_SYSTEM_SLEEP_PM_OPS in DSS submodules to force runtime PM
>> suspend and resume.
>>
>> We use suspend late version so that omapdrm's system suspend callback is
>> called first, as that will disable all the display outputs after which
>> it's safe to force DSS into suspend.
> 
> This would be great to have merged as a fix for v5.8 as it fixes a
> suspend and resume regression:
> 
> Fixes: cef766300353 ("drm/omap: Prepare DSS for probing without legacy platform data")
> Tested-by: Tony Lindgren <tonY@atomide.com>
> 

I have pushed this to drm-misc-fixes. I added

Cc: stable@vger.kernel.org # v5.7+

 Tomi
diff mbox series

Patch

diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 6639ee9b05d3..48593932bddf 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -4915,6 +4915,7 @@  static int dispc_runtime_resume(struct device *dev)
 static const struct dev_pm_ops dispc_pm_ops = {
 	.runtime_suspend = dispc_runtime_suspend,
 	.runtime_resume = dispc_runtime_resume,
+	SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
 struct platform_driver omap_dispchw_driver = {
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 79ddfbfd1b58..eeccf40bae41 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -5467,6 +5467,7 @@  static int dsi_runtime_resume(struct device *dev)
 static const struct dev_pm_ops dsi_pm_ops = {
 	.runtime_suspend = dsi_runtime_suspend,
 	.runtime_resume = dsi_runtime_resume,
+	SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
 struct platform_driver omap_dsihw_driver = {
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index 4d5739fa4a5d..6ccbc29c4ce4 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -1614,6 +1614,7 @@  static int dss_runtime_resume(struct device *dev)
 static const struct dev_pm_ops dss_pm_ops = {
 	.runtime_suspend = dss_runtime_suspend,
 	.runtime_resume = dss_runtime_resume,
+	SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
 struct platform_driver omap_dsshw_driver = {
diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c
index 9701843ccf09..01ee6c50b663 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -902,6 +902,7 @@  static int venc_runtime_resume(struct device *dev)
 static const struct dev_pm_ops venc_pm_ops = {
 	.runtime_suspend = venc_runtime_suspend,
 	.runtime_resume = venc_runtime_resume,
+	SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
 static const struct of_device_id venc_of_match[] = {