On Mon, Sep 27, 2021 at 10:59:42AM -0700, Brian Norris wrote:
In commit 43c2de1002d2, we moved most HW configuration to bind(), but we didn't move the runtime PM management. Therefore, depending on initial boot state, runtime-PM workqueue delays, and other timing factors, we may disable our power domain in between the hardware configuration (bind()) and when we enable the display. This can cause us to lose hardware state and fail to configure our display. For example:
dw-mipi-dsi-rockchip ff968000.mipi: failed to write command FIFO panel-innolux-p079zca ff960000.mipi.0: failed to write command 0
or:
dw-mipi-dsi-rockchip ff968000.mipi: failed to write command FIFO panel-kingdisplay-kd097d04 ff960000.mipi.0: failed write init cmds: -110
We should match the runtime PM to the lifetime of the bind()/unbind() cycle.
Hmm, sorry to reply to my own patch so quickly, but after a bit more testing I'm finding we still have yet another problem here -- that suspend/resume does not work. For suspend/resume, drm_mode_config_helper_{suspend,resume}() are expecting to only do teardown/setup via disable()/enable() -- there is no re-bind() (which makes sense). But the DSI hardware state may be lost, so the resume-time enable() may find the panel initialization timing out yet again.
Possible solutions:
(1) I can add PM suspend()/resume() operations just to call dw_mipi_dsi_rockchip_config().
(2) Switch back to using mode_set() for HW configuration, like the downstream/BSP driver does (and the initial versions Rockchip and later Heiko were working on did the same), since that's always called at the right time before both panel and encoder enable(). That also happens to be where some other DSI drivers [1] do similar init.
Have we been avoiding (2) just because that doesn't really match the intended purpose of the callback? I can't find any cleaner callback for this at the moment, and I'd rather not try to introduce entirely new drm helper callbacks just for this particularly-unfriendly sequence.
I have a patch written for option (1), and may send a v3 soon to include that as well (because that's also a regression from the same commit).
Brian
[1] e.g., drivers/gpu/drm/bridge/nwl-dsi.c