Subject: GFX: Add a function that find the correct slave addrss for one SDVO port Use the info parsed in general definition block to find the correct slave address for one SDVO port --- src/i830_bios.c | 30 ++++++++++++++++++++++++++++++ src/i830_sdvo.h | 2 ++ 2 files changed, 32 insertions(+) Index: xf86-video-intel/src/i830_bios.c =================================================================== --- xf86-video-intel.orig/src/i830_bios.c 2009-05-26 12:58:47.000000000 +0800 +++ xf86-video-intel/src/i830_bios.c 2009-05-26 13:00:58.000000000 +0800 @@ -350,3 +350,33 @@ return 0; } +/** + * find_sdvo_slave - find the slave address according to the dvo port + * + * The mappings between the DVO port and slave address are parsed from + * the child device array contained in general definition block. + * + * Returns 0 on success, and the slave_addr is also returned + * nonzero on failure. + */ +int find_sdvo_slave(int output_device, uint8_t *slave_addr) +{ + uint8_t dvo_port = 0; + uint8_t temp_slave_addr; + struct sdvo_device_mapping *p_mapping; + + if (output_device == SDVOB) + dvo_port = DEVICE_PORT_DVOB; + else + dvo_port = DEVICE_PORT_DVOC; + p_mapping = &sdvo_mappings[dvo_port - 1]; + temp_slave_addr = p_mapping->slave_addr; + if (!temp_slave_addr) { + /* No slave address , return failure.*/ + return 1; + } + /* get the correct slave address */ + *slave_addr = temp_slave_addr; + + return 0; +} Index: xf86-video-intel/src/i830_sdvo.h =================================================================== --- xf86-video-intel.orig/src/i830_sdvo.h 2009-05-26 12:59:13.000000000 +0800 +++ xf86-video-intel/src/i830_sdvo.h 2009-05-26 13:02:44.000000000 +0800 @@ -27,3 +27,5 @@ Bool i830_sdvo_init(ScrnInfoPtr pScrn, int output_device); + +int find_sdvo_slave(int output_device, uint8_t *slave_addr);