Hello,
to support "hardwired" TV and LVDS devices, which doesn't apear on I2O
bus I suggest following changes.
The Option ConnectedDevice set the correesponding field in
VIABIOSInfo.Since my routine and the the "switch" for ActiveDevice
are quite similar, I also risked to replace this code by new
visually shorter code.
via.patch - contains combined changes done to .c and .h files.
via_driver.c.patch, via_bios.h.patch and via_bios.c.patch - patches in
separate files.
Pls. comment this changes.
Best Regards
Damian
--- via_driver.c2005-05-09 13:53:06.854268208 +0200
+++ ../via/via_driver.c 2005-05-09 14:09:47.974074864 +0200
@@ -152,7 +152,8 @@
OPTION_CAP0_DEINTERLACE,
OPTION_CAP1_DEINTERLACE,
OPTION_CAP0_FIELDSWAP,
-OPTION_DRIXINERAMA
+OPTION_DRIXINERAMA,
+OPTION_CONNECTED_DEVICE
} VIAOpts;
@@ -184,9 +185,31 @@
{OPTION_CAP1_DEINTERLACE, "Cap1Deinterlace",OPTV_ANYSTR, {0}, FALSE},
{OPTION_CAP0_FIELDSWAP, "Cap0FieldSwap",OPTV_BOOLEAN, {0}, FALSE},
{OPTION_DRIXINERAMA, "DRIXINERAMA",OPTV_BOOLEAN, {0}, FALSE},
+{OPTION_CONNECTED_DEVICE,"ConnectedDevice",OPTV_ANYSTR,{0},FALSE},
{-1,NULL, OPTV_NONE,{0}, FALSE}
};
+struct OutputDesc { char *Name;unsigned char Mask;};
+const static struct OutputDesc Values[]=
+{
+ {"NONE",0} ,
+ {"BIOS",0xFF} ,
+ {"CRT",VIA_DEVICE_CRT1} ,
+ {"CRT ONLY",VIA_DEVICE_CRT1} ,
+{"TV", VIA_DEVICE_TV},
+{"TV ONLY", VIA_DEVICE_TV},
+{"LCD",VIA_DEVICE_LCD},
+{"LCD ONLY",VIA_DEVICE_LCD} ,
+ {"DVI",VIA_DEVICE_DFP},
+ {"DVI ONLY",VIA_DEVICE_DFP},
+ {"DFP",VIA_DEVICE_DFP},
+ {"DFP ONLY",VIA_DEVICE_DFP},
+ {"CRT2",VIA_DEVICE_CRT2}
+};
+static char *DevMask2Str[5]=
+{
+ "CRT","LCD","TV","DFP","CRT2"
+};
static const char *vgaHWSymbols[] = {
"vgaHWGetHWRec",
@@ -346,7 +369,8 @@
XF86ModuleData viaModuleData = {&VIAVersRec, VIASetup, NULL};
-static pointer VIASetup(pointer module, pointer opts, int *errmaj, int *errmin)
+/* static */
+pointer VIASetup(pointer module, pointer opts, int *errmaj, int *errmin)
{
static Bool setupDone = FALSE;
@@ -673,8 +697,67 @@
ConfiguredMonitor = vbeDoEDID(pVbe, NULL);
}
}
+/***
+ Purpose: sets connectedDevice map according to user requirements
+ Input: string passed to driver via ConnectedDevice option
+ output: mask of connected devices
+
+ Remarks: the option BIOS sets the value according to register SR32
+ ~ char negates the value;
+
+/
+static unsigned char ParseDeviceMask(
+ ScrnInfoPtr pScrn,
+ VIAPtr pVia,
+ const char *opt_value,
+ const char *opt_name,
+ const int start)
+{
+VIABIOSInfoPtr pBIOSInfo;
+ unsigned char val=0;
+ pBIOSInfo = pVia->pBIOSInfo;
+ do {
+ char str[5],neg=0;
+ unsigned char pv=0;
+ int n;
+ int err = 1;
+ const char *p=strchr(opt_value,',');
+ if(!p)
+ p = opt_value + strlen(opt_value);
+ if(*opt_value == '~') {
+ ++opt_value;
+ neg=1;
+ }
+ if((n=p - opt_value) <= sizeof(str)) {
+ memcpy(str,opt_value,n*sizeof(str[0]));
+ str[n]='\0';
+ for(n=start;nscrnIndex, X_CONFIG,
+ "Option %s, value %s is unknown in this context.\n",
+ opt_name, opt_value);
+
+ }
+ opt_value = p+ ((*p) ? 1:0);
+ } while(*opt_value);
+ return val;
+}
+/*/
static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags)
{
EntityInfoPtr pEnt;
@@ -984,53 +1067,22 @@
/* ActiveDevice Option for device selection */
pBIOSInfo->ActiveDevice = 0x00;
if ((s = xf86GetOptValString(VIAOptions, OPTION_ACTIVEDEVICE))) {
-if (!xf86NameCmp(s, "CRT,TV") || !xf86NameCmp(s, "TV,CRT")) {
-pBIOSInfo->ActiveDevice = VIA_DEVICE_CRT1 | VIA_DEVICE_TV;
-xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is CRT and
TV.\n");
-}
-else if(!xf86NameCmp(s, "CRT,LCD") || !xf86NameCmp(s, "LCD,CRT")) {
-pBIOSInfo->ActiveDevice = VIA_DEVICE_CRT1 | VIA_DEVICE_LCD;
-xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device is CRT and
LCD.\n");
-}
-else if(!xf86NameCmp(s, "CRT,DFP") || !xf86NameCmp(s, "DFP,CRT")
-|| !xf86NameCmp(s, "CRT,DVI") || !xf86NameCmp(s, "DVI,CRT")) {
-pBIOSInfo->ActiveDevice = VIA_DEVICE_CRT1 | VIA_DEVICE_DFP;
-xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Active Device