dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Dave Airlie <airlied@gmail.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 2/2] radeon: add support for forcing off lvds when mux switched away
Date: Tue,  8 Jan 2013 14:53:49 +1000	[thread overview]
Message-ID: <1357620829-24526-2-git-send-email-airlied@gmail.com> (raw)
In-Reply-To: <1357620829-24526-1-git-send-email-airlied@gmail.com>

From: Dave Airlie <airlied@redhat.com>

otherwise userspace can get very confused
---
 drivers/gpu/drm/radeon/radeon_connectors.c |  4 ++++
 drivers/gpu/drm/radeon/radeon_device.c     | 14 ++++++++++++++
 drivers/gpu/drm/radeon/radeon_mode.h       |  2 ++
 3 files changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 2399f25..e5a4a10 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -611,6 +611,10 @@ radeon_lvds_detect(struct drm_connector *connector, bool force)
 	struct radeon_connector *radeon_connector = to_radeon_connector(connector);
 	struct drm_encoder *encoder = radeon_best_single_encoder(connector);
 	enum drm_connector_status ret = connector_status_disconnected;
+	struct radeon_device *rdev = connector->dev->dev_private;
+
+	if (rdev->mode_info.mux_force_disconnected)
+		return connector_status_disconnected;
 
 	if (encoder) {
 		struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index cd75626..bf66f09 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -945,10 +945,24 @@ static bool radeon_switcheroo_can_switch(struct pci_dev *pdev)
 	return can_switch;
 }
 
+static void radeon_switcheroo_mux_switched(struct pci_dev *pdev, enum vga_switcheroo_state state)
+{
+	struct drm_device *dev = pci_get_drvdata(pdev);
+	struct radeon_device *rdev = dev->dev_private;
+
+	if (state == VGA_SWITCHEROO_OFF)
+		rdev->mode_info.mux_force_disconnected = true;
+	else
+		rdev->mode_info.mux_force_disconnected = false;
+
+	drm_kms_helper_hotplug_event(dev);
+}
+
 static const struct vga_switcheroo_client_ops radeon_switcheroo_ops = {
 	.set_gpu_state = radeon_switcheroo_set_state,
 	.reprobe = NULL,
 	.can_switch = radeon_switcheroo_can_switch,
+	.mux_switched = radeon_switcheroo_mux_switched,
 };
 
 /**
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index 4003f5a..172eed8 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -256,6 +256,8 @@ struct radeon_mode_info {
 	u16 firmware_flags;
 	/* pointer to backlight encoder */
 	struct radeon_encoder *bl_encoder;
+
+	bool mux_force_disconnected;
 };
 
 #define RADEON_MAX_BL_LEVEL 0xFF
-- 
1.8.1

  reply	other threads:[~2013-01-08  4:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-08  4:53 [PATCH 1/2] vga_switcheroo: add mux switched interface Dave Airlie
2013-01-08  4:53 ` Dave Airlie [this message]
2013-01-08 14:20   ` [PATCH 2/2] radeon: add support for forcing off lvds when mux switched away Alex Deucher
2013-01-09 14:16   ` Alex Deucher
2013-01-09 23:14     ` Dave Airlie
2013-01-08 14:18 ` [PATCH 1/2] vga_switcheroo: add mux switched interface Alex Deucher

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=1357620829-24526-2-git-send-email-airlied@gmail.com \
    --to=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).