Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'fbdev-v4.21' of git://github.com/bzolnier/linux

Pull fbdev updates from Bartlomiej Zolnierkiewicz:
"This time the pull request is really small.

The most notable changes are fixing fbcon to not cause crash on
unregister_framebuffer() operation when there is more than one
framebuffer, adding config option to center the bootup logo and making
FB_BACKLIGHT config option tristate (which in turn uncovered incorrect
FB_BACKLIGHT usage by DRM's nouveau driver).

Summary:

- fix fbcon to not cause crash on unregister_framebuffer() when there
is more than one framebuffer (Noralf Trønnes)

- improve support for small rotated displays (Peter Rosin)

- fix probe failure handling in udlfb driver (Dan Carpenter)

- add config option to center the bootup logo (Peter Rosin)

- make FB_BACKLIGHT config option tristate (Rob Clark)

- remove superfluous HAS_DMA dependency for goldfishfb driver (Geert
Uytterhoeven)

- misc fixes (Alexey Khoroshilov, YueHaibing, Colin Ian King, Lubomir
Rintel)

- misc cleanups (Yangtao Li, Wen Yang)

also there is DRM's nouveau driver fix for wrong FB_BACKLIGHT config
option usage (FB_BACKLIGHT is for internal fbdev subsystem use only)"

* tag 'fbdev-v4.21' of git://github.com/bzolnier/linux:
drm/nouveau: fix incorrect FB_BACKLIGHT usage in Kconfig
fbdev: fbcon: Fix unregister crash when more than one framebuffer
fbdev: Remove depends on HAS_DMA in case of platform dependency
pxa168fb: trivial typo fix
fbdev: fsl-diu: remove redundant null check on cmap
fbdev: omap2: omapfb: convert to DEFINE_SHOW_ATTRIBUTE
fbdev: uvesafb: fix spelling mistake "memoery" -> "memory"
fbdev: fbmem: add config option to center the bootup logo
fbdev: fbmem: make fb_show_logo_line return the end instead of the height
video: fbdev: pxafb: Fix "WARNING: invalid free of devm_ allocated data"
fbdev: fbmem: behave better with small rotated displays and many CPUs
video: clps711x-fb: release disp device node in probe()
fbdev: make FB_BACKLIGHT a tristate
udlfb: fix some inconsistent NULL checking

+71 -47
+2 -1
drivers/gpu/drm/nouveau/Kconfig
··· 4 4 select FW_LOADER 5 5 select DRM_KMS_HELPER 6 6 select DRM_TTM 7 - select FB_BACKLIGHT if DRM_NOUVEAU_BACKLIGHT 7 + select BACKLIGHT_CLASS_DEVICE if DRM_NOUVEAU_BACKLIGHT 8 + select BACKLIGHT_LCD_SUPPORT if DRM_NOUVEAU_BACKLIGHT 8 9 select ACPI_VIDEO if ACPI && X86 && BACKLIGHT_CLASS_DEVICE && INPUT 9 10 select X86_PLATFORM_DEVICES if ACPI && X86 10 11 select ACPI_WMI if ACPI && X86
+3 -2
drivers/video/fbdev/Kconfig
··· 184 184 depends on FB 185 185 186 186 config FB_BACKLIGHT 187 - bool 187 + tristate 188 188 depends on FB 189 189 select BACKLIGHT_LCD_SUPPORT 190 190 select BACKLIGHT_CLASS_DEVICE ··· 2037 2037 2038 2038 config FB_GOLDFISH 2039 2039 tristate "Goldfish Framebuffer" 2040 - depends on FB && HAS_DMA && (GOLDFISH || COMPILE_TEST) 2040 + depends on FB 2041 + depends on GOLDFISH || COMPILE_TEST 2041 2042 select FB_CFB_FILLRECT 2042 2043 select FB_CFB_COPYAREA 2043 2044 select FB_CFB_IMAGEBLIT
+4 -1
drivers/video/fbdev/clps711x-fb.c
··· 287 287 } 288 288 289 289 ret = of_get_fb_videomode(disp, &cfb->mode, OF_USE_NATIVE_MODE); 290 - if (ret) 290 + if (ret) { 291 + of_node_put(disp); 291 292 goto out_fb_release; 293 + } 292 294 293 295 of_property_read_u32(disp, "ac-prescale", &cfb->ac_prescale); 294 296 cfb->cmap_invert = of_property_read_bool(disp, "cmap-invert"); 295 297 296 298 ret = of_property_read_u32(disp, "bits-per-pixel", 297 299 &info->var.bits_per_pixel); 300 + of_node_put(disp); 298 301 if (ret) 299 302 goto out_fb_release; 300 303
+1 -1
drivers/video/fbdev/core/fbcon.c
··· 3064 3064 for (i = first_fb_vc; i <= last_fb_vc; i++) { 3065 3065 if (con2fb_map[i] != idx && 3066 3066 con2fb_map[i] != -1) { 3067 - new_idx = i; 3067 + new_idx = con2fb_map[i]; 3068 3068 break; 3069 3069 } 3070 3070 }
+33 -6
drivers/video/fbdev/core/fbmem.c
··· 436 436 image->dx += image->width + 8; 437 437 } 438 438 } else if (rotate == FB_ROTATE_UD) { 439 - for (x = 0; x < num; x++) { 439 + u32 dx = image->dx; 440 + 441 + for (x = 0; x < num && image->dx <= dx; x++) { 440 442 info->fbops->fb_imageblit(info, image); 441 443 image->dx -= image->width + 8; 442 444 } ··· 450 448 image->dy += image->height + 8; 451 449 } 452 450 } else if (rotate == FB_ROTATE_CCW) { 453 - for (x = 0; x < num; x++) { 451 + u32 dy = image->dy; 452 + 453 + for (x = 0; x < num && image->dy <= dy; x++) { 454 454 info->fbops->fb_imageblit(info, image); 455 455 image->dy -= image->height + 8; 456 456 } ··· 506 502 fb_set_logo(info, logo, logo_new, fb_logo.depth); 507 503 } 508 504 505 + #ifdef CONFIG_FB_LOGO_CENTER 506 + { 507 + int xres = info->var.xres; 508 + int yres = info->var.yres; 509 + 510 + if (rotate == FB_ROTATE_CW || rotate == FB_ROTATE_CCW) { 511 + xres = info->var.yres; 512 + yres = info->var.xres; 513 + } 514 + 515 + while (n && (n * (logo->width + 8) - 8 > xres)) 516 + --n; 517 + image.dx = (xres - n * (logo->width + 8) - 8) / 2; 518 + image.dy = y ?: (yres - logo->height) / 2; 519 + } 520 + #else 509 521 image.dx = 0; 510 522 image.dy = y; 523 + #endif 511 524 image.width = logo->width; 512 525 image.height = logo->height; 513 526 ··· 542 521 info->pseudo_palette = saved_pseudo_palette; 543 522 kfree(logo_new); 544 523 kfree(logo_rotate); 545 - return logo->height; 524 + return image.dy + logo->height; 546 525 } 547 526 548 527 ··· 594 573 unsigned int i; 595 574 596 575 for (i = 0; i < fb_logo_ex_num; i++) 597 - y += fb_show_logo_line(info, rotate, 598 - fb_logo_ex[i].logo, y, fb_logo_ex[i].n); 576 + y = fb_show_logo_line(info, rotate, 577 + fb_logo_ex[i].logo, y, fb_logo_ex[i].n); 599 578 600 579 return y; 601 580 } ··· 621 600 { 622 601 int depth = fb_get_color_depth(&info->var, &info->fix); 623 602 unsigned int yres; 603 + int height; 624 604 625 605 memset(&fb_logo, 0, sizeof(struct logo_data)); 626 606 ··· 683 661 } 684 662 } 685 663 686 - return fb_prepare_extra_logos(info, fb_logo.logo->height, yres); 664 + height = fb_logo.logo->height; 665 + #ifdef CONFIG_FB_LOGO_CENTER 666 + height += (yres - fb_logo.logo->height) / 2; 667 + #endif 668 + 669 + return fb_prepare_extra_logos(info, height, yres); 687 670 } 688 671 689 672 int fb_show_logo(struct fb_info *info, int rotate)
+4 -4
drivers/video/fbdev/core/fbsysfs.c
··· 60 60 info->device = dev; 61 61 info->fbcon_rotate_hint = -1; 62 62 63 - #ifdef CONFIG_FB_BACKLIGHT 63 + #if IS_ENABLED(CONFIG_FB_BACKLIGHT) 64 64 mutex_init(&info->bl_curve_mutex); 65 65 #endif 66 66 ··· 429 429 return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->state); 430 430 } 431 431 432 - #ifdef CONFIG_FB_BACKLIGHT 432 + #if IS_ENABLED(CONFIG_FB_BACKLIGHT) 433 433 static ssize_t store_bl_curve(struct device *device, 434 434 struct device_attribute *attr, 435 435 const char *buf, size_t count) ··· 510 510 __ATTR(stride, S_IRUGO, show_stride, NULL), 511 511 __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate), 512 512 __ATTR(state, S_IRUGO|S_IWUSR, show_fbstate, store_fbstate), 513 - #ifdef CONFIG_FB_BACKLIGHT 513 + #if IS_ENABLED(CONFIG_FB_BACKLIGHT) 514 514 __ATTR(bl_curve, S_IRUGO|S_IWUSR, show_bl_curve, store_bl_curve), 515 515 #endif 516 516 }; ··· 551 551 } 552 552 } 553 553 554 - #ifdef CONFIG_FB_BACKLIGHT 554 + #if IS_ENABLED(CONFIG_FB_BACKLIGHT) 555 555 /* This function generates a linear backlight curve 556 556 * 557 557 * 0: off
+1 -2
drivers/video/fbdev/fsl-diu-fb.c
··· 1575 1575 1576 1576 unregister_framebuffer(info); 1577 1577 unmap_video_memory(info); 1578 - if (&info->cmap) 1579 - fb_dealloc_cmap(&info->cmap); 1578 + fb_dealloc_cmap(&info->cmap); 1580 1579 1581 1580 mfbi->registered = 0; 1582 1581 }
+4 -14
drivers/video/fbdev/omap2/omapfb/dss/core.c
··· 99 99 } 100 100 101 101 #if defined(CONFIG_FB_OMAP2_DSS_DEBUGFS) 102 - static int dss_debug_show(struct seq_file *s, void *unused) 102 + static int dss_show(struct seq_file *s, void *unused) 103 103 { 104 104 void (*func)(struct seq_file *) = s->private; 105 105 func(s); 106 106 return 0; 107 107 } 108 108 109 - static int dss_debug_open(struct inode *inode, struct file *file) 110 - { 111 - return single_open(file, dss_debug_show, inode->i_private); 112 - } 113 - 114 - static const struct file_operations dss_debug_fops = { 115 - .open = dss_debug_open, 116 - .read = seq_read, 117 - .llseek = seq_lseek, 118 - .release = single_release, 119 - }; 109 + DEFINE_SHOW_ATTRIBUTE(dss); 120 110 121 111 static struct dentry *dss_debugfs_dir; 122 112 ··· 120 130 } 121 131 122 132 debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir, 123 - &dss_debug_dump_clocks, &dss_debug_fops); 133 + &dss_debug_dump_clocks, &dss_fops); 124 134 125 135 return 0; 126 136 } ··· 135 145 struct dentry *d; 136 146 137 147 d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir, 138 - write, &dss_debug_fops); 148 + write, &dss_fops); 139 149 140 150 return PTR_ERR_OR_ZERO(d); 141 151 }
+1 -1
drivers/video/fbdev/pxa168fb.c
··· 279 279 280 280 /* check whether divisor is too small. */ 281 281 if (divider_int < 2) { 282 - dev_warn(fbi->dev, "Warning: clock source is too slow." 282 + dev_warn(fbi->dev, "Warning: clock source is too slow. " 283 283 "Try smaller resolution\n"); 284 284 divider_int = 2; 285 285 }
+1 -3
drivers/video/fbdev/pxafb.c
··· 2234 2234 if (!info) 2235 2235 return ERR_PTR(-ENOMEM); 2236 2236 ret = of_get_pxafb_mode_info(dev, info); 2237 - if (ret) { 2238 - kfree(info->modes); 2237 + if (ret) 2239 2238 return ERR_PTR(ret); 2240 - } 2241 2239 2242 2240 /* 2243 2241 * On purpose, neither lccrX registers nor video memory size can be
+6 -8
drivers/video/fbdev/udlfb.c
··· 1598 1598 dlfb = kzalloc(sizeof(*dlfb), GFP_KERNEL); 1599 1599 if (!dlfb) { 1600 1600 dev_err(&intf->dev, "%s: failed to allocate dlfb\n", __func__); 1601 - goto error; 1601 + return -ENOMEM; 1602 1602 } 1603 1603 1604 1604 INIT_LIST_HEAD(&dlfb->deferred_free); ··· 1703 1703 error: 1704 1704 if (dlfb->info) { 1705 1705 dlfb_ops_destroy(dlfb->info); 1706 - } else if (dlfb) { 1706 + } else { 1707 1707 usb_put_dev(dlfb->udev); 1708 1708 kfree(dlfb); 1709 1709 } ··· 1730 1730 /* this function will wait for all in-flight urbs to complete */ 1731 1731 dlfb_free_urb_list(dlfb); 1732 1732 1733 - if (info) { 1734 - /* remove udlfb's sysfs interfaces */ 1735 - for (i = 0; i < ARRAY_SIZE(fb_device_attrs); i++) 1736 - device_remove_file(info->dev, &fb_device_attrs[i]); 1737 - device_remove_bin_file(info->dev, &edid_attr); 1738 - } 1733 + /* remove udlfb's sysfs interfaces */ 1734 + for (i = 0; i < ARRAY_SIZE(fb_device_attrs); i++) 1735 + device_remove_file(info->dev, &fb_device_attrs[i]); 1736 + device_remove_bin_file(info->dev, &edid_attr); 1739 1737 1740 1738 unregister_framebuffer(info); 1741 1739 }
+1 -1
drivers/video/fbdev/uvesafb.c
··· 1979 1979 module_param(vram_remap, uint, 0); 1980 1980 MODULE_PARM_DESC(vram_remap, "Set amount of video memory to be used [MiB]"); 1981 1981 module_param(vram_total, uint, 0); 1982 - MODULE_PARM_DESC(vram_total, "Set total amount of video memoery [MiB]"); 1982 + MODULE_PARM_DESC(vram_total, "Set total amount of video memory [MiB]"); 1983 1983 module_param(maxclk, ushort, 0); 1984 1984 MODULE_PARM_DESC(maxclk, "Maximum pixelclock [MHz], overrides EDID data"); 1985 1985 module_param(maxhf, ushort, 0);
+9
drivers/video/logo/Kconfig
··· 10 10 11 11 if LOGO 12 12 13 + config FB_LOGO_CENTER 14 + bool "Center the logo" 15 + depends on FB=y 16 + help 17 + When this option is selected, the bootup logo is centered both 18 + horizontally and vertically. If more than one logo is displayed 19 + due to multiple CPUs, the collected line of logos is centered 20 + as a whole. 21 + 13 22 config FB_LOGO_EXTRA 14 23 bool 15 24 depends on FB=y
+1 -1
include/linux/fb.h
··· 485 485 struct list_head modelist; /* mode list */ 486 486 struct fb_videomode *mode; /* current mode */ 487 487 488 - #ifdef CONFIG_FB_BACKLIGHT 488 + #if IS_ENABLED(CONFIG_FB_BACKLIGHT) 489 489 /* assigned backlight device */ 490 490 /* set before framebuffer registration, 491 491 remove after unregister */
-2
include/uapi/linux/fb.h
··· 393 393 struct fb_image image; /* Cursor image */ 394 394 }; 395 395 396 - #ifdef CONFIG_FB_BACKLIGHT 397 396 /* Settings for the generic backlight code */ 398 397 #define FB_BACKLIGHT_LEVELS 128 399 398 #define FB_BACKLIGHT_MAX 0xFF 400 - #endif 401 399 402 400 403 401 #endif /* _UAPI_LINUX_FB_H */