drm/radeon/kms/combios: fix typo in voltage fix
[safe/jmp/linux-2.6] / drivers / gpu / drm / radeon / radeon_kms.c
index 8d1ad20..6a70c0d 100644 (file)
@@ -31,6 +31,7 @@
 #include "radeon_drm.h"
 
 #include <linux/vga_switcheroo.h>
+#include <linux/slab.h>
 
 int radeon_driver_unload_kms(struct drm_device *dev)
 {
@@ -97,11 +98,15 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 {
        struct radeon_device *rdev = dev->dev_private;
        struct drm_radeon_info *info;
+       struct radeon_mode_info *minfo = &rdev->mode_info;
        uint32_t *value_ptr;
        uint32_t value;
+       struct drm_crtc *crtc;
+       int i, found;
 
        info = data;
        value_ptr = (uint32_t *)((unsigned long)info->value);
+       value = *value_ptr;
        switch (info->request) {
        case RADEON_INFO_DEVICE_ID:
                value = dev->pci_device;
@@ -113,6 +118,27 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
                value = rdev->num_z_pipes;
                break;
        case RADEON_INFO_ACCEL_WORKING:
+               /* xf86-video-ati 6.13.0 relies on this being false for evergreen */
+               if ((rdev->family >= CHIP_CEDAR) && (rdev->family <= CHIP_HEMLOCK))
+                       value = false;
+               else
+                       value = rdev->accel_working;
+               break;
+       case RADEON_INFO_CRTC_FROM_ID:
+               for (i = 0, found = 0; i < rdev->num_crtc; i++) {
+                       crtc = (struct drm_crtc *)minfo->crtcs[i];
+                       if (crtc && crtc->base.id == value) {
+                               value = i;
+                               found = 1;
+                               break;
+                       }
+               }
+               if (!found) {
+                       DRM_DEBUG("unknown crtc id %d\n", value);
+                       return -EINVAL;
+               }
+               break;
+       case RADEON_INFO_ACCEL_WORKING2:
                value = rdev->accel_working;
                break;
        default: