2 * Copyright 2010 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT license.
9 #include "accelerant.h"
19 GetI2CSignals(void* cookie
, int* _clock
, int* data
)
21 (void)cookie
; // avoid compiler warning for unused arg
23 uint32 reg
= INREG32(VIDEO_SERIAL_PARALLEL_PORT
);
24 *_clock
= (reg
& VSP_SCL0_IN
) ? 1 : 0;;
25 *data
= (reg
& VSP_SDA0_IN
) ? 1 : 0;
31 SetI2CSignals(void* cookie
, int _clock
, int data
)
33 (void)cookie
; // avoid compiler warning for unused arg
35 uint32 reg
= (INREG32(VIDEO_SERIAL_PARALLEL_PORT
)
36 & ~(VSP_SDA0_OUT
| VSP_SCL0_OUT
));
37 reg
= (reg
| (_clock
? VSP_SCL0_OUT
: 0) | (data
? VSP_SDA0_OUT
: 0));
38 OUTREG32(VIDEO_SERIAL_PARALLEL_PORT
, reg
);
45 TDFX_GetEdidInfo(edid1_info
& edidInfo
)
47 // Get the EDID info and return true if successful.
51 bus
.cookie
= (void*)NULL
;
52 bus
.set_signals
= &SetI2CSignals
;
53 bus
.get_signals
= &GetI2CSignals
;
54 ddc2_init_timing(&bus
);
56 uint32 reg
= INREG32(VIDEO_SERIAL_PARALLEL_PORT
);
57 OUTREG32(VIDEO_SERIAL_PARALLEL_PORT
, reg
| VSP_ENABLE_IIC0
);
59 bool bResult
= (ddc2_read_edid1(&bus
, &edidInfo
, NULL
, NULL
) == B_OK
);
61 OUTREG32(VIDEO_SERIAL_PARALLEL_PORT
, reg
);