Commit 5137ee94 authored by Alex Deucher's avatar Alex Deucher Committed by Dave Airlie

drm/radeon/kms: rework encoder handling

On most newer asics, digital encoders have two links each
and they can be used independantly.  As such, treat them as
separate encoders otherwise the individual links will not
get programmed properly at modeset time.
Signed-off-by: default avatarAlex Deucher <alexdeucher@gmail.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent fbee67a6
...@@ -610,7 +610,7 @@ void dp_link_train(struct drm_encoder *encoder, ...@@ -610,7 +610,7 @@ void dp_link_train(struct drm_encoder *encoder,
enc_id |= ATOM_DP_CONFIG_DIG2_ENCODER; enc_id |= ATOM_DP_CONFIG_DIG2_ENCODER;
else else
enc_id |= ATOM_DP_CONFIG_DIG1_ENCODER; enc_id |= ATOM_DP_CONFIG_DIG1_ENCODER;
if (dig_connector->linkb) if (dig->linkb)
enc_id |= ATOM_DP_CONFIG_LINK_B; enc_id |= ATOM_DP_CONFIG_LINK_B;
else else
enc_id |= ATOM_DP_CONFIG_LINK_A; enc_id |= ATOM_DP_CONFIG_LINK_A;
......
...@@ -32,11 +32,11 @@ ...@@ -32,11 +32,11 @@
/* from radeon_encoder.c */ /* from radeon_encoder.c */
extern uint32_t extern uint32_t
radeon_get_encoder_id(struct drm_device *dev, uint32_t supported_device, radeon_get_encoder_enum(struct drm_device *dev, uint32_t supported_device,
uint8_t dac); uint8_t dac);
extern void radeon_link_encoder_connector(struct drm_device *dev); extern void radeon_link_encoder_connector(struct drm_device *dev);
extern void extern void
radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_id, radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum,
uint32_t supported_device); uint32_t supported_device);
/* from radeon_connector.c */ /* from radeon_connector.c */
...@@ -46,14 +46,14 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -46,14 +46,14 @@ radeon_add_atom_connector(struct drm_device *dev,
uint32_t supported_device, uint32_t supported_device,
int connector_type, int connector_type,
struct radeon_i2c_bus_rec *i2c_bus, struct radeon_i2c_bus_rec *i2c_bus,
bool linkb, uint32_t igp_lane_info, uint32_t igp_lane_info,
uint16_t connector_object_id, uint16_t connector_object_id,
struct radeon_hpd *hpd, struct radeon_hpd *hpd,
struct radeon_router *router); struct radeon_router *router);
/* from radeon_legacy_encoder.c */ /* from radeon_legacy_encoder.c */
extern void extern void
radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id, radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_enum,
uint32_t supported_device); uint32_t supported_device);
union atom_supported_devices { union atom_supported_devices {
...@@ -479,7 +479,6 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) ...@@ -479,7 +479,6 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
int i, j, k, path_size, device_support; int i, j, k, path_size, device_support;
int connector_type; int connector_type;
u16 igp_lane_info, conn_id, connector_object_id; u16 igp_lane_info, conn_id, connector_object_id;
bool linkb;
struct radeon_i2c_bus_rec ddc_bus; struct radeon_i2c_bus_rec ddc_bus;
struct radeon_router router; struct radeon_router router;
struct radeon_gpio_rec gpio; struct radeon_gpio_rec gpio;
...@@ -512,7 +511,7 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) ...@@ -512,7 +511,7 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
addr += path_size; addr += path_size;
path = (ATOM_DISPLAY_OBJECT_PATH *) addr; path = (ATOM_DISPLAY_OBJECT_PATH *) addr;
path_size += le16_to_cpu(path->usSize); path_size += le16_to_cpu(path->usSize);
linkb = false;
if (device_support & le16_to_cpu(path->usDeviceTag)) { if (device_support & le16_to_cpu(path->usDeviceTag)) {
uint8_t con_obj_id, con_obj_num, con_obj_type; uint8_t con_obj_id, con_obj_num, con_obj_type;
...@@ -603,13 +602,10 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) ...@@ -603,13 +602,10 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
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) {
if (grph_obj_num == 2) u16 encoder_obj = le16_to_cpu(path->usGraphicObjIds[j]);
linkb = true;
else
linkb = false;
radeon_add_atom_encoder(dev, radeon_add_atom_encoder(dev,
grph_obj_id, encoder_obj,
le16_to_cpu le16_to_cpu
(path-> (path->
usDeviceTag)); usDeviceTag));
...@@ -746,7 +742,7 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) ...@@ -746,7 +742,7 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
le16_to_cpu(path-> le16_to_cpu(path->
usDeviceTag), usDeviceTag),
connector_type, &ddc_bus, connector_type, &ddc_bus,
linkb, igp_lane_info, igp_lane_info,
connector_object_id, connector_object_id,
&hpd, &hpd,
&router); &router);
...@@ -935,13 +931,13 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct ...@@ -935,13 +931,13 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
if (ASIC_IS_AVIVO(rdev) || radeon_r4xx_atom) if (ASIC_IS_AVIVO(rdev) || radeon_r4xx_atom)
radeon_add_atom_encoder(dev, radeon_add_atom_encoder(dev,
radeon_get_encoder_id(dev, radeon_get_encoder_enum(dev,
(1 << i), (1 << i),
dac), dac),
(1 << i)); (1 << i));
else else
radeon_add_legacy_encoder(dev, radeon_add_legacy_encoder(dev,
radeon_get_encoder_id(dev, radeon_get_encoder_enum(dev,
(1 << i), (1 << i),
dac), dac),
(1 << i)); (1 << i));
...@@ -998,7 +994,7 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct ...@@ -998,7 +994,7 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
bios_connectors[i]. bios_connectors[i].
connector_type, connector_type,
&bios_connectors[i].ddc_bus, &bios_connectors[i].ddc_bus,
false, 0, 0,
connector_object_id, connector_object_id,
&bios_connectors[i].hpd, &bios_connectors[i].hpd,
&router); &router);
...@@ -1307,6 +1303,7 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct ...@@ -1307,6 +1303,7 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct
union lvds_info *lvds_info; union lvds_info *lvds_info;
uint8_t frev, crev; uint8_t frev, crev;
struct radeon_encoder_atom_dig *lvds = NULL; struct radeon_encoder_atom_dig *lvds = NULL;
int encoder_enum = (encoder->encoder_enum & ENUM_ID_MASK) >> ENUM_ID_SHIFT;
if (atom_parse_data_header(mode_info->atom_context, index, NULL, if (atom_parse_data_header(mode_info->atom_context, index, NULL,
&frev, &crev, &data_offset)) { &frev, &crev, &data_offset)) {
...@@ -1370,6 +1367,12 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct ...@@ -1370,6 +1367,12 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct
} }
encoder->native_mode = lvds->native_mode; encoder->native_mode = lvds->native_mode;
if (encoder_enum == 2)
lvds->linkb = true;
else
lvds->linkb = false;
} }
return lvds; return lvds;
} }
......
This diff is collapsed.
...@@ -1037,7 +1037,6 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1037,7 +1037,6 @@ radeon_add_atom_connector(struct drm_device *dev,
uint32_t supported_device, uint32_t supported_device,
int connector_type, int connector_type,
struct radeon_i2c_bus_rec *i2c_bus, struct radeon_i2c_bus_rec *i2c_bus,
bool linkb,
uint32_t igp_lane_info, uint32_t igp_lane_info,
uint16_t connector_object_id, uint16_t connector_object_id,
struct radeon_hpd *hpd, struct radeon_hpd *hpd,
...@@ -1128,7 +1127,6 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1128,7 +1127,6 @@ radeon_add_atom_connector(struct drm_device *dev,
radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL);
if (!radeon_dig_connector) if (!radeon_dig_connector)
goto failed; goto failed;
radeon_dig_connector->linkb = linkb;
radeon_dig_connector->igp_lane_info = igp_lane_info; radeon_dig_connector->igp_lane_info = igp_lane_info;
radeon_connector->con_priv = radeon_dig_connector; radeon_connector->con_priv = radeon_dig_connector;
drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type);
...@@ -1158,7 +1156,6 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1158,7 +1156,6 @@ radeon_add_atom_connector(struct drm_device *dev,
radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL);
if (!radeon_dig_connector) if (!radeon_dig_connector)
goto failed; goto failed;
radeon_dig_connector->linkb = linkb;
radeon_dig_connector->igp_lane_info = igp_lane_info; radeon_dig_connector->igp_lane_info = igp_lane_info;
radeon_connector->con_priv = radeon_dig_connector; radeon_connector->con_priv = radeon_dig_connector;
drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type);
...@@ -1182,7 +1179,6 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1182,7 +1179,6 @@ radeon_add_atom_connector(struct drm_device *dev,
radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL);
if (!radeon_dig_connector) if (!radeon_dig_connector)
goto failed; goto failed;
radeon_dig_connector->linkb = linkb;
radeon_dig_connector->igp_lane_info = igp_lane_info; radeon_dig_connector->igp_lane_info = igp_lane_info;
radeon_connector->con_priv = radeon_dig_connector; radeon_connector->con_priv = radeon_dig_connector;
drm_connector_init(dev, &radeon_connector->base, &radeon_dp_connector_funcs, connector_type); drm_connector_init(dev, &radeon_connector->base, &radeon_dp_connector_funcs, connector_type);
...@@ -1229,7 +1225,6 @@ radeon_add_atom_connector(struct drm_device *dev, ...@@ -1229,7 +1225,6 @@ radeon_add_atom_connector(struct drm_device *dev,
radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL);
if (!radeon_dig_connector) if (!radeon_dig_connector)
goto failed; goto failed;
radeon_dig_connector->linkb = linkb;
radeon_dig_connector->igp_lane_info = igp_lane_info; radeon_dig_connector->igp_lane_info = igp_lane_info;
radeon_connector->con_priv = radeon_dig_connector; radeon_connector->con_priv = radeon_dig_connector;
drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type);
......
...@@ -81,7 +81,7 @@ void radeon_setup_encoder_clones(struct drm_device *dev) ...@@ -81,7 +81,7 @@ void radeon_setup_encoder_clones(struct drm_device *dev)
} }
uint32_t uint32_t
radeon_get_encoder_id(struct drm_device *dev, uint32_t supported_device, uint8_t dac) radeon_get_encoder_enum(struct drm_device *dev, uint32_t supported_device, uint8_t dac)
{ {
struct radeon_device *rdev = dev->dev_private; struct radeon_device *rdev = dev->dev_private;
uint32_t ret = 0; uint32_t ret = 0;
...@@ -97,59 +97,59 @@ radeon_get_encoder_id(struct drm_device *dev, uint32_t supported_device, uint8_t ...@@ -97,59 +97,59 @@ radeon_get_encoder_id(struct drm_device *dev, uint32_t supported_device, uint8_t
if ((rdev->family == CHIP_RS300) || if ((rdev->family == CHIP_RS300) ||
(rdev->family == CHIP_RS400) || (rdev->family == CHIP_RS400) ||
(rdev->family == CHIP_RS480)) (rdev->family == CHIP_RS480))
ret = ENCODER_OBJECT_ID_INTERNAL_DAC2; ret = ENCODER_INTERNAL_DAC2_ENUM_ID1;
else if (ASIC_IS_AVIVO(rdev)) else if (ASIC_IS_AVIVO(rdev))
ret = ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1; ret = ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1;
else else
ret = ENCODER_OBJECT_ID_INTERNAL_DAC1; ret = ENCODER_INTERNAL_DAC1_ENUM_ID1;
break; break;
case 2: /* dac b */ case 2: /* dac b */
if (ASIC_IS_AVIVO(rdev)) if (ASIC_IS_AVIVO(rdev))
ret = ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2; ret = ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1;
else { else {
/*if (rdev->family == CHIP_R200) /*if (rdev->family == CHIP_R200)
ret = ENCODER_OBJECT_ID_INTERNAL_DVO1; ret = ENCODER_INTERNAL_DVO1_ENUM_ID1;
else*/ else*/
ret = ENCODER_OBJECT_ID_INTERNAL_DAC2; ret = ENCODER_INTERNAL_DAC2_ENUM_ID1;
} }
break; break;
case 3: /* external dac */ case 3: /* external dac */
if (ASIC_IS_AVIVO(rdev)) if (ASIC_IS_AVIVO(rdev))
ret = ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1; ret = ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1;
else else
ret = ENCODER_OBJECT_ID_INTERNAL_DVO1; ret = ENCODER_INTERNAL_DVO1_ENUM_ID1;
break; break;
} }
break; break;
case ATOM_DEVICE_LCD1_SUPPORT: case ATOM_DEVICE_LCD1_SUPPORT:
if (ASIC_IS_AVIVO(rdev)) if (ASIC_IS_AVIVO(rdev))
ret = ENCODER_OBJECT_ID_INTERNAL_LVTM1; ret = ENCODER_INTERNAL_LVTM1_ENUM_ID1;
else else
ret = ENCODER_OBJECT_ID_INTERNAL_LVDS; ret = ENCODER_INTERNAL_LVDS_ENUM_ID1;
break; break;
case ATOM_DEVICE_DFP1_SUPPORT: case ATOM_DEVICE_DFP1_SUPPORT:
if ((rdev->family == CHIP_RS300) || if ((rdev->family == CHIP_RS300) ||
(rdev->family == CHIP_RS400) || (rdev->family == CHIP_RS400) ||
(rdev->family == CHIP_RS480)) (rdev->family == CHIP_RS480))
ret = ENCODER_OBJECT_ID_INTERNAL_DVO1; ret = ENCODER_INTERNAL_DVO1_ENUM_ID1;
else if (ASIC_IS_AVIVO(rdev)) else if (ASIC_IS_AVIVO(rdev))
ret = ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1; ret = ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1;
else else
ret = ENCODER_OBJECT_ID_INTERNAL_TMDS1; ret = ENCODER_INTERNAL_TMDS1_ENUM_ID1;
break; break;
case ATOM_DEVICE_LCD2_SUPPORT: case ATOM_DEVICE_LCD2_SUPPORT:
case ATOM_DEVICE_DFP2_SUPPORT: case ATOM_DEVICE_DFP2_SUPPORT:
if ((rdev->family == CHIP_RS600) || if ((rdev->family == CHIP_RS600) ||
(rdev->family == CHIP_RS690) || (rdev->family == CHIP_RS690) ||
(rdev->family == CHIP_RS740)) (rdev->family == CHIP_RS740))
ret = ENCODER_OBJECT_ID_INTERNAL_DDI; ret = ENCODER_INTERNAL_DDI_ENUM_ID1;
else if (ASIC_IS_AVIVO(rdev)) else if (ASIC_IS_AVIVO(rdev))
ret = ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1; ret = ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1;
else else
ret = ENCODER_OBJECT_ID_INTERNAL_DVO1; ret = ENCODER_INTERNAL_DVO1_ENUM_ID1;
break; break;
case ATOM_DEVICE_DFP3_SUPPORT: case ATOM_DEVICE_DFP3_SUPPORT:
ret = ENCODER_OBJECT_ID_INTERNAL_LVTM1; ret = ENCODER_INTERNAL_LVTM1_ENUM_ID1;
break; break;
} }
...@@ -562,7 +562,7 @@ atombios_digital_setup(struct drm_encoder *encoder, int action) ...@@ -562,7 +562,7 @@ atombios_digital_setup(struct drm_encoder *encoder, int action)
if (dig->lvds_misc & ATOM_PANEL_MISC_888RGB) if (dig->lvds_misc & ATOM_PANEL_MISC_888RGB)
args.v1.ucMisc |= (1 << 1); args.v1.ucMisc |= (1 << 1);
} else { } else {
if (dig_connector->linkb) if (dig->linkb)
args.v1.ucMisc |= PANEL_ENCODER_MISC_TMDS_LINKB; args.v1.ucMisc |= PANEL_ENCODER_MISC_TMDS_LINKB;
if (radeon_encoder->pixel_clock > 165000) if (radeon_encoder->pixel_clock > 165000)
args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL; args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL;
...@@ -601,7 +601,7 @@ atombios_digital_setup(struct drm_encoder *encoder, int action) ...@@ -601,7 +601,7 @@ atombios_digital_setup(struct drm_encoder *encoder, int action)
args.v2.ucTemporal |= PANEL_ENCODER_TEMPORAL_LEVEL_4; args.v2.ucTemporal |= PANEL_ENCODER_TEMPORAL_LEVEL_4;
} }
} else { } else {
if (dig_connector->linkb) if (dig->linkb)
args.v2.ucMisc |= PANEL_ENCODER_MISC_TMDS_LINKB; args.v2.ucMisc |= PANEL_ENCODER_MISC_TMDS_LINKB;
if (radeon_encoder->pixel_clock > 165000) if (radeon_encoder->pixel_clock > 165000)
args.v2.ucMisc |= PANEL_ENCODER_MISC_DUAL; args.v2.ucMisc |= PANEL_ENCODER_MISC_DUAL;
...@@ -781,7 +781,7 @@ atombios_dig_encoder_setup(struct drm_encoder *encoder, int action) ...@@ -781,7 +781,7 @@ atombios_dig_encoder_setup(struct drm_encoder *encoder, int action)
args.v1.ucConfig = ATOM_ENCODER_CONFIG_V2_TRANSMITTER3; args.v1.ucConfig = ATOM_ENCODER_CONFIG_V2_TRANSMITTER3;
break; break;
} }
if (dig_connector->linkb) if (dig->linkb)
args.v1.ucConfig |= ATOM_ENCODER_CONFIG_LINKB; args.v1.ucConfig |= ATOM_ENCODER_CONFIG_LINKB;
else else
args.v1.ucConfig |= ATOM_ENCODER_CONFIG_LINKA; args.v1.ucConfig |= ATOM_ENCODER_CONFIG_LINKA;
...@@ -864,7 +864,7 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t ...@@ -864,7 +864,7 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t
else else
args.v3.ucLaneNum = 4; args.v3.ucLaneNum = 4;
if (dig_connector->linkb) { if (dig->linkb) {
args.v3.acConfig.ucLinkSel = 1; args.v3.acConfig.ucLinkSel = 1;
args.v3.acConfig.ucEncoderSel = 1; args.v3.acConfig.ucEncoderSel = 1;
} }
...@@ -904,7 +904,7 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t ...@@ -904,7 +904,7 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t
} }
} else if (ASIC_IS_DCE32(rdev)) { } else if (ASIC_IS_DCE32(rdev)) {
args.v2.acConfig.ucEncoderSel = dig->dig_encoder; args.v2.acConfig.ucEncoderSel = dig->dig_encoder;
if (dig_connector->linkb) if (dig->linkb)
args.v2.acConfig.ucLinkSel = 1; args.v2.acConfig.ucLinkSel = 1;
switch (radeon_encoder->encoder_id) { switch (radeon_encoder->encoder_id) {
...@@ -954,7 +954,7 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t ...@@ -954,7 +954,7 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t
} }
} }
if (dig_connector->linkb) if (dig->linkb)
args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LINKB; args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LINKB;
else else
args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LINKA; args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LINKA;
...@@ -1290,24 +1290,22 @@ static int radeon_atom_pick_dig_encoder(struct drm_encoder *encoder) ...@@ -1290,24 +1290,22 @@ static int radeon_atom_pick_dig_encoder(struct drm_encoder *encoder)
uint32_t dig_enc_in_use = 0; uint32_t dig_enc_in_use = 0;
if (ASIC_IS_DCE4(rdev)) { if (ASIC_IS_DCE4(rdev)) {
struct radeon_connector_atom_dig *dig_connector = dig = radeon_encoder->enc_priv;
radeon_get_atom_connector_priv_from_encoder(encoder);
switch (radeon_encoder->encoder_id) { switch (radeon_encoder->encoder_id) {
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
if (dig_connector->linkb) if (dig->linkb)
return 1; return 1;
else else
return 0; return 0;
break; break;
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
if (dig_connector->linkb) if (dig->linkb)
return 3; return 3;
else else
return 2; return 2;
break; break;
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
if (dig_connector->linkb) if (dig->linkb)
return 5; return 5;
else else
return 4; return 4;
...@@ -1641,6 +1639,7 @@ radeon_atombios_set_dac_info(struct radeon_encoder *radeon_encoder) ...@@ -1641,6 +1639,7 @@ radeon_atombios_set_dac_info(struct radeon_encoder *radeon_encoder)
struct radeon_encoder_atom_dig * struct radeon_encoder_atom_dig *
radeon_atombios_set_dig_info(struct radeon_encoder *radeon_encoder) radeon_atombios_set_dig_info(struct radeon_encoder *radeon_encoder)
{ {
int encoder_enum = (radeon_encoder->encoder_enum & ENUM_ID_MASK) >> ENUM_ID_SHIFT;
struct radeon_encoder_atom_dig *dig = kzalloc(sizeof(struct radeon_encoder_atom_dig), GFP_KERNEL); struct radeon_encoder_atom_dig *dig = kzalloc(sizeof(struct radeon_encoder_atom_dig), GFP_KERNEL);
if (!dig) if (!dig)
...@@ -1650,11 +1649,16 @@ radeon_atombios_set_dig_info(struct radeon_encoder *radeon_encoder) ...@@ -1650,11 +1649,16 @@ radeon_atombios_set_dig_info(struct radeon_encoder *radeon_encoder)
dig->coherent_mode = true; dig->coherent_mode = true;
dig->dig_encoder = -1; dig->dig_encoder = -1;
if (encoder_enum == 2)
dig->linkb = true;
else
dig->linkb = false;
return dig; return dig;
} }
void void
radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t supported_device) radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum, uint32_t supported_device)
{ {
struct radeon_device *rdev = dev->dev_private; struct radeon_device *rdev = dev->dev_private;
struct drm_encoder *encoder; struct drm_encoder *encoder;
...@@ -1663,7 +1667,7 @@ radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t su ...@@ -1663,7 +1667,7 @@ radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t su
/* see if we already added it */ /* see if we already added it */
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
radeon_encoder = to_radeon_encoder(encoder); radeon_encoder = to_radeon_encoder(encoder);
if (radeon_encoder->encoder_id == encoder_id) { if (radeon_encoder->encoder_enum == encoder_enum) {
radeon_encoder->devices |= supported_device; radeon_encoder->devices |= supported_device;
return; return;
} }
...@@ -1691,7 +1695,8 @@ radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t su ...@@ -1691,7 +1695,8 @@ radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t su
radeon_encoder->enc_priv = NULL; radeon_encoder->enc_priv = NULL;
radeon_encoder->encoder_id = encoder_id; radeon_encoder->encoder_enum = encoder_enum;
radeon_encoder->encoder_id = (encoder_enum & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT;
radeon_encoder->devices = supported_device; radeon_encoder->devices = supported_device;
radeon_encoder->rmx_type = RMX_OFF; radeon_encoder->rmx_type = RMX_OFF;
radeon_encoder->underscan_type = UNDERSCAN_OFF; radeon_encoder->underscan_type = UNDERSCAN_OFF;
......
...@@ -1345,7 +1345,7 @@ static struct radeon_encoder_ext_tmds *radeon_legacy_get_ext_tmds_info(struct ra ...@@ -1345,7 +1345,7 @@ static struct radeon_encoder_ext_tmds *radeon_legacy_get_ext_tmds_info(struct ra
} }
void void
radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t supported_device) radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_enum, uint32_t supported_device)
{ {
struct radeon_device *rdev = dev->dev_private; struct radeon_device *rdev = dev->dev_private;
struct drm_encoder *encoder; struct drm_encoder *encoder;
...@@ -1354,7 +1354,7 @@ radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t ...@@ -1354,7 +1354,7 @@ radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t
/* see if we already added it */ /* see if we already added it */
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
radeon_encoder = to_radeon_encoder(encoder); radeon_encoder = to_radeon_encoder(encoder);
if (radeon_encoder->encoder_id == encoder_id) { if (radeon_encoder->encoder_enum == encoder_enum) {
radeon_encoder->devices |= supported_device; radeon_encoder->devices |= supported_device;
return; return;
} }
...@@ -1374,7 +1374,8 @@ radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t ...@@ -1374,7 +1374,8 @@ radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t
radeon_encoder->enc_priv = NULL; radeon_encoder->enc_priv = NULL;
radeon_encoder->encoder_id = encoder_id; radeon_encoder->encoder_enum = encoder_enum;
radeon_encoder->encoder_id = (encoder_enum & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT;
radeon_encoder->devices = supported_device; radeon_encoder->devices = supported_device;
radeon_encoder->rmx_type = RMX_OFF; radeon_encoder->rmx_type = RMX_OFF;
......
...@@ -342,6 +342,7 @@ struct radeon_atom_ss { ...@@ -342,6 +342,7 @@ struct radeon_atom_ss {
}; };
struct radeon_encoder_atom_dig { struct radeon_encoder_atom_dig {
bool linkb;
/* atom dig */ /* atom dig */
bool coherent_mode; bool coherent_mode;
int dig_encoder; /* -1 disabled, 0 DIGA, 1 DIGB */ int dig_encoder; /* -1 disabled, 0 DIGA, 1 DIGB */
...@@ -360,6 +361,7 @@ struct radeon_encoder_atom_dac { ...@@ -360,6 +361,7 @@ struct radeon_encoder_atom_dac {
struct radeon_encoder { struct radeon_encoder {
struct drm_encoder base; struct drm_encoder base;
uint32_t encoder_enum;
uint32_t encoder_id; uint32_t encoder_id;
uint32_t devices; uint32_t devices;
uint32_t active_device; uint32_t active_device;
...@@ -378,7 +380,6 @@ struct radeon_encoder { ...@@ -378,7 +380,6 @@ struct radeon_encoder {
struct radeon_connector_atom_dig { struct radeon_connector_atom_dig {
uint32_t igp_lane_info; uint32_t igp_lane_info;
bool linkb;
/* displayport */ /* displayport */
struct radeon_i2c_chan *dp_i2c_bus; struct radeon_i2c_chan *dp_i2c_bus;
u8 dpcd[8]; u8 dpcd[8];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment