Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249226
b: refs/heads/master
c: 6622995
h: refs/heads/master
v: v3
  • Loading branch information
Kenji Toyama authored and Greg Kroah-Hartman committed Apr 26, 2011
1 parent 9707575 commit 3f56d42
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 54 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 661f659e110723d2a10d4d8a73091edcd53a45f6
refs/heads/master: 6622995b3212e3c5b39b2ef0dd4d2b02ed183aa5
138 changes: 97 additions & 41 deletions trunk/drivers/staging/xgifb/vb_ext.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <linux/version.h>
#include <asm/io.h>
#include <linux/io.h>
#include <linux/types.h>
#include "XGIfb.h"

Expand All @@ -26,7 +26,9 @@ static unsigned char XGINew_Is301B(struct vb_device_info *pVBInfo)
return 1;
}

static unsigned char XGINew_Sense(unsigned short tempbx, unsigned short tempcx, struct vb_device_info *pVBInfo)
static unsigned char XGINew_Sense(unsigned short tempbx,
unsigned short tempcx,
struct vb_device_info *pVBInfo)
{
unsigned short temp, i, tempch;

Expand All @@ -50,7 +52,9 @@ static unsigned char XGINew_Sense(unsigned short tempbx, unsigned short tempcx,
return 0;
}

static unsigned char XGINew_GetLCDDDCInfo(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
static unsigned char
XGINew_GetLCDDDCInfo(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
unsigned short temp;

Expand Down Expand Up @@ -154,7 +158,9 @@ static unsigned char XGINew_GetPanelID(struct vb_device_info *pVBInfo)
}
}

static unsigned char XGINew_BridgeIsEnable(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
static unsigned char
XGINew_BridgeIsEnable(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
unsigned short flag;

Expand All @@ -170,7 +176,9 @@ static unsigned char XGINew_BridgeIsEnable(struct xgi_hw_device_info *HwDeviceEx
return 0;
}

static unsigned char XGINew_SenseHiTV(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
static unsigned char
XGINew_SenseHiTV(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
unsigned short tempbx, tempcx, temp, i, tempch;

Expand Down Expand Up @@ -238,21 +246,29 @@ static unsigned char XGINew_SenseHiTV(struct xgi_hw_device_info *HwDeviceExtensi
}
}

void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
unsigned short tempax = 0, tempbx, tempcx, temp, P2reg0 = 0, SenseModeNo = 0,
OutputSelect = *pVBInfo->pOutputSelect, ModeIdIndex, i;
unsigned short tempax = 0, tempbx, tempcx, temp,
P2reg0 = 0, SenseModeNo = 0,
OutputSelect = *pVBInfo->pOutputSelect,
ModeIdIndex, i;
pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress;

if (pVBInfo->IF_DEF_LVDS == 1) {
tempax = xgifb_reg_get(pVBInfo->P3c4, 0x1A); /* ynlai 02/27/2002 */
/* ynlai 02/27/2002 */
tempax = xgifb_reg_get(pVBInfo->P3c4, 0x1A);
tempbx = xgifb_reg_get(pVBInfo->P3c4, 0x1B);
tempax = ((tempax & 0xFE) >> 1) | (tempbx << 8);
if (tempax == 0x00) { /* Get Panel id from DDC */
temp = XGINew_GetLCDDDCInfo(HwDeviceExtension, pVBInfo);
if (temp == 1) { /* LCD connect */
xgifb_reg_and_or(pVBInfo->P3d4, 0x39, 0xFF, 0x01); /* set CR39 bit0="1" */
xgifb_reg_and_or(pVBInfo->P3d4, 0x37, 0xEF, 0x00); /* clean CR37 bit4="0" */
/* set CR39 bit0="1" */
xgifb_reg_and_or(pVBInfo->P3d4,
0x39, 0xFF, 0x01);
/* clean CR37 bit4="0" */
xgifb_reg_and_or(pVBInfo->P3d4,
0x37, 0xEF, 0x00);
temp = LCDSense;
} else { /* LCD don't connect */
temp = 0;
Expand All @@ -273,25 +289,47 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_
xgifb_reg_and_or(pVBInfo->P3d4, 0x32, 0xA0, temp);
} else {
if (XGI_BridgeIsOn(pVBInfo)) {
P2reg0 = xgifb_reg_get(pVBInfo->Part2Port, 0x00);
if (!XGINew_BridgeIsEnable(HwDeviceExtension, pVBInfo)) {
P2reg0 = xgifb_reg_get(pVBInfo->Part2Port,
0x00);
if (!XGINew_BridgeIsEnable(HwDeviceExtension,
pVBInfo)) {
SenseModeNo = 0x2e;
/* xgifb_reg_set(pVBInfo->P3d4, 0x30, 0x41); */
/* XGISetModeNew(HwDeviceExtension, 0x2e); // ynlai InitMode */

temp = XGI_SearchModeID(SenseModeNo, &ModeIdIndex, pVBInfo);
XGI_GetVGAType(HwDeviceExtension, pVBInfo);
/* xgifb_reg_set(pVBInfo->P3d4, 0x30, 0x41);
* XGISetModeNew(HwDeviceExtension, 0x2e);
* // ynlai InitMode */

temp = XGI_SearchModeID(SenseModeNo,
&ModeIdIndex,
pVBInfo);
XGI_GetVGAType(HwDeviceExtension,
pVBInfo);
XGI_GetVBType(pVBInfo);
pVBInfo->SetFlag = 0x00;
pVBInfo->ModeType = ModeVGA;
pVBInfo->VBInfo = SetCRT2ToRAMDAC | LoadDACFlag | SetInSlaveMode;
XGI_GetLCDInfo(0x2e, ModeIdIndex, pVBInfo);
XGI_GetTVInfo(0x2e, ModeIdIndex, pVBInfo);
XGI_EnableBridge(HwDeviceExtension, pVBInfo);
XGI_SetCRT2Group301(SenseModeNo, HwDeviceExtension, pVBInfo);
XGI_SetCRT2ModeRegs(0x2e, HwDeviceExtension, pVBInfo);
/* XGI_DisableBridge( HwDeviceExtension, pVBInfo ) ; */
xgifb_reg_and_or(pVBInfo->P3c4, 0x01, 0xDF, 0x20); /* Display Off 0212 */
pVBInfo->VBInfo = SetCRT2ToRAMDAC |
LoadDACFlag |
SetInSlaveMode;
XGI_GetLCDInfo(0x2e,
ModeIdIndex,
pVBInfo);
XGI_GetTVInfo(0x2e,
ModeIdIndex,
pVBInfo);
XGI_EnableBridge(HwDeviceExtension,
pVBInfo);
XGI_SetCRT2Group301(SenseModeNo,
HwDeviceExtension,
pVBInfo);
XGI_SetCRT2ModeRegs(0x2e,
HwDeviceExtension,
pVBInfo);
/* XGI_DisableBridge(HwDeviceExtension,
* pVBInfo ) ; */
/* Display Off 0212 */
xgifb_reg_and_or(pVBInfo->P3c4,
0x01,
0xDF,
0x20);
for (i = 0; i < 20; i++)
XGI_LongWait(pVBInfo);
}
Expand All @@ -304,29 +342,38 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_

tempcx = 0x0E08;
if (XGINew_Sense(tempbx, tempcx, pVBInfo)) {
if (XGINew_Sense(tempbx, tempcx, pVBInfo))
if (XGINew_Sense(tempbx,
tempcx,
pVBInfo))
tempax |= Monitor2Sense;
}

if (pVBInfo->VBType & VB_XGI301C)
xgifb_reg_or(pVBInfo->Part4Port, 0x0d, 0x04);
xgifb_reg_or(pVBInfo->Part4Port,
0x0d,
0x04);

if (XGINew_SenseHiTV(HwDeviceExtension, pVBInfo)) { /* add by kuku for Multi-adapter sense HiTV */
/* add by kuku for Multi-adapter sense HiTV */
if (XGINew_SenseHiTV(HwDeviceExtension,
pVBInfo)) {
tempax |= HiTVSense;
if ((pVBInfo->VBType & VB_XGI301C))
tempax ^= (HiTVSense | YPbPrSense);
tempax ^= (HiTVSense |
YPbPrSense);
}

if (!(tempax & (HiTVSense | YPbPrSense))) { /* start */

/* start */
if (!(tempax & (HiTVSense | YPbPrSense))) {
tempbx = *pVBInfo->pYCSenseData;

if (!(XGINew_Is301B(pVBInfo)))
tempbx = *pVBInfo->pYCSenseData2;

tempcx = 0x0604;
if (XGINew_Sense(tempbx, tempcx, pVBInfo)) {
if (XGINew_Sense(tempbx, tempcx, pVBInfo))
if (XGINew_Sense(tempbx,
tempcx,
pVBInfo)) {
if (XGINew_Sense(tempbx,
tempcx,
pVBInfo))
tempax |= SVIDEOSense;
}

Expand All @@ -337,8 +384,12 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_
tempbx = *pVBInfo->pVideoSenseData2;

tempcx = 0x0804;
if (XGINew_Sense(tempbx, tempcx, pVBInfo)) {
if (XGINew_Sense(tempbx, tempcx, pVBInfo))
if (XGINew_Sense(tempbx,
tempcx,
pVBInfo)) {
if (XGINew_Sense(tempbx,
tempcx,
pVBInfo))
tempax |= AVIDEOSense;
}
} else {
Expand All @@ -349,7 +400,9 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_
tempbx = *pVBInfo->pVideoSenseData2;

tempcx = 0x0804;
if (XGINew_Sense(tempbx, tempcx, pVBInfo)) {
if (XGINew_Sense(tempbx,
tempcx,
pVBInfo)) {
if (XGINew_Sense(tempbx, tempcx, pVBInfo))
tempax |= AVIDEOSense;
}
Expand All @@ -370,15 +423,18 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_

if (!(P2reg0 & 0x20)) {
pVBInfo->VBInfo = DisableCRT2Display;
/* XGI_SetCRT2Group301(SenseModeNo, HwDeviceExtension, pVBInfo); */
/* XGI_SetCRT2Group301(SenseModeNo,
* HwDeviceExtension,
* pVBInfo); */
}
}
}
XGI_DisableBridge(HwDeviceExtension, pVBInfo); /* shampoo 0226 */

}

unsigned short XGINew_SenseLCD(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
unsigned short XGINew_SenseLCD(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
/* unsigned short SoftSetting ; */
unsigned short temp;
Expand Down
25 changes: 13 additions & 12 deletions trunk/drivers/staging/xgifb/vb_ext.h
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
#ifndef _VBEXT_
#define _VBEXT_
#ifndef _VBEXT_
#define _VBEXT_

struct DWORDREGS {
unsigned long Eax, Ebx, Ecx, Edx, Esi, Edi, Ebp;
unsigned long Eax, Ebx, Ecx, Edx, Esi, Edi, Ebp;
};

struct WORDREGS {
unsigned short ax, hi_ax, bx, hi_bx, cx, hi_cx, dx, hi_dx, si,
hi_si, di, hi_di, bp, hi_bp;
unsigned short ax, hi_ax, bx, hi_bx, cx, hi_cx, dx, hi_dx, si,
hi_si, di, hi_di, bp, hi_bp;
};

struct BYTEREGS {
unsigned char al, ah, hi_al, hi_ah, bl, bh, hi_bl, hi_bh, cl, ch,
hi_cl, hi_ch, dl, dh, hi_dl, hi_dh;
unsigned char al, ah, hi_al, hi_ah, bl, bh, hi_bl, hi_bh, cl, ch,
hi_cl, hi_ch, dl, dh, hi_dl, hi_dh;
};

typedef union _X86_REGS {
struct DWORDREGS e;
struct WORDREGS x;
struct BYTEREGS h;
typedef union _X86_REGS {
struct DWORDREGS e;
struct WORDREGS x;
struct BYTEREGS h;
} X86_REGS, *PX86_REGS;

extern void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo);
extern void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo);
extern unsigned short XGINew_SenseLCD(struct xgi_hw_device_info *,
struct vb_device_info *pVBInfo);

Expand Down

0 comments on commit 3f56d42

Please sign in to comment.