1 /************************************************************************** 2 * Copyright (c) 2007-2011, Intel Corporation. 3 * All Rights Reserved. 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms and conditions of the GNU General Public License, 7 * version 2, as published by the Free Software Foundation. 8 * 9 * This program is distributed in the hope it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 * more details. 13 * 14 * You should have received a copy of the GNU General Public License along with 15 * this program; if not, write to the Free Software Foundation, Inc., 16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 17 * 18 **************************************************************************/ 19 20 #include <linux/module.h> 21 #include <linux/kernel.h> 22 #include <linux/errno.h> 23 #include <linux/string.h> 24 #include <linux/pfn_t.h> 25 #include <linux/mm.h> 26 #include <linux/tty.h> 27 #include <linux/slab.h> 28 #include <linux/delay.h> 29 #include <linux/init.h> 30 #include <linux/console.h> 31 32 #include <drm/drmP.h> 33 #include <drm/drm.h> 34 #include <drm/drm_crtc.h> 35 #include <drm/drm_fb_helper.h> 36 #include <drm/drm_gem_framebuffer_helper.h> 37 38 #include "psb_drv.h" 39 #include "psb_intel_reg.h" 40 #include "psb_intel_drv.h" 41 #include "framebuffer.h" 42 #include "gtt.h" 43 44 static const struct drm_framebuffer_funcs psb_fb_funcs = { 45 .destroy = drm_gem_fb_destroy, 46 .create_handle = drm_gem_fb_create_handle, 47 }; 48 49 #define CMAP_TOHW(_val, _width) ((((_val) << (_width)) + 0x7FFF - (_val)) >> 16) 50 51 static int psbfb_setcolreg(unsigned regno, unsigned red, unsigned green, 52 unsigned blue, unsigned transp, 53 struct fb_info *info) 54 { 55 struct psb_fbdev *fbdev = info->par; 56 struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb; 57 uint32_t v; 58 59 if (!fb) 60 return -ENOMEM; 61 62 if (regno > 255) 63 return 1; 64 65 red = CMAP_TOHW(red, info->var.red.length); 66 blue = CMAP_TOHW(blue, info->var.blue.length); 67 green = CMAP_TOHW(green, info->var.green.length); 68 transp = CMAP_TOHW(transp, info->var.transp.length); 69 70 v = (red << info->var.red.offset) | 71 (green << info->var.green.offset) | 72 (blue << info->var.blue.offset) | 73 (transp << info->var.transp.offset); 74 75 if (regno < 16) { 76 switch (fb->format->cpp[0] * 8) { 77 case 16: 78 ((uint32_t *) info->pseudo_palette)[regno] = v; 79 break; 80 case 24: 81 case 32: 82 ((uint32_t *) info->pseudo_palette)[regno] = v; 83 break; 84 } 85 } 86 87 return 0; 88 } 89 90 static int psbfb_pan(struct fb_var_screeninfo *var, struct fb_info *info) 91 { 92 struct psb_fbdev *fbdev = info->par; 93 struct psb_framebuffer *psbfb = &fbdev->pfb; 94 struct drm_device *dev = psbfb->base.dev; 95 struct gtt_range *gtt = to_gtt_range(psbfb->base.obj[0]); 96 97 /* 98 * We have to poke our nose in here. The core fb code assumes 99 * panning is part of the hardware that can be invoked before 100 * the actual fb is mapped. In our case that isn't quite true. 101 */ 102 if (gtt->npage) { 103 /* GTT roll shifts in 4K pages, we need to shift the right 104 number of pages */ 105 int pages = info->fix.line_length >> 12; 106 psb_gtt_roll(dev, gtt, var->yoffset * pages); 107 } 108 return 0; 109 } 110 111 static vm_fault_t psbfb_vm_fault(struct vm_fault *vmf) 112 { 113 struct vm_area_struct *vma = vmf->vma; 114 struct psb_framebuffer *psbfb = vma->vm_private_data; 115 struct drm_device *dev = psbfb->base.dev; 116 struct drm_psb_private *dev_priv = dev->dev_private; 117 struct gtt_range *gtt = to_gtt_range(psbfb->base.obj[0]); 118 int page_num; 119 int i; 120 unsigned long address; 121 vm_fault_t ret = VM_FAULT_SIGBUS; 122 unsigned long pfn; 123 unsigned long phys_addr = (unsigned long)dev_priv->stolen_base + 124 gtt->offset; 125 126 page_num = vma_pages(vma); 127 address = vmf->address - (vmf->pgoff << PAGE_SHIFT); 128 129 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 130 131 for (i = 0; i < page_num; i++) { 132 pfn = (phys_addr >> PAGE_SHIFT); 133 134 ret = vmf_insert_mixed(vma, address, 135 __pfn_to_pfn_t(pfn, PFN_DEV)); 136 if (unlikely(ret & VM_FAULT_ERROR)) 137 break; 138 address += PAGE_SIZE; 139 phys_addr += PAGE_SIZE; 140 } 141 return ret; 142 } 143 144 static void psbfb_vm_open(struct vm_area_struct *vma) 145 { 146 } 147 148 static void psbfb_vm_close(struct vm_area_struct *vma) 149 { 150 } 151 152 static const struct vm_operations_struct psbfb_vm_ops = { 153 .fault = psbfb_vm_fault, 154 .open = psbfb_vm_open, 155 .close = psbfb_vm_close 156 }; 157 158 static int psbfb_mmap(struct fb_info *info, struct vm_area_struct *vma) 159 { 160 struct psb_fbdev *fbdev = info->par; 161 struct psb_framebuffer *psbfb = &fbdev->pfb; 162 163 if (vma->vm_pgoff != 0) 164 return -EINVAL; 165 if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) 166 return -EINVAL; 167 168 if (!psbfb->addr_space) 169 psbfb->addr_space = vma->vm_file->f_mapping; 170 /* 171 * If this is a GEM object then info->screen_base is the virtual 172 * kernel remapping of the object. FIXME: Review if this is 173 * suitable for our mmap work 174 */ 175 vma->vm_ops = &psbfb_vm_ops; 176 vma->vm_private_data = (void *)psbfb; 177 vma->vm_flags |= VM_IO | VM_MIXEDMAP | VM_DONTEXPAND | VM_DONTDUMP; 178 return 0; 179 } 180 181 static struct fb_ops psbfb_ops = { 182 .owner = THIS_MODULE, 183 DRM_FB_HELPER_DEFAULT_OPS, 184 .fb_setcolreg = psbfb_setcolreg, 185 .fb_fillrect = drm_fb_helper_cfb_fillrect, 186 .fb_copyarea = psbfb_copyarea, 187 .fb_imageblit = drm_fb_helper_cfb_imageblit, 188 .fb_mmap = psbfb_mmap, 189 .fb_sync = psbfb_sync, 190 }; 191 192 static struct fb_ops psbfb_roll_ops = { 193 .owner = THIS_MODULE, 194 DRM_FB_HELPER_DEFAULT_OPS, 195 .fb_setcolreg = psbfb_setcolreg, 196 .fb_fillrect = drm_fb_helper_cfb_fillrect, 197 .fb_copyarea = drm_fb_helper_cfb_copyarea, 198 .fb_imageblit = drm_fb_helper_cfb_imageblit, 199 .fb_pan_display = psbfb_pan, 200 .fb_mmap = psbfb_mmap, 201 }; 202 203 static struct fb_ops psbfb_unaccel_ops = { 204 .owner = THIS_MODULE, 205 DRM_FB_HELPER_DEFAULT_OPS, 206 .fb_setcolreg = psbfb_setcolreg, 207 .fb_fillrect = drm_fb_helper_cfb_fillrect, 208 .fb_copyarea = drm_fb_helper_cfb_copyarea, 209 .fb_imageblit = drm_fb_helper_cfb_imageblit, 210 .fb_mmap = psbfb_mmap, 211 }; 212 213 /** 214 * psb_framebuffer_init - initialize a framebuffer 215 * @dev: our DRM device 216 * @fb: framebuffer to set up 217 * @mode_cmd: mode description 218 * @gt: backing object 219 * 220 * Configure and fill in the boilerplate for our frame buffer. Return 221 * 0 on success or an error code if we fail. 222 */ 223 static int psb_framebuffer_init(struct drm_device *dev, 224 struct psb_framebuffer *fb, 225 const struct drm_mode_fb_cmd2 *mode_cmd, 226 struct gtt_range *gt) 227 { 228 const struct drm_format_info *info; 229 int ret; 230 231 /* 232 * Reject unknown formats, YUV formats, and formats with more than 233 * 4 bytes per pixel. 234 */ 235 info = drm_format_info(mode_cmd->pixel_format); 236 if (!info || !info->depth || info->cpp[0] > 4) 237 return -EINVAL; 238 239 if (mode_cmd->pitches[0] & 63) 240 return -EINVAL; 241 242 drm_helper_mode_fill_fb_struct(dev, &fb->base, mode_cmd); 243 fb->base.obj[0] = >->gem; 244 ret = drm_framebuffer_init(dev, &fb->base, &psb_fb_funcs); 245 if (ret) { 246 dev_err(dev->dev, "framebuffer init failed: %d\n", ret); 247 return ret; 248 } 249 return 0; 250 } 251 252 /** 253 * psb_framebuffer_create - create a framebuffer backed by gt 254 * @dev: our DRM device 255 * @mode_cmd: the description of the requested mode 256 * @gt: the backing object 257 * 258 * Create a framebuffer object backed by the gt, and fill in the 259 * boilerplate required 260 * 261 * TODO: review object references 262 */ 263 264 static struct drm_framebuffer *psb_framebuffer_create 265 (struct drm_device *dev, 266 const struct drm_mode_fb_cmd2 *mode_cmd, 267 struct gtt_range *gt) 268 { 269 struct psb_framebuffer *fb; 270 int ret; 271 272 fb = kzalloc(sizeof(*fb), GFP_KERNEL); 273 if (!fb) 274 return ERR_PTR(-ENOMEM); 275 276 ret = psb_framebuffer_init(dev, fb, mode_cmd, gt); 277 if (ret) { 278 kfree(fb); 279 return ERR_PTR(ret); 280 } 281 return &fb->base; 282 } 283 284 /** 285 * psbfb_alloc - allocate frame buffer memory 286 * @dev: the DRM device 287 * @aligned_size: space needed 288 * 289 * Allocate the frame buffer. In the usual case we get a GTT range that 290 * is stolen memory backed and life is simple. If there isn't sufficient 291 * we fail as we don't have the virtual mapping space to really vmap it 292 * and the kernel console code can't handle non linear framebuffers. 293 * 294 * Re-address this as and if the framebuffer layer grows this ability. 295 */ 296 static struct gtt_range *psbfb_alloc(struct drm_device *dev, int aligned_size) 297 { 298 struct gtt_range *backing; 299 /* Begin by trying to use stolen memory backing */ 300 backing = psb_gtt_alloc_range(dev, aligned_size, "fb", 1, PAGE_SIZE); 301 if (backing) { 302 drm_gem_private_object_init(dev, &backing->gem, aligned_size); 303 return backing; 304 } 305 return NULL; 306 } 307 308 /** 309 * psbfb_create - create a framebuffer 310 * @fbdev: the framebuffer device 311 * @sizes: specification of the layout 312 * 313 * Create a framebuffer to the specifications provided 314 */ 315 static int psbfb_create(struct psb_fbdev *fbdev, 316 struct drm_fb_helper_surface_size *sizes) 317 { 318 struct drm_device *dev = fbdev->psb_fb_helper.dev; 319 struct drm_psb_private *dev_priv = dev->dev_private; 320 struct fb_info *info; 321 struct drm_framebuffer *fb; 322 struct psb_framebuffer *psbfb = &fbdev->pfb; 323 struct drm_mode_fb_cmd2 mode_cmd; 324 int size; 325 int ret; 326 struct gtt_range *backing; 327 u32 bpp, depth; 328 int gtt_roll = 0; 329 int pitch_lines = 0; 330 331 mode_cmd.width = sizes->surface_width; 332 mode_cmd.height = sizes->surface_height; 333 bpp = sizes->surface_bpp; 334 depth = sizes->surface_depth; 335 336 /* No 24bit packed */ 337 if (bpp == 24) 338 bpp = 32; 339 340 do { 341 /* 342 * Acceleration via the GTT requires pitch to be 343 * power of two aligned. Preferably page but less 344 * is ok with some fonts 345 */ 346 mode_cmd.pitches[0] = ALIGN(mode_cmd.width * ((bpp + 7) / 8), 4096 >> pitch_lines); 347 348 size = mode_cmd.pitches[0] * mode_cmd.height; 349 size = ALIGN(size, PAGE_SIZE); 350 351 /* Allocate the fb in the GTT with stolen page backing */ 352 backing = psbfb_alloc(dev, size); 353 354 if (pitch_lines) 355 pitch_lines *= 2; 356 else 357 pitch_lines = 1; 358 gtt_roll++; 359 } while (backing == NULL && pitch_lines <= 16); 360 361 /* The final pitch we accepted if we succeeded */ 362 pitch_lines /= 2; 363 364 if (backing == NULL) { 365 /* 366 * We couldn't get the space we wanted, fall back to the 367 * display engine requirement instead. The HW requires 368 * the pitch to be 64 byte aligned 369 */ 370 371 gtt_roll = 0; /* Don't use GTT accelerated scrolling */ 372 pitch_lines = 64; 373 374 mode_cmd.pitches[0] = ALIGN(mode_cmd.width * ((bpp + 7) / 8), 64); 375 376 size = mode_cmd.pitches[0] * mode_cmd.height; 377 size = ALIGN(size, PAGE_SIZE); 378 379 /* Allocate the framebuffer in the GTT with stolen page backing */ 380 backing = psbfb_alloc(dev, size); 381 if (backing == NULL) 382 return -ENOMEM; 383 } 384 385 memset(dev_priv->vram_addr + backing->offset, 0, size); 386 387 info = drm_fb_helper_alloc_fbi(&fbdev->psb_fb_helper); 388 if (IS_ERR(info)) { 389 ret = PTR_ERR(info); 390 goto out; 391 } 392 info->par = fbdev; 393 394 mode_cmd.pixel_format = drm_mode_legacy_fb_format(bpp, depth); 395 396 ret = psb_framebuffer_init(dev, psbfb, &mode_cmd, backing); 397 if (ret) 398 goto out; 399 400 fb = &psbfb->base; 401 psbfb->fbdev = info; 402 403 fbdev->psb_fb_helper.fb = fb; 404 405 drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth); 406 strcpy(info->fix.id, "psbdrmfb"); 407 408 if (dev_priv->ops->accel_2d && pitch_lines > 8) /* 2D engine */ 409 info->fbops = &psbfb_ops; 410 else if (gtt_roll) { /* GTT rolling seems best */ 411 info->fbops = &psbfb_roll_ops; 412 info->flags |= FBINFO_HWACCEL_YPAN; 413 } else /* Software */ 414 info->fbops = &psbfb_unaccel_ops; 415 416 info->fix.smem_start = dev->mode_config.fb_base; 417 info->fix.smem_len = size; 418 info->fix.ywrapstep = gtt_roll; 419 info->fix.ypanstep = 0; 420 421 /* Accessed stolen memory directly */ 422 info->screen_base = dev_priv->vram_addr + backing->offset; 423 info->screen_size = size; 424 425 if (dev_priv->gtt.stolen_size) { 426 info->apertures->ranges[0].base = dev->mode_config.fb_base; 427 info->apertures->ranges[0].size = dev_priv->gtt.stolen_size; 428 } 429 430 drm_fb_helper_fill_var(info, &fbdev->psb_fb_helper, 431 sizes->fb_width, sizes->fb_height); 432 433 info->fix.mmio_start = pci_resource_start(dev->pdev, 0); 434 info->fix.mmio_len = pci_resource_len(dev->pdev, 0); 435 436 /* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */ 437 438 dev_dbg(dev->dev, "allocated %dx%d fb\n", 439 psbfb->base.width, psbfb->base.height); 440 441 return 0; 442 out: 443 psb_gtt_free_range(dev, backing); 444 return ret; 445 } 446 447 /** 448 * psb_user_framebuffer_create - create framebuffer 449 * @dev: our DRM device 450 * @filp: client file 451 * @cmd: mode request 452 * 453 * Create a new framebuffer backed by a userspace GEM object 454 */ 455 static struct drm_framebuffer *psb_user_framebuffer_create 456 (struct drm_device *dev, struct drm_file *filp, 457 const struct drm_mode_fb_cmd2 *cmd) 458 { 459 struct gtt_range *r; 460 struct drm_gem_object *obj; 461 462 /* 463 * Find the GEM object and thus the gtt range object that is 464 * to back this space 465 */ 466 obj = drm_gem_object_lookup(filp, cmd->handles[0]); 467 if (obj == NULL) 468 return ERR_PTR(-ENOENT); 469 470 /* Let the core code do all the work */ 471 r = container_of(obj, struct gtt_range, gem); 472 return psb_framebuffer_create(dev, cmd, r); 473 } 474 475 static int psbfb_probe(struct drm_fb_helper *helper, 476 struct drm_fb_helper_surface_size *sizes) 477 { 478 struct psb_fbdev *psb_fbdev = 479 container_of(helper, struct psb_fbdev, psb_fb_helper); 480 struct drm_device *dev = psb_fbdev->psb_fb_helper.dev; 481 struct drm_psb_private *dev_priv = dev->dev_private; 482 int bytespp; 483 484 bytespp = sizes->surface_bpp / 8; 485 if (bytespp == 3) /* no 24bit packed */ 486 bytespp = 4; 487 488 /* If the mode will not fit in 32bit then switch to 16bit to get 489 a console on full resolution. The X mode setting server will 490 allocate its own 32bit GEM framebuffer */ 491 if (ALIGN(sizes->fb_width * bytespp, 64) * sizes->fb_height > 492 dev_priv->vram_stolen_size) { 493 sizes->surface_bpp = 16; 494 sizes->surface_depth = 16; 495 } 496 497 return psbfb_create(psb_fbdev, sizes); 498 } 499 500 static const struct drm_fb_helper_funcs psb_fb_helper_funcs = { 501 .fb_probe = psbfb_probe, 502 }; 503 504 static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev) 505 { 506 struct psb_framebuffer *psbfb = &fbdev->pfb; 507 508 drm_fb_helper_unregister_fbi(&fbdev->psb_fb_helper); 509 510 drm_fb_helper_fini(&fbdev->psb_fb_helper); 511 drm_framebuffer_unregister_private(&psbfb->base); 512 drm_framebuffer_cleanup(&psbfb->base); 513 514 if (psbfb->base.obj[0]) 515 drm_gem_object_put_unlocked(psbfb->base.obj[0]); 516 return 0; 517 } 518 519 int psb_fbdev_init(struct drm_device *dev) 520 { 521 struct psb_fbdev *fbdev; 522 struct drm_psb_private *dev_priv = dev->dev_private; 523 int ret; 524 525 fbdev = kzalloc(sizeof(struct psb_fbdev), GFP_KERNEL); 526 if (!fbdev) { 527 dev_err(dev->dev, "no memory\n"); 528 return -ENOMEM; 529 } 530 531 dev_priv->fbdev = fbdev; 532 533 drm_fb_helper_prepare(dev, &fbdev->psb_fb_helper, &psb_fb_helper_funcs); 534 535 ret = drm_fb_helper_init(dev, &fbdev->psb_fb_helper, 536 INTELFB_CONN_LIMIT); 537 if (ret) 538 goto free; 539 540 ret = drm_fb_helper_single_add_all_connectors(&fbdev->psb_fb_helper); 541 if (ret) 542 goto fini; 543 544 /* disable all the possible outputs/crtcs before entering KMS mode */ 545 drm_helper_disable_unused_functions(dev); 546 547 ret = drm_fb_helper_initial_config(&fbdev->psb_fb_helper, 32); 548 if (ret) 549 goto fini; 550 551 return 0; 552 553 fini: 554 drm_fb_helper_fini(&fbdev->psb_fb_helper); 555 free: 556 kfree(fbdev); 557 return ret; 558 } 559 560 static void psb_fbdev_fini(struct drm_device *dev) 561 { 562 struct drm_psb_private *dev_priv = dev->dev_private; 563 564 if (!dev_priv->fbdev) 565 return; 566 567 psb_fbdev_destroy(dev, dev_priv->fbdev); 568 kfree(dev_priv->fbdev); 569 dev_priv->fbdev = NULL; 570 } 571 572 static const struct drm_mode_config_funcs psb_mode_funcs = { 573 .fb_create = psb_user_framebuffer_create, 574 .output_poll_changed = drm_fb_helper_output_poll_changed, 575 }; 576 577 static void psb_setup_outputs(struct drm_device *dev) 578 { 579 struct drm_psb_private *dev_priv = dev->dev_private; 580 struct drm_connector *connector; 581 582 drm_mode_create_scaling_mode_property(dev); 583 584 /* It is ok for this to fail - we just don't get backlight control */ 585 if (!dev_priv->backlight_property) 586 dev_priv->backlight_property = drm_property_create_range(dev, 0, 587 "backlight", 0, 100); 588 dev_priv->ops->output_init(dev); 589 590 list_for_each_entry(connector, &dev->mode_config.connector_list, 591 head) { 592 struct gma_encoder *gma_encoder = gma_attached_encoder(connector); 593 struct drm_encoder *encoder = &gma_encoder->base; 594 int crtc_mask = 0, clone_mask = 0; 595 596 /* valid crtcs */ 597 switch (gma_encoder->type) { 598 case INTEL_OUTPUT_ANALOG: 599 crtc_mask = (1 << 0); 600 clone_mask = (1 << INTEL_OUTPUT_ANALOG); 601 break; 602 case INTEL_OUTPUT_SDVO: 603 crtc_mask = dev_priv->ops->sdvo_mask; 604 clone_mask = (1 << INTEL_OUTPUT_SDVO); 605 break; 606 case INTEL_OUTPUT_LVDS: 607 crtc_mask = dev_priv->ops->lvds_mask; 608 clone_mask = (1 << INTEL_OUTPUT_LVDS); 609 break; 610 case INTEL_OUTPUT_MIPI: 611 crtc_mask = (1 << 0); 612 clone_mask = (1 << INTEL_OUTPUT_MIPI); 613 break; 614 case INTEL_OUTPUT_MIPI2: 615 crtc_mask = (1 << 2); 616 clone_mask = (1 << INTEL_OUTPUT_MIPI2); 617 break; 618 case INTEL_OUTPUT_HDMI: 619 crtc_mask = dev_priv->ops->hdmi_mask; 620 clone_mask = (1 << INTEL_OUTPUT_HDMI); 621 break; 622 case INTEL_OUTPUT_DISPLAYPORT: 623 crtc_mask = (1 << 0) | (1 << 1); 624 clone_mask = (1 << INTEL_OUTPUT_DISPLAYPORT); 625 break; 626 case INTEL_OUTPUT_EDP: 627 crtc_mask = (1 << 1); 628 clone_mask = (1 << INTEL_OUTPUT_EDP); 629 } 630 encoder->possible_crtcs = crtc_mask; 631 encoder->possible_clones = 632 gma_connector_clones(dev, clone_mask); 633 } 634 } 635 636 void psb_modeset_init(struct drm_device *dev) 637 { 638 struct drm_psb_private *dev_priv = dev->dev_private; 639 struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev; 640 int i; 641 642 drm_mode_config_init(dev); 643 644 dev->mode_config.min_width = 0; 645 dev->mode_config.min_height = 0; 646 647 dev->mode_config.funcs = &psb_mode_funcs; 648 649 /* set memory base */ 650 /* Oaktrail and Poulsbo should use BAR 2*/ 651 pci_read_config_dword(dev->pdev, PSB_BSM, (u32 *) 652 &(dev->mode_config.fb_base)); 653 654 /* num pipes is 2 for PSB but 1 for Mrst */ 655 for (i = 0; i < dev_priv->num_pipe; i++) 656 psb_intel_crtc_init(dev, i, mode_dev); 657 658 dev->mode_config.max_width = 4096; 659 dev->mode_config.max_height = 4096; 660 661 psb_setup_outputs(dev); 662 663 if (dev_priv->ops->errata) 664 dev_priv->ops->errata(dev); 665 666 dev_priv->modeset = true; 667 } 668 669 void psb_modeset_cleanup(struct drm_device *dev) 670 { 671 struct drm_psb_private *dev_priv = dev->dev_private; 672 if (dev_priv->modeset) { 673 drm_kms_helper_poll_fini(dev); 674 psb_fbdev_fini(dev); 675 drm_mode_config_cleanup(dev); 676 } 677 } 678