Quoting Kuogee Hsieh (2022-01-18 10:47:25) > Current DP drivers have regulators, clocks, irq and phy are grouped > together within a function and executed not in a symmetric manner. > This increase difficulty of code maintenance and limited code scalability. > This patch divides the driver life cycle of operation into four states, > resume (including booting up), dongle plugin, dongle unplugged and suspend. > Regulators, core clocks and irq are grouped together and enabled at resume > (or booting up) so that the DP controller is armed and ready to receive HPD > plugin interrupts. HPD plugin interrupt is generated when a dongle plugs > into DUT (device under test). Once HPD plugin interrupt is received, DP > controller will initialize phy so that dpcd read/write will function and > following link training can be proceeded successfully. DP phy will be > disabled after main link is teared down at end of unplugged HPD interrupt > handle triggered by dongle unplugged out of DUT. Finally regulators, code > clocks and irq are disabled at corresponding suspension. > > Changes in V2: > -- removed unnecessary dp_ctrl NULL check > -- removed unnecessary phy init_count and power_count DRM_DEBUG_DP logs > -- remove flip parameter out of dp_ctrl_irq_enable() > -- add fixes tag > > Changes in V3: > -- call dp_display_host_phy_init() instead of dp_ctrl_phy_init() at > dp_display_host_init() for eDP > > Changes in V4: > -- rewording commit text to match this commit changes > > Changes in V5: > -- rebase on top of msm-next branch > > Changes in V6: > -- delete flip variable > > Changes in V7: > -- dp_ctrl_irq_enable/disabe() merged into dp_ctrl_reset_irq_ctrl() > > Changes in V8: > -- add more detail comment regrading dp phy at dp_display_host_init() > > Changes in V9: > -- remove set phy_initialized to false when -ECONNRESET detected > > Changes in v10: > -- group into one series > > Changes in v11: > -- drop drm/msm/dp: dp_link_parse_sink_count() return immediately > if aux read > > Changes in v12: > -- move dp_display_host_phy_exit() after dp_display_host_deinit() > > Changes in v13: > -- do not execute phy_init until plugged_in interrupt for edp, same as DP. > > Changes in v14: > -- remove redundant dp->core_initialized = false form dp_pm_suspend. > > Changes in v15: > -- remove core_initialized flag check at both host_init and host_deinit > > Changes in v16: > -- remove dp_display_host_phy_exit core_initialized=false at dp_pm_suspend > > Changes in v17: > -- remove core_initialized checking before execute attention_cb() > > Changes in v18: > -- remove core_initialized checking at dp_pm_suspend > > Fixes: 8ede2ecc3e5e ("drm/msm/dp: Add DP compliance tests on Snapdragon Chipsets") > Signed-off-by: Kuogee Hsieh <quic_khsieh@xxxxxxxxxxx> > --- Reviewed-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>