Skip to contentSkip to conversation

drm/kms: Use the standard VESA timeout for DDC channels

PATCH In review Jean Delvare 2 participants 2 messages Oct 21, 2011 – Nov 23, 2011

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

PATCH 2/2 drm/kms: Use the standard VESA timeout for DDC channels

The VESA specification suggests a 2.2 ms timeout on DDC channels. Only the intel DRM driver implements this properly today, align all drivers to the proper implementation.

Cc Eugeni Dodonov <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Keith Packard <[email protected]>
Cc Alex Deucher <[email protected]>
---
 drivers/gpu/drm/i915/intel_i2c.c      |    2 +-
 drivers/gpu/drm/nouveau/nouveau_i2c.c |    2 +-
 drivers/gpu/drm/radeon/radeon_i2c.c   |    4 +---
 3 files changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_i2c.c +1 -1
@@ -183,7 +183,7 @@ intel_gpio_create(struct drm_i915_privat
 	gpio->algo.getsda = get_data;
 	gpio->algo.getscl = get_clock;
 	gpio->algo.udelay = I2C_RISEFALL_TIME;
-	gpio->algo.timeout = usecs_to_jiffies(2200);
+	gpio->algo.timeout = usecs_to_jiffies(2200);	/* from VESA */
 	gpio->algo.data = gpio;
 
 	if (i2c_bit_add_bus(&gpio->adapter))
drivers/gpu/drm/nouveau/nouveau_i2c.c +1 -1
@@ -218,7 +218,7 @@ nouveau_i2c_init(struct drm_device *dev,
 	if (entry->port_type < 6) {
 		i2c->adapter.algo_data = &i2c->bit;
 		i2c->bit.udelay = 10;
-		i2c->bit.timeout = usecs_to_jiffies(5000);
+		i2c->bit.timeout = usecs_to_jiffies(2200);	/* from VESA */
 		i2c->bit.data = i2c;
 		ret = i2c_bit_add_bus(&i2c->adapter);
 	} else {
drivers/gpu/drm/radeon/radeon_i2c.c +1 -3
@@ -929,9 +929,7 @@ struct radeon_i2c_chan *radeon_i2c_creat
 		i2c->algo.bit.getsda = get_data;
 		i2c->algo.bit.getscl = get_clock;
 		i2c->algo.bit.udelay = 10;
-		/* vesa says 2.2 ms is enough, 1 jiffy doesn't seem to always
-		 * make this, 2 jiffies is a lot more reliable */
-		i2c->algo.bit.timeout = 2;
+		i2c->algo.bit.timeout = usecs_to_jiffies(2200);	/* from VESA */
 		i2c->algo.bit.data = i2c;
 		ret = i2c_bit_add_bus(&i2c->adapter);
 		if (ret) {
Signature · 2 lines
Jean Delvare
Suse L3
Reviewed-by on v1 2/2
#1 lore raw

drivers/gpu/drm/radeon/radeon_i2c.c struct radeon_i2c_chan *radeon_i2c_creat · line 932

Quoted 4 lines · Jean Delvare
drivers/gpu/drm/radeon/radeon_i2c.c +1 -3
-		/* vesa says 2.2 ms is enough, 1 jiffy doesn't seem to always
-		 * make this, 2 jiffies is a lot more reliable */
-		i2c->algo.bit.timeout = 2;
+		i2c->algo.bit.timeout = usecs_to_jiffies(2200);	/* from VESA */

From my reading of the usecs_to_jiffies code, it always returns a time at least as long as requested, so this will ensure that you're waiting at least 2.2ms, unlike 2 jiffies which is some random amount of time depending on the HZ setting in the kernel.

Signature · 1 line
[email protected]

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