1 /* 2 * linux/drivers/video/fbmem.c 3 * 4 * Copyright (C) 1994 Martin Schaller 5 * 6 * 2001 - Documented with DocBook 7 * - Brad Douglas <brad@neruo.com> 8 * 9 * This file is subject to the terms and conditions of the GNU General Public 10 * License. See the file COPYING in the main directory of this archive 11 * for more details. 12 */ 13 14 #include <linux/console.h> 15 #include <linux/export.h> 16 #include <linux/fb.h> 17 #include <linux/lcd.h> 18 #include <linux/leds.h> 19 20 #include <video/nomodeset.h> 21 22 #include "fb_internal.h" 23 #include "fbcon.h" 24 25 /* 26 * Frame buffer device initialization and setup routines 27 */ 28 29 #define FBPIXMAPSIZE (1024 * 8) 30 31 struct class *fb_class; 32 33 DEFINE_MUTEX(registration_lock); 34 struct fb_info *registered_fb[FB_MAX] __read_mostly; 35 int num_registered_fb __read_mostly; 36 #define for_each_registered_fb(i) \ 37 for (i = 0; i < FB_MAX; i++) \ 38 if (!registered_fb[i]) {} else 39 40 struct fb_info *get_fb_info(unsigned int idx) 41 { 42 struct fb_info *fb_info; 43 44 if (idx >= FB_MAX) 45 return ERR_PTR(-ENODEV); 46 47 mutex_lock(®istration_lock); 48 fb_info = registered_fb[idx]; 49 if (fb_info) 50 refcount_inc(&fb_info->count); 51 mutex_unlock(®istration_lock); 52 53 return fb_info; 54 } 55 56 void put_fb_info(struct fb_info *fb_info) 57 { 58 if (!refcount_dec_and_test(&fb_info->count)) 59 return; 60 if (fb_info->fbops->fb_destroy) 61 fb_info->fbops->fb_destroy(fb_info); 62 } 63 64 /* 65 * Helpers 66 */ 67 68 int fb_get_color_depth(struct fb_var_screeninfo *var, 69 struct fb_fix_screeninfo *fix) 70 { 71 int depth = 0; 72 73 if (fix->visual == FB_VISUAL_MONO01 || 74 fix->visual == FB_VISUAL_MONO10) 75 depth = 1; 76 else { 77 if (var->green.length == var->blue.length && 78 var->green.length == var->red.length && 79 var->green.offset == var->blue.offset && 80 var->green.offset == var->red.offset) 81 depth = var->green.length; 82 else 83 depth = var->green.length + var->red.length + 84 var->blue.length; 85 } 86 87 return depth; 88 } 89 EXPORT_SYMBOL(fb_get_color_depth); 90 91 /* 92 * Data padding functions. 93 */ 94 void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, const u8 *src, u32 s_pitch, u32 height) 95 { 96 __fb_pad_aligned_buffer(dst, d_pitch, src, s_pitch, height); 97 } 98 EXPORT_SYMBOL(fb_pad_aligned_buffer); 99 100 void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, const u8 *src, u32 idx, u32 height, 101 u32 shift_high, u32 shift_low, u32 mod) 102 { 103 u8 mask = (u8) (0xff << shift_high), tmp; 104 int i, j; 105 106 for (i = height; i--; ) { 107 for (j = 0; j < idx; j++) { 108 tmp = dst[j]; 109 tmp &= mask; 110 tmp |= *src >> shift_low; 111 dst[j] = tmp; 112 tmp = *src << shift_high; 113 dst[j+1] = tmp; 114 src++; 115 } 116 tmp = dst[idx]; 117 tmp &= mask; 118 tmp |= *src >> shift_low; 119 dst[idx] = tmp; 120 if (shift_high < mod) { 121 tmp = *src << shift_high; 122 dst[idx+1] = tmp; 123 } 124 src++; 125 dst += d_pitch; 126 } 127 } 128 EXPORT_SYMBOL(fb_pad_unaligned_buffer); 129 130 /* 131 * we need to lock this section since fb_cursor 132 * may use fb_imageblit() 133 */ 134 char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size) 135 { 136 u32 align = buf->buf_align - 1, offset; 137 char *addr = buf->addr; 138 139 /* If IO mapped, we need to sync before access, no sharing of 140 * the pixmap is done 141 */ 142 if (buf->flags & FB_PIXMAP_IO) { 143 if (info->fbops->fb_sync && (buf->flags & FB_PIXMAP_SYNC)) 144 info->fbops->fb_sync(info); 145 return addr; 146 } 147 148 /* See if we fit in the remaining pixmap space */ 149 offset = buf->offset + align; 150 offset &= ~align; 151 if (offset + size > buf->size) { 152 /* We do not fit. In order to be able to re-use the buffer, 153 * we must ensure no asynchronous DMA'ing or whatever operation 154 * is in progress, we sync for that. 155 */ 156 if (info->fbops->fb_sync && (buf->flags & FB_PIXMAP_SYNC)) 157 info->fbops->fb_sync(info); 158 offset = 0; 159 } 160 buf->offset = offset + size; 161 addr += offset; 162 163 return addr; 164 } 165 EXPORT_SYMBOL(fb_get_buffer_offset); 166 167 int 168 fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var) 169 { 170 struct fb_fix_screeninfo *fix = &info->fix; 171 unsigned int yres = info->var.yres; 172 int err = 0; 173 174 if (var->yoffset > 0) { 175 if (var->vmode & FB_VMODE_YWRAP) { 176 if (!fix->ywrapstep || (var->yoffset % fix->ywrapstep)) 177 err = -EINVAL; 178 else 179 yres = 0; 180 } else if (!fix->ypanstep || (var->yoffset % fix->ypanstep)) 181 err = -EINVAL; 182 } 183 184 if (var->xoffset > 0 && (!fix->xpanstep || 185 (var->xoffset % fix->xpanstep))) 186 err = -EINVAL; 187 188 if (err || !info->fbops->fb_pan_display || 189 var->yoffset > info->var.yres_virtual - yres || 190 var->xoffset > info->var.xres_virtual - info->var.xres) 191 return -EINVAL; 192 193 if ((err = info->fbops->fb_pan_display(var, info))) 194 return err; 195 info->var.xoffset = var->xoffset; 196 info->var.yoffset = var->yoffset; 197 if (var->vmode & FB_VMODE_YWRAP) 198 info->var.vmode |= FB_VMODE_YWRAP; 199 else 200 info->var.vmode &= ~FB_VMODE_YWRAP; 201 return 0; 202 } 203 EXPORT_SYMBOL(fb_pan_display); 204 205 static int fb_check_caps(struct fb_info *info, struct fb_var_screeninfo *var, 206 u32 activate) 207 { 208 struct fb_blit_caps caps, fbcaps; 209 int err = 0; 210 211 memset(&caps, 0, sizeof(caps)); 212 memset(&fbcaps, 0, sizeof(fbcaps)); 213 caps.flags = (activate & FB_ACTIVATE_ALL) ? 1 : 0; 214 fbcon_get_requirement(info, &caps); 215 info->fbops->fb_get_caps(info, &fbcaps, var); 216 217 if (!bitmap_subset(caps.x, fbcaps.x, FB_MAX_BLIT_WIDTH) || 218 !bitmap_subset(caps.y, fbcaps.y, FB_MAX_BLIT_HEIGHT) || 219 (fbcaps.len < caps.len)) 220 err = -EINVAL; 221 222 return err; 223 } 224 225 static void fb_lcd_notify_mode_change(struct fb_info *info, 226 struct fb_videomode *mode) 227 { 228 lcd_notify_mode_change_all(info->device, mode->xres, mode->yres); 229 } 230 231 int 232 fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) 233 { 234 int ret = 0; 235 u32 activate; 236 struct fb_var_screeninfo old_var; 237 struct fb_videomode mode; 238 u32 unused; 239 240 if (var->activate & FB_ACTIVATE_INV_MODE) { 241 struct fb_videomode mode1, mode2; 242 243 fb_var_to_videomode(&mode1, var); 244 fb_var_to_videomode(&mode2, &info->var); 245 /* make sure we don't delete the videomode of current var */ 246 ret = fb_mode_is_equal(&mode1, &mode2); 247 if (!ret) { 248 ret = fbcon_mode_deleted(info, &mode1); 249 if (!ret) 250 fb_delete_videomode(&mode1, &info->modelist); 251 } 252 253 return ret ? -EINVAL : 0; 254 } 255 256 if (!(var->activate & FB_ACTIVATE_FORCE) && 257 !memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) 258 return 0; 259 260 activate = var->activate; 261 262 /* When using FOURCC mode, make sure the red, green, blue and 263 * transp fields are set to 0. 264 */ 265 if ((info->fix.capabilities & FB_CAP_FOURCC) && 266 var->grayscale > 1) { 267 if (var->red.offset || var->green.offset || 268 var->blue.offset || var->transp.offset || 269 var->red.length || var->green.length || 270 var->blue.length || var->transp.length || 271 var->red.msb_right || var->green.msb_right || 272 var->blue.msb_right || var->transp.msb_right) 273 return -EINVAL; 274 } 275 276 if (!info->fbops->fb_check_var) { 277 *var = info->var; 278 return 0; 279 } 280 281 /* bitfill_aligned() assumes that it's at least 8x8 */ 282 if (var->xres < 8 || var->yres < 8) 283 return -EINVAL; 284 285 /* Too huge resolution causes multiplication overflow. */ 286 if (check_mul_overflow(var->xres, var->yres, &unused) || 287 check_mul_overflow(var->xres_virtual, var->yres_virtual, &unused)) 288 return -EINVAL; 289 290 ret = info->fbops->fb_check_var(var, info); 291 292 if (ret) 293 return ret; 294 295 /* verify that virtual resolution >= physical resolution */ 296 if (var->xres_virtual < var->xres || 297 var->yres_virtual < var->yres) { 298 pr_warn("WARNING: fbcon: Driver '%s' missed to adjust virtual screen size (%ux%u vs. %ux%u)\n", 299 info->fix.id, 300 var->xres_virtual, var->yres_virtual, 301 var->xres, var->yres); 302 return -EINVAL; 303 } 304 305 if ((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NOW) 306 return 0; 307 308 if (info->fbops->fb_get_caps) { 309 ret = fb_check_caps(info, var, activate); 310 311 if (ret) 312 return ret; 313 } 314 315 old_var = info->var; 316 info->var = *var; 317 318 if (info->fbops->fb_set_par) { 319 ret = info->fbops->fb_set_par(info); 320 321 if (ret) { 322 info->var = old_var; 323 printk(KERN_WARNING "detected " 324 "fb_set_par error, " 325 "error code: %d\n", ret); 326 return ret; 327 } 328 } 329 330 fb_pan_display(info, &info->var); 331 fb_set_cmap(&info->cmap, info); 332 fb_var_to_videomode(&mode, &info->var); 333 334 if (info->modelist.prev && info->modelist.next && 335 !list_empty(&info->modelist)) 336 ret = fb_add_videomode(&mode, &info->modelist); 337 338 if (ret) { 339 info->var = old_var; 340 return ret; 341 } 342 343 fb_lcd_notify_mode_change(info, &mode); 344 345 return 0; 346 } 347 EXPORT_SYMBOL(fb_set_var); 348 349 int fb_set_var_from_user(struct fb_info *info, struct fb_var_screeninfo *var) 350 { 351 int ret = fbcon_modechange_possible(info, var); 352 353 if (!ret) 354 ret = fb_set_var(info, var); 355 if (!ret) 356 fbcon_update_vcs(info, var->activate & FB_ACTIVATE_ALL); 357 358 return ret; 359 } 360 EXPORT_SYMBOL(fb_set_var_from_user); 361 362 static void fb_lcd_notify_blank(struct fb_info *info) 363 { 364 int power; 365 366 switch (info->blank) { 367 case FB_BLANK_UNBLANK: 368 power = LCD_POWER_ON; 369 break; 370 /* deprecated; TODO: should become 'off' */ 371 case FB_BLANK_NORMAL: 372 power = LCD_POWER_REDUCED; 373 break; 374 case FB_BLANK_VSYNC_SUSPEND: 375 power = LCD_POWER_REDUCED_VSYNC_SUSPEND; 376 break; 377 /* 'off' */ 378 case FB_BLANK_HSYNC_SUSPEND: 379 case FB_BLANK_POWERDOWN: 380 default: 381 power = LCD_POWER_OFF; 382 break; 383 } 384 385 lcd_notify_blank_all(info->device, power); 386 } 387 388 static void fb_ledtrig_backlight_notify_blank(struct fb_info *info) 389 { 390 if (info->blank == FB_BLANK_UNBLANK) 391 ledtrig_backlight_blank(false); 392 else 393 ledtrig_backlight_blank(true); 394 } 395 396 int fb_blank(struct fb_info *info, int blank) 397 { 398 int old_blank = info->blank; 399 int ret; 400 401 if (!info->fbops->fb_blank) 402 return -EINVAL; 403 404 if (blank > FB_BLANK_POWERDOWN) 405 blank = FB_BLANK_POWERDOWN; 406 407 info->blank = blank; 408 409 ret = info->fbops->fb_blank(blank, info); 410 if (ret) 411 goto err; 412 413 fb_bl_notify_blank(info, old_blank); 414 fb_lcd_notify_blank(info); 415 fb_ledtrig_backlight_notify_blank(info); 416 417 return 0; 418 419 err: 420 info->blank = old_blank; 421 return ret; 422 } 423 EXPORT_SYMBOL(fb_blank); 424 425 int fb_blank_from_user(struct fb_info *info, int blank) 426 { 427 int ret = fb_blank(info, blank); 428 429 /* might again call into fb_blank */ 430 fbcon_fb_blanked(info, blank); 431 432 return ret; 433 } 434 435 static int fb_check_foreignness(struct fb_info *fi) 436 { 437 const bool foreign_endian = fi->flags & FBINFO_FOREIGN_ENDIAN; 438 439 fi->flags &= ~FBINFO_FOREIGN_ENDIAN; 440 441 #ifdef __BIG_ENDIAN 442 fi->flags |= foreign_endian ? 0 : FBINFO_BE_MATH; 443 #else 444 fi->flags |= foreign_endian ? FBINFO_BE_MATH : 0; 445 #endif /* __BIG_ENDIAN */ 446 447 if (fi->flags & FBINFO_BE_MATH && !fb_be_math(fi)) { 448 pr_err("%s: enable CONFIG_FB_BIG_ENDIAN to " 449 "support this framebuffer\n", fi->fix.id); 450 return -ENOSYS; 451 } else if (!(fi->flags & FBINFO_BE_MATH) && fb_be_math(fi)) { 452 pr_err("%s: enable CONFIG_FB_LITTLE_ENDIAN to " 453 "support this framebuffer\n", fi->fix.id); 454 return -ENOSYS; 455 } 456 457 return 0; 458 } 459 460 static int do_register_framebuffer(struct fb_info *fb_info) 461 { 462 int i, err = 0; 463 struct fb_videomode mode; 464 465 if (fb_check_foreignness(fb_info)) 466 return -ENOSYS; 467 468 if (num_registered_fb == FB_MAX) 469 return -ENXIO; 470 471 for (i = 0 ; i < FB_MAX; i++) 472 if (!registered_fb[i]) 473 break; 474 475 if (i >= FB_MAX) 476 return -ENXIO; 477 478 if (!fb_info->modelist.prev || !fb_info->modelist.next) 479 INIT_LIST_HEAD(&fb_info->modelist); 480 481 fb_var_to_videomode(&mode, &fb_info->var); 482 err = fb_add_videomode(&mode, &fb_info->modelist); 483 if (err < 0) 484 return err; 485 486 fb_info->node = i; 487 refcount_set(&fb_info->count, 1); 488 mutex_init(&fb_info->lock); 489 mutex_init(&fb_info->mm_lock); 490 491 /* 492 * With an fb_blank callback present, we assume that the 493 * display is blank, so that fb_blank() enables it on the 494 * first modeset. 495 */ 496 if (fb_info->fbops->fb_blank) 497 fb_info->blank = FB_BLANK_POWERDOWN; 498 499 fb_device_create(fb_info); 500 501 if (fb_info->pixmap.addr == NULL) { 502 fb_info->pixmap.addr = kmalloc(FBPIXMAPSIZE, GFP_KERNEL); 503 if (fb_info->pixmap.addr) { 504 fb_info->pixmap.size = FBPIXMAPSIZE; 505 fb_info->pixmap.buf_align = 1; 506 fb_info->pixmap.scan_align = 1; 507 fb_info->pixmap.access_align = 32; 508 fb_info->pixmap.flags = FB_PIXMAP_DEFAULT; 509 } 510 } 511 fb_info->pixmap.offset = 0; 512 513 if (bitmap_empty(fb_info->pixmap.blit_x, FB_MAX_BLIT_WIDTH)) 514 bitmap_fill(fb_info->pixmap.blit_x, FB_MAX_BLIT_WIDTH); 515 516 if (bitmap_empty(fb_info->pixmap.blit_y, FB_MAX_BLIT_HEIGHT)) 517 bitmap_fill(fb_info->pixmap.blit_y, FB_MAX_BLIT_HEIGHT); 518 519 if (fb_info->skip_vt_switch) 520 pm_vt_switch_required(fb_info->device, false); 521 else 522 pm_vt_switch_required(fb_info->device, true); 523 524 num_registered_fb++; 525 registered_fb[i] = fb_info; 526 527 #ifdef CONFIG_GUMSTIX_AM200EPD 528 { 529 struct fb_event event; 530 event.info = fb_info; 531 fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event); 532 } 533 #endif 534 535 return fbcon_fb_registered(fb_info); 536 } 537 538 static void unbind_console(struct fb_info *fb_info) 539 { 540 int i = fb_info->node; 541 542 if (WARN_ON(i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)) 543 return; 544 545 fbcon_fb_unbind(fb_info); 546 } 547 548 static void unlink_framebuffer(struct fb_info *fb_info) 549 { 550 int i; 551 552 i = fb_info->node; 553 if (WARN_ON(i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)) 554 return; 555 556 fb_device_destroy(fb_info); 557 pm_vt_switch_unregister(fb_info->device); 558 unbind_console(fb_info); 559 } 560 561 static void do_unregister_framebuffer(struct fb_info *fb_info) 562 { 563 unlink_framebuffer(fb_info); 564 if (fb_info->pixmap.addr && 565 (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT)) { 566 kfree(fb_info->pixmap.addr); 567 fb_info->pixmap.addr = NULL; 568 } 569 570 fbcon_delete_modelist(&fb_info->modelist); 571 fb_destroy_modelist(&fb_info->modelist); 572 registered_fb[fb_info->node] = NULL; 573 num_registered_fb--; 574 #ifdef CONFIG_GUMSTIX_AM200EPD 575 { 576 struct fb_event event; 577 event.info = fb_info; 578 fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event); 579 } 580 #endif 581 fbcon_fb_unregistered(fb_info); 582 583 /* this may free fb info */ 584 put_fb_info(fb_info); 585 } 586 587 /** 588 * register_framebuffer - registers a frame buffer device 589 * @fb_info: frame buffer info structure 590 * 591 * Registers a frame buffer device @fb_info. 592 * 593 * Returns negative errno on error, or zero for success. 594 * 595 */ 596 int 597 register_framebuffer(struct fb_info *fb_info) 598 { 599 int ret; 600 601 mutex_lock(®istration_lock); 602 ret = do_register_framebuffer(fb_info); 603 mutex_unlock(®istration_lock); 604 605 return ret; 606 } 607 EXPORT_SYMBOL(register_framebuffer); 608 609 /** 610 * unregister_framebuffer - releases a frame buffer device 611 * @fb_info: frame buffer info structure 612 * 613 * Unregisters a frame buffer device @fb_info. 614 * 615 * Returns negative errno on error, or zero for success. 616 * 617 * This function will also notify the framebuffer console 618 * to release the driver. 619 * 620 * This is meant to be called within a driver's module_exit() 621 * function. If this is called outside module_exit(), ensure 622 * that the driver implements fb_open() and fb_release() to 623 * check that no processes are using the device. 624 */ 625 void 626 unregister_framebuffer(struct fb_info *fb_info) 627 { 628 mutex_lock(®istration_lock); 629 do_unregister_framebuffer(fb_info); 630 mutex_unlock(®istration_lock); 631 } 632 EXPORT_SYMBOL(unregister_framebuffer); 633 634 static void devm_unregister_framebuffer(void *data) 635 { 636 struct fb_info *info = data; 637 638 unregister_framebuffer(info); 639 } 640 641 /** 642 * devm_register_framebuffer - resource-managed frame buffer device registration 643 * @dev: device the framebuffer belongs to 644 * @fb_info: frame buffer info structure 645 * 646 * Registers a frame buffer device @fb_info to device @dev. 647 * 648 * Returns negative errno on error, or zero for success. 649 * 650 */ 651 int 652 devm_register_framebuffer(struct device *dev, struct fb_info *fb_info) 653 { 654 int ret; 655 656 ret = register_framebuffer(fb_info); 657 if (ret) 658 return ret; 659 660 return devm_add_action_or_reset(dev, devm_unregister_framebuffer, fb_info); 661 } 662 EXPORT_SYMBOL(devm_register_framebuffer); 663 664 /** 665 * fb_set_suspend - low level driver signals suspend 666 * @info: framebuffer affected 667 * @state: 0 = resuming, !=0 = suspending 668 * 669 * This is meant to be used by low level drivers to 670 * signal suspend/resume to the core & clients. 671 * It must be called with the console semaphore held 672 */ 673 void fb_set_suspend(struct fb_info *info, int state) 674 { 675 WARN_CONSOLE_UNLOCKED(); 676 677 if (state) { 678 fbcon_suspended(info); 679 info->state = FBINFO_STATE_SUSPENDED; 680 } else { 681 info->state = FBINFO_STATE_RUNNING; 682 fbcon_resumed(info); 683 } 684 } 685 EXPORT_SYMBOL(fb_set_suspend); 686 687 /** 688 * fb_switch_outputs - framebuffer got the outputs from vga-switcheroo 689 * @info: framebuffer 690 */ 691 void fb_switch_outputs(struct fb_info *info) 692 { 693 fbcon_remap_all(info); 694 } 695 EXPORT_SYMBOL(fb_switch_outputs); 696 697 static int __init fbmem_init(void) 698 { 699 int ret; 700 701 fb_class = class_create("graphics"); 702 if (IS_ERR(fb_class)) { 703 ret = PTR_ERR(fb_class); 704 pr_err("Unable to create fb class; errno = %d\n", ret); 705 goto err_fb_class; 706 } 707 708 ret = fb_init_procfs(); 709 if (ret) 710 goto err_class_destroy; 711 712 ret = fb_register_chrdev(); 713 if (ret) 714 goto err_fb_cleanup_procfs; 715 716 fb_console_init(); 717 718 return 0; 719 720 err_fb_cleanup_procfs: 721 fb_cleanup_procfs(); 722 err_class_destroy: 723 class_destroy(fb_class); 724 err_fb_class: 725 fb_class = NULL; 726 return ret; 727 } 728 729 #ifdef MODULE 730 static void __exit fbmem_exit(void) 731 { 732 fb_console_exit(); 733 fb_unregister_chrdev(); 734 fb_cleanup_procfs(); 735 class_destroy(fb_class); 736 } 737 738 module_init(fbmem_init); 739 module_exit(fbmem_exit); 740 MODULE_LICENSE("GPL"); 741 MODULE_DESCRIPTION("Framebuffer base"); 742 #else 743 subsys_initcall(fbmem_init); 744 #endif 745 746 int fb_new_modelist(struct fb_info *info) 747 { 748 struct fb_var_screeninfo var = info->var; 749 struct list_head *pos, *n; 750 struct fb_modelist *modelist; 751 struct fb_videomode *m, mode; 752 int err; 753 754 list_for_each_safe(pos, n, &info->modelist) { 755 modelist = list_entry(pos, struct fb_modelist, list); 756 m = &modelist->mode; 757 fb_videomode_to_var(&var, m); 758 var.activate = FB_ACTIVATE_TEST; 759 err = fb_set_var(info, &var); 760 fb_var_to_videomode(&mode, &var); 761 if (err || !fb_mode_is_equal(m, &mode)) { 762 list_del(pos); 763 kfree(pos); 764 } 765 } 766 767 if (list_empty(&info->modelist)) 768 return 1; 769 770 fbcon_new_modelist(info); 771 772 return 0; 773 } 774 775 bool fb_modesetting_disabled(const char *drvname) 776 { 777 bool fwonly = video_firmware_drivers_only(); 778 779 if (fwonly) 780 pr_warn("Driver %s not loading because of nomodeset parameter\n", 781 drvname); 782 783 return fwonly; 784 } 785 EXPORT_SYMBOL(fb_modesetting_disabled); 786 787 MODULE_LICENSE("GPL"); 788