drm/radeon/kms: fix bugs in ddc and cd path router code

This is a follow on to:
2b5b1d7da9583484b3a9e7e375a90ca0e8ca07c2
(drm/radeon/kms: add support for clock/data path routers)

That patch completed mux support for ddc and cd line routing
between connectors.  This patch fixes an indexing typo that was
resulting in the atom bios router objects not always being walked,
ensures the validity entries for the reused router structure are
reset for every connector object walked, and corrects the masking
operations used to update the mux control bits.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=31339

Signed-off-by: Tyson Whitehead <twhitehead@gmail.com>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Tyson Whitehead 2010-11-08 16:08:30 +00:00 committed by Dave Airlie
parent fb939dfcf2
commit bdd91b2b57
2 changed files with 7 additions and 10 deletions

View File

@ -526,9 +526,6 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
if (crev < 2) if (crev < 2)
return false; return false;
router.ddc_valid = false;
router.cd_valid = false;
obj_header = (ATOM_OBJECT_HEADER *) (ctx->bios + data_offset); obj_header = (ATOM_OBJECT_HEADER *) (ctx->bios + data_offset);
path_obj = (ATOM_DISPLAY_OBJECT_PATH_TABLE *) path_obj = (ATOM_DISPLAY_OBJECT_PATH_TABLE *)
(ctx->bios + data_offset + (ctx->bios + data_offset +
@ -625,6 +622,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
if (connector_type == DRM_MODE_CONNECTOR_Unknown) if (connector_type == DRM_MODE_CONNECTOR_Unknown)
continue; continue;
router.ddc_valid = false;
router.cd_valid = false;
for (j = 0; j < ((le16_to_cpu(path->usSize) - 8) / 2); j++) { for (j = 0; j < ((le16_to_cpu(path->usSize) - 8) / 2); j++) {
uint8_t grph_obj_id, grph_obj_num, grph_obj_type; uint8_t grph_obj_id, grph_obj_num, grph_obj_type;
@ -648,10 +647,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
usDeviceTag)); usDeviceTag));
} else if (grph_obj_type == GRAPH_OBJECT_TYPE_ROUTER) { } else if (grph_obj_type == GRAPH_OBJECT_TYPE_ROUTER) {
router.ddc_valid = false;
router.cd_valid = false;
for (k = 0; k < router_obj->ucNumberOfObjects; k++) { for (k = 0; k < router_obj->ucNumberOfObjects; k++) {
u16 router_obj_id = le16_to_cpu(router_obj->asObjects[j].usObjectID); u16 router_obj_id = le16_to_cpu(router_obj->asObjects[k].usObjectID);
if (le16_to_cpu(path->usGraphicObjIds[j]) == router_obj_id) { if (le16_to_cpu(path->usGraphicObjIds[j]) == router_obj_id) {
ATOM_COMMON_RECORD_HEADER *record = (ATOM_COMMON_RECORD_HEADER *) ATOM_COMMON_RECORD_HEADER *record = (ATOM_COMMON_RECORD_HEADER *)
(ctx->bios + data_offset + (ctx->bios + data_offset +

View File

@ -1095,14 +1095,14 @@ void radeon_router_select_ddc_port(struct radeon_connector *radeon_connector)
radeon_i2c_get_byte(radeon_connector->router_bus, radeon_i2c_get_byte(radeon_connector->router_bus,
radeon_connector->router.i2c_addr, radeon_connector->router.i2c_addr,
0x3, &val); 0x3, &val);
val &= radeon_connector->router.ddc_mux_control_pin; val &= ~radeon_connector->router.ddc_mux_control_pin;
radeon_i2c_put_byte(radeon_connector->router_bus, radeon_i2c_put_byte(radeon_connector->router_bus,
radeon_connector->router.i2c_addr, radeon_connector->router.i2c_addr,
0x3, val); 0x3, val);
radeon_i2c_get_byte(radeon_connector->router_bus, radeon_i2c_get_byte(radeon_connector->router_bus,
radeon_connector->router.i2c_addr, radeon_connector->router.i2c_addr,
0x1, &val); 0x1, &val);
val &= radeon_connector->router.ddc_mux_control_pin; val &= ~radeon_connector->router.ddc_mux_control_pin;
val |= radeon_connector->router.ddc_mux_state; val |= radeon_connector->router.ddc_mux_state;
radeon_i2c_put_byte(radeon_connector->router_bus, radeon_i2c_put_byte(radeon_connector->router_bus,
radeon_connector->router.i2c_addr, radeon_connector->router.i2c_addr,
@ -1120,14 +1120,14 @@ void radeon_router_select_cd_port(struct radeon_connector *radeon_connector)
radeon_i2c_get_byte(radeon_connector->router_bus, radeon_i2c_get_byte(radeon_connector->router_bus,
radeon_connector->router.i2c_addr, radeon_connector->router.i2c_addr,
0x3, &val); 0x3, &val);
val &= radeon_connector->router.cd_mux_control_pin; val &= ~radeon_connector->router.cd_mux_control_pin;
radeon_i2c_put_byte(radeon_connector->router_bus, radeon_i2c_put_byte(radeon_connector->router_bus,
radeon_connector->router.i2c_addr, radeon_connector->router.i2c_addr,
0x3, val); 0x3, val);
radeon_i2c_get_byte(radeon_connector->router_bus, radeon_i2c_get_byte(radeon_connector->router_bus,
radeon_connector->router.i2c_addr, radeon_connector->router.i2c_addr,
0x1, &val); 0x1, &val);
val &= radeon_connector->router.cd_mux_control_pin; val &= ~radeon_connector->router.cd_mux_control_pin;
val |= radeon_connector->router.cd_mux_state; val |= radeon_connector->router.cd_mux_state;
radeon_i2c_put_byte(radeon_connector->router_bus, radeon_i2c_put_byte(radeon_connector->router_bus,
radeon_connector->router.i2c_addr, radeon_connector->router.i2c_addr,