drm/radeon/kms: properly set panel mode for eDP
authorAlex Deucher <alexander.deucher@amd.com>
Mon, 31 Oct 2011 12:54:41 +0000 (08:54 -0400)
committerDave Airlie <airlied@redhat.com>
Tue, 1 Nov 2011 16:01:58 +0000 (16:01 +0000)
This should make eDP more reliable.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/atombios_dp.c
include/drm/drm_dp_helper.h

index 79e8ebc0530723e9df8a8aa5f448b3b8068fab62..b5628ce1228b0dab38713cde04e5ba24e6b2b753 100644 (file)
@@ -553,6 +553,7 @@ static void radeon_dp_set_panel_mode(struct drm_encoder *encoder,
 {
        struct drm_device *dev = encoder->dev;
        struct radeon_device *rdev = dev->dev_private;
+       struct radeon_connector *radeon_connector = to_radeon_connector(connector);
        int panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE;
 
        if (!ASIC_IS_DCE4(rdev))
@@ -560,10 +561,20 @@ static void radeon_dp_set_panel_mode(struct drm_encoder *encoder,
 
        if (radeon_connector_encoder_is_dp_bridge(connector))
                panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE;
+       else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
+               u8 tmp = radeon_read_dpcd_reg(radeon_connector, DP_EDP_CONFIGURATION_CAP);
+               if (tmp & 1)
+                       panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE;
+       }
 
        atombios_dig_encoder_setup(encoder,
                                   ATOM_ENCODER_CMD_SETUP_PANEL_MODE,
                                   panel_mode);
+
+       if ((connector->connector_type == DRM_MODE_CONNECTOR_eDP) &&
+           (panel_mode == DP_PANEL_MODE_INTERNAL_DP2_MODE)) {
+               radeon_write_dpcd_reg(radeon_connector, DP_EDP_CONFIGURATION_SET, 1);
+       }
 }
 
 void radeon_dp_set_link_config(struct drm_connector *connector,
index 0d2f727e96be8dd1e29c65e64f06c664f6d1992d..93df2d72750b1878e8822bf8716b77926941ae91 100644 (file)
@@ -72,6 +72,7 @@
 
 #define DP_MAIN_LINK_CHANNEL_CODING         0x006
 
+#define DP_EDP_CONFIGURATION_CAP            0x00d
 #define DP_TRAINING_AUX_RD_INTERVAL         0x00e
 
 #define DP_PSR_SUPPORT                      0x070
 # define DP_CP_IRQ                         (1 << 2)
 # define DP_SINK_SPECIFIC_IRQ              (1 << 6)
 
+#define DP_EDP_CONFIGURATION_SET            0x10a
+
 #define DP_LANE0_1_STATUS                  0x202
 #define DP_LANE2_3_STATUS                  0x203
 # define DP_LANE_CR_DONE                   (1 << 0)