summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2019-01-22 15:03:00 -0500
committerVille Syrjälä <ville.syrjala@linux.intel.com>2019-01-30 16:23:13 -0500
commit45bbda1e35f4943fec6522ef0cdb63cb9ab5780b (patch)
tree70c107eb334fd207bee38e85a877e68c370d5c59
parentd9f7bb56c2925ea0641fe5121b954acc6a873605 (diff)
drm/dp/mst: Provide defines for ACK vs. NAK reply type
Make the code a bit easier to read by providing symbolic names for the reply_type (ACK vs. NAK). Also clean up some brace stuff while at it. v2: s/DP_REPLY/DP_SIDEBAND_REPLY/ (DK) Fix some checkpatch issues Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190122200301.18633-1-ville.syrjala@linux.intel.com
-rw-r--r--drivers/gpu/drm/drm_dp_mst_topology.c26
-rw-r--r--include/drm/drm_dp_helper.h4
2 files changed, 17 insertions, 13 deletions
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 2552a27362a0..3d8e8cc0228f 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -568,7 +568,7 @@ static bool drm_dp_sideband_parse_reply(struct drm_dp_sideband_msg_rx *raw,
568 msg->reply_type = (raw->msg[0] & 0x80) >> 7; 568 msg->reply_type = (raw->msg[0] & 0x80) >> 7;
569 msg->req_type = (raw->msg[0] & 0x7f); 569 msg->req_type = (raw->msg[0] & 0x7f);
570 570
571 if (msg->reply_type) { 571 if (msg->reply_type == DP_SIDEBAND_REPLY_NAK) {
572 memcpy(msg->u.nak.guid, &raw->msg[1], 16); 572 memcpy(msg->u.nak.guid, &raw->msg[1], 16);
573 msg->u.nak.reason = raw->msg[17]; 573 msg->u.nak.reason = raw->msg[17];
574 msg->u.nak.nak_data = raw->msg[18]; 574 msg->u.nak.nak_data = raw->msg[18];
@@ -1969,9 +1969,9 @@ static void drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
1969 if (ret > 0) { 1969 if (ret > 0) {
1970 int i; 1970 int i;
1971 1971
1972 if (txmsg->reply.reply_type == 1) 1972 if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK) {
1973 DRM_DEBUG_KMS("link address nak received\n"); 1973 DRM_DEBUG_KMS("link address nak received\n");
1974 else { 1974 } else {
1975 DRM_DEBUG_KMS("link address reply: %d\n", txmsg->reply.u.link_addr.nports); 1975 DRM_DEBUG_KMS("link address reply: %d\n", txmsg->reply.u.link_addr.nports);
1976 for (i = 0; i < txmsg->reply.u.link_addr.nports; i++) { 1976 for (i = 0; i < txmsg->reply.u.link_addr.nports; i++) {
1977 DRM_DEBUG_KMS("port %d: input %d, pdt: %d, pn: %d, dpcd_rev: %02x, mcs: %d, ddps: %d, ldps %d, sdp %d/%d\n", i, 1977 DRM_DEBUG_KMS("port %d: input %d, pdt: %d, pn: %d, dpcd_rev: %02x, mcs: %d, ddps: %d, ldps %d, sdp %d/%d\n", i,
@@ -2020,9 +2020,9 @@ static int drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
2020 2020
2021 ret = drm_dp_mst_wait_tx_reply(mstb, txmsg); 2021 ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
2022 if (ret > 0) { 2022 if (ret > 0) {
2023 if (txmsg->reply.reply_type == 1) 2023 if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK) {
2024 DRM_DEBUG_KMS("enum path resources nak received\n"); 2024 DRM_DEBUG_KMS("enum path resources nak received\n");
2025 else { 2025 } else {
2026 if (port->port_num != txmsg->reply.u.path_resources.port_number) 2026 if (port->port_num != txmsg->reply.u.path_resources.port_number)
2027 DRM_ERROR("got incorrect port in response\n"); 2027 DRM_ERROR("got incorrect port in response\n");
2028 DRM_DEBUG_KMS("enum path resources %d: %d %d\n", txmsg->reply.u.path_resources.port_number, txmsg->reply.u.path_resources.full_payload_bw_number, 2028 DRM_DEBUG_KMS("enum path resources %d: %d %d\n", txmsg->reply.u.path_resources.port_number, txmsg->reply.u.path_resources.full_payload_bw_number,
@@ -2132,7 +2132,7 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
2132 */ 2132 */
2133 ret = drm_dp_mst_wait_tx_reply(mstb, txmsg); 2133 ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
2134 if (ret > 0) { 2134 if (ret > 0) {
2135 if (txmsg->reply.reply_type == 1) 2135 if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
2136 ret = -EINVAL; 2136 ret = -EINVAL;
2137 else 2137 else
2138 ret = 0; 2138 ret = 0;
@@ -2165,7 +2165,7 @@ int drm_dp_send_power_updown_phy(struct drm_dp_mst_topology_mgr *mgr,
2165 2165
2166 ret = drm_dp_mst_wait_tx_reply(port->parent, txmsg); 2166 ret = drm_dp_mst_wait_tx_reply(port->parent, txmsg);
2167 if (ret > 0) { 2167 if (ret > 0) {
2168 if (txmsg->reply.reply_type == 1) 2168 if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
2169 ret = -EINVAL; 2169 ret = -EINVAL;
2170 else 2170 else
2171 ret = 0; 2171 ret = 0;
@@ -2423,9 +2423,9 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
2423 2423
2424 ret = drm_dp_mst_wait_tx_reply(mstb, txmsg); 2424 ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
2425 if (ret > 0) { 2425 if (ret > 0) {
2426 if (txmsg->reply.reply_type == 1) { 2426 if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
2427 ret = -EINVAL; 2427 ret = -EINVAL;
2428 } else 2428 else
2429 ret = 0; 2429 ret = 0;
2430 } 2430 }
2431 kfree(txmsg); 2431 kfree(txmsg);
@@ -2438,7 +2438,7 @@ static int drm_dp_encode_up_ack_reply(struct drm_dp_sideband_msg_tx *msg, u8 req
2438{ 2438{
2439 struct drm_dp_sideband_msg_reply_body reply; 2439 struct drm_dp_sideband_msg_reply_body reply;
2440 2440
2441 reply.reply_type = 0; 2441 reply.reply_type = DP_SIDEBAND_REPLY_ACK;
2442 reply.req_type = req_type; 2442 reply.req_type = req_type;
2443 drm_dp_encode_sideband_reply(&reply, msg); 2443 drm_dp_encode_sideband_reply(&reply, msg);
2444 return 0; 2444 return 0;
@@ -2745,9 +2745,9 @@ static int drm_dp_mst_handle_down_rep(struct drm_dp_mst_topology_mgr *mgr)
2745 } 2745 }
2746 2746
2747 drm_dp_sideband_parse_reply(&mgr->down_rep_recv, &txmsg->reply); 2747 drm_dp_sideband_parse_reply(&mgr->down_rep_recv, &txmsg->reply);
2748 if (txmsg->reply.reply_type == 1) { 2748
2749 if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
2749 DRM_DEBUG_KMS("Got NAK reply: req 0x%02x, reason 0x%02x, nak data 0x%02x\n", txmsg->reply.req_type, txmsg->reply.u.nak.reason, txmsg->reply.u.nak.nak_data); 2750 DRM_DEBUG_KMS("Got NAK reply: req 0x%02x, reason 0x%02x, nak data 0x%02x\n", txmsg->reply.req_type, txmsg->reply.u.nak.reason, txmsg->reply.u.nak.nak_data);
2750 }
2751 2751
2752 memset(&mgr->down_rep_recv, 0, sizeof(struct drm_dp_sideband_msg_rx)); 2752 memset(&mgr->down_rep_recv, 0, sizeof(struct drm_dp_sideband_msg_rx));
2753 drm_dp_mst_topology_put_mstb(mstb); 2753 drm_dp_mst_topology_put_mstb(mstb);
@@ -3893,7 +3893,7 @@ static int drm_dp_mst_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs
3893 ret = drm_dp_mst_wait_tx_reply(mstb, txmsg); 3893 ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
3894 if (ret > 0) { 3894 if (ret > 0) {
3895 3895
3896 if (txmsg->reply.reply_type == 1) { /* got a NAK back */ 3896 if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK) {
3897 ret = -EREMOTEIO; 3897 ret = -EREMOTEIO;
3898 goto out; 3898 goto out;
3899 } 3899 }
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index c223c87ef119..a62d3750663a 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -992,6 +992,10 @@
992#define DP_SINK_EVENT_NOTIFY 0x30 992#define DP_SINK_EVENT_NOTIFY 0x30
993#define DP_QUERY_STREAM_ENC_STATUS 0x38 993#define DP_QUERY_STREAM_ENC_STATUS 0x38
994 994
995/* DP 1.2 MST sideband reply types */
996#define DP_SIDEBAND_REPLY_ACK 0x00
997#define DP_SIDEBAND_REPLY_NAK 0x01
998
995/* DP 1.2 MST sideband nak reasons - table 2.84 */ 999/* DP 1.2 MST sideband nak reasons - table 2.84 */
996#define DP_NAK_WRITE_FAILURE 0x01 1000#define DP_NAK_WRITE_FAILURE 0x01
997#define DP_NAK_INVALID_READ 0x02 1001#define DP_NAK_INVALID_READ 0x02