diff options
author | Eric Anholt <eric@anholt.net> | 2006-12-18 15:32:35 -0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2006-12-18 15:39:30 -0800 |
commit | fa4642048b183134544fc5ee47558446d27f6194 (patch) | |
tree | a46711c6bf8887a3e4cc66b38e27818896775efe /src/sil164 | |
parent | dcb069a1da6b3300b0772843dd9b67efdf319637 (diff) |
Clean up i2c_vid interface, including de-StudlyCapsing and removing dead code.
The old Init() function is removed and the previous Detect() function is now
init(). This leaves us room in the namespace for a detect() like other
outputs have ("is the monitor connected?"). Also, Power() became dpms(),
taking a DPMSMode*. In general, the mode setting path now matches the intel
internal path, except for the lack of mode_fixup().
Diffstat (limited to 'src/sil164')
-rw-r--r-- | src/sil164/sil164.c | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/src/sil164/sil164.c b/src/sil164/sil164.c index 0a68d691..497336cc 100644 --- a/src/sil164/sil164.c +++ b/src/sil164/sil164.c @@ -32,16 +32,13 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "compiler.h" #include "miscstruct.h" #include "xf86i2c.h" +#define DPMS_SERVER +#include <X11/extensions/dpms.h> #include "../i2c_vid.h" #include "sil164.h" #include "sil164_reg.h" -static void -sil164PrintRegs(I2CDevPtr d); -static void -sil164Power(I2CDevPtr d, Bool On); - static Bool sil164ReadByte(SIL164Ptr sil, int addr, CARD8 *ch) { @@ -68,7 +65,7 @@ sil164WriteByte(SIL164Ptr sil, int addr, CARD8 ch) /* Silicon Image 164 driver for chip on i2c bus */ static void * -sil164Detect(I2CBusPtr b, I2CSlaveAddr addr) +sil164_init(I2CBusPtr b, I2CSlaveAddr addr) { /* this will detect the SIL164 chip on the specified i2c bus */ SIL164Ptr sil; @@ -120,26 +117,19 @@ out: return NULL; } - -static Bool -sil164Init(I2CDevPtr d) -{ - /* not much to do */ - return TRUE; -} - static ModeStatus -sil164ModeValid(I2CDevPtr d, DisplayModePtr mode) +sil164_mode_valid(I2CDevPtr d, DisplayModePtr mode) { return MODE_OK; } static void -sil164Mode(I2CDevPtr d, DisplayModePtr mode) +sil164_mode_set(I2CDevPtr d, DisplayModePtr mode) { - sil164Power(d, TRUE); - sil164PrintRegs(d); - + /* As long as the basics are set up, since we don't have clock dependencies + * in the mode setup, we can just leave the registers alone and everything + * will work fine. + */ /* recommended programming sequence from doc */ /*sil164WriteByte(sil, 0x08, 0x30); sil164WriteByte(sil, 0x09, 0x00); @@ -152,7 +142,7 @@ sil164Mode(I2CDevPtr d, DisplayModePtr mode) /* set the SIL164 power state */ static void -sil164Power(I2CDevPtr d, Bool On) +sil164_dpms(I2CDevPtr d, int mode) { SIL164Ptr sil = SILPTR(d); int ret; @@ -162,7 +152,7 @@ sil164Power(I2CDevPtr d, Bool On) if (ret == FALSE) return; - if (On) + if (mode == DPMSModeOn) ch |= SIL164_8_PD; else ch &= ~SIL164_8_PD; @@ -173,7 +163,7 @@ sil164Power(I2CDevPtr d, Bool On) } static void -sil164PrintRegs(I2CDevPtr d) +sil164_dump_regs(I2CDevPtr d) { SIL164Ptr sil = SILPTR(d); CARD8 val; @@ -193,7 +183,7 @@ sil164PrintRegs(I2CDevPtr d) } static void -sil164SaveRegs(I2CDevPtr d) +sil164_save(I2CDevPtr d) { SIL164Ptr sil = SILPTR(d); @@ -210,7 +200,7 @@ sil164SaveRegs(I2CDevPtr d) } static void -sil164RestoreRegs(I2CDevPtr d) +sil164_restore(I2CDevPtr d) { SIL164Ptr sil = SILPTR(d); @@ -224,12 +214,11 @@ sil164RestoreRegs(I2CDevPtr d) I830I2CVidOutputRec SIL164VidOutput = { - sil164Detect, - sil164Init, - sil164ModeValid, - sil164Mode, - sil164Power, - sil164PrintRegs, - sil164SaveRegs, - sil164RestoreRegs, + .init = sil164_init, + .mode_valid = sil164_mode_valid, + .mode_set = sil164_mode_set, + .dpms = sil164_dpms, + .dump_regs = sil164_dump_regs, + .save = sil164_save, + .restore = sil164_restore, }; |