summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_state.c
diff options
context:
space:
mode:
authorDave Airlie2010-12-07 00:20:40 +0100
committerDave Airlie2011-01-05 04:45:30 +0100
commit5bcf719b7db0f9366cedaf102b081f99b1c325ae (patch)
tree6929d42e1d61a3b1bd7b130a37a80b99718e14aa /drivers/gpu/drm/nouveau/nouveau_state.c
parentvga_switcheroo: add reprobe hook for fbcon to recheck connected outputs. (diff)
downloadkernel-qcow2-linux-5bcf719b7db0f9366cedaf102b081f99b1c325ae.tar.gz
kernel-qcow2-linux-5bcf719b7db0f9366cedaf102b081f99b1c325ae.tar.xz
kernel-qcow2-linux-5bcf719b7db0f9366cedaf102b081f99b1c325ae.zip
drm/switcheroo: track state of switch in drivers.
We need to track the state of the switch in drivers, so that after s/r we don't resume the card we've explicitly switched off before. Also don't allow a userspace open to occur if we've switched the gpu off. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_state.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_state.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index 1b87eee22fa9..a54fc431fe98 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -596,12 +596,16 @@ static void nouveau_switcheroo_set_state(struct pci_dev *pdev,
pm_message_t pmm = { .event = PM_EVENT_SUSPEND };
if (state == VGA_SWITCHEROO_ON) {
printk(KERN_ERR "VGA switcheroo: switched nouveau on\n");
+ dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
nouveau_pci_resume(pdev);
drm_kms_helper_poll_enable(dev);
+ dev->switch_power_state = DRM_SWITCH_POWER_ON;
} else {
printk(KERN_ERR "VGA switcheroo: switched nouveau off\n");
+ dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
drm_kms_helper_poll_disable(dev);
nouveau_pci_suspend(pdev, pmm);
+ dev->switch_power_state = DRM_SWITCH_POWER_OFF;
}
}