From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jani Nikula Subject: Re: [PATCH 3/6] drm/i915: Implement basic Displayport automated testing function for EDID operations Date: Wed, 25 Jun 2014 10:57:05 +0300 Message-ID: <87zjh17772.fsf@intel.com> References: <1403647974-42377-1-git-send-email-tprevite@gmail.com> <1403647974-42377-4-git-send-email-tprevite@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 71ADA6E1C3 for ; Wed, 25 Jun 2014 00:57:12 -0700 (PDT) In-Reply-To: <1403647974-42377-4-git-send-email-tprevite@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Todd Previte , intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Wed, 25 Jun 2014, Todd Previte wrote: > Implements some of the basic EDID tests for Displayport compliance. These tests > include reading the EDID, verifying the checksum and writing the test responses > back to the sink device. > > Signed-off-by: Todd Previte > --- > drivers/gpu/drm/i915/intel_dp.c | 36 +++++++++++++++++++++++++++++++++++- > 1 file changed, 35 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c > index 43fcabe..d060853 100644 > --- a/drivers/gpu/drm/i915/intel_dp.c > +++ b/drivers/gpu/drm/i915/intel_dp.c > @@ -3352,8 +3352,42 @@ intel_dp_autotest_video_pattern(struct intel_dp *intel_dp) > static uint8_t > intel_dp_autotest_edid(struct intel_dp *intel_dp) > { > + struct drm_connector *connector = &intel_dp->attached_connector->base; > + struct i2c_adapter *adapter = &intel_dp->aux.ddc; > + struct edid *edid_read = NULL; > + uint8_t *edid_data = NULL; > uint8_t test_result = DP_TEST_NAK; > - return test_result; > + uint32_t i = 0, ret = 0, checksum = 0; > + struct drm_display_mode *use_mode = NULL; > + dp_compliance_mode comp_mode_type = DP_COMPLIANCE_MODE_PREFERRED; > + int mode_count = 0; > + > + edid_read = drm_get_edid(connector, adapter); > + > + DRM_DEBUG_KMS("Displayport: EDID automated test\n"); > + > + if (edid_read) { It is customary to have if (!edid_read) and bail out early. Then the rest will be a happy day scenario with minimal indentation. BR, Jani. > + test_result = true; > + edid_data = (uint8_t*) edid_read; > + // Compute checksum > + for (i = 0; i < 128; i++) > + checksum += edid_data[i]; > + > + DRM_DEBUG_KMS("Displayport: EDID test - computed byte sum = %02x\n", checksum); > + // Verify EDID checksum > + if (checksum % 256 == 0) { > + /* Write the checksum to EDID checksum register */ > + ret = drm_dp_dpcd_write(&intel_dp->aux, DP_TEST_EDID_CHECKSUM, &edid_read->checksum, 1); > + // Reponse is ACK and and checksum written > + test_result = DP_TEST_ACK | DP_TEST_EDID_CHECKSUM_WRITE; > + DRM_DEBUG_KMS("Displayport: EDID test - checksum = %02x\n", edid_read->checksum); > + } > + else { > + // Invalid checksum, set for failsafe mode > + comp_mode_type = DP_COMPLIANCE_MODE_FAILSAFE; > + } > + } > + return test_result; > } > > /* Displayport compliance testing - PHY pattern testing */ > -- > 1.9.1 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Jani Nikula, Intel Open Source Technology Center