Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 1 | /************************************************************************** |
| 2 | * Copyright (c) 2007-2011, Intel Corporation. |
| 3 | * All Rights Reserved. |
| 4 | * Copyright (c) 2008, Tungsten Graphics, Inc. Cedar Park, TX., USA. |
| 5 | * All Rights Reserved. |
| 6 | * |
| 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. |
| 10 | * |
| 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 |
| 14 | * more details. |
| 15 | * |
| 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. |
| 19 | * |
| 20 | **************************************************************************/ |
| 21 | |
| 22 | #include <drm/drmP.h> |
| 23 | #include <drm/drm.h> |
David Howells | 760285e | 2012-10-02 18:01:07 +0100 | [diff] [blame] | 24 | #include <drm/gma_drm.h> |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 25 | #include "psb_drv.h" |
| 26 | #include "framebuffer.h" |
| 27 | #include "psb_reg.h" |
| 28 | #include "psb_intel_reg.h" |
| 29 | #include "intel_bios.h" |
| 30 | #include "mid_bios.h" |
| 31 | #include <drm/drm_pciids.h> |
| 32 | #include "power.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> |
Dave Airlie | af3a2cf | 2011-11-16 12:13:30 +0000 | [diff] [blame] | 38 | #include <linux/module.h> |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 39 | |
| 40 | static int drm_psb_trap_pagefaults; |
| 41 | |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 42 | static int psb_probe(struct pci_dev *pdev, const struct pci_device_id *ent); |
| 43 | |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 44 | MODULE_PARM_DESC(trap_pagefaults, "Error and reset on MMU pagefaults"); |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 45 | module_param_named(trap_pagefaults, drm_psb_trap_pagefaults, int, 0600); |
| 46 | |
| 47 | |
| 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 }, |
Alan Cox | 0cecdd8 | 2011-12-19 21:06:35 +0000 | [diff] [blame] | 51 | #if defined(CONFIG_DRM_GMA600) |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 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}, |
Alan Cox | 56125db | 2011-12-28 15:16:07 +0000 | [diff] [blame] | 60 | /* Atom E620 */ |
| 61 | { 0x8086, 0x4108, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops}, |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 62 | #endif |
Kirill A. Shutemov | 026abc3 | 2012-03-08 16:02:20 +0000 | [diff] [blame] | 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}, |
| 72 | #endif |
Alan Cox | b6195aa | 2011-12-29 14:37:03 +0000 | [diff] [blame] | 73 | #if defined(CONFIG_DRM_GMA3600) |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 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}, |
Alan Cox | 9aa65a2 | 2012-05-11 11:32:46 +0100 | [diff] [blame] | 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}, |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 90 | #endif |
Kirill A. Shutemov | aa53f53 | 2012-03-08 16:09:19 +0000 | [diff] [blame] | 91 | { 0, } |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 92 | }; |
| 93 | MODULE_DEVICE_TABLE(pci, pciidlist); |
| 94 | |
| 95 | /* |
| 96 | * Standard IOCTLs. |
| 97 | */ |
| 98 | |
Kirill A. Shutemov | 670c044 | 2012-03-08 16:04:32 +0000 | [diff] [blame] | 99 | #define DRM_IOCTL_GMA_ADB \ |
Alan Cox | 770179d | 2011-11-16 22:39:18 +0000 | [diff] [blame] | 100 | DRM_IOWR(DRM_GMA_ADB + DRM_COMMAND_BASE, uint32_t) |
Kirill A. Shutemov | 670c044 | 2012-03-08 16:04:32 +0000 | [diff] [blame] | 101 | #define DRM_IOCTL_GMA_MODE_OPERATION \ |
Alan Cox | 770179d | 2011-11-16 22:39:18 +0000 | [diff] [blame] | 102 | DRM_IOWR(DRM_GMA_MODE_OPERATION + DRM_COMMAND_BASE, \ |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 103 | struct drm_psb_mode_operation_arg) |
Kirill A. Shutemov | 670c044 | 2012-03-08 16:04:32 +0000 | [diff] [blame] | 104 | #define DRM_IOCTL_GMA_STOLEN_MEMORY \ |
Alan Cox | 770179d | 2011-11-16 22:39:18 +0000 | [diff] [blame] | 105 | DRM_IOWR(DRM_GMA_STOLEN_MEMORY + DRM_COMMAND_BASE, \ |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 106 | struct drm_psb_stolen_memory_arg) |
Kirill A. Shutemov | 670c044 | 2012-03-08 16:04:32 +0000 | [diff] [blame] | 107 | #define DRM_IOCTL_GMA_GAMMA \ |
Alan Cox | 770179d | 2011-11-16 22:39:18 +0000 | [diff] [blame] | 108 | DRM_IOWR(DRM_GMA_GAMMA + DRM_COMMAND_BASE, \ |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 109 | struct drm_psb_dpst_lut_arg) |
Kirill A. Shutemov | 670c044 | 2012-03-08 16:04:32 +0000 | [diff] [blame] | 110 | #define DRM_IOCTL_GMA_DPST_BL \ |
Alan Cox | 770179d | 2011-11-16 22:39:18 +0000 | [diff] [blame] | 111 | DRM_IOWR(DRM_GMA_DPST_BL + DRM_COMMAND_BASE, \ |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 112 | uint32_t) |
Kirill A. Shutemov | 670c044 | 2012-03-08 16:04:32 +0000 | [diff] [blame] | 113 | #define DRM_IOCTL_GMA_GET_PIPE_FROM_CRTC_ID \ |
Alan Cox | 770179d | 2011-11-16 22:39:18 +0000 | [diff] [blame] | 114 | DRM_IOWR(DRM_GMA_GET_PIPE_FROM_CRTC_ID + DRM_COMMAND_BASE, \ |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 115 | struct drm_psb_get_pipe_from_crtc_id_arg) |
Kirill A. Shutemov | 670c044 | 2012-03-08 16:04:32 +0000 | [diff] [blame] | 116 | #define DRM_IOCTL_GMA_GEM_CREATE \ |
Alan Cox | 770179d | 2011-11-16 22:39:18 +0000 | [diff] [blame] | 117 | DRM_IOWR(DRM_GMA_GEM_CREATE + DRM_COMMAND_BASE, \ |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 118 | struct drm_psb_gem_create) |
Kirill A. Shutemov | 670c044 | 2012-03-08 16:04:32 +0000 | [diff] [blame] | 119 | #define DRM_IOCTL_GMA_GEM_MMAP \ |
Alan Cox | 770179d | 2011-11-16 22:39:18 +0000 | [diff] [blame] | 120 | DRM_IOWR(DRM_GMA_GEM_MMAP + DRM_COMMAND_BASE, \ |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 121 | struct drm_psb_gem_mmap) |
| 122 | |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 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); |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 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); |
| 133 | |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 134 | static struct drm_ioctl_desc psb_ioctls[] = { |
Kirill A. Shutemov | 670c044 | 2012-03-08 16:04:32 +0000 | [diff] [blame] | 135 | DRM_IOCTL_DEF_DRV(GMA_ADB, psb_adb_ioctl, DRM_AUTH), |
| 136 | DRM_IOCTL_DEF_DRV(GMA_MODE_OPERATION, psb_mode_operation_ioctl, |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 137 | DRM_AUTH), |
Kirill A. Shutemov | 670c044 | 2012-03-08 16:04:32 +0000 | [diff] [blame] | 138 | DRM_IOCTL_DEF_DRV(GMA_STOLEN_MEMORY, psb_stolen_memory_ioctl, |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 139 | DRM_AUTH), |
Kirill A. Shutemov | 670c044 | 2012-03-08 16:04:32 +0000 | [diff] [blame] | 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, |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 143 | psb_intel_get_pipe_from_crtc_id, 0), |
Kirill A. Shutemov | 670c044 | 2012-03-08 16:04:32 +0000 | [diff] [blame] | 144 | DRM_IOCTL_DEF_DRV(GMA_GEM_CREATE, psb_gem_create_ioctl, |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 145 | DRM_UNLOCKED | DRM_AUTH), |
Kirill A. Shutemov | 670c044 | 2012-03-08 16:04:32 +0000 | [diff] [blame] | 146 | DRM_IOCTL_DEF_DRV(GMA_GEM_MMAP, psb_gem_mmap_ioctl, |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 147 | DRM_UNLOCKED | DRM_AUTH), |
| 148 | }; |
| 149 | |
| 150 | static void psb_lastclose(struct drm_device *dev) |
| 151 | { |
Daniel Vetter | 7147573 | 2012-12-02 21:55:41 +0100 | [diff] [blame] | 152 | int ret; |
| 153 | struct drm_psb_private *dev_priv = dev->dev_private; |
| 154 | struct psb_fbdev *fbdev = dev_priv->fbdev; |
| 155 | |
Daniel Vetter | 0a81951 | 2012-12-02 01:33:17 +0100 | [diff] [blame] | 156 | drm_modeset_lock_all(dev); |
Daniel Vetter | 7147573 | 2012-12-02 21:55:41 +0100 | [diff] [blame] | 157 | ret = drm_fb_helper_restore_fbdev_mode(&fbdev->psb_fb_helper); |
| 158 | if (ret) |
| 159 | DRM_DEBUG("failed to restore crtc mode\n"); |
Daniel Vetter | 0a81951 | 2012-12-02 01:33:17 +0100 | [diff] [blame] | 160 | drm_modeset_unlock_all(dev); |
Daniel Vetter | 7147573 | 2012-12-02 21:55:41 +0100 | [diff] [blame] | 161 | |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 162 | return; |
| 163 | } |
| 164 | |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 165 | static int psb_do_init(struct drm_device *dev) |
| 166 | { |
| 167 | struct drm_psb_private *dev_priv = dev->dev_private; |
| 168 | struct psb_gtt *pg = &dev_priv->gtt; |
| 169 | |
| 170 | uint32_t stolen_gtt; |
| 171 | |
| 172 | int ret = -ENOMEM; |
| 173 | |
| 174 | if (pg->mmu_gatt_start & 0x0FFFFFFF) { |
| 175 | dev_err(dev->dev, "Gatt must be 256M aligned. This is a bug.\n"); |
| 176 | ret = -EINVAL; |
| 177 | goto out_err; |
| 178 | } |
| 179 | |
| 180 | |
| 181 | stolen_gtt = (pg->stolen_size >> PAGE_SHIFT) * 4; |
| 182 | stolen_gtt = (stolen_gtt + PAGE_SIZE - 1) >> PAGE_SHIFT; |
| 183 | stolen_gtt = |
| 184 | (stolen_gtt < pg->gtt_pages) ? stolen_gtt : pg->gtt_pages; |
| 185 | |
| 186 | dev_priv->gatt_free_offset = pg->mmu_gatt_start + |
| 187 | (stolen_gtt << PAGE_SHIFT) * 1024; |
| 188 | |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 189 | spin_lock_init(&dev_priv->irqmask_lock); |
Alan Cox | 9242fe2 | 2011-11-29 22:27:10 +0000 | [diff] [blame] | 190 | spin_lock_init(&dev_priv->lock_2d); |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 191 | |
| 192 | PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK0); |
| 193 | PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK1); |
| 194 | PSB_RSGX32(PSB_CR_BIF_BANK1); |
| 195 | PSB_WSGX32(PSB_RSGX32(PSB_CR_BIF_CTRL) | _PSB_MMU_ER_MASK, |
| 196 | PSB_CR_BIF_CTRL); |
| 197 | psb_spank(dev_priv); |
| 198 | |
| 199 | /* mmu_gatt ?? */ |
| 200 | PSB_WSGX32(pg->gatt_start, PSB_CR_BIF_TWOD_REQ_BASE); |
| 201 | return 0; |
| 202 | out_err: |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 203 | return ret; |
| 204 | } |
| 205 | |
| 206 | static int psb_driver_unload(struct drm_device *dev) |
| 207 | { |
| 208 | struct drm_psb_private *dev_priv = dev->dev_private; |
| 209 | |
| 210 | /* Kill vblank etc here */ |
| 211 | |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 212 | |
| 213 | if (dev_priv) { |
Alan Cox | 4ab2c7f | 2012-05-14 12:04:00 +0100 | [diff] [blame] | 214 | if (dev_priv->backlight_device) |
| 215 | gma_backlight_exit(dev); |
| 216 | psb_modeset_cleanup(dev); |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 217 | |
| 218 | if (dev_priv->ops->chip_teardown) |
| 219 | dev_priv->ops->chip_teardown(dev); |
Alan Cox | 6607e02 | 2012-05-14 12:03:34 +0100 | [diff] [blame] | 220 | |
| 221 | psb_intel_opregion_fini(dev); |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 222 | |
| 223 | if (dev_priv->pf_pd) { |
| 224 | psb_mmu_free_pagedir(dev_priv->pf_pd); |
| 225 | dev_priv->pf_pd = NULL; |
| 226 | } |
| 227 | if (dev_priv->mmu) { |
| 228 | struct psb_gtt *pg = &dev_priv->gtt; |
| 229 | |
| 230 | down_read(&pg->sem); |
| 231 | psb_mmu_remove_pfn_sequence( |
| 232 | psb_mmu_get_default_pd |
| 233 | (dev_priv->mmu), |
| 234 | pg->mmu_gatt_start, |
| 235 | dev_priv->vram_stolen_size >> PAGE_SHIFT); |
| 236 | up_read(&pg->sem); |
| 237 | psb_mmu_driver_takedown(dev_priv->mmu); |
| 238 | dev_priv->mmu = NULL; |
| 239 | } |
| 240 | psb_gtt_takedown(dev); |
| 241 | if (dev_priv->scratch_page) { |
Alan Cox | 1896344 | 2012-04-25 14:36:13 +0100 | [diff] [blame] | 242 | set_pages_wb(dev_priv->scratch_page, 1); |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 243 | __free_page(dev_priv->scratch_page); |
| 244 | dev_priv->scratch_page = NULL; |
| 245 | } |
| 246 | if (dev_priv->vdc_reg) { |
| 247 | iounmap(dev_priv->vdc_reg); |
| 248 | dev_priv->vdc_reg = NULL; |
| 249 | } |
| 250 | if (dev_priv->sgx_reg) { |
| 251 | iounmap(dev_priv->sgx_reg); |
| 252 | dev_priv->sgx_reg = NULL; |
| 253 | } |
| 254 | |
Alan Cox | 4ab2c7f | 2012-05-14 12:04:00 +0100 | [diff] [blame] | 255 | /* Destroy VBT data */ |
| 256 | psb_intel_destroy_bios(dev); |
| 257 | |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 258 | kfree(dev_priv); |
| 259 | dev->dev_private = NULL; |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 260 | } |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 261 | gma_power_uninit(dev); |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 262 | return 0; |
| 263 | } |
| 264 | |
| 265 | |
| 266 | static int psb_driver_load(struct drm_device *dev, unsigned long chipset) |
| 267 | { |
| 268 | struct drm_psb_private *dev_priv; |
| 269 | unsigned long resource_start; |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 270 | unsigned long irqflags; |
| 271 | int ret = -ENOMEM; |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 272 | struct drm_connector *connector; |
Patrik Jakobsson | 1730f89 | 2011-12-19 21:40:33 +0000 | [diff] [blame] | 273 | struct psb_intel_encoder *psb_intel_encoder; |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 274 | |
| 275 | dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL); |
| 276 | if (dev_priv == NULL) |
| 277 | return -ENOMEM; |
| 278 | |
| 279 | dev_priv->ops = (struct psb_ops *)chipset; |
| 280 | dev_priv->dev = dev; |
| 281 | dev->dev_private = (void *) dev_priv; |
| 282 | |
Dave Airlie | 466e69b | 2011-12-19 11:15:29 +0000 | [diff] [blame] | 283 | pci_set_master(dev->pdev); |
| 284 | |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 285 | dev_priv->num_pipe = dev_priv->ops->pipes; |
| 286 | |
| 287 | resource_start = pci_resource_start(dev->pdev, PSB_MMIO_RESOURCE); |
| 288 | |
| 289 | dev_priv->vdc_reg = |
| 290 | ioremap(resource_start + PSB_VDC_OFFSET, PSB_VDC_SIZE); |
| 291 | if (!dev_priv->vdc_reg) |
| 292 | goto out_err; |
| 293 | |
| 294 | dev_priv->sgx_reg = ioremap(resource_start + dev_priv->ops->sgx_offset, |
| 295 | PSB_SGX_SIZE); |
| 296 | if (!dev_priv->sgx_reg) |
| 297 | goto out_err; |
| 298 | |
Alan Cox | d839ede | 2012-05-03 15:06:18 +0100 | [diff] [blame] | 299 | psb_intel_opregion_setup(dev); |
| 300 | |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 301 | ret = dev_priv->ops->chip_setup(dev); |
| 302 | if (ret) |
| 303 | goto out_err; |
| 304 | |
| 305 | /* Init OSPM support */ |
| 306 | gma_power_init(dev); |
| 307 | |
| 308 | ret = -ENOMEM; |
| 309 | |
| 310 | dev_priv->scratch_page = alloc_page(GFP_DMA32 | __GFP_ZERO); |
| 311 | if (!dev_priv->scratch_page) |
| 312 | goto out_err; |
| 313 | |
| 314 | set_pages_uc(dev_priv->scratch_page, 1); |
| 315 | |
| 316 | ret = psb_gtt_init(dev, 0); |
| 317 | if (ret) |
| 318 | goto out_err; |
| 319 | |
| 320 | dev_priv->mmu = psb_mmu_driver_init((void *)0, |
| 321 | drm_psb_trap_pagefaults, 0, |
| 322 | dev_priv); |
| 323 | if (!dev_priv->mmu) |
| 324 | goto out_err; |
| 325 | |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 326 | dev_priv->pf_pd = psb_mmu_alloc_pd(dev_priv->mmu, 1, 0); |
| 327 | if (!dev_priv->pf_pd) |
| 328 | goto out_err; |
| 329 | |
| 330 | psb_mmu_set_pd_context(psb_mmu_get_default_pd(dev_priv->mmu), 0); |
| 331 | psb_mmu_set_pd_context(dev_priv->pf_pd, 1); |
| 332 | |
| 333 | ret = psb_do_init(dev); |
| 334 | if (ret) |
| 335 | return ret; |
| 336 | |
| 337 | PSB_WSGX32(0x20000000, PSB_CR_PDS_EXEC_BASE); |
| 338 | PSB_WSGX32(0x30000000, PSB_CR_BIF_3D_REQ_BASE); |
| 339 | |
Alan Cox | d839ede | 2012-05-03 15:06:18 +0100 | [diff] [blame] | 340 | acpi_video_register(); |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 341 | |
| 342 | ret = drm_vblank_init(dev, dev_priv->num_pipe); |
| 343 | if (ret) |
| 344 | goto out_err; |
| 345 | |
| 346 | /* |
| 347 | * Install interrupt handlers prior to powering off SGX or else we will |
| 348 | * crash. |
| 349 | */ |
| 350 | dev_priv->vdc_irq_mask = 0; |
| 351 | dev_priv->pipestat[0] = 0; |
| 352 | dev_priv->pipestat[1] = 0; |
| 353 | dev_priv->pipestat[2] = 0; |
| 354 | spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags); |
| 355 | PSB_WVDC32(0xFFFFFFFF, PSB_HWSTAM); |
| 356 | PSB_WVDC32(0x00000000, PSB_INT_ENABLE_R); |
| 357 | PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R); |
| 358 | spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); |
Alan Cox | 62363a4 | 2012-05-11 11:33:17 +0100 | [diff] [blame] | 359 | |
| 360 | drm_irq_install(dev); |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 361 | |
| 362 | dev->vblank_disable_allowed = 1; |
| 363 | |
| 364 | dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ |
| 365 | |
| 366 | dev->driver->get_vblank_counter = psb_get_vblank_counter; |
| 367 | |
Alan Cox | f9f23a7 | 2011-12-29 14:38:07 +0000 | [diff] [blame] | 368 | psb_modeset_init(dev); |
| 369 | psb_fbdev_init(dev); |
| 370 | drm_kms_helper_poll_init(dev); |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 371 | |
| 372 | /* Only add backlight support if we have LVDS output */ |
| 373 | list_for_each_entry(connector, &dev->mode_config.connector_list, |
| 374 | head) { |
Patrik Jakobsson | 1730f89 | 2011-12-19 21:40:33 +0000 | [diff] [blame] | 375 | psb_intel_encoder = psb_intel_attached_encoder(connector); |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 376 | |
Patrik Jakobsson | 1730f89 | 2011-12-19 21:40:33 +0000 | [diff] [blame] | 377 | switch (psb_intel_encoder->type) { |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 378 | case INTEL_OUTPUT_LVDS: |
| 379 | case INTEL_OUTPUT_MIPI: |
| 380 | ret = gma_backlight_init(dev); |
| 381 | break; |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | if (ret) |
| 386 | return ret; |
Alan Cox | 166973e | 2012-07-16 17:52:45 +0100 | [diff] [blame] | 387 | psb_intel_opregion_enable_asle(dev); |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 388 | #if 0 |
| 389 | /*enable runtime pm at last*/ |
| 390 | pm_runtime_enable(&dev->pdev->dev); |
| 391 | pm_runtime_set_active(&dev->pdev->dev); |
| 392 | #endif |
| 393 | /*Intel drm driver load is done, continue doing pvr load*/ |
| 394 | return 0; |
| 395 | out_err: |
| 396 | psb_driver_unload(dev); |
| 397 | return ret; |
| 398 | } |
| 399 | |
Kirill A. Shutemov | 15308e2 | 2012-03-08 16:08:45 +0000 | [diff] [blame] | 400 | static int psb_driver_device_is_agp(struct drm_device *dev) |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 401 | { |
| 402 | return 0; |
| 403 | } |
| 404 | |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 405 | static inline void get_brightness(struct backlight_device *bd) |
| 406 | { |
| 407 | #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE |
| 408 | if (bd) { |
| 409 | bd->props.brightness = bd->ops->get_brightness(bd); |
| 410 | backlight_update_status(bd); |
| 411 | } |
| 412 | #endif |
| 413 | } |
| 414 | |
| 415 | static int psb_dpst_bl_ioctl(struct drm_device *dev, void *data, |
| 416 | struct drm_file *file_priv) |
| 417 | { |
| 418 | struct drm_psb_private *dev_priv = psb_priv(dev); |
| 419 | uint32_t *arg = data; |
| 420 | |
| 421 | dev_priv->blc_adj2 = *arg; |
| 422 | get_brightness(dev_priv->backlight_device); |
| 423 | return 0; |
| 424 | } |
| 425 | |
| 426 | static int psb_adb_ioctl(struct drm_device *dev, void *data, |
| 427 | struct drm_file *file_priv) |
| 428 | { |
| 429 | struct drm_psb_private *dev_priv = psb_priv(dev); |
| 430 | uint32_t *arg = data; |
| 431 | |
| 432 | dev_priv->blc_adj1 = *arg; |
| 433 | get_brightness(dev_priv->backlight_device); |
| 434 | return 0; |
| 435 | } |
| 436 | |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 437 | static int psb_gamma_ioctl(struct drm_device *dev, void *data, |
| 438 | struct drm_file *file_priv) |
| 439 | { |
| 440 | struct drm_psb_dpst_lut_arg *lut_arg = data; |
| 441 | struct drm_mode_object *obj; |
| 442 | struct drm_crtc *crtc; |
| 443 | struct drm_connector *connector; |
| 444 | struct psb_intel_crtc *psb_intel_crtc; |
| 445 | int i = 0; |
| 446 | int32_t obj_id; |
| 447 | |
| 448 | obj_id = lut_arg->output_id; |
| 449 | obj = drm_mode_object_find(dev, obj_id, DRM_MODE_OBJECT_CONNECTOR); |
| 450 | if (!obj) { |
| 451 | dev_dbg(dev->dev, "Invalid Connector object.\n"); |
| 452 | return -EINVAL; |
| 453 | } |
| 454 | |
| 455 | connector = obj_to_connector(obj); |
| 456 | crtc = connector->encoder->crtc; |
| 457 | psb_intel_crtc = to_psb_intel_crtc(crtc); |
| 458 | |
| 459 | for (i = 0; i < 256; i++) |
| 460 | psb_intel_crtc->lut_adj[i] = lut_arg->lut[i]; |
| 461 | |
| 462 | psb_intel_crtc_load_lut(crtc); |
| 463 | |
| 464 | return 0; |
| 465 | } |
| 466 | |
| 467 | static int psb_mode_operation_ioctl(struct drm_device *dev, void *data, |
| 468 | struct drm_file *file_priv) |
| 469 | { |
| 470 | uint32_t obj_id; |
| 471 | uint16_t op; |
| 472 | struct drm_mode_modeinfo *umode; |
| 473 | struct drm_display_mode *mode = NULL; |
| 474 | struct drm_psb_mode_operation_arg *arg; |
| 475 | struct drm_mode_object *obj; |
| 476 | struct drm_connector *connector; |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 477 | struct drm_connector_helper_funcs *connector_funcs; |
| 478 | int ret = 0; |
| 479 | int resp = MODE_OK; |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 480 | |
| 481 | arg = (struct drm_psb_mode_operation_arg *)data; |
| 482 | obj_id = arg->obj_id; |
| 483 | op = arg->operation; |
| 484 | |
| 485 | switch (op) { |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 486 | case PSB_MODE_OPERATION_MODE_VALID: |
| 487 | umode = &arg->mode; |
| 488 | |
Daniel Vetter | 0a81951 | 2012-12-02 01:33:17 +0100 | [diff] [blame] | 489 | drm_modeset_lock_all(dev); |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 490 | |
| 491 | obj = drm_mode_object_find(dev, obj_id, |
| 492 | DRM_MODE_OBJECT_CONNECTOR); |
| 493 | if (!obj) { |
| 494 | ret = -EINVAL; |
| 495 | goto mode_op_out; |
| 496 | } |
| 497 | |
| 498 | connector = obj_to_connector(obj); |
| 499 | |
| 500 | mode = drm_mode_create(dev); |
| 501 | if (!mode) { |
| 502 | ret = -ENOMEM; |
| 503 | goto mode_op_out; |
| 504 | } |
| 505 | |
| 506 | /* drm_crtc_convert_umode(mode, umode); */ |
| 507 | { |
| 508 | mode->clock = umode->clock; |
| 509 | mode->hdisplay = umode->hdisplay; |
| 510 | mode->hsync_start = umode->hsync_start; |
| 511 | mode->hsync_end = umode->hsync_end; |
| 512 | mode->htotal = umode->htotal; |
| 513 | mode->hskew = umode->hskew; |
| 514 | mode->vdisplay = umode->vdisplay; |
| 515 | mode->vsync_start = umode->vsync_start; |
| 516 | mode->vsync_end = umode->vsync_end; |
| 517 | mode->vtotal = umode->vtotal; |
| 518 | mode->vscan = umode->vscan; |
| 519 | mode->vrefresh = umode->vrefresh; |
| 520 | mode->flags = umode->flags; |
| 521 | mode->type = umode->type; |
| 522 | strncpy(mode->name, umode->name, DRM_DISPLAY_MODE_LEN); |
| 523 | mode->name[DRM_DISPLAY_MODE_LEN-1] = 0; |
| 524 | } |
| 525 | |
| 526 | connector_funcs = (struct drm_connector_helper_funcs *) |
| 527 | connector->helper_private; |
| 528 | |
| 529 | if (connector_funcs->mode_valid) { |
| 530 | resp = connector_funcs->mode_valid(connector, mode); |
Alan Cox | 61bedf7 | 2011-11-16 22:38:42 +0000 | [diff] [blame] | 531 | arg->data = resp; |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 532 | } |
| 533 | |
| 534 | /*do some clean up work*/ |
| 535 | if (mode) |
| 536 | drm_mode_destroy(dev, mode); |
| 537 | mode_op_out: |
Daniel Vetter | 0a81951 | 2012-12-02 01:33:17 +0100 | [diff] [blame] | 538 | drm_modeset_unlock_all(dev); |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 539 | return ret; |
| 540 | |
| 541 | default: |
| 542 | dev_dbg(dev->dev, "Unsupported psb mode operation\n"); |
| 543 | return -EOPNOTSUPP; |
| 544 | } |
| 545 | |
| 546 | return 0; |
| 547 | } |
| 548 | |
| 549 | static int psb_stolen_memory_ioctl(struct drm_device *dev, void *data, |
| 550 | struct drm_file *file_priv) |
| 551 | { |
| 552 | struct drm_psb_private *dev_priv = psb_priv(dev); |
| 553 | struct drm_psb_stolen_memory_arg *arg = data; |
| 554 | |
| 555 | arg->base = dev_priv->stolen_base; |
| 556 | arg->size = dev_priv->vram_stolen_size; |
| 557 | |
| 558 | return 0; |
| 559 | } |
| 560 | |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 561 | static int psb_driver_open(struct drm_device *dev, struct drm_file *priv) |
| 562 | { |
| 563 | return 0; |
| 564 | } |
| 565 | |
| 566 | static void psb_driver_close(struct drm_device *dev, struct drm_file *priv) |
| 567 | { |
| 568 | } |
| 569 | |
| 570 | static long psb_unlocked_ioctl(struct file *filp, unsigned int cmd, |
| 571 | unsigned long arg) |
| 572 | { |
| 573 | struct drm_file *file_priv = filp->private_data; |
| 574 | struct drm_device *dev = file_priv->minor->dev; |
| 575 | struct drm_psb_private *dev_priv = dev->dev_private; |
| 576 | static unsigned int runtime_allowed; |
| 577 | |
| 578 | if (runtime_allowed == 1 && dev_priv->is_lvds_on) { |
| 579 | runtime_allowed++; |
| 580 | pm_runtime_allow(&dev->pdev->dev); |
| 581 | dev_priv->rpm_enabled = 1; |
| 582 | } |
| 583 | return drm_ioctl(filp, cmd, arg); |
| 584 | /* FIXME: do we need to wrap the other side of this */ |
| 585 | } |
| 586 | |
| 587 | |
| 588 | /* When a client dies: |
| 589 | * - Check for and clean up flipped page state |
| 590 | */ |
Kirill A. Shutemov | 15308e2 | 2012-03-08 16:08:45 +0000 | [diff] [blame] | 591 | static void psb_driver_preclose(struct drm_device *dev, struct drm_file *priv) |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 592 | { |
| 593 | } |
| 594 | |
| 595 | static void psb_remove(struct pci_dev *pdev) |
| 596 | { |
| 597 | struct drm_device *dev = pci_get_drvdata(pdev); |
| 598 | drm_put_dev(dev); |
| 599 | } |
| 600 | |
| 601 | static const struct dev_pm_ops psb_pm_ops = { |
| 602 | .resume = gma_power_resume, |
| 603 | .suspend = gma_power_suspend, |
| 604 | .runtime_suspend = psb_runtime_suspend, |
| 605 | .runtime_resume = psb_runtime_resume, |
| 606 | .runtime_idle = psb_runtime_idle, |
| 607 | }; |
| 608 | |
Laurent Pinchart | 78b6855 | 2012-05-17 13:27:22 +0200 | [diff] [blame] | 609 | static const struct vm_operations_struct psb_gem_vm_ops = { |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 610 | .fault = psb_gem_fault, |
| 611 | .open = drm_gem_vm_open, |
| 612 | .close = drm_gem_vm_close, |
| 613 | }; |
| 614 | |
Ilija Hadzic | 1595c56 | 2011-11-27 11:08:33 -0500 | [diff] [blame] | 615 | static const struct file_operations psb_gem_fops = { |
| 616 | .owner = THIS_MODULE, |
| 617 | .open = drm_open, |
| 618 | .release = drm_release, |
| 619 | .unlocked_ioctl = psb_unlocked_ioctl, |
| 620 | .mmap = drm_gem_mmap, |
| 621 | .poll = drm_poll, |
| 622 | .fasync = drm_fasync, |
| 623 | .read = drm_read, |
| 624 | }; |
| 625 | |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 626 | static struct drm_driver driver = { |
| 627 | .driver_features = DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | \ |
| 628 | DRIVER_IRQ_VBL | DRIVER_MODESET | DRIVER_GEM , |
| 629 | .load = psb_driver_load, |
| 630 | .unload = psb_driver_unload, |
| 631 | |
| 632 | .ioctls = psb_ioctls, |
| 633 | .num_ioctls = DRM_ARRAY_SIZE(psb_ioctls), |
| 634 | .device_is_agp = psb_driver_device_is_agp, |
| 635 | .irq_preinstall = psb_irq_preinstall, |
| 636 | .irq_postinstall = psb_irq_postinstall, |
| 637 | .irq_uninstall = psb_irq_uninstall, |
| 638 | .irq_handler = psb_irq_handler, |
| 639 | .enable_vblank = psb_enable_vblank, |
| 640 | .disable_vblank = psb_disable_vblank, |
| 641 | .get_vblank_counter = psb_get_vblank_counter, |
| 642 | .lastclose = psb_lastclose, |
| 643 | .open = psb_driver_open, |
| 644 | .preclose = psb_driver_preclose, |
| 645 | .postclose = psb_driver_close, |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 646 | |
| 647 | .gem_init_object = psb_gem_init_object, |
| 648 | .gem_free_object = psb_gem_free_object, |
| 649 | .gem_vm_ops = &psb_gem_vm_ops, |
| 650 | .dumb_create = psb_gem_dumb_create, |
| 651 | .dumb_map_offset = psb_gem_dumb_map_gtt, |
| 652 | .dumb_destroy = psb_gem_dumb_destroy, |
Ilija Hadzic | 1595c56 | 2011-11-27 11:08:33 -0500 | [diff] [blame] | 653 | .fops = &psb_gem_fops, |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 654 | .name = DRIVER_NAME, |
| 655 | .desc = DRIVER_DESC, |
| 656 | .date = PSB_DRM_DRIVER_DATE, |
| 657 | .major = PSB_DRM_DRIVER_MAJOR, |
| 658 | .minor = PSB_DRM_DRIVER_MINOR, |
| 659 | .patchlevel = PSB_DRM_DRIVER_PATCHLEVEL |
| 660 | }; |
| 661 | |
| 662 | static struct pci_driver psb_pci_driver = { |
| 663 | .name = DRIVER_NAME, |
| 664 | .id_table = pciidlist, |
| 665 | .probe = psb_probe, |
| 666 | .remove = psb_remove, |
Kirill A. Shutemov | aa53f53 | 2012-03-08 16:09:19 +0000 | [diff] [blame] | 667 | .driver = { |
| 668 | .pm = &psb_pm_ops, |
| 669 | } |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 670 | }; |
| 671 | |
| 672 | static int psb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
| 673 | { |
Alan Cox | 5c49fd3 | 2011-11-03 18:22:04 +0000 | [diff] [blame] | 674 | return drm_get_pci_dev(pdev, ent, &driver); |
| 675 | } |
| 676 | |
| 677 | static int __init psb_init(void) |
| 678 | { |
| 679 | return drm_pci_init(&driver, &psb_pci_driver); |
| 680 | } |
| 681 | |
| 682 | static void __exit psb_exit(void) |
| 683 | { |
| 684 | drm_pci_exit(&driver, &psb_pci_driver); |
| 685 | } |
| 686 | |
| 687 | late_initcall(psb_init); |
| 688 | module_exit(psb_exit); |
| 689 | |
| 690 | MODULE_AUTHOR("Alan Cox <alan@linux.intel.com> and others"); |
| 691 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 692 | MODULE_LICENSE("GPL"); |