25 static void tmds_register_write(
int index,
u8 data);
26 static int tmds_register_read(
int index);
27 static int tmds_register_read_bytes(
int index,
u8 *buff,
int buff_len);
28 static void __devinit dvi_get_panel_size_from_DDCv1(
31 static int viafb_dvi_query_EDID(
void);
33 static inline bool check_tmds_chip(
int device_id_subaddr,
int device_id)
35 return tmds_register_read(device_id_subaddr) ==
device_id;
44 if (viafb_dvi_query_EDID() == 1)
45 dvi_get_panel_size_from_DDCv1(tmds_chip, tmds_setting);
52 unsigned char sr2a = 0, sr1e = 0, sr3e = 0;
55 switch (
viaparinfo->chip_info->gfx_chip_name) {
93 tmds_register_write(0x08, 0x3b);
97 viaparinfo->chip_info->tmds_chip_info.tmds_chip_name);
99 viaparinfo->chip_info->tmds_chip_info.i2c_port);
104 tmds_register_write(0x08, 0x3b);
108 tmds_chip_info.tmds_chip_name);
111 tmds_chip_info.i2c_port);
125 switch (
viaparinfo->chip_info->gfx_chip_name) {
149 static void tmds_register_write(
int index,
u8 data)
152 viaparinfo->chip_info->tmds_chip_info.tmds_chip_slave_addr,
156 static int tmds_register_read(
int index)
161 (
u8)
viaparinfo->chip_info->tmds_chip_info.tmds_chip_slave_addr,
166 static int tmds_register_read_bytes(
int index,
u8 *buff,
int buff_len)
169 (
u8)
viaparinfo->chip_info->tmds_chip_info.tmds_chip_slave_addr,
170 (
u8) index, buff, buff_len);
176 u16 cxres,
u16 cyres,
int iga)
182 maxPixelClock =
viaparinfo->shared->tmds_setting_info.max_pixel_clock;
195 u8 RegSR1E = 0, RegSR3E = 0, RegCR6B = 0, RegCR91 = 0,
196 RegCR93 = 0, RegCR9B = 0,
data;
242 data = (
u8) tmds_register_read(0x09);
247 if (viafb_dvi_query_EDID())
266 static int viafb_dvi_query_EDID(
void)
273 restore =
viaparinfo->chip_info->tmds_chip_info.tmds_chip_slave_addr;
274 viaparinfo->chip_info->tmds_chip_info.tmds_chip_slave_addr = 0xA0;
276 data0 = (
u8) tmds_register_read(0x00);
277 data1 = (
u8) tmds_register_read(0x01);
278 if ((data0 == 0) && (data1 == 0xFF)) {
280 tmds_chip_info.tmds_chip_slave_addr = restore;
288 static void __devinit dvi_get_panel_size_from_DDCv1(
293 unsigned char EDID_DATA[18];
299 for (i = 0x25; i < 0x6D; i++) {
305 tmds_register_read_bytes(i, EDID_DATA, 10);
306 if (!(EDID_DATA[0] || EDID_DATA[1])) {
308 if (EDID_DATA[3] == 0xFD) {
336 static void dvi_patch_skew_dvp0(
void)
342 switch (
viaparinfo->chip_info->gfx_chip_name) {
345 if ((
viaparinfo->tmds_setting_info->h_active == 1600) &&
372 static void dvi_patch_skew_dvp_low(
void)
374 switch (
viaparinfo->chip_info->gfx_chip_name) {
407 switch (
viaparinfo->chip_info->tmds_chip_info.output_interface) {
411 dvi_patch_skew_dvp0();
413 tmds_register_write(0x88, 0x3b);
417 via_write_reg_mask(
VIACR, 0x91, 0x00, 0x20);
426 tmds_register_write(0x88, 0x3b);
430 via_write_reg_mask(
VIACR, 0x91, 0x00, 0x20);
442 tmds_chip_info.i2c_port,
444 tmds_chip_info.tmds_chip_slave_addr,
452 via_write_reg_mask(
VIACR,
CR97, 0x03, 0x03);
454 via_write_reg_mask(
VIACR, 0x91, 0x00, 0x20);
461 dvi_patch_skew_dvp_low();
462 via_write_reg_mask(
VIACR, 0x91, 0x00, 0x20);