Commit c1617abc authored by Manasi Navare's avatar Manasi Navare Committed by Jani Nikula

drm/i915: Move all the DP compliance data to a separate struct

This patch does not change anything functionally, just cleans up
the DP compliance related variables and stores them all together
in a separate struct intel_dp_compliance. There is another struct
intel_dp_compliance_data to store all the test data. This makes it easy to
reset the compliance variables through a memset instead of
individual resetting.

v2:
* Removed functional changes for EDID (Jani Nikula)
Reviewed-by: default avatarJani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: default avatarManasi Navare <manasi.d.navare@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwl.ch>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1481329371-16306-1-git-send-email-manasi.d.navare@intel.com
parent fdb14d33
...@@ -3612,9 +3612,9 @@ static ssize_t i915_displayport_test_active_write(struct file *file, ...@@ -3612,9 +3612,9 @@ static ssize_t i915_displayport_test_active_write(struct file *file,
* testing code, only accept an actual value of 1 here * testing code, only accept an actual value of 1 here
*/ */
if (val == 1) if (val == 1)
intel_dp->compliance_test_active = 1; intel_dp->compliance.test_active = 1;
else else
intel_dp->compliance_test_active = 0; intel_dp->compliance.test_active = 0;
} }
} }
out: out:
...@@ -3641,7 +3641,7 @@ static int i915_displayport_test_active_show(struct seq_file *m, void *data) ...@@ -3641,7 +3641,7 @@ static int i915_displayport_test_active_show(struct seq_file *m, void *data)
if (connector->status == connector_status_connected && if (connector->status == connector_status_connected &&
connector->encoder != NULL) { connector->encoder != NULL) {
intel_dp = enc_to_intel_dp(connector->encoder); intel_dp = enc_to_intel_dp(connector->encoder);
if (intel_dp->compliance_test_active) if (intel_dp->compliance.test_active)
seq_puts(m, "1"); seq_puts(m, "1");
else else
seq_puts(m, "0"); seq_puts(m, "0");
...@@ -3685,7 +3685,7 @@ static int i915_displayport_test_data_show(struct seq_file *m, void *data) ...@@ -3685,7 +3685,7 @@ static int i915_displayport_test_data_show(struct seq_file *m, void *data)
if (connector->status == connector_status_connected && if (connector->status == connector_status_connected &&
connector->encoder != NULL) { connector->encoder != NULL) {
intel_dp = enc_to_intel_dp(connector->encoder); intel_dp = enc_to_intel_dp(connector->encoder);
seq_printf(m, "%lx", intel_dp->compliance_test_data); seq_printf(m, "%lx", intel_dp->compliance.test_data.edid);
} else } else
seq_puts(m, "0"); seq_puts(m, "0");
} }
...@@ -3724,7 +3724,7 @@ static int i915_displayport_test_type_show(struct seq_file *m, void *data) ...@@ -3724,7 +3724,7 @@ static int i915_displayport_test_type_show(struct seq_file *m, void *data)
if (connector->status == connector_status_connected && if (connector->status == connector_status_connected &&
connector->encoder != NULL) { connector->encoder != NULL) {
intel_dp = enc_to_intel_dp(connector->encoder); intel_dp = enc_to_intel_dp(connector->encoder);
seq_printf(m, "%02lx", intel_dp->compliance_test_type); seq_printf(m, "%02lx", intel_dp->compliance.test_type);
} else } else
seq_puts(m, "0"); seq_puts(m, "0");
} }
......
...@@ -3872,7 +3872,7 @@ static uint8_t intel_dp_autotest_edid(struct intel_dp *intel_dp) ...@@ -3872,7 +3872,7 @@ static uint8_t intel_dp_autotest_edid(struct intel_dp *intel_dp)
DRM_DEBUG_KMS("EDID read had %d NACKs, %d DEFERs\n", DRM_DEBUG_KMS("EDID read had %d NACKs, %d DEFERs\n",
intel_dp->aux.i2c_nack_count, intel_dp->aux.i2c_nack_count,
intel_dp->aux.i2c_defer_count); intel_dp->aux.i2c_defer_count);
intel_dp->compliance_test_data = INTEL_DP_RESOLUTION_FAILSAFE; intel_dp->compliance.test_data.edid = INTEL_DP_RESOLUTION_FAILSAFE;
} else { } else {
struct edid *block = intel_connector->detect_edid; struct edid *block = intel_connector->detect_edid;
...@@ -3888,11 +3888,11 @@ static uint8_t intel_dp_autotest_edid(struct intel_dp *intel_dp) ...@@ -3888,11 +3888,11 @@ static uint8_t intel_dp_autotest_edid(struct intel_dp *intel_dp)
DRM_DEBUG_KMS("Failed to write EDID checksum\n"); DRM_DEBUG_KMS("Failed to write EDID checksum\n");
test_result = DP_TEST_ACK | DP_TEST_EDID_CHECKSUM_WRITE; test_result = DP_TEST_ACK | DP_TEST_EDID_CHECKSUM_WRITE;
intel_dp->compliance_test_data = INTEL_DP_RESOLUTION_STANDARD; intel_dp->compliance.test_data.edid = INTEL_DP_RESOLUTION_STANDARD;
} }
/* Set test active flag here so userspace doesn't interrupt things */ /* Set test active flag here so userspace doesn't interrupt things */
intel_dp->compliance_test_active = 1; intel_dp->compliance.test_active = 1;
return test_result; return test_result;
} }
...@@ -3918,22 +3918,22 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp) ...@@ -3918,22 +3918,22 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)
switch (rxdata) { switch (rxdata) {
case DP_TEST_LINK_TRAINING: case DP_TEST_LINK_TRAINING:
DRM_DEBUG_KMS("LINK_TRAINING test requested\n"); DRM_DEBUG_KMS("LINK_TRAINING test requested\n");
intel_dp->compliance_test_type = DP_TEST_LINK_TRAINING; intel_dp->compliance.test_type = DP_TEST_LINK_TRAINING;
response = intel_dp_autotest_link_training(intel_dp); response = intel_dp_autotest_link_training(intel_dp);
break; break;
case DP_TEST_LINK_VIDEO_PATTERN: case DP_TEST_LINK_VIDEO_PATTERN:
DRM_DEBUG_KMS("TEST_PATTERN test requested\n"); DRM_DEBUG_KMS("TEST_PATTERN test requested\n");
intel_dp->compliance_test_type = DP_TEST_LINK_VIDEO_PATTERN; intel_dp->compliance.test_type = DP_TEST_LINK_VIDEO_PATTERN;
response = intel_dp_autotest_video_pattern(intel_dp); response = intel_dp_autotest_video_pattern(intel_dp);
break; break;
case DP_TEST_LINK_EDID_READ: case DP_TEST_LINK_EDID_READ:
DRM_DEBUG_KMS("EDID test requested\n"); DRM_DEBUG_KMS("EDID test requested\n");
intel_dp->compliance_test_type = DP_TEST_LINK_EDID_READ; intel_dp->compliance.test_type = DP_TEST_LINK_EDID_READ;
response = intel_dp_autotest_edid(intel_dp); response = intel_dp_autotest_edid(intel_dp);
break; break;
case DP_TEST_LINK_PHY_TEST_PATTERN: case DP_TEST_LINK_PHY_TEST_PATTERN:
DRM_DEBUG_KMS("PHY_PATTERN test requested\n"); DRM_DEBUG_KMS("PHY_PATTERN test requested\n");
intel_dp->compliance_test_type = DP_TEST_LINK_PHY_TEST_PATTERN; intel_dp->compliance.test_type = DP_TEST_LINK_PHY_TEST_PATTERN;
response = intel_dp_autotest_phy_pattern(intel_dp); response = intel_dp_autotest_phy_pattern(intel_dp);
break; break;
default: default:
...@@ -4057,7 +4057,7 @@ intel_dp_check_link_status(struct intel_dp *intel_dp) ...@@ -4057,7 +4057,7 @@ intel_dp_check_link_status(struct intel_dp *intel_dp)
return; return;
/* if link training is requested we should perform it always */ /* if link training is requested we should perform it always */
if ((intel_dp->compliance_test_type == DP_TEST_LINK_TRAINING) || if ((intel_dp->compliance.test_type == DP_TEST_LINK_TRAINING) ||
(!drm_dp_channel_eq_ok(link_status, intel_dp->lane_count))) { (!drm_dp_channel_eq_ok(link_status, intel_dp->lane_count))) {
DRM_DEBUG_KMS("%s: channel EQ not ok, retraining\n", DRM_DEBUG_KMS("%s: channel EQ not ok, retraining\n",
intel_encoder->base.name); intel_encoder->base.name);
...@@ -4091,9 +4091,7 @@ intel_dp_short_pulse(struct intel_dp *intel_dp) ...@@ -4091,9 +4091,7 @@ intel_dp_short_pulse(struct intel_dp *intel_dp)
* Clearing compliance test variables to allow capturing * Clearing compliance test variables to allow capturing
* of values for next automated test request. * of values for next automated test request.
*/ */
intel_dp->compliance_test_active = 0; memset(&intel_dp->compliance, 0, sizeof(intel_dp->compliance));
intel_dp->compliance_test_type = 0;
intel_dp->compliance_test_data = 0;
/* /*
* Now read the DPCD to see if it's actually running * Now read the DPCD to see if it's actually running
...@@ -4410,9 +4408,7 @@ intel_dp_long_pulse(struct intel_connector *intel_connector) ...@@ -4410,9 +4408,7 @@ intel_dp_long_pulse(struct intel_connector *intel_connector)
status = connector_status_disconnected; status = connector_status_disconnected;
if (status == connector_status_disconnected) { if (status == connector_status_disconnected) {
intel_dp->compliance_test_active = 0; memset(&intel_dp->compliance, 0, sizeof(intel_dp->compliance));
intel_dp->compliance_test_type = 0;
intel_dp->compliance_test_data = 0;
if (intel_dp->is_mst) { if (intel_dp->is_mst) {
DRM_DEBUG_KMS("MST device may have disappeared %d vs %d\n", DRM_DEBUG_KMS("MST device may have disappeared %d vs %d\n",
......
...@@ -884,6 +884,16 @@ struct intel_dp_desc { ...@@ -884,6 +884,16 @@ struct intel_dp_desc {
u8 sw_minor_rev; u8 sw_minor_rev;
} __packed; } __packed;
struct intel_dp_compliance_data {
unsigned long edid;
};
struct intel_dp_compliance {
unsigned long test_type;
struct intel_dp_compliance_data test_data;
bool test_active;
};
struct intel_dp { struct intel_dp {
i915_reg_t output_reg; i915_reg_t output_reg;
i915_reg_t aux_ch_ctl_reg; i915_reg_t aux_ch_ctl_reg;
...@@ -963,9 +973,7 @@ struct intel_dp { ...@@ -963,9 +973,7 @@ struct intel_dp {
void (*prepare_link_retrain)(struct intel_dp *intel_dp); void (*prepare_link_retrain)(struct intel_dp *intel_dp);
/* Displayport compliance testing */ /* Displayport compliance testing */
unsigned long compliance_test_type; struct intel_dp_compliance compliance;
unsigned long compliance_test_data;
bool compliance_test_active;
}; };
struct intel_lspcon { struct intel_lspcon {
......
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