| .. | .. |
|---|
| 25 | 25 | * Alex Deucher |
|---|
| 26 | 26 | * Jerome Glisse |
|---|
| 27 | 27 | */ |
|---|
| 28 | | -#include <drm/drmP.h> |
|---|
| 29 | | -#include <drm/drm_fb_helper.h> |
|---|
| 30 | | -#include "radeon.h" |
|---|
| 31 | | -#include <drm/radeon_drm.h> |
|---|
| 32 | | -#include "radeon_asic.h" |
|---|
| 33 | 28 | |
|---|
| 34 | | -#include <linux/vga_switcheroo.h> |
|---|
| 35 | | -#include <linux/slab.h> |
|---|
| 29 | +#include <linux/pci.h> |
|---|
| 36 | 30 | #include <linux/pm_runtime.h> |
|---|
| 31 | +#include <linux/slab.h> |
|---|
| 32 | +#include <linux/uaccess.h> |
|---|
| 33 | +#include <linux/vga_switcheroo.h> |
|---|
| 34 | + |
|---|
| 35 | +#include <drm/drm_agpsupport.h> |
|---|
| 36 | +#include <drm/drm_fb_helper.h> |
|---|
| 37 | +#include <drm/drm_file.h> |
|---|
| 38 | +#include <drm/drm_ioctl.h> |
|---|
| 39 | +#include <drm/radeon_drm.h> |
|---|
| 40 | + |
|---|
| 41 | +#include "radeon.h" |
|---|
| 42 | +#include "radeon_asic.h" |
|---|
| 37 | 43 | |
|---|
| 38 | 44 | #if defined(CONFIG_VGA_SWITCHEROO) |
|---|
| 39 | 45 | bool radeon_has_atpx(void); |
|---|
| .. | .. |
|---|
| 71 | 77 | |
|---|
| 72 | 78 | radeon_modeset_fini(rdev); |
|---|
| 73 | 79 | radeon_device_fini(rdev); |
|---|
| 80 | + |
|---|
| 81 | + if (dev->agp) |
|---|
| 82 | + arch_phys_wc_del(dev->agp->agp_mtrr); |
|---|
| 83 | + kfree(dev->agp); |
|---|
| 84 | + dev->agp = NULL; |
|---|
| 74 | 85 | |
|---|
| 75 | 86 | done_free: |
|---|
| 76 | 87 | kfree(rdev); |
|---|
| .. | .. |
|---|
| 147 | 158 | } |
|---|
| 148 | 159 | |
|---|
| 149 | 160 | if (radeon_is_px(dev)) { |
|---|
| 150 | | - dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NEVER_SKIP); |
|---|
| 161 | + dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NO_DIRECT_COMPLETE); |
|---|
| 151 | 162 | pm_runtime_use_autosuspend(dev->dev); |
|---|
| 152 | 163 | pm_runtime_set_autosuspend_delay(dev->dev, 5000); |
|---|
| 153 | 164 | pm_runtime_set_active(dev->dev); |
|---|
| .. | .. |
|---|
| 743 | 754 | /** |
|---|
| 744 | 755 | * radeon_get_vblank_counter_kms - get frame count |
|---|
| 745 | 756 | * |
|---|
| 746 | | - * @dev: drm dev pointer |
|---|
| 747 | | - * @pipe: crtc to get the frame count from |
|---|
| 757 | + * @crtc: crtc to get the frame count from |
|---|
| 748 | 758 | * |
|---|
| 749 | 759 | * Gets the frame count on the requested crtc (all asics). |
|---|
| 750 | 760 | * Returns frame count on success, -EINVAL on failure. |
|---|
| 751 | 761 | */ |
|---|
| 752 | | -u32 radeon_get_vblank_counter_kms(struct drm_device *dev, unsigned int pipe) |
|---|
| 762 | +u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc) |
|---|
| 753 | 763 | { |
|---|
| 764 | + struct drm_device *dev = crtc->dev; |
|---|
| 765 | + unsigned int pipe = crtc->index; |
|---|
| 754 | 766 | int vpos, hpos, stat; |
|---|
| 755 | 767 | u32 count; |
|---|
| 756 | 768 | struct radeon_device *rdev = dev->dev_private; |
|---|
| .. | .. |
|---|
| 812 | 824 | /** |
|---|
| 813 | 825 | * radeon_enable_vblank_kms - enable vblank interrupt |
|---|
| 814 | 826 | * |
|---|
| 815 | | - * @dev: drm dev pointer |
|---|
| 816 | 827 | * @crtc: crtc to enable vblank interrupt for |
|---|
| 817 | 828 | * |
|---|
| 818 | 829 | * Enable the interrupt on the requested crtc (all asics). |
|---|
| 819 | 830 | * Returns 0 on success, -EINVAL on failure. |
|---|
| 820 | 831 | */ |
|---|
| 821 | | -int radeon_enable_vblank_kms(struct drm_device *dev, int crtc) |
|---|
| 832 | +int radeon_enable_vblank_kms(struct drm_crtc *crtc) |
|---|
| 822 | 833 | { |
|---|
| 834 | + struct drm_device *dev = crtc->dev; |
|---|
| 835 | + unsigned int pipe = crtc->index; |
|---|
| 823 | 836 | struct radeon_device *rdev = dev->dev_private; |
|---|
| 824 | 837 | unsigned long irqflags; |
|---|
| 825 | 838 | int r; |
|---|
| 826 | 839 | |
|---|
| 827 | | - if (crtc < 0 || crtc >= rdev->num_crtc) { |
|---|
| 828 | | - DRM_ERROR("Invalid crtc %d\n", crtc); |
|---|
| 840 | + if (pipe >= rdev->num_crtc) { |
|---|
| 841 | + DRM_ERROR("Invalid crtc %d\n", pipe); |
|---|
| 829 | 842 | return -EINVAL; |
|---|
| 830 | 843 | } |
|---|
| 831 | 844 | |
|---|
| 832 | 845 | spin_lock_irqsave(&rdev->irq.lock, irqflags); |
|---|
| 833 | | - rdev->irq.crtc_vblank_int[crtc] = true; |
|---|
| 846 | + rdev->irq.crtc_vblank_int[pipe] = true; |
|---|
| 834 | 847 | r = radeon_irq_set(rdev); |
|---|
| 835 | 848 | spin_unlock_irqrestore(&rdev->irq.lock, irqflags); |
|---|
| 836 | 849 | return r; |
|---|
| .. | .. |
|---|
| 839 | 852 | /** |
|---|
| 840 | 853 | * radeon_disable_vblank_kms - disable vblank interrupt |
|---|
| 841 | 854 | * |
|---|
| 842 | | - * @dev: drm dev pointer |
|---|
| 843 | 855 | * @crtc: crtc to disable vblank interrupt for |
|---|
| 844 | 856 | * |
|---|
| 845 | 857 | * Disable the interrupt on the requested crtc (all asics). |
|---|
| 846 | 858 | */ |
|---|
| 847 | | -void radeon_disable_vblank_kms(struct drm_device *dev, int crtc) |
|---|
| 859 | +void radeon_disable_vblank_kms(struct drm_crtc *crtc) |
|---|
| 848 | 860 | { |
|---|
| 861 | + struct drm_device *dev = crtc->dev; |
|---|
| 862 | + unsigned int pipe = crtc->index; |
|---|
| 849 | 863 | struct radeon_device *rdev = dev->dev_private; |
|---|
| 850 | 864 | unsigned long irqflags; |
|---|
| 851 | 865 | |
|---|
| 852 | | - if (crtc < 0 || crtc >= rdev->num_crtc) { |
|---|
| 853 | | - DRM_ERROR("Invalid crtc %d\n", crtc); |
|---|
| 866 | + if (pipe >= rdev->num_crtc) { |
|---|
| 867 | + DRM_ERROR("Invalid crtc %d\n", pipe); |
|---|
| 854 | 868 | return; |
|---|
| 855 | 869 | } |
|---|
| 856 | 870 | |
|---|
| 857 | 871 | spin_lock_irqsave(&rdev->irq.lock, irqflags); |
|---|
| 858 | | - rdev->irq.crtc_vblank_int[crtc] = false; |
|---|
| 872 | + rdev->irq.crtc_vblank_int[pipe] = false; |
|---|
| 859 | 873 | radeon_irq_set(rdev); |
|---|
| 860 | 874 | spin_unlock_irqrestore(&rdev->irq.lock, irqflags); |
|---|
| 861 | 875 | } |
|---|