All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org
Cc: Alex Deucher <alexander.deucher@amd.com>
Subject: [PATCH v5 08/12] drm/radeon: Switch DDC when reading the EDID
Date: Mon, 11 Jan 2016 20:09:20 +0100	[thread overview]
Message-ID: <dae71655e8c484fbef492d3389c157975f9622c9.1452525860.git.lukas@wunner.de> (raw)
In-Reply-To: <cover.1452525860.git.lukas@wunner.de>

The pre-retina MacBook Pro uses an LVDS panel and a gmux controller
to switch the panel between its two GPUs. The panel mode in VBIOS
is notoriously bogus on these machines.

Use drm_get_edid_switcheroo() in lieu of drm_get_edid() on LVDS
if the vga_switcheroo handler is capable of temporarily switching
the panel's DDC lines to the discrete GPU. This allows us to retrieve
the EDID if the panel is currently muxed to the integrated GPU.

This only enables EDID probing on the pre-retina MBP (2008 - 2013).
The retina MBP (2012 - present) uses eDP and gmux is not capable of
switching AUX separately from the main link on these models.
This will be addressed in later patches.

List of pre-retina MBPs with dual GPUs, one of them AMD:
    [MBP  8,2 2011  intel SNB + amd turks     pre-retina  15"]
    [MBP  8,3 2011  intel SNB + amd turks     pre-retina  17"]

v3: Commit newly added due to introduction of drm_get_edid_switcheroo()
    wrapper which drivers need to opt-in to.

v5: Rebase on "vga_switcheroo: Add handler flags infrastructure",
    i.e. call drm_get_edid_switcheroo() only if the handler
    indicates that DDC is switchable.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61115
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
 drivers/gpu/drm/radeon/radeon_connectors.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 340f3f5..cfcc099 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -34,6 +34,7 @@
 #include "atom.h"
 
 #include <linux/pm_runtime.h>
+#include <linux/vga_switcheroo.h>
 
 static int radeon_dp_handle_hpd(struct drm_connector *connector)
 {
@@ -344,6 +345,11 @@ static void radeon_connector_get_edid(struct drm_connector *connector)
 		else if (radeon_connector->ddc_bus)
 			radeon_connector->edid = drm_get_edid(&radeon_connector->base,
 							      &radeon_connector->ddc_bus->adapter);
+	} else if (vga_switcheroo_handler_flags() & VGA_SWITCHEROO_CAN_SWITCH_DDC &&
+		   connector->connector_type == DRM_MODE_CONNECTOR_LVDS &&
+		   radeon_connector->ddc_bus) {
+		radeon_connector->edid = drm_get_edid_switcheroo(&radeon_connector->base,
+								 &radeon_connector->ddc_bus->adapter);
 	} else if (radeon_connector->ddc_bus) {
 		radeon_connector->edid = drm_get_edid(&radeon_connector->base,
 						      &radeon_connector->ddc_bus->adapter);
-- 
1.8.5.2 (Apple Git-48)

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-01-11 19:09 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-11 19:09 [PATCH v5 00/12] Enable GPU switching on pre-retina MacBook Pro Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 05/12] drm/edid: Switch DDC when reading the EDID Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 07/12] drm/nouveau: " Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 09/12] apple-gmux: Add helper for presence detect Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 06/12] drm/i915: Switch DDC when reading the EDID Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 10/12] drm/i915: Defer probe if gmux is present but its driver isn't Lukas Wunner
2016-02-09  9:04   ` Daniel Vetter
2016-02-14 12:10     ` Lukas Wunner
2016-02-14 12:46       ` Daniel Vetter
2016-02-16 15:58         ` Lukas Wunner
2016-02-16 16:08           ` Daniel Vetter
2016-02-18 20:34             ` Lukas Wunner
2016-02-18 21:39               ` Daniel Vetter
2016-02-18 22:20                 ` Lukas Wunner
2016-02-18 23:11                   ` Daniel Vetter
2016-02-18 23:53                     ` Deucher, Alexander
2016-01-11 19:09 ` [PATCH v5 02/12] vga_switcheroo: Add support for switching only the DDC Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 03/12] apple-gmux: Track switch state Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 01/12] vga_switcheroo: Add handler flags infrastructure Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 04/12] apple-gmux: Add switch_ddc support Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 11/12] drm/nouveau: Defer probe if gmux is present but its driver isn't Lukas Wunner
2016-01-11 19:09 ` [PATCH v5 12/12] drm/radeon: " Lukas Wunner
2016-01-11 19:09 ` Lukas Wunner [this message]
     [not found] ` <cover.1452525860.git.lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2016-02-01 22:49   ` [PATCH v5 00/12] Enable GPU switching on pre-retina MacBook Pro Lukas Wunner
2016-02-02  1:10     ` Dave Airlie
2016-02-02  1:19       ` Dave Airlie
2016-02-02 15:03       ` Lukas Wunner
     [not found]     ` <20160201224944.GA12944-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2016-02-02  6:33       ` Pierre Moreau
2016-02-08 18:10 ` Darren Hart
     [not found]   ` <20160208181000.GL1779-Z5kFBHtJu+EzCVHREhWfF0EOCMrvLtNR@public.gmane.org>
2016-02-09  9:01     ` Daniel Vetter
2016-03-04 16:12 ` Bastien Nocera
2016-03-05 14:16   ` [Intel-gfx] [PATCH v5 00/12] Enable GPU switching on pre-retina?MacBook Pro Lukas Wunner
2016-03-05 16:31     ` Bastien Nocera
2016-03-09 23:30       ` Dave Airlie
2016-03-10 15:29         ` Bastien Nocera
2016-03-10 15:33           ` Bastien Nocera
2016-03-14 12:41       ` [Intel-gfx] " Lukas Wunner
2016-03-14 13:37         ` Bastien Nocera
2016-03-15  7:51           ` Daniel Vetter
2016-03-15 11:10           ` [Intel-gfx] " Dave Airlie
2016-03-15 11:55             ` Bastien Nocera
2016-04-05 16:59         ` Bastien Nocera
2016-04-05 17:43           ` Lukas Wunner
2016-03-05 17:28     ` [Intel-gfx] " Bastien Nocera
2016-03-05 18:10     ` Alex Deucher
2016-03-15 17:54       ` Lukas Wunner
2016-03-15 18:33         ` Alex Deucher
2016-03-15 20:41           ` Lukas Wunner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dae71655e8c484fbef492d3389c157975f9622c9.1452525860.git.lukas@wunner.de \
    --to=lukas@wunner.de \
    --cc=alexander.deucher@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.