[openchrome-devel] xf86-video-openchrome: Branch 'main' - 9 commits - configure.ac src/via_ch7xxx.c src/via_ch7xxx.h src/via_driver.c src/via_output.c src/via_tv.c src/via_ums.h src/via_vt162x.c
Kevin Brace
kevinbrace at kemper.freedesktop.org
Wed Sep 21 15:33:38 UTC 2022
configure.ac | 2
src/via_ch7xxx.c | 626 +++++++++++++++++++++---------------------
src/via_ch7xxx.h | 146 ++++-----
src/via_driver.c | 5
src/via_output.c | 3
src/via_tv.c | 291 ++++++++++---------
src/via_ums.h | 55 ++-
src/via_vt162x.c | 813 ++++++++++++++++++++++++++++---------------------------
8 files changed, 1020 insertions(+), 921 deletions(-)
New commits:
commit 0c752742e54fa34140386547947c81a832c9cad1
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Wed Sep 21 08:31:52 2022 -0700
Version bumped to 0.6.602
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/configure.ac b/configure.ac
index b3678d1..6bc88ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xf86-video-openchrome],
- [0.6.601],
+ [0.6.602],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
[xf86-video-openchrome])
commit 6025510d78b90195613cddcde8b52ca0d469f724
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Wed Sep 21 08:31:52 2022 -0700
Add HAVE_DEBUG macros to suppress warnings for TV output code
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/src/via_ch7xxx.c b/src/via_ch7xxx.c
index 16c66af..b6d675e 100644
--- a/src/via_ch7xxx.c
+++ b/src/via_ch7xxx.c
@@ -142,7 +142,9 @@ static void
CH7xxxSave(xf86OutputPtr output)
{
int i;
+#ifdef HAVE_DEBUG
ScrnInfoPtr pScrn = output->scrn;
+#endif /* HAVE_DEBUG */
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
@@ -156,7 +158,9 @@ static void
CH7xxxRestore(xf86OutputPtr output)
{
int i;
+#ifdef HAVE_DEBUG
ScrnInfoPtr pScrn = output->scrn;
+#endif /* HAVE_DEBUG */
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
@@ -509,7 +513,9 @@ CH7xxxModeCrtc(xf86OutputPtr output, DisplayModePtr mode)
static void
CH7xxxTVPower(xf86OutputPtr output, Bool On)
{
+#ifdef HAVE_DEBUG
ScrnInfoPtr pScrn = output->scrn;
+#endif /* HAVE_DEBUG */
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
if (On) {
@@ -525,7 +531,9 @@ CH7xxxTVPower(xf86OutputPtr output, Bool On)
static void
CH7019LCDPower(xf86OutputPtr output, Bool On)
{
+#ifdef HAVE_DEBUG
ScrnInfoPtr pScrn = output->scrn;
+#endif /* HAVE_DEBUG */
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
CARD8 W_Buffer[2], R_Buffer[1];
int i;
@@ -607,7 +615,9 @@ CH7019LCDPower(xf86OutputPtr output, Bool On)
void
ViaCH7xxxInit(xf86OutputPtr output)
{
+#ifdef HAVE_DEBUG
ScrnInfoPtr pScrn = output->scrn;
+#endif /* HAVE_DEBUG */
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
diff --git a/src/via_tv.c b/src/via_tv.c
index 7fe4941..7209bac 100644
--- a/src/via_tv.c
+++ b/src/via_tv.c
@@ -569,7 +569,9 @@ ViaTVSetMode(xf86OutputPtr output, DisplayModePtr mode)
static void
ViaTVPower(xf86OutputPtr output, Bool On)
{
+#ifdef HAVE_DEBUG
ScrnInfoPtr pScrn = output->scrn;
+#endif /* HAVE_DEBUG */
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
#ifdef HAVE_DEBUG
diff --git a/src/via_vt162x.c b/src/via_vt162x.c
index 2414729..7616fab 100644
--- a/src/via_vt162x.c
+++ b/src/via_vt162x.c
@@ -167,7 +167,9 @@ static void
VT162xSave(xf86OutputPtr output)
{
int i;
+#ifdef HAVE_DEBUG
ScrnInfoPtr pScrn = output->scrn;
+#endif /* HAVE_DEBUG */
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
@@ -180,7 +182,9 @@ VT162xSave(xf86OutputPtr output)
static void
VT162xRestore(xf86OutputPtr output)
{
+#ifdef HAVE_DEBUG
ScrnInfoPtr pScrn = output->scrn;
+#endif /* HAVE_DEBUG */
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
int i;
@@ -832,7 +836,9 @@ VT1622ModeCrtc(xf86OutputPtr output, DisplayModePtr mode)
static void
VT1621Power(xf86OutputPtr output, Bool On)
{
+#ifdef HAVE_DEBUG
ScrnInfoPtr pScrn = output->scrn;
+#endif /* HAVE_DEBUG */
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
@@ -846,7 +852,9 @@ VT1621Power(xf86OutputPtr output, Bool On)
static void
VT1622Power(xf86OutputPtr output, Bool On)
{
+#ifdef HAVE_DEBUG
ScrnInfoPtr pScrn = output->scrn;
+#endif /* HAVE_DEBUG */
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
@@ -860,7 +868,9 @@ VT1622Power(xf86OutputPtr output, Bool On)
static void
VT1625Power(xf86OutputPtr output, Bool On)
{
+#ifdef HAVE_DEBUG
ScrnInfoPtr pScrn = output->scrn;
+#endif /* HAVE_DEBUG */
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
@@ -875,7 +885,9 @@ VT1625Power(xf86OutputPtr output, Bool On)
void
ViaVT162xInit(xf86OutputPtr output)
{
+#ifdef HAVE_DEBUG
ScrnInfoPtr pScrn = output->scrn;
+#endif /* HAVE_DEBUG */
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
commit 748a8ee12743e6ca71703377d8692810b96f8a98
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Wed Sep 21 08:31:52 2022 -0700
Add HAVE_DEBUG macro for printing TV output registers
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/src/via_tv.c b/src/via_tv.c
index 91be840..7fe4941 100644
--- a/src/via_tv.c
+++ b/src/via_tv.c
@@ -832,7 +832,9 @@ via_tv_init(ScrnInfoPtr pScrn)
pVIATV->TVModeCrtc = NULL;
pVIATV->TVPower = NULL;
pVIATV->TVModes = NULL;
+#ifdef HAVE_DEBUG
pVIATV->TVPrintRegs = NULL;
+#endif /* HAVE_DEBUG */
pVIATV->LCDPower = NULL;
pVIATV->TVNumRegs = 0;
@@ -861,7 +863,10 @@ via_tv_init(ScrnInfoPtr pScrn)
|| !pVIATV->TVDACSense || !pVIATV->TVModeValid
|| !pVIATV->TVModeI2C || !pVIATV->TVModeCrtc
|| !pVIATV->TVPower || !pVIATV->TVModes
- || !pVIATV->TVPrintRegs) {
+#ifdef HAVE_DEBUG
+ || !pVIATV->TVPrintRegs
+#endif /* HAVE_DEBUG */
+ ) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"TV encoder was not properly initialized.\n");
goto free_mem;
@@ -885,7 +890,9 @@ free_mem:
pVIATV->TVModeCrtc = NULL;
pVIATV->TVPower = NULL;
pVIATV->TVModes = NULL;
+#ifdef HAVE_DEBUG
pVIATV->TVPrintRegs = NULL;
+#endif /* HAVE_DEBUG */
pVIATV->TVNumRegs = 0;
xf86DestroyI2CDevRec(pVIATV->pVIATVI2CDev, TRUE);
diff --git a/src/via_vt162x.c b/src/via_vt162x.c
index ea4103d..2414729 100644
--- a/src/via_vt162x.c
+++ b/src/via_vt162x.c
@@ -78,6 +78,7 @@ ViaSetTVClockSource(xf86OutputPtr output)
}
+#ifdef HAVE_DEBUG
static void
VT162xPrintRegs(xf86OutputPtr output)
{
@@ -95,7 +96,7 @@ VT162xPrintRegs(xf86OutputPtr output)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "End of TV registers.\n");
}
-
+#endif /* HAVE_DEBUG */
I2CDevPtr
ViaVT162xDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address)
@@ -890,7 +891,9 @@ ViaVT162xInit(xf86OutputPtr output)
pVIATV->TVPower = VT1621Power;
pVIATV->TVModes = VT1621Modes;
pVIATV->TVNumModes = sizeof(VT1621Modes) / sizeof(DisplayModeRec);
+#ifdef HAVE_DEBUG
pVIATV->TVPrintRegs = VT162xPrintRegs;
+#endif /* HAVE_DEBUG */
pVIATV->TVNumRegs = 0x68;
break;
case VIA_VT1622:
@@ -903,7 +906,9 @@ ViaVT162xInit(xf86OutputPtr output)
pVIATV->TVPower = VT1622Power;
pVIATV->TVModes = VT1622Modes;
pVIATV->TVNumModes = sizeof(VT1622Modes) / sizeof(DisplayModeRec);
+#ifdef HAVE_DEBUG
pVIATV->TVPrintRegs = VT162xPrintRegs;
+#endif /* HAVE_DEBUG */
pVIATV->TVNumRegs = 0x68;
break;
case VIA_VT1623:
@@ -916,7 +921,9 @@ ViaVT162xInit(xf86OutputPtr output)
pVIATV->TVPower = VT1622Power;
pVIATV->TVModes = VT1623Modes;
pVIATV->TVNumModes = sizeof(VT1623Modes) / sizeof(DisplayModeRec);
+#ifdef HAVE_DEBUG
pVIATV->TVPrintRegs = VT162xPrintRegs;
+#endif /* HAVE_DEBUG */
pVIATV->TVNumRegs = 0x6C;
break;
case VIA_VT1625:
@@ -929,7 +936,9 @@ ViaVT162xInit(xf86OutputPtr output)
pVIATV->TVPower = VT1625Power;
pVIATV->TVModes = VT1625Modes;
pVIATV->TVNumModes = sizeof(VT1625Modes) / sizeof(DisplayModeRec);
+#ifdef HAVE_DEBUG
pVIATV->TVPrintRegs = VT162xPrintRegs;
+#endif /* HAVE_DEBUG */
pVIATV->TVNumRegs = 0x82;
break;
default:
commit 058b0ba0a9da10b0e47edef45c461a9d0aa46b43
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Wed Sep 21 08:31:52 2022 -0700
Fix indentation issues for TV output code
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/src/via_ch7xxx.c b/src/via_ch7xxx.c
index 39c01d4..16c66af 100644
--- a/src/via_ch7xxx.c
+++ b/src/via_ch7xxx.c
@@ -85,51 +85,52 @@ ViaCH7xxxDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address)
}
switch (buf) {
- case 0x17:
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected Chrontel CH7011 TV Encoder\n");
- pVIADisplay->TVEncoder = VIA_CH7011;
- pDev->DevName="CH7011";
- break;
- case 0x19:
- xf86I2CReadByte(pDev, 0x4A, &buf);
- if (buf == 0x81) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected Chrontel CH7019A LVDS Transmitter/TV Encoder\n");
- pVIADisplay->TVEncoder = VIA_CH7019A;
- pDev->DevName="CH7019A";
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected Chrontel CH7019B LVDS Transmitter/TV Encoder\n");
- pVIADisplay->TVEncoder = VIA_CH7019B;
- pDev->DevName="CH7019B";
- }
- break;
- case 0x1B:
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected Chrontel CH7017 LVDS Transmitter\n");
- pVIADisplay->TVEncoder = VIA_CH7017;
- pDev->DevName="CH7017";
- break;
- case 0x3A:
- /* single init table --> single channel LVDS transmitter ? */
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected Chrontel CH7304 LVDS Transmitter\n");
- pVIADisplay->TVEncoder = VIA_CH7304;
- pDev->DevName="CH7304";
- break;
- case 0x3B:
- /* dual init table --> dual channel LVDS transmitter ? */
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected Chrontel CH7305 LVDS Transmitter\n");
- pVIADisplay->TVEncoder = VIA_CH7305;
- pDev->DevName="CH7305";
- break;
- default:
- pVIADisplay->TVEncoder = VIA_NONETV;
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unknown CH7xxx"
- " device found. [%x:0x1B contains %x]\n",
- Address, buf);
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Unknown CH7xxx encoder found\n");
-
- xf86DestroyI2CDevRec(pDev,TRUE);
- pDev = NULL;
- break;
+ case 0x17:
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected Chrontel CH7011 TV Encoder\n");
+ pVIADisplay->TVEncoder = VIA_CH7011;
+ pDev->DevName="CH7011";
+ break;
+ case 0x19:
+ xf86I2CReadByte(pDev, 0x4A, &buf);
+ if (buf == 0x81) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected Chrontel CH7019A LVDS Transmitter/TV Encoder\n");
+ pVIADisplay->TVEncoder = VIA_CH7019A;
+ pDev->DevName="CH7019A";
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected Chrontel CH7019B LVDS Transmitter/TV Encoder\n");
+ pVIADisplay->TVEncoder = VIA_CH7019B;
+ pDev->DevName="CH7019B";
+ }
+ break;
+ case 0x1B:
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected Chrontel CH7017 LVDS Transmitter\n");
+ pVIADisplay->TVEncoder = VIA_CH7017;
+ pDev->DevName="CH7017";
+ break;
+ case 0x3A:
+ /* single init table --> single channel LVDS transmitter ? */
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected Chrontel CH7304 LVDS Transmitter\n");
+ pVIADisplay->TVEncoder = VIA_CH7304;
+ pDev->DevName="CH7304";
+ break;
+ case 0x3B:
+ /* dual init table --> dual channel LVDS transmitter ? */
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected Chrontel CH7305 LVDS Transmitter\n");
+ pVIADisplay->TVEncoder = VIA_CH7305;
+ pDev->DevName="CH7305";
+ break;
+ default:
+ pVIADisplay->TVEncoder = VIA_NONETV;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unknown CH7xxx"
+ " device found. [%x:0x1B contains %x]\n",
+ Address, buf);
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Unknown CH7xxx encoder found\n");
+
+ xf86DestroyI2CDevRec(pDev,TRUE);
+ pDev = NULL;
+ break;
}
+
return pDev;
}
@@ -167,7 +168,7 @@ CH7xxxRestore(xf86OutputPtr output)
static CARD8
CH7xxxDACSenseI2C(I2CDevPtr pDev)
{
- CARD8 save, sense;
+ CARD8 save, sense;
/* Turn all DACP on*/
xf86I2CWriteByte(pDev, 0x49, 0x20);
@@ -223,27 +224,27 @@ CH7xxxDACSense(xf86OutputPtr output)
* seem to be correct however.
*/
switch (sense) {
- case 0x10:
+ case 0x10:
pVIATV->TVOutput = TVOUTPUT_COMPOSITE;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CH7xxx: Composite connected.\n");
return TRUE;
- case 0x0C:
+ case 0x0C:
pVIATV->TVOutput = TVOUTPUT_SVIDEO;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CH7xxx: S-Video connected.\n");
return TRUE;
- case 0x02:
+ case 0x02:
pVIATV->TVOutput = TVOUTPUT_SC;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CHxxx: Composite+S-Video connected.\n");
return TRUE;
- case 0x04:
+ case 0x04:
pVIATV->TVOutput = TVOUTPUT_YCBCR;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CHxxx: YcBcR Connected.\n");
return TRUE;
- case 0x00:
+ case 0x00:
pVIATV->TVOutput = TVOUTPUT_NONE;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CH7xxx: Nothing connected.\n");
return FALSE;
- default:
+ default:
pVIATV->TVOutput = TVOUTPUT_NONE;
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "CH7xxx: Unknown cable combination: 0x0%2X.\n",sense);
return FALSE;
@@ -258,6 +259,7 @@ CH7011ModeIndex(xf86OutputPtr output, DisplayModePtr mode)
int i;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
+
for (i = 0; CH7011Table[i].Width; i++) {
if ((CH7011Table[i].Width == mode->CrtcHDisplay) &&
(CH7011Table[i].Height == mode->CrtcVDisplay) &&
@@ -265,6 +267,7 @@ CH7011ModeIndex(xf86OutputPtr output, DisplayModePtr mode)
!(strcmp(CH7011Table[i].name, mode->name)))
return i;
}
+
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "%s:"
" Mode \"%s\" not found in Table\n", __func__, mode->name);
return 0xFF;
@@ -285,6 +288,7 @@ CH7019ModeIndex(xf86OutputPtr output, DisplayModePtr mode)
!(strcmp(CH7019Table[i].name, mode->name)))
return i;
}
+
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "%s:"
" Mode \"%s\" not found in Table\n", __func__, mode->name);
return 0xFF;
@@ -318,16 +322,14 @@ CH7xxxModeValid(xf86OutputPtr output, DisplayModePtr mode)
return MODE_BAD;
}
- if (pVIATV->TVEncoder == VIA_CH7011)
- {
+ if (pVIATV->TVEncoder == VIA_CH7011) {
if (CH7011ModeIndex(output, mode) != 0xFF)
return MODE_OK;
- }
- else
- {
+ } else {
if (CH7019ModeIndex(output, mode) != 0xFF)
return MODE_OK;
}
+
return MODE_BAD;
}
@@ -337,19 +339,14 @@ CH7xxxModeI2C(xf86OutputPtr output, DisplayModePtr mode)
ScrnInfoPtr pScrn = output->scrn;
VIAPtr pVia = VIAPTR(pScrn);
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
-
CARD8 i, j;
-
VIABIOSTVMASKTableRec Mask;
struct CH7xxxTableRec Table;
- if (pVIATV->TVEncoder == VIA_CH7011)
- {
+ if (pVIATV->TVEncoder == VIA_CH7011) {
Table = CH7011Table[CH7011ModeIndex(output, mode)];
Mask = ch7011MaskTable;
- }
- else
- {
+ } else {
Table = CH7019Table[CH7019ModeIndex(output, mode)];
Mask = ch7019MaskTable;
}
@@ -383,21 +380,21 @@ CH7xxxModeI2C(xf86OutputPtr output, DisplayModePtr mode)
/*
* Only Composite and SVideo have been tested.
*/
- switch(pVIATV->TVOutput){
- case TVOUTPUT_COMPOSITE:
- xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x2E);
- break;
- case TVOUTPUT_SVIDEO:
- xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x32);
- break;
- case TVOUTPUT_SC:
- xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x3C);
- break;
- case TVOUTPUT_YCBCR:
- xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x3A);
- break;
- default:
- break;
+ switch (pVIATV->TVOutput) {
+ case TVOUTPUT_COMPOSITE:
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x2E);
+ break;
+ case TVOUTPUT_SVIDEO:
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x32);
+ break;
+ case TVOUTPUT_SC:
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x3C);
+ break;
+ case TVOUTPUT_YCBCR:
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x3A);
+ break;
+ default:
+ break;
}
if (pVia->IsSecondary) { /* Patch as setting 2nd path */
@@ -418,17 +415,13 @@ CH7xxxModeCrtc(xf86OutputPtr output, DisplayModePtr mode)
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
CARD8 *CRTC, *Misc;
int i, j;
-
VIABIOSTVMASKTableRec Mask;
struct CH7xxxTableRec Table;
- if (pVIATV->TVEncoder == VIA_CH7011)
- {
+ if (pVIATV->TVEncoder == VIA_CH7011) {
Table = CH7011Table[CH7011ModeIndex(output, mode)];
Mask = ch7011MaskTable;
- }
- else
- {
+ } else {
Table = CH7019Table[CH7019ModeIndex(output, mode)];
Mask = ch7019MaskTable;
}
@@ -437,16 +430,16 @@ CH7xxxModeCrtc(xf86OutputPtr output, DisplayModePtr mode)
if (pVia->IsSecondary) {
switch (pScrn->bitsPerPixel) {
- case 16:
- CRTC = Table.CRTC2_16BPP;
- break;
- case 32:
- CRTC = Table.CRTC2_32BPP;
- break;
- case 8:
- default:
- CRTC = Table.CRTC2_8BPP;
- break;
+ case 16:
+ CRTC = Table.CRTC2_16BPP;
+ break;
+ case 32:
+ CRTC = Table.CRTC2_32BPP;
+ break;
+ case 8:
+ default:
+ CRTC = Table.CRTC2_8BPP;
+ break;
}
Misc = Table.Misc2;
@@ -468,9 +461,8 @@ CH7xxxModeCrtc(xf86OutputPtr output, DisplayModePtr mode)
/* Disable LCD Scaling */
if (!pVia->SAMM || pVia->FirstInit)
- hwp->writeCrtc(hwp, 0x79, 0x00);}
- else {
-
+ hwp->writeCrtc(hwp, 0x79, 0x00);
+ } else {
CRTC = Table.CRTC1;
Misc = Table.Misc1;
@@ -520,10 +512,10 @@ CH7xxxTVPower(xf86OutputPtr output, Bool On)
ScrnInfoPtr pScrn = output->scrn;
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- if (On){
+ if (On) {
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s: On\n", __func__));
xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x20);
- }else{
+ } else {
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s: Off\n", __func__));
xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x3E);
xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x1E, 0xD0);
@@ -538,7 +530,7 @@ CH7019LCDPower(xf86OutputPtr output, Bool On)
CARD8 W_Buffer[2], R_Buffer[1];
int i;
- if (On){
+ if (On) {
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s: On\n", __func__));
W_Buffer[0] = 0x63;
W_Buffer[1] = 0x4B;
@@ -593,7 +585,7 @@ CH7019LCDPower(xf86OutputPtr output, Bool On)
"%s: [%d]0x66 = %X!\n",
__func__, i+1, R_Buffer[0]));
}
- }else{
+ } else {
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s: Off\n", __func__));
/* Turn off VDD (Turn off backlignt only) */
W_Buffer[0] = 0x66;
@@ -621,43 +613,43 @@ ViaCH7xxxInit(xf86OutputPtr output)
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
switch (pVIATV->TVEncoder) {
- case VIA_CH7011:
- pVIATV->TVSave = CH7xxxSave;
- pVIATV->TVRestore = CH7xxxRestore;
- pVIATV->TVDACSense = CH7xxxDACSense;
- pVIATV->TVModeValid = CH7xxxModeValid;
- pVIATV->TVModeI2C = CH7xxxModeI2C;
- pVIATV->TVModeCrtc = CH7xxxModeCrtc;
- pVIATV->TVPower = CH7xxxTVPower;
- pVIATV->TVModes = CH7011Modes;
- pVIATV->TVNumModes = sizeof(CH7011Modes) / sizeof(DisplayModeRec);
- pVIATV->LCDPower = NULL;
- pVIATV->TVNumRegs = CH_7011_MAX_NUM_REG;
+ case VIA_CH7011:
+ pVIATV->TVSave = CH7xxxSave;
+ pVIATV->TVRestore = CH7xxxRestore;
+ pVIATV->TVDACSense = CH7xxxDACSense;
+ pVIATV->TVModeValid = CH7xxxModeValid;
+ pVIATV->TVModeI2C = CH7xxxModeI2C;
+ pVIATV->TVModeCrtc = CH7xxxModeCrtc;
+ pVIATV->TVPower = CH7xxxTVPower;
+ pVIATV->TVModes = CH7011Modes;
+ pVIATV->TVNumModes = sizeof(CH7011Modes) / sizeof(DisplayModeRec);
+ pVIATV->LCDPower = NULL;
+ pVIATV->TVNumRegs = CH_7011_MAX_NUM_REG;
#ifdef HAVE_DEBUG
- pVIATV->TVPrintRegs = CH7xxxPrintRegs;
+ pVIATV->TVPrintRegs = CH7xxxPrintRegs;
#endif
- break;
- case VIA_CH7019A:
- case VIA_CH7019B:
- pVIATV->TVDACSense = CH7xxxDACSense;
- pVIATV->TVSave = CH7xxxSave;
- pVIATV->TVRestore = CH7xxxRestore;
- pVIATV->TVModeValid = CH7xxxModeValid;
- pVIATV->TVModeI2C = CH7xxxModeI2C;
- pVIATV->TVModeCrtc = CH7xxxModeCrtc;
- pVIATV->TVPower = CH7xxxTVPower;
- pVIATV->TVModes = CH7019Modes;
- pVIATV->TVNumModes = sizeof(CH7019Modes) / sizeof(DisplayModeRec);
- pVIATV->LCDPower = CH7019LCDPower;
- pVIATV->TVNumRegs = CH_7019_MAX_NUM_REG;
+ break;
+ case VIA_CH7019A:
+ case VIA_CH7019B:
+ pVIATV->TVDACSense = CH7xxxDACSense;
+ pVIATV->TVSave = CH7xxxSave;
+ pVIATV->TVRestore = CH7xxxRestore;
+ pVIATV->TVModeValid = CH7xxxModeValid;
+ pVIATV->TVModeI2C = CH7xxxModeI2C;
+ pVIATV->TVModeCrtc = CH7xxxModeCrtc;
+ pVIATV->TVPower = CH7xxxTVPower;
+ pVIATV->TVModes = CH7019Modes;
+ pVIATV->TVNumModes = sizeof(CH7019Modes) / sizeof(DisplayModeRec);
+ pVIATV->LCDPower = CH7019LCDPower;
+ pVIATV->TVNumRegs = CH_7019_MAX_NUM_REG;
#ifdef HAVE_DEBUG
- pVIATV->TVPrintRegs = CH7xxxPrintRegs;
+ pVIATV->TVPrintRegs = CH7xxxPrintRegs;
#endif
- break;
- default:
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s missing\n",
- __func__));
- break;
+ break;
+ default:
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s missing\n",
+ __func__));
+ break;
}
/* Save before continuing */
diff --git a/src/via_tv.c b/src/via_tv.c
index b63d8a4..91be840 100644
--- a/src/via_tv.c
+++ b/src/via_tv.c
@@ -546,6 +546,7 @@ ViaTVDACSense(xf86OutputPtr output)
if (pVIATV->TVDACSense)
return pVIATV->TVDACSense(output);
+
return FALSE;
}
@@ -703,6 +704,7 @@ via_tv_detect(xf86OutputPtr output)
if (ViaTVDACSense(output))
status = XF86OutputStatusConnected;
+
return status;
}
@@ -717,6 +719,7 @@ via_tv_get_modes(xf86OutputPtr output)
mode = xf86DuplicateMode(&pVIATV->TVModes[i]);
modes = xf86ModesAdd(modes, mode);
}
+
return modes;
}
diff --git a/src/via_vt162x.c b/src/via_vt162x.c
index 3272506..ea4103d 100644
--- a/src/via_vt162x.c
+++ b/src/via_vt162x.c
@@ -42,38 +42,38 @@ ViaSetTVClockSource(xf86OutputPtr output)
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
- switch(pVIATV->TVEncoder) {
- case VIA_VT1625:
- /* External TV: */
- switch(pVia->Chipset) {
- case VIA_CX700:
- case VIA_VX800:
- case VIA_VX855:
- case VIA_VX900:
- /* IGA1 */
- if (!iga->index) {
- /* Fixing it to DVP1 for IGA1. */
- ViaCrtcMask(hwp, 0x6C, 0xB0, 0xF0);
- /* IGA2 */
- } else {
- /* Fixing it to DVP1 for IGA2. */
- ViaCrtcMask(hwp, 0x6C, 0x0B, 0x0F);
- }
- break;
- default:
- if (!iga->index)
- ViaCrtcMask(hwp, 0x6C, 0x21, 0x21);
- else
- ViaCrtcMask(hwp, 0x6C, 0xA1, 0xA1);
- break;
+ switch (pVIATV->TVEncoder) {
+ case VIA_VT1625:
+ /* External TV: */
+ switch (pVia->Chipset) {
+ case VIA_CX700:
+ case VIA_VX800:
+ case VIA_VX855:
+ case VIA_VX900:
+ /* IGA1 */
+ if (!iga->index) {
+ /* Fixing it to DVP1 for IGA1. */
+ ViaCrtcMask(hwp, 0x6C, 0xB0, 0xF0);
+ /* IGA2 */
+ } else {
+ /* Fixing it to DVP1 for IGA2. */
+ ViaCrtcMask(hwp, 0x6C, 0x0B, 0x0F);
}
break;
default:
if (!iga->index)
- ViaCrtcMask(hwp, 0x6C, 0x50, 0xF0);
+ ViaCrtcMask(hwp, 0x6C, 0x21, 0x21);
else
- ViaCrtcMask(hwp, 0x6C, 0x05, 0x0F);
+ ViaCrtcMask(hwp, 0x6C, 0xA1, 0xA1);
break;
+ }
+ break;
+ default:
+ if (!iga->index)
+ ViaCrtcMask(hwp, 0x6C, 0x50, 0xF0);
+ else
+ ViaCrtcMask(hwp, 0x6C, 0x05, 0x0F);
+ break;
}
}
@@ -85,7 +85,6 @@ VT162xPrintRegs(xf86OutputPtr output)
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
CARD8 i, buf;
-
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Printing registers for %s\n",
pVIATV->pVIATVI2CDev->DevName);
@@ -125,38 +124,38 @@ ViaVT162xDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address)
}
switch (buf) {
- case 0x02:
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Detected VIA Technologies VT1621 TV Encoder\n");
- pVIADisplay->TVEncoder = VIA_VT1621;
- pDev->DevName = "VT1621";
- break;
- case 0x03:
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Detected VIA Technologies VT1622 TV Encoder\n");
- pVIADisplay->TVEncoder = VIA_VT1622;
- pDev->DevName = "VT1622";
- break;
- case 0x10:
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Detected VIA Technologies VT1622A/VT1623 TV Encoder\n");
- pVIADisplay->TVEncoder = VIA_VT1623;
- pDev->DevName = "VT1623";
- break;
- case 0x50:
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Detected VIA Technologies VT1625 TV Encoder\n");
- pVIADisplay->TVEncoder = VIA_VT1625;
- pDev->DevName = "VT1625";
- break;
- default:
- pVIADisplay->TVEncoder = VIA_NONETV;
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Unknown TV Encoder found at %s %X.\n",
- pBus->BusName, Address);
- xf86DestroyI2CDevRec(pDev, TRUE);
- pDev = NULL;
- break;
+ case 0x02:
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Detected VIA Technologies VT1621 TV Encoder\n");
+ pVIADisplay->TVEncoder = VIA_VT1621;
+ pDev->DevName = "VT1621";
+ break;
+ case 0x03:
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Detected VIA Technologies VT1622 TV Encoder\n");
+ pVIADisplay->TVEncoder = VIA_VT1622;
+ pDev->DevName = "VT1622";
+ break;
+ case 0x10:
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Detected VIA Technologies VT1622A/VT1623 TV Encoder\n");
+ pVIADisplay->TVEncoder = VIA_VT1623;
+ pDev->DevName = "VT1623";
+ break;
+ case 0x50:
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Detected VIA Technologies VT1625 TV Encoder\n");
+ pVIADisplay->TVEncoder = VIA_VT1625;
+ pDev->DevName = "VT1625";
+ break;
+ default:
+ pVIADisplay->TVEncoder = VIA_NONETV;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Unknown TV Encoder found at %s %X.\n",
+ pBus->BusName, Address);
+ xf86DestroyI2CDevRec(pDev, TRUE);
+ pDev = NULL;
+ break;
}
return pDev;
@@ -264,31 +263,31 @@ VT1621DACSense(xf86OutputPtr output)
sense = VT162xDACSenseI2C(pVIATV->pVIATVI2CDev);
switch (sense) {
- case 0x00:
- pVIATV->TVOutput = TVOUTPUT_SC;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VT1621: S-Video & Composite connected.\n");
- return TRUE;
- case 0x01:
- pVIATV->TVOutput = TVOUTPUT_COMPOSITE;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VT1621: Composite connected.\n");
- return TRUE;
- case 0x02:
- pVIATV->TVOutput = TVOUTPUT_SVIDEO;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VT1621: S-Video connected.\n");
- return TRUE;
- case 0x03:
- pVIATV->TVOutput = TVOUTPUT_NONE;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VT1621: Nothing connected.\n");
- return FALSE;
- default:
- pVIATV->TVOutput = TVOUTPUT_NONE;
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "VT1621: Unknown cable combination: 0x0%2X.\n", sense);
- return FALSE;
+ case 0x00:
+ pVIATV->TVOutput = TVOUTPUT_SC;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "VT1621: S-Video & Composite connected.\n");
+ return TRUE;
+ case 0x01:
+ pVIATV->TVOutput = TVOUTPUT_COMPOSITE;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "VT1621: Composite connected.\n");
+ return TRUE;
+ case 0x02:
+ pVIATV->TVOutput = TVOUTPUT_SVIDEO;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "VT1621: S-Video connected.\n");
+ return TRUE;
+ case 0x03:
+ pVIATV->TVOutput = TVOUTPUT_NONE;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "VT1621: Nothing connected.\n");
+ return FALSE;
+ default:
+ pVIATV->TVOutput = TVOUTPUT_NONE;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "VT1621: Unknown cable combination: 0x0%2X.\n", sense);
+ return FALSE;
}
}
@@ -306,41 +305,41 @@ VT1622DACSense(xf86OutputPtr output)
sense = VT162xDACSenseI2C(pVIATV->pVIATVI2CDev);
switch (sense) {
- case 0x00: /* DAC A,B,C,D */
- pVIATV->TVOutput = TVOUTPUT_RGB;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VT162x: RGB connected.\n");
- return TRUE;
- case 0x01: /* DAC A,B,C */
- pVIATV->TVOutput = TVOUTPUT_SC;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VT162x: S-Video & Composite connected.\n");
- return TRUE;
- case 0x07: /* DAC A */
- pVIATV->TVOutput = TVOUTPUT_COMPOSITE;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VT162x: Composite connected.\n");
- return TRUE;
- case 0x08: /* DAC B,C,D */
- pVIATV->TVOutput = TVOUTPUT_YCBCR;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VT162x: YcBcR connected.\n");
- return TRUE;
- case 0x09: /* DAC B,C */
- pVIATV->TVOutput = TVOUTPUT_SVIDEO;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VT162x: S-Video connected.\n");
- return TRUE;
- case 0x0F:
- pVIATV->TVOutput = TVOUTPUT_NONE;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VT162x: Nothing connected.\n");
- return FALSE;
- default:
- pVIATV->TVOutput = TVOUTPUT_NONE;
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "VT162x: Unknown cable combination: 0x0%2X.\n", sense);
- return FALSE;
+ case 0x00: /* DAC A,B,C,D */
+ pVIATV->TVOutput = TVOUTPUT_RGB;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "VT162x: RGB connected.\n");
+ return TRUE;
+ case 0x01: /* DAC A,B,C */
+ pVIATV->TVOutput = TVOUTPUT_SC;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "VT162x: S-Video & Composite connected.\n");
+ return TRUE;
+ case 0x07: /* DAC A */
+ pVIATV->TVOutput = TVOUTPUT_COMPOSITE;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "VT162x: Composite connected.\n");
+ return TRUE;
+ case 0x08: /* DAC B,C,D */
+ pVIATV->TVOutput = TVOUTPUT_YCBCR;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "VT162x: YcBcR connected.\n");
+ return TRUE;
+ case 0x09: /* DAC B,C */
+ pVIATV->TVOutput = TVOUTPUT_SVIDEO;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "VT162x: S-Video connected.\n");
+ return TRUE;
+ case 0x0F:
+ pVIATV->TVOutput = TVOUTPUT_NONE;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "VT162x: Nothing connected.\n");
+ return FALSE;
+ default:
+ pVIATV->TVOutput = TVOUTPUT_NONE;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "VT162x: Unknown cable combination: 0x0%2X.\n", sense);
+ return FALSE;
}
}
@@ -358,41 +357,41 @@ VT1625DACSense(xf86OutputPtr output)
sense = VT1625DACSenseI2C(pVIATV->pVIATVI2CDev);
switch (sense) {
- case 0x00: /* DAC A,B,C,D,E,F */
- pVIATV->TVOutput = TVOUTPUT_RGB;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VT1625: RGB connected.\n");
- return TRUE;
- case 0x07: /* DAC A,B,C */
- pVIATV->TVOutput = TVOUTPUT_SC;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VT1625: S-Video & Composite connected.\n");
- return TRUE;
- case 0x37: /* DAC C */
- pVIATV->TVOutput = TVOUTPUT_COMPOSITE;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VT1625: Composite connected.\n");
- return TRUE;
- case 0x38: /* DAC D,E,F */
- pVIATV->TVOutput = TVOUTPUT_YCBCR;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VT1625: YCbCr connected.\n");
- return TRUE;
- case 0x0F: /* DAC A,B */
- pVIATV->TVOutput = TVOUTPUT_SVIDEO;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VT1625: S-Video connected.\n");
- return TRUE;
- case 0x3F:
- pVIATV->TVOutput = TVOUTPUT_NONE;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VT1625: Nothing connected.\n");
- return FALSE;
- default:
- pVIATV->TVOutput = TVOUTPUT_NONE;
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "VT1625: Unknown cable combination: 0x0%2X.\n", sense);
- return FALSE;
+ case 0x00: /* DAC A,B,C,D,E,F */
+ pVIATV->TVOutput = TVOUTPUT_RGB;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "VT1625: RGB connected.\n");
+ return TRUE;
+ case 0x07: /* DAC A,B,C */
+ pVIATV->TVOutput = TVOUTPUT_SC;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "VT1625: S-Video & Composite connected.\n");
+ return TRUE;
+ case 0x37: /* DAC C */
+ pVIATV->TVOutput = TVOUTPUT_COMPOSITE;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "VT1625: Composite connected.\n");
+ return TRUE;
+ case 0x38: /* DAC D,E,F */
+ pVIATV->TVOutput = TVOUTPUT_YCBCR;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "VT1625: YCbCr connected.\n");
+ return TRUE;
+ case 0x0F: /* DAC A,B */
+ pVIATV->TVOutput = TVOUTPUT_SVIDEO;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "VT1625: S-Video connected.\n");
+ return TRUE;
+ case 0x3F:
+ pVIATV->TVOutput = TVOUTPUT_NONE;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "VT1625: Nothing connected.\n");
+ return FALSE;
+ default:
+ pVIATV->TVOutput = TVOUTPUT_NONE;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "VT1625: Unknown cable combination: 0x0%2X.\n", sense);
+ return FALSE;
}
}
@@ -412,6 +411,7 @@ VT1621ModeIndex(xf86OutputPtr output, DisplayModePtr mode)
!(strcmp(VT1621Table[i].name, mode->name)))
return i;
}
+
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "%s:"
" Mode \"%s\" not found in Table\n", __func__, mode->name);
return 0xFF;
@@ -481,6 +481,7 @@ VT1622ModeIndex(xf86OutputPtr output, DisplayModePtr mode)
!strcmp(Table[i].name, mode->name))
return i;
}
+
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "%s:"
" Mode \"%s\" not found in Table\n", __func__, mode->name);
return 0xFF;
commit 2c71957742b32d0317cf09eb81532f3e2737e95c
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Wed Sep 21 08:31:51 2022 -0700
Automatically generate debug message function names for TV output code
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/src/via_ch7xxx.c b/src/via_ch7xxx.c
index 4a40987..39c01d4 100644
--- a/src/via_ch7xxx.c
+++ b/src/via_ch7xxx.c
@@ -66,7 +66,7 @@ ViaCH7xxxDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address)
I2CDevPtr pDev = xf86CreateI2CDevRec();
CARD8 buf;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaCH7xxxDetect\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
pDev->DevName = "CH7xxx";
pDev->SlaveAddr = Address;
@@ -144,7 +144,7 @@ CH7xxxSave(xf86OutputPtr output)
ScrnInfoPtr pScrn = output->scrn;
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxSave\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
for (i = 0; i < pVIATV->TVNumRegs; i++)
xf86I2CReadByte(pVIATV->pVIATVI2CDev, i, &(pVIATV->TVRegs[i]));
@@ -158,7 +158,7 @@ CH7xxxRestore(xf86OutputPtr output)
ScrnInfoPtr pScrn = output->scrn;
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxRestore\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
for (i = 0; i < pVIATV->TVNumRegs; i++)
xf86I2CWriteByte(pVIATV->pVIATVI2CDev, i, pVIATV->TVRegs[i]);
@@ -208,7 +208,7 @@ CH7xxxDACSense(xf86OutputPtr output)
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
CARD8 sense;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxDACDetect\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
/* is this needed? IH */
if (!pVIATV->pVIATVI2CDev ||
@@ -257,7 +257,7 @@ CH7011ModeIndex(xf86OutputPtr output, DisplayModePtr mode)
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
int i;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7011ModeIndex\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
for (i = 0; CH7011Table[i].Width; i++) {
if ((CH7011Table[i].Width == mode->CrtcHDisplay) &&
(CH7011Table[i].Height == mode->CrtcVDisplay) &&
@@ -265,8 +265,8 @@ CH7011ModeIndex(xf86OutputPtr output, DisplayModePtr mode)
!(strcmp(CH7011Table[i].name, mode->name)))
return i;
}
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "CH7011ModeIndex:"
- " Mode \"%s\" not found in Table\n", mode->name);
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "%s:"
+ " Mode \"%s\" not found in Table\n", __func__, mode->name);
return 0xFF;
}
@@ -277,7 +277,7 @@ CH7019ModeIndex(xf86OutputPtr output, DisplayModePtr mode)
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
int i;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7019ModeIndex\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
for (i = 0; CH7019Table[i].Width; i++) {
if ((CH7019Table[i].Width == mode->CrtcHDisplay) &&
(CH7019Table[i].Height == mode->CrtcVDisplay) &&
@@ -285,8 +285,8 @@ CH7019ModeIndex(xf86OutputPtr output, DisplayModePtr mode)
!(strcmp(CH7019Table[i].name, mode->name)))
return i;
}
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "CH7019ModeIndex:"
- " Mode \"%s\" not found in Table\n", mode->name);
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "%s:"
+ " Mode \"%s\" not found in Table\n", __func__, mode->name);
return 0xFF;
}
@@ -299,7 +299,7 @@ CH7xxxModeValid(xf86OutputPtr output, DisplayModePtr mode)
ScrnInfoPtr pScrn = output->scrn;
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxModeValid\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
if ((mode->PrivSize != sizeof(struct CH7xxxModePrivate)) ||
((mode->Private != (void *) &CH7xxxModePrivateNTSC) &&
@@ -354,7 +354,7 @@ CH7xxxModeI2C(xf86OutputPtr output, DisplayModePtr mode)
Mask = ch7019MaskTable;
}
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7011ModeI2C\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x3E);
xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x1E, 0xD0);
@@ -433,7 +433,7 @@ CH7xxxModeCrtc(xf86OutputPtr output, DisplayModePtr mode)
Mask = ch7019MaskTable;
}
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxModeCrtc\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
if (pVia->IsSecondary) {
switch (pScrn->bitsPerPixel) {
@@ -521,10 +521,10 @@ CH7xxxTVPower(xf86OutputPtr output, Bool On)
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
if (On){
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxTVPower: On\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s: On\n", __func__));
xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x20);
}else{
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxTVPower: Off\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s: Off\n", __func__));
xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x3E);
xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x1E, 0xD0);
}
@@ -539,7 +539,7 @@ CH7019LCDPower(xf86OutputPtr output, Bool On)
int i;
if (On){
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxLCDPower: On\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s: On\n", __func__));
W_Buffer[0] = 0x63;
W_Buffer[1] = 0x4B;
xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
@@ -555,13 +555,15 @@ CH7019LCDPower(xf86OutputPtr output, Bool On)
W_Buffer[1] = (R_Buffer[0] | 0x40);
xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "CH7xxxLCDPower: [%d]write 0x63 = %X!\n", i+1, W_Buffer[1]));
+ "%s: [%d]write 0x63 = %X!\n",
+ __func__, i+1, W_Buffer[1]));
usleep(1);
W_Buffer[0] = 0x63;
W_Buffer[1] &= ~0x40;
xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "CH7xxxLCDPower: [%d]write 0x63 = %X!\n", i+1, W_Buffer[1]));
+ "%s: [%d]write 0x63 = %X!\n",
+ __func__, i+1, W_Buffer[1]));
usleep(100);
W_Buffer[0] = 0x66;
xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
@@ -572,7 +574,7 @@ CH7019LCDPower(xf86OutputPtr output, Bool On)
W_Buffer[1] = R_Buffer[0] | 0x01;
xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "CH7xxxLCDPower: CH7019 PLL lock ok!\n"));
+ "%s: CH7019 PLL lock ok!\n", __func__));
/* reset data path */
W_Buffer[0] = 0x48;
xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
@@ -585,12 +587,14 @@ CH7019LCDPower(xf86OutputPtr output, Bool On)
}
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "CH7xxxLCDPower: [%d]CH7019 PLL lock fail!\n", i+1));
+ "%s: [%d]CH7019 PLL lock fail!\n",
+ __func__, i+1));
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "CH7xxxLCDPower: [%d]0x66 = %X!\n", i+1, R_Buffer[0]));
+ "%s: [%d]0x66 = %X!\n",
+ __func__, i+1, R_Buffer[0]));
}
}else{
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxLCDPower: Off\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s: Off\n", __func__));
/* Turn off VDD (Turn off backlignt only) */
W_Buffer[0] = 0x66;
xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
@@ -614,7 +618,7 @@ ViaCH7xxxInit(xf86OutputPtr output)
ScrnInfoPtr pScrn = output->scrn;
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaCH7xxxInit\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
switch (pVIATV->TVEncoder) {
case VIA_CH7011:
@@ -651,7 +655,8 @@ ViaCH7xxxInit(xf86OutputPtr output)
#endif
break;
default:
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaCH7xxxInit missing\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s missing\n",
+ __func__));
break;
}
diff --git a/src/via_tv.c b/src/via_tv.c
index 87010b2..b63d8a4 100644
--- a/src/via_tv.c
+++ b/src/via_tv.c
@@ -50,7 +50,7 @@ viaTVSetDisplaySource(ScrnInfoPtr pScrn, CARD8 displaySource)
CARD8 sr5a = 0x00;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Entered viaTVSetDisplaySource.\n"));
+ "Entered %s.\n", __func__));
if ((pVia->Chipset == VIA_CX700)
|| (pVia->Chipset == VIA_VX800)
@@ -173,7 +173,7 @@ viaTVSetDisplaySource(ScrnInfoPtr pScrn, CARD8 displaySource)
}
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Exiting viaTVSetDisplaySource.\n"));
+ "Exiting %s.\n", __func__));
}
static void
@@ -185,7 +185,7 @@ viaTVEnableIOPads(ScrnInfoPtr pScrn, CARD8 ioPadState)
CARD8 sr5a = 0x00;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Entered viaTVEnableIOPads.\n"));
+ "Entered %s.\n", __func__));
if ((pVia->Chipset == VIA_CX700)
|| (pVia->Chipset == VIA_VX800)
@@ -308,7 +308,7 @@ viaTVEnableIOPads(ScrnInfoPtr pScrn, CARD8 ioPadState)
}
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Exiting viaTVEnableIOPads.\n"));
+ "Exiting %s.\n", __func__));
}
static void
@@ -320,7 +320,7 @@ viaTVSetClockDriveStrength(ScrnInfoPtr pScrn, CARD8 clockDriveStrength)
CARD8 sr5a = 0x00;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Entered viaTVSetClockDriveStrength.\n"));
+ "Entered %s.\n", __func__));
if ((pVia->Chipset == VIA_CX700)
|| (pVia->Chipset == VIA_VX800)
@@ -413,7 +413,7 @@ viaTVSetClockDriveStrength(ScrnInfoPtr pScrn, CARD8 clockDriveStrength)
}
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Exiting viaTVSetClockDriveStrength.\n"));
+ "Exiting %s.\n", __func__));
}
static void
@@ -425,7 +425,7 @@ viaTVSetDataDriveStrength(ScrnInfoPtr pScrn, CARD8 dataDriveStrength)
CARD8 sr5a = 0x00;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Entered viaTVSetDataDriveStrength.\n"));
+ "Entered %s.\n", __func__));
if ((pVia->Chipset == VIA_CX700)
|| (pVia->Chipset == VIA_VX800)
@@ -518,7 +518,7 @@ viaTVSetDataDriveStrength(ScrnInfoPtr pScrn, CARD8 dataDriveStrength)
}
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Exiting viaTVSetDataDriveStrength.\n"));
+ "Exiting %s.\n", __func__));
}
static void
@@ -573,9 +573,9 @@ ViaTVPower(xf86OutputPtr output, Bool On)
#ifdef HAVE_DEBUG
if (On)
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaTVPower: On.\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s: On.\n", __func__);
else
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaTVPower: Off.\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s: Off.\n", __func__);
#endif
if (pVIATV->TVPower)
diff --git a/src/via_vt162x.c b/src/via_vt162x.c
index 3d382a4..3272506 100644
--- a/src/via_vt162x.c
+++ b/src/via_vt162x.c
@@ -40,7 +40,7 @@ ViaSetTVClockSource(xf86OutputPtr output)
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
vgaHWPtr hwp = VGAHWPTR(pScrn);
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaSetTVClockSource\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
switch(pVIATV->TVEncoder) {
case VIA_VT1625:
@@ -105,7 +105,7 @@ ViaVT162xDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address)
I2CDevPtr pDev = xf86CreateI2CDevRec();
CARD8 buf;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT162xDetect\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
pDev->DevName = "VT162x";
pDev->SlaveAddr = Address;
@@ -170,7 +170,7 @@ VT162xSave(xf86OutputPtr output)
ScrnInfoPtr pScrn = output->scrn;
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT162xSave\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
for (i = 0; i < pVIATV->TVNumRegs; i++)
xf86I2CReadByte(pVIATV->pVIATVI2CDev, i, &(pVIATV->TVRegs[i]));
@@ -184,7 +184,7 @@ VT162xRestore(xf86OutputPtr output)
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
int i;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT162xRestore\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
for (i = 0; i < pVIATV->TVNumRegs; i++)
xf86I2CWriteByte(pVIATV->pVIATVI2CDev, i, pVIATV->TVRegs[i]);
@@ -260,7 +260,7 @@ VT1621DACSense(xf86OutputPtr output)
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
CARD8 sense;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621DACSense\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
sense = VT162xDACSenseI2C(pVIATV->pVIATVI2CDev);
switch (sense) {
@@ -302,7 +302,7 @@ VT1622DACSense(xf86OutputPtr output)
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
CARD8 sense;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622DACSense\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
sense = VT162xDACSenseI2C(pVIATV->pVIATVI2CDev);
switch (sense) {
@@ -354,7 +354,7 @@ VT1625DACSense(xf86OutputPtr output)
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
CARD8 sense;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1625DACSense\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
sense = VT1625DACSenseI2C(pVIATV->pVIATVI2CDev);
switch (sense) {
@@ -403,7 +403,7 @@ VT1621ModeIndex(xf86OutputPtr output, DisplayModePtr mode)
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
int i;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621ModeIndex\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
for (i = 0; VT1621Table[i].Width; i++) {
if ((VT1621Table[i].Width == mode->CrtcHDisplay) &&
@@ -412,8 +412,8 @@ VT1621ModeIndex(xf86OutputPtr output, DisplayModePtr mode)
!(strcmp(VT1621Table[i].name, mode->name)))
return i;
}
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VT1621ModeIndex:"
- " Mode \"%s\" not found in Table\n", mode->name);
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "%s:"
+ " Mode \"%s\" not found in Table\n", __func__, mode->name);
return 0xFF;
}
@@ -423,7 +423,7 @@ VT1621ModeValid(xf86OutputPtr output, DisplayModePtr mode)
ScrnInfoPtr pScrn = output->scrn;
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621ModeValid\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
if ((mode->PrivSize != sizeof(struct VT162xModePrivate)) ||
((mode->Private != (void *)&VT162xModePrivateNTSC) &&
@@ -458,7 +458,7 @@ VT1622ModeIndex(xf86OutputPtr output, DisplayModePtr mode)
struct VT162XTableRec *Table;
int i;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622ModeIndex\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
if (pVIATV->TVEncoder == VIA_VT1622)
Table = VT1622Table;
@@ -481,8 +481,8 @@ VT1622ModeIndex(xf86OutputPtr output, DisplayModePtr mode)
!strcmp(Table[i].name, mode->name))
return i;
}
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VT1622ModeIndex:"
- " Mode \"%s\" not found in Table\n", mode->name);
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "%s:"
+ " Mode \"%s\" not found in Table\n", __func__, mode->name);
return 0xFF;
}
@@ -492,7 +492,7 @@ VT1622ModeValid(xf86OutputPtr output, DisplayModePtr mode)
ScrnInfoPtr pScrn = output->scrn;
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622ModeValid\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
if ((mode->PrivSize != sizeof(struct VT162xModePrivate)) ||
((mode->Private != (void *)&VT162xModePrivateNTSC) &&
@@ -525,7 +525,7 @@ VT1625ModeValid(xf86OutputPtr output, DisplayModePtr mode)
ScrnInfoPtr pScrn = output->scrn;
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1625ModeValid\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
if ((mode->PrivSize != sizeof(struct VT162xModePrivate)) ||
((mode->Private != (void *)&VT162xModePrivateNTSC) &&
@@ -594,7 +594,7 @@ VT1621ModeI2C(xf86OutputPtr output, DisplayModePtr mode)
struct VT1621TableRec Table = VT1621Table[VT1621ModeIndex(output, mode)];
CARD8 i;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621ModeI2C\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
for (i = 0; i < 0x16; i++)
xf86I2CWriteByte(pVIATV->pVIATVI2CDev, i, Table.TV[i]);
@@ -644,7 +644,7 @@ VT1621ModeCrtc(xf86OutputPtr output, DisplayModePtr mode)
VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
struct VT1621TableRec Table = VT1621Table[VT1621ModeIndex(output, mode)];
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621ModeCrtc\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
if (pVia->IsSecondary) {
hwp->writeCrtc(hwp, 0x6A, 0x80);
@@ -676,7 +676,7 @@ VT1622ModeI2C(xf86OutputPtr output, DisplayModePtr mode)
struct VT162XTableRec Table;
CARD8 save, i;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622ModeI2C\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
if (pVIATV->TVEncoder == VIA_VT1622)
Table = VT1622Table[VT1622ModeIndex(output, mode)];
@@ -780,7 +780,7 @@ VT1622ModeCrtc(xf86OutputPtr output, DisplayModePtr mode)
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
struct VT162XTableRec Table;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622ModeCrtc\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
if (pVIATV->TVEncoder == VIA_VT1622)
Table = VT1622Table[VT1622ModeIndex(output, mode)];
@@ -833,7 +833,7 @@ VT1621Power(xf86OutputPtr output, Bool On)
ScrnInfoPtr pScrn = output->scrn;
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621Power\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
if (On)
xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x0E, 0x00);
@@ -847,7 +847,7 @@ VT1622Power(xf86OutputPtr output, Bool On)
ScrnInfoPtr pScrn = output->scrn;
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622Power\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
if (On)
xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x0E, 0x00);
@@ -861,7 +861,7 @@ VT1625Power(xf86OutputPtr output, Bool On)
ScrnInfoPtr pScrn = output->scrn;
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1625Power\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
if (On)
xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x0E, 0x00);
@@ -876,7 +876,7 @@ ViaVT162xInit(xf86OutputPtr output)
ScrnInfoPtr pScrn = output->scrn;
viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT162xInit\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", __func__));
switch (pVIATV->TVEncoder) {
case VIA_VT1621:
commit 87880aca785642310968d72eb020a245cd20511c
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Wed Sep 21 08:31:51 2022 -0700
Convert tabs to white spaces for TV output code
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/src/via_ch7xxx.c b/src/via_ch7xxx.c
index 54b8d3c..4a40987 100644
--- a/src/via_ch7xxx.c
+++ b/src/via_ch7xxx.c
@@ -45,11 +45,11 @@ CH7xxxPrintRegs(xf86OutputPtr output)
CARD8 i, buf;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Printing registers for %s\n",
- pVIATV->pVIATVI2CDev->DevName);
+ pVIATV->pVIATVI2CDev->DevName);
for (i = 0; i < pVIATV->TVNumRegs; i++) {
- xf86I2CReadByte(pVIATV->pVIATVI2CDev, i, &buf);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV%02X: 0x%02X\n", i, buf);
+ xf86I2CReadByte(pVIATV->pVIATVI2CDev, i, &buf);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV%02X: 0x%02X\n", i, buf);
}
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "End of TV registers.\n");
@@ -73,8 +73,8 @@ ViaCH7xxxDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address)
pDev->pI2CBus = pBus;
if (!xf86I2CDevInit(pDev)) {
- xf86DestroyI2CDevRec(pDev, TRUE);
- return NULL;
+ xf86DestroyI2CDevRec(pDev, TRUE);
+ return NULL;
}
if (!xf86I2CReadByte(pDev, 0x4B, &buf)) {
@@ -194,7 +194,7 @@ CH7xxxDACSenseI2C(I2CDevPtr pDev)
* A CH7xxx hack. (T. Lewis. S-Video fixed by P. Langdale)
*
* CH7xxx Cable types (C+S and YcBcR untested and almost certainly wrong)
- * 0x10 = Composite
+ * 0x10 = Composite
* 0x0C = S-Video
* 0x02 = Composite+S-Video
* 0x04 = YcBcR
@@ -210,10 +210,10 @@ CH7xxxDACSense(xf86OutputPtr output)
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxDACDetect\n"));
- /* is this needed? IH */
+ /* is this needed? IH */
if (!pVIATV->pVIATVI2CDev ||
!pVIATV->TVEncoder)
- return FALSE;
+ return FALSE;
sense = CH7xxxDACSenseI2C(pVIATV->pVIATVI2CDev);
@@ -222,32 +222,32 @@ CH7xxxDACSense(xf86OutputPtr output)
* 0x10 (Composite), 0x0C (S-Video) and 0x00 (Nothing connected)
* seem to be correct however.
*/
- switch (sense) {
- case 0x10:
- pVIATV->TVOutput = TVOUTPUT_COMPOSITE;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CH7xxx: Composite connected.\n");
- return TRUE;
- case 0x0C:
- pVIATV->TVOutput = TVOUTPUT_SVIDEO;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CH7xxx: S-Video connected.\n");
- return TRUE;
- case 0x02:
- pVIATV->TVOutput = TVOUTPUT_SC;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CHxxx: Composite+S-Video connected.\n");
- return TRUE;
- case 0x04:
- pVIATV->TVOutput = TVOUTPUT_YCBCR;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CHxxx: YcBcR Connected.\n");
- return TRUE;
- case 0x00:
- pVIATV->TVOutput = TVOUTPUT_NONE;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CH7xxx: Nothing connected.\n");
- return FALSE;
- default:
- pVIATV->TVOutput = TVOUTPUT_NONE;
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "CH7xxx: Unknown cable combination: 0x0%2X.\n",sense);
- return FALSE;
- }
+ switch (sense) {
+ case 0x10:
+ pVIATV->TVOutput = TVOUTPUT_COMPOSITE;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CH7xxx: Composite connected.\n");
+ return TRUE;
+ case 0x0C:
+ pVIATV->TVOutput = TVOUTPUT_SVIDEO;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CH7xxx: S-Video connected.\n");
+ return TRUE;
+ case 0x02:
+ pVIATV->TVOutput = TVOUTPUT_SC;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CHxxx: Composite+S-Video connected.\n");
+ return TRUE;
+ case 0x04:
+ pVIATV->TVOutput = TVOUTPUT_YCBCR;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CHxxx: YcBcR Connected.\n");
+ return TRUE;
+ case 0x00:
+ pVIATV->TVOutput = TVOUTPUT_NONE;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CH7xxx: Nothing connected.\n");
+ return FALSE;
+ default:
+ pVIATV->TVOutput = TVOUTPUT_NONE;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "CH7xxx: Unknown cable combination: 0x0%2X.\n",sense);
+ return FALSE;
+ }
}
static CARD8
@@ -410,14 +410,14 @@ CH7xxxModeI2C(xf86OutputPtr output, DisplayModePtr mode)
static void
CH7xxxModeCrtc(xf86OutputPtr output, DisplayModePtr mode)
{
- xf86CrtcPtr crtc = output->crtc;
- ScrnInfoPtr pScrn = crtc->scrn;
- vgaHWPtr hwp = VGAHWPTR(pScrn);
- VIAPtr pVia = VIAPTR(pScrn);
- VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
- viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- CARD8 *CRTC, *Misc;
- int i, j;
+ xf86CrtcPtr crtc = output->crtc;
+ ScrnInfoPtr pScrn = crtc->scrn;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
+ CARD8 *CRTC, *Misc;
+ int i, j;
VIABIOSTVMASKTableRec Mask;
struct CH7xxxTableRec Table;
@@ -517,92 +517,92 @@ CH7xxxModeCrtc(xf86OutputPtr output, DisplayModePtr mode)
static void
CH7xxxTVPower(xf86OutputPtr output, Bool On)
{
- ScrnInfoPtr pScrn = output->scrn;
- viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
-
- if (On){
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxTVPower: On\n"));
- xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x20);
- }else{
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxTVPower: Off\n"));
- xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x3E);
- xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x1E, 0xD0);
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
+
+ if (On){
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxTVPower: On\n"));
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x20);
+ }else{
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxTVPower: Off\n"));
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x3E);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x1E, 0xD0);
}
}
static void
CH7019LCDPower(xf86OutputPtr output, Bool On)
{
- ScrnInfoPtr pScrn = output->scrn;
- viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- CARD8 W_Buffer[2], R_Buffer[1];
- int i;
-
- if (On){
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxLCDPower: On\n"));
- W_Buffer[0] = 0x63;
- W_Buffer[1] = 0x4B;
- xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
- W_Buffer[0] = 0x66;
- W_Buffer[1] = 0x20;
- xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
-
- for (i = 0; i < 10; i++) {
- W_Buffer[0] = 0x63;
- xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
- usleep(100);
- W_Buffer[0] = 0x63;
- W_Buffer[1] = (R_Buffer[0] | 0x40);
- xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
+ CARD8 W_Buffer[2], R_Buffer[1];
+ int i;
+
+ if (On){
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxLCDPower: On\n"));
+ W_Buffer[0] = 0x63;
+ W_Buffer[1] = 0x4B;
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
+ W_Buffer[0] = 0x66;
+ W_Buffer[1] = 0x20;
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
+
+ for (i = 0; i < 10; i++) {
+ W_Buffer[0] = 0x63;
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
+ usleep(100);
+ W_Buffer[0] = 0x63;
+ W_Buffer[1] = (R_Buffer[0] | 0x40);
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"CH7xxxLCDPower: [%d]write 0x63 = %X!\n", i+1, W_Buffer[1]));
- usleep(1);
- W_Buffer[0] = 0x63;
- W_Buffer[1] &= ~0x40;
- xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ usleep(1);
+ W_Buffer[0] = 0x63;
+ W_Buffer[1] &= ~0x40;
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"CH7xxxLCDPower: [%d]write 0x63 = %X!\n", i+1, W_Buffer[1]));
- usleep(100);
- W_Buffer[0] = 0x66;
- xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
-
- if (((R_Buffer[0] & 0x44) == 0x44) || (i >= 9)) {
- /* PLL lock OK, Turn on VDD */
- usleep(500);
- W_Buffer[1] = R_Buffer[0] | 0x01;
- xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "CH7xxxLCDPower: CH7019 PLL lock ok!\n"));
- /* reset data path */
- W_Buffer[0] = 0x48;
- xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
- W_Buffer[1] = R_Buffer[0] & ~0x08;
- xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
- usleep(1);
- W_Buffer[1] = R_Buffer[0];
- xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
- break;
- }
+ usleep(100);
+ W_Buffer[0] = 0x66;
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
+
+ if (((R_Buffer[0] & 0x44) == 0x44) || (i >= 9)) {
+ /* PLL lock OK, Turn on VDD */
+ usleep(500);
+ W_Buffer[1] = R_Buffer[0] | 0x01;
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "CH7xxxLCDPower: CH7019 PLL lock ok!\n"));
+ /* reset data path */
+ W_Buffer[0] = 0x48;
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
+ W_Buffer[1] = R_Buffer[0] & ~0x08;
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
+ usleep(1);
+ W_Buffer[1] = R_Buffer[0];
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
+ break;
+ }
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"CH7xxxLCDPower: [%d]CH7019 PLL lock fail!\n", i+1));
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"CH7xxxLCDPower: [%d]0x66 = %X!\n", i+1, R_Buffer[0]));
- }
- }else{
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxLCDPower: Off\n"));
- /* Turn off VDD (Turn off backlignt only) */
- W_Buffer[0] = 0x66;
- xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
- W_Buffer[1] &= ~0x01;
- xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
- usleep(100);
- /* Turn off LVDS path */
- W_Buffer[0] = 0x63;
- xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
- W_Buffer[1] = (R_Buffer[0] | 0x40);
- xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
- }
+ }
+ }else{
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxLCDPower: Off\n"));
+ /* Turn off VDD (Turn off backlignt only) */
+ W_Buffer[0] = 0x66;
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
+ W_Buffer[1] &= ~0x01;
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
+ usleep(100);
+ /* Turn off LVDS path */
+ W_Buffer[0] = 0x63;
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
+ W_Buffer[1] = (R_Buffer[0] | 0x40);
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
+ }
}
/*
diff --git a/src/via_ch7xxx.h b/src/via_ch7xxx.h
index 11da93d..5d536d6 100644
--- a/src/via_ch7xxx.h
+++ b/src/via_ch7xxx.h
@@ -62,9 +62,9 @@ static struct CH7xxxModePrivate CH7xxxModePrivatePAL = {
#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DEFAULT
#define MODESUFFIXNTSC 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,\
- sizeof(struct CH7xxxModePrivate),(void *)&CH7xxxModePrivateNTSC,0,0.0,0.0
+ sizeof(struct CH7xxxModePrivate),(void *)&CH7xxxModePrivateNTSC,0,0.0,0.0
#define MODESUFFIXPAL 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,\
- sizeof(struct CH7xxxModePrivate),(void *)&CH7xxxModePrivatePAL,0,0.0,0.0
+ sizeof(struct CH7xxxModePrivate),(void *)&CH7xxxModePrivatePAL,0,0.0,0.0
/* dotclock is just for modeline validation */
static DisplayModeRec CH7011Modes[]={
@@ -136,22 +136,22 @@ struct CH7xxxTableRec {
static struct CH7xxxTableRec
CH7011Table[] = {
{ "640x480", 640, 480, TVTYPE_NTSC,
- { 0X6A, /* 0x00 Mode 17 */
- 0X3F, /* 0x01 FF Default 0x27 (was 7F) */
- 0X7E, /* 0x02 VBW Default 0xBE (was 0x7E) */
- 0X8B, /* 0x03 TE Decent Text 0x8B (was 8D) */
- 0X28, /* 0x04 SAV Default 0x50 (was 0x21) */
- 0X2C, /* 0x05 HP Default 0x50 (was 0x2E) */
- 0X05, /* 0x06 VP Default 0x00 (was 0x04) */
- 0X83, /* 0x07 BL Default 0x83 */
- 0X03, /* 0x08 CE Default 0x03 */
- 0X80, /* 0x09 TPC Default 0x80 */
- 0X3F, /* 0x0A PLLM Default 0x3F */
- 0X7E, /* 0x0B PLLN Default 0x7E */
- 0X20, /* 0x0C FSCI Default 0x20 */
- 0X80, /* 0x0D FSCI Default 0x80 */
- 0X00, /* 0x0E FSCI Default 0x08 (was 00) */
- 0X00, /* 0x0F FSCI Default 0xEB (was 00) */
+ { 0X6A, /* 0x00 Mode 17 */
+ 0X3F, /* 0x01 FF Default 0x27 (was 7F) */
+ 0X7E, /* 0x02 VBW Default 0xBE (was 0x7E) */
+ 0X8B, /* 0x03 TE Decent Text 0x8B (was 8D) */
+ 0X28, /* 0x04 SAV Default 0x50 (was 0x21) */
+ 0X2C, /* 0x05 HP Default 0x50 (was 0x2E) */
+ 0X05, /* 0x06 VP Default 0x00 (was 0x04) */
+ 0X83, /* 0x07 BL Default 0x83 */
+ 0X03, /* 0x08 CE Default 0x03 */
+ 0X80, /* 0x09 TPC Default 0x80 */
+ 0X3F, /* 0x0A PLLM Default 0x3F */
+ 0X7E, /* 0x0B PLLN Default 0x7E */
+ 0X20, /* 0x0C FSCI Default 0x20 */
+ 0X80, /* 0x0D FSCI Default 0x80 */
+ 0X00, /* 0x0E FSCI Default 0x08 (was 00) */
+ 0X00, /* 0x0F FSCI Default 0xEB (was 00) */
0, /* 0x10 CIVC */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* We don't touch these */
0X48, /* 0x1C */
@@ -208,15 +208,15 @@ CH7011Table[] = {
},
{ "800x600", 800, 600, TVTYPE_NTSC,
- { 0XCF, /* 0x00 Mode 29 */
- 0X27, /* 0x01 FF Default 0x27 (was 7F) */
- 0XBE, /* 0x02 VBW Default 0xBE (was 0x76) */
- 0X8B, /* 0x03 TE Decent Text 0x8B (was 8F) */
+ { 0XCF, /* 0x00 Mode 29 */
+ 0X27, /* 0x01 FF Default 0x27 (was 7F) */
+ 0XBE, /* 0x02 VBW Default 0xBE (was 0x76) */
+ 0X8B, /* 0x03 TE Decent Text 0x8B (was 8F) */
0X59, /* 0x04 SAV*/
0X3C, /* 0x05 HP */
0X15, /* 0x06 VP */
- 0X66, /* 0x07 BL Default 0x83 */
- 0X3, /* 0x08 CE Default 0x03 */
+ 0X66, /* 0x07 BL Default 0x83 */
+ 0X3, /* 0x08 CE Default 0x03 */
0X88,
0X59,
0X2E,
@@ -260,7 +260,7 @@ CH7011Table[] = {
/*check these two modes*/
{ "1024x768", 1024, 768, TVTYPE_NTSC,
{ 0XEE,
- 0X3F, /* 0x01 FF Default 0x27 (was 7F) */
+ 0X3F, /* 0x01 FF Default 0x27 (was 7F) */
0X7E,
0X87,
0X49,
@@ -309,31 +309,31 @@ CH7011Table[] = {
},
{ "640x480Over", 640, 480, TVTYPE_NTSC,
- { 0X69, /* 0x00 DM Mode 16 640x480 1/1 */
- 0X3F, /* 0x01 FF Default 0x27 (was 7F) */
- 0X7E, /* 0x02 VBW Default 0xBE (was 7E) */
- 0X03, /* 0x03 TE Decent text 0x83 (was 8D) */
- 0X18, /* 0x04 SAV Default 0x50 (was 10) */
- 0X19, /* 0x05 HP Default 0x50 */
- 0XFB, /* 0x06 VP Default 0x00 */
- 0X83, /* 0x07 BL Default 0x83 (NTSC-J 66) */
- 0X03, /* 0x08 CE Default 0x03 */
- 0X80, /* 0x09 TPC Default 0x80 */
- 0X3F, /* 0x0A PLLM Default 0x3F */
- 0X6E, /* 0x0B PLLN Default 0x7E */
- 0X25, /* 0x0C FSCI Default 0x25 */
- 0X24, /* 0x0D FSCI Default 0x24 */
- 0X92, /* 0x0E FSCI Default 0x9C (was 92) */
- 0X49, /* 0x0F FSCI Default 0x7A (was 49) */
- 0X00, /* 0x10 CIVC Default 0x01 */
+ { 0X69, /* 0x00 DM Mode 16 640x480 1/1 */
+ 0X3F, /* 0x01 FF Default 0x27 (was 7F) */
+ 0X7E, /* 0x02 VBW Default 0xBE (was 7E) */
+ 0X03, /* 0x03 TE Decent text 0x83 (was 8D) */
+ 0X18, /* 0x04 SAV Default 0x50 (was 10) */
+ 0X19, /* 0x05 HP Default 0x50 */
+ 0XFB, /* 0x06 VP Default 0x00 */
+ 0X83, /* 0x07 BL Default 0x83 (NTSC-J 66) */
+ 0X03, /* 0x08 CE Default 0x03 */
+ 0X80, /* 0x09 TPC Default 0x80 */
+ 0X3F, /* 0x0A PLLM Default 0x3F */
+ 0X6E, /* 0x0B PLLN Default 0x7E */
+ 0X25, /* 0x0C FSCI Default 0x25 */
+ 0X24, /* 0x0D FSCI Default 0x24 */
+ 0X92, /* 0x0E FSCI Default 0x9C (was 92) */
+ 0X49, /* 0x0F FSCI Default 0x7A (was 49) */
+ 0X00, /* 0x10 CIVC Default 0x01 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* We don't touch these */
- 0X48, /* 0x1C CM Default 0x00 */
- 0X40, /* 0x1D IC Default 0x88 */
- 0XD2, /* 0x1E GPIO Default 0xC0 */
- 0X80, /* 0x1F IDF Default 0x00 */
+ 0X48, /* 0x1C CM Default 0x00 */
+ 0X40, /* 0x1D IC Default 0x88 */
+ 0XD2, /* 0x1E GPIO Default 0xC0 */
+ 0X80, /* 0x1F IDF Default 0x00 */
0X40, /* 0x20 CD */
0X00, /* 0x21 DC */
- 0X00, /* 0x22 BCO Default 0x00 */ },
+ 0X00, /* 0x22 BCO Default 0x00 */ },
/* why is this #ifed, what's the difference? */
#if 0
{ 0X55, 0X4F, 0X4F, 0X99, 0X51, 0X18, 0X2E, 0X3E, 0, 0X40, 0, 0, 0, 0, 0, 0, 0XE7, 0, 0XDF, 0, 0, 0XDF, 0X2F, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
@@ -393,9 +393,9 @@ CH7011Table[] = {
},
{ "800x600Over", 800, 600, TVTYPE_NTSC,
- { 0XCE, /* 0x00 Mode 28 */
- 0X27, /* 0x01 Default 0x27 (was 7F) */
- 0XBE, /* 0x02 Default 0xBE (was 76) */
+ { 0XCE, /* 0x00 Mode 28 */
+ 0X27, /* 0x01 Default 0x27 (was 7F) */
+ 0XBE, /* 0x02 Default 0xBE (was 76) */
0X8F, /* 0x03 */
0X51, /* 0x04 */
0X2E, /* 0x05 */
@@ -442,7 +442,7 @@ CH7011Table[] = {
{ "1024x768Over", 1024, 768, TVTYPE_NTSC,
{ 0XED,
- 0X3F, /* 0x01 FF Default 0x27 (was 7F) */
+ 0X3F, /* 0x01 FF Default 0x27 (was 7F) */
0X7E,
0X87,
0X49,
@@ -491,31 +491,31 @@ CH7011Table[] = {
},
{ "720x480", 720, 480, TVTYPE_NTSC,
- { 0X89, /* 0x00 DM Mode 19 720x480 1/1 */
- 0X3F, /* 0x01 FF Default 0x27 (was 7F) */
- 0X7E, /* 0x02 VBW Default 0xBE (was 7E) */
- 0X03, /* 0x03 TE Decent text 0x83 (was 8D) */
- 0X18, /* 0x04 SAV Default 0x50 (was 10) */
- 0X19, /* 0x05 HP Default 0x50 */
- 0XFB, /* 0x06 VP Default 0x00 */
- 0X83, /* 0x07 BL Default 0x83 (NTSC-J 66) */
- 0X03, /* 0x08 CE Default 0x03 */
- 0X80, /* 0x09 TPC Default 0x80 */
- 0X3F, /* 0x0A PLLM Default 0x3F */
- 0X7C, /* 0x0B PLLN Default 0x7C */
- 0X21, /* 0x0C FSCI Default 0x25 */
- 0X04, /* 0x0D FSCI Default 0x04 */
- 0X10, /* 0x0E FSCI Default 0x10 */
- 0X41, /* 0x0F FSCI Default 0x41 */
- 0X00, /* 0x10 CIVC Default 0x01 */
+ { 0X89, /* 0x00 DM Mode 19 720x480 1/1 */
+ 0X3F, /* 0x01 FF Default 0x27 (was 7F) */
+ 0X7E, /* 0x02 VBW Default 0xBE (was 7E) */
+ 0X03, /* 0x03 TE Decent text 0x83 (was 8D) */
+ 0X18, /* 0x04 SAV Default 0x50 (was 10) */
+ 0X19, /* 0x05 HP Default 0x50 */
+ 0XFB, /* 0x06 VP Default 0x00 */
+ 0X83, /* 0x07 BL Default 0x83 (NTSC-J 66) */
+ 0X03, /* 0x08 CE Default 0x03 */
+ 0X80, /* 0x09 TPC Default 0x80 */
+ 0X3F, /* 0x0A PLLM Default 0x3F */
+ 0X7C, /* 0x0B PLLN Default 0x7C */
+ 0X21, /* 0x0C FSCI Default 0x25 */
+ 0X04, /* 0x0D FSCI Default 0x04 */
+ 0X10, /* 0x0E FSCI Default 0x10 */
+ 0X41, /* 0x0F FSCI Default 0x41 */
+ 0X00, /* 0x10 CIVC Default 0x01 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* We don't touch these */
- 0X48, /* 0x1C CM Default 0x00 */
- 0X40, /* 0x1D IC Default 0x88 */
- 0XD2, /* 0x1E GPIO Default 0xC0 */
- 0X80, /* 0x1F IDF Default 0x00 */
+ 0X48, /* 0x1C CM Default 0x00 */
+ 0X40, /* 0x1D IC Default 0x88 */
+ 0XD2, /* 0x1E GPIO Default 0xC0 */
+ 0X80, /* 0x1F IDF Default 0x00 */
0X40, /* 0x20 CD */
0X00, /* 0x21 DC */
- 0X00, /* 0x22 BCO Default 0x00 */ },
+ 0X00, /* 0x22 BCO Default 0x00 */ },
{ 0X64, 0X59, 0X59, 0X88, 0X5B, 0X81, 0X56, 0X3E, 0, 0X40, 0, 0, 0, 0, 0, 0, 0XFF, 0, 0XDF, 0, 0, 0XDF, 0X57, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0X20, 0X40, 0, 0X4, 0X87, 0X1C, 0, 0 },
{ 0, 0, 0, 0X87, 0X1C, 0, 0, 0 },
diff --git a/src/via_vt162x.c b/src/via_vt162x.c
index 225efe2..3d382a4 100644
--- a/src/via_vt162x.c
+++ b/src/via_vt162x.c
@@ -33,14 +33,14 @@
static void
ViaSetTVClockSource(xf86OutputPtr output)
{
- xf86CrtcPtr crtc = output->crtc;
- drmmode_crtc_private_ptr iga = crtc->driver_private;
- ScrnInfoPtr pScrn = crtc->scrn;
- VIAPtr pVia = VIAPTR(pScrn);
- viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- vgaHWPtr hwp = VGAHWPTR(pScrn);
+ xf86CrtcPtr crtc = output->crtc;
+ drmmode_crtc_private_ptr iga = crtc->driver_private;
+ ScrnInfoPtr pScrn = crtc->scrn;
+ VIAPtr pVia = VIAPTR(pScrn);
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaSetTVClockSource\n"));
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaSetTVClockSource\n"));
switch(pVIATV->TVEncoder) {
case VIA_VT1625:
@@ -69,10 +69,10 @@ ViaSetTVClockSource(xf86OutputPtr output)
}
break;
default:
- if (!iga->index)
- ViaCrtcMask(hwp, 0x6C, 0x50, 0xF0);
- else
- ViaCrtcMask(hwp, 0x6C, 0x05, 0x0F);
+ if (!iga->index)
+ ViaCrtcMask(hwp, 0x6C, 0x50, 0xF0);
+ else
+ ViaCrtcMask(hwp, 0x6C, 0x05, 0x0F);
break;
}
@@ -638,11 +638,11 @@ VT1621ModeI2C(xf86OutputPtr output, DisplayModePtr mode)
static void
VT1621ModeCrtc(xf86OutputPtr output, DisplayModePtr mode)
{
- ScrnInfoPtr pScrn = output->scrn;
- vgaHWPtr hwp = VGAHWPTR(pScrn);
- VIAPtr pVia = VIAPTR(pScrn);
- VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
- struct VT1621TableRec Table = VT1621Table[VT1621ModeIndex(output, mode)];
+ ScrnInfoPtr pScrn = output->scrn;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
+ struct VT1621TableRec Table = VT1621Table[VT1621ModeIndex(output, mode)];
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621ModeCrtc\n"));
@@ -773,12 +773,12 @@ VT1622ModeI2C(xf86OutputPtr output, DisplayModePtr mode)
static void
VT1622ModeCrtc(xf86OutputPtr output, DisplayModePtr mode)
{
- ScrnInfoPtr pScrn = output->scrn;
- vgaHWPtr hwp = VGAHWPTR(pScrn);
- VIAPtr pVia = VIAPTR(pScrn);
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
- viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- struct VT162XTableRec Table;
+ ScrnInfoPtr pScrn = output->scrn;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
+ struct VT162XTableRec Table;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622ModeCrtc\n"));
commit 69908e3231f58892dc8bc5e94a0e04b169beec0a
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Wed Sep 21 08:31:51 2022 -0700
Convert TV output resource allocation to be per device
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/src/via_ch7xxx.c b/src/via_ch7xxx.c
index b60e598..54b8d3c 100644
--- a/src/via_ch7xxx.c
+++ b/src/via_ch7xxx.c
@@ -38,16 +38,17 @@
*
*/
static void
-CH7xxxPrintRegs(ScrnInfoPtr pScrn)
+CH7xxxPrintRegs(xf86OutputPtr output)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
CARD8 i, buf;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Printing registers for %s\n",
- pVIADisplay->TVI2CDev->DevName);
+ pVIATV->pVIATVI2CDev->DevName);
- for (i = 0; i < pVIADisplay->TVNumRegs; i++) {
- xf86I2CReadByte(pVIADisplay->TVI2CDev, i, &buf);
+ for (i = 0; i < pVIATV->TVNumRegs; i++) {
+ xf86I2CReadByte(pVIATV->pVIATVI2CDev, i, &buf);
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV%02X: 0x%02X\n", i, buf);
}
@@ -137,28 +138,30 @@ ViaCH7xxxDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address)
*/
static void
-CH7xxxSave(ScrnInfoPtr pScrn)
+CH7xxxSave(xf86OutputPtr output)
{
int i;
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxSave\n"));
- for (i = 0; i < pVIADisplay->TVNumRegs; i++)
- xf86I2CReadByte(pVIADisplay->TVI2CDev, i, &(pVIADisplay->TVRegs[i]));
+ for (i = 0; i < pVIATV->TVNumRegs; i++)
+ xf86I2CReadByte(pVIATV->pVIATVI2CDev, i, &(pVIATV->TVRegs[i]));
}
static void
-CH7xxxRestore(ScrnInfoPtr pScrn)
+CH7xxxRestore(xf86OutputPtr output)
{
int i;
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxRestore\n"));
- for (i = 0; i < pVIADisplay->TVNumRegs; i++)
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, i, pVIADisplay->TVRegs[i]);
+ for (i = 0; i < pVIATV->TVNumRegs; i++)
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, i, pVIATV->TVRegs[i]);
}
static CARD8
@@ -199,19 +202,20 @@ CH7xxxDACSenseI2C(I2CDevPtr pDev)
*/
static Bool
-CH7xxxDACSense(ScrnInfoPtr pScrn)
+CH7xxxDACSense(xf86OutputPtr output)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
CARD8 sense;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxDACDetect\n"));
/* is this needed? IH */
- if (!pVIADisplay->TVI2CDev ||
- !pVIADisplay->TVEncoder)
+ if (!pVIATV->pVIATVI2CDev ||
+ !pVIATV->TVEncoder)
return FALSE;
- sense = CH7xxxDACSenseI2C(pVIADisplay->TVI2CDev);
+ sense = CH7xxxDACSenseI2C(pVIATV->pVIATVI2CDev);
/* I'm sure these case values are correct,
* but we should get something in any case.
@@ -220,43 +224,44 @@ CH7xxxDACSense(ScrnInfoPtr pScrn)
*/
switch (sense) {
case 0x10:
- pVIADisplay->TVOutput = TVOUTPUT_COMPOSITE;
+ pVIATV->TVOutput = TVOUTPUT_COMPOSITE;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CH7xxx: Composite connected.\n");
return TRUE;
case 0x0C:
- pVIADisplay->TVOutput = TVOUTPUT_SVIDEO;
+ pVIATV->TVOutput = TVOUTPUT_SVIDEO;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CH7xxx: S-Video connected.\n");
return TRUE;
case 0x02:
- pVIADisplay->TVOutput = TVOUTPUT_SC;
+ pVIATV->TVOutput = TVOUTPUT_SC;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CHxxx: Composite+S-Video connected.\n");
return TRUE;
case 0x04:
- pVIADisplay->TVOutput = TVOUTPUT_YCBCR;
+ pVIATV->TVOutput = TVOUTPUT_YCBCR;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CHxxx: YcBcR Connected.\n");
return TRUE;
case 0x00:
- pVIADisplay->TVOutput = TVOUTPUT_NONE;
+ pVIATV->TVOutput = TVOUTPUT_NONE;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "CH7xxx: Nothing connected.\n");
return FALSE;
default:
- pVIADisplay->TVOutput = TVOUTPUT_NONE;
+ pVIATV->TVOutput = TVOUTPUT_NONE;
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "CH7xxx: Unknown cable combination: 0x0%2X.\n",sense);
return FALSE;
}
}
static CARD8
-CH7011ModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
+CH7011ModeIndex(xf86OutputPtr output, DisplayModePtr mode)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
int i;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7011ModeIndex\n"));
for (i = 0; CH7011Table[i].Width; i++) {
if ((CH7011Table[i].Width == mode->CrtcHDisplay) &&
(CH7011Table[i].Height == mode->CrtcVDisplay) &&
- (CH7011Table[i].Standard == pVIADisplay->TVType) &&
+ (CH7011Table[i].Standard == pVIATV->TVType) &&
!(strcmp(CH7011Table[i].name, mode->name)))
return i;
}
@@ -266,16 +271,17 @@ CH7011ModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
static CARD8
-CH7019ModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
+CH7019ModeIndex(xf86OutputPtr output, DisplayModePtr mode)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
int i;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7019ModeIndex\n"));
for (i = 0; CH7019Table[i].Width; i++) {
if ((CH7019Table[i].Width == mode->CrtcHDisplay) &&
(CH7019Table[i].Height == mode->CrtcVDisplay) &&
- (CH7019Table[i].Standard == pVIADisplay->TVType) &&
+ (CH7019Table[i].Standard == pVIATV->TVType) &&
!(strcmp(CH7019Table[i].name, mode->name)))
return i;
}
@@ -288,9 +294,10 @@ CH7019ModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
*
*/
static ModeStatus
-CH7xxxModeValid(ScrnInfoPtr pScrn, DisplayModePtr mode)
+CH7xxxModeValid(xf86OutputPtr output, DisplayModePtr mode)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxModeValid\n"));
@@ -301,66 +308,67 @@ CH7xxxModeValid(ScrnInfoPtr pScrn, DisplayModePtr mode)
return MODE_BAD;
}
- if ((pVIADisplay->TVType == TVTYPE_NTSC) &&
+ if ((pVIATV->TVType == TVTYPE_NTSC) &&
(mode->Private != (void *) &CH7xxxModePrivateNTSC)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV standard is NTSC. This is a PAL mode.\n");
return MODE_BAD;
- } else if ((pVIADisplay->TVType == TVTYPE_PAL) &&
+ } else if ((pVIATV->TVType == TVTYPE_PAL) &&
(mode->Private != (void *) &CH7xxxModePrivatePAL)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV standard is PAL. This is a NTSC mode.\n");
return MODE_BAD;
}
- if (pVIADisplay->TVEncoder == VIA_CH7011)
+ if (pVIATV->TVEncoder == VIA_CH7011)
{
- if (CH7011ModeIndex(pScrn, mode) != 0xFF)
+ if (CH7011ModeIndex(output, mode) != 0xFF)
return MODE_OK;
}
else
{
- if (CH7019ModeIndex(pScrn, mode) != 0xFF)
+ if (CH7019ModeIndex(output, mode) != 0xFF)
return MODE_OK;
}
return MODE_BAD;
}
static void
-CH7xxxModeI2C(ScrnInfoPtr pScrn, DisplayModePtr mode)
+CH7xxxModeI2C(xf86OutputPtr output, DisplayModePtr mode)
{
+ ScrnInfoPtr pScrn = output->scrn;
VIAPtr pVia = VIAPTR(pScrn);
- VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
CARD8 i, j;
VIABIOSTVMASKTableRec Mask;
struct CH7xxxTableRec Table;
- if (pVIADisplay->TVEncoder == VIA_CH7011)
+ if (pVIATV->TVEncoder == VIA_CH7011)
{
- Table = CH7011Table[CH7011ModeIndex(pScrn, mode)];
+ Table = CH7011Table[CH7011ModeIndex(output, mode)];
Mask = ch7011MaskTable;
}
else
{
- Table = CH7019Table[CH7019ModeIndex(pScrn, mode)];
+ Table = CH7019Table[CH7019ModeIndex(output, mode)];
Mask = ch7019MaskTable;
}
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7011ModeI2C\n"));
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x49, 0x3E);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x1E, 0xD0);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x3E);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x1E, 0xD0);
for (i = 0,j = 0; (j < Mask.numTV) && (i < VIA_BIOS_TABLE_NUM_TV_REG); i++) {
if (Mask.TV[i] == 0xFF) {
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, i, Table.TV[i]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, i, Table.TV[i]);
j++;
} else {
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, i, pVIADisplay->TVRegs[i]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, i, pVIATV->TVRegs[i]);
}
}
- if ((pVIADisplay->TVType == TVTYPE_NTSC) && pVIADisplay->TVDotCrawl) {
+ if ((pVIATV->TVType == TVTYPE_NTSC) && pVIATV->TVDotCrawl) {
CARD16 *DotCrawl = Table.DotCrawlNTSC;
CARD8 address, save;
@@ -368,25 +376,25 @@ CH7xxxModeI2C(ScrnInfoPtr pScrn, DisplayModePtr mode)
address = (CARD8)(DotCrawl[i] & 0xFF);
save = (CARD8)(DotCrawl[i] >> 8);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, address, save);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, address, save);
}
}
/*
* Only Composite and SVideo have been tested.
*/
- switch(pVIADisplay->TVOutput){
+ switch(pVIATV->TVOutput){
case TVOUTPUT_COMPOSITE:
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x49, 0x2E);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x2E);
break;
case TVOUTPUT_SVIDEO:
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x49, 0x32);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x32);
break;
case TVOUTPUT_SC:
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x49, 0x3C);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x3C);
break;
case TVOUTPUT_YCBCR:
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x49, 0x3A);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x3A);
break;
default:
break;
@@ -395,31 +403,33 @@ CH7xxxModeI2C(ScrnInfoPtr pScrn, DisplayModePtr mode)
if (pVia->IsSecondary) { /* Patch as setting 2nd path */
j = (CARD8)(Mask.misc2 >> 5);
for (i = 0; i < j; i++)
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, Table.Patch2[i] & 0xFF, Table.Patch2[i] >> 8);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, Table.Patch2[i] & 0xFF, Table.Patch2[i] >> 8);
}
}
static void
-CH7xxxModeCrtc(xf86CrtcPtr crtc, DisplayModePtr mode)
+CH7xxxModeCrtc(xf86OutputPtr output, DisplayModePtr mode)
{
+ xf86CrtcPtr crtc = output->crtc;
ScrnInfoPtr pScrn = crtc->scrn;
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
CARD8 *CRTC, *Misc;
int i, j;
VIABIOSTVMASKTableRec Mask;
struct CH7xxxTableRec Table;
- if (pVIADisplay->TVEncoder == VIA_CH7011)
+ if (pVIATV->TVEncoder == VIA_CH7011)
{
- Table = CH7011Table[CH7011ModeIndex(pScrn, mode)];
+ Table = CH7011Table[CH7011ModeIndex(output, mode)];
Mask = ch7011MaskTable;
}
else
{
- Table = CH7019Table[CH7019ModeIndex(pScrn, mode)];
+ Table = CH7019Table[CH7019ModeIndex(output, mode)];
Mask = ch7019MaskTable;
}
@@ -505,24 +515,26 @@ CH7xxxModeCrtc(xf86CrtcPtr crtc, DisplayModePtr mode)
*
*/
static void
-CH7xxxTVPower(ScrnInfoPtr pScrn, Bool On)
+CH7xxxTVPower(xf86OutputPtr output, Bool On)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
if (On){
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxTVPower: On\n"));
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x49, 0x20);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x20);
}else{
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxTVPower: Off\n"));
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x49, 0x3E);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x1E, 0xD0);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x49, 0x3E);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x1E, 0xD0);
}
}
static void
-CH7019LCDPower(ScrnInfoPtr pScrn, Bool On)
+CH7019LCDPower(xf86OutputPtr output, Bool On)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
CARD8 W_Buffer[2], R_Buffer[1];
int i;
@@ -530,45 +542,45 @@ CH7019LCDPower(ScrnInfoPtr pScrn, Bool On)
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxLCDPower: On\n"));
W_Buffer[0] = 0x63;
W_Buffer[1] = 0x4B;
- xf86I2CWriteRead(pVIADisplay->TVI2CDev, W_Buffer,2, NULL,0);
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
W_Buffer[0] = 0x66;
W_Buffer[1] = 0x20;
- xf86I2CWriteRead(pVIADisplay->TVI2CDev, W_Buffer,2, NULL,0);
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
for (i = 0; i < 10; i++) {
W_Buffer[0] = 0x63;
- xf86I2CWriteRead(pVIADisplay->TVI2CDev, W_Buffer,1, R_Buffer,1);
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
usleep(100);
W_Buffer[0] = 0x63;
W_Buffer[1] = (R_Buffer[0] | 0x40);
- xf86I2CWriteRead(pVIADisplay->TVI2CDev, W_Buffer,2, NULL,0);
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"CH7xxxLCDPower: [%d]write 0x63 = %X!\n", i+1, W_Buffer[1]));
usleep(1);
W_Buffer[0] = 0x63;
W_Buffer[1] &= ~0x40;
- xf86I2CWriteRead(pVIADisplay->TVI2CDev, W_Buffer,2, NULL,0);
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"CH7xxxLCDPower: [%d]write 0x63 = %X!\n", i+1, W_Buffer[1]));
usleep(100);
W_Buffer[0] = 0x66;
- xf86I2CWriteRead(pVIADisplay->TVI2CDev, W_Buffer,1, R_Buffer,1);
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
if (((R_Buffer[0] & 0x44) == 0x44) || (i >= 9)) {
/* PLL lock OK, Turn on VDD */
usleep(500);
W_Buffer[1] = R_Buffer[0] | 0x01;
- xf86I2CWriteRead(pVIADisplay->TVI2CDev, W_Buffer,2, NULL,0);
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"CH7xxxLCDPower: CH7019 PLL lock ok!\n"));
/* reset data path */
W_Buffer[0] = 0x48;
- xf86I2CWriteRead(pVIADisplay->TVI2CDev, W_Buffer,1, R_Buffer,1);
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
W_Buffer[1] = R_Buffer[0] & ~0x08;
- xf86I2CWriteRead(pVIADisplay->TVI2CDev, W_Buffer,2, NULL,0);
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
usleep(1);
W_Buffer[1] = R_Buffer[0];
- xf86I2CWriteRead(pVIADisplay->TVI2CDev, W_Buffer,2, NULL,0);
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
break;
}
@@ -581,15 +593,15 @@ CH7019LCDPower(ScrnInfoPtr pScrn, Bool On)
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxLCDPower: Off\n"));
/* Turn off VDD (Turn off backlignt only) */
W_Buffer[0] = 0x66;
- xf86I2CWriteRead(pVIADisplay->TVI2CDev, W_Buffer,1, R_Buffer,1);
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
W_Buffer[1] &= ~0x01;
- xf86I2CWriteRead(pVIADisplay->TVI2CDev, W_Buffer,2, NULL,0);
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
usleep(100);
/* Turn off LVDS path */
W_Buffer[0] = 0x63;
- xf86I2CWriteRead(pVIADisplay->TVI2CDev, W_Buffer,1, R_Buffer,1);
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,1, R_Buffer,1);
W_Buffer[1] = (R_Buffer[0] | 0x40);
- xf86I2CWriteRead(pVIADisplay->TVI2CDev, W_Buffer,2, NULL,0);
+ xf86I2CWriteRead(pVIATV->pVIATVI2CDev, W_Buffer,2, NULL,0);
}
}
@@ -597,44 +609,45 @@ CH7019LCDPower(ScrnInfoPtr pScrn, Bool On)
*
*/
void
-ViaCH7xxxInit(ScrnInfoPtr pScrn)
+ViaCH7xxxInit(xf86OutputPtr output)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaCH7xxxInit\n"));
- switch (pVIADisplay->TVEncoder) {
+ switch (pVIATV->TVEncoder) {
case VIA_CH7011:
- pVIADisplay->TVSave = CH7xxxSave;
- pVIADisplay->TVRestore = CH7xxxRestore;
- pVIADisplay->TVDACSense = CH7xxxDACSense;
- pVIADisplay->TVModeValid = CH7xxxModeValid;
- pVIADisplay->TVModeI2C = CH7xxxModeI2C;
- pVIADisplay->TVModeCrtc = CH7xxxModeCrtc;
- pVIADisplay->TVPower = CH7xxxTVPower;
- pVIADisplay->TVModes = CH7011Modes;
- pVIADisplay->TVNumModes = sizeof(CH7011Modes) / sizeof(DisplayModeRec);
- pVIADisplay->LCDPower = NULL;
- pVIADisplay->TVNumRegs = CH_7011_MAX_NUM_REG;
+ pVIATV->TVSave = CH7xxxSave;
+ pVIATV->TVRestore = CH7xxxRestore;
+ pVIATV->TVDACSense = CH7xxxDACSense;
+ pVIATV->TVModeValid = CH7xxxModeValid;
+ pVIATV->TVModeI2C = CH7xxxModeI2C;
+ pVIATV->TVModeCrtc = CH7xxxModeCrtc;
+ pVIATV->TVPower = CH7xxxTVPower;
+ pVIATV->TVModes = CH7011Modes;
+ pVIATV->TVNumModes = sizeof(CH7011Modes) / sizeof(DisplayModeRec);
+ pVIATV->LCDPower = NULL;
+ pVIATV->TVNumRegs = CH_7011_MAX_NUM_REG;
#ifdef HAVE_DEBUG
- pVIADisplay->TVPrintRegs = CH7xxxPrintRegs;
+ pVIATV->TVPrintRegs = CH7xxxPrintRegs;
#endif
break;
case VIA_CH7019A:
case VIA_CH7019B:
- pVIADisplay->TVDACSense = CH7xxxDACSense;
- pVIADisplay->TVSave = CH7xxxSave;
- pVIADisplay->TVRestore = CH7xxxRestore;
- pVIADisplay->TVModeValid = CH7xxxModeValid;
- pVIADisplay->TVModeI2C = CH7xxxModeI2C;
- pVIADisplay->TVModeCrtc = CH7xxxModeCrtc;
- pVIADisplay->TVPower = CH7xxxTVPower;
- pVIADisplay->TVModes = CH7019Modes;
- pVIADisplay->TVNumModes = sizeof(CH7019Modes) / sizeof(DisplayModeRec);
- pVIADisplay->LCDPower = CH7019LCDPower;
- pVIADisplay->TVNumRegs = CH_7019_MAX_NUM_REG;
+ pVIATV->TVDACSense = CH7xxxDACSense;
+ pVIATV->TVSave = CH7xxxSave;
+ pVIATV->TVRestore = CH7xxxRestore;
+ pVIATV->TVModeValid = CH7xxxModeValid;
+ pVIATV->TVModeI2C = CH7xxxModeI2C;
+ pVIATV->TVModeCrtc = CH7xxxModeCrtc;
+ pVIATV->TVPower = CH7xxxTVPower;
+ pVIATV->TVModes = CH7019Modes;
+ pVIATV->TVNumModes = sizeof(CH7019Modes) / sizeof(DisplayModeRec);
+ pVIATV->LCDPower = CH7019LCDPower;
+ pVIATV->TVNumRegs = CH_7019_MAX_NUM_REG;
#ifdef HAVE_DEBUG
- pVIADisplay->TVPrintRegs = CH7xxxPrintRegs;
+ pVIATV->TVPrintRegs = CH7xxxPrintRegs;
#endif
break;
default:
@@ -643,6 +656,6 @@ ViaCH7xxxInit(ScrnInfoPtr pScrn)
}
/* Save before continuing */
- if (pVIADisplay->TVSave)
- pVIADisplay->TVSave(pScrn);
+ if (pVIATV->TVSave)
+ pVIATV->TVSave(output);
}
diff --git a/src/via_driver.c b/src/via_driver.c
index 5140e54..622c4f1 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -380,9 +380,6 @@ VIAFreeRec(ScrnInfoPtr pScrn)
pVIADisplay = pVia->pVIADisplay;
if (pVIADisplay) {
- if (pVIADisplay->TVI2CDev)
- xf86DestroyI2CDevRec(pVIADisplay->TVI2CDev, TRUE);
-
pVia->pVIADisplay = NULL;
free(pVIADisplay);
}
@@ -621,8 +618,6 @@ VIAGetRec(ScrnInfoPtr pScrn)
pVIADisplay = pVia->pVIADisplay;
if (pVIADisplay) {
- pVIADisplay->TVI2CDev = NULL;
-
pVia->VideoRegs = (video_via_regs *) xnfcalloc(sizeof(video_via_regs), 1);
if (!pVia->VideoRegs) {
free(pVIADisplay);
diff --git a/src/via_tv.c b/src/via_tv.c
index 0aea043..87010b2 100644
--- a/src/via_tv.c
+++ b/src/via_tv.c
@@ -524,58 +524,52 @@ viaTVSetDataDriveStrength(ScrnInfoPtr pScrn, CARD8 dataDriveStrength)
static void
ViaTVSave(xf86OutputPtr output)
{
- ScrnInfoPtr pScrn = output->scrn;
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- if (pVIADisplay->TVSave)
- pVIADisplay->TVSave(pScrn);
+ if (pVIATV->TVSave)
+ pVIATV->TVSave(output);
}
static void
ViaTVRestore(xf86OutputPtr output)
{
- ScrnInfoPtr pScrn = output->scrn;
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- if (pVIADisplay->TVRestore)
- pVIADisplay->TVRestore(pScrn);
+ if (pVIATV->TVRestore)
+ pVIATV->TVRestore(output);
}
static Bool
ViaTVDACSense(xf86OutputPtr output)
{
- ScrnInfoPtr pScrn = output->scrn;
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- if (pVIADisplay->TVDACSense)
- return pVIADisplay->TVDACSense(pScrn);
+ if (pVIATV->TVDACSense)
+ return pVIATV->TVDACSense(output);
return FALSE;
}
static void
ViaTVSetMode(xf86OutputPtr output, DisplayModePtr mode)
{
- ScrnInfoPtr pScrn = output->scrn;
- xf86CrtcPtr crtc = output->crtc;
- VIAPtr pVia = VIAPTR(pScrn);
- VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- if (pVIADisplay->TVModeI2C)
- pVIADisplay->TVModeI2C(pScrn, mode);
+ if (pVIATV->TVModeI2C)
+ pVIATV->TVModeI2C(output, mode);
- if (pVIADisplay->TVModeCrtc)
- pVIADisplay->TVModeCrtc(crtc, mode);
+ if (pVIATV->TVModeCrtc)
+ pVIATV->TVModeCrtc(output, mode);
/* TV reset. */
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x1D, 0x00);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x1D, 0x80);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x1D, 0x00);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x1D, 0x80);
}
static void
ViaTVPower(xf86OutputPtr output, Bool On)
{
ScrnInfoPtr pScrn = output->scrn;
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
#ifdef HAVE_DEBUG
if (On)
@@ -584,19 +578,18 @@ ViaTVPower(xf86OutputPtr output, Bool On)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaTVPower: Off.\n");
#endif
- if (pVIADisplay->TVPower)
- pVIADisplay->TVPower(pScrn, On);
+ if (pVIATV->TVPower)
+ pVIATV->TVPower(output, On);
}
#ifdef HAVE_DEBUG
void
ViaTVPrintRegs(xf86OutputPtr output)
{
- ScrnInfoPtr pScrn = output->scrn;
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
- if (pVIADisplay->TVPrintRegs)
- pVIADisplay->TVPrintRegs(pScrn);
+ if (pVIATV->TVPrintRegs)
+ pVIATV->TVPrintRegs(output);
}
#endif /* HAVE_DEBUG */
@@ -717,12 +710,11 @@ static DisplayModePtr
via_tv_get_modes(xf86OutputPtr output)
{
DisplayModePtr modes = NULL, mode = NULL;
- ScrnInfoPtr pScrn = output->scrn;
- VIAPtr pVia = VIAPTR(pScrn);
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
int i;
- for (i = 0; i < pVia->pVIADisplay->TVNumModes; i++) {
- mode = xf86DuplicateMode(&pVia->pVIADisplay->TVModes[i]);
+ for (i = 0; i < pVIATV->TVNumModes; i++) {
+ mode = xf86DuplicateMode(&pVIATV->TVModes[i]);
modes = xf86ModesAdd(modes, mode);
}
return modes;
@@ -762,6 +754,8 @@ via_tv_init(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
+ viaTVRecPtr pVIATV;
+ I2CDevPtr pI2CDevice = NULL;
xf86OutputPtr output;
char outputNameBuffer[32];
@@ -770,66 +764,32 @@ via_tv_init(ScrnInfoPtr pScrn)
/* preset some pVIADisplay TV related values -- move up */
pVIADisplay->TVEncoder = VIA_NONETV;
- pVIADisplay->TVI2CDev = NULL;
- pVIADisplay->TVSave = NULL;
- pVIADisplay->TVRestore = NULL;
- pVIADisplay->TVDACSense = NULL;
- pVIADisplay->TVModeValid = NULL;
- pVIADisplay->TVModeI2C = NULL;
- pVIADisplay->TVModeCrtc = NULL;
- pVIADisplay->TVPower = NULL;
- pVIADisplay->TVModes = NULL;
- pVIADisplay->TVPrintRegs = NULL;
- pVIADisplay->LCDPower = NULL;
- pVIADisplay->TVNumRegs = 0;
/*
* On an SK43G (KM400/Ch7011), false positive detections at a VT162x
* chip were observed, so try to detect the Ch7011 first.
*/
if (pVIADisplay->pI2CBus2 && xf86I2CProbeAddress(pVIADisplay->pI2CBus2, 0xEC))
- pVIADisplay->TVI2CDev = ViaCH7xxxDetect(pScrn, pVIADisplay->pI2CBus2, 0xEC);
+ pI2CDevice = ViaCH7xxxDetect(pScrn, pVIADisplay->pI2CBus2, 0xEC);
else if (pVIADisplay->pI2CBus2 && xf86I2CProbeAddress(pVIADisplay->pI2CBus2, 0x40))
- pVIADisplay->TVI2CDev = ViaVT162xDetect(pScrn, pVIADisplay->pI2CBus2, 0x40);
+ pI2CDevice = ViaVT162xDetect(pScrn, pVIADisplay->pI2CBus2, 0x40);
else if (pVIADisplay->pI2CBus3 && xf86I2CProbeAddress(pVIADisplay->pI2CBus3, 0x40))
- pVIADisplay->TVI2CDev = ViaVT162xDetect(pScrn, pVIADisplay->pI2CBus3, 0x40);
+ pI2CDevice = ViaVT162xDetect(pScrn, pVIADisplay->pI2CBus3, 0x40);
else if (pVIADisplay->pI2CBus2 && xf86I2CProbeAddress(pVIADisplay->pI2CBus2, 0xEA))
- pVIADisplay->TVI2CDev = ViaCH7xxxDetect(pScrn, pVIADisplay->pI2CBus2, 0xEA);
+ pI2CDevice = ViaCH7xxxDetect(pScrn, pVIADisplay->pI2CBus2, 0xEA);
else if (pVIADisplay->pI2CBus3 && xf86I2CProbeAddress(pVIADisplay->pI2CBus3, 0xEA))
- pVIADisplay->TVI2CDev = ViaCH7xxxDetect(pScrn, pVIADisplay->pI2CBus3, 0xEA);
+ pI2CDevice = ViaCH7xxxDetect(pScrn, pVIADisplay->pI2CBus3, 0xEA);
- if (!pVIADisplay->TVI2CDev) {
+ if (!pI2CDevice) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Did not detect a TV encoder.\n");
goto exit;
}
- switch (pVIADisplay->TVEncoder) {
- case VIA_VT1621:
- case VIA_VT1622:
- case VIA_VT1623:
- case VIA_VT1625:
- ViaVT162xInit(pScrn);
- break;
- case VIA_CH7011:
- case VIA_CH7019A:
- case VIA_CH7019B:
- ViaCH7xxxInit(pScrn);
- break;
- default:
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Was not able to initialize a known TV encoder.\n");
- goto exit;
- break;
- }
-
- if (!pVIADisplay->TVSave || !pVIADisplay->TVRestore
- || !pVIADisplay->TVDACSense || !pVIADisplay->TVModeValid
- || !pVIADisplay->TVModeI2C || !pVIADisplay->TVModeCrtc
- || !pVIADisplay->TVPower || !pVIADisplay->TVModes
- || !pVIADisplay->TVPrintRegs) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "TV encoder was not properly initialized.\n");
+ pVIATV = (viaTVRecPtr) xnfcalloc(1, sizeof(viaTVRec));
+ if (pVIATV) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate storage for TV.\n"));
goto free_i2c;
}
@@ -838,7 +798,7 @@ via_tv_init(ScrnInfoPtr pScrn)
if (!output) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed to register TV as an output.\n");
- goto free_i2c;
+ goto free_mem;
}
/*
@@ -846,35 +806,91 @@ via_tv_init(ScrnInfoPtr pScrn)
*/
pVIADisplay->numberTV++;
- pVIADisplay->tv = output;
+ pVia->FirstInit = TRUE;
- /* Save now */
- pVIADisplay->TVSave(pScrn);
+ output->driver_private = pVIATV;
/*
* To allow TV output on both CRTCs, set bit 0 and 1.
*/
output->possible_crtcs = BIT(1) | BIT(0);
- pVia->FirstInit = TRUE;
+ pVIATV->TVEncoder = pVIADisplay->TVEncoder;
+ pVIATV->TVOutput = pVIADisplay->TVOutput;
+ pVIATV->TVType = pVIADisplay->TVType;
+ pVIATV->TVDotCrawl = pVIADisplay->TVDotCrawl;
+ pVIATV->TVDeflicker = pVIADisplay->TVDeflicker;
+
+ pVIATV->TVSave = NULL;
+ pVIATV->TVRestore = NULL;
+ pVIATV->TVDACSense = NULL;
+ pVIATV->TVModeValid = NULL;
+ pVIATV->TVModeI2C = NULL;
+ pVIATV->TVModeCrtc = NULL;
+ pVIATV->TVPower = NULL;
+ pVIATV->TVModes = NULL;
+ pVIATV->TVPrintRegs = NULL;
+ pVIATV->LCDPower = NULL;
+ pVIATV->TVNumRegs = 0;
+
+ pVIATV->pVIATVI2CDev = pI2CDevice;
+
+ switch (pVIATV->TVEncoder) {
+ case VIA_VT1621:
+ case VIA_VT1622:
+ case VIA_VT1623:
+ case VIA_VT1625:
+ ViaVT162xInit(output);
+ break;
+ case VIA_CH7011:
+ case VIA_CH7019A:
+ case VIA_CH7019B:
+ ViaCH7xxxInit(output);
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Was not able to initialize a known TV encoder.\n");
+ goto free_mem;
+ break;
+ }
+
+ if (!pVIATV->TVSave || !pVIATV->TVRestore
+ || !pVIATV->TVDACSense || !pVIATV->TVModeValid
+ || !pVIATV->TVModeI2C || !pVIATV->TVModeCrtc
+ || !pVIATV->TVPower || !pVIATV->TVModes
+ || !pVIATV->TVPrintRegs) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "TV encoder was not properly initialized.\n");
+ goto free_mem;
+ }
+
+ /*
+ * Save TV registers.
+ */
+ pVIATV->TVSave(output);
+
goto exit;
+free_mem:
+ pVIATV->TVOutput = TVOUTPUT_NONE;
+ pVIATV->TVEncoder = VIA_NONETV;
+
+ pVIATV->TVSave = NULL;
+ pVIATV->TVRestore = NULL;
+ pVIATV->TVDACSense = NULL;
+ pVIATV->TVModeValid = NULL;
+ pVIATV->TVModeI2C = NULL;
+ pVIATV->TVModeCrtc = NULL;
+ pVIATV->TVPower = NULL;
+ pVIATV->TVModes = NULL;
+ pVIATV->TVPrintRegs = NULL;
+ pVIATV->TVNumRegs = 0;
+
+ xf86DestroyI2CDevRec(pVIATV->pVIATVI2CDev, TRUE);
+ pVIATV->pVIATVI2CDev = NULL;
+ free(pVIATV);
free_i2c:
pVIADisplay->TVOutput = TVOUTPUT_NONE;
pVIADisplay->TVEncoder = VIA_NONETV;
- pVIADisplay->TVI2CDev = NULL;
- pVIADisplay->TVSave = NULL;
- pVIADisplay->TVRestore = NULL;
- pVIADisplay->TVDACSense = NULL;
- pVIADisplay->TVModeValid = NULL;
- pVIADisplay->TVModeI2C = NULL;
- pVIADisplay->TVModeCrtc = NULL;
- pVIADisplay->TVPower = NULL;
- pVIADisplay->TVModes = NULL;
- pVIADisplay->TVPrintRegs = NULL;
- pVIADisplay->TVNumRegs = 0;
-
- xf86DestroyI2CDevRec(pVIADisplay->TVI2CDev, TRUE);
- pVIADisplay->TVI2CDev = NULL;
exit:
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Exiting %s.\n", __func__));
diff --git a/src/via_ums.h b/src/via_ums.h
index ab2769e..3474452 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -233,8 +233,6 @@ typedef struct _VIADISPLAY {
VIARegRec SavedReg;
- xf86OutputPtr tv;
-
CARD32 Clock; /* register value for the dotclock */
Bool ClockExternal;
CARD32 Bandwidth; /* available memory bandwidth */
@@ -242,26 +240,9 @@ typedef struct _VIADISPLAY {
/* TV entries */
int TVEncoder;
int TVOutput;
- I2CDevPtr TVI2CDev;
int TVType;
Bool TVDotCrawl;
int TVDeflicker;
- CARD8 TVRegs[0xFF];
- int TVNumRegs;
-
- /* TV Callbacks */
- void (*TVSave) (ScrnInfoPtr pScrn);
- void (*TVRestore) (ScrnInfoPtr pScrn);
- Bool (*TVDACSense) (ScrnInfoPtr pScrn);
- ModeStatus (*TVModeValid) (ScrnInfoPtr pScrn, DisplayModePtr mode);
- void (*TVModeI2C) (ScrnInfoPtr pScrn, DisplayModePtr mode);
- void (*TVModeCrtc) (xf86CrtcPtr crtc, DisplayModePtr mode);
- void (*TVPower) (ScrnInfoPtr pScrn, Bool On);
- void (*LCDPower) (ScrnInfoPtr pScrn, Bool On);
- DisplayModePtr TVModes;
- int TVNumModes;
- void (*TVPrintRegs) (ScrnInfoPtr pScrn);
-
} VIADisplayRec, *VIADisplayPtr;
typedef struct _VIAANALOG {
@@ -305,6 +286,31 @@ typedef struct _VIATMDS {
CARD8 i2cBus;
} VIATMDSRec, *VIATMDSPtr;
+typedef struct _VIATV {
+ int TVEncoder;
+ int TVOutput;
+ int TVType;
+ Bool TVDotCrawl;
+ int TVDeflicker;
+ CARD8 TVRegs[0xFF];
+ int TVNumRegs;
+
+ /* TV Callbacks */
+ void (*TVSave) (xf86OutputPtr output);
+ void (*TVRestore) (xf86OutputPtr output);
+ Bool (*TVDACSense) (xf86OutputPtr output);
+ ModeStatus (*TVModeValid) (xf86OutputPtr output, DisplayModePtr mode);
+ void (*TVModeI2C) (xf86OutputPtr output, DisplayModePtr mode);
+ void (*TVModeCrtc) (xf86OutputPtr output, DisplayModePtr mode);
+ void (*TVPower) (xf86OutputPtr output, Bool On);
+ void (*LCDPower) (xf86OutputPtr output, Bool On);
+ DisplayModePtr TVModes;
+ int TVNumModes;
+ void (*TVPrintRegs) (xf86OutputPtr output);
+
+ I2CDevPtr pVIATVI2CDev;
+} viaTVRec, *viaTVRecPtr;
+
typedef struct
{
CARD16 X;
@@ -1776,10 +1782,10 @@ void via_tv_init(ScrnInfoPtr pScrn);
/* via_vt162x.c */
I2CDevPtr ViaVT162xDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address);
-void ViaVT162xInit(ScrnInfoPtr pScrn);
+void ViaVT162xInit(xf86OutputPtr output);
/* via_ch7xxx.c */
I2CDevPtr ViaCH7xxxDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address);
-void ViaCH7xxxInit(ScrnInfoPtr pScrn);
+void ViaCH7xxxInit(xf86OutputPtr output);
#endif /* _VIA_UMS_H_ */
diff --git a/src/via_vt162x.c b/src/via_vt162x.c
index 41f7d78..225efe2 100644
--- a/src/via_vt162x.c
+++ b/src/via_vt162x.c
@@ -31,17 +31,18 @@
#include "via_vt162x.h"
static void
-ViaSetTVClockSource(xf86CrtcPtr crtc)
+ViaSetTVClockSource(xf86OutputPtr output)
{
+ xf86CrtcPtr crtc = output->crtc;
drmmode_crtc_private_ptr iga = crtc->driver_private;
ScrnInfoPtr pScrn = crtc->scrn;
VIAPtr pVia = VIAPTR(pScrn);
- VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
vgaHWPtr hwp = VGAHWPTR(pScrn);
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaSetTVClockSource\n"));
- switch(pVIADisplay->TVEncoder) {
+ switch(pVIATV->TVEncoder) {
case VIA_VT1625:
/* External TV: */
switch(pVia->Chipset) {
@@ -78,17 +79,18 @@ ViaSetTVClockSource(xf86CrtcPtr crtc)
}
static void
-VT162xPrintRegs(ScrnInfoPtr pScrn)
+VT162xPrintRegs(xf86OutputPtr output)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
CARD8 i, buf;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Printing registers for %s\n",
- pVIADisplay->TVI2CDev->DevName);
+ pVIATV->pVIATVI2CDev->DevName);
- for (i = 0; i < pVIADisplay->TVNumRegs; i++) {
- xf86I2CReadByte(pVIADisplay->TVI2CDev, i, &buf);
+ for (i = 0; i < pVIATV->TVNumRegs; i++) {
+ xf86I2CReadByte(pVIATV->pVIATVI2CDev, i, &buf);
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV%02X: 0x%02X\n", i, buf);
}
@@ -162,28 +164,30 @@ ViaVT162xDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address)
static void
-VT162xSave(ScrnInfoPtr pScrn)
+VT162xSave(xf86OutputPtr output)
{
int i;
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT162xSave\n"));
- for (i = 0; i < pVIADisplay->TVNumRegs; i++)
- xf86I2CReadByte(pVIADisplay->TVI2CDev, i, &(pVIADisplay->TVRegs[i]));
+ for (i = 0; i < pVIATV->TVNumRegs; i++)
+ xf86I2CReadByte(pVIATV->pVIATVI2CDev, i, &(pVIATV->TVRegs[i]));
}
static void
-VT162xRestore(ScrnInfoPtr pScrn)
+VT162xRestore(xf86OutputPtr output)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
int i;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT162xRestore\n"));
- for (i = 0; i < pVIADisplay->TVNumRegs; i++)
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, i, pVIADisplay->TVRegs[i]);
+ for (i = 0; i < pVIATV->TVNumRegs; i++)
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, i, pVIATV->TVRegs[i]);
}
@@ -250,37 +254,38 @@ VT1625DACSenseI2C(I2CDevPtr pDev)
* VT1621 only knows composite and s-video.
*/
static Bool
-VT1621DACSense(ScrnInfoPtr pScrn)
+VT1621DACSense(xf86OutputPtr output)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
CARD8 sense;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621DACSense\n"));
- sense = VT162xDACSenseI2C(pVIADisplay->TVI2CDev);
+ sense = VT162xDACSenseI2C(pVIATV->pVIATVI2CDev);
switch (sense) {
case 0x00:
- pVIADisplay->TVOutput = TVOUTPUT_SC;
+ pVIATV->TVOutput = TVOUTPUT_SC;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"VT1621: S-Video & Composite connected.\n");
return TRUE;
case 0x01:
- pVIADisplay->TVOutput = TVOUTPUT_COMPOSITE;
+ pVIATV->TVOutput = TVOUTPUT_COMPOSITE;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"VT1621: Composite connected.\n");
return TRUE;
case 0x02:
- pVIADisplay->TVOutput = TVOUTPUT_SVIDEO;
+ pVIATV->TVOutput = TVOUTPUT_SVIDEO;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"VT1621: S-Video connected.\n");
return TRUE;
case 0x03:
- pVIADisplay->TVOutput = TVOUTPUT_NONE;
+ pVIATV->TVOutput = TVOUTPUT_NONE;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"VT1621: Nothing connected.\n");
return FALSE;
default:
- pVIADisplay->TVOutput = TVOUTPUT_NONE;
+ pVIATV->TVOutput = TVOUTPUT_NONE;
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"VT1621: Unknown cable combination: 0x0%2X.\n", sense);
return FALSE;
@@ -291,47 +296,48 @@ VT1621DACSense(ScrnInfoPtr pScrn)
* VT1622, VT1622A and VT1623 know composite, s-video, RGB and YCBCR.
*/
static Bool
-VT1622DACSense(ScrnInfoPtr pScrn)
+VT1622DACSense(xf86OutputPtr output)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
CARD8 sense;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622DACSense\n"));
- sense = VT162xDACSenseI2C(pVIADisplay->TVI2CDev);
+ sense = VT162xDACSenseI2C(pVIATV->pVIATVI2CDev);
switch (sense) {
case 0x00: /* DAC A,B,C,D */
- pVIADisplay->TVOutput = TVOUTPUT_RGB;
+ pVIATV->TVOutput = TVOUTPUT_RGB;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"VT162x: RGB connected.\n");
return TRUE;
case 0x01: /* DAC A,B,C */
- pVIADisplay->TVOutput = TVOUTPUT_SC;
+ pVIATV->TVOutput = TVOUTPUT_SC;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"VT162x: S-Video & Composite connected.\n");
return TRUE;
case 0x07: /* DAC A */
- pVIADisplay->TVOutput = TVOUTPUT_COMPOSITE;
+ pVIATV->TVOutput = TVOUTPUT_COMPOSITE;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"VT162x: Composite connected.\n");
return TRUE;
case 0x08: /* DAC B,C,D */
- pVIADisplay->TVOutput = TVOUTPUT_YCBCR;
+ pVIATV->TVOutput = TVOUTPUT_YCBCR;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"VT162x: YcBcR connected.\n");
return TRUE;
case 0x09: /* DAC B,C */
- pVIADisplay->TVOutput = TVOUTPUT_SVIDEO;
+ pVIATV->TVOutput = TVOUTPUT_SVIDEO;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"VT162x: S-Video connected.\n");
return TRUE;
case 0x0F:
- pVIADisplay->TVOutput = TVOUTPUT_NONE;
+ pVIATV->TVOutput = TVOUTPUT_NONE;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"VT162x: Nothing connected.\n");
return FALSE;
default:
- pVIADisplay->TVOutput = TVOUTPUT_NONE;
+ pVIATV->TVOutput = TVOUTPUT_NONE;
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"VT162x: Unknown cable combination: 0x0%2X.\n", sense);
return FALSE;
@@ -342,47 +348,48 @@ VT1622DACSense(ScrnInfoPtr pScrn)
* VT1625 knows composite, s-video, RGB and YCBCR.
*/
static Bool
-VT1625DACSense(ScrnInfoPtr pScrn)
+VT1625DACSense(xf86OutputPtr output)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
CARD8 sense;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1625DACSense\n"));
- sense = VT1625DACSenseI2C(pVIADisplay->TVI2CDev);
+ sense = VT1625DACSenseI2C(pVIATV->pVIATVI2CDev);
switch (sense) {
case 0x00: /* DAC A,B,C,D,E,F */
- pVIADisplay->TVOutput = TVOUTPUT_RGB;
+ pVIATV->TVOutput = TVOUTPUT_RGB;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"VT1625: RGB connected.\n");
return TRUE;
case 0x07: /* DAC A,B,C */
- pVIADisplay->TVOutput = TVOUTPUT_SC;
+ pVIATV->TVOutput = TVOUTPUT_SC;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"VT1625: S-Video & Composite connected.\n");
return TRUE;
case 0x37: /* DAC C */
- pVIADisplay->TVOutput = TVOUTPUT_COMPOSITE;
+ pVIATV->TVOutput = TVOUTPUT_COMPOSITE;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"VT1625: Composite connected.\n");
return TRUE;
case 0x38: /* DAC D,E,F */
- pVIADisplay->TVOutput = TVOUTPUT_YCBCR;
+ pVIATV->TVOutput = TVOUTPUT_YCBCR;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"VT1625: YCbCr connected.\n");
return TRUE;
case 0x0F: /* DAC A,B */
- pVIADisplay->TVOutput = TVOUTPUT_SVIDEO;
+ pVIATV->TVOutput = TVOUTPUT_SVIDEO;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"VT1625: S-Video connected.\n");
return TRUE;
case 0x3F:
- pVIADisplay->TVOutput = TVOUTPUT_NONE;
+ pVIATV->TVOutput = TVOUTPUT_NONE;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"VT1625: Nothing connected.\n");
return FALSE;
default:
- pVIADisplay->TVOutput = TVOUTPUT_NONE;
+ pVIATV->TVOutput = TVOUTPUT_NONE;
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"VT1625: Unknown cable combination: 0x0%2X.\n", sense);
return FALSE;
@@ -390,9 +397,10 @@ VT1625DACSense(ScrnInfoPtr pScrn)
}
static CARD8
-VT1621ModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
+VT1621ModeIndex(xf86OutputPtr output, DisplayModePtr mode)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
int i;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621ModeIndex\n"));
@@ -400,7 +408,7 @@ VT1621ModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
for (i = 0; VT1621Table[i].Width; i++) {
if ((VT1621Table[i].Width == mode->CrtcHDisplay) &&
(VT1621Table[i].Height == mode->CrtcVDisplay) &&
- (VT1621Table[i].Standard == pVIADisplay->TVType) &&
+ (VT1621Table[i].Standard == pVIATV->TVType) &&
!(strcmp(VT1621Table[i].name, mode->name)))
return i;
}
@@ -410,9 +418,10 @@ VT1621ModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
static ModeStatus
-VT1621ModeValid(ScrnInfoPtr pScrn, DisplayModePtr mode)
+VT1621ModeValid(xf86OutputPtr output, DisplayModePtr mode)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621ModeValid\n"));
@@ -424,35 +433,36 @@ VT1621ModeValid(ScrnInfoPtr pScrn, DisplayModePtr mode)
return MODE_BAD;
}
- if ((pVIADisplay->TVType == TVTYPE_NTSC) &&
+ if ((pVIATV->TVType == TVTYPE_NTSC) &&
(mode->Private != (void *)&VT162xModePrivateNTSC)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"TV standard is NTSC. This is a PAL mode.\n");
return MODE_BAD;
- } else if ((pVIADisplay->TVType == TVTYPE_PAL) &&
+ } else if ((pVIATV->TVType == TVTYPE_PAL) &&
(mode->Private != (void *)&VT162xModePrivatePAL)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"TV standard is PAL. This is a NTSC mode.\n");
return MODE_BAD;
}
- if (VT1621ModeIndex(pScrn, mode) != 0xFF)
+ if (VT1621ModeIndex(output, mode) != 0xFF)
return MODE_OK;
return MODE_BAD;
}
static CARD8
-VT1622ModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
+VT1622ModeIndex(xf86OutputPtr output, DisplayModePtr mode)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
struct VT162XTableRec *Table;
int i;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622ModeIndex\n"));
- if (pVIADisplay->TVEncoder == VIA_VT1622)
+ if (pVIATV->TVEncoder == VIA_VT1622)
Table = VT1622Table;
- else if (pVIADisplay->TVEncoder == VIA_VT1625)
+ else if (pVIATV->TVEncoder == VIA_VT1625)
Table = VT1625Table;
else
Table = VT1623Table;
@@ -462,12 +472,12 @@ VT1622ModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
"width=%d:%d, height=%d:%d, std=%d:%d, name=%s:%s.\n",
Table[i].Width, mode->CrtcHDisplay,
Table[i].Height, mode->CrtcVDisplay,
- Table[i].Standard, pVIADisplay->TVType,
+ Table[i].Standard, pVIATV->TVType,
Table[i].name, mode->name);
if ((Table[i].Width == mode->CrtcHDisplay) &&
(Table[i].Height == mode->CrtcVDisplay) &&
- (Table[i].Standard == pVIADisplay->TVType) &&
+ (Table[i].Standard == pVIATV->TVType) &&
!strcmp(Table[i].name, mode->name))
return i;
}
@@ -477,9 +487,10 @@ VT1622ModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
static ModeStatus
-VT1622ModeValid(ScrnInfoPtr pScrn, DisplayModePtr mode)
+VT1622ModeValid(xf86OutputPtr output, DisplayModePtr mode)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622ModeValid\n"));
@@ -491,27 +502,28 @@ VT1622ModeValid(ScrnInfoPtr pScrn, DisplayModePtr mode)
return MODE_BAD;
}
- if ((pVIADisplay->TVType == TVTYPE_NTSC) &&
+ if ((pVIATV->TVType == TVTYPE_NTSC) &&
(mode->Private != (void *)&VT162xModePrivateNTSC)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"TV standard is NTSC. This is a PAL mode.\n");
return MODE_BAD;
- } else if ((pVIADisplay->TVType == TVTYPE_PAL) &&
+ } else if ((pVIATV->TVType == TVTYPE_PAL) &&
(mode->Private != (void *)&VT162xModePrivatePAL)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"TV standard is PAL. This is a NTSC mode.\n");
return MODE_BAD;
}
- if (VT1622ModeIndex(pScrn, mode) != 0xFF)
+ if (VT1622ModeIndex(output, mode) != 0xFF)
return MODE_OK;
return MODE_BAD;
}
static ModeStatus
-VT1625ModeValid(ScrnInfoPtr pScrn, DisplayModePtr mode)
+VT1625ModeValid(xf86OutputPtr output, DisplayModePtr mode)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1625ModeValid\n"));
@@ -527,39 +539,39 @@ VT1625ModeValid(ScrnInfoPtr pScrn, DisplayModePtr mode)
return MODE_BAD;
}
- if ((pVIADisplay->TVType == TVTYPE_NTSC) &&
+ if ((pVIATV->TVType == TVTYPE_NTSC) &&
(mode->Private != (void *)&VT162xModePrivateNTSC)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"TV standard is NTSC. This is an incompatible mode.\n");
return MODE_BAD;
- } else if ((pVIADisplay->TVType == TVTYPE_PAL) &&
+ } else if ((pVIATV->TVType == TVTYPE_PAL) &&
(mode->Private != (void *)&VT162xModePrivatePAL)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"TV standard is PAL. This is an incompatible mode.\n");
return MODE_BAD;
- } else if ((pVIADisplay->TVType == TVTYPE_480P) &&
+ } else if ((pVIATV->TVType == TVTYPE_480P) &&
(mode->Private != (void *)&VT162xModePrivate480P)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"TV standard is 480P. This is an incompatible mode.\n");
return MODE_BAD;
- } else if ((pVIADisplay->TVType == TVTYPE_576P) &&
+ } else if ((pVIATV->TVType == TVTYPE_576P) &&
(mode->Private != (void *)&VT162xModePrivate576P)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"TV standard is 576P. This is an incompatible mode.\n");
return MODE_BAD;
- } else if ((pVIADisplay->TVType == TVTYPE_720P) &&
+ } else if ((pVIATV->TVType == TVTYPE_720P) &&
(mode->Private != (void *)&VT162xModePrivate720P)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"TV standard is 720P. This is an incompatible mode.\n");
return MODE_BAD;
- } else if ((pVIADisplay->TVType == TVTYPE_1080I) &&
+ } else if ((pVIATV->TVType == TVTYPE_1080I) &&
(mode->Private != (void *)&VT162xModePrivate1080I)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"TV standard is 1080I. This is an incompatible mode.\n");
return MODE_BAD;
}
- if (VT1622ModeIndex(pScrn, mode) != 0xFF)
+ if (VT1622ModeIndex(output, mode) != 0xFF)
return MODE_OK;
return MODE_BAD;
}
@@ -575,47 +587,48 @@ VT162xSetSubCarrier(I2CDevPtr pDev, CARD32 SubCarrier)
}
static void
-VT1621ModeI2C(ScrnInfoPtr pScrn, DisplayModePtr mode)
+VT1621ModeI2C(xf86OutputPtr output, DisplayModePtr mode)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
- struct VT1621TableRec Table = VT1621Table[VT1621ModeIndex(pScrn, mode)];
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
+ struct VT1621TableRec Table = VT1621Table[VT1621ModeIndex(output, mode)];
CARD8 i;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621ModeI2C\n"));
for (i = 0; i < 0x16; i++)
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, i, Table.TV[i]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, i, Table.TV[i]);
- VT162xSetSubCarrier(pVIADisplay->TVI2CDev, Table.SubCarrier);
+ VT162xSetSubCarrier(pVIATV->pVIATVI2CDev, Table.SubCarrier);
/* Skip reserved (1A) and version ID (1B). */
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x1C, Table.TV[0x1C]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x1C, Table.TV[0x1C]);
/* Skip software reset (1D). */
for (i = 0x1E; i < 0x24; i++)
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, i, Table.TV[i]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, i, Table.TV[i]);
/* Write some zeroes? */
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x24, 0x00);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x24, 0x00);
for (i = 0; i < 0x08; i++)
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x4A + i, 0x00);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x4A + i, 0x00);
- if (pVIADisplay->TVOutput == TVOUTPUT_COMPOSITE)
+ if (pVIATV->TVOutput == TVOUTPUT_COMPOSITE)
for (i = 0; i < 0x10; i++)
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x52 + i, Table.TVC[i]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x52 + i, Table.TVC[i]);
else
for (i = 0; i < 0x10; i++)
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x52 + i, Table.TVS[i]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x52 + i, Table.TVS[i]);
/* Turn on all Composite and S-Video output. */
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x0E, 0x00);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x0E, 0x00);
- if (pVIADisplay->TVDotCrawl) {
+ if (pVIATV->TVDotCrawl) {
if (Table.DotCrawlSubCarrier) {
- xf86I2CReadByte(pVIADisplay->TVI2CDev, 0x11, &i);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x11, i | 0x08);
+ xf86I2CReadByte(pVIATV->pVIATVI2CDev, 0x11, &i);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x11, i | 0x08);
- VT162xSetSubCarrier(pVIADisplay->TVI2CDev, Table.DotCrawlSubCarrier);
+ VT162xSetSubCarrier(pVIATV->pVIATVI2CDev, Table.DotCrawlSubCarrier);
} else
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "This mode does not currently "
"support DotCrawl suppression.\n");
@@ -623,13 +636,13 @@ VT1621ModeI2C(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
static void
-VT1621ModeCrtc(xf86CrtcPtr crtc, DisplayModePtr mode)
+VT1621ModeCrtc(xf86OutputPtr output, DisplayModePtr mode)
{
- ScrnInfoPtr pScrn = crtc->scrn;
+ ScrnInfoPtr pScrn = output->scrn;
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
- struct VT1621TableRec Table = VT1621Table[VT1621ModeIndex(pScrn, mode)];
+ struct VT1621TableRec Table = VT1621Table[VT1621ModeIndex(output, mode)];
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621ModeCrtc\n"));
@@ -656,123 +669,125 @@ VT1621ModeCrtc(xf86CrtcPtr crtc, DisplayModePtr mode)
* Also suited for VT1622A, VT1623, VT1625.
*/
static void
-VT1622ModeI2C(ScrnInfoPtr pScrn, DisplayModePtr mode)
+VT1622ModeI2C(xf86OutputPtr output, DisplayModePtr mode)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
struct VT162XTableRec Table;
CARD8 save, i;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622ModeI2C\n"));
- if (pVIADisplay->TVEncoder == VIA_VT1622)
- Table = VT1622Table[VT1622ModeIndex(pScrn, mode)];
- else if (pVIADisplay->TVEncoder == VIA_VT1625)
- Table = VT1625Table[VT1622ModeIndex(pScrn, mode)];
+ if (pVIATV->TVEncoder == VIA_VT1622)
+ Table = VT1622Table[VT1622ModeIndex(output, mode)];
+ else if (pVIATV->TVEncoder == VIA_VT1625)
+ Table = VT1625Table[VT1622ModeIndex(output, mode)];
else /* VT1622A/VT1623 */
- Table = VT1623Table[VT1622ModeIndex(pScrn, mode)];
+ Table = VT1623Table[VT1622ModeIndex(output, mode)];
/* TV reset. */
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x1D, 0x00);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x1D, 0x80);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x1D, 0x00);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x1D, 0x80);
for (i = 0; i < 0x16; i++)
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, i, Table.TV1[i]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, i, Table.TV1[i]);
- VT162xSetSubCarrier(pVIADisplay->TVI2CDev, Table.SubCarrier);
+ VT162xSetSubCarrier(pVIATV->pVIATVI2CDev, Table.SubCarrier);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x1A, Table.TV1[0x1A]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x1A, Table.TV1[0x1A]);
/* Skip version ID. */
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x1C, Table.TV1[0x1C]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x1C, Table.TV1[0x1C]);
/* Skip software reset. */
for (i = 0x1E; i < 0x30; i++)
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, i, Table.TV1[i]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, i, Table.TV1[i]);
for (i = 0; i < 0x1B; i++)
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x4A + i, Table.TV2[i]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x4A + i, Table.TV2[i]);
/* Turn on all Composite and S-Video output. */
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x0E, 0x00);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x0E, 0x00);
- if (pVIADisplay->TVDotCrawl) {
+ if (pVIATV->TVDotCrawl) {
if (Table.DotCrawlSubCarrier) {
- xf86I2CReadByte(pVIADisplay->TVI2CDev, 0x11, &save);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x11, save | 0x08);
+ xf86I2CReadByte(pVIATV->pVIATVI2CDev, 0x11, &save);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x11, save | 0x08);
- VT162xSetSubCarrier(pVIADisplay->TVI2CDev, Table.DotCrawlSubCarrier);
+ VT162xSetSubCarrier(pVIATV->pVIATVI2CDev, Table.DotCrawlSubCarrier);
} else
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "This mode does not currently "
"support DotCrawl suppression.\n");
}
- if (pVIADisplay->TVOutput == TVOUTPUT_RGB) {
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x02, 0x2A);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x65, Table.RGB[0]);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x66, Table.RGB[1]);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x67, Table.RGB[2]);
+ if (pVIATV->TVOutput == TVOUTPUT_RGB) {
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x02, 0x2A);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x65, Table.RGB[0]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x66, Table.RGB[1]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x67, Table.RGB[2]);
if (Table.RGB[3])
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x27, Table.RGB[3]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x27, Table.RGB[3]);
if (Table.RGB[4])
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x2B, Table.RGB[4]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x2B, Table.RGB[4]);
if (Table.RGB[5])
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x2C, Table.RGB[5]);
- if (pVIADisplay->TVEncoder == VIA_VT1625) {
- if (pVIADisplay->TVType < TVTYPE_480P) {
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x02, 0x12);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x23, 0x7E);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x4A, 0x85);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x4B, 0x0A);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x4E, 0x00);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x2C, Table.RGB[5]);
+ if (pVIATV->TVEncoder == VIA_VT1625) {
+ if (pVIATV->TVType < TVTYPE_480P) {
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x02, 0x12);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x23, 0x7E);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x4A, 0x85);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x4B, 0x0A);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x4E, 0x00);
} else {
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x02, 0x12);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x4A, 0x85);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x4B, 0x0A);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x02, 0x12);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x4A, 0x85);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x4B, 0x0A);
}
}
- } else if (pVIADisplay->TVOutput == TVOUTPUT_YCBCR) {
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x02, 0x03);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x65, Table.YCbCr[0]);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x66, Table.YCbCr[1]);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x67, Table.YCbCr[2]);
- if (pVIADisplay->TVEncoder == VIA_VT1625) {
- if (pVIADisplay->TVType < TVTYPE_480P) {
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x23, 0x7E);
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x4E, 0x00);
+ } else if (pVIATV->TVOutput == TVOUTPUT_YCBCR) {
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x02, 0x03);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x65, Table.YCbCr[0]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x66, Table.YCbCr[1]);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x67, Table.YCbCr[2]);
+ if (pVIATV->TVEncoder == VIA_VT1625) {
+ if (pVIATV->TVType < TVTYPE_480P) {
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x23, 0x7E);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x4E, 0x00);
}
}
}
/* Configure flicker filter. */
- xf86I2CReadByte(pVIADisplay->TVI2CDev, 0x03, &save);
+ xf86I2CReadByte(pVIATV->pVIATVI2CDev, 0x03, &save);
save &= 0xFC;
- if (pVIADisplay->TVDeflicker == 1)
+ if (pVIATV->TVDeflicker == 1)
save |= 0x01;
- else if (pVIADisplay->TVDeflicker == 2)
+ else if (pVIATV->TVDeflicker == 2)
save |= 0x02;
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x03, save);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x03, save);
}
/*
* Also suited for VT1622A, VT1623, VT1625.
*/
static void
-VT1622ModeCrtc(xf86CrtcPtr crtc, DisplayModePtr mode)
+VT1622ModeCrtc(xf86OutputPtr output, DisplayModePtr mode)
{
- ScrnInfoPtr pScrn = crtc->scrn;
+ ScrnInfoPtr pScrn = output->scrn;
vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
- VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
+ VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
struct VT162XTableRec Table;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622ModeCrtc\n"));
- if (pVIADisplay->TVEncoder == VIA_VT1622)
- Table = VT1622Table[VT1622ModeIndex(pScrn, mode)];
- else if (pVIADisplay->TVEncoder == VIA_VT1625)
- Table = VT1625Table[VT1622ModeIndex(pScrn, mode)];
+ if (pVIATV->TVEncoder == VIA_VT1622)
+ Table = VT1622Table[VT1622ModeIndex(output, mode)];
+ else if (pVIATV->TVEncoder == VIA_VT1625)
+ Table = VT1625Table[VT1622ModeIndex(output, mode)];
else /* VT1622A/VT1623 */
- Table = VT1623Table[VT1622ModeIndex(pScrn, mode)];
+ Table = VT1623Table[VT1622ModeIndex(output, mode)];
hwp->writeCrtc(hwp, 0x6A, 0x00);
hwp->writeCrtc(hwp, 0x6B, 0x00);
@@ -808,109 +823,113 @@ VT1622ModeCrtc(xf86CrtcPtr crtc, DisplayModePtr mode)
}
pVIADisplay->ClockExternal = TRUE;
ViaCrtcMask(hwp, 0x6A, 0x40, 0x40);
- ViaSetTVClockSource(crtc);
+ ViaSetTVClockSource(output);
}
static void
-VT1621Power(ScrnInfoPtr pScrn, Bool On)
+VT1621Power(xf86OutputPtr output, Bool On)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1621Power\n"));
if (On)
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x0E, 0x00);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x0E, 0x00);
else
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x0E, 0x03);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x0E, 0x03);
}
static void
-VT1622Power(ScrnInfoPtr pScrn, Bool On)
+VT1622Power(xf86OutputPtr output, Bool On)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1622Power\n"));
if (On)
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x0E, 0x00);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x0E, 0x00);
else
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x0E, 0x0F);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x0E, 0x0F);
}
static void
-VT1625Power(ScrnInfoPtr pScrn, Bool On)
+VT1625Power(xf86OutputPtr output, Bool On)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1625Power\n"));
if (On)
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x0E, 0x00);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x0E, 0x00);
else
- xf86I2CWriteByte(pVIADisplay->TVI2CDev, 0x0E, 0x3F);
+ xf86I2CWriteByte(pVIATV->pVIATVI2CDev, 0x0E, 0x3F);
}
void
-ViaVT162xInit(ScrnInfoPtr pScrn)
+ViaVT162xInit(xf86OutputPtr output)
{
- VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
+ ScrnInfoPtr pScrn = output->scrn;
+ viaTVRecPtr pVIATV = (viaTVRecPtr) output->driver_private;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVT162xInit\n"));
- switch (pVIADisplay->TVEncoder) {
+ switch (pVIATV->TVEncoder) {
case VIA_VT1621:
- pVIADisplay->TVSave = VT162xSave;
- pVIADisplay->TVRestore = VT162xRestore;
- pVIADisplay->TVDACSense = VT1621DACSense;
- pVIADisplay->TVModeValid = VT1621ModeValid;
- pVIADisplay->TVModeI2C = VT1621ModeI2C;
- pVIADisplay->TVModeCrtc = VT1621ModeCrtc;
- pVIADisplay->TVPower = VT1621Power;
- pVIADisplay->TVModes = VT1621Modes;
- pVIADisplay->TVNumModes = sizeof(VT1621Modes) / sizeof(DisplayModeRec);
- pVIADisplay->TVPrintRegs = VT162xPrintRegs;
- pVIADisplay->TVNumRegs = 0x68;
+ pVIATV->TVSave = VT162xSave;
+ pVIATV->TVRestore = VT162xRestore;
+ pVIATV->TVDACSense = VT1621DACSense;
+ pVIATV->TVModeValid = VT1621ModeValid;
+ pVIATV->TVModeI2C = VT1621ModeI2C;
+ pVIATV->TVModeCrtc = VT1621ModeCrtc;
+ pVIATV->TVPower = VT1621Power;
+ pVIATV->TVModes = VT1621Modes;
+ pVIATV->TVNumModes = sizeof(VT1621Modes) / sizeof(DisplayModeRec);
+ pVIATV->TVPrintRegs = VT162xPrintRegs;
+ pVIATV->TVNumRegs = 0x68;
break;
case VIA_VT1622:
- pVIADisplay->TVSave = VT162xSave;
- pVIADisplay->TVRestore = VT162xRestore;
- pVIADisplay->TVDACSense = VT1622DACSense;
- pVIADisplay->TVModeValid = VT1622ModeValid;
- pVIADisplay->TVModeI2C = VT1622ModeI2C;
- pVIADisplay->TVModeCrtc = VT1622ModeCrtc;
- pVIADisplay->TVPower = VT1622Power;
- pVIADisplay->TVModes = VT1622Modes;
- pVIADisplay->TVNumModes = sizeof(VT1622Modes) / sizeof(DisplayModeRec);
- pVIADisplay->TVPrintRegs = VT162xPrintRegs;
- pVIADisplay->TVNumRegs = 0x68;
+ pVIATV->TVSave = VT162xSave;
+ pVIATV->TVRestore = VT162xRestore;
+ pVIATV->TVDACSense = VT1622DACSense;
+ pVIATV->TVModeValid = VT1622ModeValid;
+ pVIATV->TVModeI2C = VT1622ModeI2C;
+ pVIATV->TVModeCrtc = VT1622ModeCrtc;
+ pVIATV->TVPower = VT1622Power;
+ pVIATV->TVModes = VT1622Modes;
+ pVIATV->TVNumModes = sizeof(VT1622Modes) / sizeof(DisplayModeRec);
+ pVIATV->TVPrintRegs = VT162xPrintRegs;
+ pVIATV->TVNumRegs = 0x68;
break;
case VIA_VT1623:
- pVIADisplay->TVSave = VT162xSave;
- pVIADisplay->TVRestore = VT162xRestore;
- pVIADisplay->TVDACSense = VT1622DACSense;
- pVIADisplay->TVModeValid = VT1622ModeValid;
- pVIADisplay->TVModeI2C = VT1622ModeI2C;
- pVIADisplay->TVModeCrtc = VT1622ModeCrtc;
- pVIADisplay->TVPower = VT1622Power;
- pVIADisplay->TVModes = VT1623Modes;
- pVIADisplay->TVNumModes = sizeof(VT1623Modes) / sizeof(DisplayModeRec);
- pVIADisplay->TVPrintRegs = VT162xPrintRegs;
- pVIADisplay->TVNumRegs = 0x6C;
+ pVIATV->TVSave = VT162xSave;
+ pVIATV->TVRestore = VT162xRestore;
+ pVIATV->TVDACSense = VT1622DACSense;
+ pVIATV->TVModeValid = VT1622ModeValid;
+ pVIATV->TVModeI2C = VT1622ModeI2C;
+ pVIATV->TVModeCrtc = VT1622ModeCrtc;
+ pVIATV->TVPower = VT1622Power;
+ pVIATV->TVModes = VT1623Modes;
+ pVIATV->TVNumModes = sizeof(VT1623Modes) / sizeof(DisplayModeRec);
+ pVIATV->TVPrintRegs = VT162xPrintRegs;
+ pVIATV->TVNumRegs = 0x6C;
break;
case VIA_VT1625:
- pVIADisplay->TVSave = VT162xSave;
- pVIADisplay->TVRestore = VT162xRestore;
- pVIADisplay->TVDACSense = VT1625DACSense;
- pVIADisplay->TVModeValid = VT1625ModeValid;
- pVIADisplay->TVModeI2C = VT1622ModeI2C;
- pVIADisplay->TVModeCrtc = VT1622ModeCrtc;
- pVIADisplay->TVPower = VT1625Power;
- pVIADisplay->TVModes = VT1625Modes;
- pVIADisplay->TVNumModes = sizeof(VT1625Modes) / sizeof(DisplayModeRec);
- pVIADisplay->TVPrintRegs = VT162xPrintRegs;
- pVIADisplay->TVNumRegs = 0x82;
+ pVIATV->TVSave = VT162xSave;
+ pVIATV->TVRestore = VT162xRestore;
+ pVIATV->TVDACSense = VT1625DACSense;
+ pVIATV->TVModeValid = VT1625ModeValid;
+ pVIATV->TVModeI2C = VT1622ModeI2C;
+ pVIATV->TVModeCrtc = VT1622ModeCrtc;
+ pVIATV->TVPower = VT1625Power;
+ pVIATV->TVModes = VT1625Modes;
+ pVIATV->TVNumModes = sizeof(VT1625Modes) / sizeof(DisplayModeRec);
+ pVIATV->TVPrintRegs = VT162xPrintRegs;
+ pVIATV->TVNumRegs = 0x82;
break;
default:
break;
commit 386641066cd406befa7bac3bc3b7dba56d4bf223
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Wed Sep 21 08:31:51 2022 -0700
Convert ViaTV*() to take xf86OutputPtr type
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/src/via_tv.c b/src/via_tv.c
index 14dccd1..0aea043 100644
--- a/src/via_tv.c
+++ b/src/via_tv.c
@@ -522,8 +522,9 @@ viaTVSetDataDriveStrength(ScrnInfoPtr pScrn, CARD8 dataDriveStrength)
}
static void
-ViaTVSave(ScrnInfoPtr pScrn)
+ViaTVSave(xf86OutputPtr output)
{
+ ScrnInfoPtr pScrn = output->scrn;
VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
if (pVIADisplay->TVSave)
@@ -531,8 +532,9 @@ ViaTVSave(ScrnInfoPtr pScrn)
}
static void
-ViaTVRestore(ScrnInfoPtr pScrn)
+ViaTVRestore(xf86OutputPtr output)
{
+ ScrnInfoPtr pScrn = output->scrn;
VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
if (pVIADisplay->TVRestore)
@@ -540,8 +542,9 @@ ViaTVRestore(ScrnInfoPtr pScrn)
}
static Bool
-ViaTVDACSense(ScrnInfoPtr pScrn)
+ViaTVDACSense(xf86OutputPtr output)
{
+ ScrnInfoPtr pScrn = output->scrn;
VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
if (pVIADisplay->TVDACSense)
@@ -550,9 +553,10 @@ ViaTVDACSense(ScrnInfoPtr pScrn)
}
static void
-ViaTVSetMode(xf86CrtcPtr crtc, DisplayModePtr mode)
+ViaTVSetMode(xf86OutputPtr output, DisplayModePtr mode)
{
- ScrnInfoPtr pScrn = crtc->scrn;
+ ScrnInfoPtr pScrn = output->scrn;
+ xf86CrtcPtr crtc = output->crtc;
VIAPtr pVia = VIAPTR(pScrn);
VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
@@ -568,8 +572,9 @@ ViaTVSetMode(xf86CrtcPtr crtc, DisplayModePtr mode)
}
static void
-ViaTVPower(ScrnInfoPtr pScrn, Bool On)
+ViaTVPower(xf86OutputPtr output, Bool On)
{
+ ScrnInfoPtr pScrn = output->scrn;
VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
#ifdef HAVE_DEBUG
@@ -585,8 +590,9 @@ ViaTVPower(ScrnInfoPtr pScrn, Bool On)
#ifdef HAVE_DEBUG
void
-ViaTVPrintRegs(ScrnInfoPtr pScrn)
+ViaTVPrintRegs(xf86OutputPtr output)
{
+ ScrnInfoPtr pScrn = output->scrn;
VIADisplayPtr pVIADisplay = VIAPTR(pScrn)->pVIADisplay;
if (pVIADisplay->TVPrintRegs)
@@ -617,17 +623,15 @@ via_tv_get_property(xf86OutputPtr output, Atom property)
static void
via_tv_dpms(xf86OutputPtr output, int mode)
{
- ScrnInfoPtr pScrn = output->scrn;
-
switch (mode) {
case DPMSModeOn:
- ViaTVPower(pScrn, TRUE);
+ ViaTVPower(output, TRUE);
break;
case DPMSModeStandby:
case DPMSModeSuspend:
case DPMSModeOff:
- ViaTVPower(pScrn, FALSE);
+ ViaTVPower(output, FALSE);
break;
}
}
@@ -635,17 +639,13 @@ via_tv_dpms(xf86OutputPtr output, int mode)
static void
via_tv_save(xf86OutputPtr output)
{
- ScrnInfoPtr pScrn = output->scrn;
-
- ViaTVSave(pScrn);
+ ViaTVSave(output);
}
static void
via_tv_restore(xf86OutputPtr output)
{
- ScrnInfoPtr pScrn = output->scrn;
-
- ViaTVRestore(pScrn);
+ ViaTVRestore(output);
}
static int
@@ -697,7 +697,7 @@ via_tv_mode_set(xf86OutputPtr output, DisplayModePtr mode,
viaTVSetClockDriveStrength(pScrn, 0x03);
viaTVSetDataDriveStrength(pScrn, 0x03);
- ViaTVSetMode(output->crtc, adjusted_mode);
+ ViaTVSetMode(output, adjusted_mode);
}
pVia->FirstInit = FALSE;
@@ -707,9 +707,8 @@ static xf86OutputStatus
via_tv_detect(xf86OutputPtr output)
{
xf86OutputStatus status = XF86OutputStatusDisconnected;
- ScrnInfoPtr pScrn = output->scrn;
- if (ViaTVDACSense(pScrn))
+ if (ViaTVDACSense(output))
status = XF86OutputStatusConnected;
return status;
}
diff --git a/src/via_ums.h b/src/via_ums.h
index e8761b0..ab2769e 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -1770,7 +1770,7 @@ void viaExtTMDSInit(ScrnInfoPtr pScrn);
/*via_tv.c */
#ifdef HAVE_DEBUG
-void ViaTVPrintRegs(ScrnInfoPtr pScrn);
+void ViaTVPrintRegs(xf86OutputPtr output);
#endif
void via_tv_init(ScrnInfoPtr pScrn);
commit 2d0f25469f0fae41b5621f36d0576f8d3439d3e7
Author: Kevin Brace <kevinbrace at bracecomputerlab.com>
Date: Wed Sep 21 08:31:51 2022 -0700
Improvements to via_tv_init()
Signed-off-by: Kevin Brace <kevinbrace at bracecomputerlab.com>
diff --git a/src/via_output.c b/src/via_output.c
index 3711b21..1dcc27f 100644
--- a/src/via_output.c
+++ b/src/via_output.c
@@ -202,6 +202,9 @@ viaInitDisplay(ScrnInfoPtr pScrn)
/* Initialize the number of FP connectors. */
pVIADisplay->numberFP = 0;
+ /* Initialize the number of TV connectors. */
+ pVIADisplay->numberTV = 0;
+
viaExtTMDSProbe(pScrn);
viaTMDSProbe(pScrn);
diff --git a/src/via_tv.c b/src/via_tv.c
index 26a34d8..14dccd1 100644
--- a/src/via_tv.c
+++ b/src/via_tv.c
@@ -756,17 +756,18 @@ static const xf86OutputFuncsRec via_tv_funcs = {
};
/*
- *
+ * TV initialization
*/
-Bool
+void
via_tv_init(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
- xf86OutputPtr output = NULL;
+ xf86OutputPtr output;
+ char outputNameBuffer[32];
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Entered via_tv_init.\n"));
+ "Entered %s.\n", __func__));
/* preset some pVIADisplay TV related values -- move up */
pVIADisplay->TVEncoder = VIA_NONETV;
@@ -801,10 +802,7 @@ via_tv_init(ScrnInfoPtr pScrn)
if (!pVIADisplay->TVI2CDev) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Did not detect a TV encoder.\n");
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Exiting via_tv_init.\n"));
-
- return FALSE;
+ goto exit;
}
switch (pVIADisplay->TVEncoder) {
@@ -822,9 +820,7 @@ via_tv_init(ScrnInfoPtr pScrn)
default:
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Was not able to initialize a known TV encoder.\n");
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Exiting via_tv_init.\n"));
- return FALSE;
+ goto exit;
break;
}
@@ -833,47 +829,55 @@ via_tv_init(ScrnInfoPtr pScrn)
|| !pVIADisplay->TVModeI2C || !pVIADisplay->TVModeCrtc
|| !pVIADisplay->TVPower || !pVIADisplay->TVModes
|| !pVIADisplay->TVPrintRegs) {
-
- xf86DestroyI2CDevRec(pVIADisplay->TVI2CDev, TRUE);
-
- pVIADisplay->TVI2CDev = NULL;
- pVIADisplay->TVOutput = TVOUTPUT_NONE;
- pVIADisplay->TVEncoder = VIA_NONETV;
- pVIADisplay->TVI2CDev = NULL;
- pVIADisplay->TVSave = NULL;
- pVIADisplay->TVRestore = NULL;
- pVIADisplay->TVDACSense = NULL;
- pVIADisplay->TVModeValid = NULL;
- pVIADisplay->TVModeI2C = NULL;
- pVIADisplay->TVModeCrtc = NULL;
- pVIADisplay->TVPower = NULL;
- pVIADisplay->TVModes = NULL;
- pVIADisplay->TVPrintRegs = NULL;
- pVIADisplay->TVNumRegs = 0;
-
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"TV encoder was not properly initialized.\n");
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Exiting via_tv_init.\n"));
- return FALSE;
+ goto free_i2c;
}
- output = xf86OutputCreate(pScrn, &via_tv_funcs, "TV-1");
- pVia->FirstInit = TRUE;
-
- if (output) {
- /* Allow tv output on both crtcs, set bit 0 and 1. */
- output->possible_crtcs = 0x3;
- } else {
+ sprintf(outputNameBuffer, "TV-%d", (pVIADisplay->numberTV));
+ output = xf86OutputCreate(pScrn, &via_tv_funcs, outputNameBuffer);
+ if (!output) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to register TV-1.\n");
+ "Failed to register TV as an output.\n");
+ goto free_i2c;
}
+ /*
+ * Increment the number of TV encoders.
+ */
+ pVIADisplay->numberTV++;
+
pVIADisplay->tv = output;
+
/* Save now */
pVIADisplay->TVSave(pScrn);
+ /*
+ * To allow TV output on both CRTCs, set bit 0 and 1.
+ */
+ output->possible_crtcs = BIT(1) | BIT(0);
+
+ pVia->FirstInit = TRUE;
+ goto exit;
+free_i2c:
+ pVIADisplay->TVOutput = TVOUTPUT_NONE;
+ pVIADisplay->TVEncoder = VIA_NONETV;
+ pVIADisplay->TVI2CDev = NULL;
+ pVIADisplay->TVSave = NULL;
+ pVIADisplay->TVRestore = NULL;
+ pVIADisplay->TVDACSense = NULL;
+ pVIADisplay->TVModeValid = NULL;
+ pVIADisplay->TVModeI2C = NULL;
+ pVIADisplay->TVModeCrtc = NULL;
+ pVIADisplay->TVPower = NULL;
+ pVIADisplay->TVModes = NULL;
+ pVIADisplay->TVPrintRegs = NULL;
+ pVIADisplay->TVNumRegs = 0;
+
+ xf86DestroyI2CDevRec(pVIADisplay->TVI2CDev, TRUE);
+ pVIADisplay->TVI2CDev = NULL;
+exit:
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Exiting via_tv_init.\n"));
- return TRUE;
+ "Exiting %s.\n", __func__));
+ return;
}
diff --git a/src/via_ums.h b/src/via_ums.h
index 1d37581..e8761b0 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -201,6 +201,9 @@ typedef struct _VIADISPLAY {
/* Keeping track of the number of FP (Flat Panel) connectors. */
unsigned int numberFP;
+ /* Keeping track of the number of TV (Television) connectors. */
+ unsigned int numberTV;
+
CARD8 I2CDevices;
CARD8 mappedI2CBus;
@@ -1769,7 +1772,7 @@ void viaExtTMDSInit(ScrnInfoPtr pScrn);
#ifdef HAVE_DEBUG
void ViaTVPrintRegs(ScrnInfoPtr pScrn);
#endif
-Bool via_tv_init(ScrnInfoPtr pScrn);
+void via_tv_init(ScrnInfoPtr pScrn);
/* via_vt162x.c */
I2CDevPtr ViaVT162xDetect(ScrnInfoPtr pScrn, I2CBusPtr pBus, CARD8 Address);
More information about the openchrome-devel
mailing list