diff mbox

drm/i915: fix checksum write for automated test reply

Message ID 1437559608-4742-1-git-send-email-sivakumar.thulasimani@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sivakumar Thulasimani July 22, 2015, 10:06 a.m. UTC
From: "Thulasimani,Sivakumar" <sivakumar.thulasimani@intel.com>

DP spec requires the checksum of the last block read to be written
when replying to TEST_EDID_READ. This patch fixes the current code
to do the same.

Signed-off-by: Sivakumar Thulasimani <sivakumar.thulasimani@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Daniel Vetter July 22, 2015, noon UTC | #1
On Wed, Jul 22, 2015 at 03:36:48PM +0530, Sivakumar Thulasimani wrote:
> From: "Thulasimani,Sivakumar" <sivakumar.thulasimani@intel.com>
> 
> DP spec requires the checksum of the last block read to be written
> when replying to TEST_EDID_READ. This patch fixes the current code
> to do the same.
> 
> Signed-off-by: Sivakumar Thulasimani <sivakumar.thulasimani@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c |   11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index f1b9f93..9617d04 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -4090,9 +4090,18 @@ static uint8_t intel_dp_autotest_edid(struct intel_dp *intel_dp)
>  				      intel_dp->aux.i2c_defer_count);
>  		intel_dp->compliance_test_data = INTEL_DP_RESOLUTION_FAILSAFE;
>  	} else {
> +		struct edid *block = intel_connector->detect_edid;
> +		uint8_t temp = intel_connector->detect_edid->extensions;
> +
> +		/* We have to write the checksum
> +		 * of the last block read
> +		 */
> +		while (temp--)
> +			block++;

		block += block->extensions;

instead of implementing addition by adding lots of 1? Also if you want to
simplify computation by extracting local variables, give them a better
name than "temp". That's somewhat ok for a reused u32 tmp for register
read-modify-writes over lots of registers, but not really for anything
else.
-Daniel

> +
>  		if (!drm_dp_dpcd_write(&intel_dp->aux,
>  					DP_TEST_EDID_CHECKSUM,
> -					&intel_connector->detect_edid->checksum,
> +					&block->checksum,
>  					1))
>  			DRM_DEBUG_KMS("Failed to write EDID checksum\n");
>  
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Sivakumar Thulasimani July 22, 2015, 12:59 p.m. UTC | #2
On 7/22/2015 5:30 PM, Daniel Vetter wrote:
> On Wed, Jul 22, 2015 at 03:36:48PM +0530, Sivakumar Thulasimani wrote:
>> From: "Thulasimani,Sivakumar" <sivakumar.thulasimani@intel.com>
>>
>> DP spec requires the checksum of the last block read to be written
>> when replying to TEST_EDID_READ. This patch fixes the current code
>> to do the same.
>>
>> Signed-off-by: Sivakumar Thulasimani <sivakumar.thulasimani@intel.com>
>> ---
>>   drivers/gpu/drm/i915/intel_dp.c |   11 ++++++++++-
>>   1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>> index f1b9f93..9617d04 100644
>> --- a/drivers/gpu/drm/i915/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>> @@ -4090,9 +4090,18 @@ static uint8_t intel_dp_autotest_edid(struct intel_dp *intel_dp)
>>   				      intel_dp->aux.i2c_defer_count);
>>   		intel_dp->compliance_test_data = INTEL_DP_RESOLUTION_FAILSAFE;
>>   	} else {
>> +		struct edid *block = intel_connector->detect_edid;
>> +		uint8_t temp = intel_connector->detect_edid->extensions;
>> +
>> +		/* We have to write the checksum
>> +		 * of the last block read
>> +		 */
>> +		while (temp--)
>> +			block++;
> 		block += block->extensions;
>
> instead of implementing addition by adding lots of 1? Also if you want to
> simplify computation by extracting local variables, give them a better
> name than "temp". That's somewhat ok for a reused u32 tmp for register
> read-modify-writes over lots of registers, but not really for anything
> else.
> -Daniel
>
Done. uploaded v2 with this change.
>> +
>>   		if (!drm_dp_dpcd_write(&intel_dp->aux,
>>   					DP_TEST_EDID_CHECKSUM,
>> -					&intel_connector->detect_edid->checksum,
>> +					&block->checksum,
>>   					1))
>>   			DRM_DEBUG_KMS("Failed to write EDID checksum\n");
>>   
>> -- 
>> 1.7.9.5
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index f1b9f93..9617d04 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4090,9 +4090,18 @@  static uint8_t intel_dp_autotest_edid(struct intel_dp *intel_dp)
 				      intel_dp->aux.i2c_defer_count);
 		intel_dp->compliance_test_data = INTEL_DP_RESOLUTION_FAILSAFE;
 	} else {
+		struct edid *block = intel_connector->detect_edid;
+		uint8_t temp = intel_connector->detect_edid->extensions;
+
+		/* We have to write the checksum
+		 * of the last block read
+		 */
+		while (temp--)
+			block++;
+
 		if (!drm_dp_dpcd_write(&intel_dp->aux,
 					DP_TEST_EDID_CHECKSUM,
-					&intel_connector->detect_edid->checksum,
+					&block->checksum,
 					1))
 			DRM_DEBUG_KMS("Failed to write EDID checksum\n");