Skip to content

Commit 559be30

Browse files
Todd Previtedanvet
authored andcommitted
drm/i915: Implement the intel_dp_autotest_edid function for DP EDID complaince tests
Updates the EDID compliance test function to perform the analyze and react to the EDID data read as a result of a hot plug event. The results of this analysis are handed off to userspace so that the userspace app can set the display mode appropriately for the test result/response. The compliance_test_active flag now appears at the end of the individual test handling functions. This is so that the kernel-side operations can be completed without the risk of interruption from the userspace app that is polling on that flag. V2: - Addressed mailing list feedback - Removed excess debug messages - Removed extraneous comments - Fixed formatting issues (line length > 80) - Updated the debug message in compute_edid_checksum to output hex values instead of decimal V3: - Addressed more list feedback - Added the test_active flag to the autotest function - Removed test_active flag from handler - Added failsafe check on the compliance test active flag at the end of the test handler - Fixed checkpatch.pl issues V4: - Removed the checksum computation function and its use as it has been rendered superfluous by changes to the core DRM EDID functions - Updated to use the raw header corruption detection mechanism - Moved the declaration of the test_data variable here V5: - Update test active flag variable name to match the change in the first patch of the series. - Relocated the test active flag declaration and initialization to this patch V6: - Updated to use the new flag for raw EDID header corruption - Removed the extra EDID read from the autotest function - Added the edid_checksum variable to struct intel_dp so that the autotest function can write it to the sink device - Moved the update to the hpd_pulse function to another patch - Removed extraneous constants V7: - Fixed erroneous placement of the checksum assignment. In some cases such as when the EDID read fails and is NULL, this causes a NULL ptr dereference in the kernel. Bad news. Fixed now. V8: - Updated to support the kfree() on the EDID data added previously V9: - Updated for the long_hpd flag propagation V10: - Updated to use actual checksum from the EDID read that occurs during normal hot plug path execution - Removed variables from intel_dp struct that are no longer needed - Updated the patch subject to more closely match the nature and contents of the patch - Fixed formatting problem (long line) V11: - Removed extra debug messages - Updated comments to be more informative - Removed extra variable V12: - Removed the 4 bit offset of the resolution setting in compliance data - Changed to DRM_DEBUG_KMS instead of DRM_DEBUG_DRIVER Signed-off-by: Todd Previte <tprevite@gmail.com> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent 6ba2bd3 commit 559be30

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

drivers/gpu/drm/i915/intel_dp.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141

4242
#define DP_LINK_CHECK_TIMEOUT (10 * 1000)
4343

44+
/* Compliance test status bits */
45+
#define INTEL_DP_RESOLUTION_SHIFT_MASK 0
46+
#define INTEL_DP_RESOLUTION_PREFERRED (1 << INTEL_DP_RESOLUTION_SHIFT_MASK)
47+
#define INTEL_DP_RESOLUTION_STANDARD (2 << INTEL_DP_RESOLUTION_SHIFT_MASK)
48+
#define INTEL_DP_RESOLUTION_FAILSAFE (3 << INTEL_DP_RESOLUTION_SHIFT_MASK)
49+
4450
struct dp_link_dpll {
4551
int link_bw;
4652
struct dpll dpll;
@@ -4079,6 +4085,39 @@ static uint8_t intel_dp_autotest_video_pattern(struct intel_dp *intel_dp)
40794085
static uint8_t intel_dp_autotest_edid(struct intel_dp *intel_dp)
40804086
{
40814087
uint8_t test_result = DP_TEST_NAK;
4088+
struct intel_connector *intel_connector = intel_dp->attached_connector;
4089+
struct drm_connector *connector = &intel_connector->base;
4090+
4091+
if (intel_connector->detect_edid == NULL ||
4092+
connector->edid_corrupt == 1 ||
4093+
intel_dp->aux.i2c_defer_count > 6) {
4094+
/* Check EDID read for NACKs, DEFERs and corruption
4095+
* (DP CTS 1.2 Core r1.1)
4096+
* 4.2.2.4 : Failed EDID read, I2C_NAK
4097+
* 4.2.2.5 : Failed EDID read, I2C_DEFER
4098+
* 4.2.2.6 : EDID corruption detected
4099+
* Use failsafe mode for all cases
4100+
*/
4101+
if (intel_dp->aux.i2c_nack_count > 0 ||
4102+
intel_dp->aux.i2c_defer_count > 0)
4103+
DRM_DEBUG_KMS("EDID read had %d NACKs, %d DEFERs\n",
4104+
intel_dp->aux.i2c_nack_count,
4105+
intel_dp->aux.i2c_defer_count);
4106+
intel_dp->compliance_test_data = INTEL_DP_RESOLUTION_FAILSAFE;
4107+
} else {
4108+
if (!drm_dp_dpcd_write(&intel_dp->aux,
4109+
DP_TEST_EDID_CHECKSUM,
4110+
&intel_connector->detect_edid->checksum,
4111+
1));
4112+
DRM_DEBUG_KMS("Failed to write EDID checksum\n");
4113+
4114+
test_result = DP_TEST_ACK | DP_TEST_EDID_CHECKSUM_WRITE;
4115+
intel_dp->compliance_test_data = INTEL_DP_RESOLUTION_STANDARD;
4116+
}
4117+
4118+
/* Set test active flag here so userspace doesn't interrupt things */
4119+
intel_dp->compliance_test_active = 1;
4120+
40824121
return test_result;
40834122
}
40844123

@@ -4094,7 +4133,10 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)
40944133
uint8_t rxdata = 0;
40954134
int status = 0;
40964135

4136+
intel_dp->compliance_test_active = 0;
40974137
intel_dp->compliance_test_type = 0;
4138+
intel_dp->compliance_test_data = 0;
4139+
40984140
intel_dp->aux.i2c_nack_count = 0;
40994141
intel_dp->aux.i2c_defer_count = 0;
41004142

drivers/gpu/drm/i915/intel_drv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,8 @@ struct intel_dp {
740740

741741
/* Displayport compliance testing */
742742
unsigned long compliance_test_type;
743+
unsigned long compliance_test_data;
744+
bool compliance_test_active;
743745
};
744746

745747
struct intel_digital_port {

0 commit comments

Comments
 (0)