From: Dave Airlie <airlied@gmail.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 1/2] vga_switcheroo: add mux switched interface
Date: Tue, 8 Jan 2013 14:53:48 +1000 [thread overview]
Message-ID: <1357620829-24526-1-git-send-email-airlied@gmail.com> (raw)
From: Dave Airlie <airlied@redhat.com>
this tells the drivers when the mux is switch to/from it, can be used
to report outputs as disconnected to userspace etc.
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
drivers/gpu/vga/vga_switcheroo.c | 19 +++++++++++++++++++
include/linux/vga_switcheroo.h | 1 +
2 files changed, 20 insertions(+)
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index fa60add..2362175 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -93,6 +93,9 @@ static void vga_switcheroo_enable(void)
return;
client->id = ret;
+
+ if (client->ops->mux_switched)
+ client->ops->mux_switched(client->pdev, client->active ? VGA_SWITCHEROO_ON : VGA_SWITCHEROO_OFF);
}
vga_switcheroo_debugfs_init(&vgasr_priv);
vgasr_priv.active = true;
@@ -345,6 +348,13 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client)
if (ret)
return ret;
+ /* call mux switched callbacks */
+ if (active->ops->mux_switched)
+ active->ops->mux_switched(active->pdev, VGA_SWITCHEROO_OFF);
+
+ if (new_client->ops->mux_switched)
+ new_client->ops->mux_switched(new_client->pdev, VGA_SWITCHEROO_ON);
+
if (new_client->ops->reprobe)
new_client->ops->reprobe(new_client->pdev);
@@ -452,7 +462,16 @@ vga_switcheroo_debugfs_write(struct file *filp, const char __user *ubuf,
vgasr_priv.delayed_switch_active = false;
if (just_mux) {
+ struct vga_switcheroo_client *active;
+ active = find_active_client(&vgasr_priv.clients);
+ if (!active)
+ return 0;
ret = vgasr_priv.handler->switchto(client_id);
+
+ if (active->ops->mux_switched)
+ active->ops->mux_switched(active->pdev, VGA_SWITCHEROO_OFF);
+ if (client->ops->mux_switched)
+ client->ops->mux_switched(client->pdev, VGA_SWITCHEROO_ON);
goto out;
}
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index ddb419c..6275719 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -40,6 +40,7 @@ struct vga_switcheroo_client_ops {
void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state);
void (*reprobe)(struct pci_dev *dev);
bool (*can_switch)(struct pci_dev *dev);
+ void (*mux_switched)(struct pci_dev *dev, enum vga_switcheroo_state);
};
#if defined(CONFIG_VGA_SWITCHEROO)
--
1.8.1
next 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 Dave Airlie [this message]
2013-01-08 4:53 ` [PATCH 2/2] radeon: add support for forcing off lvds when mux switched away Dave Airlie
2013-01-08 14:20 ` 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-1-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).