Commit d4ad4eca authored by Ville Syrjälä's avatar Ville Syrjälä

drm/dp: Include the AUX CH name in the debug messages

To make it easier to figure out what caused a particular debug
message let's print out aux->name.

v2: Convert drm_dp_send_real_edid_checksum() too

Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200514184040.20700-1-ville.syrjala@linux.intel.comAcked-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 119c53d2
...@@ -258,7 +258,8 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request, ...@@ -258,7 +258,8 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request,
err = ret; err = ret;
} }
DRM_DEBUG_KMS("Too many retries, giving up. First error: %d\n", err); DRM_DEBUG_KMS("%s: Too many retries, giving up. First error: %d\n",
aux->name, err);
ret = err; ret = err;
unlock: unlock:
...@@ -377,43 +378,44 @@ bool drm_dp_send_real_edid_checksum(struct drm_dp_aux *aux, ...@@ -377,43 +378,44 @@ bool drm_dp_send_real_edid_checksum(struct drm_dp_aux *aux,
if (drm_dp_dpcd_read(aux, DP_DEVICE_SERVICE_IRQ_VECTOR, if (drm_dp_dpcd_read(aux, DP_DEVICE_SERVICE_IRQ_VECTOR,
&auto_test_req, 1) < 1) { &auto_test_req, 1) < 1) {
DRM_ERROR("DPCD failed read at register 0x%x\n", DRM_ERROR("%s: DPCD failed read at register 0x%x\n",
DP_DEVICE_SERVICE_IRQ_VECTOR); aux->name, DP_DEVICE_SERVICE_IRQ_VECTOR);
return false; return false;
} }
auto_test_req &= DP_AUTOMATED_TEST_REQUEST; auto_test_req &= DP_AUTOMATED_TEST_REQUEST;
if (drm_dp_dpcd_read(aux, DP_TEST_REQUEST, &link_edid_read, 1) < 1) { if (drm_dp_dpcd_read(aux, DP_TEST_REQUEST, &link_edid_read, 1) < 1) {
DRM_ERROR("DPCD failed read at register 0x%x\n", DRM_ERROR("%s: DPCD failed read at register 0x%x\n",
DP_TEST_REQUEST); aux->name, DP_TEST_REQUEST);
return false; return false;
} }
link_edid_read &= DP_TEST_LINK_EDID_READ; link_edid_read &= DP_TEST_LINK_EDID_READ;
if (!auto_test_req || !link_edid_read) { if (!auto_test_req || !link_edid_read) {
DRM_DEBUG_KMS("Source DUT does not support TEST_EDID_READ\n"); DRM_DEBUG_KMS("%s: Source DUT does not support TEST_EDID_READ\n",
aux->name);
return false; return false;
} }
if (drm_dp_dpcd_write(aux, DP_DEVICE_SERVICE_IRQ_VECTOR, if (drm_dp_dpcd_write(aux, DP_DEVICE_SERVICE_IRQ_VECTOR,
&auto_test_req, 1) < 1) { &auto_test_req, 1) < 1) {
DRM_ERROR("DPCD failed write at register 0x%x\n", DRM_ERROR("%s: DPCD failed write at register 0x%x\n",
DP_DEVICE_SERVICE_IRQ_VECTOR); aux->name, DP_DEVICE_SERVICE_IRQ_VECTOR);
return false; return false;
} }
/* send back checksum for the last edid extension block data */ /* send back checksum for the last edid extension block data */
if (drm_dp_dpcd_write(aux, DP_TEST_EDID_CHECKSUM, if (drm_dp_dpcd_write(aux, DP_TEST_EDID_CHECKSUM,
&real_edid_checksum, 1) < 1) { &real_edid_checksum, 1) < 1) {
DRM_ERROR("DPCD failed write at register 0x%x\n", DRM_ERROR("%s: DPCD failed write at register 0x%x\n",
DP_TEST_EDID_CHECKSUM); aux->name, DP_TEST_EDID_CHECKSUM);
return false; return false;
} }
test_resp |= DP_TEST_EDID_CHECKSUM_WRITE; test_resp |= DP_TEST_EDID_CHECKSUM_WRITE;
if (drm_dp_dpcd_write(aux, DP_TEST_RESPONSE, &test_resp, 1) < 1) { if (drm_dp_dpcd_write(aux, DP_TEST_RESPONSE, &test_resp, 1) < 1) {
DRM_ERROR("DPCD failed write at register 0x%x\n", DRM_ERROR("%s: DPCD failed write at register 0x%x\n",
DP_TEST_RESPONSE); aux->name, DP_TEST_RESPONSE);
return false; return false;
} }
...@@ -738,10 +740,11 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) ...@@ -738,10 +740,11 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
* Avoid spamming the kernel log with timeout errors. * Avoid spamming the kernel log with timeout errors.
*/ */
if (ret == -ETIMEDOUT) if (ret == -ETIMEDOUT)
DRM_DEBUG_KMS_RATELIMITED("transaction timed out\n"); DRM_DEBUG_KMS_RATELIMITED("%s: transaction timed out\n",
aux->name);
else else
DRM_DEBUG_KMS("transaction failed: %d\n", ret); DRM_DEBUG_KMS("%s: transaction failed: %d\n",
aux->name, ret);
return ret; return ret;
} }
...@@ -755,11 +758,12 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) ...@@ -755,11 +758,12 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
break; break;
case DP_AUX_NATIVE_REPLY_NACK: case DP_AUX_NATIVE_REPLY_NACK:
DRM_DEBUG_KMS("native nack (result=%d, size=%zu)\n", ret, msg->size); DRM_DEBUG_KMS("%s: native nack (result=%d, size=%zu)\n",
aux->name, ret, msg->size);
return -EREMOTEIO; return -EREMOTEIO;
case DP_AUX_NATIVE_REPLY_DEFER: case DP_AUX_NATIVE_REPLY_DEFER:
DRM_DEBUG_KMS("native defer\n"); DRM_DEBUG_KMS("%s: native defer\n", aux->name);
/* /*
* We could check for I2C bit rate capabilities and if * We could check for I2C bit rate capabilities and if
* available adjust this interval. We could also be * available adjust this interval. We could also be
...@@ -773,7 +777,8 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) ...@@ -773,7 +777,8 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
continue; continue;
default: default:
DRM_ERROR("invalid native reply %#04x\n", msg->reply); DRM_ERROR("%s: invalid native reply %#04x\n",
aux->name, msg->reply);
return -EREMOTEIO; return -EREMOTEIO;
} }
...@@ -788,13 +793,13 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) ...@@ -788,13 +793,13 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
return ret; return ret;
case DP_AUX_I2C_REPLY_NACK: case DP_AUX_I2C_REPLY_NACK:
DRM_DEBUG_KMS("I2C nack (result=%d, size=%zu)\n", DRM_DEBUG_KMS("%s: I2C nack (result=%d, size=%zu)\n",
ret, msg->size); aux->name, ret, msg->size);
aux->i2c_nack_count++; aux->i2c_nack_count++;
return -EREMOTEIO; return -EREMOTEIO;
case DP_AUX_I2C_REPLY_DEFER: case DP_AUX_I2C_REPLY_DEFER:
DRM_DEBUG_KMS("I2C defer\n"); DRM_DEBUG_KMS("%s: I2C defer\n", aux->name);
/* DP Compliance Test 4.2.2.5 Requirement: /* DP Compliance Test 4.2.2.5 Requirement:
* Must have at least 7 retries for I2C defers on the * Must have at least 7 retries for I2C defers on the
* transaction to pass this test * transaction to pass this test
...@@ -808,12 +813,13 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) ...@@ -808,12 +813,13 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
continue; continue;
default: default:
DRM_ERROR("invalid I2C reply %#04x\n", msg->reply); DRM_ERROR("%s: invalid I2C reply %#04x\n",
aux->name, msg->reply);
return -EREMOTEIO; return -EREMOTEIO;
} }
} }
DRM_DEBUG_KMS("too many retries, giving up\n"); DRM_DEBUG_KMS("%s: Too many retries, giving up\n", aux->name);
return -EREMOTEIO; return -EREMOTEIO;
} }
...@@ -842,8 +848,8 @@ static int drm_dp_i2c_drain_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *o ...@@ -842,8 +848,8 @@ static int drm_dp_i2c_drain_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *o
return err == 0 ? -EPROTO : err; return err == 0 ? -EPROTO : err;
if (err < msg.size && err < ret) { if (err < msg.size && err < ret) {
DRM_DEBUG_KMS("Partial I2C reply: requested %zu bytes got %d bytes\n", DRM_DEBUG_KMS("%s: Partial I2C reply: requested %zu bytes got %d bytes\n",
msg.size, err); aux->name, msg.size, err);
ret = err; ret = err;
} }
...@@ -1022,11 +1028,12 @@ static void drm_dp_aux_crc_work(struct work_struct *work) ...@@ -1022,11 +1028,12 @@ static void drm_dp_aux_crc_work(struct work_struct *work)
} }
if (ret == -EAGAIN) { if (ret == -EAGAIN) {
DRM_DEBUG_KMS("Get CRC failed after retrying: %d\n", DRM_DEBUG_KMS("%s: Get CRC failed after retrying: %d\n",
ret); aux->name, ret);
continue; continue;
} else if (ret) { } else if (ret) {
DRM_DEBUG_KMS("Failed to get a CRC: %d\n", ret); DRM_DEBUG_KMS("%s: Failed to get a CRC: %d\n",
aux->name, ret);
continue; continue;
} }
...@@ -1389,8 +1396,8 @@ int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc, ...@@ -1389,8 +1396,8 @@ int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc,
dev_id_len = strnlen(ident->device_id, sizeof(ident->device_id)); dev_id_len = strnlen(ident->device_id, sizeof(ident->device_id));
DRM_DEBUG_KMS("DP %s: OUI %*phD dev-ID %*pE HW-rev %d.%d SW-rev %d.%d quirks 0x%04x\n", DRM_DEBUG_KMS("%s: DP %s: OUI %*phD dev-ID %*pE HW-rev %d.%d SW-rev %d.%d quirks 0x%04x\n",
is_branch ? "branch" : "sink", aux->name, is_branch ? "branch" : "sink",
(int)sizeof(ident->oui), ident->oui, (int)sizeof(ident->oui), ident->oui,
dev_id_len, ident->device_id, dev_id_len, ident->device_id,
ident->hw_rev >> 4, ident->hw_rev & 0xf, ident->hw_rev >> 4, ident->hw_rev & 0xf,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment