Skip to contentSkip to conversation

more radeon drm kms hw i2c fixes

PATCH New Alex Deucher 1 participant 1 message Mar 12, 2010

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

PATCH 1/1 more radeon drm kms hw i2c fixes

This patch series gets hw i2c working on my r1xx card and should fix the hw i2c issues some others have run into on some r2xx and r3xx cards.

Alex

From 03a67a9d68705ccde14ee329e90d8eb1d9d10dc1 Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Thu, 11 Mar 2010 13:28:14 -0500
Subject: [PATCH] drm/radeon/kms: fix for hw i2c

use the i2c pads to drive SDA

Possible fix for fdo bug 26430

---
 drivers/gpu/drm/radeon/radeon_i2c.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/radeon_i2c.c +1 -0
index ca00f69..9ac94cf 100644
@@ -312,6 +312,7 @@ static int r100_hw_i2c_xfer(struct i2c_adapter *i2c_adap,
 	prescale = radeon_get_i2c_prescale(rdev);
 
 	reg = ((prescale << RADEON_I2C_PRESCALE_SHIFT) |
+	       RADEON_I2C_DRIVE_EN |
 	       RADEON_I2C_START |
 	       RADEON_I2C_STOP |
 	       RADEON_I2C_GO);
Signature · 1 line
1.5.6.3

From b171bbe7de8e7aed10085ffde3aeb394416e498c Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Fri, 12 Mar 2010 12:55:34 -0500
Subject: [PATCH] drm/radeon/kms: fix i2c prescale calc on older radeons

Should fix fdo bug 26430

---
 drivers/gpu/drm/radeon/radeon_i2c.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)
drivers/gpu/drm/radeon/radeon_i2c.c +8 -9
index 9ac94cf..f0200e5 100644
@@ -204,11 +204,10 @@ static void post_xfer(struct i2c_adapter *i2c_adap,
 
 static u32 radeon_get_i2c_prescale(struct radeon_device *rdev)
 {
-	struct radeon_pll *spll = &rdev->clock.spll;
 	u32 sclk = radeon_get_engine_clock(rdev);
 	u32 prescale = 0;
-	u32 n, m;
-	u8 loop;
+	u32 nm;
+	u8 n, m, loop;
 	int i2c_clock;
 
 	switch (rdev->family) {
@@ -224,13 +223,15 @@ static u32 radeon_get_i2c_prescale(struct radeon_device *rdev)
 	case CHIP_R300:
 	case CHIP_R350:
 	case CHIP_RV350:
-		n = (spll->reference_freq) / (4 * 6);
+		i2c_clock = 60;
+		nm = (sclk * 10) / (i2c_clock * 4);
 		for (loop = 1; loop < 255; loop++) {
-			if ((loop * (loop - 1)) > n)
+			if ((nm / loop) < loop)
 				break;
 		}
-		m = loop - 1;
-		prescale = m | (loop << 8);
+		n = loop - 1;
+		m = loop - 2;
+		prescale = m | (n << 8);
 		break;
 	case CHIP_RV380:
 	case CHIP_RS400:
@@ -238,7 +239,6 @@ static u32 radeon_get_i2c_prescale(struct radeon_device *rdev)
 	case CHIP_R420:
 	case CHIP_R423:
 	case CHIP_RV410:
-		sclk = radeon_get_engine_clock(rdev);
 		prescale = (((sclk * 10)/(4 * 128 * 100) + 1) << 8) + 128;
 		break;
 	case CHIP_RS600:
@@ -253,7 +253,6 @@ static u32 radeon_get_i2c_prescale(struct radeon_device *rdev)
 	case CHIP_RV570:
 	case CHIP_R580:
 		i2c_clock = 50;
-		sclk = radeon_get_engine_clock(rdev);
 		if (rdev->family == CHIP_R520)
 			prescale = (127 << 8) + ((sclk * 10) / (4 * 127 * i2c_clock));
 		else
Signature · 1 line
1.5.6.3

From 81b2cc3bb62925ad690ea223531037629701790d Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Fri, 12 Mar 2010 13:30:49 -0500
Subject: [PATCH] drm/radeon/kms/r1xx: enable hw i2c

fixing the i2c prescale in the last patch
gets it working on r1xx.

---
 drivers/gpu/drm/radeon/radeon_combios.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/radeon_combios.c +1 -4
index 30a84ae..6d87e70 100644
@@ -531,10 +531,7 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde
 	case CHIP_RS300:
 		switch (ddc_line) {
 		case RADEON_GPIO_DVI_DDC:
-			/* in theory this should be hw capable,
-			 * but it doesn't seem to work
-			 */
-			i2c.hw_capable = false;
+			i2c.hw_capable = true;
 			break;
 		default:
 			i2c.hw_capable = false;
Signature · 1 line
1.5.6.3

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev

--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel