2 Haiku S3 Virge driver adapted from the X.org Virge and Savage driver.
4 Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
6 Copyright 2007-2008 Haiku, Inc. All rights reserved.
7 Distributed under the terms of the MIT license.
10 Gerald Zajac 2007-2008
23 GetI2CSignals_Alt(void* cookie
, int* _clock
, int* data
)
25 uint32 index
= (uint32
)cookie
;
26 uint8 value
= ReadCrtcReg(index
);
28 *_clock
= (value
& 0x4) != 0;
29 *data
= (value
& 0x8) != 0;
35 SetI2CSignals_Alt(void* cookie
, int _clock
, int data
)
37 uint32 index
= (uint32
)cookie
;
45 WriteCrtcReg(index
, value
);
52 GetI2CSignals(void* cookie
, int* _clock
, int* data
)
54 (void)cookie
; // avoid compiler warning for unused arg
56 uint8 reg
= ReadReg8(DDC_REG
);
58 *_clock
= (reg
& 0x4) != 0;
59 *data
= (reg
& 0x8) != 0;
65 SetI2CSignals(void* cookie
, int _clock
, int data
)
67 (void)cookie
; // avoid compiler warning for unused arg
76 WriteReg8(DDC_REG
, reg
);
83 Virge_GetEdidInfo(edid1_info
& edidInfo
)
85 // Get the EDID info and return true if successful.
87 SharedInfo
& si
= *gInfo
.sharedInfo
;
91 if (si
.chipType
== S3_TRIO_3D_2X
) {
92 uint32 DDCPort
= 0xAA;
95 bus
.cookie
= (void*)DDCPort
;
96 bus
.set_signals
= &SetI2CSignals_Alt
;
97 bus
.get_signals
= &GetI2CSignals_Alt
;
98 ddc2_init_timing(&bus
);
100 uint8 tmp
= ReadCrtcReg(DDCPort
);
101 WriteCrtcReg(DDCPort
, tmp
| 0x13);
103 bResult
= (ddc2_read_edid1(&bus
, &edidInfo
, NULL
, NULL
) == B_OK
);
105 WriteCrtcReg(DDCPort
, tmp
);
108 bus
.cookie
= (void*)DDC_REG
;
109 bus
.set_signals
= &SetI2CSignals
;
110 bus
.get_signals
= &GetI2CSignals
;
111 ddc2_init_timing(&bus
);
113 uint8 tmp
= ReadReg8(DDC_REG
);
114 WriteReg8(DDC_REG
, tmp
| 0x13);
116 bResult
= (ddc2_read_edid1(&bus
, &edidInfo
, NULL
, NULL
) == B_OK
);
118 WriteReg8(DDC_REG
, tmp
);