Merge branch 'gpu-switcher' of /ssd/git//linux-2.6 into drm-next-stage
[safe/jmp/linux-2.6] / drivers / gpu / drm / i915 / i915_drv.c
index fd739ef..1b2e954 100644 (file)
@@ -49,6 +49,7 @@ unsigned int i915_lvds_downclock = 0;
 module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400);
 
 static struct drm_driver driver;
+extern int intel_agp_enabled;
 
 #define INTEL_VGA_DEVICE(id, info) {           \
        .class = PCI_CLASS_DISPLAY_VGA << 8,    \
@@ -136,6 +137,16 @@ const static struct intel_device_info intel_ironlake_m_info = {
        .has_hotplug = 1,
 };
 
+const static struct intel_device_info intel_sandybridge_d_info = {
+       .is_i965g = 1, .is_i9xx = 1, .need_gfx_hws = 1,
+       .has_hotplug = 1,
+};
+
+const static struct intel_device_info intel_sandybridge_m_info = {
+       .is_i965g = 1, .is_mobile = 1, .is_i9xx = 1, .need_gfx_hws = 1,
+       .has_hotplug = 1,
+};
+
 const static struct pci_device_id pciidlist[] = {
        INTEL_VGA_DEVICE(0x3577, &intel_i830_info),
        INTEL_VGA_DEVICE(0x2562, &intel_845g_info),
@@ -167,6 +178,8 @@ const static struct pci_device_id pciidlist[] = {
        INTEL_VGA_DEVICE(0xa011, &intel_pineview_info),
        INTEL_VGA_DEVICE(0x0042, &intel_ironlake_d_info),
        INTEL_VGA_DEVICE(0x0046, &intel_ironlake_m_info),
+       INTEL_VGA_DEVICE(0x0102, &intel_sandybridge_d_info),
+       INTEL_VGA_DEVICE(0x0106, &intel_sandybridge_m_info),
        {0, 0, 0}
 };
 
@@ -546,6 +559,11 @@ static struct drm_driver driver = {
 
 static int __init i915_init(void)
 {
+       if (!intel_agp_enabled) {
+               DRM_ERROR("drm/i915 can't work without intel_agp module!\n");
+               return -ENODEV;
+       }
+
        driver.num_ioctls = i915_max_ioctl;
 
        i915_gem_shrinker_init();
@@ -571,6 +589,11 @@ static int __init i915_init(void)
                driver.driver_features &= ~DRIVER_MODESET;
 #endif
 
+       if (!(driver.driver_features & DRIVER_MODESET)) {
+               driver.suspend = i915_suspend;
+               driver.resume = i915_resume;
+       }
+
        return drm_init(&driver);
 }