* run edid check on all connectors regardless of encoder

* correction to output check (B_OK != true)
* check for invalid gpio (prevents seg violation)
* tab cleanup


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42727 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexander von Gluck IV
2011-09-08 22:11:20 +00:00
parent 560e1322cd
commit a8b357c747
3 changed files with 98 additions and 91 deletions
@@ -139,6 +139,7 @@ struct pll_info {
struct ddc_info { struct ddc_info {
bool valid;
uint8 gpio_id; uint8 gpio_id;
uint16 mask_scl_reg; uint16 mask_scl_reg;
+4 -12
View File
@@ -433,8 +433,8 @@ detect_connectors()
= (B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) & = (B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) &
OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT; OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT;
if (grph_obj_type == GRAPH_OBJECT_TYPE_ENCODER) { if (grph_obj_type == GRAPH_OBJECT_TYPE_ENCODER) {
// Found an encoder
int32 k; int32 k;
TRACE("%s: Found encoder at #%" B_PRIu32 "\n", __func__, j);
for (k = 0; k < enc_obj->ucNumberOfObjects; k++) { for (k = 0; k < enc_obj->ucNumberOfObjects; k++) {
uint16 encoder_obj uint16 encoder_obj
= B_LENDIAN_TO_HOST_INT16( = B_LENDIAN_TO_HOST_INT16(
@@ -533,7 +533,7 @@ detect_connectors()
} }
} }
} else if (grph_obj_type == GRAPH_OBJECT_TYPE_ROUTER) { } else if (grph_obj_type == GRAPH_OBJECT_TYPE_ROUTER) {
ERROR("%s: TODO : Router object?\n", __func__); ERROR("%s: TODO : Found router object?\n", __func__);
} }
} }
@@ -630,20 +630,12 @@ detect_displays()
if (displayIndex >= MAX_DISPLAY) if (displayIndex >= MAX_DISPLAY)
continue; continue;
bool found = false; if (radeon_gpu_read_edid(id, gDisplay[displayIndex]->edid_info)) {
switch(gConnector[id]->encoder_type) {
case VIDEO_ENCODER_DAC:
found = radeon_gpu_read_edid(id, gDisplay[id]->edid_info);
break;
default:
found = false;
}
if (found == true) {
gDisplay[displayIndex]->active = true; gDisplay[displayIndex]->active = true;
// set this display as active // set this display as active
gDisplay[displayIndex]->connector_index = id; gDisplay[displayIndex]->connector_index = id;
// set physical connector index from gConnector // set physical connector index from gConnector
init_registers(gDisplay[displayIndex]->regs, displayIndex); init_registers(gDisplay[displayIndex]->regs, displayIndex);
if (detect_crt_ranges(displayIndex) == B_OK) if (detect_crt_ranges(displayIndex) == B_OK)
+25 -11
View File
@@ -10,6 +10,7 @@
#include "accelerant_protos.h" #include "accelerant_protos.h"
#include "accelerant.h" #include "accelerant.h"
#include "bios.h"
#include "gpu.h" #include "gpu.h"
#include "utility.h" #include "utility.h"
@@ -286,6 +287,9 @@ get_i2c_signals(void* cookie, int* _clock, int* _data)
*_clock = (value >> info->gpio_y_scl_shift) & 1; *_clock = (value >> info->gpio_y_scl_shift) & 1;
*_data = (value >> info->gpio_y_sda_shift) & 1; *_data = (value >> info->gpio_y_sda_shift) & 1;
TRACE("%s: GPIO 0x%" B_PRIX8 ", clock: %d, data: %d\n",
__func__, info->gpio_id, *_clock, *_data);
return B_OK; return B_OK;
} }
@@ -304,6 +308,9 @@ set_i2c_signals(void* cookie, int clock, int data)
Write32(OUT, info->gpio_id, value); Write32(OUT, info->gpio_id, value);
TRACE("%s: GPIO 0x%" B_PRIX8 ", clock: %d, data: %d\n",
__func__, info->gpio_id, clock, data);
return B_OK; return B_OK;
} }
@@ -311,6 +318,11 @@ set_i2c_signals(void* cookie, int clock, int data)
bool bool
radeon_gpu_read_edid(uint32 connector, edid1_info *edid) radeon_gpu_read_edid(uint32 connector, edid1_info *edid)
{ {
// ensure things are sane
if (gConnector[connector]->connector_ddc_info.valid == false
|| gConnector[connector]->connector_ddc_info.gpio_id == 0)
return false;
i2c_bus bus; i2c_bus bus;
ddc2_init_timing(&bus); ddc2_init_timing(&bus);
@@ -339,22 +351,27 @@ radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id)
TRACE("%s: Path #%" B_PRId32 ": GPIO Pin 0x%" B_PRIx8 "\n", __func__, TRACE("%s: Path #%" B_PRId32 ": GPIO Pin 0x%" B_PRIx8 "\n", __func__,
connector, gpio_id); connector, gpio_id);
ATOM_GPIO_I2C_ASSIGMENT *gpio;
struct _ATOM_GPIO_I2C_INFO *i2c_info;
int index = GetIndexIntoMasterTable(DATA, GPIO_I2C_Info); int index = GetIndexIntoMasterTable(DATA, GPIO_I2C_Info);
uint8 frev;
uint8 crev;
uint16 offset; uint16 offset;
uint16 size; uint16 size;
if (atom_parse_data_header(gAtomContext, index, if (atom_parse_data_header(gAtomContext, index, &size, &frev, &crev,
&size, NULL, NULL, &offset)) { &offset) != B_OK) {
ERROR("%s: GPIO pin not within AtomBIOS!\n", __func__);
gConnector[connector]->connector_ddc_info.valid = false;
return B_ERROR;
}
i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(gAtomContext->bios + offset); struct _ATOM_GPIO_I2C_INFO *i2c_info
= (struct _ATOM_GPIO_I2C_INFO *)(gAtomContext->bios + offset);
uint32 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) uint32 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER))
/ sizeof(ATOM_GPIO_I2C_ASSIGMENT); / sizeof(ATOM_GPIO_I2C_ASSIGMENT);
for (uint32 i = 0; i < num_indices; i++) { for (uint32 i = 0; i < num_indices; i++) {
gpio = &i2c_info->asGPIO_Info[i]; ATOM_GPIO_I2C_ASSIGMENT *gpio = &i2c_info->asGPIO_Info[i];
// TODO : if DCE 4 and i == 7 ... manual override for evergreen // TODO : if DCE 4 and i == 7 ... manual override for evergreen
// TODO : if DCE 3 and i == 4 ... manual override // TODO : if DCE 3 and i == 4 ... manual override
@@ -363,10 +380,10 @@ radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id)
continue; continue;
// successful lookup // successful lookup
TRACE("%s: found i2c gpio\n", __func__); TRACE("%s: successful AtomBIOS GPIO lookup\n", __func__);
// populate gpio information // populate gpio information
gConnector[connector]->connector_ddc_info.valid = true;
gConnector[connector]->connector_ddc_info.gpio_id = gpio_id; gConnector[connector]->connector_ddc_info.gpio_id = gpio_id;
gConnector[connector]->connector_ddc_info.mask_scl_reg gConnector[connector]->connector_ddc_info.mask_scl_reg
@@ -406,8 +423,5 @@ radeon_gpu_i2c_setup(uint32 connector, uint8 gpio_id)
= (1 << gpio->ucDataA_Shift); = (1 << gpio->ucDataA_Shift);
} }
}
return B_OK; return B_OK;
} }