aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-11-10 21:25:07 -0500
committerDave Airlie <airlied@redhat.com>2009-12-01 20:36:40 -0500
commitfcec570b27a47e428a9bfc8572ae4c7c230d0488 (patch)
tree10cbff0900c7de4b0cd6c83df5cc220d5844b8a9 /drivers/gpu/drm/radeon/radeon_legacy_encoders.c
parent9b9fe72488a3a637e0550cc888e3f7a8f70e521e (diff)
drm/radeon/kms: add support for external tmds on legacy boards
This enables initialization of external tmds chips on pre-atom and mac systems. Macs are untested. Also, some macs have single link tmds chips while others have dual link tmds chips. We need to figure out which ones have which. This gets external TMDS working on my RS485 and RV380. Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_legacy_encoders.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_encoders.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index 00382122869..2670a9e6502 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -697,6 +697,8 @@ static void radeon_legacy_tmds_ext_mode_set(struct drm_encoder *encoder,
697 /*if (mode->clock > 165000) 697 /*if (mode->clock > 165000)
698 fp2_gen_cntl |= R300_FP2_DVO_DUAL_CHANNEL_EN;*/ 698 fp2_gen_cntl |= R300_FP2_DVO_DUAL_CHANNEL_EN;*/
699 } 699 }
700 if (!radeon_combios_external_tmds_setup(encoder))
701 radeon_external_tmds_setup(encoder);
700 } 702 }
701 703
702 if (radeon_crtc->crtc_id == 0) { 704 if (radeon_crtc->crtc_id == 0) {
@@ -724,6 +726,19 @@ static void radeon_legacy_tmds_ext_mode_set(struct drm_encoder *encoder,
724 radeon_combios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); 726 radeon_combios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id);
725} 727}
726 728
729static void radeon_ext_tmds_enc_destroy(struct drm_encoder *encoder)
730{
731 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
732 struct radeon_encoder_ext_tmds *tmds = radeon_encoder->enc_priv;
733 if (tmds) {
734 if (tmds->i2c_bus)
735 radeon_i2c_destroy(tmds->i2c_bus);
736 }
737 kfree(radeon_encoder->enc_priv);
738 drm_encoder_cleanup(encoder);
739 kfree(radeon_encoder);
740}
741
727static const struct drm_encoder_helper_funcs radeon_legacy_tmds_ext_helper_funcs = { 742static const struct drm_encoder_helper_funcs radeon_legacy_tmds_ext_helper_funcs = {
728 .dpms = radeon_legacy_tmds_ext_dpms, 743 .dpms = radeon_legacy_tmds_ext_dpms,
729 .mode_fixup = radeon_legacy_tmds_ext_mode_fixup, 744 .mode_fixup = radeon_legacy_tmds_ext_mode_fixup,
@@ -735,7 +750,7 @@ static const struct drm_encoder_helper_funcs radeon_legacy_tmds_ext_helper_funcs
735 750
736 751
737static const struct drm_encoder_funcs radeon_legacy_tmds_ext_enc_funcs = { 752static const struct drm_encoder_funcs radeon_legacy_tmds_ext_enc_funcs = {
738 .destroy = radeon_enc_destroy, 753 .destroy = radeon_ext_tmds_enc_destroy,
739}; 754};
740 755
741static bool radeon_legacy_tv_dac_mode_fixup(struct drm_encoder *encoder, 756static bool radeon_legacy_tv_dac_mode_fixup(struct drm_encoder *encoder,
@@ -1302,6 +1317,29 @@ static struct radeon_encoder_int_tmds *radeon_legacy_get_tmds_info(struct radeon
1302 return tmds; 1317 return tmds;
1303} 1318}
1304 1319
1320static struct radeon_encoder_ext_tmds *radeon_legacy_get_ext_tmds_info(struct radeon_encoder *encoder)
1321{
1322 struct drm_device *dev = encoder->base.dev;
1323 struct radeon_device *rdev = dev->dev_private;
1324 struct radeon_encoder_ext_tmds *tmds = NULL;
1325 bool ret;
1326
1327 if (rdev->is_atom_bios)
1328 return NULL;
1329
1330 tmds = kzalloc(sizeof(struct radeon_encoder_ext_tmds), GFP_KERNEL);
1331
1332 if (!tmds)
1333 return NULL;
1334
1335 ret = radeon_legacy_get_ext_tmds_info_from_combios(encoder, tmds);
1336
1337 if (ret == false)
1338 radeon_legacy_get_ext_tmds_info_from_table(encoder, tmds);
1339
1340 return tmds;
1341}
1342
1305void 1343void
1306radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t supported_device) 1344radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t supported_device)
1307{ 1345{
@@ -1373,7 +1411,7 @@ radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t
1373 drm_encoder_init(dev, encoder, &radeon_legacy_tmds_ext_enc_funcs, DRM_MODE_ENCODER_TMDS); 1411 drm_encoder_init(dev, encoder, &radeon_legacy_tmds_ext_enc_funcs, DRM_MODE_ENCODER_TMDS);
1374 drm_encoder_helper_add(encoder, &radeon_legacy_tmds_ext_helper_funcs); 1412 drm_encoder_helper_add(encoder, &radeon_legacy_tmds_ext_helper_funcs);
1375 if (!rdev->is_atom_bios) 1413 if (!rdev->is_atom_bios)
1376 radeon_combios_get_ext_tmds_info(radeon_encoder); 1414 radeon_encoder->enc_priv = radeon_legacy_get_ext_tmds_info(radeon_encoder);
1377 break; 1415 break;
1378 } 1416 }
1379} 1417}