[8/9] drm/i915: Move dummy aux read from read_wake to aux_transfer.

Submitted by Rodrigo Vivi on Nov. 26, 2015, 12:04 a.m.

Details

Message ID 1448496245-1495-9-git-send-email-rodrigo.vivi@intel.com
State New
Headers show
Series "Organize aux retries v3" ( rev: 1 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Rodrigo Vivi Nov. 26, 2015, 12:04 a.m.
The goal is to kill the intel_dp_dpcd_read_wake for all, however
Jani noticed we cannot ignore the case introduced by:
'commit f6a1906 ("drm/i915: Do a dummy DPCD read before the actual read")'

So, instead for removing this for now let's apply that dummy read
to all DP_AUX_NATIVE_READ cases. Pratically no functional changes with
this change, but ideally we want to remove this code for here.

Unfortunately I don't have the monitor/hardware that made us
to include this extra call so for now let's move this here and
add a FIXME tag so this case can be properly fixed/verified later.

An alternative plan is to remove completely this piece of code and when
we start getting the corner cases again we investigate it properly to
see if instead of this extra read we can simply handle properly or
return a -EBUSY or -EAGAIN so drm can retry instead.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index a02bfa1..0febf8d 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -937,7 +937,7 @@  static ssize_t
 intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
 {
 	struct intel_dp *intel_dp = container_of(aux, struct intel_dp, aux);
-	uint8_t txbuf[20], rxbuf[20];
+	uint8_t txbuf[20], rxbuf[20], dumbuf[20];
 	size_t txsize, rxsize;
 	int ret;
 
@@ -974,6 +974,18 @@  intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
 		break;
 
 	case DP_AUX_NATIVE_READ:
+		/*
+		 * FIXME: Sometime we just get the same incorrect byte repeated
+		 * over the entire buffer. Doing just one throw away read
+		 * initially seems to "solve" it.
+		 */
+		dumbuf[0] = (DP_AUX_NATIVE_READ << 4) |
+			((DP_DPCD_REV >> 16) & 0xf);
+		dumbuf[1] = (DP_DPCD_REV >> 8) & 0xff;
+		dumbuf[2] = DP_DPCD_REV & 0xff;
+		dumbuf[3] = 0;
+		intel_dp_aux_ch(intel_dp, dumbuf, HEADER_SIZE, rxbuf, 2);
+
 	case DP_AUX_I2C_READ:
 		txsize = msg->size ? HEADER_SIZE : BARE_ADDRESS_SIZE;
 		rxsize = msg->size + 1;
@@ -3171,13 +3183,6 @@  intel_dp_dpcd_read_wake(struct drm_dp_aux *aux, unsigned int offset,
 	ssize_t ret;
 	int i;
 
-	/*
-	 * Sometime we just get the same incorrect byte repeated
-	 * over the entire buffer. Doing just one throw away read
-	 * initially seems to "solve" it.
-	 */
-	drm_dp_dpcd_read(aux, DP_DPCD_REV, buffer, 1);
-
 	for (i = 0; i < 3; i++) {
 		ret = drm_dp_dpcd_read(aux, offset, buffer, size);
 		if (ret == size)