diff options
author | Dave Airlie <airlied@redhat.com> | 2010-12-06 18:20:40 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-01-04 22:45:30 -0500 |
commit | 5bcf719b7db0f9366cedaf102b081f99b1c325ae (patch) | |
tree | 6929d42e1d61a3b1bd7b130a37a80b99718e14aa /drivers/gpu/drm/radeon | |
parent | 8d608aa6295242fe4c4b6105b8c59c6a5b232d89 (diff) |
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/radeon')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_device.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_kms.c | 4 |
3 files changed, 6 insertions, 11 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index d2697f8f2da8..140eaceab279 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -1167,7 +1167,6 @@ struct radeon_device { | |||
1167 | uint8_t audio_status_bits; | 1167 | uint8_t audio_status_bits; |
1168 | uint8_t audio_category_code; | 1168 | uint8_t audio_category_code; |
1169 | 1169 | ||
1170 | bool powered_down; | ||
1171 | struct notifier_block acpi_nb; | 1170 | struct notifier_block acpi_nb; |
1172 | /* only one userspace can use Hyperz features at a time */ | 1171 | /* only one userspace can use Hyperz features at a time */ |
1173 | struct drm_file *hyperz_filp; | 1172 | struct drm_file *hyperz_filp; |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 1a1017f0d9db..4ee0c53b28a7 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -642,20 +642,20 @@ void radeon_check_arguments(struct radeon_device *rdev) | |||
642 | static void radeon_switcheroo_set_state(struct pci_dev *pdev, enum vga_switcheroo_state state) | 642 | static void radeon_switcheroo_set_state(struct pci_dev *pdev, enum vga_switcheroo_state state) |
643 | { | 643 | { |
644 | struct drm_device *dev = pci_get_drvdata(pdev); | 644 | struct drm_device *dev = pci_get_drvdata(pdev); |
645 | struct radeon_device *rdev = dev->dev_private; | ||
646 | pm_message_t pmm = { .event = PM_EVENT_SUSPEND }; | 645 | pm_message_t pmm = { .event = PM_EVENT_SUSPEND }; |
647 | if (state == VGA_SWITCHEROO_ON) { | 646 | if (state == VGA_SWITCHEROO_ON) { |
648 | printk(KERN_INFO "radeon: switched on\n"); | 647 | printk(KERN_INFO "radeon: switched on\n"); |
649 | /* don't suspend or resume card normally */ | 648 | /* don't suspend or resume card normally */ |
650 | rdev->powered_down = false; | 649 | dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; |
651 | radeon_resume_kms(dev); | 650 | radeon_resume_kms(dev); |
651 | dev->switch_power_state = DRM_SWITCH_POWER_ON; | ||
652 | drm_kms_helper_poll_enable(dev); | 652 | drm_kms_helper_poll_enable(dev); |
653 | } else { | 653 | } else { |
654 | printk(KERN_INFO "radeon: switched off\n"); | 654 | printk(KERN_INFO "radeon: switched off\n"); |
655 | drm_kms_helper_poll_disable(dev); | 655 | drm_kms_helper_poll_disable(dev); |
656 | dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; | ||
656 | radeon_suspend_kms(dev, pmm); | 657 | radeon_suspend_kms(dev, pmm); |
657 | /* don't suspend or resume card normally */ | 658 | dev->switch_power_state = DRM_SWITCH_POWER_OFF; |
658 | rdev->powered_down = true; | ||
659 | } | 659 | } |
660 | } | 660 | } |
661 | 661 | ||
@@ -842,7 +842,7 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state) | |||
842 | } | 842 | } |
843 | rdev = dev->dev_private; | 843 | rdev = dev->dev_private; |
844 | 844 | ||
845 | if (rdev->powered_down) | 845 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
846 | return 0; | 846 | return 0; |
847 | 847 | ||
848 | /* turn off display hw */ | 848 | /* turn off display hw */ |
@@ -900,7 +900,7 @@ int radeon_resume_kms(struct drm_device *dev) | |||
900 | struct drm_connector *connector; | 900 | struct drm_connector *connector; |
901 | struct radeon_device *rdev = dev->dev_private; | 901 | struct radeon_device *rdev = dev->dev_private; |
902 | 902 | ||
903 | if (rdev->powered_down) | 903 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
904 | return 0; | 904 | return 0; |
905 | 905 | ||
906 | acquire_console_sem(); | 906 | acquire_console_sem(); |
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 4bf423ca4c12..b2686334d46b 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
@@ -203,10 +203,6 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
203 | */ | 203 | */ |
204 | int radeon_driver_firstopen_kms(struct drm_device *dev) | 204 | int radeon_driver_firstopen_kms(struct drm_device *dev) |
205 | { | 205 | { |
206 | struct radeon_device *rdev = dev->dev_private; | ||
207 | |||
208 | if (rdev->powered_down) | ||
209 | return -EINVAL; | ||
210 | return 0; | 206 | return 0; |
211 | } | 207 | } |
212 | 208 | ||