From: root <root@OT.(none)> It is quite hard to understand all this magic numbers and bits so add some defined and comments to make it understandable. All the needed defines are taken from gplvsa_ii source code, which can be found at coreboot project.
Signed-off-by: Christian Gmeiner <christian.gmei...@gmail.com> --- src/lx_panel.c | 42 +++++++++++++++++++++++++++++++++++------- 1 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/lx_panel.c b/src/lx_panel.c index 6b5d4ed..576ad21 100644 --- a/src/lx_panel.c +++ b/src/lx_panel.c @@ -39,8 +39,24 @@ #include "xf86Modes.h" #include "geode.h" + +#define VRC_INDEX 0xAC1C // Index register +#define VRC_DATA 0xAC1E // Data register +#define VR_UNLOCK 0xFC53 // Virtual register unlock code + +#define VRC_VG 0x02 + +#define VG_CONFIG 0x00 // Main configuration register +#define VG_CFG_DSMASK 0x0700 // Active display mask bits +#define VG_CFG_DSCRT 0x0000 // Active display is CRT +#define VG_CFG_DSPAN 0x0100 // Active display is panel +#define VG_CFG_DSTV 0x0200 // Active display is TV +#define VG_CFG_DSSIM 0x0400 // Simultaneous CRT + +#define VG_FP_TYPE 0x02 // Flat panel type data + #define LX_READ_VG(reg) \ - (outw(0xAC1C,0xFC53), outw(0xAC1C,0x0200|(reg)), inw(0xAC1E)) + (outw(VRC_INDEX, VR_UNLOCK), outw(VRC_INDEX, (VRC_VG << 8) | (reg)), inw(VRC_DATA)) /* This is borrowed from xerver/hw/xfree86/modes */ @@ -79,12 +95,24 @@ DisplayModeRec lx_panel_modes[] = { DisplayModePtr LXGetLegacyPanelMode(ScrnInfoPtr pScrni) { - unsigned short reg = LX_READ_VG(0x00); - unsigned char ret = (reg >> 8) & 0x07; - - if ((ret == 1 || ret == 5)) { - - reg = LX_READ_VG(0x02); + /* read Active display configuration */ + unsigned short reg = LX_READ_VG(VG_CONFIG); + unsigned char ret = (reg & VG_CFG_DSMASK); + + if ((ret == VG_CFG_DSPAN || ret == (VG_CFG_DSPAN | VG_CFG_DSSIM))) { + + /* read panel resolution + * + * 0x00: 640x480 + * 0x01: 800x600 + * 0x02: 1004x768 + * 0x03: 1152x864 + * 0x04: 1280x768 + * 0x05: reserved + * 0x06: reserved + * 0x07: reserved + */ + reg = LX_READ_VG(VG_FP_TYPE); ret = (reg >> 3) & 0x07; /* FIXME: 7 is reserved in default. We use this value to support -- 1.7.2.5 _______________________________________________ Xorg-driver-geode mailing list Xorg-driver-geode@lists.x.org http://lists.x.org/mailman/listinfo/xorg-driver-geode