drm/dp_mst: Factor out function to queue a topology probe work
PATCH 1/3 drm/dp_mst: Factor out function to queue a topology probe work
From: Imre Deak <[email protected]>
[ Upstream commit e9b36c5be2e7fdef2cc933c1dac50bd81881e9b8 ]
Factor out a function to queue a work for probing the topology, also used by the next patch.
--- drivers/gpu/drm/display/drm_dp_mst_topology.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/display/drm_dp_mst_topology.c +7 -2
@@ -2692,6 +2692,11 @@ static void drm_dp_mst_link_probe_work(struct work_struct *work)drm_kms_helper_hotplug_event (dev); } +static void drm_dp_mst_queue_probe_work (struct drm_dp_mst_topology_mgr *mgr) +{ +queue_work (system_long_wq, &mgr->work); +} +static bool drm_dp_validate_guid (struct drm_dp_mst_topology_mgr *mgr,u8 *guid) {
@@ -3643,7 +3648,7 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms/* Write reset payload */ drm_dp_dpcd_write_payload (mgr,0 ,0 ,0x3f ); -queue_work (system_long_wq, &mgr->work); +drm_dp_mst_queue_probe_work (mgr); ret =0 ; }else {
@@ -3766,7 +3771,7 @@ int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr,* state of our in-memory topology back into sync with reality. So, * restart the probing process as if we're probing a new hub */ -queue_work (system_long_wq, &mgr->work); +drm_dp_mst_queue_probe_work (mgr);mutex_unlock (&mgr->lock);if (sync) {
Signature · 1 line
2.47.2
PATCH 2/3 drm/dp_mst: Add a helper to queue a topology probe
From: Imre Deak <[email protected]>
[ Upstream commit dbaeef363ea54f4c18112874b77503c72ba60fec ]
A follow up i915 patch will need to reprobe the MST topology after the initial probing, add a helper for this.
--- drivers/gpu/drm/display/drm_dp_mst_topology.c | 27 +++++++++++++++++++ include/drm/display/drm_dp_mst_helper.h | 2 ++ 2 files changed, 29 insertions(+)
drivers/gpu/drm/display/drm_dp_mst_topology.c +27 -0
@@ -3685,6 +3685,33 @@ drm_dp_mst_topology_mgr_invalidate_mstb(struct drm_dp_mst_branch *mstb)drm_dp_mst_topology_mgr_invalidate_mstb (port->mstb); } +/** +* drm_dp_mst_topology_queue_probe - Queue a topology probe +* @mgr: manager to probe +* +* Queue a work to probe the MST topology. Driver's should call this only to +* sync the topology's HW->SW state after the MST link's parameters have +* changed in a way the state could've become out-of-sync. This is the case +* for instance when the link rate between the source and first downstream +* branch device has switched between UHBR and non-UHBR rates. Except of those +* cases - for instance when a sink gets plugged/unplugged to a port - the SW +* state will get updated automatically via MST UP message notifications. +*/ +void drm_dp_mst_topology_queue_probe (struct drm_dp_mst_topology_mgr *mgr) +{ +mutex_lock (&mgr->lock); + +if (drm_WARN_ON (mgr->dev, !mgr->mst_state || !mgr->mst_primary)) + goto out_unlock; + +drm_dp_mst_topology_mgr_invalidate_mstb (mgr->mst_primary); +drm_dp_mst_queue_probe_work (mgr); + +out_unlock: +mutex_unlock (&mgr->lock); +} +EXPORT_SYMBOL (drm_dp_mst_topology_queue_probe); +/** * drm_dp_mst_topology_mgr_suspend() - suspend the MST manager * @mgr: manager to suspend
include/drm/display/drm_dp_mst_helper.h +2 -0
@@ -859,6 +859,8 @@ int drm_dp_check_act_status(struct drm_dp_mst_topology_mgr *mgr);void drm_dp_mst_dump_topology (struct seq_file *m,struct drm_dp_mst_topology_mgr *mgr); +void drm_dp_mst_topology_queue_probe (struct drm_dp_mst_topology_mgr *mgr); +void drm_dp_mst_topology_mgr_suspend (struct drm_dp_mst_topology_mgr *mgr); int __must_check drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr,
Signature · 1 line
2.47.2
PATCH 3/3 drm/amd/display: Don't write DP_MSTM_CTRL after LT
In reply to Thadeu Lima de Souza CascardoFrom: Wayne Lin <[email protected]>
[ Upstream commit bc068194f548ef1f230d96c4398046bf59165992 ]
[Why]
Observe after suspend/resme, we can't light up mst monitors under specific mst hub. The reason is that driver still writes DPCD DP_MSTM_CTRL after LT. It's forbidden even we write the same value for that dpcd register.
[How]
We already resume the mst branch device dpcd settings during resume_mst_branch_status(). Leverage drm_dp_mst_topology_queue_probe() to only probe the topology, not calling drm_dp_mst_topology_mgr_resume() which will set DP_MSTM_CTRL as well.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -12
@@ -2825,8 +2825,7 @@ static int dm_resume(void *handle)struct dm_atomic_state *dm_state =to_dm_atomic_state (dm->atomic_obj.state);enum dc_connection_type new_connection_type = dc_connection_none;struct dc_state *dc_state; -int i, r, j, ret; -bool need_hotplug = false; +int i, r, j;if (amdgpu_in_reset (adev)) { dc_state = dm->cached_dc_state;
@@ -3003,23 +3002,16 @@ static int dm_resume(void *handle) aconnector->mst_root)continue ; - ret =drm_dp_mst_topology_mgr_resume (&aconnector->mst_mgr, true); - -if (ret <0 ) { -dm_helpers_dp_mst_stop_top_mgr (aconnector->dc_link->ctx, - aconnector->dc_link); - need_hotplug = true; - } +drm_dp_mst_topology_queue_probe (&aconnector->mst_mgr); }drm_connector_list_iter_end (&iter); -if (need_hotplug) -drm_kms_helper_hotplug_event (ddev); -amdgpu_dm_irq_resume_late (adev);amdgpu_dm_smu_write_watermarks_table (adev); +drm_kms_helper_hotplug_event (ddev); +return 0 ; }
Signature · 1 line
2.47.2