From d53c94321e5cce9d70291aac8a73fe39f811de00 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 9 May 2006 21:22:42 +1000 Subject: detect the chrontel ch7xxx chip properly --- src/ch7xxx/ch7xxx.c | 18 +++++++++--------- src/ch7xxx/ch7xxx.h | 16 +++++++--------- src/i830_i2c.c | 11 +++++++++-- 3 files changed, 25 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/ch7xxx/ch7xxx.c b/src/ch7xxx/ch7xxx.c index 96964ce2..fe377ba0 100644 --- a/src/ch7xxx/ch7xxx.c +++ b/src/ch7xxx/ch7xxx.c @@ -74,7 +74,7 @@ static void *ch7xxxDetect(I2CBusPtr b, I2CSlaveAddr addr) sil->d.ByteTimeout = b->ByteTimeout; sil->d.DriverPrivate.ptr = sil; - if (!ch7xxxReadByte(sil, CH7xxx_VID_LO, &ch)) + if (!ch7xxxReadByte(sil, CH7xxx_REG_VID, &ch)) goto out; if (ch!=(CH7xxx_VID & 0xFF)) @@ -84,7 +84,7 @@ static void *ch7xxxDetect(I2CBusPtr b, I2CSlaveAddr addr) } - if (!ch7xxxReadByte(sil, CH7xxx_DID_LO, &ch)) + if (!ch7xxxReadByte(sil, CH7xxx_REG_DID, &ch)) goto out; if (ch!=(CH7xxx_DID & 0xFF)) @@ -109,7 +109,7 @@ static void *ch7xxxDetect(I2CBusPtr b, I2CSlaveAddr addr) static Bool ch7xxxInit(I2CDevPtr d) { - CH7xxxPtr sil = SILPTR(d); + CH7xxxPtr sil = CH7PTR(d); /* not much to do */ return TRUE; @@ -117,14 +117,14 @@ static Bool ch7xxxInit(I2CDevPtr d) static ModeStatus ch7xxxModeValid(I2CDevPtr d, DisplayModePtr mode) { - CH7xxxPtr sil = SILPTR(d); + CH7xxxPtr sil = CH7PTR(d); return MODE_OK; } static void ch7xxxMode(I2CDevPtr d, DisplayModePtr mode) { - CH7xxxPtr sil = SILPTR(d); + CH7xxxPtr sil = CH7PTR(d); /* don't do much */ return; @@ -133,7 +133,7 @@ static void ch7xxxMode(I2CDevPtr d, DisplayModePtr mode) /* set the CH7xxx power state */ static void ch7xxxPower(I2CDevPtr d, Bool On) { - CH7xxxPtr sil = SILPTR(d); + CH7xxxPtr sil = CH7PTR(d); int ret; unsigned char ch; @@ -152,12 +152,12 @@ static void ch7xxxPower(I2CDevPtr d, Bool On) static void ch7xxxPrintRegs(I2CDevPtr d) { - CH7xxxPtr sil = SILPTR(d); + CH7xxxPtr sil = CH7PTR(d); } static void ch7xxxSaveRegs(I2CDevPtr d) { - CH7xxxPtr sil = SILPTR(d); + CH7xxxPtr sil = CH7PTR(d); if (!ch7xxxReadByte(sil, CH7xxx_FREQ_LO, &sil->SavedReg.freq_lo)) return; @@ -178,7 +178,7 @@ static void ch7xxxSaveRegs(I2CDevPtr d) } -I830I2CVidOutputRec CH7xxxxVidOutput = { +I830I2CVidOutputRec CH7xxxVidOutput = { ch7xxxDetect, ch7xxxInit, ch7xxxModeValid, diff --git a/src/ch7xxx/ch7xxx.h b/src/ch7xxx/ch7xxx.h index 7aa44dfa..07b5544f 100644 --- a/src/ch7xxx/ch7xxx.h +++ b/src/ch7xxx/ch7xxx.h @@ -28,13 +28,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "../i2c_vid.h" -#define CH7xxx_VID 0x0001 -#define CH7xxx_DID 0x0006 +#define CH7xxx_VID 0x84 +#define CH7xxx_DID 0x17 -#define CH7xxx_VID_LO 0x00 -#define CH7xxx_VID_HI 0x01 -#define CH7xxx_DID_LO 0x02 -#define CH7xxx_DID_HI 0x03 +#define CH7xxx_REG_VID 0x4a +#define CH7xxx_REG_DID 0x4b #define CH7xxx_REV 0x04 #define CH7xxx_RSVD 0x05 #define CH7xxx_FREQ_LO 0x06 @@ -58,7 +56,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define CH7xxx_REGC 0x0c -typedef struct _Sil164SaveRec { +typedef struct _CH7xxxSaveRec { CARD8 freq_lo; CARD8 freq_hi; CARD8 reg8; @@ -72,9 +70,9 @@ typedef struct { CH7xxxSaveRec ModeReg; } CH7xxxRec, *CH7xxxPtr; -#define CH7xxx_ADDR_1 0x38 +#define CH7xxx_ADDR_1 0x76 #define CH7xxx_SYMBOL_LIST "CH7xxxVidOutput" -#define SILPTR(d) ((CH7xxxPtr)(d->DriverPrivate.ptr)) +#define CH7PTR(d) ((CH7xxxPtr)(d->DriverPrivate.ptr)) #endif diff --git a/src/i830_i2c.c b/src/i830_i2c.c index 80d823f1..8dd5d316 100644 --- a/src/i830_i2c.c +++ b/src/i830_i2c.c @@ -50,14 +50,21 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "i830.h" #include "sil164/sil164.h" +#include "ch7xxx/ch7xxx.h" static const char *SIL164Symbols[] = { SIL164_SYMBOL_LIST }; +static const char *CH7xxxSymbols[] = { + CH7xxx_SYMBOL_LIST +}; + /* driver list */ struct _I830DVODriver i830_dvo_drivers[] = - { I830_DVO_CHIP_TMDS, "sil164", "SIL164VidOutput", (SIL164_ADDR_1<<1), SIL164Symbols, NULL , NULL, NULL}; + { { I830_DVO_CHIP_TMDS, "sil164", "SIL164VidOutput", (SIL164_ADDR_1<<1), SIL164Symbols, NULL , NULL, NULL}, + { I830_DVO_CHIP_TMDS|I830_DVO_CHIP_TVOUT, "ch7xxx", "CH7xxxVidOutput", (CH7xxx_ADDR_1<<1), CH7xxxSymbols, NULL , NULL, NULL} +}; @@ -470,7 +477,7 @@ I830I2CDetectDVOControllers(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus, struct _I830DV *retdrv = drv; return TRUE; } - xf86UnloadModule(drv->modhandle); + xf86UnloadSubModule(drv->modhandle); } return FALSE; } -- cgit v1.2.3