[Openchrome-devel] xf86-video-openchrome: src/via_lvds.c

2017-02-15 Thread Kevin Brace
 src/via_lvds.c |  145 +
 1 file changed, 145 insertions(+)

New commits:
commit 1f7898969a38f3e350871168338deb1dfbb1cc18
Author: Kevin Brace 
Date:   Wed Feb 15 00:12:12 2017 -0800

Permanent fix for HP 2133 PCIe WLAN not working

Using strapping pins for Chrome IGP help figure out whether or not to
activate DVP0. Tested the fix with 3 different VN896 chipset based
laptops, but all of these have a 12-bit FP interface. The fix is untested
with a 24-bit FP interface. This fix also helps to restore the FP
correctly when coming out of standby in HP 2133 Mini-Note.

Signed-off-by: Kevin Brace 

diff --git a/src/via_lvds.c b/src/via_lvds.c
index 18dbf3e..0605cce 100644
--- a/src/via_lvds.c
+++ b/src/via_lvds.c
@@ -353,6 +353,143 @@ viaLVDS2SetOutputFormat(ScrnInfoPtr pScrn, CARD8 
outputFormat)
 "Exiting viaLVDS2SetOutputFormat.\n"));
 }
 
+/*
+ * Sets PCIe based 2 chip chipset's pin multiplexed DVP0 I/O pad state.
+ */
+static void
+viaDVP0PCIeSetIOPadSetting(ScrnInfoPtr pScrn, CARD8 ioPadState)
+{
+vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Entered viaDVP0PCIeSetIOPadSetting.\n"));
+
+/* Set pin multiplexed DVP1 I/O pad state. */
+/* 3C5.2A[3:2] - DVP0 I/O Pad Control */
+ViaSeqMask(hwp, 0x2A, ioPadState << 2, 0x0C);
+xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"DVP0 I/O Pad State: %d\n",
+(ioPadState & 0x03));
+
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Exiting viaDVP0PCIeSetIOPadSetting.\n"));
+}
+
+/*
+ * Sets PCIe based 2 chip chipset's pin multiplexed DVP1 I/O pad state.
+ */
+static void
+viaDVP1PCIeSetIOPadSetting(ScrnInfoPtr pScrn, CARD8 ioPadState)
+{
+vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Entered viaDVP1PCIeSetIOPadSetting.\n"));
+
+/* Set pin multiplexed DVP0 I/O pad state. */
+/* 3C5.2A[1:0] - DVP1 I/O Pad Control */
+ViaSeqMask(hwp, 0x2A, ioPadState, 0x03);
+xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"DVP1 I/O Pad State: %d\n",
+(ioPadState & 0x03));
+
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Exiting viaDVP1PCIeSetIOPadSetting.\n"));
+}
+
+static void
+viaFPIOPadSetting(ScrnInfoPtr pScrn, Bool ioPadOn)
+{
+vgaHWPtr hwp = VGAHWPTR(pScrn);
+VIAPtr pVia = VIAPTR(pScrn);
+CARD8 sr12, sr13, sr5a;
+
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Entered viaFPIOPadSetting.\n"));
+
+if ((pVia->Chipset == VIA_CX700)
+|| (pVia->Chipset == VIA_VX800)
+|| (pVia->Chipset == VIA_VX855)
+|| (pVia->Chipset == VIA_VX900)) {
+
+sr5a = hwp->readSeq(hwp, 0x5A);
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"SR5A: 0x%02X\n", sr5a));
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Setting 3C5.5A[0] to 0.\n"));
+ViaSeqMask(hwp, 0x5A, sr5a & 0xFE, 0x01);
+}
+
+sr12 = hwp->readSeq(hwp, 0x12);
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"SR12: 0x%02X\n", sr12));
+sr13 = hwp->readSeq(hwp, 0x13);
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"SR13: 0x%02X\n", sr13));
+
+switch (pVia->Chipset) {
+case VIA_CLE266:
+break;
+case VIA_KM400:
+case VIA_K8M800:
+case VIA_PM800:
+case VIA_P4M800PRO:
+break;
+case VIA_P4M890:
+case VIA_K8M890:
+case VIA_P4M900:
+/* The tricky thing about VIA Technologies PCI Express based
+ * north bridge / south bridge 2 chip chipset is that
+ * it pin multiplexes DVP0 / DVP1 with north bridge's PCI
+ * Express x16 link. In particular, HP 2133 Mini-Note's WLAN
+ * is connected to north bridge's PCI Express Lane 0, but the
+ * Lane 0 is also pin multiplexed with DVP0. What this means is
+ * turning on DVP0 without probing the relevant strapping pin
+ * to determine the connected panel interface type will lead to
+ * the PCIe based WLAN to getting disabled by OpenChrome DDX
+ * when X.Org Server starts.
+ * The current remedy for this will be to turn on DVP0
+ * only when an 18-bit / 24-bit interface flat panel is 
+ * connected. */
+/* 3C5.12[4] - DVP0D4 pin strapping
+ * 0: Use DVP1 only for a flat panel.
+ * 1: Use DVP0 and DVP1 for a flat panel */
+if (sr12 & 0x10) {
+/* Since an 18-bit / 24-bit flat panel is being used, actively
+ * control DVP0. */
+viaDVP0PCIeSetIOPadSetting(pScrn, ioPadOn ? 0x03 : 0x00);
+} else {
+/* Keep DVP0 powered down. Otherwise, it will 

[Openchrome-devel] xf86-video-openchrome: src/via_lvds.c

2016-04-15 Thread Kevin Brace
 src/via_lvds.c |   15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit e311f712e619f1098dddfbc854bf4fabd3b16937
Author: Kevin Brace 
Date:   Fri Apr 15 00:17:47 2016 -0700

Debug messages quality improvement within ViaLCDPower

Improved the quality of debug messages within ViaLCDPower function
inside via_lvds.c.

Signed-off-by: Kevin Brace 

diff --git a/src/via_lvds.c b/src/via_lvds.c
index 4935fc6..bd41e14 100644
--- a/src/via_lvds.c
+++ b/src/via_lvds.c
@@ -339,12 +339,8 @@ ViaLCDPower(xf86OutputPtr output, Bool On)
 VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo;
 int i;
 
-#ifdef HAVE_DEBUG
-if (On)
-xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaLCDPower: On.\n");
-else
-xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaLCDPower: Off.\n");
-#endif
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Entered ViaLCDPower.\n"));
 
 /* Enable LCD */
 if (On)
@@ -375,6 +371,13 @@ ViaLCDPower(xf86OutputPtr output, Bool On)
 else
 ViaLCDPowerSequence(hwp, powerOff[i]);
 usleep(1);
+
+xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Integrated LVDS Flat Panel Power: %s\n",
+On ? "On" : "Off");
+
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Exiting ViaLCDPower.\n"));
 }
 
 static void
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


Re: [Openchrome-devel] xf86-video-openchrome: src/via_lvds.c

2016-03-31 Thread Benno Schulenberg

Hi Kevin,

On Thu, Mar 31, 2016, at 07:55, Kevin Brace wrote:
>  src/via_lvds.c |8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> New commits:
> commit b77de4f3c9e43187aff9c1817b24c8a5fba2f883
> Author: Kevin Brace 
> Date:   Wed Mar 30 22:54:25 2016 -0700
> 
> Modified debug messages within via_lvds_get_modes
> 
> Modified debug messages within via_lvds_get_modes function inside 
> via_lvds.c.

It looks much better when you don't repeat what is in the subject.
The subject line /is/ the entire commit message, when it fits in
one line.  The "body" is used only when the commit needs some
explanation, some rationale, some background.

Saying "inside via_lvds.c" is superfluous; that is what 'git log --stat'
is for.  Personally I would have commited this change with the message
"Modified some debug messages".  When looking through 'git log', that
is enough information: it means one can skip it because there are no
functional changes.

I haven't yet tested latest git.  Will do that this weekend.

Benno

-- 
http://www.fastmail.com - Send your email first class

___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_lvds.c

2016-03-30 Thread Kevin Brace
 src/via_lvds.c |   48 
 1 file changed, 24 insertions(+), 24 deletions(-)

New commits:
commit 3efd244480f5d05a01432a94e5c754f1f83247bc
Author: Kevin Brace 
Date:   Tue Mar 29 23:00:17 2016 -0700

Renaming variables within via_lvds_get_modes

Renamed several variable names within via_lvds_get_modes function
inside via_lvds.c.

Signed-off-by: Kevin Brace 

diff --git a/src/via_lvds.c b/src/via_lvds.c
index 4aa2eac..cf189cc 100644
--- a/src/via_lvds.c
+++ b/src/via_lvds.c
@@ -914,9 +914,9 @@ via_lvds_detect(xf86OutputPtr output)
 static DisplayModePtr
 via_lvds_get_modes(xf86OutputPtr output)
 {
-ViaPanelInfoPtr Panel = output->driver_private;
+ViaPanelInfoPtr pPanel = output->driver_private;
 ScrnInfoPtr pScrn = output->scrn;
-DisplayModePtr p = NULL;
+DisplayModePtr pDisplay_Mode = NULL;
 
 if (output->status == XF86OutputStatusConnected) {
 if (!output->MonInfo) {
@@ -924,32 +924,32 @@ via_lvds_get_modes(xf86OutputPtr output)
  * Generates a display mode for the native panel resolution,
  * using CVT.
  */
-if (Panel->NativeWidth && Panel->NativeHeight) {
+if (pPanel->NativeWidth && pPanel->NativeHeight) {
 VIAPtr pVia = VIAPTR(pScrn);
 
 if (pVia->IsOLPCXO15) {
-p = xf86DuplicateMode();
+pDisplay_Mode = xf86DuplicateMode();
 } else {
-p = xf86CVTMode(Panel->NativeWidth, Panel->NativeHeight,
+pDisplay_Mode = xf86CVTMode(pPanel->NativeWidth, 
pPanel->NativeHeight,
 60.0f, FALSE, FALSE);
 }
 
-if (p) {
-p->CrtcHDisplay = p->HDisplay;
-p->CrtcHSyncStart = p->HSyncStart;
-p->CrtcHSyncEnd = p->HSyncEnd;
-p->CrtcHTotal = p->HTotal;
-p->CrtcHSkew = p->HSkew;
-p->CrtcVDisplay = p->VDisplay;
-p->CrtcVSyncStart = p->VSyncStart;
-p->CrtcVSyncEnd = p->VSyncEnd;
-p->CrtcVTotal = p->VTotal;
-
-p->CrtcVBlankStart = min(p->CrtcVSyncStart, 
p->CrtcVDisplay);
-p->CrtcVBlankEnd = max(p->CrtcVSyncEnd, p->CrtcVTotal);
-p->CrtcHBlankStart = min(p->CrtcHSyncStart, 
p->CrtcHDisplay);
-p->CrtcHBlankEnd = max(p->CrtcHSyncEnd, p->CrtcHTotal);
-p->type = M_T_DRIVER | M_T_PREFERRED;
+if (pDisplay_Mode) {
+pDisplay_Mode->CrtcHDisplay = pDisplay_Mode->HDisplay;
+pDisplay_Mode->CrtcHSyncStart = pDisplay_Mode->HSyncStart;
+pDisplay_Mode->CrtcHSyncEnd = pDisplay_Mode->HSyncEnd;
+pDisplay_Mode->CrtcHTotal = pDisplay_Mode->HTotal;
+pDisplay_Mode->CrtcHSkew = pDisplay_Mode->HSkew;
+pDisplay_Mode->CrtcVDisplay = pDisplay_Mode->VDisplay;
+pDisplay_Mode->CrtcVSyncStart = pDisplay_Mode->VSyncStart;
+pDisplay_Mode->CrtcVSyncEnd = pDisplay_Mode->VSyncEnd;
+pDisplay_Mode->CrtcVTotal = pDisplay_Mode->VTotal;
+
+pDisplay_Mode->CrtcVBlankStart = 
min(pDisplay_Mode->CrtcVSyncStart, pDisplay_Mode->CrtcVDisplay);
+pDisplay_Mode->CrtcVBlankEnd = 
max(pDisplay_Mode->CrtcVSyncEnd, pDisplay_Mode->CrtcVTotal);
+pDisplay_Mode->CrtcHBlankStart = 
min(pDisplay_Mode->CrtcHSyncStart, pDisplay_Mode->CrtcHDisplay);
+pDisplay_Mode->CrtcHBlankEnd = 
max(pDisplay_Mode->CrtcHSyncEnd, pDisplay_Mode->CrtcHTotal);
+pDisplay_Mode->type = M_T_DRIVER | M_T_PREFERRED;
 } else {
 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 "Out of memory. Size: %zu bytes\n", 
sizeof(DisplayModeRec));
@@ -957,13 +957,13 @@ via_lvds_get_modes(xf86OutputPtr output)
 } else {
 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 "Invalid panel dimension (%dx%d)\n",
-Panel->NativeWidth, Panel->NativeHeight);
+pPanel->NativeWidth, pPanel->NativeHeight);
 }
 } else {
-p = xf86OutputGetEDIDModes(output);
+pDisplay_Mode = xf86OutputGetEDIDModes(output);
 }
 }
-return p;
+return pDisplay_Mode;
 }
 
 static void
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_lvds.c

2016-03-29 Thread Kevin Brace
 src/via_lvds.c |   51 +++
 1 file changed, 43 insertions(+), 8 deletions(-)

New commits:
commit aba5302d9017e3ed993909cafdd1ff5b7b39779d
Author: Kevin Brace 
Date:   Tue Mar 29 05:03:28 2016 -0700

Checking the availability of a flat panel before starting the detection

One method VIA Technologies appears to be using in order to let the
device driver know the availability a flat panel is through CRT
Controller Extended Register - Scratch Pad Register 2 (3X5.3B). While
this method is less than perfect, it appears to be the only method
available that can support all IGPs. Use of this "hint" is necessary
for correctly detecting flat panels that lack I2C bus support.

Signed-off-by: Kevin Brace 

diff --git a/src/via_lvds.c b/src/via_lvds.c
index c057cf9..dfe2c77 100644
--- a/src/via_lvds.c
+++ b/src/via_lvds.c
@@ -839,6 +839,8 @@ via_lvds_detect(xf86OutputPtr output)
 ScrnInfoPtr pScrn = output->scrn;
 VIAPtr pVia = VIAPTR(pScrn);
 vgaHWPtr hwp = VGAHWPTR(pScrn);
+CARD8 cr3b = 0x00;
+CARD8 cr3b_mask = 0x00;
 
 DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 "Entered via_lvds_detect.\n"));
@@ -876,17 +878,32 @@ via_lvds_detect(xf86OutputPtr output)
 status = XF86OutputStatusConnected;
 }
 } else {
-if (!panel->NativeWidth || !panel->NativeHeight)
+/* Apparently this is the way VIA Technologies passes */
+/* the presence of a flat panel to the device driver */
+/* via BIOS setup. */
+if (pVia->Chipset == VIA_CLE266) {
+cr3b_mask = 0x08;
+} else {
+cr3b_mask = 0x02;
+}
+
+cr3b = hwp->readCrtc(hwp, 0x3B) & cr3b_mask;
+
+if (cr3b) {
 ViaPanelGetNativeModeFromScratchPad(output);
 
-if (panel->NativeWidth && panel->NativeHeight)
-status = XF86OutputStatusConnected;
+if (panel->NativeWidth && panel->NativeHeight) {
+status = XF86OutputStatusConnected;
+}
+}
 }
 
-DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
-"Detected Flat Panel Screen Resolution: "
-"%dx%d\n",
-panel->NativeWidth, panel->NativeHeight));
+if (status == XF86OutputStatusConnected) {
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+"Detected Flat Panel Screen Resolution: "
+"%dx%d\n",
+panel->NativeWidth, panel->NativeHeight));
+}
 } else {
 status = XF86OutputStatusConnected;
 }
@@ -1015,13 +1032,31 @@ via_lvds_init(ScrnInfoPtr pScrn)
 ViaPanelInfoPtr Panel = (ViaPanelInfoPtr) 
xnfcalloc(sizeof(ViaPanelInfoRec), 1);
 OptionInfoPtr  Options = xnfalloc(sizeof(ViaPanelOptions));
 MessageType from = X_DEFAULT;
+const char *s = NULL;
 VIAPtr pVia = VIAPTR(pScrn);
 xf86OutputPtr output = NULL;
-const char *s = NULL;
+vgaHWPtr hwp = VGAHWPTR(pScrn);
+CARD8 cr3b = 0x00;
+CARD8 cr3b_mask = 0x00;
 
 if (!Panel)
 return;
 
+/* Apparently this is the way VIA Technologies passes */
+/* the presence of a flat panel to the device driver */
+/* via BIOS setup. */
+if (pVia->Chipset == VIA_CLE266) {
+cr3b_mask = 0x08;
+} else {
+cr3b_mask = 0x02;
+}
+
+cr3b = hwp->readCrtc(hwp, 0x3B) & cr3b_mask;
+
+if (!cr3b) {
+return;
+}
+
 memcpy(Options, ViaPanelOptions, sizeof(ViaPanelOptions));
 xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, Options);
 
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_lvds.c

2016-03-29 Thread Kevin Brace
 src/via_lvds.c |   25 ++---
 1 file changed, 22 insertions(+), 3 deletions(-)

New commits:
commit a60b53eb99a3c78ff10ba0a6ea8c5eb439b2879d
Author: Kevin Brace 
Date:   Tue Mar 29 04:01:18 2016 -0700

Modified debug messages within via_lvds_detect

Modified debug messages within via_lvds_detect function inside via_lvds.c.

Signed-off-by: Kevin Brace 

diff --git a/src/via_lvds.c b/src/via_lvds.c
index 79e0667..c057cf9 100644
--- a/src/via_lvds.c
+++ b/src/via_lvds.c
@@ -840,11 +840,22 @@ via_lvds_detect(xf86OutputPtr output)
 VIAPtr pVia = VIAPTR(pScrn);
 vgaHWPtr hwp = VGAHWPTR(pScrn);
 
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Entered via_lvds_detect.\n"));
+
 /* Hardcode panel size for the XO */
 if (pVia->IsOLPCXO15) {
 panel->NativeWidth = 1200;
 panel->NativeHeight = 900;
 status = XF86OutputStatusConnected;
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+"Setting up OLPC XO-1.5 flat panel.\n"));
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+"Detected Flat Panel Screen Resolution: "
+"%dx%d\n",
+panel->NativeWidth, panel->NativeHeight));
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Exiting via_lvds_detect.\n"));
 return status;
 }
 
@@ -855,7 +866,10 @@ via_lvds_detect(xf86OutputPtr output)
 ret = ViaPanelGetSizeFromDDCv1(output, , );
 if (ret) {
 panel->NativeModeIndex = ViaPanelLookUpModeIndex(width, height);
-DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
"ViaPanelLookUpModeIndex, Width %d, Height %d, NativeModeIndex%d\n", width, 
height, panel->NativeModeIndex));
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+"ViaPanelLookUpModeIndex: Width %d, "
+"Height %d, NativeModeIndex%d\n", 
+width, height, panel->NativeModeIndex));
 if (panel->NativeModeIndex != VIA_PANEL_INVALID) {
 panel->NativeWidth = width;
 panel->NativeHeight = height;
@@ -868,12 +882,17 @@ via_lvds_detect(xf86OutputPtr output)
 if (panel->NativeWidth && panel->NativeHeight)
 status = XF86OutputStatusConnected;
 }
-DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NativeMode: %d %d\n",
-panel->NativeWidth, panel->NativeHeight));
+
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+"Detected Flat Panel Screen Resolution: "
+"%dx%d\n",
+panel->NativeWidth, panel->NativeHeight));
 } else {
 status = XF86OutputStatusConnected;
 }
 
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Exiting via_lvds_detect.\n"));
 return status;
 }
 
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_lvds.c

2016-03-29 Thread Kevin Brace
 src/via_lvds.c |   42 --
 1 file changed, 42 deletions(-)

New commits:
commit 6375a34fa3c8e413aafb6f161a19195571da1434
Author: Kevin Brace 
Date:   Tue Mar 29 03:26:40 2016 -0700

Removal of backdoor flat panel screen resolution detection algorithm

For those models that do not have their flat panel connected to an
I2C bus, flat panel detection code was referencing their CRTC
horizontal and vertical active data period (screen resolution)
registers to "guess" what their flat panel native screen resolution
is. While this poorly conceived algorithm works fine with certain
models, it causes problems with many other models. Thus, the use of
this detection algorithm is discontinued.

Signed-off-by: Kevin Brace 

diff --git a/src/via_lvds.c b/src/via_lvds.c
index 44ddb6b..79e0667 100644
--- a/src/via_lvds.c
+++ b/src/via_lvds.c
@@ -862,48 +862,6 @@ via_lvds_detect(xf86OutputPtr output)
 status = XF86OutputStatusConnected;
 }
 } else {
-CARD8 CR6A = hwp->readCrtc(hwp, 0x6A);
-CARD8 CR6B = hwp->readCrtc(hwp, 0x6B);
-CARD8 CR97 = hwp->readCrtc(hwp, 0x97);
-CARD8 CR99 = hwp->readCrtc(hwp, 0x99);
-
-/* First test CRTC2 is out of reset and if its enabled or
- * simultaneous mode is enabled. Also avoid the secondary
- * DFP source */
-if CR6A & 0xC0) == 0xC0) || (((CR6A & 0xC0) == 0x40) &&
-(CR6B & 0x08))) && (CR97 & 0x10) && (CR99 & 0x10)) {
-/* Use Vertical addreess register of IGA 2 */
-panel->NativeWidth  = (hwp->readCrtc(hwp, 0x51) |
-((hwp->readCrtc(hwp, 0x55) & 
0x70) << 4)) + 1;
-panel->NativeHeight = (hwp->readCrtc(hwp, 0x59) |
-((hwp->readCrtc(hwp, 0x5D) & 
0x38) << 5)) + 1;
-panel->NativeModeIndex = VIA_PANEL6X4;
-
-xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel Mode probed 
%dx%d from IGA 2\n",
-   panel->NativeWidth, panel->NativeHeight);
-
-status = XF86OutputStatusConnected;
-} else if (!(CR97 & 0x10) && !(CR99 & 0x10)) {
-CARD8 val;
-
-/* IGA1 Horizontal Overscan register */
-panel->NativeWidth = (hwp->readCrtc(hwp, 0x01) + 1) * 8;
-/* IGA1 default Vertical Overscan register is
- * incorrect on some devices so use VBlank start */
-panel->NativeHeight = (hwp->readCrtc(hwp, 0x15) + 1);
-val = hwp->readCrtc(hwp, 0x07);
-panel->NativeHeight |= ((val >> 3) & 0x1) << 8;
-panel->NativeHeight |= ((val >> 5) & 0x1) << 9;
-val = hwp->readCrtc(hwp, 0x35);
-panel->NativeHeight |= ((val >> 3) & 0x1) << 10;
-panel->NativeModeIndex = VIA_PANEL6X4;
-
-xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel Mode probed 
%dx%d from IGA 1\n",
-panel->NativeWidth,
-panel->NativeHeight);
-status = XF86OutputStatusConnected;
-}
-
 if (!panel->NativeWidth || !panel->NativeHeight)
 ViaPanelGetNativeModeFromScratchPad(output);
 
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_lvds.c

2016-03-08 Thread Kevin Brace
 src/via_lvds.c |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 8e95e6919263763f64e8e034a88132f71c5b6783
Author: Kevin Brace 
Date:   Tue Mar 8 23:26:01 2016 -0800

get_property callback of xf86OutputFuncsRec and RandR compilation error

get_property callback of xf86OutputFuncsRec structure is supported by
RandR version 1.3, not version 1.2.

Signed-off-by: Kevin Brace 

diff --git a/src/via_lvds.c b/src/via_lvds.c
index 09c5763..fd5d4b9 100644
--- a/src/via_lvds.c
+++ b/src/via_lvds.c
@@ -1476,6 +1476,8 @@ static const xf86OutputFuncsRec via_lvds_funcs = {
 .create_resources   = via_lvds_create_resources,
 #ifdef RANDR_12_INTERFACE
 .set_property   = via_lvds_set_property,
+#endif
+#ifdef RANDR_13_INTERFACE
 .get_property   = via_lvds_get_property,
 #endif
 .dpms   = via_lvds_dpms,
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_lvds.c

2016-03-06 Thread Kevin Brace
 src/via_lvds.c |   43 +++
 1 file changed, 35 insertions(+), 8 deletions(-)

New commits:
commit 7dd217502d91ffecfc857c4337893e826ffd00bd
Author: Kevin Brace 
Date:   Sun Mar 6 02:27:28 2016 -0800

Fixing the misdetection of NanoBook flat panel

It was observed in a VIA Technologies NanoBook based laptop computer
that the flat panel it contains is not connected to an I2C bus, hence
the supported screen resolution cannot be determined via an I2C bus.
Furthermore, the code was obtaining EDID information via I2C bus 2, but
it was not scrutinizing the interface type. Hence, if a VGA monitor
is connected to the computer, the code was determining the flat panel
screen resolution based on the EDID information obtained from the VGA
monitor via I2C bus 2. Due to all of these issues, the flat panel
screen color was going completely white, making the flat panel
completely useless. Thanks to this fix, the flat panel and a VGA
monitor can now be detected correctly.

Signed-off-by: Kevin Brace 

diff --git a/src/via_lvds.c b/src/via_lvds.c
index 073cef6..09c5763 100644
--- a/src/via_lvds.c
+++ b/src/via_lvds.c
@@ -485,28 +485,55 @@ ViaPanelGetSizeFromDDCv1(xf86OutputPtr output, int 
*width, int *height)
 VIAPtr pVia = VIAPTR(pScrn);
 xf86MonPtr pMon;
 
-DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAGetPanelSizeFromDDCv1\n"));
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Entered VIAGetPanelSizeFromDDCv1.\n"));
 
-if (!(pVia->I2CDevices & VIA_I2C_BUS2))
+if (!pVia->pI2CBus2) {
+xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+"I2C Bus 2 does not exist.\n");
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Exiting VIAGetPanelSizeFromDDCv1.\n"));
 return FALSE;
+}
 
-if (!xf86I2CProbeAddress(pVia->pI2CBus2, 0xA0))
+if (!xf86I2CProbeAddress(pVia->pI2CBus2, 0xA0)) {
+xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+"I2C device on I2C Bus 2 does not support EDID.\n");
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Exiting VIAGetPanelSizeFromDDCv1.\n"));
 return FALSE;
+}
 
-pMon = xf86DoEEDID(XF86_SCRN_ARG(pScrn), pVia->pI2CBus2, TRUE);
-if (!pMon)
+/* Probe I2C Bus 2 to see if a flat panel is connected. */
+xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+"Probing for a flat panel on I2C Bus 2.\n");
+pMon = xf86OutputGetEDID(output, pVia->pI2CBus2);
+if (pMon && DIGITAL(pMon->features.input_type)) {
+xf86OutputSetEDID(output, pMon);
+xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+"Detected a flat panel on I2C Bus 2.\n");
+} else {
+xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+"Did not detect a flat panel on I2C Bus 2.\n");
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Exiting VIAGetPanelSizeFromDDCv1.\n"));
 return FALSE;
 
-xf86OutputSetEDID(output, pMon);
+}
 
 if (!ViaPanelGetSizeFromEDID(pScrn, pMon, width, height)) {
 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-   "Unable to read PanelSize from EDID information\n");
+"Unable to obtain panel size from EDID information.\n");
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Exiting VIAGetPanelSizeFromDDCv1.\n"));
 return FALSE;
 }
 
 DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "VIAGetPanelSizeFromDDCv1: (%dx%d)\n", *width, *height));
+"VIAGetPanelSizeFromDDCv1: (%d X %d)\n",
+*width, *height));
+DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+"Exiting VIAGetPanelSizeFromDDCv1.\n"));
 return TRUE;
 }
 
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_lvds.c

2015-01-13 Thread James Simmons
 src/via_lvds.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit bcdd1e7ef9df5dc72b9dbb2977b39e65a45f8697
Author: James Simmons jsimm...@infradead.org
Date:   Tue Jan 13 13:43:03 2015 -0700

Last of the gcc warnings.

Signed-off-by: James Simmons jsimm...@infradead.org

diff --git a/src/via_lvds.c b/src/via_lvds.c
index 0dcc64a..4f17484 100644
--- a/src/via_lvds.c
+++ b/src/via_lvds.c
@@ -1468,7 +1468,8 @@ static const xf86OutputFuncsRec via_lvds_funcs = {
  * using name with format x.
  */
 static void
-ViaPanelGetNativeModeFromOption(ScrnInfoPtr pScrn, ViaPanelInfoPtr panel, char 
*name)
+ViaPanelGetNativeModeFromOption(ScrnInfoPtr pScrn, ViaPanelInfoPtr panel,
+   const char 
*name)
 {
 char aux[strlen(name) + 1];
 CARD8 length, index;
@@ -1500,7 +1501,7 @@ via_lvds_init(ScrnInfoPtr pScrn)
 VIAPtr pVia = VIAPTR(pScrn);
 xf86OutputPtr output = NULL;
 Bool ForcePanel = FALSE;
-char *s = NULL;
+const char *s = NULL;
 
 if (!Panel)
 return;
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] xf86-video-openchrome: src/via_lvds.c

2013-03-04 Thread Xavier Bachelot
 src/via_lvds.c |8 
 1 file changed, 8 insertions(+)

New commits:
commit 396a209cd1988ece56d556d756c062b0120991d1
Author: Xavier Bachelot xav...@bachelot.org
Date:   Mon Feb 18 22:45:11 2013 +0100

Hardcode panel size for the XO

diff --git a/src/via_lvds.c b/src/via_lvds.c
index d7d8225..e4e5cdf 100644
--- a/src/via_lvds.c
+++ b/src/via_lvds.c
@@ -1301,6 +1301,14 @@ via_lvds_detect(xf86OutputPtr output)
 VIAPtr pVia = VIAPTR(pScrn);
 vgaHWPtr hwp = VGAHWPTR(pScrn);
 
+/* Hardcode panel size for the XO */
+if (pVia-Id-String == OLPC XO 1.5) {
+panel-NativeWidth = 1200;
+panel-NativeHeight = 900;
+status = XF86OutputStatusConnected;
+return status;
+}
+
 if (!pVia-UseLegacyModeSwitch) {
 /* First try to get the mode from EDID. */
 if (!panel-NativeWidth || !panel-NativeHeight) {
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/openchrome-devel