Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm/dp: Account for the timeout in wait_hpd_asserted() callback

The DP wait_hpd_asserted() callback is passed a timeout which
indicates how long we should wait for HPD. This timeout was being
ignored in the MSM DP implementation and instead a hardcoded 500 ms
timeout was used. Fix it to use the proper timeout.

As part of this we move the hardcoded 500 ms number into the AUX
transfer function, which isn't given a timeout. The wait in the AUX
transfer function will be removed in a future commit.

Fixes: e2969ee30252 ("drm/msm/dp: move of_dp_aux_populate_bus() to eDP probe()")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/583128/
Link: https://lore.kernel.org/r/20240315143621.v2.2.I7758d18a1773821fa39c034b16a12ef3f18a51ee@changeid
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

authored by

Douglas Anderson and committed by
Dmitry Baryshkov
c8520d5e 5d1a7493

+9 -6
+3 -2
drivers/gpu/drm/msm/dp/dp_aux.c
··· 325 325 * avoid ever doing the extra long wait for DP. 326 326 */ 327 327 if (aux->is_edp) { 328 - ret = dp_catalog_aux_wait_for_hpd_connect_state(aux->catalog); 328 + ret = dp_catalog_aux_wait_for_hpd_connect_state(aux->catalog, 329 + 500000); 329 330 if (ret) { 330 331 DRM_DEBUG_DP("Panel not ready for aux transactions\n"); 331 332 goto exit; ··· 534 533 aux = container_of(dp_aux, struct dp_aux_private, dp_aux); 535 534 536 535 pm_runtime_get_sync(aux->dev); 537 - ret = dp_catalog_aux_wait_for_hpd_connect_state(aux->catalog); 536 + ret = dp_catalog_aux_wait_for_hpd_connect_state(aux->catalog, wait_us); 538 537 pm_runtime_put_sync(aux->dev); 539 538 540 539 return ret;
+4 -3
drivers/gpu/drm/msm/dp/dp_catalog.c
··· 263 263 dp_write_aux(catalog, REG_DP_AUX_CTRL, aux_ctrl); 264 264 } 265 265 266 - int dp_catalog_aux_wait_for_hpd_connect_state(struct dp_catalog *dp_catalog) 266 + int dp_catalog_aux_wait_for_hpd_connect_state(struct dp_catalog *dp_catalog, 267 + unsigned long wait_us) 267 268 { 268 269 u32 state; 269 270 struct dp_catalog_private *catalog = container_of(dp_catalog, 270 271 struct dp_catalog_private, dp_catalog); 271 272 272 - /* poll for hpd connected status every 2ms and timeout after 500ms */ 273 + /* poll for hpd connected status every 2ms and timeout after wait_us */ 273 274 return readl_poll_timeout(catalog->io.aux.base + 274 275 REG_DP_DP_HPD_INT_STATUS, 275 276 state, state & DP_DP_HPD_STATE_STATUS_CONNECTED, 276 - 2000, 500000); 277 + min(wait_us, 2000), wait_us); 277 278 } 278 279 279 280 static void dump_regs(void __iomem *base, int len)
+2 -1
drivers/gpu/drm/msm/dp/dp_catalog.h
··· 87 87 int dp_catalog_aux_clear_hw_interrupts(struct dp_catalog *dp_catalog); 88 88 void dp_catalog_aux_reset(struct dp_catalog *dp_catalog); 89 89 void dp_catalog_aux_enable(struct dp_catalog *dp_catalog, bool enable); 90 - int dp_catalog_aux_wait_for_hpd_connect_state(struct dp_catalog *dp_catalog); 90 + int dp_catalog_aux_wait_for_hpd_connect_state(struct dp_catalog *dp_catalog, 91 + unsigned long wait_us); 91 92 u32 dp_catalog_aux_get_irq(struct dp_catalog *dp_catalog); 92 93 93 94 /* DP Controller APIs */