diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2011-06-13 17:13:33 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-06-16 19:28:02 -0400 |
commit | d629a3ceb4fc1ab5aab737b964100d114aba1173 (patch) | |
tree | 9bf07b4c4e2552b070283a347fb6c314c813dffa | |
parent | 7ec478f835a391d27491493ebfd91f2bed98dbd9 (diff) |
drm/radeon/kms: add support for load detection on dp bridges
dp to vga bridges for example.
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_connectors.c | 20 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_encoders.c | 49 |
2 files changed, 68 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index c04e18ee8a87..dc7852b3c5ca 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -1235,6 +1235,16 @@ radeon_dp_detect(struct drm_connector *connector, bool force) | |||
1235 | ret = connector_status_connected; | 1235 | ret = connector_status_connected; |
1236 | } | 1236 | } |
1237 | } | 1237 | } |
1238 | |||
1239 | if ((ret == connector_status_disconnected) && | ||
1240 | radeon_connector->dac_load_detect) { | ||
1241 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | ||
1242 | struct drm_encoder_helper_funcs *encoder_funcs; | ||
1243 | if (encoder) { | ||
1244 | encoder_funcs = encoder->helper_private; | ||
1245 | ret = encoder_funcs->detect(encoder, connector); | ||
1246 | } | ||
1247 | } | ||
1238 | } | 1248 | } |
1239 | 1249 | ||
1240 | radeon_connector_update_scratch_regs(connector, ret); | 1250 | radeon_connector_update_scratch_regs(connector, ret); |
@@ -1408,6 +1418,10 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1408 | default: | 1418 | default: |
1409 | connector->interlace_allowed = true; | 1419 | connector->interlace_allowed = true; |
1410 | connector->doublescan_allowed = true; | 1420 | connector->doublescan_allowed = true; |
1421 | radeon_connector->dac_load_detect = true; | ||
1422 | drm_connector_attach_property(&radeon_connector->base, | ||
1423 | rdev->mode_info.load_detect_property, | ||
1424 | 1); | ||
1411 | break; | 1425 | break; |
1412 | case DRM_MODE_CONNECTOR_DVII: | 1426 | case DRM_MODE_CONNECTOR_DVII: |
1413 | case DRM_MODE_CONNECTOR_DVID: | 1427 | case DRM_MODE_CONNECTOR_DVID: |
@@ -1429,6 +1443,12 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1429 | connector->doublescan_allowed = true; | 1443 | connector->doublescan_allowed = true; |
1430 | else | 1444 | else |
1431 | connector->doublescan_allowed = false; | 1445 | connector->doublescan_allowed = false; |
1446 | if (connector_type == DRM_MODE_CONNECTOR_DVII) { | ||
1447 | radeon_connector->dac_load_detect = true; | ||
1448 | drm_connector_attach_property(&radeon_connector->base, | ||
1449 | rdev->mode_info.load_detect_property, | ||
1450 | 1); | ||
1451 | } | ||
1432 | break; | 1452 | break; |
1433 | case DRM_MODE_CONNECTOR_LVDS: | 1453 | case DRM_MODE_CONNECTOR_LVDS: |
1434 | case DRM_MODE_CONNECTOR_eDP: | 1454 | case DRM_MODE_CONNECTOR_eDP: |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 39fa2258f235..d3449443aa1f 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -1999,6 +1999,53 @@ radeon_atom_dac_detect(struct drm_encoder *encoder, struct drm_connector *connec | |||
1999 | return connector_status_disconnected; | 1999 | return connector_status_disconnected; |
2000 | } | 2000 | } |
2001 | 2001 | ||
2002 | static enum drm_connector_status | ||
2003 | radeon_atom_dig_detect(struct drm_encoder *encoder, struct drm_connector *connector) | ||
2004 | { | ||
2005 | struct drm_device *dev = encoder->dev; | ||
2006 | struct radeon_device *rdev = dev->dev_private; | ||
2007 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
2008 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | ||
2009 | struct drm_encoder *ext_encoder = radeon_atom_get_external_encoder(encoder); | ||
2010 | u32 bios_0_scratch; | ||
2011 | |||
2012 | if (!ASIC_IS_DCE4(rdev)) | ||
2013 | return connector_status_unknown; | ||
2014 | |||
2015 | if (!ext_encoder) | ||
2016 | return connector_status_unknown; | ||
2017 | |||
2018 | if ((radeon_connector->devices & ATOM_DEVICE_CRT_SUPPORT) == 0) | ||
2019 | return connector_status_unknown; | ||
2020 | |||
2021 | /* load detect on the dp bridge */ | ||
2022 | atombios_external_encoder_setup(encoder, ext_encoder, | ||
2023 | EXTERNAL_ENCODER_ACTION_V3_DACLOAD_DETECTION); | ||
2024 | |||
2025 | bios_0_scratch = RREG32(R600_BIOS_0_SCRATCH); | ||
2026 | |||
2027 | DRM_DEBUG_KMS("Bios 0 scratch %x %08x\n", bios_0_scratch, radeon_encoder->devices); | ||
2028 | if (radeon_connector->devices & ATOM_DEVICE_CRT1_SUPPORT) { | ||
2029 | if (bios_0_scratch & ATOM_S0_CRT1_MASK) | ||
2030 | return connector_status_connected; | ||
2031 | } | ||
2032 | if (radeon_connector->devices & ATOM_DEVICE_CRT2_SUPPORT) { | ||
2033 | if (bios_0_scratch & ATOM_S0_CRT2_MASK) | ||
2034 | return connector_status_connected; | ||
2035 | } | ||
2036 | if (radeon_connector->devices & ATOM_DEVICE_CV_SUPPORT) { | ||
2037 | if (bios_0_scratch & (ATOM_S0_CV_MASK|ATOM_S0_CV_MASK_A)) | ||
2038 | return connector_status_connected; | ||
2039 | } | ||
2040 | if (radeon_connector->devices & ATOM_DEVICE_TV1_SUPPORT) { | ||
2041 | if (bios_0_scratch & (ATOM_S0_TV1_COMPOSITE | ATOM_S0_TV1_COMPOSITE_A)) | ||
2042 | return connector_status_connected; /* CTV */ | ||
2043 | else if (bios_0_scratch & (ATOM_S0_TV1_SVIDEO | ATOM_S0_TV1_SVIDEO_A)) | ||
2044 | return connector_status_connected; /* STV */ | ||
2045 | } | ||
2046 | return connector_status_disconnected; | ||
2047 | } | ||
2048 | |||
2002 | static void radeon_atom_encoder_prepare(struct drm_encoder *encoder) | 2049 | static void radeon_atom_encoder_prepare(struct drm_encoder *encoder) |
2003 | { | 2050 | { |
2004 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 2051 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
@@ -2162,7 +2209,7 @@ static const struct drm_encoder_helper_funcs radeon_atom_dig_helper_funcs = { | |||
2162 | .mode_set = radeon_atom_encoder_mode_set, | 2209 | .mode_set = radeon_atom_encoder_mode_set, |
2163 | .commit = radeon_atom_encoder_commit, | 2210 | .commit = radeon_atom_encoder_commit, |
2164 | .disable = radeon_atom_encoder_disable, | 2211 | .disable = radeon_atom_encoder_disable, |
2165 | /* no detect for TMDS/LVDS yet */ | 2212 | .detect = radeon_atom_dig_detect, |
2166 | }; | 2213 | }; |
2167 | 2214 | ||
2168 | static const struct drm_encoder_helper_funcs radeon_atom_dac_helper_funcs = { | 2215 | static const struct drm_encoder_helper_funcs radeon_atom_dac_helper_funcs = { |