drm/radeon: Fix eDP for single-display iMac10,1 (v2)

Submitted by Mario Kleiner on July 7, 2017, 2:57 a.m.

Details

Message ID 20170707025704.1864-1-mario.kleiner.de@gmail.com
State New
Headers show
Series "drm/radeon: Fix eDP for single-display iMac10,1 (v2)" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Mario Kleiner July 7, 2017, 2:57 a.m.
The late 2009, 27 inch Apple iMac10,1 has an
internal eDP display and an external Mini-
Displayport output, driven by a DCE-3.2, RV730
Radeon Mobility HD-4670.

The machine worked fine in a dual-display setup
with eDP panel + externally connected HDMI
or DVI-D digital display sink, connected via
MiniDP to DVI or HDMI adapter.

However, booting the machine single-display with
only eDP panel results in a completely black
display - even backlight powering off, as soon as
the radeon modesetting driver loads.

This patch fixes the single dispay eDP case by
assigning encoders based on dig->linkb, similar
to DCE-4+. While this should not be generally
necessary (Alex: "...atom on normal boards
should be able to handle any mapping."), Apple
seems to use some special routing here.

One remaining problem not solved by this patch
is that an external Minidisplayport->DP sink
does still not work on iMac10,1, whereas external
DVI and HDMI sinks continue to work.

The problem affects at least all tested kernels
since Linux 3.13 - didn't test earlier kernels, so
backporting to stable probably makes sense.

v2: With the original patch from 2016, Alex was worried it
    will break other DCE3.2 systems. Use dmi_match() to
    apply this special encoder assignment only for the
    Apple iMac 10,1 from late 2009.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Michel Dänzer <michel.daenzer@amd.com>
Cc: <stable@vger.kernel.org>
---
 drivers/gpu/drm/radeon/atombios_encoders.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index fa4f8f0..e67ed38 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -31,6 +31,7 @@ 
 #include "radeon_asic.h"
 #include "atom.h"
 #include <linux/backlight.h>
+#include <linux/dmi.h>
 
 extern int atom_debug;
 
@@ -2184,9 +2185,17 @@  int radeon_atom_pick_dig_encoder(struct drm_encoder *encoder, int fe_idx)
 		goto assigned;
 	}
 
-	/* on DCE32 and encoder can driver any block so just crtc id */
+	/*
+	 * On DCE32 any encoder can drive any block so usually just use crtc id,
+	 * but Apple thinks different at least on iMac10,1, so there use linkb,
+	 * otherwise the internal eDP panel will stay dark.
+	 */
 	if (ASIC_IS_DCE32(rdev)) {
-		enc_idx = radeon_crtc->crtc_id;
+		if (dmi_match(DMI_PRODUCT_NAME, "iMac10,1"))
+			enc_idx = (dig->linkb) ? 1 : 0;
+		else
+			enc_idx = radeon_crtc->crtc_id;
+
 		goto assigned;
 	}
 

Comments

On Thu, Jul 6, 2017 at 10:57 PM, Mario Kleiner
<mario.kleiner.de@gmail.com> wrote:
> The late 2009, 27 inch Apple iMac10,1 has an
> internal eDP display and an external Mini-
> Displayport output, driven by a DCE-3.2, RV730
> Radeon Mobility HD-4670.
>
> The machine worked fine in a dual-display setup
> with eDP panel + externally connected HDMI
> or DVI-D digital display sink, connected via
> MiniDP to DVI or HDMI adapter.
>
> However, booting the machine single-display with
> only eDP panel results in a completely black
> display - even backlight powering off, as soon as
> the radeon modesetting driver loads.
>
> This patch fixes the single dispay eDP case by
> assigning encoders based on dig->linkb, similar
> to DCE-4+. While this should not be generally
> necessary (Alex: "...atom on normal boards
> should be able to handle any mapping."), Apple
> seems to use some special routing here.
>
> One remaining problem not solved by this patch
> is that an external Minidisplayport->DP sink
> does still not work on iMac10,1, whereas external
> DVI and HDMI sinks continue to work.
>
> The problem affects at least all tested kernels
> since Linux 3.13 - didn't test earlier kernels, so
> backporting to stable probably makes sense.
>
> v2: With the original patch from 2016, Alex was worried it
>     will break other DCE3.2 systems. Use dmi_match() to
>     apply this special encoder assignment only for the
>     Apple iMac 10,1 from late 2009.
>
> Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Michel Dänzer <michel.daenzer@amd.com>
> Cc: <stable@vger.kernel.org>

Applied.  thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/atombios_encoders.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
> index fa4f8f0..e67ed38 100644
> --- a/drivers/gpu/drm/radeon/atombios_encoders.c
> +++ b/drivers/gpu/drm/radeon/atombios_encoders.c
> @@ -31,6 +31,7 @@
>  #include "radeon_asic.h"
>  #include "atom.h"
>  #include <linux/backlight.h>
> +#include <linux/dmi.h>
>
>  extern int atom_debug;
>
> @@ -2184,9 +2185,17 @@ int radeon_atom_pick_dig_encoder(struct drm_encoder *encoder, int fe_idx)
>                 goto assigned;
>         }
>
> -       /* on DCE32 and encoder can driver any block so just crtc id */
> +       /*
> +        * On DCE32 any encoder can drive any block so usually just use crtc id,
> +        * but Apple thinks different at least on iMac10,1, so there use linkb,
> +        * otherwise the internal eDP panel will stay dark.
> +        */
>         if (ASIC_IS_DCE32(rdev)) {
> -               enc_idx = radeon_crtc->crtc_id;
> +               if (dmi_match(DMI_PRODUCT_NAME, "iMac10,1"))
> +                       enc_idx = (dig->linkb) ? 1 : 0;
> +               else
> +                       enc_idx = radeon_crtc->crtc_id;
> +
>                 goto assigned;
>         }
>
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx