1 /**************************************************************************
2 * Copyright (c) 2007-2011, Intel Corporation.
4 * Copyright (c) 2008, Tungsten Graphics, Inc. Cedar Park, TX., USA.
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
20 **************************************************************************/
26 #include "framebuffer.h"
28 #include "psb_intel_reg.h"
29 #include "intel_bios.h"
31 #include <drm/drm_pciids.h>
33 #include <linux/cpu.h>
34 #include <linux/notifier.h>
35 #include <linux/spinlock.h>
36 #include <linux/pm_runtime.h>
37 #include <acpi/video.h>
38 #include <linux/module.h>
40 static int drm_psb_trap_pagefaults
;
42 static int psb_probe(struct pci_dev
*pdev
, const struct pci_device_id
*ent
);
44 MODULE_PARM_DESC(trap_pagefaults
, "Error and reset on MMU pagefaults");
45 module_param_named(trap_pagefaults
, drm_psb_trap_pagefaults
, int, 0600);
48 static DEFINE_PCI_DEVICE_TABLE(pciidlist
) = {
49 { 0x8086, 0x8108, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &psb_chip_ops
},
50 { 0x8086, 0x8109, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &psb_chip_ops
},
51 #if defined(CONFIG_DRM_GMA600)
52 { 0x8086, 0x4100, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &oaktrail_chip_ops
},
53 { 0x8086, 0x4101, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &oaktrail_chip_ops
},
54 { 0x8086, 0x4102, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &oaktrail_chip_ops
},
55 { 0x8086, 0x4103, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &oaktrail_chip_ops
},
56 { 0x8086, 0x4104, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &oaktrail_chip_ops
},
57 { 0x8086, 0x4105, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &oaktrail_chip_ops
},
58 { 0x8086, 0x4106, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &oaktrail_chip_ops
},
59 { 0x8086, 0x4107, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &oaktrail_chip_ops
},
61 { 0x8086, 0x4108, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &oaktrail_chip_ops
},
63 #if defined(CONFIG_DRM_MEDFIELD)
64 {0x8086, 0x0130, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &mdfld_chip_ops
},
65 {0x8086, 0x0131, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &mdfld_chip_ops
},
66 {0x8086, 0x0132, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &mdfld_chip_ops
},
67 {0x8086, 0x0133, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &mdfld_chip_ops
},
68 {0x8086, 0x0134, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &mdfld_chip_ops
},
69 {0x8086, 0x0135, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &mdfld_chip_ops
},
70 {0x8086, 0x0136, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &mdfld_chip_ops
},
71 {0x8086, 0x0137, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &mdfld_chip_ops
},
73 #if defined(CONFIG_DRM_GMA3600)
74 { 0x8086, 0x0be0, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &cdv_chip_ops
},
75 { 0x8086, 0x0be1, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &cdv_chip_ops
},
76 { 0x8086, 0x0be2, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &cdv_chip_ops
},
77 { 0x8086, 0x0be3, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &cdv_chip_ops
},
78 { 0x8086, 0x0be4, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &cdv_chip_ops
},
79 { 0x8086, 0x0be5, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &cdv_chip_ops
},
80 { 0x8086, 0x0be6, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &cdv_chip_ops
},
81 { 0x8086, 0x0be7, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &cdv_chip_ops
},
82 { 0x8086, 0x0be8, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &cdv_chip_ops
},
83 { 0x8086, 0x0be9, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &cdv_chip_ops
},
84 { 0x8086, 0x0bea, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &cdv_chip_ops
},
85 { 0x8086, 0x0beb, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &cdv_chip_ops
},
86 { 0x8086, 0x0bec, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &cdv_chip_ops
},
87 { 0x8086, 0x0bed, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &cdv_chip_ops
},
88 { 0x8086, 0x0bee, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &cdv_chip_ops
},
89 { 0x8086, 0x0bef, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (long) &cdv_chip_ops
},
93 MODULE_DEVICE_TABLE(pci
, pciidlist
);
99 #define DRM_IOCTL_GMA_ADB \
100 DRM_IOWR(DRM_GMA_ADB + DRM_COMMAND_BASE, uint32_t)
101 #define DRM_IOCTL_GMA_MODE_OPERATION \
102 DRM_IOWR(DRM_GMA_MODE_OPERATION + DRM_COMMAND_BASE, \
103 struct drm_psb_mode_operation_arg)
104 #define DRM_IOCTL_GMA_STOLEN_MEMORY \
105 DRM_IOWR(DRM_GMA_STOLEN_MEMORY + DRM_COMMAND_BASE, \
106 struct drm_psb_stolen_memory_arg)
107 #define DRM_IOCTL_GMA_GAMMA \
108 DRM_IOWR(DRM_GMA_GAMMA + DRM_COMMAND_BASE, \
109 struct drm_psb_dpst_lut_arg)
110 #define DRM_IOCTL_GMA_DPST_BL \
111 DRM_IOWR(DRM_GMA_DPST_BL + DRM_COMMAND_BASE, \
113 #define DRM_IOCTL_GMA_GET_PIPE_FROM_CRTC_ID \
114 DRM_IOWR(DRM_GMA_GET_PIPE_FROM_CRTC_ID + DRM_COMMAND_BASE, \
115 struct drm_psb_get_pipe_from_crtc_id_arg)
116 #define DRM_IOCTL_GMA_GEM_CREATE \
117 DRM_IOWR(DRM_GMA_GEM_CREATE + DRM_COMMAND_BASE, \
118 struct drm_psb_gem_create)
119 #define DRM_IOCTL_GMA_GEM_MMAP \
120 DRM_IOWR(DRM_GMA_GEM_MMAP + DRM_COMMAND_BASE, \
121 struct drm_psb_gem_mmap)
123 static int psb_adb_ioctl(struct drm_device
*dev
, void *data
,
124 struct drm_file
*file_priv
);
125 static int psb_mode_operation_ioctl(struct drm_device
*dev
, void *data
,
126 struct drm_file
*file_priv
);
127 static int psb_stolen_memory_ioctl(struct drm_device
*dev
, void *data
,
128 struct drm_file
*file_priv
);
129 static int psb_gamma_ioctl(struct drm_device
*dev
, void *data
,
130 struct drm_file
*file_priv
);
131 static int psb_dpst_bl_ioctl(struct drm_device
*dev
, void *data
,
132 struct drm_file
*file_priv
);
134 static struct drm_ioctl_desc psb_ioctls
[] = {
135 DRM_IOCTL_DEF_DRV(GMA_ADB
, psb_adb_ioctl
, DRM_AUTH
),
136 DRM_IOCTL_DEF_DRV(GMA_MODE_OPERATION
, psb_mode_operation_ioctl
,
138 DRM_IOCTL_DEF_DRV(GMA_STOLEN_MEMORY
, psb_stolen_memory_ioctl
,
140 DRM_IOCTL_DEF_DRV(GMA_GAMMA
, psb_gamma_ioctl
, DRM_AUTH
),
141 DRM_IOCTL_DEF_DRV(GMA_DPST_BL
, psb_dpst_bl_ioctl
, DRM_AUTH
),
142 DRM_IOCTL_DEF_DRV(GMA_GET_PIPE_FROM_CRTC_ID
,
143 psb_intel_get_pipe_from_crtc_id
, 0),
144 DRM_IOCTL_DEF_DRV(GMA_GEM_CREATE
, psb_gem_create_ioctl
,
145 DRM_UNLOCKED
| DRM_AUTH
),
146 DRM_IOCTL_DEF_DRV(GMA_GEM_MMAP
, psb_gem_mmap_ioctl
,
147 DRM_UNLOCKED
| DRM_AUTH
),
150 static void psb_lastclose(struct drm_device
*dev
)
155 static int psb_do_init(struct drm_device
*dev
)
157 struct drm_psb_private
*dev_priv
= dev
->dev_private
;
158 struct psb_gtt
*pg
= &dev_priv
->gtt
;
164 if (pg
->mmu_gatt_start
& 0x0FFFFFFF) {
165 dev_err(dev
->dev
, "Gatt must be 256M aligned. This is a bug.\n");
171 stolen_gtt
= (pg
->stolen_size
>> PAGE_SHIFT
) * 4;
172 stolen_gtt
= (stolen_gtt
+ PAGE_SIZE
- 1) >> PAGE_SHIFT
;
174 (stolen_gtt
< pg
->gtt_pages
) ? stolen_gtt
: pg
->gtt_pages
;
176 dev_priv
->gatt_free_offset
= pg
->mmu_gatt_start
+
177 (stolen_gtt
<< PAGE_SHIFT
) * 1024;
179 spin_lock_init(&dev_priv
->irqmask_lock
);
180 spin_lock_init(&dev_priv
->lock_2d
);
182 PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK0
);
183 PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK1
);
184 PSB_RSGX32(PSB_CR_BIF_BANK1
);
185 PSB_WSGX32(PSB_RSGX32(PSB_CR_BIF_CTRL
) | _PSB_MMU_ER_MASK
,
190 PSB_WSGX32(pg
->gatt_start
, PSB_CR_BIF_TWOD_REQ_BASE
);
196 static int psb_driver_unload(struct drm_device
*dev
)
198 struct drm_psb_private
*dev_priv
= dev
->dev_private
;
200 /* Kill vblank etc here */
204 if (dev_priv
->backlight_device
)
205 gma_backlight_exit(dev
);
206 psb_modeset_cleanup(dev
);
208 if (dev_priv
->ops
->chip_teardown
)
209 dev_priv
->ops
->chip_teardown(dev
);
211 psb_intel_opregion_fini(dev
);
213 if (dev_priv
->pf_pd
) {
214 psb_mmu_free_pagedir(dev_priv
->pf_pd
);
215 dev_priv
->pf_pd
= NULL
;
218 struct psb_gtt
*pg
= &dev_priv
->gtt
;
221 psb_mmu_remove_pfn_sequence(
222 psb_mmu_get_default_pd
225 dev_priv
->vram_stolen_size
>> PAGE_SHIFT
);
227 psb_mmu_driver_takedown(dev_priv
->mmu
);
228 dev_priv
->mmu
= NULL
;
230 psb_gtt_takedown(dev
);
231 if (dev_priv
->scratch_page
) {
232 set_pages_wb(dev_priv
->scratch_page
, 1);
233 __free_page(dev_priv
->scratch_page
);
234 dev_priv
->scratch_page
= NULL
;
236 if (dev_priv
->vdc_reg
) {
237 iounmap(dev_priv
->vdc_reg
);
238 dev_priv
->vdc_reg
= NULL
;
240 if (dev_priv
->sgx_reg
) {
241 iounmap(dev_priv
->sgx_reg
);
242 dev_priv
->sgx_reg
= NULL
;
245 /* Destroy VBT data */
246 psb_intel_destroy_bios(dev
);
249 dev
->dev_private
= NULL
;
251 gma_power_uninit(dev
);
256 static int psb_driver_load(struct drm_device
*dev
, unsigned long chipset
)
258 struct drm_psb_private
*dev_priv
;
259 unsigned long resource_start
;
260 unsigned long irqflags
;
262 struct drm_connector
*connector
;
263 struct psb_intel_encoder
*psb_intel_encoder
;
265 dev_priv
= kzalloc(sizeof(*dev_priv
), GFP_KERNEL
);
266 if (dev_priv
== NULL
)
269 dev_priv
->ops
= (struct psb_ops
*)chipset
;
271 dev
->dev_private
= (void *) dev_priv
;
273 pci_set_master(dev
->pdev
);
275 dev_priv
->num_pipe
= dev_priv
->ops
->pipes
;
277 resource_start
= pci_resource_start(dev
->pdev
, PSB_MMIO_RESOURCE
);
280 ioremap(resource_start
+ PSB_VDC_OFFSET
, PSB_VDC_SIZE
);
281 if (!dev_priv
->vdc_reg
)
284 dev_priv
->sgx_reg
= ioremap(resource_start
+ dev_priv
->ops
->sgx_offset
,
286 if (!dev_priv
->sgx_reg
)
289 psb_intel_opregion_setup(dev
);
291 ret
= dev_priv
->ops
->chip_setup(dev
);
295 /* Init OSPM support */
300 dev_priv
->scratch_page
= alloc_page(GFP_DMA32
| __GFP_ZERO
);
301 if (!dev_priv
->scratch_page
)
304 set_pages_uc(dev_priv
->scratch_page
, 1);
306 ret
= psb_gtt_init(dev
, 0);
310 dev_priv
->mmu
= psb_mmu_driver_init((void *)0,
311 drm_psb_trap_pagefaults
, 0,
316 dev_priv
->pf_pd
= psb_mmu_alloc_pd(dev_priv
->mmu
, 1, 0);
317 if (!dev_priv
->pf_pd
)
320 psb_mmu_set_pd_context(psb_mmu_get_default_pd(dev_priv
->mmu
), 0);
321 psb_mmu_set_pd_context(dev_priv
->pf_pd
, 1);
323 ret
= psb_do_init(dev
);
327 PSB_WSGX32(0x20000000, PSB_CR_PDS_EXEC_BASE
);
328 PSB_WSGX32(0x30000000, PSB_CR_BIF_3D_REQ_BASE
);
330 acpi_video_register();
332 ret
= drm_vblank_init(dev
, dev_priv
->num_pipe
);
337 * Install interrupt handlers prior to powering off SGX or else we will
340 dev_priv
->vdc_irq_mask
= 0;
341 dev_priv
->pipestat
[0] = 0;
342 dev_priv
->pipestat
[1] = 0;
343 dev_priv
->pipestat
[2] = 0;
344 spin_lock_irqsave(&dev_priv
->irqmask_lock
, irqflags
);
345 PSB_WVDC32(0xFFFFFFFF, PSB_HWSTAM
);
346 PSB_WVDC32(0x00000000, PSB_INT_ENABLE_R
);
347 PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R
);
348 spin_unlock_irqrestore(&dev_priv
->irqmask_lock
, irqflags
);
350 drm_irq_install(dev
);
352 dev
->vblank_disable_allowed
= 1;
354 dev
->max_vblank_count
= 0xffffff; /* only 24 bits of frame count */
356 dev
->driver
->get_vblank_counter
= psb_get_vblank_counter
;
358 psb_modeset_init(dev
);
360 drm_kms_helper_poll_init(dev
);
362 /* Only add backlight support if we have LVDS output */
363 list_for_each_entry(connector
, &dev
->mode_config
.connector_list
,
365 psb_intel_encoder
= psb_intel_attached_encoder(connector
);
367 switch (psb_intel_encoder
->type
) {
368 case INTEL_OUTPUT_LVDS
:
369 case INTEL_OUTPUT_MIPI
:
370 ret
= gma_backlight_init(dev
);
378 /*enable runtime pm at last*/
379 pm_runtime_enable(&dev
->pdev
->dev
);
380 pm_runtime_set_active(&dev
->pdev
->dev
);
382 /*Intel drm driver load is done, continue doing pvr load*/
385 psb_driver_unload(dev
);
389 static int psb_driver_device_is_agp(struct drm_device
*dev
)
394 static inline void get_brightness(struct backlight_device
*bd
)
396 #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
398 bd
->props
.brightness
= bd
->ops
->get_brightness(bd
);
399 backlight_update_status(bd
);
404 static int psb_dpst_bl_ioctl(struct drm_device
*dev
, void *data
,
405 struct drm_file
*file_priv
)
407 struct drm_psb_private
*dev_priv
= psb_priv(dev
);
408 uint32_t *arg
= data
;
410 dev_priv
->blc_adj2
= *arg
;
411 get_brightness(dev_priv
->backlight_device
);
415 static int psb_adb_ioctl(struct drm_device
*dev
, void *data
,
416 struct drm_file
*file_priv
)
418 struct drm_psb_private
*dev_priv
= psb_priv(dev
);
419 uint32_t *arg
= data
;
421 dev_priv
->blc_adj1
= *arg
;
422 get_brightness(dev_priv
->backlight_device
);
426 static int psb_gamma_ioctl(struct drm_device
*dev
, void *data
,
427 struct drm_file
*file_priv
)
429 struct drm_psb_dpst_lut_arg
*lut_arg
= data
;
430 struct drm_mode_object
*obj
;
431 struct drm_crtc
*crtc
;
432 struct drm_connector
*connector
;
433 struct psb_intel_crtc
*psb_intel_crtc
;
437 obj_id
= lut_arg
->output_id
;
438 obj
= drm_mode_object_find(dev
, obj_id
, DRM_MODE_OBJECT_CONNECTOR
);
440 dev_dbg(dev
->dev
, "Invalid Connector object.\n");
444 connector
= obj_to_connector(obj
);
445 crtc
= connector
->encoder
->crtc
;
446 psb_intel_crtc
= to_psb_intel_crtc(crtc
);
448 for (i
= 0; i
< 256; i
++)
449 psb_intel_crtc
->lut_adj
[i
] = lut_arg
->lut
[i
];
451 psb_intel_crtc_load_lut(crtc
);
456 static int psb_mode_operation_ioctl(struct drm_device
*dev
, void *data
,
457 struct drm_file
*file_priv
)
461 struct drm_mode_modeinfo
*umode
;
462 struct drm_display_mode
*mode
= NULL
;
463 struct drm_psb_mode_operation_arg
*arg
;
464 struct drm_mode_object
*obj
;
465 struct drm_connector
*connector
;
466 struct drm_connector_helper_funcs
*connector_funcs
;
470 arg
= (struct drm_psb_mode_operation_arg
*)data
;
471 obj_id
= arg
->obj_id
;
475 case PSB_MODE_OPERATION_MODE_VALID
:
478 mutex_lock(&dev
->mode_config
.mutex
);
480 obj
= drm_mode_object_find(dev
, obj_id
,
481 DRM_MODE_OBJECT_CONNECTOR
);
487 connector
= obj_to_connector(obj
);
489 mode
= drm_mode_create(dev
);
495 /* drm_crtc_convert_umode(mode, umode); */
497 mode
->clock
= umode
->clock
;
498 mode
->hdisplay
= umode
->hdisplay
;
499 mode
->hsync_start
= umode
->hsync_start
;
500 mode
->hsync_end
= umode
->hsync_end
;
501 mode
->htotal
= umode
->htotal
;
502 mode
->hskew
= umode
->hskew
;
503 mode
->vdisplay
= umode
->vdisplay
;
504 mode
->vsync_start
= umode
->vsync_start
;
505 mode
->vsync_end
= umode
->vsync_end
;
506 mode
->vtotal
= umode
->vtotal
;
507 mode
->vscan
= umode
->vscan
;
508 mode
->vrefresh
= umode
->vrefresh
;
509 mode
->flags
= umode
->flags
;
510 mode
->type
= umode
->type
;
511 strncpy(mode
->name
, umode
->name
, DRM_DISPLAY_MODE_LEN
);
512 mode
->name
[DRM_DISPLAY_MODE_LEN
-1] = 0;
515 connector_funcs
= (struct drm_connector_helper_funcs
*)
516 connector
->helper_private
;
518 if (connector_funcs
->mode_valid
) {
519 resp
= connector_funcs
->mode_valid(connector
, mode
);
523 /*do some clean up work*/
525 drm_mode_destroy(dev
, mode
);
527 mutex_unlock(&dev
->mode_config
.mutex
);
531 dev_dbg(dev
->dev
, "Unsupported psb mode operation\n");
538 static int psb_stolen_memory_ioctl(struct drm_device
*dev
, void *data
,
539 struct drm_file
*file_priv
)
541 struct drm_psb_private
*dev_priv
= psb_priv(dev
);
542 struct drm_psb_stolen_memory_arg
*arg
= data
;
544 arg
->base
= dev_priv
->stolen_base
;
545 arg
->size
= dev_priv
->vram_stolen_size
;
550 static int psb_driver_open(struct drm_device
*dev
, struct drm_file
*priv
)
555 static void psb_driver_close(struct drm_device
*dev
, struct drm_file
*priv
)
559 static long psb_unlocked_ioctl(struct file
*filp
, unsigned int cmd
,
562 struct drm_file
*file_priv
= filp
->private_data
;
563 struct drm_device
*dev
= file_priv
->minor
->dev
;
564 struct drm_psb_private
*dev_priv
= dev
->dev_private
;
565 static unsigned int runtime_allowed
;
567 if (runtime_allowed
== 1 && dev_priv
->is_lvds_on
) {
569 pm_runtime_allow(&dev
->pdev
->dev
);
570 dev_priv
->rpm_enabled
= 1;
572 return drm_ioctl(filp
, cmd
, arg
);
573 /* FIXME: do we need to wrap the other side of this */
577 /* When a client dies:
578 * - Check for and clean up flipped page state
580 static void psb_driver_preclose(struct drm_device
*dev
, struct drm_file
*priv
)
584 static void psb_remove(struct pci_dev
*pdev
)
586 struct drm_device
*dev
= pci_get_drvdata(pdev
);
590 static const struct dev_pm_ops psb_pm_ops
= {
591 .resume
= gma_power_resume
,
592 .suspend
= gma_power_suspend
,
593 .runtime_suspend
= psb_runtime_suspend
,
594 .runtime_resume
= psb_runtime_resume
,
595 .runtime_idle
= psb_runtime_idle
,
598 static const struct vm_operations_struct psb_gem_vm_ops
= {
599 .fault
= psb_gem_fault
,
600 .open
= drm_gem_vm_open
,
601 .close
= drm_gem_vm_close
,
604 static const struct file_operations psb_gem_fops
= {
605 .owner
= THIS_MODULE
,
607 .release
= drm_release
,
608 .unlocked_ioctl
= psb_unlocked_ioctl
,
609 .mmap
= drm_gem_mmap
,
611 .fasync
= drm_fasync
,
615 static struct drm_driver driver
= {
616 .driver_features
= DRIVER_HAVE_IRQ
| DRIVER_IRQ_SHARED
| \
617 DRIVER_IRQ_VBL
| DRIVER_MODESET
| DRIVER_GEM
,
618 .load
= psb_driver_load
,
619 .unload
= psb_driver_unload
,
621 .ioctls
= psb_ioctls
,
622 .num_ioctls
= DRM_ARRAY_SIZE(psb_ioctls
),
623 .device_is_agp
= psb_driver_device_is_agp
,
624 .irq_preinstall
= psb_irq_preinstall
,
625 .irq_postinstall
= psb_irq_postinstall
,
626 .irq_uninstall
= psb_irq_uninstall
,
627 .irq_handler
= psb_irq_handler
,
628 .enable_vblank
= psb_enable_vblank
,
629 .disable_vblank
= psb_disable_vblank
,
630 .get_vblank_counter
= psb_get_vblank_counter
,
631 .lastclose
= psb_lastclose
,
632 .open
= psb_driver_open
,
633 .preclose
= psb_driver_preclose
,
634 .postclose
= psb_driver_close
,
635 .reclaim_buffers
= drm_core_reclaim_buffers
,
637 .gem_init_object
= psb_gem_init_object
,
638 .gem_free_object
= psb_gem_free_object
,
639 .gem_vm_ops
= &psb_gem_vm_ops
,
640 .dumb_create
= psb_gem_dumb_create
,
641 .dumb_map_offset
= psb_gem_dumb_map_gtt
,
642 .dumb_destroy
= psb_gem_dumb_destroy
,
643 .fops
= &psb_gem_fops
,
646 .date
= PSB_DRM_DRIVER_DATE
,
647 .major
= PSB_DRM_DRIVER_MAJOR
,
648 .minor
= PSB_DRM_DRIVER_MINOR
,
649 .patchlevel
= PSB_DRM_DRIVER_PATCHLEVEL
652 static struct pci_driver psb_pci_driver
= {
654 .id_table
= pciidlist
,
656 .remove
= psb_remove
,
662 static int psb_probe(struct pci_dev
*pdev
, const struct pci_device_id
*ent
)
664 return drm_get_pci_dev(pdev
, ent
, &driver
);
667 static int __init
psb_init(void)
669 return drm_pci_init(&driver
, &psb_pci_driver
);
672 static void __exit
psb_exit(void)
674 drm_pci_exit(&driver
, &psb_pci_driver
);
677 late_initcall(psb_init
);
678 module_exit(psb_exit
);
680 MODULE_AUTHOR("Alan Cox <alan@linux.intel.com> and others");
681 MODULE_DESCRIPTION(DRIVER_DESC
);
682 MODULE_LICENSE("GPL");