The Apple iMac11,1 (27-inch, Late 2009) uses a Mobility Radeon HD 4850
(RV770/DCE3.1) with a 2560x1440 internal panel on an internal
DisplayPort path. Without this fix the display stays dark under KMS.

The same problem already exists for iMac10,1 and iMac11,2. Three fixes:

1. Introduce ASIC_IS_DCE31() for CHIP_RV770 and newer. Note that
   CHIP_RV770 precedes CHIP_RV730 in the enum, so ASIC_IS_DCE31()
   subsumes ASIC_IS_DCE32().

2. Extend the Link B encoder quirk from ASIC_IS_DCE32() to
   ASIC_IS_DCE31() and add iMac11,1 to the DMI list.

3. The 2560x1440 panel needs RADEON_PLL_USE_FRAC_FB_DIV and
   ATOM_ENCODER_CMD_DP_VIDEO_ON. These are limited to iMac11,1
   via dmi_match() to avoid affecting other DCE3.1 boards.

Signed-off-by: Gilles Risch <[email protected]>
---
 drivers/gpu/drm/radeon/atombios_crtc.c     |  5 ++++-
 drivers/gpu/drm/radeon/atombios_encoders.c | 11 ++++++-----
 drivers/gpu/drm/radeon/radeon.h            |  1 +
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c 
b/drivers/gpu/drm/radeon/atombios_crtc.c
index 2fc0334e0..075eba2d4 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -24,6 +24,8 @@
  *          Alex Deucher
  */
 
+#include <linux/dmi.h>
+
 #include <drm/drm_fixed.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
@@ -594,7 +596,8 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
                if (((rdev->family == CHIP_RS780) || (rdev->family == 
CHIP_RS880))
                    && !radeon_crtc->ss_enabled)
                        radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV;
-               if (ASIC_IS_DCE32(rdev) && mode->clock > 165000)
+               if ((ASIC_IS_DCE32(rdev) || dmi_match(DMI_PRODUCT_NAME, 
"iMac11,1"))
+                   && mode->clock > 165000)
                        radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV;
        } else {
                radeon_crtc->pll_flags |= RADEON_PLL_LEGACY;
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c 
b/drivers/gpu/drm/radeon/atombios_encoders.c
index 5cfd8fcfa..4de60559f 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -1707,7 +1707,7 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, 
int mode)
                if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(encoder)) && 
connector) {
                        /* DP_SET_POWER_D0 is set in radeon_dp_link_train */
                        radeon_dp_link_train(encoder, connector);
-                       if (ASIC_IS_DCE4(rdev))
+                       if (ASIC_IS_DCE4(rdev) || dmi_match(DMI_PRODUCT_NAME, 
"iMac11,1"))
                                atombios_dig_encoder_setup(encoder, 
ATOM_ENCODER_CMD_DP_VIDEO_ON, 0);
                }
                if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
@@ -2123,12 +2123,13 @@ int radeon_atom_pick_dig_encoder(struct drm_encoder 
*encoder, int fe_idx)
        }
 
        /*
-        * On DCE32 any encoder can drive any block so usually just use crtc id,
-        * but Apple thinks different at least on iMac10,1 and iMac11,2, so 
there use linkb,
-        * otherwise the internal eDP panel will stay dark.
+        * On DCE31 and DCE32 any encoder can drive any block so usually just 
use crtc id,
+        * but Apple thinks different at least on iMac10,1, iMac11,1 and 
iMac11,2,
+        * so there use linkb, otherwise the internal eDP panel will stay dark.
         */
-       if (ASIC_IS_DCE32(rdev)) {
+       if (ASIC_IS_DCE31(rdev)) {
                if (dmi_match(DMI_PRODUCT_NAME, "iMac10,1") ||
+                   dmi_match(DMI_PRODUCT_NAME, "iMac11,1") ||
                    dmi_match(DMI_PRODUCT_NAME, "iMac11,2"))
                        enc_idx = (dig->linkb) ? 1 : 0;
                else
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 527b9d19d..6b7c0abe4 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -2625,6 +2625,7 @@ void r100_pll_errata_after_index(struct radeon_device 
*rdev);
                            (rdev->family == CHIP_RS740)  ||    \
                            (rdev->family >= CHIP_R600))
 #define ASIC_IS_DCE3(rdev) ((rdev->family >= CHIP_RV620))
+#define ASIC_IS_DCE31(rdev) ((rdev->family >= CHIP_RV770))
 #define ASIC_IS_DCE32(rdev) ((rdev->family >= CHIP_RV730))
 #define ASIC_IS_DCE4(rdev) ((rdev->family >= CHIP_CEDAR))
 #define ASIC_IS_DCE41(rdev) ((rdev->family >= CHIP_PALM) && \

base-commit: e7ae89a0c97ce2b68b0983cd01eda67cf373517d
-- 
2.47.3

Reply via email to