Skip to content

Commit ea9f337

Browse files
Kuogee Hsiehrobclark
authored andcommitted
drm/msm/dp: reset dp controller only at boot up and pm_resume
DP_SW_RESET is the global SW reset that is used to initialize DP controller. If DP_SW_RESET executed during connection setup, two HPD related side effects may occurred, 1) pending HPD interrupts cleared unexpected 2) re start debounce logic which trigger another interrupt This patch only issue DP_SW_RESET at boot up and pm_resume. This patch also reinit video_comp before configure dp controller to avoid missing VIDEO_READY interrupt. Fixes: 9fc4184 ("drm/msm/dp: unplug interrupt missed after irq_hpd handler") Signed-off-by: Kuogee Hsieh <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Signed-off-by: Rob Clark <[email protected]>
1 parent c8d99bb commit ea9f337

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

drivers/gpu/drm/msm/dp/dp_ctrl.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,8 +1296,6 @@ static int dp_ctrl_setup_main_link(struct dp_ctrl_private *ctrl,
12961296
* transitioned to PUSH_IDLE. In order to start transmitting
12971297
* a link training pattern, we have to first do soft reset.
12981298
*/
1299-
if (*training_step == DP_TRAINING_1)
1300-
dp_catalog_ctrl_reset(ctrl->catalog);
13011299

13021300
ret = dp_ctrl_link_train(ctrl, cr, training_step);
13031301

@@ -1366,7 +1364,7 @@ static int dp_ctrl_enable_stream_clocks(struct dp_ctrl_private *ctrl)
13661364
return ret;
13671365
}
13681366

1369-
int dp_ctrl_host_init(struct dp_ctrl *dp_ctrl, bool flip)
1367+
int dp_ctrl_host_init(struct dp_ctrl *dp_ctrl, bool flip, bool reset)
13701368
{
13711369
struct dp_ctrl_private *ctrl;
13721370
struct dp_io *dp_io;
@@ -1383,6 +1381,9 @@ int dp_ctrl_host_init(struct dp_ctrl *dp_ctrl, bool flip)
13831381

13841382
ctrl->dp_ctrl.orientation = flip;
13851383

1384+
if (reset)
1385+
dp_catalog_ctrl_reset(ctrl->catalog);
1386+
13861387
dp_catalog_ctrl_phy_reset(ctrl->catalog);
13871388
phy_init(phy);
13881389
dp_catalog_ctrl_enable_irq(ctrl->catalog, true);
@@ -1492,18 +1493,14 @@ static int dp_ctrl_deinitialize_mainlink(struct dp_ctrl_private *ctrl)
14921493
return 0;
14931494
}
14941495

1495-
static void dp_ctrl_link_idle_reset(struct dp_ctrl_private *ctrl)
1496-
{
1497-
dp_ctrl_push_idle(&ctrl->dp_ctrl);
1498-
dp_catalog_ctrl_reset(ctrl->catalog);
1499-
}
1500-
15011496
static int dp_ctrl_link_maintenance(struct dp_ctrl_private *ctrl)
15021497
{
15031498
int ret = 0;
15041499
struct dp_cr_status cr;
15051500
int training_step = DP_TRAINING_NONE;
15061501

1502+
dp_ctrl_push_idle(&ctrl->dp_ctrl);
1503+
15071504
ctrl->dp_ctrl.pixel_rate = ctrl->panel->dp_mode.drm_mode.clock;
15081505

15091506
ret = dp_ctrl_setup_main_link(ctrl, &cr, &training_step);
@@ -1630,7 +1627,6 @@ void dp_ctrl_handle_sink_request(struct dp_ctrl *dp_ctrl)
16301627

16311628
if (sink_request & DP_TEST_LINK_TRAINING) {
16321629
dp_link_send_test_response(ctrl->link);
1633-
dp_ctrl_link_idle_reset(ctrl);
16341630
if (dp_ctrl_link_maintenance(ctrl)) {
16351631
DRM_ERROR("LM failed: TEST_LINK_TRAINING\n");
16361632
return;
@@ -1684,7 +1680,7 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)
16841680
break;
16851681
}
16861682

1687-
training_step = DP_TRAINING_1;
1683+
training_step = DP_TRAINING_NONE;
16881684
rc = dp_ctrl_setup_main_link(ctrl, &cr, &training_step);
16891685
if (rc == 0) {
16901686
/* training completed successfully */
@@ -1792,14 +1788,14 @@ int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl)
17921788
* Set up transfer unit values and set controller state to send
17931789
* video.
17941790
*/
1791+
reinit_completion(&ctrl->video_comp);
1792+
17951793
dp_ctrl_configure_source_params(ctrl);
17961794

17971795
dp_catalog_ctrl_config_msa(ctrl->catalog,
17981796
ctrl->link->link_params.rate,
17991797
ctrl->dp_ctrl.pixel_rate, dp_ctrl_use_fixed_nvid(ctrl));
18001798

1801-
reinit_completion(&ctrl->video_comp);
1802-
18031799
dp_ctrl_setup_tr_unit(ctrl);
18041800

18051801
dp_catalog_ctrl_state_ctrl(ctrl->catalog, DP_STATE_CTRL_SEND_VIDEO);

drivers/gpu/drm/msm/dp/dp_ctrl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct dp_ctrl {
1919
u32 pixel_rate;
2020
};
2121

22-
int dp_ctrl_host_init(struct dp_ctrl *dp_ctrl, bool flip);
22+
int dp_ctrl_host_init(struct dp_ctrl *dp_ctrl, bool flip, bool reset);
2323
void dp_ctrl_host_deinit(struct dp_ctrl *dp_ctrl);
2424
int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl);
2525
int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl);

drivers/gpu/drm/msm/dp/dp_display.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ static int dp_display_process_hpd_high(struct dp_display_private *dp)
350350
return rc;
351351
}
352352

353-
static void dp_display_host_init(struct dp_display_private *dp)
353+
static void dp_display_host_init(struct dp_display_private *dp, int reset)
354354
{
355355
bool flip = false;
356356

@@ -365,7 +365,7 @@ static void dp_display_host_init(struct dp_display_private *dp)
365365
dp_display_set_encoder_mode(dp);
366366

367367
dp_power_init(dp->power, flip);
368-
dp_ctrl_host_init(dp->ctrl, flip);
368+
dp_ctrl_host_init(dp->ctrl, flip, reset);
369369
dp_aux_init(dp->aux);
370370
dp->core_initialized = true;
371371
}
@@ -403,7 +403,7 @@ static int dp_display_usbpd_configure_cb(struct device *dev)
403403
goto end;
404404
}
405405

406-
dp_display_host_init(dp);
406+
dp_display_host_init(dp, false);
407407

408408
/*
409409
* set sink to normal operation mode -- D0
@@ -700,7 +700,7 @@ static int dp_irq_hpd_handle(struct dp_display_private *dp, u32 data)
700700
return 0;
701701
}
702702

703-
if (state == ST_CONNECT_PENDING) {
703+
if (state == ST_CONNECT_PENDING || state == ST_DISCONNECT_PENDING) {
704704
/* wait until ST_CONNECTED */
705705
dp_add_event(dp, EV_IRQ_HPD_INT, 0, 1); /* delay = 1 */
706706
mutex_unlock(&dp->event_mutex);
@@ -1012,7 +1012,7 @@ int dp_display_get_test_bpp(struct msm_dp *dp)
10121012
static void dp_display_config_hpd(struct dp_display_private *dp)
10131013
{
10141014

1015-
dp_display_host_init(dp);
1015+
dp_display_host_init(dp, true);
10161016
dp_catalog_ctrl_hpd_config(dp->catalog);
10171017

10181018
/* Enable interrupt first time
@@ -1266,7 +1266,7 @@ static int dp_pm_resume(struct device *dev)
12661266
dp->hpd_state = ST_DISCONNECTED;
12671267

12681268
/* turn on dp ctrl/phy */
1269-
dp_display_host_init(dp);
1269+
dp_display_host_init(dp, true);
12701270

12711271
dp_catalog_ctrl_hpd_config(dp->catalog);
12721272

@@ -1449,7 +1449,7 @@ int msm_dp_display_enable(struct msm_dp *dp, struct drm_encoder *encoder)
14491449
state = dp_display->hpd_state;
14501450

14511451
if (state == ST_DISPLAY_OFF)
1452-
dp_display_host_init(dp_display);
1452+
dp_display_host_init(dp_display, true);
14531453

14541454
dp_display_enable(dp_display, 0);
14551455

0 commit comments

Comments
 (0)