[haiku-commits] haiku: hrev43437 - src/add-ons/accelerants/radeon_hd

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 8 Dec 2011 21:04:28 +0100 (CET)

hrev43437 adds 2 changesets to branch 'master'
old head: be63c91230f96d9d728c125ca0e910819b7c0f19
new head: 104c404c7edb585d7d4d6f88ad99d6525e6f1022

----------------------------------------------------------------------------

4540f5e: Create connector source file, move connector bus calls into it
  
  * this will help break apart some of the sources
  * display bus communications really don't belong with GPU operations
  * rename functions to better describe their actions

104c404: Move connector code into new connector source file.
  
  * clean up some comments
  * most of this movement is prep for AUX display transactions

                          [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

8 files changed, 833 insertions(+), 785 deletions(-)
src/add-ons/accelerants/radeon_hd/Jamfile        |    3 +-
src/add-ons/accelerants/radeon_hd/accelerant.cpp |   13 +-
src/add-ons/accelerants/radeon_hd/connector.cpp  |  753 ++++++++++++++++++
src/add-ons/accelerants/radeon_hd/connector.h    |   69 ++
src/add-ons/accelerants/radeon_hd/display.cpp    |  401 +---------
src/add-ons/accelerants/radeon_hd/display.h      |   48 --
src/add-ons/accelerants/radeon_hd/gpu.cpp        |  328 --------
src/add-ons/accelerants/radeon_hd/gpu.h          |    3 -

############################################################################

Commit:      4540f5e929448b82266a16ad5c2ea9d5f6ed5ed3
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4540f5e
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Thu Dec  8 19:42:47 2011 UTC

Create connector source file, move connector bus calls into it

* this will help break apart some of the sources
* display bus communications really don't belong with GPU operations
* rename functions to better describe their actions

----------------------------------------------------------------------------

diff --git a/src/add-ons/accelerants/radeon_hd/Jamfile 
b/src/add-ons/accelerants/radeon_hd/Jamfile
index f72e18b..91a46e6 100644
--- a/src/add-ons/accelerants/radeon_hd/Jamfile
+++ b/src/add-ons/accelerants/radeon_hd/Jamfile
@@ -12,8 +12,9 @@ UsePrivateHeaders [ FDirName graphics common ] ;
 Addon radeon_hd.accelerant :
        accelerant.cpp
        atom.cpp
-       create_display_modes.cpp
        bios.cpp
+       connector.cpp
+       create_display_modes.cpp
        display.cpp
        encoder.cpp
        engine.cpp
diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp 
b/src/add-ons/accelerants/radeon_hd/accelerant.cpp
index 94d50f3..f8df104 100644
--- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp
+++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp
@@ -12,6 +12,7 @@
 #include "accelerant.h"
 
 #include "bios.h"
+#include "connector.h"
 #include "display.h"
 #include "gpu.h"
 #include "pll.h"
@@ -252,7 +253,7 @@ radeon_init_accelerant(int device)
        radeon_init_bios(gInfo->rom);
 
        // detect GPIO pins
-       radeon_gpu_gpio_setup();
+       gpio_probe();
 
        // detect physical connectors
        status = detect_connectors();
diff --git a/src/add-ons/accelerants/radeon_hd/connector.cpp 
b/src/add-ons/accelerants/radeon_hd/connector.cpp
new file mode 100644
index 0000000..64f726a
--- /dev/null
+++ b/src/add-ons/accelerants/radeon_hd/connector.cpp
@@ -0,0 +1,357 @@
+/*
+ * Copyright 2006-2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *      Alexander von Gluck, kallisti5@xxxxxxxxxxx
+ */
+
+
+#include "accelerant_protos.h"
+#include "accelerant.h"
+#include "bios.h"
+#include "connector.h"
+#include "gpu.h"
+#include "utility.h"
+
+#include <Debug.h>
+
+
+#undef TRACE
+
+#define TRACE_CONNECTOR
+#ifdef TRACE_CONNECTOR
+#   define TRACE(x...) _sPrintf("radeon_hd: " x)
+#else
+#   define TRACE(x...) ;
+#endif
+
+#define ERROR(x...) _sPrintf("radeon_hd: " x)
+
+
+static void
+gpio_lock_i2c(void* cookie, bool lock)
+{
+       gpio_info *info = (gpio_info*)cookie;
+       radeon_shared_info &sinfo = *gInfo->shared_info;
+
+       uint32 buffer = 0;
+
+       if (lock == true) {
+               // hw_capable and > DCE3
+               if (info->hw_capable == true
+                       && sinfo.dceMajor >= 3) {
+                       // Switch GPIO pads to ddc mode
+                       buffer = Read32(OUT, info->mask_scl_reg);
+                       buffer &= ~(1 << 16);
+                       Write32(OUT, info->mask_scl_reg, buffer);
+               }
+
+               // Clear pins
+               buffer = Read32(OUT, info->a_scl_reg) & ~info->a_scl_mask;
+               Write32(OUT, info->a_scl_reg, buffer);
+               buffer = Read32(OUT, info->a_sda_reg) & ~info->a_sda_mask;
+               Write32(OUT, info->a_sda_reg, buffer);
+       }
+
+       // Set pins to input
+       buffer = Read32(OUT, info->en_scl_reg) & ~info->en_scl_mask;
+       Write32(OUT, info->en_scl_reg, buffer);
+       buffer = Read32(OUT, info->en_sda_reg) & ~info->en_sda_mask;
+       Write32(OUT, info->en_sda_reg, buffer);
+
+       // mask GPIO pins for software use
+       buffer = Read32(OUT, info->mask_scl_reg);
+       if (lock == true) {
+               buffer |= info->mask_scl_mask;
+       } else {
+               buffer &= ~info->mask_scl_mask;
+       }
+       Write32(OUT, info->mask_scl_reg, buffer);
+       Read32(OUT, info->mask_scl_reg);
+
+       buffer = Read32(OUT, info->mask_sda_reg);
+       if (lock == true) {
+               buffer |= info->mask_sda_mask;
+       } else {
+               buffer &= ~info->mask_sda_mask;
+       }
+       Write32(OUT, info->mask_sda_reg, buffer);
+       Read32(OUT, info->mask_sda_reg);
+}
+
+
+static status_t
+gpio_get_i2c_bit(void* cookie, int* _clock, int* _data)
+{
+       gpio_info *info = (gpio_info*)cookie;
+
+       uint32 scl = Read32(OUT, info->y_scl_reg)
+               & info->y_scl_mask;
+       uint32 sda = Read32(OUT, info->y_sda_reg)
+               & info->y_sda_mask;
+
+       *_clock = (scl != 0);
+       *_data = (sda != 0);
+
+       return B_OK;
+}
+
+
+static status_t
+gpio_set_i2c_bit(void* cookie, int clock, int data)
+{
+       gpio_info* info = (gpio_info*)cookie;
+
+       uint32 scl = Read32(OUT, info->en_scl_reg)
+               & ~info->en_scl_mask;
+       scl |= clock ? 0 : info->en_scl_mask;
+       Write32(OUT, info->en_scl_reg, scl);
+       Read32(OUT, info->en_scl_reg);
+
+       uint32 sda = Read32(OUT, info->en_sda_reg)
+               & ~info->en_sda_mask;
+       sda |= data ? 0 : info->en_sda_mask;
+       Write32(OUT, info->en_sda_reg, sda);
+       Read32(OUT, info->en_sda_reg);
+
+       return B_OK;
+}
+
+
+bool
+connector_read_edid(uint32 connector, edid1_info *edid)
+{
+       // ensure things are sane
+       uint32 gpioID = gConnector[connector]->gpioID;
+       if (gGPIOInfo[gpioID]->valid == false)
+               return false;
+
+       if (gConnector[connector]->type == VIDEO_CONNECTOR_LVDS) {
+               // we should call connector_read_edid_lvds at some point
+               ERROR("%s: LCD panel detected (LVDS), sending VESA EDID!\n",
+                       __func__);
+               memcpy(edid, &gInfo->shared_info->edid_info, sizeof(struct 
edid1_info));
+               return true;
+       }
+
+       i2c_bus bus;
+
+       ddc2_init_timing(&bus);
+       bus.cookie = (void*)gGPIOInfo[gpioID];
+       bus.set_signals = &gpio_set_i2c_bit;
+       bus.get_signals = &gpio_get_i2c_bit;
+
+       gpio_lock_i2c(bus.cookie, true);
+       status_t edid_result = ddc2_read_edid1(&bus, edid, NULL, NULL);
+       gpio_lock_i2c(bus.cookie, false);
+
+       if (edid_result != B_OK)
+               return false;
+
+       TRACE("%s: found edid monitor on connector #%" B_PRId32 "\n",
+               __func__, connector);
+
+       return true;
+}
+
+
+#if 0
+bool
+connector_read_edid_lvds(uint32 connector, edid1_info *edid)
+{
+       uint8 dceMajor;
+       uint8 dceMinor;
+       int index = GetIndexIntoMasterTable(DATA, LVDS_Info);
+       uint16 offset;
+
+       if (atom_parse_data_header(gAtomContexg, index, NULL,
+               &dceMajor, &dceMinor, &offset) == B_OK) {
+               lvdsInfo = (union lvds_info *)(gAtomContext->bios + offset);
+
+               display_timing timing;
+               // Pixel Clock
+               timing.pixel_clock
+                       = 
B_LENDIAN_TO_HOST_INT16(lvdsInfo->info.sLCDTiming.usPixClk) * 10;
+               // Horizontal
+               timing.h_display
+                       = 
B_LENDIAN_TO_HOST_INT16(lvdsInfo->info.sLCDTiming.usHActive);
+               timing.h_total = timing.h_display + B_LENDIAN_TO_HOST_INT16(
+                       lvdsInfo->info.sLCDTiming.usHBlanking_Time);
+               timing.h_sync_start = timing.h_display
+                       + 
B_LENDIAN_TO_HOST_INT16(lvdsInfo->info.sLCDTiming.usHSyncOffset);
+               timing.h_sync_end = timing.h_sync_start
+                       + 
B_LENDIAN_TO_HOST_INT16(lvdsInfo->info.sLCDTiming.usHSyncWidth);
+               // Vertical
+               timing.v_display
+                       = 
B_LENDIAN_TO_HOST_INT16(lvdsInfo->info.sLCDTiming.usVActive);
+               timing.v_total = timing.v_display + B_LENDIAN_TO_HOST_INT16(
+                       lvdsInfo->info.sLCDTiming.usVBlanking_Time);
+               timing.v_sync_start = timing.v_display
+                       + 
B_LENDIAN_TO_HOST_INT16(lvdsInfo->info.sLCDTiming.usVSyncOffset);
+               timing.v_sync_end = timing.v_sync_start
+                       + 
B_LENDIAN_TO_HOST_INT16(lvdsInfo->info.sLCDTiming.usVSyncWidth);
+
+               #if 0
+               // Who cares.
+               uint32 powerDelay
+                       = 
B_LENDIAN_TO_HOST_INT16(lvdsInfo->info.usOffDelayInMs);
+               uint32 lcdMisc = lvdsInfo->info.ucLVDS_Misc;
+               #endif
+
+               uint16 flags = B_LENDIAN_TO_HOST_INT16(
+                       lvdsInfo->info.sLCDTiming.susModeMiscInfo.usAccess);
+
+               if ((flags & ATOM_VSYNC_POLARITY) == 0)
+                       timing.flags |= B_POSITIVE_VSYNC;
+               if ((flags & ATOM_HSYNC_POLARITY) == 0)
+                       timing.flags |= B_POSITIVE_HSYNC;
+
+               // Extra flags
+               if ((flags & ATOM_INTERLACE) != 0)
+                       timing.flags |= B_TIMING_INTERLACED;
+
+               #if 0
+               // We don't use these timing flags at the moment
+               if ((flags & ATOM_COMPOSITESYNC) != 0)
+                       timing.flags |= MODE_FLAG_CSYNC;
+               if ((flags & ATOM_DOUBLE_CLOCK_MODE) != 0)
+                       timing.flags |= MODE_FLAG_DBLSCAN;
+               #endif
+
+               // TODO: generate a fake EDID with information above
+       }
+}
+#endif
+
+
+status_t
+connector_attach_gpio(uint32 id, uint8 hw_line)
+{
+       gConnector[id]->gpioID = 0;
+       for (uint32 i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) {
+               if (gGPIOInfo[i]->hw_line != hw_line)
+                       continue;
+               gConnector[id]->gpioID = i;
+               return B_OK;
+       }
+
+       TRACE("%s: couldn't find GPIO for connector %" B_PRIu32 "\n",
+               __func__, id);
+       return B_ERROR;
+}
+
+
+status_t
+gpio_probe()
+{
+       radeon_shared_info &info = *gInfo->shared_info;
+
+       int index = GetIndexIntoMasterTable(DATA, GPIO_I2C_Info);
+
+       uint8 tableMajor;
+       uint8 tableMinor;
+       uint16 tableOffset;
+       uint16 tableSize;
+
+       if (atom_parse_data_header(gAtomContext, index, &tableSize,
+               &tableMajor, &tableMinor, &tableOffset) != B_OK) {
+               ERROR("%s: could't read GPIO_I2C_Info table from AtomBIOS index 
%d!\n",
+                       __func__, index);
+               return B_ERROR;
+       }
+
+       struct _ATOM_GPIO_I2C_INFO *i2c_info
+               = (struct _ATOM_GPIO_I2C_INFO *)(gAtomContext->bios + 
tableOffset);
+
+       uint32 numIndices = (tableSize - sizeof(ATOM_COMMON_TABLE_HEADER))
+               / sizeof(ATOM_GPIO_I2C_ASSIGMENT);
+
+       if (numIndices > ATOM_MAX_SUPPORTED_DEVICE) {
+               ERROR("%s: ERROR: AtomBIOS contains more GPIO_Info items then I"
+                       "was prepared for! (seen: %" B_PRIu32 "; max: %" 
B_PRIu32 ")\n",
+                       __func__, numIndices, 
(uint32)ATOM_MAX_SUPPORTED_DEVICE);
+               return B_ERROR;
+       }
+
+       for (uint32 i = 0; i < numIndices; i++) {
+               ATOM_GPIO_I2C_ASSIGMENT *gpio = &i2c_info->asGPIO_Info[i];
+
+               if (info.dceMajor >= 3) {
+                       if (i == 4 && 
B_LENDIAN_TO_HOST_INT16(gpio->usClkMaskRegisterIndex)
+                               == 0x1fda && gpio->sucI2cId.ucAccess == 0x94) {
+                               gpio->sucI2cId.ucAccess = 0x14;
+                               TRACE("%s: BUG: GPIO override for DCE 3 
occured\n", __func__);
+                       }
+               }
+
+               if (info.dceMajor >= 4) {
+                       if (i == 7 && 
B_LENDIAN_TO_HOST_INT16(gpio->usClkMaskRegisterIndex)
+                               == 0x1936 && gpio->sucI2cId.ucAccess == 0) {
+                               gpio->sucI2cId.ucAccess = 0x97;
+                               gpio->ucDataMaskShift = 8;
+                               gpio->ucDataEnShift = 8;
+                               gpio->ucDataY_Shift = 8;
+                               gpio->ucDataA_Shift = 8;
+                               TRACE("%s: BUG: GPIO override for DCE 4 
occured\n", __func__);
+                       }
+               }
+
+               // populate gpio information
+               gGPIOInfo[i]->hw_line
+                       = gpio->sucI2cId.ucAccess;
+               gGPIOInfo[i]->hw_capable
+                       = (gpio->sucI2cId.sbfAccess.bfHW_Capable) ? true : 
false;
+
+               // GPIO mask (Allows software to control the GPIO pad)
+               // 0 = chip access; 1 = only software;
+               gGPIOInfo[i]->mask_scl_reg
+                       = B_LENDIAN_TO_HOST_INT16(gpio->usClkMaskRegisterIndex) 
* 4;
+               gGPIOInfo[i]->mask_sda_reg
+                       = 
B_LENDIAN_TO_HOST_INT16(gpio->usDataMaskRegisterIndex) * 4;
+               gGPIOInfo[i]->mask_scl_mask
+                       = (1 << gpio->ucClkMaskShift);
+               gGPIOInfo[i]->mask_sda_mask
+                       = (1 << gpio->ucDataMaskShift);
+
+               // GPIO output / write (A) enable
+               // 0 = GPIO input (Y); 1 = GPIO output (A);
+               gGPIOInfo[i]->en_scl_reg
+                       = B_LENDIAN_TO_HOST_INT16(gpio->usClkEnRegisterIndex) * 
4;
+               gGPIOInfo[i]->en_sda_reg
+                       = B_LENDIAN_TO_HOST_INT16(gpio->usDataEnRegisterIndex) 
* 4;
+               gGPIOInfo[i]->en_scl_mask
+                       = (1 << gpio->ucClkEnShift);
+               gGPIOInfo[i]->en_sda_mask
+                       = (1 << gpio->ucDataEnShift);
+
+               // GPIO output / write (A)
+               gGPIOInfo[i]->a_scl_reg
+                       = B_LENDIAN_TO_HOST_INT16(gpio->usClkA_RegisterIndex) * 
4;
+               gGPIOInfo[i]->a_sda_reg
+                       = B_LENDIAN_TO_HOST_INT16(gpio->usDataA_RegisterIndex) 
* 4;
+               gGPIOInfo[i]->a_scl_mask
+                       = (1 << gpio->ucClkA_Shift);
+               gGPIOInfo[i]->a_sda_mask
+                       = (1 << gpio->ucDataA_Shift);
+
+               // GPIO input / read (Y)
+               gGPIOInfo[i]->y_scl_reg
+                       = B_LENDIAN_TO_HOST_INT16(gpio->usClkY_RegisterIndex) * 
4;
+               gGPIOInfo[i]->y_sda_reg
+                       = B_LENDIAN_TO_HOST_INT16(gpio->usDataY_RegisterIndex) 
* 4;
+               gGPIOInfo[i]->y_scl_mask
+                       = (1 << gpio->ucClkY_Shift);
+               gGPIOInfo[i]->y_sda_mask
+                       = (1 << gpio->ucDataY_Shift);
+
+               // ensure data is valid
+               gGPIOInfo[i]->valid = (gGPIOInfo[i]->mask_scl_reg) ? true : 
false;
+
+               TRACE("%s: GPIO @ %" B_PRIu32 ", valid: %s, hw_line: 0x%" 
B_PRIX32 "\n",
+                       __func__, i, gGPIOInfo[i]->valid ? "true" : "false",
+                       gGPIOInfo[i]->hw_line);
+       }
+
+       return B_OK;
+}
diff --git a/src/add-ons/accelerants/radeon_hd/connector.h 
b/src/add-ons/accelerants/radeon_hd/connector.h
new file mode 100644
index 0000000..6f24ab8
--- /dev/null
+++ b/src/add-ons/accelerants/radeon_hd/connector.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2006-2011, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Alexander von Gluck, kallisti5@xxxxxxxxxxx
+ */
+#ifndef RADEON_HD_CONNECTOR_H
+#define RADEON_HD_CONNECTOR_H
+
+status_t gpio_probe();
+status_t connector_attach_gpio(uint32 id, uint8 hw_line);
+bool connector_read_edid(uint32 connector, edid1_info *edid);
+
+#endif
diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp 
b/src/add-ons/accelerants/radeon_hd/display.cpp
index 221cbb2..f1f0a37 100644
--- a/src/add-ons/accelerants/radeon_hd/display.cpp
+++ b/src/add-ons/accelerants/radeon_hd/display.cpp
@@ -15,6 +15,7 @@
 #include "accelerant_protos.h"
 #include "accelerant.h"
 #include "bios.h"
+#include "connector.h"
 #include "display.h"
 
 #include <stdlib.h>
@@ -322,7 +323,7 @@ detect_connectors_legacy()
                gConnector[connectorIndex]->encoder.isExternal
                        = encoder_is_external(encoderID);
 
-               radeon_gpu_i2c_attach(connectorIndex, ci.sucI2cId.ucAccess);
+               connector_attach_gpio(connectorIndex, ci.sucI2cId.ucAccess);
 
                pll_limit_probe(&gConnector[connectorIndex]->encoder.pll);
 
@@ -558,7 +559,7 @@ detect_connectors()
                                                                                
= (ATOM_I2C_ID_CONFIG_ACCESS *)
                                                                                
&i2c_record->sucI2cId;
                                                                        // 
attach i2c gpio information for connector
-                                                                       
radeon_gpu_i2c_attach(connectorIndex,
+                                                                       
connector_attach_gpio(connectorIndex,
                                                                                
i2c_config->ucAccess);
                                                                        break;
                                                                case 
ATOM_HPD_INT_RECORD_TYPE:
@@ -625,7 +626,7 @@ detect_displays()
                if (displayIndex >= MAX_DISPLAY)
                        continue;
 
-               if (radeon_gpu_read_edid(id, 
&gDisplay[displayIndex]->edid_info)) {
+               if (connector_read_edid(id, 
&gDisplay[displayIndex]->edid_info)) {
 
                        if (gConnector[id]->encoder.type == VIDEO_ENCODER_TVDAC
                                || gConnector[id]->encoder.type == 
VIDEO_ENCODER_DAC) {
diff --git a/src/add-ons/accelerants/radeon_hd/gpu.cpp 
b/src/add-ons/accelerants/radeon_hd/gpu.cpp
index 12e80aa..5fec816 100644
--- a/src/add-ons/accelerants/radeon_hd/gpu.cpp
+++ b/src/add-ons/accelerants/radeon_hd/gpu.cpp
@@ -523,331 +523,3 @@ radeon_gpu_irq_setup()
 
        return B_ERROR;
 }
-
-
-static void
-lock_i2c(void* cookie, bool lock)
-{
-       gpio_info *info = (gpio_info*)cookie;
-       radeon_shared_info &sinfo = *gInfo->shared_info;
-
-       uint32 buffer = 0;
-
-       if (lock == true) {
-               // hw_capable and > DCE3
-               if (info->hw_capable == true
-                       && sinfo.dceMajor >= 3) {
-                       // Switch GPIO pads to ddc mode
-                       buffer = Read32(OUT, info->mask_scl_reg);
-                       buffer &= ~(1 << 16);
-                       Write32(OUT, info->mask_scl_reg, buffer);
-               }
-
-               // Clear pins
-               buffer = Read32(OUT, info->a_scl_reg) & ~info->a_scl_mask;
-               Write32(OUT, info->a_scl_reg, buffer);
-               buffer = Read32(OUT, info->a_sda_reg) & ~info->a_sda_mask;
-               Write32(OUT, info->a_sda_reg, buffer);
-       }
-
-       // Set pins to input
-       buffer = Read32(OUT, info->en_scl_reg) & ~info->en_scl_mask;
-       Write32(OUT, info->en_scl_reg, buffer);
-       buffer = Read32(OUT, info->en_sda_reg) & ~info->en_sda_mask;
-       Write32(OUT, info->en_sda_reg, buffer);
-
-       // mask GPIO pins for software use
-       buffer = Read32(OUT, info->mask_scl_reg);
-       if (lock == true) {
-               buffer |= info->mask_scl_mask;
-       } else {
-               buffer &= ~info->mask_scl_mask;
-       }
-       Write32(OUT, info->mask_scl_reg, buffer);
-       Read32(OUT, info->mask_scl_reg);
-
-       buffer = Read32(OUT, info->mask_sda_reg);
-       if (lock == true) {
-               buffer |= info->mask_sda_mask;
-       } else {
-               buffer &= ~info->mask_sda_mask;
-       }
-       Write32(OUT, info->mask_sda_reg, buffer);
-       Read32(OUT, info->mask_sda_reg);
-}
-
-
-static status_t
-get_i2c_signals(void* cookie, int* _clock, int* _data)
-{
-       gpio_info *info = (gpio_info*)cookie;
-
-       uint32 scl = Read32(OUT, info->y_scl_reg)
-               & info->y_scl_mask;
-       uint32 sda = Read32(OUT, info->y_sda_reg)
-               & info->y_sda_mask;
-
-       *_clock = (scl != 0);
-       *_data = (sda != 0);
-
-       return B_OK;
-}
-
-
-static status_t
-set_i2c_signals(void* cookie, int clock, int data)
-{
-       gpio_info* info = (gpio_info*)cookie;
-
-       uint32 scl = Read32(OUT, info->en_scl_reg)
-               & ~info->en_scl_mask;
-       scl |= clock ? 0 : info->en_scl_mask;
-       Write32(OUT, info->en_scl_reg, scl);
-       Read32(OUT, info->en_scl_reg);
-
-       uint32 sda = Read32(OUT, info->en_sda_reg)
-               & ~info->en_sda_mask;
-       sda |= data ? 0 : info->en_sda_mask;
-       Write32(OUT, info->en_sda_reg, sda);
-       Read32(OUT, info->en_sda_reg);
-
-       return B_OK;
-}
-
-
-bool
-radeon_gpu_read_edid(uint32 connector, edid1_info *edid)
-{
-       // ensure things are sane
-       uint32 gpioID = gConnector[connector]->gpioID;
-       if (gGPIOInfo[gpioID]->valid == false)
-               return false;
-
-       if (gConnector[connector]->type == VIDEO_CONNECTOR_LVDS) {
-               // we should call radeon_gpu_read_edid_lvds at some point
-               ERROR("%s: LCD panel detected (LVDS), sending VESA EDID!\n",
-                       __func__);
-               memcpy(edid, &gInfo->shared_info->edid_info, sizeof(struct 
edid1_info));
-               return true;
-       }
-
-       i2c_bus bus;
-
-       ddc2_init_timing(&bus);
-       bus.cookie = (void*)gGPIOInfo[gpioID];
-       bus.set_signals = &set_i2c_signals;
-       bus.get_signals = &get_i2c_signals;
-
-       lock_i2c(bus.cookie, true);
-       status_t edid_result = ddc2_read_edid1(&bus, edid, NULL, NULL);
-       lock_i2c(bus.cookie, false);
-
-       if (edid_result != B_OK)
-               return false;
-
-       TRACE("%s: found edid monitor on connector #%" B_PRId32 "\n",
-               __func__, connector);
-
-       return true;
-}
-
-
-#if 0
-bool
-radeon_gpu_read_edid_lvds(uint32 connector, edid1_info *edid)
-{
-       uint8 dceMajor;
-       uint8 dceMinor;
-       int index = GetIndexIntoMasterTable(DATA, LVDS_Info);
-       uint16 offset;
-
-       if (atom_parse_data_header(gAtomContexg, index, NULL,
-               &dceMajor, &dceMinor, &offset) == B_OK) {
-               lvdsInfo = (union lvds_info *)(gAtomContext->bios + offset);
-
-               display_timing timing;
-               // Pixel Clock
-               timing.pixel_clock
-                       = 
B_LENDIAN_TO_HOST_INT16(lvdsInfo->info.sLCDTiming.usPixClk) * 10;
-               // Horizontal
-               timing.h_display
-                       = 
B_LENDIAN_TO_HOST_INT16(lvdsInfo->info.sLCDTiming.usHActive);
-               timing.h_total = timing.h_display + B_LENDIAN_TO_HOST_INT16(
-                       lvdsInfo->info.sLCDTiming.usHBlanking_Time);
-               timing.h_sync_start = timing.h_display
-                       + 
B_LENDIAN_TO_HOST_INT16(lvdsInfo->info.sLCDTiming.usHSyncOffset);
-               timing.h_sync_end = timing.h_sync_start
-                       + 
B_LENDIAN_TO_HOST_INT16(lvdsInfo->info.sLCDTiming.usHSyncWidth);
-               // Vertical
-               timing.v_display
-                       = 
B_LENDIAN_TO_HOST_INT16(lvdsInfo->info.sLCDTiming.usVActive);
-               timing.v_total = timing.v_display + B_LENDIAN_TO_HOST_INT16(
-                       lvdsInfo->info.sLCDTiming.usVBlanking_Time);
-               timing.v_sync_start = timing.v_display
-                       + 
B_LENDIAN_TO_HOST_INT16(lvdsInfo->info.sLCDTiming.usVSyncOffset);
-               timing.v_sync_end = timing.v_sync_start
-                       + 
B_LENDIAN_TO_HOST_INT16(lvdsInfo->info.sLCDTiming.usVSyncWidth);
-
-               #if 0
-               // Who cares.
-               uint32 powerDelay
-                       = 
B_LENDIAN_TO_HOST_INT16(lvdsInfo->info.usOffDelayInMs);
-               uint32 lcdMisc = lvdsInfo->info.ucLVDS_Misc;
-               #endif
-
-               uint16 flags = B_LENDIAN_TO_HOST_INT16(
-                       lvdsInfo->info.sLCDTiming.susModeMiscInfo.usAccess);
-
-               if ((flags & ATOM_VSYNC_POLARITY) == 0)
-                       timing.flags |= B_POSITIVE_VSYNC;
-               if ((flags & ATOM_HSYNC_POLARITY) == 0)
-                       timing.flags |= B_POSITIVE_HSYNC;
-
-               // Extra flags
-               if ((flags & ATOM_INTERLACE) != 0)
-                       timing.flags |= B_TIMING_INTERLACED;
-
-               #if 0
-               // We don't use these timing flags at the moment
-               if ((flags & ATOM_COMPOSITESYNC) != 0)
-                       timing.flags |= MODE_FLAG_CSYNC;
-               if ((flags & ATOM_DOUBLE_CLOCK_MODE) != 0)
-                       timing.flags |= MODE_FLAG_DBLSCAN;
-               #endif
-
-               // TODO: generate a fake EDID with information above
-       }
-}
-#endif
-
-
-status_t
-radeon_gpu_i2c_attach(uint32 id, uint8 hw_line)
-{
-       gConnector[id]->gpioID = 0;
-       for (uint32 i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) {
-               if (gGPIOInfo[i]->hw_line != hw_line)
-                       continue;
-               gConnector[id]->gpioID = i;
-               return B_OK;
-       }
-
-       TRACE("%s: couldn't find GPIO for connector %" B_PRIu32 "\n",
-               __func__, id);
-       return B_ERROR;
-}
-
-
-status_t
-radeon_gpu_gpio_setup()
-{
-       radeon_shared_info &info = *gInfo->shared_info;
-
-       int index = GetIndexIntoMasterTable(DATA, GPIO_I2C_Info);
-
-       uint8 tableMajor;
-       uint8 tableMinor;
-       uint16 tableOffset;
-       uint16 tableSize;
-
-       if (atom_parse_data_header(gAtomContext, index, &tableSize,
-               &tableMajor, &tableMinor, &tableOffset) != B_OK) {
-               ERROR("%s: could't read GPIO_I2C_Info table from AtomBIOS index 
%d!\n",
-                       __func__, index);
-               return B_ERROR;
-       }
-
-       struct _ATOM_GPIO_I2C_INFO *i2c_info
-               = (struct _ATOM_GPIO_I2C_INFO *)(gAtomContext->bios + 
tableOffset);
-
-       uint32 numIndices = (tableSize - sizeof(ATOM_COMMON_TABLE_HEADER))
-               / sizeof(ATOM_GPIO_I2C_ASSIGMENT);
-
-       if (numIndices > ATOM_MAX_SUPPORTED_DEVICE) {
-               ERROR("%s: ERROR: AtomBIOS contains more GPIO_Info items then I"
-                       "was prepared for! (seen: %" B_PRIu32 "; max: %" 
B_PRIu32 ")\n",
-                       __func__, numIndices, 
(uint32)ATOM_MAX_SUPPORTED_DEVICE);
-               return B_ERROR;
-       }
-
-       for (uint32 i = 0; i < numIndices; i++) {
-               ATOM_GPIO_I2C_ASSIGMENT *gpio = &i2c_info->asGPIO_Info[i];
-
-               if (info.dceMajor >= 3) {
-                       if (i == 4 && 
B_LENDIAN_TO_HOST_INT16(gpio->usClkMaskRegisterIndex)
-                               == 0x1fda && gpio->sucI2cId.ucAccess == 0x94) {
-                               gpio->sucI2cId.ucAccess = 0x14;
-                               TRACE("%s: BUG: GPIO override for DCE 3 
occured\n", __func__);
-                       }
-               }
-
-               if (info.dceMajor >= 4) {
-                       if (i == 7 && 
B_LENDIAN_TO_HOST_INT16(gpio->usClkMaskRegisterIndex)
-                               == 0x1936 && gpio->sucI2cId.ucAccess == 0) {
-                               gpio->sucI2cId.ucAccess = 0x97;
-                               gpio->ucDataMaskShift = 8;
-                               gpio->ucDataEnShift = 8;
-                               gpio->ucDataY_Shift = 8;
-                               gpio->ucDataA_Shift = 8;
-                               TRACE("%s: BUG: GPIO override for DCE 4 
occured\n", __func__);
-                       }
-               }
-
-               // populate gpio information
-               gGPIOInfo[i]->hw_line
-                       = gpio->sucI2cId.ucAccess;
-               gGPIOInfo[i]->hw_capable
-                       = (gpio->sucI2cId.sbfAccess.bfHW_Capable) ? true : 
false;
-
-               // GPIO mask (Allows software to control the GPIO pad)
-               // 0 = chip access; 1 = only software;
-               gGPIOInfo[i]->mask_scl_reg
-                       = B_LENDIAN_TO_HOST_INT16(gpio->usClkMaskRegisterIndex) 
* 4;
-               gGPIOInfo[i]->mask_sda_reg
-                       = 
B_LENDIAN_TO_HOST_INT16(gpio->usDataMaskRegisterIndex) * 4;
-               gGPIOInfo[i]->mask_scl_mask
-                       = (1 << gpio->ucClkMaskShift);
-               gGPIOInfo[i]->mask_sda_mask
-                       = (1 << gpio->ucDataMaskShift);
-
-               // GPIO output / write (A) enable
-               // 0 = GPIO input (Y); 1 = GPIO output (A);
-               gGPIOInfo[i]->en_scl_reg
-                       = B_LENDIAN_TO_HOST_INT16(gpio->usClkEnRegisterIndex) * 
4;
-               gGPIOInfo[i]->en_sda_reg
-                       = B_LENDIAN_TO_HOST_INT16(gpio->usDataEnRegisterIndex) 
* 4;
-               gGPIOInfo[i]->en_scl_mask
-                       = (1 << gpio->ucClkEnShift);
-               gGPIOInfo[i]->en_sda_mask
-                       = (1 << gpio->ucDataEnShift);
-
-               // GPIO output / write (A)
-               gGPIOInfo[i]->a_scl_reg
-                       = B_LENDIAN_TO_HOST_INT16(gpio->usClkA_RegisterIndex) * 
4;
-               gGPIOInfo[i]->a_sda_reg
-                       = B_LENDIAN_TO_HOST_INT16(gpio->usDataA_RegisterIndex) 
* 4;
-               gGPIOInfo[i]->a_scl_mask
-                       = (1 << gpio->ucClkA_Shift);
-               gGPIOInfo[i]->a_sda_mask
-                       = (1 << gpio->ucDataA_Shift);
-
-               // GPIO input / read (Y)
-               gGPIOInfo[i]->y_scl_reg
-                       = B_LENDIAN_TO_HOST_INT16(gpio->usClkY_RegisterIndex) * 
4;
-               gGPIOInfo[i]->y_sda_reg
-                       = B_LENDIAN_TO_HOST_INT16(gpio->usDataY_RegisterIndex) 
* 4;
-               gGPIOInfo[i]->y_scl_mask
-                       = (1 << gpio->ucClkY_Shift);
-               gGPIOInfo[i]->y_sda_mask
-                       = (1 << gpio->ucDataY_Shift);
-
-               // ensure data is valid
-               gGPIOInfo[i]->valid = (gGPIOInfo[i]->mask_scl_reg) ? true : 
false;
-
-               TRACE("%s: GPIO @ %" B_PRIu32 ", valid: %s, hw_line: 0x%" 
B_PRIX32 "\n",
-                       __func__, i, gGPIOInfo[i]->valid ? "true" : "false",
-                       gGPIOInfo[i]->hw_line);
-       }
-
-       return B_OK;
-}
diff --git a/src/add-ons/accelerants/radeon_hd/gpu.h 
b/src/add-ons/accelerants/radeon_hd/gpu.h
index 66940b3..6ca5087 100644
--- a/src/add-ons/accelerants/radeon_hd/gpu.h
+++ b/src/add-ons/accelerants/radeon_hd/gpu.h
@@ -176,9 +176,6 @@ void radeon_gpu_mc_resume(struct gpu_state *gpuState);
 uint32 radeon_gpu_mc_idlecheck();
 status_t radeon_gpu_mc_setup();
 status_t radeon_gpu_irq_setup();
-status_t radeon_gpu_gpio_setup();
-status_t radeon_gpu_i2c_attach(uint32 id, uint8 hw_line);
-bool radeon_gpu_read_edid(uint32 connector, edid1_info *edid);
 
 
 #endif

############################################################################

Revision:    hrev43437
Commit:      104c404c7edb585d7d4d6f88ad99d6525e6f1022
URL:         http://cgit.haiku-os.org/haiku/commit/?id=104c404
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Thu Dec  8 20:03:43 2011 UTC

Move connector code into new connector source file.

* clean up some comments
* most of this movement is prep for AUX display transactions

----------------------------------------------------------------------------

diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp 
b/src/add-ons/accelerants/radeon_hd/accelerant.cpp
index f8df104..db3af92 100644
--- a/src/add-ons/accelerants/radeon_hd/accelerant.cpp
+++ b/src/add-ons/accelerants/radeon_hd/accelerant.cpp
@@ -252,15 +252,15 @@ radeon_init_accelerant(int device)
 
        radeon_init_bios(gInfo->rom);
 
-       // detect GPIO pins
+       // find GPIO pins from AtomBIOS
        gpio_probe();
 
-       // detect physical connectors
-       status = detect_connectors();
+       // find physical card connectors from AtomBIOS
+       status = connector_probe();
 
        if (status != B_OK) {
-               TRACE("%s: falling back to legacy connector detection.\n", 
__func__);
-               status = detect_connectors_legacy();
+               TRACE("%s: falling back to legacy connector probe.\n", 
__func__);
+               status = connector_probe_legacy();
        }
 
        if (status != B_OK) {
diff --git a/src/add-ons/accelerants/radeon_hd/connector.cpp 
b/src/add-ons/accelerants/radeon_hd/connector.cpp
index 64f726a..8e98403 100644
--- a/src/add-ons/accelerants/radeon_hd/connector.cpp
+++ b/src/add-ons/accelerants/radeon_hd/connector.cpp
@@ -355,3 +355,399 @@ gpio_probe()
 
        return B_OK;
 }
+
+
+union atom_supported_devices {
+       struct _ATOM_SUPPORTED_DEVICES_INFO info;
+       struct _ATOM_SUPPORTED_DEVICES_INFO_2 info_2;
+       struct _ATOM_SUPPORTED_DEVICES_INFO_2d1 info_2d1;
+};
+
+
+status_t
+connector_probe_legacy()
+{
+       int index = GetIndexIntoMasterTable(DATA, SupportedDevicesInfo);
+       uint8 tableMajor;
+       uint8 tableMinor;
+       uint16 tableSize;
+       uint16 tableOffset;
+
+       if (atom_parse_data_header(gAtomContext, index, &tableSize,
+               &tableMajor, &tableMinor, &tableOffset) != B_OK) {
+               ERROR("%s: unable to parse data header!\n", __func__);
+               return B_ERROR;
+       }
+
+       union atom_supported_devices *supportedDevices;
+       supportedDevices = (union atom_supported_devices *)
+               (gAtomContext->bios + tableOffset);
+
+       uint16 deviceSupport
+               = 
B_LENDIAN_TO_HOST_INT16(supportedDevices->info.usDeviceSupport);
+
+       uint32 maxDevice;
+
+       if (tableMajor > 1)
+               maxDevice = ATOM_MAX_SUPPORTED_DEVICE;
+       else
+               maxDevice = ATOM_MAX_SUPPORTED_DEVICE_INFO;
+
+       uint32 i;
+       uint32 connectorIndex = 0;
+       for (i = 0; i < maxDevice; i++) {
+
+               gConnector[connectorIndex]->valid = false;
+
+               // check if this connector is used
+               if ((deviceSupport & (1 << i)) == 0)
+                       continue;
+
+               if (i == ATOM_DEVICE_CV_INDEX) {
+                       TRACE("%s: skipping component video\n",
+                               __func__);
+                       continue;
+               }
+
+               ATOM_CONNECTOR_INFO_I2C ci
+                       = supportedDevices->info.asConnInfo[i];
+
+               gConnector[connectorIndex]->type = connector_convert_legacy[
+                       ci.sucConnectorInfo.sbfAccess.bfConnectorType];
+
+               if (gConnector[connectorIndex]->type == 
VIDEO_CONNECTOR_UNKNOWN) {
+                       TRACE("%s: skipping unknown connector at %" B_PRId32
+                               " of 0x%" B_PRIX8 "\n", __func__, i,
+                               ci.sucConnectorInfo.sbfAccess.bfConnectorType);
+                       continue;
+               }
+
+               // TODO: give tv unique connector ids
+
+               // Always set CRT1 and CRT2 as VGA, some cards incorrectly set
+               // VGA ports as DVI
+               if (i == ATOM_DEVICE_CRT1_INDEX || i == ATOM_DEVICE_CRT2_INDEX)
+                       gConnector[connectorIndex]->type = VIDEO_CONNECTOR_VGA;
+
+               uint8 dac = ci.sucConnectorInfo.sbfAccess.bfAssociatedDAC;
+               uint32 encoderObject = encoder_object_lookup((1 << i), dac);
+               uint32 encoderID = (encoderObject & OBJECT_ID_MASK) >> 
OBJECT_ID_SHIFT;
+
+               gConnector[connectorIndex]->valid = true;
+               gConnector[connectorIndex]->encoder.flags = (1 << i);
+               gConnector[connectorIndex]->encoder.valid = true;
+               gConnector[connectorIndex]->encoder.objectID = encoderID;
+               gConnector[connectorIndex]->encoder.type
+                       = encoder_type_lookup(encoderID, (1 << i));
+               gConnector[connectorIndex]->encoder.isExternal
+                       = encoder_is_external(encoderID);
+
+               connector_attach_gpio(connectorIndex, ci.sucI2cId.ucAccess);
+
+               pll_limit_probe(&gConnector[connectorIndex]->encoder.pll);
+
+               connectorIndex++;
+       }
+
+       // TODO: combine shared connectors
+
+       for (i = 0; i < maxDevice; i++) {
+               if (gConnector[i]->valid == true) {
+                       TRACE("%s: connector #%" B_PRId32 " is %s\n", __func__, 
i,
+                               get_connector_name(gConnector[i]->type));
+               }
+       }
+
+       if (connectorIndex == 0) {
+               TRACE("%s: zero connectors found using legacy detection\n", 
__func__);
+               return B_ERROR;
+       }
+
+       return B_OK;
+}
+
+
+// r600+
+status_t
+connector_probe()
+{
+       int index = GetIndexIntoMasterTable(DATA, Object_Header);
+       uint8 tableMajor;
+       uint8 tableMinor;
+       uint16 tableSize;
+       uint16 tableOffset;
+
+       if (atom_parse_data_header(gAtomContext, index, &tableSize,
+               &tableMajor, &tableMinor, &tableOffset) != B_OK) {
+               ERROR("%s: ERROR: parsing data header failed!\n", __func__);
+               return B_ERROR;
+       }
+
+       if (tableMinor < 2) {
+               ERROR("%s: ERROR: table minor version unknown! "
+                       "(%" B_PRIu8 ".%" B_PRIu8 ")\n", __func__, tableMajor, 
tableMinor);
+               return B_ERROR;
+       }
+
+       ATOM_CONNECTOR_OBJECT_TABLE *con_obj;
+       ATOM_ENCODER_OBJECT_TABLE *enc_obj;
+       ATOM_OBJECT_TABLE *router_obj;
+       ATOM_DISPLAY_OBJECT_PATH_TABLE *path_obj;
+       ATOM_OBJECT_HEADER *obj_header;
+
+       obj_header = (ATOM_OBJECT_HEADER *)(gAtomContext->bios + tableOffset);
+       path_obj = (ATOM_DISPLAY_OBJECT_PATH_TABLE *)
+               (gAtomContext->bios + tableOffset
+               + 
B_LENDIAN_TO_HOST_INT16(obj_header->usDisplayPathTableOffset));
+       con_obj = (ATOM_CONNECTOR_OBJECT_TABLE *)
+               (gAtomContext->bios + tableOffset
+               + 
B_LENDIAN_TO_HOST_INT16(obj_header->usConnectorObjectTableOffset));
+       enc_obj = (ATOM_ENCODER_OBJECT_TABLE *)
+               (gAtomContext->bios + tableOffset
+               + 
B_LENDIAN_TO_HOST_INT16(obj_header->usEncoderObjectTableOffset));
+       router_obj = (ATOM_OBJECT_TABLE *)
+               (gAtomContext->bios + tableOffset
+               + 
B_LENDIAN_TO_HOST_INT16(obj_header->usRouterObjectTableOffset));
+       int deviceSupport = 
B_LENDIAN_TO_HOST_INT16(obj_header->usDeviceSupport);
+
+       int pathSize = 0;
+       int32 i = 0;
+
+       TRACE("%s: found %" B_PRIu8 " potential display paths.\n", __func__,
+               path_obj->ucNumOfDispPath);
+
+       uint32 connectorIndex = 0;
+       for (i = 0; i < path_obj->ucNumOfDispPath; i++) {
+
+               if (connectorIndex >= ATOM_MAX_SUPPORTED_DEVICE)
+                       continue;
+
+               uint8 *addr = (uint8*)path_obj->asDispPath;
+               ATOM_DISPLAY_OBJECT_PATH *path;
+               addr += pathSize;
+               path = (ATOM_DISPLAY_OBJECT_PATH *)addr;
+               pathSize += B_LENDIAN_TO_HOST_INT16(path->usSize);
+
+               uint32 connectorType;
+               uint16 connectorObjectID;
+               uint16 connectorFlags = 
B_LENDIAN_TO_HOST_INT16(path->usDeviceTag);
+
+               if ((deviceSupport & connectorFlags) != 0) {
+                       uint8 con_obj_id = 
(B_LENDIAN_TO_HOST_INT16(path->usConnObjectId)
+                               & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT;
+
+                       //uint8 con_obj_num
+                       //      = (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId)
+                       //      & ENUM_ID_MASK) >> ENUM_ID_SHIFT;
+                       //uint8 con_obj_type
+                       //      = (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId)
+                       //      & OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT;
+
+                       if (connectorFlags == ATOM_DEVICE_CV_SUPPORT) {
+                               TRACE("%s: Path #%" B_PRId32 ": skipping 
component video.\n",
+                                       __func__, i);
+                               continue;
+                       }
+
+                       uint16 igp_lane_info;
+                       if (0)
+                               ERROR("%s: TODO: IGP chip connector 
detection\n", __func__);
+                       else {
+                               igp_lane_info = 0;
+                               connectorType = connector_convert[con_obj_id];
+                               connectorObjectID = con_obj_id;
+                       }
+
+                       if (connectorType == VIDEO_CONNECTOR_UNKNOWN) {
+                               ERROR("%s: Path #%" B_PRId32 ": skipping 
unknown connector.\n",
+                                       __func__, i);
+                               continue;
+                       }
+
+                       int32 j;
+                       for (j = 0; j < ((B_LENDIAN_TO_HOST_INT16(path->usSize) 
- 8) / 2);
+                               j++) {
+                               //uint16 grph_obj_id
+                               //      = 
(B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j])
+                               //      & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT;
+                               //uint8 grph_obj_num
+                               //      = 
(B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) &
+                               //      ENUM_ID_MASK) >> ENUM_ID_SHIFT;
+                               uint8 grph_obj_type
+                                       = 
(B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) &
+                                       OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT;
+
+                               if (grph_obj_type == GRAPH_OBJECT_TYPE_ENCODER) 
{
+                                       // Found an encoder
+                                       // TODO: it may be possible to have 
more then one encoder
+                                       int32 k;
+                                       for (k = 0; k < 
enc_obj->ucNumberOfObjects; k++) {
+                                               uint16 encoder_obj
+                                                       = 
B_LENDIAN_TO_HOST_INT16(
+                                                       
enc_obj->asObjects[k].usObjectID);
+                                               if 
(B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j])
+                                                       == encoder_obj) {
+                                                       
ATOM_COMMON_RECORD_HEADER *record
+                                                               = 
(ATOM_COMMON_RECORD_HEADER *)
+                                                               ((uint16 
*)gAtomContext->bios + tableOffset
+                                                               + 
B_LENDIAN_TO_HOST_INT16(
+                                                               
enc_obj->asObjects[k].usRecordOffset));
+                                                       ATOM_ENCODER_CAP_RECORD 
*cap_record;
+                                                       uint16 caps = 0;
+                                                       while 
(record->ucRecordSize > 0
+                                                               && 
record->ucRecordType > 0
+                                                               && 
record->ucRecordType
+                                                               <= 
ATOM_MAX_OBJECT_RECORD_NUMBER) {
+                                                               switch 
(record->ucRecordType) {
+                                                                       case 
ATOM_ENCODER_CAP_RECORD_TYPE:
+                                                                               
cap_record = (ATOM_ENCODER_CAP_RECORD *)
+                                                                               
        record;
+                                                                               
caps = B_LENDIAN_TO_HOST_INT16(
+                                                                               
        cap_record->usEncoderCap);
+                                                                               
break;
+                                                               }
+                                                               record = 
(ATOM_COMMON_RECORD_HEADER *)
+                                                                       ((char 
*)record + record->ucRecordSize);
+                                                       }
+
+                                                       uint32 encoderID = 
(encoder_obj & OBJECT_ID_MASK)
+                                                               >> 
OBJECT_ID_SHIFT;
+
+                                                       uint32 encoderType = 
encoder_type_lookup(encoderID,
+                                                               connectorFlags);
+
+                                                       if (encoderType == 
VIDEO_ENCODER_NONE) {
+                                                               ERROR("%s: Path 
#%" B_PRId32 ":"
+                                                                       
"skipping unknown encoder.\n",
+                                                                       
__func__, i);
+                                                               continue;
+                                                       }
+
+                                                       // Set up encoder on 
connector if valid
+                                                       TRACE("%s: Path #%" 
B_PRId32 ": Found encoder "
+                                                               "%s\n", 
__func__, i,
+                                                               
get_encoder_name(encoderType));
+
+                                                       
gConnector[connectorIndex]->encoder.valid
+                                                               = true;
+                                                       
gConnector[connectorIndex]->encoder.flags
+                                                               = 
connectorFlags;
+                                                       
gConnector[connectorIndex]->encoder.objectID
+                                                               = encoderID;
+                                                       
gConnector[connectorIndex]->encoder.type
+                                                               = encoderType;
+                                                       
gConnector[connectorIndex]->encoder.isExternal
+                                                               = 
encoder_is_external(encoderID);
+
+                                                       pll_limit_probe(
+                                                               
&gConnector[connectorIndex]->encoder.pll);
+                                               }
+                                       }
+                                       // END if object is encoder
+                               } else if (grph_obj_type == 
GRAPH_OBJECT_TYPE_ROUTER) {
+                                       ERROR("%s: TODO: Found router 
object?\n", __func__);
+                               } // END if object is router
+                       }
+
+                       // Set up information buses such as ddc
+                       if ((connectorFlags
+                               & (ATOM_DEVICE_TV_SUPPORT | 
ATOM_DEVICE_CV_SUPPORT)) == 0) {
+                               for (j = 0; j < con_obj->ucNumberOfObjects; 
j++) {
+                                       if 
(B_LENDIAN_TO_HOST_INT16(path->usConnObjectId)
+                                               == B_LENDIAN_TO_HOST_INT16(
+                                               
con_obj->asObjects[j].usObjectID)) {
+                                               ATOM_COMMON_RECORD_HEADER 
*record
+                                                       = 
(ATOM_COMMON_RECORD_HEADER*)(gAtomContext->bios
+                                                       + tableOffset + 
B_LENDIAN_TO_HOST_INT16(
+                                                       
con_obj->asObjects[j].usRecordOffset));
+                                               while (record->ucRecordSize > 0
+                                                       && record->ucRecordType 
> 0
+                                                       && record->ucRecordType
+                                                               <= 
ATOM_MAX_OBJECT_RECORD_NUMBER) {
+                                                       ATOM_I2C_RECORD 
*i2c_record;
+                                                       
ATOM_I2C_ID_CONFIG_ACCESS *i2c_config;
+                                                       //ATOM_HPD_INT_RECORD 
*hpd_record;
+
+                                                       switch 
(record->ucRecordType) {
+                                                               case 
ATOM_I2C_RECORD_TYPE:
+                                                                       
i2c_record
+                                                                               
= (ATOM_I2C_RECORD *)record;
+                                                                       
i2c_config
+                                                                               
= (ATOM_I2C_ID_CONFIG_ACCESS *)
+                                                                               
&i2c_record->sucI2cId;
+                                                                       // 
attach i2c gpio information for connector
+                                                                       
connector_attach_gpio(connectorIndex,
+                                                                               
i2c_config->ucAccess);
+                                                                       break;
+                                                               case 
ATOM_HPD_INT_RECORD_TYPE:
+                                                                       // 
TODO: HPD (Hot Plug)
+                                                                       break;
+                                                       }
+
+                                                       // move to next record
+                                                       record = 
(ATOM_COMMON_RECORD_HEADER *)
+                                                               ((char *)record 
+ record->ucRecordSize);
+                                               }
+                                       }
+                               }
+                       }
+
+                       // TODO: aux chan transactions
+
+                       // record connector information
+                       TRACE("%s: Path #%" B_PRId32 ": Found %s (0x%" B_PRIX32 
")\n",
+                               __func__, i, get_connector_name(connectorType),
+                               connectorType);
+
+                       gConnector[connectorIndex]->valid = true;
+                       gConnector[connectorIndex]->flags = connectorFlags;
+                       gConnector[connectorIndex]->type = connectorType;
+                       gConnector[connectorIndex]->objectID = 
connectorObjectID;
+
+                       gConnector[connectorIndex]->encoder.isTV = false;
+                       gConnector[connectorIndex]->encoder.isHDMI = false;
+
+                       switch(connectorType) {
+                               case VIDEO_CONNECTOR_COMPOSITE:
+                               case VIDEO_CONNECTOR_SVIDEO:
+                               case VIDEO_CONNECTOR_9DIN:
+                                       
gConnector[connectorIndex]->encoder.isTV = true;
+                                       break;
+                               case VIDEO_CONNECTOR_HDMIA:
+                               case VIDEO_CONNECTOR_HDMIB:
+                                       
gConnector[connectorIndex]->encoder.isHDMI = true;
+                                       break;
+                       }
+
+                       connectorIndex++;
+               } // END for each valid connector
+       } // end for each display path
+
+       return B_OK;
+}
+
+
+void
+debug_connectors()
+{
+       ERROR("Currently detected connectors=============\n");
+       for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) {
+               if (gConnector[id]->valid == true) {
+                       uint32 connectorType = gConnector[id]->type;
+                       uint32 encoderType = gConnector[id]->encoder.type;
+                       uint16 encoderID = gConnector[id]->encoder.objectID;
+                       uint16 gpioID = gConnector[id]->gpioID;
+                       ERROR("Connector #%" B_PRIu32 ")\n", id);
+                       ERROR(" + connector:  %s\n", 
get_connector_name(connectorType));
+                       ERROR(" + encoder:    %s\n", 
get_encoder_name(encoderType));
+                       ERROR(" + encoder id: %" B_PRIu16 " (%s)\n", encoderID,
+                               encoder_name_lookup(encoderID));
+                       ERROR(" + gpio id:    %" B_PRIu16 "\n", gpioID);
+                       ERROR(" + gpio valid: %s\n",
+                               gGPIOInfo[gpioID]->valid ? "true" : "false");
+                       ERROR(" + hw line:    0x%" B_PRIX32 "\n",
+                               gGPIOInfo[gpioID]->hw_line);
+               }
+       }
+       ERROR("==========================================\n");
+}
diff --git a/src/add-ons/accelerants/radeon_hd/connector.h 
b/src/add-ons/accelerants/radeon_hd/connector.h
index 6f24ab8..1d7b06c 100644
--- a/src/add-ons/accelerants/radeon_hd/connector.h
+++ b/src/add-ons/accelerants/radeon_hd/connector.h
@@ -8,8 +8,62 @@
 #ifndef RADEON_HD_CONNECTOR_H
 #define RADEON_HD_CONNECTOR_H
 
+
+#include <video_configuration.h>
+
+
+// convert radeon connector to common connector type
+const int connector_convert_legacy[] = {
+       VIDEO_CONNECTOR_UNKNOWN,
+       VIDEO_CONNECTOR_VGA,
+       VIDEO_CONNECTOR_DVII,
+       VIDEO_CONNECTOR_DVID,
+       VIDEO_CONNECTOR_DVIA,
+       VIDEO_CONNECTOR_SVIDEO,
+       VIDEO_CONNECTOR_COMPOSITE,
+       VIDEO_CONNECTOR_LVDS,
+       VIDEO_CONNECTOR_UNKNOWN,
+       VIDEO_CONNECTOR_UNKNOWN,
+       VIDEO_CONNECTOR_HDMIA,
+       VIDEO_CONNECTOR_HDMIB,
+       VIDEO_CONNECTOR_UNKNOWN,
+       VIDEO_CONNECTOR_UNKNOWN,
+       VIDEO_CONNECTOR_9DIN,
+       VIDEO_CONNECTOR_DP
+};
+
+const int connector_convert[] = {
+       VIDEO_CONNECTOR_UNKNOWN,
+       VIDEO_CONNECTOR_DVII,
+       VIDEO_CONNECTOR_DVII,
+       VIDEO_CONNECTOR_DVID,
+       VIDEO_CONNECTOR_DVID,
+       VIDEO_CONNECTOR_VGA,
+       VIDEO_CONNECTOR_COMPOSITE,
+       VIDEO_CONNECTOR_SVIDEO,
+       VIDEO_CONNECTOR_UNKNOWN,
+       VIDEO_CONNECTOR_UNKNOWN,
+       VIDEO_CONNECTOR_9DIN,
+       VIDEO_CONNECTOR_UNKNOWN,
+       VIDEO_CONNECTOR_HDMIA,
+       VIDEO_CONNECTOR_HDMIB,
+       VIDEO_CONNECTOR_LVDS,
+       VIDEO_CONNECTOR_9DIN,
+       VIDEO_CONNECTOR_UNKNOWN,
+       VIDEO_CONNECTOR_UNKNOWN,
+       VIDEO_CONNECTOR_UNKNOWN,
+       VIDEO_CONNECTOR_DP,
+       VIDEO_CONNECTOR_EDP,
+       VIDEO_CONNECTOR_UNKNOWN
+};
+
+
 status_t gpio_probe();
 status_t connector_attach_gpio(uint32 id, uint8 hw_line);
 bool connector_read_edid(uint32 connector, edid1_info *edid);
+status_t connector_probe();
+status_t connector_probe_legacy();
+void debug_connectors();
+
 
-#endif
+#endif /* RADEON_HD_CONNECTOR_H */
diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp 
b/src/add-ons/accelerants/radeon_hd/display.cpp
index f1f0a37..165e361 100644
--- a/src/add-ons/accelerants/radeon_hd/display.cpp
+++ b/src/add-ons/accelerants/radeon_hd/display.cpp
@@ -238,378 +238,6 @@ detect_crt_ranges(uint32 crtid)
 }
 
 
-union atom_supported_devices {
-       struct _ATOM_SUPPORTED_DEVICES_INFO info;
-       struct _ATOM_SUPPORTED_DEVICES_INFO_2 info_2;
-       struct _ATOM_SUPPORTED_DEVICES_INFO_2d1 info_2d1;
-};
-
-
-status_t
-detect_connectors_legacy()
-{
-       int index = GetIndexIntoMasterTable(DATA, SupportedDevicesInfo);
-       uint8 tableMajor;
-       uint8 tableMinor;
-       uint16 tableSize;
-       uint16 tableOffset;
-
-       if (atom_parse_data_header(gAtomContext, index, &tableSize,
-               &tableMajor, &tableMinor, &tableOffset) != B_OK) {
-               ERROR("%s: unable to parse data header!\n", __func__);
-               return B_ERROR;
-       }
-
-       union atom_supported_devices *supportedDevices;
-       supportedDevices = (union atom_supported_devices *)
-               (gAtomContext->bios + tableOffset);
-
-       uint16 deviceSupport
-               = 
B_LENDIAN_TO_HOST_INT16(supportedDevices->info.usDeviceSupport);
-
-       uint32 maxDevice;
-
-       if (tableMajor > 1)
-               maxDevice = ATOM_MAX_SUPPORTED_DEVICE;
-       else
-               maxDevice = ATOM_MAX_SUPPORTED_DEVICE_INFO;
-
-       uint32 i;
-       uint32 connectorIndex = 0;
-       for (i = 0; i < maxDevice; i++) {
-
-               gConnector[connectorIndex]->valid = false;
-
-               // check if this connector is used
-               if ((deviceSupport & (1 << i)) == 0)
-                       continue;
-
-               if (i == ATOM_DEVICE_CV_INDEX) {
-                       TRACE("%s: skipping component video\n",
-                               __func__);
-                       continue;
-               }
-
-               ATOM_CONNECTOR_INFO_I2C ci
-                       = supportedDevices->info.asConnInfo[i];
-
-               gConnector[connectorIndex]->type = connector_convert_legacy[
-                       ci.sucConnectorInfo.sbfAccess.bfConnectorType];
-
-               if (gConnector[connectorIndex]->type == 
VIDEO_CONNECTOR_UNKNOWN) {
-                       TRACE("%s: skipping unknown connector at %" B_PRId32
-                               " of 0x%" B_PRIX8 "\n", __func__, i,
-                               ci.sucConnectorInfo.sbfAccess.bfConnectorType);
-                       continue;
-               }
-
-               // TODO: give tv unique connector ids
-
-               // Always set CRT1 and CRT2 as VGA, some cards incorrectly set
-               // VGA ports as DVI
-               if (i == ATOM_DEVICE_CRT1_INDEX || i == ATOM_DEVICE_CRT2_INDEX)
-                       gConnector[connectorIndex]->type = VIDEO_CONNECTOR_VGA;
-
-               uint8 dac = ci.sucConnectorInfo.sbfAccess.bfAssociatedDAC;
-               uint32 encoderObject = encoder_object_lookup((1 << i), dac);
-               uint32 encoderID = (encoderObject & OBJECT_ID_MASK) >> 
OBJECT_ID_SHIFT;
-
-               gConnector[connectorIndex]->valid = true;
-               gConnector[connectorIndex]->encoder.flags = (1 << i);
-               gConnector[connectorIndex]->encoder.valid = true;
-               gConnector[connectorIndex]->encoder.objectID = encoderID;
-               gConnector[connectorIndex]->encoder.type
-                       = encoder_type_lookup(encoderID, (1 << i));
-               gConnector[connectorIndex]->encoder.isExternal
-                       = encoder_is_external(encoderID);
-
-               connector_attach_gpio(connectorIndex, ci.sucI2cId.ucAccess);
-
-               pll_limit_probe(&gConnector[connectorIndex]->encoder.pll);
-
-               connectorIndex++;
-       }
-
-       // TODO: combine shared connectors
-
-       // TODO: add connectors
-
-       for (i = 0; i < maxDevice; i++) {
-               if (gConnector[i]->valid == true) {
-                       TRACE("%s: connector #%" B_PRId32 " is %s\n", __func__, 
i,
-                               get_connector_name(gConnector[i]->type));
-               }
-       }
-
-       if (connectorIndex == 0) {
-               TRACE("%s: zero connectors found using legacy detection\n", 
__func__);
-               return B_ERROR;
-       }
-
-       return B_OK;
-}
-
-
-// r600+
-status_t
-detect_connectors()
-{
-       int index = GetIndexIntoMasterTable(DATA, Object_Header);
-       uint8 tableMajor;
-       uint8 tableMinor;
-       uint16 tableSize;
-       uint16 tableOffset;
-
-       if (atom_parse_data_header(gAtomContext, index, &tableSize,
-               &tableMajor, &tableMinor, &tableOffset) != B_OK) {
-               ERROR("%s: ERROR: parsing data header failed!\n", __func__);
-               return B_ERROR;
-       }
-
-       if (tableMinor < 2) {
-               ERROR("%s: ERROR: table minor version unknown! "
-                       "(%" B_PRIu8 ".%" B_PRIu8 ")\n", __func__, tableMajor, 
tableMinor);
-               return B_ERROR;
-       }
-
-       ATOM_CONNECTOR_OBJECT_TABLE *con_obj;
-       ATOM_ENCODER_OBJECT_TABLE *enc_obj;
-       ATOM_OBJECT_TABLE *router_obj;
-       ATOM_DISPLAY_OBJECT_PATH_TABLE *path_obj;
-       ATOM_OBJECT_HEADER *obj_header;
-
-       obj_header = (ATOM_OBJECT_HEADER *)(gAtomContext->bios + tableOffset);
-       path_obj = (ATOM_DISPLAY_OBJECT_PATH_TABLE *)
-               (gAtomContext->bios + tableOffset
-               + 
B_LENDIAN_TO_HOST_INT16(obj_header->usDisplayPathTableOffset));
-       con_obj = (ATOM_CONNECTOR_OBJECT_TABLE *)
-               (gAtomContext->bios + tableOffset
-               + 
B_LENDIAN_TO_HOST_INT16(obj_header->usConnectorObjectTableOffset));
-       enc_obj = (ATOM_ENCODER_OBJECT_TABLE *)
-               (gAtomContext->bios + tableOffset
-               + 
B_LENDIAN_TO_HOST_INT16(obj_header->usEncoderObjectTableOffset));
-       router_obj = (ATOM_OBJECT_TABLE *)
-               (gAtomContext->bios + tableOffset
-               + 
B_LENDIAN_TO_HOST_INT16(obj_header->usRouterObjectTableOffset));
-       int deviceSupport = 
B_LENDIAN_TO_HOST_INT16(obj_header->usDeviceSupport);
-
-       int pathSize = 0;
-       int32 i = 0;
-
-       TRACE("%s: found %" B_PRIu8 " potential display paths.\n", __func__,
-               path_obj->ucNumOfDispPath);
-
-       uint32 connectorIndex = 0;
-       for (i = 0; i < path_obj->ucNumOfDispPath; i++) {
-
-               if (connectorIndex >= ATOM_MAX_SUPPORTED_DEVICE)
-                       continue;
-
-               uint8 *addr = (uint8*)path_obj->asDispPath;
-               ATOM_DISPLAY_OBJECT_PATH *path;
-               addr += pathSize;
-               path = (ATOM_DISPLAY_OBJECT_PATH *)addr;
-               pathSize += B_LENDIAN_TO_HOST_INT16(path->usSize);
-
-               uint32 connectorType;
-               uint16 connectorObjectID;
-               uint16 connectorFlags = 
B_LENDIAN_TO_HOST_INT16(path->usDeviceTag);
-
-               if ((deviceSupport & connectorFlags) != 0) {
-                       uint8 con_obj_id = 
(B_LENDIAN_TO_HOST_INT16(path->usConnObjectId)
-                               & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT;
-
-                       //uint8 con_obj_num
-                       //      = (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId)
-                       //      & ENUM_ID_MASK) >> ENUM_ID_SHIFT;
-                       //uint8 con_obj_type
-                       //      = (B_LENDIAN_TO_HOST_INT16(path->usConnObjectId)
-                       //      & OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT;
-
-                       if (connectorFlags == ATOM_DEVICE_CV_SUPPORT) {
-                               TRACE("%s: Path #%" B_PRId32 ": skipping 
component video.\n",
-                                       __func__, i);
-                               continue;
-                       }
-
-                       uint16 igp_lane_info;
-                       if (0)
-                               ERROR("%s: TODO: IGP chip connector 
detection\n", __func__);
-                       else {
-                               igp_lane_info = 0;
-                               connectorType = connector_convert[con_obj_id];
-                               connectorObjectID = con_obj_id;
-                       }
-
-                       if (connectorType == VIDEO_CONNECTOR_UNKNOWN) {
-                               ERROR("%s: Path #%" B_PRId32 ": skipping 
unknown connector.\n",
-                                       __func__, i);
-                               continue;
-                       }
-
-                       int32 j;
-                       for (j = 0; j < ((B_LENDIAN_TO_HOST_INT16(path->usSize) 
- 8) / 2);
-                               j++) {
-                               //uint16 grph_obj_id
-                               //      = 
(B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j])
-                               //      & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT;
-                               //uint8 grph_obj_num
-                               //      = 
(B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) &
-                               //      ENUM_ID_MASK) >> ENUM_ID_SHIFT;
-                               uint8 grph_obj_type
-                                       = 
(B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) &
-                                       OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT;
-
-                               if (grph_obj_type == GRAPH_OBJECT_TYPE_ENCODER) 
{
-                                       // Found an encoder
-                                       // TODO: it may be possible to have 
more then one encoder
-                                       int32 k;
-                                       for (k = 0; k < 
enc_obj->ucNumberOfObjects; k++) {
-                                               uint16 encoder_obj
-                                                       = 
B_LENDIAN_TO_HOST_INT16(
-                                                       
enc_obj->asObjects[k].usObjectID);
-                                               if 
(B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j])
-                                                       == encoder_obj) {
-                                                       
ATOM_COMMON_RECORD_HEADER *record
-                                                               = 
(ATOM_COMMON_RECORD_HEADER *)
-                                                               ((uint16 
*)gAtomContext->bios + tableOffset
-                                                               + 
B_LENDIAN_TO_HOST_INT16(
-                                                               
enc_obj->asObjects[k].usRecordOffset));
-                                                       ATOM_ENCODER_CAP_RECORD 
*cap_record;
-                                                       uint16 caps = 0;
-                                                       while 
(record->ucRecordSize > 0
-                                                               && 
record->ucRecordType > 0
-                                                               && 
record->ucRecordType
-                                                               <= 
ATOM_MAX_OBJECT_RECORD_NUMBER) {
-                                                               switch 
(record->ucRecordType) {
-                                                                       case 
ATOM_ENCODER_CAP_RECORD_TYPE:
-                                                                               
cap_record = (ATOM_ENCODER_CAP_RECORD *)
-                                                                               
        record;
-                                                                               
caps = B_LENDIAN_TO_HOST_INT16(
-                                                                               
        cap_record->usEncoderCap);
-                                                                               
break;
-                                                               }
-                                                               record = 
(ATOM_COMMON_RECORD_HEADER *)
-                                                                       ((char 
*)record + record->ucRecordSize);
-                                                       }
-
-                                                       uint32 encoderID = 
(encoder_obj & OBJECT_ID_MASK)
-                                                               >> 
OBJECT_ID_SHIFT;
-
-                                                       uint32 encoderType = 
encoder_type_lookup(encoderID,
-                                                               connectorFlags);
-
-                                                       if (encoderType == 
VIDEO_ENCODER_NONE) {
-                                                               ERROR("%s: Path 
#%" B_PRId32 ":"
-                                                                       
"skipping unknown encoder.\n",
-                                                                       
__func__, i);
-                                                               continue;
-                                                       }
-
-                                                       // Set up encoder on 
connector if valid
-                                                       TRACE("%s: Path #%" 
B_PRId32 ": Found encoder "
-                                                               "%s\n", 
__func__, i,
-                                                               
get_encoder_name(encoderType));
-
-                                                       
gConnector[connectorIndex]->encoder.valid
-                                                               = true;
-                                                       
gConnector[connectorIndex]->encoder.flags
-                                                               = 
connectorFlags;
-                                                       
gConnector[connectorIndex]->encoder.objectID
-                                                               = encoderID;
-                                                       
gConnector[connectorIndex]->encoder.type
-                                                               = encoderType;
-                                                       
gConnector[connectorIndex]->encoder.isExternal
-                                                               = 
encoder_is_external(encoderID);
-
-                                                       pll_limit_probe(
-                                                               
&gConnector[connectorIndex]->encoder.pll);
-                                               }
-                                       }
-                                       // END if object is encoder
-                               } else if (grph_obj_type == 
GRAPH_OBJECT_TYPE_ROUTER) {
-                                       ERROR("%s: TODO: Found router 
object?\n", __func__);
-                               } // END if object is router
-                       }
-
-                       // Set up information buses such as ddc
-                       if ((connectorFlags
-                               & (ATOM_DEVICE_TV_SUPPORT | 
ATOM_DEVICE_CV_SUPPORT)) == 0) {
-                               for (j = 0; j < con_obj->ucNumberOfObjects; 
j++) {
-                                       if 
(B_LENDIAN_TO_HOST_INT16(path->usConnObjectId)
-                                               == B_LENDIAN_TO_HOST_INT16(
-                                               
con_obj->asObjects[j].usObjectID)) {
-                                               ATOM_COMMON_RECORD_HEADER 
*record
-                                                       = 
(ATOM_COMMON_RECORD_HEADER*)(gAtomContext->bios
-                                                       + tableOffset + 
B_LENDIAN_TO_HOST_INT16(
-                                                       
con_obj->asObjects[j].usRecordOffset));
-                                               while (record->ucRecordSize > 0
-                                                       && record->ucRecordType 
> 0
-                                                       && record->ucRecordType
-                                                               <= 
ATOM_MAX_OBJECT_RECORD_NUMBER) {
-                                                       ATOM_I2C_RECORD 
*i2c_record;
-                                                       
ATOM_I2C_ID_CONFIG_ACCESS *i2c_config;
-                                                       //ATOM_HPD_INT_RECORD 
*hpd_record;
-
-                                                       switch 
(record->ucRecordType) {
-                                                               case 
ATOM_I2C_RECORD_TYPE:
-                                                                       
i2c_record
-                                                                               
= (ATOM_I2C_RECORD *)record;
-                                                                       
i2c_config
-                                                                               
= (ATOM_I2C_ID_CONFIG_ACCESS *)
-                                                                               
&i2c_record->sucI2cId;
-                                                                       // 
attach i2c gpio information for connector
-                                                                       
connector_attach_gpio(connectorIndex,
-                                                                               
i2c_config->ucAccess);
-                                                                       break;
-                                                               case 
ATOM_HPD_INT_RECORD_TYPE:
-                                                                       // 
TODO: HPD (Hot Plug)
-                                                                       break;
-                                                       }
-
-                                                       // move to next record
-                                                       record = 
(ATOM_COMMON_RECORD_HEADER *)
-                                                               ((char *)record 
+ record->ucRecordSize);
-                                               }
-                                       }
-                               }
-                       }
-
-                       // TODO: aux chan transactions
-
-                       // record connector information
-                       TRACE("%s: Path #%" B_PRId32 ": Found %s (0x%" B_PRIX32 
")\n",
-                               __func__, i, get_connector_name(connectorType),
-                               connectorType);
-
-                       gConnector[connectorIndex]->valid = true;
-                       gConnector[connectorIndex]->flags = connectorFlags;
-                       gConnector[connectorIndex]->type = connectorType;
-                       gConnector[connectorIndex]->objectID = 
connectorObjectID;
-
-                       gConnector[connectorIndex]->encoder.isTV = false;
-                       gConnector[connectorIndex]->encoder.isHDMI = false;
-
-                       switch(connectorType) {
-                               case VIDEO_CONNECTOR_COMPOSITE:
-                               case VIDEO_CONNECTOR_SVIDEO:
-                               case VIDEO_CONNECTOR_9DIN:
-                                       
gConnector[connectorIndex]->encoder.isTV = true;
-                                       break;
-                               case VIDEO_CONNECTOR_HDMIA:
-                               case VIDEO_CONNECTOR_HDMIB:
-                                       
gConnector[connectorIndex]->encoder.isHDMI = true;
-                                       break;
-                       }
-
-                       connectorIndex++;
-               } // END for each valid connector
-       } // end for each display path
-
-       return B_OK;
-}
-
-
 status_t
 detect_displays()
 {
@@ -698,32 +326,6 @@ debug_displays()
 }
 
 
-void
-debug_connectors()
-{
-       ERROR("Currently detected connectors=============\n");
-       for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) {
-               if (gConnector[id]->valid == true) {
-                       uint32 connectorType = gConnector[id]->type;
-                       uint32 encoderType = gConnector[id]->encoder.type;
-                       uint16 encoderID = gConnector[id]->encoder.objectID;
-                       uint16 gpioID = gConnector[id]->gpioID;
-                       ERROR("Connector #%" B_PRIu32 ")\n", id);
-                       ERROR(" + connector:  %s\n", 
get_connector_name(connectorType));
-                       ERROR(" + encoder:    %s\n", 
get_encoder_name(encoderType));
-                       ERROR(" + encoder id: %" B_PRIu16 " (%s)\n", encoderID,
-                               encoder_name_lookup(encoderID));
-                       ERROR(" + gpio id:    %" B_PRIu16 "\n", gpioID);
-                       ERROR(" + gpio valid: %s\n",
-                               gGPIOInfo[gpioID]->valid ? "true" : "false");
-                       ERROR(" + hw line:    0x%" B_PRIX32 "\n",
-                               gGPIOInfo[gpioID]->hw_line);
-               }
-       }
-       ERROR("==========================================\n");
-}
-
-
 uint32
 display_get_encoder_mode(uint32 connectorIndex)
 {
diff --git a/src/add-ons/accelerants/radeon_hd/display.h 
b/src/add-ons/accelerants/radeon_hd/display.h
index 3b937ef..4e6c135 100644
--- a/src/add-ons/accelerants/radeon_hd/display.h
+++ b/src/add-ons/accelerants/radeon_hd/display.h
@@ -12,58 +12,10 @@
 #include <video_configuration.h>
 
 
-// convert radeon connector to common connector type
-const int connector_convert_legacy[] = {
-       VIDEO_CONNECTOR_UNKNOWN,
-       VIDEO_CONNECTOR_VGA,
-       VIDEO_CONNECTOR_DVII,
-       VIDEO_CONNECTOR_DVID,
-       VIDEO_CONNECTOR_DVIA,
-       VIDEO_CONNECTOR_SVIDEO,
-       VIDEO_CONNECTOR_COMPOSITE,
-       VIDEO_CONNECTOR_LVDS,
-       VIDEO_CONNECTOR_UNKNOWN,
-       VIDEO_CONNECTOR_UNKNOWN,
-       VIDEO_CONNECTOR_HDMIA,
-       VIDEO_CONNECTOR_HDMIB,
-       VIDEO_CONNECTOR_UNKNOWN,
-       VIDEO_CONNECTOR_UNKNOWN,
-       VIDEO_CONNECTOR_9DIN,
-       VIDEO_CONNECTOR_DP
-};
-
-const int connector_convert[] = {
-       VIDEO_CONNECTOR_UNKNOWN,
-       VIDEO_CONNECTOR_DVII,
-       VIDEO_CONNECTOR_DVII,
-       VIDEO_CONNECTOR_DVID,
-       VIDEO_CONNECTOR_DVID,
-       VIDEO_CONNECTOR_VGA,
-       VIDEO_CONNECTOR_COMPOSITE,
-       VIDEO_CONNECTOR_SVIDEO,
-       VIDEO_CONNECTOR_UNKNOWN,
-       VIDEO_CONNECTOR_UNKNOWN,
-       VIDEO_CONNECTOR_9DIN,
-       VIDEO_CONNECTOR_UNKNOWN,
-       VIDEO_CONNECTOR_HDMIA,
-       VIDEO_CONNECTOR_HDMIB,
-       VIDEO_CONNECTOR_LVDS,
-       VIDEO_CONNECTOR_9DIN,
-       VIDEO_CONNECTOR_UNKNOWN,
-       VIDEO_CONNECTOR_UNKNOWN,
-       VIDEO_CONNECTOR_UNKNOWN,
-       VIDEO_CONNECTOR_DP,
-       VIDEO_CONNECTOR_EDP,
-       VIDEO_CONNECTOR_UNKNOWN
-};
-
 status_t init_registers(register_info* reg, uint8 crtid);
-status_t detect_connectors_legacy();
-status_t detect_connectors();
 status_t detect_crt_ranges(uint32 crtid);
 status_t detect_displays();
 void debug_displays();
-void debug_connectors();
 
 uint32 display_get_encoder_mode(uint32 connectorIndex);
 void display_crtc_lock(uint8 crtcID, int command);


Other related posts: