Skip to content

drm: cadence: Fix runtime suspend logic

This avoids calling into runtime resume

While dusting off something different I noticed I had that sitting here and it still applies. This avoids calling into cdns_dp_pm_runtime_resume which should save some power although I could only measure minimal gains (if any). I tested that it doesn't break display hotplug.

So the odd logic in the driver got me puzzled and I had a closer look. There were several errors:

  • the bridge enabled autosuspend but never bothered to tell whether it was still busy (so let's just drop that)
  • the phy driver forgot to unset that the phy was already configured hence configured it over and over again
  • the extcon hook didn't distinguish plug from unplug so the phy driver could never go into suspend (which didn't matter as the suspend hookd didn't do anything)
  • the bridge's suspend hook was empty (IIRC since we had problems powering the phy back up)

I (hopefully) fixed those and then added phy power down to the bridges suspend hook (which in fact is the suspend hook of the phy due the way those are intermixed) and in my tests

  • power draw went down significantly on unplug
  • the nextdock still lights up as exected even with multiple plugs

Before after unplug (redpine wifi on, modem and display off):

# cat /sys/devices/platform/soc@0/32c00000.bus/32c00000.hdmi/power/runtime_status 
active
#   cat /sys//devices/platform/soc@0/30800000.bus/30a50000.i2c/i2c-3/3-0036/power_supply/max170xx_battery/current_avg
-325247

Before after unplug (redpine wifi on, modem and display off):

# cat /sys/devices/platform/soc@0/32c00000.bus/32c00000.hdmi/power/runtime_status 
suspended
#   cat /sys//devices/platform/soc@0/30800000.bus/30a50000.i2c/i2c-3/3-0036/power_supply/max170xx_battery/current_avg
-268071

As I only gave this a quick test I'd be happy to hear if this makes any positive or negative impact.

Hopefully helps #242

Edited by Guido Gunther

Merge request reports