Skip to contentSkip to conversation

drm/i915: Fall back to bit banging mode for DVO transmitter detection

PATCH In review David Müller (ELSOFT AG) 2 participants 4 messages Apr 19, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Fall back to bit banging mode for DVO transmitter detection

Hello

As discussed in this thread
http://lists.freedesktop.org/archives/dri-devel/2013-April/037411.html
GMBUS based DVO transmitter detection seems to be unreliable which could result in an unusable DVO port.

The attached patch fixes this by falling back to bit banging mode for the time DVO transmitter detection is in progress.

---

drivers/gpu/drm/i915/intel_dvo.c +12 -1
diff -dpurN a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
@@ -449,6 +449,7 @@ void intel_dvo_init(struct drm_device *d
 		const struct intel_dvo_device *dvo = &intel_dvo_devices[i];
 		struct i2c_adapter *i2c;
 		int gpio;
+		bool dvoinit;
 
 		/* Allow the I2C driver info to specify the GPIO to be used in
 		 * special cases, but otherwise default to what's defined
@@ -468,7 +469,17 @@ void intel_dvo_init(struct drm_device *d
 		i2c = intel_gmbus_get_adapter(dev_priv, gpio);
 
 		intel_dvo->dev = *dvo;
-		if (!dvo->dev_ops->init(&intel_dvo->dev, i2c))
+
+		/* GMBUS NAK handling seems to be unstable, hence let the
+		 * transmitter detection run in bit banging mode for now.
+		 */
+		intel_gmbus_force_bit(i2c, true);
+
+		dvoinit = dvo->dev_ops->init(&intel_dvo->dev, i2c);
+
+		intel_gmbus_force_bit(i2c, false);
+
+		if (!dvoinit)
 			continue;
 
 		intel_encoder->type = INTEL_OUTPUT_DVO;

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw
Quoted 30 lines · David Müller (ELSOFT AG)

Hello

As discussed in this thread
http://lists.freedesktop.org/archives/dri-devel/2013-April/037411.html
GMBUS based DVO transmitter detection seems to be unreliable which could result in an unusable DVO port.

The attached patch fixes this by falling back to bit banging mode for the time DVO transmitter detection is in progress.

---
diff -dpurN a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c

drivers/gpu/drm/i915/intel_dvo.c +1 -0
@@ -449,6 +449,7 @@ void intel_dvo_init(struct drm_device *d
 		const struct intel_dvo_device *dvo = &intel_dvo_devices[i];
 		struct i2c_adapter *i2c;
 		int gpio;
+		bool dvoinit;
 
 		/* Allow the I2C driver info to specify the GPIO to be used in
 		 * special cases, but otherwise default to what's defined
@@ -468,7 +469,17 @@ void intel_dvo_init(struct drm_device *d
 		i2c = intel_gmbus_get_adapter(dev_priv, gpio);
 
 		intel_dvo->dev = *dvo;

drivers/gpu/drm/i915/intel_dvo.c void intel_dvo_init(struct drm_device *d · line 480

Quoted 10 lines
drivers/gpu/drm/i915/intel_dvo.c +9 -1
-		if (!dvo->dev_ops->init(&intel_dvo->dev, i2c))
+
+		/* GMBUS NAK handling seems to be unstable, hence let the
+		 * transmitter detection run in bit banging mode for now.
+		 */
+		intel_gmbus_force_bit(i2c, true);
+
+		dvoinit = dvo->dev_ops->init(&intel_dvo->dev, i2c);
+
+		intel_gmbus_force_bit(i2c, false);

Shouldn't we keep the dvo i2c line in bit-banging mode always, i.e. restore gmbus mode only when dvo init failed?

I suspect that for fickle hw not just init will fail ... -Daniel

Quoted 5 lines
drivers/gpu/drm/i915/intel_dvo.c +2 -0
+
+		if (!dvoinit)
 			continue;
 
 		intel_encoder->type = INTEL_OUTPUT_DVO;
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#2 lore raw
Quoted 13 lines · Daniel Vetter

drivers/gpu/drm/i915/intel_dvo.c void intel_dvo_init(struct drm_device *d · line 480

Quoted 8 lines · David Müller (ELSOFT AG)
drivers/gpu/drm/i915/intel_dvo.c +8 -0
+		/* GMBUS NAK handling seems to be unstable, hence let the
+		 * transmitter detection run in bit banging mode for now.
+		 */
+		intel_gmbus_force_bit(i2c, true);
+
+		dvoinit = dvo->dev_ops->init(&intel_dvo->dev, i2c);
+
+		intel_gmbus_force_bit(i2c, false);

Shouldn't we keep the dvo i2c line in bit-banging mode always, i.e. restore gmbus mode only when dvo init failed?

Quoted 1 line

I suspect that for fickle hw not just init will fail ...

As far as i can tell, the critical part is the NAK handling.

Dave

#3 lore raw
Quoted 14 lines · David Müller (ELSOFT AG)
Quoted 13 lines · Daniel Vetter

drivers/gpu/drm/i915/intel_dvo.c void intel_dvo_init(struct drm_device *d · line 480

Quoted 8 lines · David Müller (ELSOFT AG)
drivers/gpu/drm/i915/intel_dvo.c +8 -0
+		/* GMBUS NAK handling seems to be unstable, hence let the
+		 * transmitter detection run in bit banging mode for now.
+		 */
+		intel_gmbus_force_bit(i2c, true);
+
+		dvoinit = dvo->dev_ops->init(&intel_dvo->dev, i2c);
+
+		intel_gmbus_force_bit(i2c, false);

Shouldn't we keep the dvo i2c line in bit-banging mode always, i.e. restore gmbus mode only when dvo init failed?

Quoted 3 lines
Quoted 1 line

I suspect that for fickle hw not just init will fail ...

As far as i can tell, the critical part is the NAK handling.

Ok, I've merged the patch for 3.10 with cc: stable.

Thanks, Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch