Skip to content

Commit 601f047

Browse files
Maitreyee Raorobclark
authored andcommitted
drm/msm/dp: add logs across DP driver for ease of debugging
Add trace points across the MSM DP driver to help debug interop issues. Changes in v2: - Got rid of redundant log messages. - Added %#x instead of 0x%x wherever required. - Got rid of __func__ calls in debug messages. - Added newline wherever missing. Changes in v3: - Got rid of redundant log messages. - Unstuck colon from printf specifier in various places. Changes in v4: - Changed goto statement and used if else-if Changes in v5: - Changed if else if statement, to not overwrite the ret variable multiple times. Changes in v6: - Changed a wrong log message. Signed-off-by: Maitreyee Rao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Stephen Boyd <[email protected]> Signed-off-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Rob Clark <[email protected]>
1 parent b9007a0 commit 601f047

File tree

5 files changed

+44
-35
lines changed

5 files changed

+44
-35
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ void dp_catalog_ctrl_mainlink_ctrl(struct dp_catalog *dp_catalog,
372372
struct dp_catalog_private *catalog = container_of(dp_catalog,
373373
struct dp_catalog_private, dp_catalog);
374374

375+
DRM_DEBUG_DP("enable=%d\n", enable);
375376
if (enable) {
376377
/*
377378
* To make sure link reg writes happens before other operation,
@@ -580,6 +581,7 @@ void dp_catalog_hpd_config_intr(struct dp_catalog *dp_catalog,
580581

581582
config = (en ? config | intr_mask : config & ~intr_mask);
582583

584+
DRM_DEBUG_DP("intr_mask=%#x config=%#x\n", intr_mask, config);
583585
dp_write_aux(catalog, REG_DP_DP_HPD_INT_MASK,
584586
config & DP_DP_HPD_INT_MASK);
585587
}
@@ -610,6 +612,7 @@ u32 dp_catalog_link_is_connected(struct dp_catalog *dp_catalog)
610612
u32 status;
611613

612614
status = dp_read_aux(catalog, REG_DP_DP_HPD_INT_STATUS);
615+
DRM_DEBUG_DP("aux status: %#x\n", status);
613616
status >>= DP_DP_HPD_STATE_STATUS_BITS_SHIFT;
614617
status &= DP_DP_HPD_STATE_STATUS_BITS_MASK;
615618

@@ -685,6 +688,7 @@ void dp_catalog_ctrl_send_phy_pattern(struct dp_catalog *dp_catalog,
685688
/* Make sure to clear the current pattern before starting a new one */
686689
dp_write_link(catalog, REG_DP_STATE_CTRL, 0x0);
687690

691+
DRM_DEBUG_DP("pattern: %#x\n", pattern);
688692
switch (pattern) {
689693
case DP_PHY_TEST_PATTERN_D10_2:
690694
dp_write_link(catalog, REG_DP_STATE_CTRL,
@@ -745,7 +749,7 @@ void dp_catalog_ctrl_send_phy_pattern(struct dp_catalog *dp_catalog,
745749
DP_STATE_CTRL_LINK_TRAINING_PATTERN4);
746750
break;
747751
default:
748-
DRM_DEBUG_DP("No valid test pattern requested:0x%x\n", pattern);
752+
DRM_DEBUG_DP("No valid test pattern requested: %#x\n", pattern);
749753
break;
750754
}
751755
}
@@ -928,7 +932,7 @@ void dp_catalog_audio_config_acr(struct dp_catalog *dp_catalog)
928932
select = dp_catalog->audio_data;
929933
acr_ctrl = select << 4 | BIT(31) | BIT(8) | BIT(14);
930934

931-
DRM_DEBUG_DP("select = 0x%x, acr_ctrl = 0x%x\n", select, acr_ctrl);
935+
DRM_DEBUG_DP("select: %#x, acr_ctrl: %#x\n", select, acr_ctrl);
932936

933937
dp_write_link(catalog, MMSS_DP_AUDIO_ACR_CTRL, acr_ctrl);
934938
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void dp_ctrl_push_idle(struct dp_ctrl *dp_ctrl)
120120
IDLE_PATTERN_COMPLETION_TIMEOUT_JIFFIES))
121121
pr_warn("PUSH_IDLE pattern timedout\n");
122122

123-
pr_debug("mainlink off done\n");
123+
DRM_DEBUG_DP("mainlink off done\n");
124124
}
125125

126126
static void dp_ctrl_config_ctrl(struct dp_ctrl_private *ctrl)
@@ -1011,6 +1011,8 @@ static int dp_ctrl_update_vx_px(struct dp_ctrl_private *ctrl)
10111011
u32 voltage_swing_level = link->phy_params.v_level;
10121012
u32 pre_emphasis_level = link->phy_params.p_level;
10131013

1014+
DRM_DEBUG_DP("voltage level: %d emphasis level: %d\n", voltage_swing_level,
1015+
pre_emphasis_level);
10141016
ret = dp_catalog_ctrl_update_vx_px(ctrl->catalog,
10151017
voltage_swing_level, pre_emphasis_level);
10161018

@@ -1382,6 +1384,7 @@ int dp_ctrl_host_init(struct dp_ctrl *dp_ctrl, bool flip, bool reset)
13821384
if (reset)
13831385
dp_catalog_ctrl_reset(ctrl->catalog);
13841386

1387+
DRM_DEBUG_DP("flip=%d\n", flip);
13851388
dp_catalog_ctrl_phy_reset(ctrl->catalog);
13861389
phy_init(phy);
13871390
dp_catalog_ctrl_enable_irq(ctrl->catalog, true);

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ static bool dp_display_is_ds_bridge(struct dp_panel *panel)
265265

266266
static bool dp_display_is_sink_count_zero(struct dp_display_private *dp)
267267
{
268+
DRM_DEBUG_DP("present=%#x sink_count=%d\n", dp->panel->dpcd[DP_DOWNSTREAMPORT_PRESENT],
269+
dp->link->sink_count);
268270
return dp_display_is_ds_bridge(dp->panel) &&
269271
(dp->link->sink_count == 0);
270272
}
@@ -296,6 +298,7 @@ static int dp_display_send_hpd_notification(struct dp_display_private *dp,
296298

297299
dp->dp_display.is_connected = hpd;
298300

301+
DRM_DEBUG_DP("hpd=%d\n", hpd);
299302
dp_display_send_hpd_event(&dp->dp_display);
300303

301304
return 0;
@@ -345,6 +348,7 @@ static void dp_display_host_init(struct dp_display_private *dp, int reset)
345348
{
346349
bool flip = false;
347350

351+
DRM_DEBUG_DP("core_initialized=%d\n", dp->core_initialized);
348352
if (dp->core_initialized) {
349353
DRM_DEBUG_DP("DP core already initialized\n");
350354
return;
@@ -447,8 +451,10 @@ static int dp_display_handle_irq_hpd(struct dp_display_private *dp)
447451
{
448452
u32 sink_request = dp->link->sink_request;
449453

454+
DRM_DEBUG_DP("%d\n", sink_request);
450455
if (dp->hpd_state == ST_DISCONNECTED) {
451456
if (sink_request & DP_LINK_STATUS_UPDATED) {
457+
DRM_DEBUG_DP("Disconnected sink_request: %d\n", sink_request);
452458
DRM_ERROR("Disconnected, no DP_LINK_STATUS_UPDATED\n");
453459
return -EINVAL;
454460
}
@@ -480,6 +486,7 @@ static int dp_display_usbpd_attention_cb(struct device *dev)
480486
rc = dp_link_process_request(dp->link);
481487
if (!rc) {
482488
sink_request = dp->link->sink_request;
489+
DRM_DEBUG_DP("hpd_state=%d sink_request=%d\n", dp->hpd_state, sink_request);
483490
if (sink_request & DS_PORT_STATUS_CHANGED)
484491
rc = dp_display_handle_port_ststus_changed(dp);
485492
else
@@ -502,6 +509,7 @@ static int dp_hpd_plug_handle(struct dp_display_private *dp, u32 data)
502509
mutex_lock(&dp->event_mutex);
503510

504511
state = dp->hpd_state;
512+
DRM_DEBUG_DP("hpd_state=%d\n", state);
505513
if (state == ST_DISPLAY_OFF || state == ST_SUSPENDED) {
506514
mutex_unlock(&dp->event_mutex);
507515
return 0;
@@ -637,6 +645,7 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data)
637645
/* start sentinel checking in case of missing uevent */
638646
dp_add_event(dp, EV_DISCONNECT_PENDING_TIMEOUT, 0, DP_TIMEOUT_5_SECOND);
639647

648+
DRM_DEBUG_DP("hpd_state=%d\n", state);
640649
/* signal the disconnect event early to ensure proper teardown */
641650
dp_display_handle_plugged_change(g_dp_display, false);
642651

@@ -695,6 +704,7 @@ static int dp_irq_hpd_handle(struct dp_display_private *dp, u32 data)
695704
if (ret == -ECONNRESET) { /* cable unplugged */
696705
dp->core_initialized = false;
697706
}
707+
DRM_DEBUG_DP("hpd_state=%d\n", state);
698708

699709
mutex_unlock(&dp->event_mutex);
700710

@@ -836,6 +846,7 @@ static int dp_display_enable(struct dp_display_private *dp, u32 data)
836846

837847
dp_display = g_dp_display;
838848

849+
DRM_DEBUG_DP("sink_count=%d\n", dp->link->sink_count);
839850
if (dp_display->power_on) {
840851
DRM_DEBUG_DP("Link already setup, return\n");
841852
return 0;
@@ -897,6 +908,7 @@ static int dp_display_disable(struct dp_display_private *dp, u32 data)
897908

898909
dp_display->power_on = false;
899910

911+
DRM_DEBUG_DP("sink count: %d\n", dp->link->sink_count);
900912
return 0;
901913
}
902914

@@ -1144,6 +1156,7 @@ static irqreturn_t dp_display_irq_handler(int irq, void *dev_id)
11441156

11451157
hpd_isr_status = dp_catalog_hpd_get_intr_status(dp->catalog);
11461158

1159+
DRM_DEBUG_DP("hpd isr status=%#x\n", hpd_isr_status);
11471160
if (hpd_isr_status & 0x0F) {
11481161
/* hpd related interrupts */
11491162
if (hpd_isr_status & DP_DP_HPD_PLUG_INT_MASK ||

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

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,43 +1027,29 @@ int dp_link_process_request(struct dp_link *dp_link)
10271027

10281028
if (link->request.test_requested == DP_TEST_LINK_EDID_READ) {
10291029
dp_link->sink_request |= DP_TEST_LINK_EDID_READ;
1030-
return ret;
1031-
}
1032-
1033-
ret = dp_link_process_ds_port_status_change(link);
1034-
if (!ret) {
1030+
} else if (!dp_link_process_ds_port_status_change(link)) {
10351031
dp_link->sink_request |= DS_PORT_STATUS_CHANGED;
1036-
return ret;
1037-
}
1038-
1039-
ret = dp_link_process_link_training_request(link);
1040-
if (!ret) {
1032+
} else if (!dp_link_process_link_training_request(link)) {
10411033
dp_link->sink_request |= DP_TEST_LINK_TRAINING;
1042-
return ret;
1043-
}
1044-
1045-
ret = dp_link_process_phy_test_pattern_request(link);
1046-
if (!ret) {
1034+
} else if (!dp_link_process_phy_test_pattern_request(link)) {
10471035
dp_link->sink_request |= DP_TEST_LINK_PHY_TEST_PATTERN;
1048-
return ret;
1049-
}
1050-
1051-
ret = dp_link_process_link_status_update(link);
1052-
if (!ret) {
1053-
dp_link->sink_request |= DP_LINK_STATUS_UPDATED;
1054-
return ret;
1055-
}
1056-
1057-
if (dp_link_is_video_pattern_requested(link)) {
1058-
ret = 0;
1059-
dp_link->sink_request |= DP_TEST_LINK_VIDEO_PATTERN;
1060-
}
1061-
1062-
if (dp_link_is_audio_pattern_requested(link)) {
1063-
dp_link->sink_request |= DP_TEST_LINK_AUDIO_PATTERN;
1064-
return -EINVAL;
1036+
} else {
1037+
ret = dp_link_process_link_status_update(link);
1038+
if (!ret) {
1039+
dp_link->sink_request |= DP_LINK_STATUS_UPDATED;
1040+
} else {
1041+
if (dp_link_is_video_pattern_requested(link)) {
1042+
ret = 0;
1043+
dp_link->sink_request |= DP_TEST_LINK_VIDEO_PATTERN;
1044+
}
1045+
if (dp_link_is_audio_pattern_requested(link)) {
1046+
dp_link->sink_request |= DP_TEST_LINK_AUDIO_PATTERN;
1047+
ret = -EINVAL;
1048+
}
1049+
}
10651050
}
10661051

1052+
DRM_DEBUG_DP("sink request=%#x", dp_link->sink_request);
10671053
return ret;
10681054
}
10691055

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ static int dp_power_clk_set_rate(struct dp_power_private *power,
208208

209209
int dp_power_clk_status(struct dp_power *dp_power, enum dp_pm_type pm_type)
210210
{
211+
DRM_DEBUG_DP("core_clk_on=%d link_clk_on=%d stream_clk_on=%d\n",
212+
dp_power->core_clks_on, dp_power->link_clks_on, dp_power->stream_clks_on);
213+
211214
if (pm_type == DP_CORE_PM)
212215
return dp_power->core_clks_on;
213216

0 commit comments

Comments
 (0)