summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2006-05-09 21:33:07 +1000
committerDave Airlie <airlied@linux.ie>2006-06-02 10:03:24 +1000
commit2e9570e5a281fe31c744416c1698bf124f15be44 (patch)
treea7d66a1582b60104405efcb3222ddb9fffa673d4
parent66e2c7c9ee9b4e08ebc86db12de15499b6c7d31b (diff)
downloadxorg-driver-xf86-video-intel-2e9570e5a281fe31c744416c1698bf124f15be44.tar.gz
split up ch7xxx registers file
-rw-r--r--src/ch7xxx/Makefile.am3
-rw-r--r--src/ch7xxx/ch7xxx.c83
-rw-r--r--src/ch7xxx/ch7xxx.h45
-rw-r--r--src/ch7xxx/ch7xxx_reg.h51
-rw-r--r--src/sil164/sil164.c1
-rw-r--r--src/sil164/sil164.h2
6 files changed, 98 insertions, 87 deletions
diff --git a/src/ch7xxx/Makefile.am b/src/ch7xxx/Makefile.am
index 75d1a1e6..645ac692 100644
--- a/src/ch7xxx/Makefile.am
+++ b/src/ch7xxx/Makefile.am
@@ -12,4 +12,5 @@ ch7xxx_ladir = @moduledir@/drivers
ch7xxx_la_SOURCES = \
ch7xxx.c \
ch7xxx_module.c \
- ch7xxx.h
+ ch7xxx.h \
+ ch7xxx_reg.h
diff --git a/src/ch7xxx/ch7xxx.c b/src/ch7xxx/ch7xxx.c
index fe377ba0..bb902a1d 100644
--- a/src/ch7xxx/ch7xxx.c
+++ b/src/ch7xxx/ch7xxx.c
@@ -32,84 +32,86 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "miscstruct.h"
#include "xf86i2c.h"
+#include "../i2c_vid.h"
#include "ch7xxx.h"
+#include "ch7xxx_reg.h"
-static Bool ch7xxxReadByte(CH7xxxPtr sil, int addr, unsigned char *ch)
+static Bool ch7xxxReadByte(CH7xxxPtr ch7xxx, int addr, unsigned char *ch)
{
- if (!xf86I2CReadByte(&(sil->d), addr, ch)) {
- xf86DrvMsg(sil->d.pI2CBus->scrnIndex, X_ERROR, "Unable to read from %s Slave %d.\n", sil->d.pI2CBus->BusName, sil->d.SlaveAddr);
+ if (!xf86I2CReadByte(&(ch7xxx->d), addr, ch)) {
+ xf86DrvMsg(ch7xxx->d.pI2CBus->scrnIndex, X_ERROR, "Unable to read from %s Slave %d.\n", ch7xxx->d.pI2CBus->BusName, ch7xxx->d.SlaveAddr);
return FALSE;
}
return TRUE;
}
-static Bool ch7xxxWriteByte(CH7xxxPtr sil, int addr, unsigned char ch)
+static Bool ch7xxxWriteByte(CH7xxxPtr ch7xxx, int addr, unsigned char ch)
{
- if (!xf86I2CWriteByte(&(sil->d), addr, ch)) {
- xf86DrvMsg(sil->d.pI2CBus->scrnIndex, X_ERROR, "Unable to write to %s Slave %d.\n", sil->d.pI2CBus->BusName, sil->d.SlaveAddr);
+ if (!xf86I2CWriteByte(&(ch7xxx->d), addr, ch)) {
+ xf86DrvMsg(ch7xxx->d.pI2CBus->scrnIndex, X_ERROR, "Unable to write to %s Slave %d.\n", ch7xxx->d.pI2CBus->BusName, ch7xxx->d.SlaveAddr);
return FALSE;
}
return TRUE;
}
-/* Silicon Image 164 driver for chip on i2c bus */
+/* Ch7xxxicon Image 164 driver for chip on i2c bus */
static void *ch7xxxDetect(I2CBusPtr b, I2CSlaveAddr addr)
{
/* this will detect the CH7xxx chip on the specified i2c bus */
- CH7xxxPtr sil;
+ CH7xxxPtr ch7xxx;
unsigned char ch;
xf86DrvMsg(b->scrnIndex, X_ERROR, "detecting ch7xxx\n");
- sil = xcalloc(1, sizeof(CH7xxxRec));
- if (sil == NULL)
+ ch7xxx = xcalloc(1, sizeof(CH7xxxRec));
+ if (ch7xxx == NULL)
return NULL;
- sil->d.DevName = "CH7xxx TMDS Controller";
- sil->d.SlaveAddr = addr;
- sil->d.pI2CBus = b;
- sil->d.StartTimeout = b->StartTimeout;
- sil->d.BitTimeout = b->BitTimeout;
- sil->d.AcknTimeout = b->AcknTimeout;
- sil->d.ByteTimeout = b->ByteTimeout;
- sil->d.DriverPrivate.ptr = sil;
+ ch7xxx->d.DevName = "CH7xxx TMDS Controller";
+ ch7xxx->d.SlaveAddr = addr;
+ ch7xxx->d.pI2CBus = b;
+ ch7xxx->d.StartTimeout = b->StartTimeout;
+ ch7xxx->d.BitTimeout = b->BitTimeout;
+ ch7xxx->d.AcknTimeout = b->AcknTimeout;
+ ch7xxx->d.ByteTimeout = b->ByteTimeout;
+ ch7xxx->d.DriverPrivate.ptr = ch7xxx;
- if (!ch7xxxReadByte(sil, CH7xxx_REG_VID, &ch))
+ if (!ch7xxxReadByte(ch7xxx, CH7xxx_REG_VID, &ch))
goto out;
if (ch!=(CH7xxx_VID & 0xFF))
{
- xf86DrvMsg(sil->d.pI2CBus->scrnIndex, X_ERROR, "ch7xxx not detected got %d: from %s Slave %d.\n", ch, sil->d.pI2CBus->BusName, sil->d.SlaveAddr);
+ xf86DrvMsg(ch7xxx->d.pI2CBus->scrnIndex, X_ERROR, "ch7xxx not detected got %d: from %s Slave %d.\n", ch, ch7xxx->d.pI2CBus->BusName, ch7xxx->d.SlaveAddr);
goto out;
}
- if (!ch7xxxReadByte(sil, CH7xxx_REG_DID, &ch))
+ if (!ch7xxxReadByte(ch7xxx, CH7xxx_REG_DID, &ch))
goto out;
if (ch!=(CH7xxx_DID & 0xFF))
{
- xf86DrvMsg(sil->d.pI2CBus->scrnIndex, X_ERROR, "ch7xxx not detected got %d: from %s Slave %d.\n", ch, sil->d.pI2CBus->BusName, sil->d.SlaveAddr);
+ xf86DrvMsg(ch7xxx->d.pI2CBus->scrnIndex, X_ERROR, "ch7xxx not detected got %d: from %s Slave %d.\n", ch, ch7xxx->d.pI2CBus->BusName, ch7xxx->d.SlaveAddr);
goto out;
}
- if (!xf86I2CDevInit(&(sil->d)))
+ if (!xf86I2CDevInit(&(ch7xxx->d)))
{
goto out;
}
- return sil;
+ return ch7xxx;
out:
- xfree(sil);
+ xfree(ch7xxx);
return NULL;
}
static Bool ch7xxxInit(I2CDevPtr d)
{
- CH7xxxPtr sil = CH7PTR(d);
+ CH7xxxPtr ch7xxx = CH7PTR(d);
/* not much to do */
return TRUE;
@@ -117,14 +119,14 @@ static Bool ch7xxxInit(I2CDevPtr d)
static ModeStatus ch7xxxModeValid(I2CDevPtr d, DisplayModePtr mode)
{
- CH7xxxPtr sil = CH7PTR(d);
+ CH7xxxPtr ch7xxx = CH7PTR(d);
return MODE_OK;
}
static void ch7xxxMode(I2CDevPtr d, DisplayModePtr mode)
{
- CH7xxxPtr sil = CH7PTR(d);
+ CH7xxxPtr ch7xxx = CH7PTR(d);
/* don't do much */
return;
@@ -133,11 +135,11 @@ static void ch7xxxMode(I2CDevPtr d, DisplayModePtr mode)
/* set the CH7xxx power state */
static void ch7xxxPower(I2CDevPtr d, Bool On)
{
- CH7xxxPtr sil = CH7PTR(d);
+ CH7xxxPtr ch7xxx = CH7PTR(d);
int ret;
unsigned char ch;
-
- ret = ch7xxxReadByte(sil, CH7xxx_REG8, &ch);
+#if 0
+ ret = ch7xxxReadByte(ch7xxx, CH7xxx_REG8, &ch);
if (ret)
return;
@@ -146,34 +148,37 @@ static void ch7xxxPower(I2CDevPtr d, Bool On)
else
ch &= ~CH7xxx_8_PD;
- ch7xxxWriteByte(sil, CH7xxx_REG8, ch);
+ ch7xxxWriteByte(ch7xxx, CH7xxx_REG8, ch);
+#endif
return;
}
static void ch7xxxPrintRegs(I2CDevPtr d)
{
- CH7xxxPtr sil = CH7PTR(d);
+ CH7xxxPtr ch7xxx = CH7PTR(d);
}
static void ch7xxxSaveRegs(I2CDevPtr d)
{
- CH7xxxPtr sil = CH7PTR(d);
+ CH7xxxPtr ch7xxx = CH7PTR(d);
- if (!ch7xxxReadByte(sil, CH7xxx_FREQ_LO, &sil->SavedReg.freq_lo))
+#if 0
+ if (!ch7xxxReadByte(ch7xxx, CH7xxx_FREQ_LO, &ch7xxx->SavedReg.freq_lo))
return;
- if (!ch7xxxReadByte(sil, CH7xxx_FREQ_HI, &sil->SavedReg.freq_hi))
+ if (!ch7xxxReadByte(ch7xxx, CH7xxx_FREQ_HI, &ch7xxx->SavedReg.freq_hi))
return;
- if (!ch7xxxReadByte(sil, CH7xxx_REG8, &sil->SavedReg.reg8))
+ if (!ch7xxxReadByte(ch7xxx, CH7xxx_REG8, &ch7xxx->SavedReg.reg8))
return;
- if (!ch7xxxReadByte(sil, CH7xxx_REG9, &sil->SavedReg.reg9))
+ if (!ch7xxxReadByte(ch7xxx, CH7xxx_REG9, &ch7xxx->SavedReg.reg9))
return;
- if (!ch7xxxReadByte(sil, CH7xxx_REGC, &sil->SavedReg.regc))
+ if (!ch7xxxReadByte(ch7xxx, CH7xxx_REGC, &ch7xxx->SavedReg.regc))
return;
+#endif
return;
}
diff --git a/src/ch7xxx/ch7xxx.h b/src/ch7xxx/ch7xxx.h
index 07b5544f..5ae0ab8c 100644
--- a/src/ch7xxx/ch7xxx.h
+++ b/src/ch7xxx/ch7xxx.h
@@ -26,53 +26,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef CH7xxx_H
#define CH7xxx_H
-#include "../i2c_vid.h"
-
-#define CH7xxx_VID 0x84
-#define CH7xxx_DID 0x17
-
-#define CH7xxx_REG_VID 0x4a
-#define CH7xxx_REG_DID 0x4b
-#define CH7xxx_REV 0x04
-#define CH7xxx_RSVD 0x05
-#define CH7xxx_FREQ_LO 0x06
-#define CH7xxx_FREQ_HI 0x07
-
-#define CH7xxx_REG8 0x08
-#define CH7xxx_8_VEN (1<<5)
-#define CH7xxx_8_HEN (1<<4)
-#define CH7xxx_8_DSEL (1<<3)
-#define CH7xxx_8_BSEL (1<<2)
-#define CH7xxx_8_EDGE (1<<1)
-#define CH7xxx_8_PD (1<<0)
-
-#define CH7xxx_REG9 0x09
-#define CH7xxx_9_VLOW (1<<7)
-#define CH7xxx_9_MSEL_MASK (0x7<<4)
-#define CH7xxx_9_TSEL (1<<3)
-#define CH7xxx_9_RSEN (1<<2)
-#define CH7xxx_9_HTPLG (1<<1)
-#define CH7xxx_9_MDI (1<<0)
-
-#define CH7xxx_REGC 0x0c
-
-typedef struct _CH7xxxSaveRec {
- CARD8 freq_lo;
- CARD8 freq_hi;
- CARD8 reg8;
- CARD8 reg9;
- CARD8 regc;
-} CH7xxxSaveRec;
-
-typedef struct {
- I2CDevRec d;
- CH7xxxSaveRec SavedReg;
- CH7xxxSaveRec ModeReg;
-} CH7xxxRec, *CH7xxxPtr;
-
#define CH7xxx_ADDR_1 0x76
#define CH7xxx_SYMBOL_LIST "CH7xxxVidOutput"
-#define CH7PTR(d) ((CH7xxxPtr)(d->DriverPrivate.ptr))
#endif
diff --git a/src/ch7xxx/ch7xxx_reg.h b/src/ch7xxx/ch7xxx_reg.h
new file mode 100644
index 00000000..4b17314b
--- /dev/null
+++ b/src/ch7xxx/ch7xxx_reg.h
@@ -0,0 +1,51 @@
+/**************************************************************************
+
+ Copyright 2006 Dave Airlie <airlied@linux.ie>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+on the rights to use, copy, modify, merge, publish, distribute, sub
+license, and/or sell copies of the Software, and to permit persons to whom
+the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef CH7xxx_REG_H
+#define CH7xxx_REG_H
+
+#define CH7xxx_REG_VID 0x4a
+#define CH7xxx_REG_DID 0x4b
+
+#define CH7xxx_VID 0x84
+#define CH7xxx_DID 0x17
+
+typedef struct _CH7xxxSaveRec {
+ CARD8 freq_lo;
+ CARD8 freq_hi;
+ CARD8 reg8;
+ CARD8 reg9;
+ CARD8 regc;
+} CH7xxxSaveRec;
+
+typedef struct {
+ I2CDevRec d;
+ CH7xxxSaveRec SavedReg;
+ CH7xxxSaveRec ModeReg;
+} CH7xxxRec, *CH7xxxPtr;
+
+#define CH7PTR(d) ((CH7xxxPtr)(d->DriverPrivate.ptr))
+
+#endif
diff --git a/src/sil164/sil164.c b/src/sil164/sil164.c
index 9f432a45..5c57082c 100644
--- a/src/sil164/sil164.c
+++ b/src/sil164/sil164.c
@@ -32,6 +32,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "miscstruct.h"
#include "xf86i2c.h"
+#include "../i2c_vid.h"
#include "sil164.h"
#include "sil164_reg.h"
diff --git a/src/sil164/sil164.h b/src/sil164/sil164.h
index d7b91441..ea5c4c9a 100644
--- a/src/sil164/sil164.h
+++ b/src/sil164/sil164.h
@@ -26,8 +26,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef SIL164_H
#define SIL164_H
-#include "../i2c_vid.h"
-
#define SIL164_ADDR_1 0x38
#define SIL164_SYMBOL_LIST "SIL164VidOutput"