diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2019-06-24 12:08:32 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-06-24 14:37:40 +0200 |
commit | ae9a9796ec395e66ff0ed6d4484ea40ce85c0300 (patch) | |
tree | b19fd2865e45b5c31ac86046ab7635a3638058e1 /vgasrc/atiext.c | |
parent | 136e2612bd48ef06562625f15259fbacf7bcf66f (diff) | |
download | seabios-hppa-ae9a9796ec395e66ff0ed6d4484ea40ce85c0300.zip seabios-hppa-ae9a9796ec395e66ff0ed6d4484ea40ce85c0300.tar.gz seabios-hppa-ae9a9796ec395e66ff0ed6d4484ea40ce85c0300.tar.bz2 |
ati-vga: make i2c register and bits configurable
Prepare to support other ati cards. Also log access mode and whenever
we got a valid edid block.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'vgasrc/atiext.c')
-rw-r--r-- | vgasrc/atiext.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/vgasrc/atiext.c b/vgasrc/atiext.c index a24b980..901e82d 100644 --- a/vgasrc/atiext.c +++ b/vgasrc/atiext.c @@ -43,6 +43,11 @@ #define CRT_CRTC_ON 0x00008000 static u32 ati_io_addr VAR16 = 0; +static u32 ati_i2c_reg VAR16; +static u32 ati_i2c_bit_scl_out VAR16; +static u32 ati_i2c_bit_sda_out VAR16; +static u32 ati_i2c_bit_sda_in VAR16; + int is_ati_mode(struct vgamode_s *vmode_g) @@ -206,18 +211,18 @@ ati_i2c_set_scl_sda(int scl, int sda) u32 data = 0; if (!scl) - data |= (1 << 17); + data |= (1 << GET_GLOBAL(ati_i2c_bit_scl_out)); if (!sda) - data |= (1 << 16); - ati_write(GPIO_DVI_DDC, data); + data |= (1 << GET_GLOBAL(ati_i2c_bit_sda_out)); + ati_write(GET_GLOBAL(ati_i2c_reg), data); } static int ati_i2c_get_sda(void) { - u32 data = ati_read(GPIO_DVI_DDC); + u32 data = ati_read(GET_GLOBAL(ati_i2c_reg)); - return data & (1 << 8) ? 1 : 0; + return data & (1 << GET_GLOBAL(ati_i2c_bit_sda_in)) ? 1 : 0; } static void ati_i2c_start(void) @@ -275,7 +280,6 @@ static void ati_i2c_edid(void) u8 byte; int i; - dprintf(1, "ati: reading edid blob\n"); ati_i2c_start(); ati_i2c_send_byte(0x50 << 1 | 1); ati_i2c_ack(); @@ -287,6 +291,22 @@ static void ati_i2c_edid(void) ati_i2c_stop(); } +static void ati_i2c_edid_radeon(void) +{ + int valid; + + SET_VGA(ati_i2c_bit_scl_out, 17); + SET_VGA(ati_i2c_bit_sda_out, 16); + SET_VGA(ati_i2c_bit_sda_in, 8); + + dprintf(1, "ati: reading edid blob (radeon dvi) ... \n"); + SET_VGA(ati_i2c_reg, GPIO_DVI_DDC); + ati_i2c_edid(); + valid = (GET_GLOBAL(VBE_edid[0]) == 0x00 && + GET_GLOBAL(VBE_edid[1]) == 0xff); + dprintf(1, "ati: ... %s\n", valid ? "good" : "invalid"); +} + /**************************************************************** * init ****************************************************************/ @@ -351,7 +371,7 @@ ati_setup(void) u16 device = pci_config_readw(bdf, PCI_DEVICE_ID); switch (device) { case 0x5159: - ati_i2c_edid(); + ati_i2c_edid_radeon(); break; } |