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

Merge tag 'fbdev-v5.3' of git://github.com/bzolnier/linux

Pull fbdev updates from Bartlomiej Zolnierkiewicz:

- remove fbdev notifier usage for fbcon (as prep work to clean up the
fbcon locking), add locking checks in vt/console code and make
assorted cleanups in fbdev and backlight code (Daniel Vetter)

- add COMPILE_TEST support to atmel_lcdfb, da8xx-fb, gbefb, imxfb,
pvr2fb and pxa168fb drivers (me)

- fix DMA API abuse in au1200fb and jz4740_fb drivers (Christoph
Hellwig)

- add check for new BGRT status field rotation bits in efifb driver
(Hans de Goede)

- mark expected switch fall-throughs in s3c-fb driver (Gustavo A. R.
Silva)

- remove fbdev mxsfb driver in favour of the drm version (Fabio
Estevam)

- remove broken rfbi code from omap2fb driver (me)

- misc fixes (Arnd Bergmann, Shobhit Kukreti, Wei Yongjun, me)

- misc cleanups (Gustavo A. R. Silva, Colin Ian King, me)

* tag 'fbdev-v5.3' of git://github.com/bzolnier/linux: (62 commits)
video: fbdev: imxfb: fix a typo in imxfb_probe()
video: fbdev: s3c-fb: Mark expected switch fall-throughs
video: fbdev: s3c-fb: fix sparse warnings about using incorrect types
video: fbdev: don't print error message on framebuffer_alloc() failure
video: fbdev: intelfb: return -ENOMEM on framebuffer_alloc() failure
video: fbdev: s3c-fb: return -ENOMEM on framebuffer_alloc() failure
vga_switcheroo: Depend upon fbcon being built-in, if enabled
video: fbdev: omap2: remove rfbi
video: fbdev: atmel_lcdfb: remove redundant initialization to variable ret
video: fbdev-MMP: Use struct_size() in devm_kzalloc()
video: fbdev: controlfb: fix warnings about comparing pointer to 0
efifb: BGRT: Add check for new BGRT status field rotation bits
jz4740_fb: fix DMA API abuse
video: fbdev: pvr2fb: fix link error for pvr2fb_pci_exit
video: fbdev: s3c-fb: add COMPILE_TEST support
video: fbdev: imxfb: fix sparse warnings about using incorrect types
video: fbdev: pvr2fb: fix build warning when compiling as module
fbcon: Export fbcon_update_vcs
backlight: simplify lcd notifier
staging/olpc_dcon: Add drm conversion to TODO
...

+586 -3263
+11 -2
arch/arm/mach-pxa/am200epd.c
··· 347 347 { 348 348 int ret; 349 349 350 - /* before anything else, we request notification for any fb 351 - * creation events */ 350 + /* 351 + * Before anything else, we request notification for any fb 352 + * creation events. 353 + * 354 + * FIXME: This is terrible and needs to be nuked. The notifier is used 355 + * to get at the fb base address from the boot splash fb driver, which 356 + * is then passed to metronomefb. Instaed of metronomfb or this board 357 + * support file here figuring this out on their own. 358 + * 359 + * See also the #ifdef in fbmem.c. 360 + */ 352 361 fb_register_client(&am200_fb_notif); 353 362 354 363 pxa2xx_mfp_config(ARRAY_AND_SIZE(am200_pin_config));
+1
drivers/gpu/vga/Kconfig
··· 23 23 depends on X86 24 24 depends on ACPI 25 25 depends on PCI 26 + depends on (FRAMEBUFFER_CONSOLE=n || FB=y) 26 27 select VGA_ARB 27 28 help 28 29 Many laptops released in 2008/9/10 have two GPUs with a multiplexer
+3 -8
drivers/gpu/vga/vga_switcheroo.c
··· 35 35 #include <linux/debugfs.h> 36 36 #include <linux/fb.h> 37 37 #include <linux/fs.h> 38 + #include <linux/fbcon.h> 38 39 #include <linux/module.h> 39 40 #include <linux/pci.h> 40 41 #include <linux/pm_domain.h> ··· 737 736 if (!active->driver_power_control) 738 737 set_audio_state(active->id, VGA_SWITCHEROO_OFF); 739 738 740 - if (new_client->fb_info) { 741 - struct fb_event event; 742 - 743 - console_lock(); 744 - event.info = new_client->fb_info; 745 - fb_notifier_call_chain(FB_EVENT_REMAP_ALL_CONSOLE, &event); 746 - console_unlock(); 747 - } 739 + if (new_client->fb_info) 740 + fbcon_remap_all(new_client->fb_info); 748 741 749 742 mutex_lock(&vgasr_priv.mux_hw_lock); 750 743 ret = vgasr_priv.handler->switchto(new_client->id);
+1 -3
drivers/hid/hid-picolcd_fb.c
··· 512 512 sizeof(struct fb_deferred_io) + 513 513 sizeof(struct picolcd_fb_data) + 514 514 PICOLCDFB_SIZE, dev); 515 - if (info == NULL) { 516 - dev_err(dev, "failed to allocate a framebuffer\n"); 515 + if (!info) 517 516 goto err_nomem; 518 - } 519 517 520 518 info->fbdefio = info->par; 521 519 *info->fbdefio = picolcd_fb_defio;
+1 -5
drivers/media/pci/ivtv/ivtvfb.c
··· 1256 1256 itv->streams[IVTV_DEC_STREAM_TYPE_MPG].vdev.device_caps &= 1257 1257 ~V4L2_CAP_VIDEO_OUTPUT_OVERLAY; 1258 1258 itv->v4l2_cap &= ~V4L2_CAP_VIDEO_OUTPUT_OVERLAY; 1259 - if (unregister_framebuffer(&itv->osd_info->ivtvfb_info)) { 1260 - IVTVFB_WARN("Framebuffer %d is in use, cannot unload\n", 1261 - itv->instance); 1262 - return 0; 1263 - } 1259 + unregister_framebuffer(&itv->osd_info->ivtvfb_info); 1264 1260 IVTVFB_INFO("Unregister framebuffer %d\n", itv->instance); 1265 1261 itv->ivtvfb_restore = NULL; 1266 1262 ivtvfb_blank(FB_BLANK_VSYNC_SUSPEND, &oi->ivtvfb_info);
+3 -1
drivers/staging/fbtft/fbtft-core.c
··· 891 891 if (par->fbtftops.unregister_backlight) 892 892 par->fbtftops.unregister_backlight(par); 893 893 fbtft_sysfs_exit(par); 894 - return unregister_framebuffer(fb_info); 894 + unregister_framebuffer(fb_info); 895 + 896 + return 0; 895 897 } 896 898 EXPORT_SYMBOL(fbtft_unregister_framebuffer); 897 899
+7
drivers/staging/olpc_dcon/TODO
··· 1 1 TODO: 2 + - complete rewrite: 3 + 1. The underlying fbdev drivers need to be converted into drm kernel 4 + modesetting drivers. 5 + 2. The dcon low-power display mode can then be integrated using the 6 + drm damage tracking and self-refresh helpers. 7 + This bolted-on self-refresh support that digs around in fbdev 8 + internals, but isn't properly integrated, is not the correct solution. 2 9 - see if vx855 gpio API can be made similar enough to cs5535 so we can 3 10 share more code 4 11 - convert all uses of the old GPIO API from <linux/gpio.h> to the
+1 -5
drivers/staging/olpc_dcon/olpc_dcon.c
··· 250 250 int err; 251 251 252 252 console_lock(); 253 - if (!lock_fb_info(dcon->fbinfo)) { 254 - console_unlock(); 255 - dev_err(&dcon->client->dev, "unable to lock framebuffer\n"); 256 - return false; 257 - } 253 + lock_fb_info(dcon->fbinfo); 258 254 259 255 dcon->ignore_fb_events = true; 260 256 err = fb_blank(dcon->fbinfo,
+18
drivers/tty/vt/vt.c
··· 3822 3822 { 3823 3823 int i, bound = 0; 3824 3824 3825 + WARN_CONSOLE_UNLOCKED(); 3826 + 3825 3827 for (i = 0; i < MAX_NR_CONSOLES; i++) { 3826 3828 if (con_driver_map[i] == csw) { 3827 3829 bound = 1; ··· 3834 3832 return bound; 3835 3833 } 3836 3834 EXPORT_SYMBOL(con_is_bound); 3835 + 3836 + /** 3837 + * con_is_visible - checks whether the current console is visible 3838 + * @vc: virtual console 3839 + * 3840 + * RETURNS: zero if not visible, nonzero if visible 3841 + */ 3842 + bool con_is_visible(const struct vc_data *vc) 3843 + { 3844 + WARN_CONSOLE_UNLOCKED(); 3845 + 3846 + return *vc->vc_display_fg == vc; 3847 + } 3848 + EXPORT_SYMBOL(con_is_visible); 3837 3849 3838 3850 /** 3839 3851 * con_debug_enter - prepare the console for the kernel debugger ··· 4181 4165 { 4182 4166 struct vc_data *vc = vc_cons[fg_console].d; 4183 4167 int i; 4168 + 4169 + might_sleep(); 4184 4170 4185 4171 WARN_CONSOLE_UNLOCKED(); 4186 4172
+1 -1
drivers/video/backlight/backlight.c
··· 47 47 int fb_blank = 0; 48 48 49 49 /* If we aren't interested in this event, skip it immediately ... */ 50 - if (event != FB_EVENT_BLANK && event != FB_EVENT_CONBLANK) 50 + if (event != FB_EVENT_BLANK) 51 51 return 0; 52 52 53 53 bd = container_of(self, struct backlight_device, fb_notif);
-12
drivers/video/backlight/lcd.c
··· 30 30 struct lcd_device *ld; 31 31 struct fb_event *evdata = data; 32 32 33 - /* If we aren't interested in this event, skip it immediately ... */ 34 - switch (event) { 35 - case FB_EVENT_BLANK: 36 - case FB_EVENT_MODE_CHANGE: 37 - case FB_EVENT_MODE_CHANGE_ALL: 38 - case FB_EARLY_EVENT_BLANK: 39 - case FB_R_EARLY_EVENT_BLANK: 40 - break; 41 - default: 42 - return 0; 43 - } 44 - 45 33 ld = container_of(self, struct lcd_device, fb_notif); 46 34 if (!ld->ops) 47 35 return 0;
+6
drivers/video/console/dummycon.c
··· 34 34 35 35 void dummycon_register_output_notifier(struct notifier_block *nb) 36 36 { 37 + WARN_CONSOLE_UNLOCKED(); 38 + 37 39 raw_notifier_chain_register(&dummycon_output_nh, nb); 38 40 39 41 if (dummycon_putc_called) ··· 44 42 45 43 void dummycon_unregister_output_notifier(struct notifier_block *nb) 46 44 { 45 + WARN_CONSOLE_UNLOCKED(); 46 + 47 47 raw_notifier_chain_unregister(&dummycon_output_nh, nb); 48 48 } 49 49 50 50 static void dummycon_putc(struct vc_data *vc, int c, int ypos, int xpos) 51 51 { 52 + WARN_CONSOLE_UNLOCKED(); 53 + 52 54 dummycon_putc_called = true; 53 55 raw_notifier_call_chain(&dummycon_output_nh, 0, NULL); 54 56 }
+15 -19
drivers/video/fbdev/Kconfig
··· 332 332 333 333 config FB_IMX 334 334 tristate "Freescale i.MX1/21/25/27 LCD support" 335 - depends on FB && ARCH_MXC 335 + depends on FB && HAVE_CLK && HAS_IOMEM 336 + depends on ARCH_MXC || COMPILE_TEST 336 337 select LCD_CLASS_DEVICE 337 338 select FB_CFB_FILLRECT 338 339 select FB_CFB_COPYAREA ··· 671 670 672 671 config FB_GBE 673 672 bool "SGI Graphics Backend frame buffer support" 674 - depends on (FB = y) && SGI_IP32 673 + depends on (FB = y) && HAS_IOMEM 674 + depends on SGI_IP32 || COMPILE_TEST 675 675 select FB_CFB_FILLRECT 676 676 select FB_CFB_COPYAREA 677 677 select FB_CFB_IMAGEBLIT ··· 810 808 811 809 config FB_PVR2 812 810 tristate "NEC PowerVR 2 display support" 813 - depends on FB && SH_DREAMCAST 811 + depends on FB && HAS_IOMEM 812 + depends on SH_DREAMCAST || COMPILE_TEST 814 813 select FB_CFB_FILLRECT 815 814 select FB_CFB_COPYAREA 816 815 select FB_CFB_IMAGEBLIT ··· 859 856 860 857 config FB_ATMEL 861 858 tristate "AT91 LCD Controller support" 862 - depends on FB && OF && HAVE_FB_ATMEL 859 + depends on FB && OF && HAVE_CLK && HAS_IOMEM 860 + depends on HAVE_FB_ATMEL || COMPILE_TEST 863 861 select FB_BACKLIGHT 864 862 select FB_CFB_FILLRECT 865 863 select FB_CFB_COPYAREA ··· 1733 1729 1734 1730 config FB_PXA168 1735 1731 tristate "PXA168/910 LCD framebuffer support" 1736 - depends on FB && (CPU_PXA168 || CPU_PXA910) 1732 + depends on FB && HAVE_CLK && HAS_IOMEM 1733 + depends on CPU_PXA168 || CPU_PXA910 || COMPILE_TEST 1737 1734 select FB_CFB_FILLRECT 1738 1735 select FB_CFB_COPYAREA 1739 1736 select FB_CFB_IMAGEBLIT ··· 1878 1873 1879 1874 config FB_S3C 1880 1875 tristate "Samsung S3C framebuffer support" 1881 - depends on FB && (CPU_S3C2416 || ARCH_S3C64XX) 1876 + depends on FB && HAVE_CLK && HAS_IOMEM 1877 + depends on (CPU_S3C2416 || ARCH_S3C64XX) || COMPILE_TEST 1882 1878 select FB_CFB_FILLRECT 1883 1879 select FB_CFB_COPYAREA 1884 1880 select FB_CFB_IMAGEBLIT ··· 2061 2055 2062 2056 config FB_DA8XX 2063 2057 tristate "DA8xx/OMAP-L1xx/AM335x Framebuffer support" 2064 - depends on FB && (ARCH_DAVINCI_DA8XX || SOC_AM33XX) 2058 + depends on FB && HAVE_CLK && HAS_IOMEM 2059 + depends on ARCH_DAVINCI_DA8XX || SOC_AM33XX || COMPILE_TEST 2065 2060 select FB_CFB_FILLRECT 2066 2061 select FB_CFB_COPYAREA 2067 2062 select FB_CFB_IMAGEBLIT ··· 2179 2172 2180 2173 config FB_PRE_INIT_FB 2181 2174 bool "Don't reinitialize, use bootloader's GDC/Display configuration" 2182 - depends on FB && (FB_MB862XX_LIME || FB_MXS) 2175 + depends on FB && FB_MB862XX_LIME 2183 2176 ---help--- 2184 2177 Select this option if display contents should be inherited as set by 2185 2178 the bootloader. ··· 2219 2212 select FB_SYS_IMAGEBLIT 2220 2213 help 2221 2214 Framebuffer support for the JZ4740 SoC. 2222 - 2223 - config FB_MXS 2224 - tristate "MXS LCD framebuffer support" 2225 - depends on FB && (ARCH_MXS || ARCH_MXC) 2226 - select FB_CFB_FILLRECT 2227 - select FB_CFB_COPYAREA 2228 - select FB_CFB_IMAGEBLIT 2229 - select FB_MODE_HELPERS 2230 - select VIDEOMODE_HELPERS 2231 - help 2232 - Framebuffer support for the MXS SoC. 2233 2215 2234 2216 config FB_PUV3_UNIGFX 2235 2217 tristate "PKUnity v3 Unigfx framebuffer support"
-1
drivers/video/fbdev/Makefile
··· 131 131 obj-$(CONFIG_FB_OF) += offb.o 132 132 obj-$(CONFIG_FB_MX3) += mx3fb.o 133 133 obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o 134 - obj-$(CONFIG_FB_MXS) += mxsfb.o 135 134 obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o 136 135 obj-$(CONFIG_FB_SIMPLE) += simplefb.o 137 136
+1 -3
drivers/video/fbdev/amifb.c
··· 3554 3554 custom.dmacon = DMAF_ALL | DMAF_MASTER; 3555 3555 3556 3556 info = framebuffer_alloc(sizeof(struct amifb_par), &pdev->dev); 3557 - if (!info) { 3558 - dev_err(&pdev->dev, "framebuffer_alloc failed\n"); 3557 + if (!info) 3559 3558 return -ENOMEM; 3560 - } 3561 3559 3562 3560 strcpy(info->fix.id, "Amiga "); 3563 3561 info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
+1 -3
drivers/video/fbdev/arkfb.c
··· 954 954 955 955 /* Allocate and fill driver data structure */ 956 956 info = framebuffer_alloc(sizeof(struct arkfb_info), &(dev->dev)); 957 - if (! info) { 958 - dev_err(&(dev->dev), "cannot allocate memory\n"); 957 + if (!info) 959 958 return -ENOMEM; 960 - } 961 959 962 960 par = info->par; 963 961 mutex_init(&par->open_lock);
-21
drivers/video/fbdev/atafb.c
··· 77 77 #define SWITCH_SND7 0x80 78 78 #define SWITCH_NONE 0x00 79 79 80 - 81 80 #define up(x, r) (((x) + (r) - 1) & ~((r)-1)) 82 - 83 - /* 84 - * Interface to the world 85 - */ 86 - 87 - static int atafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info); 88 - static int atafb_set_par(struct fb_info *info); 89 - static int atafb_setcolreg(unsigned int regno, unsigned int red, unsigned int green, 90 - unsigned int blue, unsigned int transp, 91 - struct fb_info *info); 92 - static int atafb_blank(int blank, struct fb_info *info); 93 - static int atafb_pan_display(struct fb_var_screeninfo *var, 94 - struct fb_info *info); 95 - static void atafb_fillrect(struct fb_info *info, 96 - const struct fb_fillrect *rect); 97 - static void atafb_copyarea(struct fb_info *info, 98 - const struct fb_copyarea *region); 99 - static void atafb_imageblit(struct fb_info *info, const struct fb_image *image); 100 - static int atafb_ioctl(struct fb_info *info, unsigned int cmd, 101 - unsigned long arg); 102 81 103 82 104 83 static int default_par; /* default resolution (0=none) */
+4 -6
drivers/video/fbdev/atmel_lcdfb.c
··· 673 673 lcdc_writel(sinfo, ATMEL_LCDC_MVAL, 0); 674 674 675 675 /* Disable all interrupts */ 676 - lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0UL); 676 + lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0U); 677 677 /* Enable FIFO & DMA errors */ 678 678 lcdc_writel(sinfo, ATMEL_LCDC_IER, ATMEL_LCDC_UFLWI | ATMEL_LCDC_OWRI | ATMEL_LCDC_MERI); 679 679 ··· 950 950 struct fb_videomode fb_vm; 951 951 struct gpio_desc *gpiod; 952 952 struct videomode vm; 953 - int ret = -ENOENT; 953 + int ret; 954 954 int i; 955 955 956 956 sinfo->config = (struct atmel_lcdfb_config*) ··· 1053 1053 1054 1054 ret = -ENOMEM; 1055 1055 info = framebuffer_alloc(sizeof(struct atmel_lcdfb_info), dev); 1056 - if (!info) { 1057 - dev_err(dev, "cannot allocate memory\n"); 1056 + if (!info) 1058 1057 goto out; 1059 - } 1060 1058 1061 1059 sinfo = info->par; 1062 1060 sinfo->pdev = pdev; ··· 1289 1291 * We don't want to handle interrupts while the clock is 1290 1292 * stopped. It may take forever. 1291 1293 */ 1292 - lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0UL); 1294 + lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0U); 1293 1295 1294 1296 sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_CTR); 1295 1297 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0);
+2 -67
drivers/video/fbdev/aty/aty128fb.c
··· 2103 2103 2104 2104 /* We have the resources. Now virtualize them */ 2105 2105 info = framebuffer_alloc(sizeof(struct aty128fb_par), &pdev->dev); 2106 - if (info == NULL) { 2107 - printk(KERN_ERR "aty128fb: can't alloc fb_info_aty128\n"); 2106 + if (!info) 2108 2107 goto err_free_mmio; 2109 - } 2108 + 2110 2109 par = info->par; 2111 2110 2112 2111 info->pseudo_palette = par->pseudo_palette; ··· 2348 2349 } 2349 2350 return -EINVAL; 2350 2351 } 2351 - 2352 - #if 0 2353 - /* 2354 - * Accelerated functions 2355 - */ 2356 - 2357 - static inline void aty128_rectcopy(int srcx, int srcy, int dstx, int dsty, 2358 - u_int width, u_int height, 2359 - struct fb_info_aty128 *par) 2360 - { 2361 - u32 save_dp_datatype, save_dp_cntl, dstval; 2362 - 2363 - if (!width || !height) 2364 - return; 2365 - 2366 - dstval = depth_to_dst(par->current_par.crtc.depth); 2367 - if (dstval == DST_24BPP) { 2368 - srcx *= 3; 2369 - dstx *= 3; 2370 - width *= 3; 2371 - } else if (dstval == -EINVAL) { 2372 - printk("aty128fb: invalid depth or RGBA\n"); 2373 - return; 2374 - } 2375 - 2376 - wait_for_fifo(2, par); 2377 - save_dp_datatype = aty_ld_le32(DP_DATATYPE); 2378 - save_dp_cntl = aty_ld_le32(DP_CNTL); 2379 - 2380 - wait_for_fifo(6, par); 2381 - aty_st_le32(SRC_Y_X, (srcy << 16) | srcx); 2382 - aty_st_le32(DP_MIX, ROP3_SRCCOPY | DP_SRC_RECT); 2383 - aty_st_le32(DP_CNTL, DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM); 2384 - aty_st_le32(DP_DATATYPE, save_dp_datatype | dstval | SRC_DSTCOLOR); 2385 - 2386 - aty_st_le32(DST_Y_X, (dsty << 16) | dstx); 2387 - aty_st_le32(DST_HEIGHT_WIDTH, (height << 16) | width); 2388 - 2389 - par->blitter_may_be_busy = 1; 2390 - 2391 - wait_for_fifo(2, par); 2392 - aty_st_le32(DP_DATATYPE, save_dp_datatype); 2393 - aty_st_le32(DP_CNTL, save_dp_cntl); 2394 - } 2395 - 2396 - 2397 - /* 2398 - * Text mode accelerated functions 2399 - */ 2400 - 2401 - static void fbcon_aty128_bmove(struct display *p, int sy, int sx, int dy, 2402 - int dx, int height, int width) 2403 - { 2404 - sx *= fontwidth(p); 2405 - sy *= fontheight(p); 2406 - dx *= fontwidth(p); 2407 - dy *= fontheight(p); 2408 - width *= fontwidth(p); 2409 - height *= fontheight(p); 2410 - 2411 - aty128_rectcopy(sx, sy, dx, dy, width, height, 2412 - (struct fb_info_aty128 *)p->fb_info); 2413 - } 2414 - #endif /* 0 */ 2415 2352 2416 2353 static void aty128_set_suspend(struct aty128fb_par *par, int suspend) 2417 2354 {
+5 -8
drivers/video/fbdev/aty/atyfb_base.c
··· 3550 3550 3551 3551 /* Allocate framebuffer */ 3552 3552 info = framebuffer_alloc(sizeof(struct atyfb_par), &pdev->dev); 3553 - if (!info) { 3554 - PRINTKE("atyfb_pci_probe() can't alloc fb_info\n"); 3553 + if (!info) 3555 3554 return -ENOMEM; 3556 - } 3555 + 3557 3556 par = info->par; 3558 3557 par->bus_type = PCI; 3559 3558 info->fix = atyfb_fix; ··· 3642 3643 } 3643 3644 3644 3645 info = framebuffer_alloc(sizeof(struct atyfb_par), NULL); 3645 - if (!info) { 3646 - PRINTKE("atyfb_atari_probe() can't alloc fb_info\n"); 3646 + if (!info) 3647 3647 return -ENOMEM; 3648 - } 3648 + 3649 3649 par = info->par; 3650 3650 3651 3651 info->fix = atyfb_fix; ··· 3914 3916 if (!reboot_info) 3915 3917 goto out; 3916 3918 3917 - if (!lock_fb_info(reboot_info)) 3918 - goto out; 3919 + lock_fb_info(reboot_info); 3919 3920 3920 3921 par = reboot_info->par; 3921 3922
-2
drivers/video/fbdev/aty/radeon_base.c
··· 2294 2294 2295 2295 info = framebuffer_alloc(sizeof(struct radeonfb_info), &pdev->dev); 2296 2296 if (!info) { 2297 - printk (KERN_ERR "radeonfb (%s): could not allocate memory\n", 2298 - pci_name(pdev)); 2299 2297 ret = -ENOMEM; 2300 2298 goto err_disable; 2301 2299 }
+4 -15
drivers/video/fbdev/au1200fb.c
··· 147 147 struct au1200fb_device { 148 148 struct fb_info *fb_info; /* FB driver info record */ 149 149 struct au1200fb_platdata *pd; 150 + struct device *dev; 150 151 151 152 int plane; 152 153 unsigned char* fb_mem; /* FrameBuffer memory map */ ··· 1233 1232 { 1234 1233 struct au1200fb_device *fbdev = info->par; 1235 1234 1236 - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 1237 - pgprot_val(vma->vm_page_prot) |= _CACHE_MASK; /* CCA=7 */ 1238 - 1239 - return vm_iomap_memory(vma, fbdev->fb_phys, fbdev->fb_len); 1235 + return dma_mmap_attrs(fbdev->dev, vma, fbdev->fb_mem, fbdev->fb_phys, 1236 + fbdev->fb_len, DMA_ATTR_NON_CONSISTENT); 1240 1237 } 1241 1238 1242 1239 static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata) ··· 1646 1647 struct au1200fb_device *fbdev; 1647 1648 struct au1200fb_platdata *pd; 1648 1649 struct fb_info *fbi = NULL; 1649 - unsigned long page; 1650 1650 int bpp, plane, ret, irq; 1651 1651 1652 1652 print_info("" DRIVER_DESC ""); ··· 1683 1685 fbdev = fbi->par; 1684 1686 fbdev->fb_info = fbi; 1685 1687 fbdev->pd = pd; 1688 + fbdev->dev = &dev->dev; 1686 1689 1687 1690 fbdev->plane = plane; 1688 1691 ··· 1701 1702 goto failed; 1702 1703 } 1703 1704 1704 - /* 1705 - * Set page reserved so that mmap will work. This is necessary 1706 - * since we'll be remapping normal memory. 1707 - */ 1708 - for (page = (unsigned long)fbdev->fb_phys; 1709 - page < PAGE_ALIGN((unsigned long)fbdev->fb_phys + 1710 - fbdev->fb_len); 1711 - page += PAGE_SIZE) { 1712 - SetPageReserved(pfn_to_page(page >> PAGE_SHIFT)); /* LCD DMA is NOT coherent on Au1200 */ 1713 - } 1714 1705 print_dbg("Framebuffer memory map at %p", fbdev->fb_mem); 1715 1706 print_dbg("phys=0x%08x, size=%dK", fbdev->fb_phys, fbdev->fb_len / 1024); 1716 1707
-1
drivers/video/fbdev/chipsfb.c
··· 366 366 367 367 p = framebuffer_alloc(0, &dp->dev); 368 368 if (p == NULL) { 369 - dev_err(&dp->dev, "Cannot allocate framebuffer structure\n"); 370 369 rc = -ENOMEM; 371 370 goto err_disable; 372 371 }
+1 -4
drivers/video/fbdev/cirrusfb.c
··· 2093 2093 2094 2094 info = framebuffer_alloc(sizeof(struct cirrusfb_info), &pdev->dev); 2095 2095 if (!info) { 2096 - printk(KERN_ERR "cirrusfb: could not allocate memory\n"); 2097 2096 ret = -ENOMEM; 2098 2097 goto err_out; 2099 2098 } ··· 2205 2206 struct cirrusfb_info *cinfo; 2206 2207 2207 2208 info = framebuffer_alloc(sizeof(struct cirrusfb_info), &z->dev); 2208 - if (!info) { 2209 - printk(KERN_ERR "cirrusfb: could not allocate memory\n"); 2209 + if (!info) 2210 2210 return -ENOMEM; 2211 - } 2212 2211 2213 2212 zcl = (const struct zorrocl *)ent->driver_data; 2214 2213 btype = zcl->type;
+4 -4
drivers/video/fbdev/controlfb.c
··· 182 182 int ret = -ENXIO; 183 183 184 184 dp = of_find_node_by_name(NULL, "control"); 185 - if (dp != 0 && !control_of_init(dp)) 185 + if (dp && !control_of_init(dp)) 186 186 ret = 0; 187 187 of_node_put(dp); 188 188 ··· 580 580 control_setup(option); 581 581 582 582 dp = of_find_node_by_name(NULL, "control"); 583 - if (dp != 0 && !control_of_init(dp)) 583 + if (dp && !control_of_init(dp)) 584 584 ret = 0; 585 585 of_node_put(dp); 586 586 ··· 683 683 return -ENXIO; 684 684 } 685 685 p = kzalloc(sizeof(*p), GFP_KERNEL); 686 - if (p == 0) 687 - return -ENXIO; 686 + if (!p) 687 + return -ENOMEM; 688 688 control_fb = p; /* save it for cleanups */ 689 689 690 690 /* Map in frame buffer and registers */
+1 -5
drivers/video/fbdev/core/fbcmap.c
··· 285 285 goto out; 286 286 } 287 287 umap.start = cmap->start; 288 - if (!lock_fb_info(info)) { 289 - rc = -ENODEV; 290 - goto out; 291 - } 292 - 288 + lock_fb_info(info); 293 289 rc = fb_set_cmap(&umap, info); 294 290 unlock_fb_info(info); 295 291 out:
+134 -180
drivers/video/fbdev/core/fbcon.c
··· 76 76 #include <linux/init.h> 77 77 #include <linux/interrupt.h> 78 78 #include <linux/crc32.h> /* For counting font checksums */ 79 + #include <linux/uaccess.h> 79 80 #include <asm/fb.h> 80 81 #include <asm/irq.h> 81 82 ··· 88 87 # define DPRINTK(fmt, args...) 89 88 #endif 90 89 90 + /* 91 + * FIXME: Locking 92 + * 93 + * - fbcon state itself is protected by the console_lock, and the code does a 94 + * pretty good job at making sure that lock is held everywhere it's needed. 95 + * 96 + * - access to the registered_fb array is entirely unprotected. This should use 97 + * proper object lifetime handling, i.e. get/put_fb_info. This also means 98 + * switching from indices to proper pointers for fb_info everywhere. 99 + * 100 + * - fbcon doesn't bother with fb_lock/unlock at all. This is buggy, since it 101 + * means concurrent access to the same fbdev from both fbcon and userspace 102 + * will blow up. To fix this all fbcon calls from fbmem.c need to be moved out 103 + * of fb_lock/unlock protected sections, since otherwise we'll recurse and 104 + * deadlock eventually. Aside: Due to these deadlock issues the fbdev code in 105 + * fbmem.c cannot use locking asserts, and there's lots of callers which get 106 + * the rules wrong, e.g. fbsysfs.c entirely missed fb_lock/unlock calls too. 107 + */ 108 + 91 109 enum { 92 110 FBCON_LOGO_CANSHOW = -1, /* the logo can be shown */ 93 111 FBCON_LOGO_DRAW = -2, /* draw the logo to a console */ 94 112 FBCON_LOGO_DONTSHOW = -3 /* do not show the logo */ 95 113 }; 96 114 97 - static struct display fb_display[MAX_NR_CONSOLES]; 115 + static struct fbcon_display fb_display[MAX_NR_CONSOLES]; 98 116 99 117 static signed char con2fb_map[MAX_NR_CONSOLES]; 100 118 static signed char con2fb_map_boot[MAX_NR_CONSOLES]; ··· 132 112 static int first_fb_vc; 133 113 static int last_fb_vc = MAX_NR_CONSOLES - 1; 134 114 static int fbcon_is_default = 1; 135 - static int fbcon_has_exited; 136 115 static int primary_device = -1; 137 116 static int fbcon_has_console_bind; 138 117 ··· 204 185 static __inline__ void ywrap_down(struct vc_data *vc, int count); 205 186 static __inline__ void ypan_up(struct vc_data *vc, int count); 206 187 static __inline__ void ypan_down(struct vc_data *vc, int count); 207 - static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int sx, 188 + static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx, 208 189 int dy, int dx, int height, int width, u_int y_break); 209 190 static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var, 210 191 int unit); 211 - static void fbcon_redraw_move(struct vc_data *vc, struct display *p, 192 + static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, 212 193 int line, int count, int dy); 213 194 static void fbcon_modechanged(struct fb_info *info); 214 195 static void fbcon_set_all_vcs(struct fb_info *info); ··· 239 220 fb_info = registered_fb[con2fb_map[ops->currcon]]; 240 221 241 222 if (info == fb_info) { 242 - struct display *p = &fb_display[ops->currcon]; 223 + struct fbcon_display *p = &fb_display[ops->currcon]; 243 224 244 225 if (rotate < 4) 245 226 p->con_rotate = rotate; ··· 254 235 { 255 236 struct fbcon_ops *ops = info->fbcon_par; 256 237 struct vc_data *vc; 257 - struct display *p; 238 + struct fbcon_display *p; 258 239 int i; 259 240 260 241 if (!ops || ops->currcon < 0 || rotate > 3) ··· 919 900 * Low Level Operations 920 901 */ 921 902 /* NOTE: fbcon cannot be __init: it may be called from do_take_over_console later */ 922 - static int var_to_display(struct display *disp, 903 + static int var_to_display(struct fbcon_display *disp, 923 904 struct fb_var_screeninfo *var, 924 905 struct fb_info *info) 925 906 { ··· 944 925 } 945 926 946 927 static void display_to_var(struct fb_var_screeninfo *var, 947 - struct display *disp) 928 + struct fbcon_display *disp) 948 929 { 949 930 fb_videomode_to_var(var, disp->mode); 950 931 var->xres_virtual = disp->xres_virtual; ··· 965 946 static const char *fbcon_startup(void) 966 947 { 967 948 const char *display_desc = "frame buffer device"; 968 - struct display *p = &fb_display[fg_console]; 949 + struct fbcon_display *p = &fb_display[fg_console]; 969 950 struct vc_data *vc = vc_cons[fg_console].d; 970 951 const struct font_desc *font = NULL; 971 952 struct module *owner; ··· 1069 1050 info->var.bits_per_pixel); 1070 1051 1071 1052 fbcon_add_cursor_timer(info); 1072 - fbcon_has_exited = 0; 1073 1053 return display_desc; 1074 1054 } 1075 1055 1076 1056 static void fbcon_init(struct vc_data *vc, int init) 1077 1057 { 1078 - struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 1058 + struct fb_info *info; 1079 1059 struct fbcon_ops *ops; 1080 1060 struct vc_data **default_mode = vc->vc_display_fg; 1081 1061 struct vc_data *svc = *default_mode; 1082 - struct display *t, *p = &fb_display[vc->vc_num]; 1062 + struct fbcon_display *t, *p = &fb_display[vc->vc_num]; 1083 1063 int logo = 1, new_rows, new_cols, rows, cols, charcnt = 256; 1084 1064 int cap, ret; 1085 1065 1086 - if (info_idx == -1 || info == NULL) 1066 + if (WARN_ON(info_idx == -1)) 1087 1067 return; 1088 1068 1069 + if (con2fb_map[vc->vc_num] == -1) 1070 + con2fb_map[vc->vc_num] = info_idx; 1071 + 1072 + info = registered_fb[con2fb_map[vc->vc_num]]; 1089 1073 cap = info->flags; 1090 1074 1091 1075 if (logo_shown < 0 && console_loglevel <= CONSOLE_LOGLEVEL_QUIET) ··· 1225 1203 ops->p = &fb_display[fg_console]; 1226 1204 } 1227 1205 1228 - static void fbcon_free_font(struct display *p, bool freefont) 1206 + static void fbcon_free_font(struct fbcon_display *p, bool freefont) 1229 1207 { 1230 1208 if (freefont && p->userfont && p->fontdata && (--REFCOUNT(p->fontdata) == 0)) 1231 1209 kfree(p->fontdata - FONT_EXTRA_WORDS * sizeof(int)); ··· 1237 1215 1238 1216 static void fbcon_deinit(struct vc_data *vc) 1239 1217 { 1240 - struct display *p = &fb_display[vc->vc_num]; 1218 + struct fbcon_display *p = &fb_display[vc->vc_num]; 1241 1219 struct fb_info *info; 1242 1220 struct fbcon_ops *ops; 1243 1221 int idx; ··· 1310 1288 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 1311 1289 struct fbcon_ops *ops = info->fbcon_par; 1312 1290 1313 - struct display *p = &fb_display[vc->vc_num]; 1291 + struct fbcon_display *p = &fb_display[vc->vc_num]; 1314 1292 u_int y_break; 1315 1293 1316 1294 if (fbcon_is_inactive(vc, info)) ··· 1346 1324 int count, int ypos, int xpos) 1347 1325 { 1348 1326 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 1349 - struct display *p = &fb_display[vc->vc_num]; 1327 + struct fbcon_display *p = &fb_display[vc->vc_num]; 1350 1328 struct fbcon_ops *ops = info->fbcon_par; 1351 1329 1352 1330 if (!fbcon_is_inactive(vc, info)) ··· 1410 1388 static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var, 1411 1389 int unit) 1412 1390 { 1413 - struct display *p, *t; 1391 + struct fbcon_display *p, *t; 1414 1392 struct vc_data **default_mode, *vc; 1415 1393 struct vc_data *svc; 1416 1394 struct fbcon_ops *ops = info->fbcon_par; ··· 1479 1457 { 1480 1458 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 1481 1459 struct fbcon_ops *ops = info->fbcon_par; 1482 - struct display *p = &fb_display[vc->vc_num]; 1460 + struct fbcon_display *p = &fb_display[vc->vc_num]; 1483 1461 1484 1462 p->yscroll += count; 1485 1463 if (p->yscroll >= p->vrows) /* Deal with wrap */ ··· 1498 1476 { 1499 1477 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 1500 1478 struct fbcon_ops *ops = info->fbcon_par; 1501 - struct display *p = &fb_display[vc->vc_num]; 1479 + struct fbcon_display *p = &fb_display[vc->vc_num]; 1502 1480 1503 1481 p->yscroll -= count; 1504 1482 if (p->yscroll < 0) /* Deal with wrap */ ··· 1516 1494 static __inline__ void ypan_up(struct vc_data *vc, int count) 1517 1495 { 1518 1496 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 1519 - struct display *p = &fb_display[vc->vc_num]; 1497 + struct fbcon_display *p = &fb_display[vc->vc_num]; 1520 1498 struct fbcon_ops *ops = info->fbcon_par; 1521 1499 1522 1500 p->yscroll += count; ··· 1541 1519 { 1542 1520 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 1543 1521 struct fbcon_ops *ops = info->fbcon_par; 1544 - struct display *p = &fb_display[vc->vc_num]; 1522 + struct fbcon_display *p = &fb_display[vc->vc_num]; 1545 1523 1546 1524 p->yscroll += count; 1547 1525 ··· 1564 1542 static __inline__ void ypan_down(struct vc_data *vc, int count) 1565 1543 { 1566 1544 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 1567 - struct display *p = &fb_display[vc->vc_num]; 1545 + struct fbcon_display *p = &fb_display[vc->vc_num]; 1568 1546 struct fbcon_ops *ops = info->fbcon_par; 1569 1547 1570 1548 p->yscroll -= count; ··· 1589 1567 { 1590 1568 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 1591 1569 struct fbcon_ops *ops = info->fbcon_par; 1592 - struct display *p = &fb_display[vc->vc_num]; 1570 + struct fbcon_display *p = &fb_display[vc->vc_num]; 1593 1571 1594 1572 p->yscroll -= count; 1595 1573 ··· 1609 1587 scrollback_current = 0; 1610 1588 } 1611 1589 1612 - static void fbcon_redraw_softback(struct vc_data *vc, struct display *p, 1590 + static void fbcon_redraw_softback(struct vc_data *vc, struct fbcon_display *p, 1613 1591 long delta) 1614 1592 { 1615 1593 int count = vc->vc_rows; ··· 1702 1680 } 1703 1681 } 1704 1682 1705 - static void fbcon_redraw_move(struct vc_data *vc, struct display *p, 1683 + static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, 1706 1684 int line, int count, int dy) 1707 1685 { 1708 1686 unsigned short *s = (unsigned short *) ··· 1737 1715 } 1738 1716 1739 1717 static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, 1740 - struct display *p, int line, int count, int ycount) 1718 + struct fbcon_display *p, int line, int count, int ycount) 1741 1719 { 1742 1720 int offset = ycount * vc->vc_cols; 1743 1721 unsigned short *d = (unsigned short *) ··· 1786 1764 } 1787 1765 } 1788 1766 1789 - static void fbcon_redraw(struct vc_data *vc, struct display *p, 1767 + static void fbcon_redraw(struct vc_data *vc, struct fbcon_display *p, 1790 1768 int line, int count, int offset) 1791 1769 { 1792 1770 unsigned short *d = (unsigned short *) ··· 1870 1848 enum con_scroll dir, unsigned int count) 1871 1849 { 1872 1850 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 1873 - struct display *p = &fb_display[vc->vc_num]; 1851 + struct fbcon_display *p = &fb_display[vc->vc_num]; 1874 1852 int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK; 1875 1853 1876 1854 if (fbcon_is_inactive(vc, info)) ··· 2074 2052 int height, int width) 2075 2053 { 2076 2054 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 2077 - struct display *p = &fb_display[vc->vc_num]; 2055 + struct fbcon_display *p = &fb_display[vc->vc_num]; 2078 2056 2079 2057 if (fbcon_is_inactive(vc, info)) 2080 2058 return; ··· 2093 2071 p->vrows - p->yscroll); 2094 2072 } 2095 2073 2096 - static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int sx, 2074 + static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx, 2097 2075 int dy, int dx, int height, int width, u_int y_break) 2098 2076 { 2099 2077 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; ··· 2135 2113 height, width); 2136 2114 } 2137 2115 2138 - static void updatescrollmode(struct display *p, 2116 + static void updatescrollmode(struct fbcon_display *p, 2139 2117 struct fb_info *info, 2140 2118 struct vc_data *vc) 2141 2119 { ··· 2187 2165 { 2188 2166 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 2189 2167 struct fbcon_ops *ops = info->fbcon_par; 2190 - struct display *p = &fb_display[vc->vc_num]; 2168 + struct fbcon_display *p = &fb_display[vc->vc_num]; 2191 2169 struct fb_var_screeninfo var = info->var; 2192 2170 int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh; 2193 2171 ··· 2232 2210 { 2233 2211 struct fb_info *info, *old_info = NULL; 2234 2212 struct fbcon_ops *ops; 2235 - struct display *p = &fb_display[vc->vc_num]; 2213 + struct fbcon_display *p = &fb_display[vc->vc_num]; 2236 2214 struct fb_var_screeninfo var; 2237 2215 int i, ret, prev_console, charcnt = 256; 2238 2216 ··· 2370 2348 static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, 2371 2349 int blank) 2372 2350 { 2373 - struct fb_event event; 2374 - 2375 2351 if (blank) { 2376 2352 unsigned short charmask = vc->vc_hi_font_mask ? 2377 2353 0x1ff : 0xff; ··· 2380 2360 fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols); 2381 2361 vc->vc_video_erase_char = oldc; 2382 2362 } 2383 - 2384 - 2385 - if (!lock_fb_info(info)) 2386 - return; 2387 - event.info = info; 2388 - event.data = &blank; 2389 - fb_notifier_call_chain(FB_EVENT_CONBLANK, &event); 2390 - unlock_fb_info(info); 2391 2363 } 2392 2364 2393 2365 static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) ··· 2406 2394 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); 2407 2395 ops->cursor_flash = (!blank); 2408 2396 2409 - if (!(info->flags & FBINFO_MISC_USEREVENT)) 2410 - if (fb_blank(info, blank)) 2411 - fbcon_generic_blank(vc, info, blank); 2397 + if (fb_blank(info, blank)) 2398 + fbcon_generic_blank(vc, info, blank); 2412 2399 } 2413 2400 2414 2401 if (!blank) ··· 2564 2553 { 2565 2554 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 2566 2555 struct fbcon_ops *ops = info->fbcon_par; 2567 - struct display *p = &fb_display[vc->vc_num]; 2556 + struct fbcon_display *p = &fb_display[vc->vc_num]; 2568 2557 int resize; 2569 2558 int cnt; 2570 2559 char *old_data = NULL; ··· 2612 2601 2613 2602 static int fbcon_copy_font(struct vc_data *vc, int con) 2614 2603 { 2615 - struct display *od = &fb_display[con]; 2604 + struct fbcon_display *od = &fb_display[con]; 2616 2605 struct console_font *f = &vc->vc_font; 2617 2606 2618 2607 if (od->fontdata == f->data) ··· 2837 2826 { 2838 2827 struct fb_info *info = registered_fb[con2fb_map[fg_console]]; 2839 2828 struct fbcon_ops *ops = info->fbcon_par; 2840 - struct display *disp = &fb_display[fg_console]; 2829 + struct fbcon_display *disp = &fb_display[fg_console]; 2841 2830 int offset, limit, scrollback_old; 2842 2831 2843 2832 if (softback_top) { ··· 2929 2918 return 0; 2930 2919 } 2931 2920 2932 - static void fbcon_suspended(struct fb_info *info) 2921 + void fbcon_suspended(struct fb_info *info) 2933 2922 { 2934 2923 struct vc_data *vc = NULL; 2935 2924 struct fbcon_ops *ops = info->fbcon_par; ··· 2942 2931 fbcon_cursor(vc, CM_ERASE); 2943 2932 } 2944 2933 2945 - static void fbcon_resumed(struct fb_info *info) 2934 + void fbcon_resumed(struct fb_info *info) 2946 2935 { 2947 2936 struct vc_data *vc; 2948 2937 struct fbcon_ops *ops = info->fbcon_par; ··· 2958 2947 { 2959 2948 struct fbcon_ops *ops = info->fbcon_par; 2960 2949 struct vc_data *vc; 2961 - struct display *p; 2950 + struct fbcon_display *p; 2962 2951 int rows, cols; 2963 2952 2964 2953 if (!ops || ops->currcon < 0) ··· 2998 2987 { 2999 2988 struct fbcon_ops *ops = info->fbcon_par; 3000 2989 struct vc_data *vc; 3001 - struct display *p; 2990 + struct fbcon_display *p; 3002 2991 int i, rows, cols, fg = -1; 3003 2992 3004 2993 if (!ops || ops->currcon < 0) ··· 3029 3018 fbcon_modechanged(info); 3030 3019 } 3031 3020 3032 - static int fbcon_mode_deleted(struct fb_info *info, 3033 - struct fb_videomode *mode) 3021 + 3022 + void fbcon_update_vcs(struct fb_info *info, bool all) 3023 + { 3024 + if (all) 3025 + fbcon_set_all_vcs(info); 3026 + else 3027 + fbcon_modechanged(info); 3028 + } 3029 + EXPORT_SYMBOL(fbcon_update_vcs); 3030 + 3031 + int fbcon_mode_deleted(struct fb_info *info, 3032 + struct fb_videomode *mode) 3034 3033 { 3035 3034 struct fb_info *fb_info; 3036 - struct display *p; 3035 + struct fbcon_display *p; 3037 3036 int i, j, found = 0; 3038 3037 3039 3038 /* before deletion, ensure that mode is not in use */ ··· 3066 3045 } 3067 3046 3068 3047 #ifdef CONFIG_VT_HW_CONSOLE_BINDING 3069 - static int fbcon_unbind(void) 3048 + static void fbcon_unbind(void) 3070 3049 { 3071 3050 int ret; 3072 3051 ··· 3075 3054 3076 3055 if (!ret) 3077 3056 fbcon_has_console_bind = 0; 3078 - 3079 - return ret; 3080 3057 } 3081 3058 #else 3082 - static inline int fbcon_unbind(void) 3083 - { 3084 - return -EINVAL; 3085 - } 3059 + static inline void fbcon_unbind(void) {} 3086 3060 #endif /* CONFIG_VT_HW_CONSOLE_BINDING */ 3087 3061 3088 3062 /* called with console_lock held */ 3089 - static int fbcon_fb_unbind(int idx) 3063 + void fbcon_fb_unbind(struct fb_info *info) 3090 3064 { 3091 3065 int i, new_idx = -1, ret = 0; 3066 + int idx = info->node; 3092 3067 3093 3068 WARN_CONSOLE_UNLOCKED(); 3094 3069 3095 3070 if (!fbcon_has_console_bind) 3096 - return 0; 3071 + return; 3097 3072 3098 3073 for (i = first_fb_vc; i <= last_fb_vc; i++) { 3099 3074 if (con2fb_map[i] != idx && ··· 3122 3105 idx, 0); 3123 3106 if (ret) { 3124 3107 con2fb_map[i] = idx; 3125 - return ret; 3108 + return; 3126 3109 } 3127 3110 } 3128 3111 } 3129 3112 } 3130 - ret = fbcon_unbind(); 3113 + fbcon_unbind(); 3131 3114 } 3132 - 3133 - return ret; 3134 3115 } 3135 3116 3136 3117 /* called with console_lock held */ 3137 - static int fbcon_fb_unregistered(struct fb_info *info) 3118 + void fbcon_fb_unregistered(struct fb_info *info) 3138 3119 { 3139 3120 int i, idx; 3140 3121 3141 3122 WARN_CONSOLE_UNLOCKED(); 3142 3123 3143 3124 if (deferred_takeover) 3144 - return 0; 3125 + return; 3145 3126 3146 3127 idx = info->node; 3147 3128 for (i = first_fb_vc; i <= last_fb_vc; i++) { ··· 3168 3153 3169 3154 if (!num_registered_fb) 3170 3155 do_unregister_con_driver(&fb_con); 3171 - 3172 - return 0; 3173 3156 } 3174 3157 3175 - /* called with console_lock held */ 3176 - static void fbcon_remap_all(int idx) 3158 + void fbcon_remap_all(struct fb_info *info) 3177 3159 { 3178 - int i; 3160 + int i, idx = info->node; 3179 3161 3180 - WARN_CONSOLE_UNLOCKED(); 3181 - 3162 + console_lock(); 3182 3163 if (deferred_takeover) { 3183 3164 for (i = first_fb_vc; i <= last_fb_vc; i++) 3184 3165 con2fb_map_boot[i] = idx; 3185 3166 fbcon_map_override(); 3167 + console_unlock(); 3186 3168 return; 3187 3169 } 3188 3170 ··· 3192 3180 first_fb_vc + 1, last_fb_vc + 1); 3193 3181 info_idx = idx; 3194 3182 } 3183 + console_unlock(); 3195 3184 } 3196 3185 3197 3186 #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY ··· 3226 3213 #endif /* CONFIG_FRAMEBUFFER_DETECT_PRIMARY */ 3227 3214 3228 3215 /* called with console_lock held */ 3229 - static int fbcon_fb_registered(struct fb_info *info) 3216 + int fbcon_fb_registered(struct fb_info *info) 3230 3217 { 3231 3218 int ret = 0, i, idx; 3232 3219 ··· 3260 3247 return ret; 3261 3248 } 3262 3249 3263 - static void fbcon_fb_blanked(struct fb_info *info, int blank) 3250 + void fbcon_fb_blanked(struct fb_info *info, int blank) 3264 3251 { 3265 3252 struct fbcon_ops *ops = info->fbcon_par; 3266 3253 struct vc_data *vc; ··· 3282 3269 ops->blank_state = blank; 3283 3270 } 3284 3271 3285 - static void fbcon_new_modelist(struct fb_info *info) 3272 + void fbcon_new_modelist(struct fb_info *info) 3286 3273 { 3287 3274 int i; 3288 3275 struct vc_data *vc; ··· 3303 3290 } 3304 3291 } 3305 3292 3306 - static void fbcon_get_requirement(struct fb_info *info, 3307 - struct fb_blit_caps *caps) 3293 + void fbcon_get_requirement(struct fb_info *info, 3294 + struct fb_blit_caps *caps) 3308 3295 { 3309 3296 struct vc_data *vc; 3310 - struct display *p; 3297 + struct fbcon_display *p; 3311 3298 3312 3299 if (caps->flags) { 3313 3300 int i, charcnt; ··· 3339 3326 } 3340 3327 } 3341 3328 3342 - static int fbcon_event_notify(struct notifier_block *self, 3343 - unsigned long action, void *data) 3329 + int fbcon_set_con2fb_map_ioctl(void __user *argp) 3344 3330 { 3345 - struct fb_event *event = data; 3346 - struct fb_info *info = event->info; 3347 - struct fb_videomode *mode; 3348 - struct fb_con2fbmap *con2fb; 3349 - struct fb_blit_caps *caps; 3350 - int idx, ret = 0; 3331 + struct fb_con2fbmap con2fb; 3332 + int ret; 3351 3333 3352 - /* 3353 - * ignore all events except driver registration and deregistration 3354 - * if fbcon is not active 3355 - */ 3356 - if (fbcon_has_exited && !(action == FB_EVENT_FB_REGISTERED || 3357 - action == FB_EVENT_FB_UNREGISTERED)) 3358 - goto done; 3359 - 3360 - switch(action) { 3361 - case FB_EVENT_SUSPEND: 3362 - fbcon_suspended(info); 3363 - break; 3364 - case FB_EVENT_RESUME: 3365 - fbcon_resumed(info); 3366 - break; 3367 - case FB_EVENT_MODE_CHANGE: 3368 - fbcon_modechanged(info); 3369 - break; 3370 - case FB_EVENT_MODE_CHANGE_ALL: 3371 - fbcon_set_all_vcs(info); 3372 - break; 3373 - case FB_EVENT_MODE_DELETE: 3374 - mode = event->data; 3375 - ret = fbcon_mode_deleted(info, mode); 3376 - break; 3377 - case FB_EVENT_FB_UNBIND: 3378 - idx = info->node; 3379 - ret = fbcon_fb_unbind(idx); 3380 - break; 3381 - case FB_EVENT_FB_REGISTERED: 3382 - ret = fbcon_fb_registered(info); 3383 - break; 3384 - case FB_EVENT_FB_UNREGISTERED: 3385 - ret = fbcon_fb_unregistered(info); 3386 - break; 3387 - case FB_EVENT_SET_CONSOLE_MAP: 3388 - /* called with console lock held */ 3389 - con2fb = event->data; 3390 - ret = set_con2fb_map(con2fb->console - 1, 3391 - con2fb->framebuffer, 1); 3392 - break; 3393 - case FB_EVENT_GET_CONSOLE_MAP: 3394 - con2fb = event->data; 3395 - con2fb->framebuffer = con2fb_map[con2fb->console - 1]; 3396 - break; 3397 - case FB_EVENT_BLANK: 3398 - fbcon_fb_blanked(info, *(int *)event->data); 3399 - break; 3400 - case FB_EVENT_NEW_MODELIST: 3401 - fbcon_new_modelist(info); 3402 - break; 3403 - case FB_EVENT_GET_REQ: 3404 - caps = event->data; 3405 - fbcon_get_requirement(info, caps); 3406 - break; 3407 - case FB_EVENT_REMAP_ALL_CONSOLE: 3408 - idx = info->node; 3409 - fbcon_remap_all(idx); 3410 - break; 3334 + if (copy_from_user(&con2fb, argp, sizeof(con2fb))) 3335 + return -EFAULT; 3336 + if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) 3337 + return -EINVAL; 3338 + if (con2fb.framebuffer >= FB_MAX) 3339 + return -EINVAL; 3340 + if (!registered_fb[con2fb.framebuffer]) 3341 + request_module("fb%d", con2fb.framebuffer); 3342 + if (!registered_fb[con2fb.framebuffer]) { 3343 + return -EINVAL; 3411 3344 } 3412 - done: 3345 + 3346 + console_lock(); 3347 + ret = set_con2fb_map(con2fb.console - 1, 3348 + con2fb.framebuffer, 1); 3349 + console_unlock(); 3350 + 3413 3351 return ret; 3352 + } 3353 + 3354 + int fbcon_get_con2fb_map_ioctl(void __user *argp) 3355 + { 3356 + struct fb_con2fbmap con2fb; 3357 + 3358 + if (copy_from_user(&con2fb, argp, sizeof(con2fb))) 3359 + return -EFAULT; 3360 + if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) 3361 + return -EINVAL; 3362 + 3363 + console_lock(); 3364 + con2fb.framebuffer = con2fb_map[con2fb.console - 1]; 3365 + console_unlock(); 3366 + 3367 + return copy_to_user(argp, &con2fb, sizeof(con2fb)) ? -EFAULT : 0; 3414 3368 } 3415 3369 3416 3370 /* ··· 3411 3431 .con_debug_leave = fbcon_debug_leave, 3412 3432 }; 3413 3433 3414 - static struct notifier_block fbcon_event_notifier = { 3415 - .notifier_call = fbcon_event_notify, 3416 - }; 3417 - 3418 3434 static ssize_t store_rotate(struct device *device, 3419 3435 struct device_attribute *attr, const char *buf, 3420 3436 size_t count) ··· 3418 3442 struct fb_info *info; 3419 3443 int rotate, idx; 3420 3444 char **last = NULL; 3421 - 3422 - if (fbcon_has_exited) 3423 - return count; 3424 3445 3425 3446 console_lock(); 3426 3447 idx = con2fb_map[fg_console]; ··· 3441 3468 int rotate, idx; 3442 3469 char **last = NULL; 3443 3470 3444 - if (fbcon_has_exited) 3445 - return count; 3446 - 3447 3471 console_lock(); 3448 3472 idx = con2fb_map[fg_console]; 3449 3473 ··· 3461 3491 struct fb_info *info; 3462 3492 int rotate = 0, idx; 3463 3493 3464 - if (fbcon_has_exited) 3465 - return 0; 3466 - 3467 3494 console_lock(); 3468 3495 idx = con2fb_map[fg_console]; 3469 3496 ··· 3480 3513 struct fb_info *info; 3481 3514 struct fbcon_ops *ops; 3482 3515 int idx, blink = -1; 3483 - 3484 - if (fbcon_has_exited) 3485 - return 0; 3486 3516 3487 3517 console_lock(); 3488 3518 idx = con2fb_map[fg_console]; ··· 3506 3542 struct fb_info *info; 3507 3543 int blink, idx; 3508 3544 char **last = NULL; 3509 - 3510 - if (fbcon_has_exited) 3511 - return count; 3512 3545 3513 3546 console_lock(); 3514 3547 idx = con2fb_map[fg_console]; ··· 3629 3668 struct fb_info *info; 3630 3669 int i, j, mapped; 3631 3670 3632 - if (fbcon_has_exited) 3633 - return; 3634 - 3635 3671 #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER 3636 3672 if (deferred_takeover) { 3637 3673 dummycon_unregister_output_notifier(&fbcon_output_nb); ··· 3653 3695 for (j = first_fb_vc; j <= last_fb_vc; j++) { 3654 3696 if (con2fb_map[j] == i) { 3655 3697 mapped = 1; 3656 - break; 3698 + con2fb_map[j] = -1; 3657 3699 } 3658 3700 } 3659 3701 ··· 3676 3718 info->queue.func = NULL; 3677 3719 } 3678 3720 } 3679 - 3680 - fbcon_has_exited = 1; 3681 3721 } 3682 3722 3683 3723 void __init fb_console_init(void) ··· 3683 3727 int i; 3684 3728 3685 3729 console_lock(); 3686 - fb_register_client(&fbcon_event_notifier); 3687 3730 fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), NULL, 3688 3731 "fbcon"); 3689 3732 ··· 3718 3763 void __exit fb_console_exit(void) 3719 3764 { 3720 3765 console_lock(); 3721 - fb_unregister_client(&fbcon_event_notifier); 3722 3766 fbcon_deinit_device(); 3723 3767 device_destroy(fb_class, MKDEV(0, 0)); 3724 3768 fbcon_exit();
+3 -3
drivers/video/fbdev/core/fbcon.h
··· 25 25 * low-level frame buffer device 26 26 */ 27 27 28 - struct display { 28 + struct fbcon_display { 29 29 /* Filled in by the low-level console driver */ 30 30 const u_char *fontdata; 31 31 int userfont; /* != 0 if fontdata kmalloc()ed */ ··· 68 68 struct fb_var_screeninfo var; /* copy of the current fb_var_screeninfo */ 69 69 struct timer_list cursor_timer; /* Cursor timer */ 70 70 struct fb_cursor cursor_state; 71 - struct display *p; 71 + struct fbcon_display *p; 72 72 struct fb_info *info; 73 73 int currcon; /* Current VC. */ 74 74 int cur_blink_jiffies; ··· 225 225 #define FBCON_ATTRIBUTE_REVERSE 2 226 226 #define FBCON_ATTRIBUTE_BOLD 4 227 227 228 - static inline int real_y(struct display *p, int ypos) 228 + static inline int real_y(struct fbcon_display *p, int ypos) 229 229 { 230 230 int rows = p->vrows; 231 231
+149 -258
drivers/video/fbdev/core/fbmem.c
··· 80 80 fb_info->fbops->fb_destroy(fb_info); 81 81 } 82 82 83 - int lock_fb_info(struct fb_info *info) 84 - { 85 - mutex_lock(&info->lock); 86 - if (!info->fbops) { 87 - mutex_unlock(&info->lock); 88 - return 0; 89 - } 90 - return 1; 91 - } 92 - EXPORT_SYMBOL(lock_fb_info); 93 - 94 83 /* 95 84 * Helpers 96 85 */ ··· 932 943 static int fb_check_caps(struct fb_info *info, struct fb_var_screeninfo *var, 933 944 u32 activate) 934 945 { 935 - struct fb_event event; 936 946 struct fb_blit_caps caps, fbcaps; 937 947 int err = 0; 938 948 939 949 memset(&caps, 0, sizeof(caps)); 940 950 memset(&fbcaps, 0, sizeof(fbcaps)); 941 951 caps.flags = (activate & FB_ACTIVATE_ALL) ? 1 : 0; 942 - event.info = info; 943 - event.data = &caps; 944 - fb_notifier_call_chain(FB_EVENT_GET_REQ, &event); 952 + fbcon_get_requirement(info, &caps); 945 953 info->fbops->fb_get_caps(info, &fbcaps, var); 946 954 947 955 if (((fbcaps.x ^ caps.x) & caps.x) || ··· 954 968 { 955 969 int flags = info->flags; 956 970 int ret = 0; 971 + u32 activate; 972 + struct fb_var_screeninfo old_var; 973 + struct fb_videomode mode; 974 + struct fb_event event; 957 975 958 976 if (var->activate & FB_ACTIVATE_INV_MODE) { 959 977 struct fb_videomode mode1, mode2; ··· 967 977 /* make sure we don't delete the videomode of current var */ 968 978 ret = fb_mode_is_equal(&mode1, &mode2); 969 979 970 - if (!ret) { 971 - struct fb_event event; 972 - 973 - event.info = info; 974 - event.data = &mode1; 975 - ret = fb_notifier_call_chain(FB_EVENT_MODE_DELETE, &event); 976 - } 980 + if (!ret) 981 + fbcon_mode_deleted(info, &mode1); 977 982 978 983 if (!ret) 979 - fb_delete_videomode(&mode1, &info->modelist); 984 + fb_delete_videomode(&mode1, &info->modelist); 980 985 981 986 982 - ret = (ret) ? -EINVAL : 0; 983 - goto done; 987 + return ret ? -EINVAL : 0; 984 988 } 985 989 986 - if ((var->activate & FB_ACTIVATE_FORCE) || 987 - memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) { 988 - u32 activate = var->activate; 990 + if (!(var->activate & FB_ACTIVATE_FORCE) && 991 + !memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) 992 + return 0; 989 993 990 - /* When using FOURCC mode, make sure the red, green, blue and 991 - * transp fields are set to 0. 992 - */ 993 - if ((info->fix.capabilities & FB_CAP_FOURCC) && 994 - var->grayscale > 1) { 995 - if (var->red.offset || var->green.offset || 996 - var->blue.offset || var->transp.offset || 997 - var->red.length || var->green.length || 998 - var->blue.length || var->transp.length || 999 - var->red.msb_right || var->green.msb_right || 1000 - var->blue.msb_right || var->transp.msb_right) 1001 - return -EINVAL; 1002 - } 994 + activate = var->activate; 1003 995 1004 - if (!info->fbops->fb_check_var) { 1005 - *var = info->var; 1006 - goto done; 1007 - } 996 + /* When using FOURCC mode, make sure the red, green, blue and 997 + * transp fields are set to 0. 998 + */ 999 + if ((info->fix.capabilities & FB_CAP_FOURCC) && 1000 + var->grayscale > 1) { 1001 + if (var->red.offset || var->green.offset || 1002 + var->blue.offset || var->transp.offset || 1003 + var->red.length || var->green.length || 1004 + var->blue.length || var->transp.length || 1005 + var->red.msb_right || var->green.msb_right || 1006 + var->blue.msb_right || var->transp.msb_right) 1007 + return -EINVAL; 1008 + } 1008 1009 1009 - ret = info->fbops->fb_check_var(var, info); 1010 + if (!info->fbops->fb_check_var) { 1011 + *var = info->var; 1012 + return 0; 1013 + } 1014 + 1015 + ret = info->fbops->fb_check_var(var, info); 1016 + 1017 + if (ret) 1018 + return ret; 1019 + 1020 + if ((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NOW) 1021 + return 0; 1022 + 1023 + if (info->fbops->fb_get_caps) { 1024 + ret = fb_check_caps(info, var, activate); 1010 1025 1011 1026 if (ret) 1012 - goto done; 1027 + return ret; 1028 + } 1013 1029 1014 - if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) { 1015 - struct fb_var_screeninfo old_var; 1016 - struct fb_videomode mode; 1030 + old_var = info->var; 1031 + info->var = *var; 1017 1032 1018 - if (info->fbops->fb_get_caps) { 1019 - ret = fb_check_caps(info, var, activate); 1033 + if (info->fbops->fb_set_par) { 1034 + ret = info->fbops->fb_set_par(info); 1020 1035 1021 - if (ret) 1022 - goto done; 1023 - } 1024 - 1025 - old_var = info->var; 1026 - info->var = *var; 1027 - 1028 - if (info->fbops->fb_set_par) { 1029 - ret = info->fbops->fb_set_par(info); 1030 - 1031 - if (ret) { 1032 - info->var = old_var; 1033 - printk(KERN_WARNING "detected " 1034 - "fb_set_par error, " 1035 - "error code: %d\n", ret); 1036 - goto done; 1037 - } 1038 - } 1039 - 1040 - fb_pan_display(info, &info->var); 1041 - fb_set_cmap(&info->cmap, info); 1042 - fb_var_to_videomode(&mode, &info->var); 1043 - 1044 - if (info->modelist.prev && info->modelist.next && 1045 - !list_empty(&info->modelist)) 1046 - ret = fb_add_videomode(&mode, &info->modelist); 1047 - 1048 - if (!ret && (flags & FBINFO_MISC_USEREVENT)) { 1049 - struct fb_event event; 1050 - int evnt = (activate & FB_ACTIVATE_ALL) ? 1051 - FB_EVENT_MODE_CHANGE_ALL : 1052 - FB_EVENT_MODE_CHANGE; 1053 - 1054 - info->flags &= ~FBINFO_MISC_USEREVENT; 1055 - event.info = info; 1056 - event.data = &mode; 1057 - fb_notifier_call_chain(evnt, &event); 1058 - } 1036 + if (ret) { 1037 + info->var = old_var; 1038 + printk(KERN_WARNING "detected " 1039 + "fb_set_par error, " 1040 + "error code: %d\n", ret); 1041 + return ret; 1059 1042 } 1060 1043 } 1061 1044 1062 - done: 1063 - return ret; 1045 + fb_pan_display(info, &info->var); 1046 + fb_set_cmap(&info->cmap, info); 1047 + fb_var_to_videomode(&mode, &info->var); 1048 + 1049 + if (info->modelist.prev && info->modelist.next && 1050 + !list_empty(&info->modelist)) 1051 + ret = fb_add_videomode(&mode, &info->modelist); 1052 + 1053 + if (ret) 1054 + return ret; 1055 + 1056 + event.info = info; 1057 + event.data = &mode; 1058 + fb_notifier_call_chain(FB_EVENT_MODE_CHANGE, &event); 1059 + 1060 + if (flags & FBINFO_MISC_USEREVENT) 1061 + fbcon_update_vcs(info, activate & FB_ACTIVATE_ALL); 1062 + 1063 + return 0; 1064 1064 } 1065 1065 EXPORT_SYMBOL(fb_set_var); 1066 1066 ··· 1092 1112 struct fb_ops *fb; 1093 1113 struct fb_var_screeninfo var; 1094 1114 struct fb_fix_screeninfo fix; 1095 - struct fb_con2fbmap con2fb; 1096 1115 struct fb_cmap cmap_from; 1097 1116 struct fb_cmap_user cmap; 1098 - struct fb_event event; 1099 1117 void __user *argp = (void __user *)arg; 1100 1118 long ret = 0; 1101 1119 1102 1120 switch (cmd) { 1103 1121 case FBIOGET_VSCREENINFO: 1104 - if (!lock_fb_info(info)) 1105 - return -ENODEV; 1122 + lock_fb_info(info); 1106 1123 var = info->var; 1107 1124 unlock_fb_info(info); 1108 1125 ··· 1109 1132 if (copy_from_user(&var, argp, sizeof(var))) 1110 1133 return -EFAULT; 1111 1134 console_lock(); 1112 - if (!lock_fb_info(info)) { 1113 - console_unlock(); 1114 - return -ENODEV; 1115 - } 1135 + lock_fb_info(info); 1116 1136 info->flags |= FBINFO_MISC_USEREVENT; 1117 1137 ret = fb_set_var(info, &var); 1118 1138 info->flags &= ~FBINFO_MISC_USEREVENT; ··· 1119 1145 ret = -EFAULT; 1120 1146 break; 1121 1147 case FBIOGET_FSCREENINFO: 1122 - if (!lock_fb_info(info)) 1123 - return -ENODEV; 1148 + lock_fb_info(info); 1124 1149 fix = info->fix; 1125 1150 if (info->flags & FBINFO_HIDE_SMEM_START) 1126 1151 fix.smem_start = 0; ··· 1135 1162 case FBIOGETCMAP: 1136 1163 if (copy_from_user(&cmap, argp, sizeof(cmap))) 1137 1164 return -EFAULT; 1138 - if (!lock_fb_info(info)) 1139 - return -ENODEV; 1165 + lock_fb_info(info); 1140 1166 cmap_from = info->cmap; 1141 1167 unlock_fb_info(info); 1142 1168 ret = fb_cmap_to_user(&cmap_from, &cmap); ··· 1144 1172 if (copy_from_user(&var, argp, sizeof(var))) 1145 1173 return -EFAULT; 1146 1174 console_lock(); 1147 - if (!lock_fb_info(info)) { 1148 - console_unlock(); 1149 - return -ENODEV; 1150 - } 1175 + lock_fb_info(info); 1151 1176 ret = fb_pan_display(info, &var); 1152 1177 unlock_fb_info(info); 1153 1178 console_unlock(); ··· 1155 1186 ret = -EINVAL; 1156 1187 break; 1157 1188 case FBIOGET_CON2FBMAP: 1158 - if (copy_from_user(&con2fb, argp, sizeof(con2fb))) 1159 - return -EFAULT; 1160 - if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) 1161 - return -EINVAL; 1162 - con2fb.framebuffer = -1; 1163 - event.data = &con2fb; 1164 - if (!lock_fb_info(info)) 1165 - return -ENODEV; 1166 - event.info = info; 1167 - fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP, &event); 1168 - unlock_fb_info(info); 1169 - ret = copy_to_user(argp, &con2fb, sizeof(con2fb)) ? -EFAULT : 0; 1189 + ret = fbcon_get_con2fb_map_ioctl(argp); 1170 1190 break; 1171 1191 case FBIOPUT_CON2FBMAP: 1172 - if (copy_from_user(&con2fb, argp, sizeof(con2fb))) 1173 - return -EFAULT; 1174 - if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) 1175 - return -EINVAL; 1176 - if (con2fb.framebuffer >= FB_MAX) 1177 - return -EINVAL; 1178 - if (!registered_fb[con2fb.framebuffer]) 1179 - request_module("fb%d", con2fb.framebuffer); 1180 - if (!registered_fb[con2fb.framebuffer]) { 1181 - ret = -EINVAL; 1182 - break; 1183 - } 1184 - event.data = &con2fb; 1185 - console_lock(); 1186 - if (!lock_fb_info(info)) { 1187 - console_unlock(); 1188 - return -ENODEV; 1189 - } 1190 - event.info = info; 1191 - ret = fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP, &event); 1192 - unlock_fb_info(info); 1193 - console_unlock(); 1192 + ret = fbcon_set_con2fb_map_ioctl(argp); 1194 1193 break; 1195 1194 case FBIOBLANK: 1196 1195 console_lock(); 1197 - if (!lock_fb_info(info)) { 1198 - console_unlock(); 1199 - return -ENODEV; 1200 - } 1201 - info->flags |= FBINFO_MISC_USEREVENT; 1196 + lock_fb_info(info); 1202 1197 ret = fb_blank(info, arg); 1203 - info->flags &= ~FBINFO_MISC_USEREVENT; 1198 + /* might again call into fb_blank */ 1199 + fbcon_fb_blanked(info, arg); 1204 1200 unlock_fb_info(info); 1205 1201 console_unlock(); 1206 1202 break; 1207 1203 default: 1208 - if (!lock_fb_info(info)) 1209 - return -ENODEV; 1204 + lock_fb_info(info); 1210 1205 fb = info->fbops; 1211 1206 if (fb->fb_ioctl) 1212 1207 ret = fb->fb_ioctl(info, cmd, arg); ··· 1290 1357 { 1291 1358 struct fb_fix_screeninfo fix; 1292 1359 1293 - if (!lock_fb_info(info)) 1294 - return -ENODEV; 1360 + lock_fb_info(info); 1295 1361 fix = info->fix; 1296 1362 if (info->flags & FBINFO_HIDE_SMEM_START) 1297 1363 fix.smem_start = 0; ··· 1350 1418 if (!info) 1351 1419 return -ENODEV; 1352 1420 fb = info->fbops; 1353 - if (!fb) 1354 - return -ENODEV; 1355 1421 mutex_lock(&info->mm_lock); 1356 1422 if (fb->fb_mmap) { 1357 1423 int res; ··· 1413 1483 if (IS_ERR(info)) 1414 1484 return PTR_ERR(info); 1415 1485 1416 - mutex_lock(&info->lock); 1486 + lock_fb_info(info); 1417 1487 if (!try_module_get(info->fbops->owner)) { 1418 1488 res = -ENODEV; 1419 1489 goto out; ··· 1429 1499 fb_deferred_io_open(info, inode, file); 1430 1500 #endif 1431 1501 out: 1432 - mutex_unlock(&info->lock); 1502 + unlock_fb_info(info); 1433 1503 if (res) 1434 1504 put_fb_info(info); 1435 1505 return res; ··· 1442 1512 { 1443 1513 struct fb_info * const info = file->private_data; 1444 1514 1445 - mutex_lock(&info->lock); 1515 + lock_fb_info(info); 1446 1516 if (info->fbops->fb_release) 1447 1517 info->fbops->fb_release(info,1); 1448 1518 module_put(info->fbops->owner); 1449 - mutex_unlock(&info->lock); 1519 + unlock_fb_info(info); 1450 1520 put_fb_info(info); 1451 1521 return 0; 1452 1522 } ··· 1551 1621 return false; 1552 1622 } 1553 1623 1554 - static int do_unregister_framebuffer(struct fb_info *fb_info); 1624 + static void do_unregister_framebuffer(struct fb_info *fb_info); 1555 1625 1556 1626 #define VGA_FB_PHYS 0xA0000 1557 - static int do_remove_conflicting_framebuffers(struct apertures_struct *a, 1558 - const char *name, bool primary) 1627 + static void do_remove_conflicting_framebuffers(struct apertures_struct *a, 1628 + const char *name, bool primary) 1559 1629 { 1560 - int i, ret; 1630 + int i; 1561 1631 1562 1632 /* check all firmware fbs and kick off if the base addr overlaps */ 1563 1633 for_each_registered_fb(i) { ··· 1573 1643 1574 1644 printk(KERN_INFO "fb%d: switching to %s from %s\n", 1575 1645 i, name, registered_fb[i]->fix.id); 1576 - ret = do_unregister_framebuffer(registered_fb[i]); 1577 - if (ret) 1578 - return ret; 1646 + do_unregister_framebuffer(registered_fb[i]); 1579 1647 } 1580 1648 } 1581 - 1582 - return 0; 1583 1649 } 1584 1650 1585 1651 static bool lockless_register_fb; ··· 1586 1660 static int do_register_framebuffer(struct fb_info *fb_info) 1587 1661 { 1588 1662 int i, ret; 1589 - struct fb_event event; 1590 1663 struct fb_videomode mode; 1591 1664 1592 1665 if (fb_check_foreignness(fb_info)) 1593 1666 return -ENOSYS; 1594 1667 1595 - ret = do_remove_conflicting_framebuffers(fb_info->apertures, 1596 - fb_info->fix.id, 1597 - fb_is_primary_device(fb_info)); 1598 - if (ret) 1599 - return ret; 1668 + do_remove_conflicting_framebuffers(fb_info->apertures, 1669 + fb_info->fix.id, 1670 + fb_is_primary_device(fb_info)); 1600 1671 1601 1672 if (num_registered_fb == FB_MAX) 1602 1673 return -ENXIO; ··· 1646 1723 fb_add_videomode(&mode, &fb_info->modelist); 1647 1724 registered_fb[i] = fb_info; 1648 1725 1649 - event.info = fb_info; 1726 + #ifdef CONFIG_GUMSTIX_AM200EPD 1727 + { 1728 + struct fb_event event; 1729 + event.info = fb_info; 1730 + fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event); 1731 + } 1732 + #endif 1733 + 1650 1734 if (!lockless_register_fb) 1651 1735 console_lock(); 1652 1736 else 1653 1737 atomic_inc(&ignore_console_lock_warning); 1654 - if (!lock_fb_info(fb_info)) { 1655 - ret = -ENODEV; 1656 - goto unlock_console; 1657 - } 1658 - ret = 0; 1659 - 1660 - fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event); 1738 + lock_fb_info(fb_info); 1739 + ret = fbcon_fb_registered(fb_info); 1661 1740 unlock_fb_info(fb_info); 1662 - unlock_console: 1741 + 1663 1742 if (!lockless_register_fb) 1664 1743 console_unlock(); 1665 1744 else ··· 1669 1744 return ret; 1670 1745 } 1671 1746 1672 - static int unbind_console(struct fb_info *fb_info) 1747 + static void unbind_console(struct fb_info *fb_info) 1673 1748 { 1674 - struct fb_event event; 1675 - int ret; 1676 1749 int i = fb_info->node; 1677 1750 1678 - if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info) 1679 - return -EINVAL; 1751 + if (WARN_ON(i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)) 1752 + return; 1680 1753 1681 1754 console_lock(); 1682 - if (!lock_fb_info(fb_info)) { 1683 - console_unlock(); 1684 - return -ENODEV; 1685 - } 1686 - 1687 - event.info = fb_info; 1688 - ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event); 1755 + lock_fb_info(fb_info); 1756 + fbcon_fb_unbind(fb_info); 1689 1757 unlock_fb_info(fb_info); 1690 1758 console_unlock(); 1691 - 1692 - return ret; 1693 1759 } 1694 1760 1695 - static int __unlink_framebuffer(struct fb_info *fb_info); 1696 - 1697 - static int do_unregister_framebuffer(struct fb_info *fb_info) 1761 + void unlink_framebuffer(struct fb_info *fb_info) 1698 1762 { 1699 - struct fb_event event; 1700 - int ret; 1763 + int i; 1701 1764 1702 - ret = unbind_console(fb_info); 1765 + i = fb_info->node; 1766 + if (WARN_ON(i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)) 1767 + return; 1703 1768 1704 - if (ret) 1705 - return -EINVAL; 1769 + if (!fb_info->dev) 1770 + return; 1771 + 1772 + device_destroy(fb_class, MKDEV(FB_MAJOR, i)); 1706 1773 1707 1774 pm_vt_switch_unregister(fb_info->dev); 1708 1775 1709 - __unlink_framebuffer(fb_info); 1776 + unbind_console(fb_info); 1777 + 1778 + fb_info->dev = NULL; 1779 + } 1780 + EXPORT_SYMBOL(unlink_framebuffer); 1781 + 1782 + static void do_unregister_framebuffer(struct fb_info *fb_info) 1783 + { 1784 + unlink_framebuffer(fb_info); 1710 1785 if (fb_info->pixmap.addr && 1711 1786 (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT)) 1712 1787 kfree(fb_info->pixmap.addr); ··· 1714 1789 registered_fb[fb_info->node] = NULL; 1715 1790 num_registered_fb--; 1716 1791 fb_cleanup_device(fb_info); 1717 - event.info = fb_info; 1792 + #ifdef CONFIG_GUMSTIX_AM200EPD 1793 + { 1794 + struct fb_event event; 1795 + event.info = fb_info; 1796 + fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event); 1797 + } 1798 + #endif 1718 1799 console_lock(); 1719 - fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event); 1800 + fbcon_fb_unregistered(fb_info); 1720 1801 console_unlock(); 1721 1802 1722 1803 /* this may free fb info */ 1723 1804 put_fb_info(fb_info); 1724 - return 0; 1725 1805 } 1726 - 1727 - static int __unlink_framebuffer(struct fb_info *fb_info) 1728 - { 1729 - int i; 1730 - 1731 - i = fb_info->node; 1732 - if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info) 1733 - return -EINVAL; 1734 - 1735 - if (fb_info->dev) { 1736 - device_destroy(fb_class, MKDEV(FB_MAJOR, i)); 1737 - fb_info->dev = NULL; 1738 - } 1739 - 1740 - return 0; 1741 - } 1742 - 1743 - int unlink_framebuffer(struct fb_info *fb_info) 1744 - { 1745 - int ret; 1746 - 1747 - ret = __unlink_framebuffer(fb_info); 1748 - if (ret) 1749 - return ret; 1750 - 1751 - unbind_console(fb_info); 1752 - 1753 - return 0; 1754 - } 1755 - EXPORT_SYMBOL(unlink_framebuffer); 1756 1806 1757 1807 /** 1758 1808 * remove_conflicting_framebuffers - remove firmware-configured framebuffers ··· 1742 1842 int remove_conflicting_framebuffers(struct apertures_struct *a, 1743 1843 const char *name, bool primary) 1744 1844 { 1745 - int ret; 1746 1845 bool do_free = false; 1747 1846 1748 1847 if (!a) { ··· 1755 1856 } 1756 1857 1757 1858 mutex_lock(&registration_lock); 1758 - ret = do_remove_conflicting_framebuffers(a, name, primary); 1859 + do_remove_conflicting_framebuffers(a, name, primary); 1759 1860 mutex_unlock(&registration_lock); 1760 1861 1761 1862 if (do_free) 1762 1863 kfree(a); 1763 1864 1764 - return ret; 1865 + return 0; 1765 1866 } 1766 1867 EXPORT_SYMBOL(remove_conflicting_framebuffers); 1767 1868 ··· 1858 1959 * that the driver implements fb_open() and fb_release() to 1859 1960 * check that no processes are using the device. 1860 1961 */ 1861 - int 1962 + void 1862 1963 unregister_framebuffer(struct fb_info *fb_info) 1863 1964 { 1864 - int ret; 1865 - 1866 1965 mutex_lock(&registration_lock); 1867 - ret = do_unregister_framebuffer(fb_info); 1966 + do_unregister_framebuffer(fb_info); 1868 1967 mutex_unlock(&registration_lock); 1869 - 1870 - return ret; 1871 1968 } 1872 1969 EXPORT_SYMBOL(unregister_framebuffer); 1873 1970 ··· 1878 1983 */ 1879 1984 void fb_set_suspend(struct fb_info *info, int state) 1880 1985 { 1881 - struct fb_event event; 1986 + WARN_CONSOLE_UNLOCKED(); 1882 1987 1883 - event.info = info; 1884 1988 if (state) { 1885 - fb_notifier_call_chain(FB_EVENT_SUSPEND, &event); 1989 + fbcon_suspended(info); 1886 1990 info->state = FBINFO_STATE_SUSPENDED; 1887 1991 } else { 1888 1992 info->state = FBINFO_STATE_RUNNING; 1889 - fb_notifier_call_chain(FB_EVENT_RESUME, &event); 1993 + fbcon_resumed(info); 1890 1994 } 1891 1995 } 1892 1996 EXPORT_SYMBOL(fb_set_suspend); ··· 1953 2059 1954 2060 int fb_new_modelist(struct fb_info *info) 1955 2061 { 1956 - struct fb_event event; 1957 2062 struct fb_var_screeninfo var = info->var; 1958 2063 struct list_head *pos, *n; 1959 2064 struct fb_modelist *modelist; ··· 1972 2079 } 1973 2080 } 1974 2081 1975 - err = 1; 2082 + if (list_empty(&info->modelist)) 2083 + return 1; 1976 2084 1977 - if (!list_empty(&info->modelist)) { 1978 - event.info = info; 1979 - err = fb_notifier_call_chain(FB_EVENT_NEW_MODELIST, &event); 1980 - } 2085 + fbcon_new_modelist(info); 1981 2086 1982 - return err; 2087 + return 0; 1983 2088 } 1984 2089 1985 2090 MODULE_LICENSE("GPL");
+8 -12
drivers/video/fbdev/core/fbsysfs.c
··· 14 14 #include <linux/kernel.h> 15 15 #include <linux/slab.h> 16 16 #include <linux/fb.h> 17 + #include <linux/fbcon.h> 17 18 #include <linux/console.h> 18 19 #include <linux/module.h> 19 20 ··· 176 175 return -EINVAL; 177 176 178 177 console_lock(); 179 - if (!lock_fb_info(fb_info)) { 180 - console_unlock(); 181 - return -ENODEV; 182 - } 178 + lock_fb_info(fb_info); 183 179 184 180 list_splice(&fb_info->modelist, &old_list); 185 181 fb_videomode_to_modelist((const struct fb_videomode *)buf, i, ··· 302 304 { 303 305 struct fb_info *fb_info = dev_get_drvdata(device); 304 306 char *last = NULL; 305 - int err; 307 + int err, arg; 306 308 309 + arg = simple_strtoul(buf, &last, 0); 307 310 console_lock(); 308 - fb_info->flags |= FBINFO_MISC_USEREVENT; 309 - err = fb_blank(fb_info, simple_strtoul(buf, &last, 0)); 310 - fb_info->flags &= ~FBINFO_MISC_USEREVENT; 311 + err = fb_blank(fb_info, arg); 312 + /* might again call into fb_blank */ 313 + fbcon_fb_blanked(fb_info, arg); 311 314 console_unlock(); 312 315 if (err < 0) 313 316 return err; ··· 404 405 state = simple_strtoul(buf, &last, 0); 405 406 406 407 console_lock(); 407 - if (!lock_fb_info(fb_info)) { 408 - console_unlock(); 409 - return -ENODEV; 410 - } 408 + lock_fb_info(fb_info); 411 409 412 410 fb_set_suspend(fb_info, (int)state); 413 411
-6
drivers/video/fbdev/cyber2000fb.c
··· 58 58 struct cfb_info { 59 59 struct fb_info fb; 60 60 struct display_switch *dispsw; 61 - struct display *display; 62 61 unsigned char __iomem *region; 63 62 unsigned char __iomem *regs; 64 63 u_int id; ··· 1638 1639 } 1639 1640 1640 1641 /* 1641 - * PCI specific support. 1642 - */ 1643 - #ifdef CONFIG_PCI 1644 - /* 1645 1642 * We need to wake up the CyberPro, and make sure its in linear memory 1646 1643 * mode. Unfortunately, this is specific to the platform and card that 1647 1644 * we are running on. ··· 1853 1858 .resume = cyberpro_pci_resume, 1854 1859 .id_table = cyberpro_pci_table 1855 1860 }; 1856 - #endif 1857 1861 1858 1862 /* 1859 1863 * I don't think we can use the "module_init" stuff here because
-1
drivers/video/fbdev/da8xx-fb.c
··· 1387 1387 da8xx_fb_info = framebuffer_alloc(sizeof(struct da8xx_fb_par), 1388 1388 &device->dev); 1389 1389 if (!da8xx_fb_info) { 1390 - dev_dbg(&device->dev, "Memory allocation failed for fb_info\n"); 1391 1390 ret = -ENOMEM; 1392 1391 goto err_pm_runtime_disable; 1393 1392 }
+5 -1
drivers/video/fbdev/efifb.c
··· 169 169 return; 170 170 } 171 171 172 + if (bgrt_tab.status & 0x06) { 173 + pr_info("efifb: BGRT rotation bits set, not showing boot graphics\n"); 174 + return; 175 + } 176 + 172 177 /* Avoid flashing the logo if we're going to print std probe messages */ 173 178 if (console_loglevel > CONSOLE_LOGLEVEL_QUIET) 174 179 return; ··· 453 448 454 449 info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev); 455 450 if (!info) { 456 - pr_err("efifb: cannot allocate framebuffer\n"); 457 451 err = -ENOMEM; 458 452 goto err_release_mem; 459 453 }
+7 -12
drivers/video/fbdev/gbefb.c
··· 39 39 int valid; 40 40 }; 41 41 42 - #ifdef CONFIG_SGI_IP32 43 42 #define GBE_BASE 0x16000000 /* SGI O2 */ 44 - #endif 45 43 46 44 /* macro for fastest write-though access to the framebuffer */ 47 45 #ifdef CONFIG_MIPS ··· 48 50 #else 49 51 #define pgprot_fb(_prot) (((_prot) & (~_CACHE_MASK)) | _CACHE_CACHABLE_NO_WA) 50 52 #endif 51 - #endif 52 - #ifdef CONFIG_X86 53 - #define pgprot_fb(_prot) (((_prot) & ~_PAGE_CACHE_MASK) | \ 54 - cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS)) 55 53 #endif 56 54 57 55 /* ··· 273 279 val = 0; 274 280 SET_GBE_FIELD(VT_XY, FREEZE, val, 1); 275 281 gbe->vt_xy = val; 276 - udelay(10000); 282 + mdelay(10); 277 283 for (i = 0; i < 10000; i++) { 278 284 val = gbe->vt_xy; 279 285 if (GET_GBE_FIELD(VT_XY, FREEZE, val) != 1) ··· 288 294 val = gbe->dotclock; 289 295 SET_GBE_FIELD(DOTCLK, RUN, val, 0); 290 296 gbe->dotclock = val; 291 - udelay(10000); 297 + mdelay(10); 292 298 for (i = 0; i < 10000; i++) { 293 299 val = gbe->dotclock; 294 300 if (GET_GBE_FIELD(DOTCLK, RUN, val)) ··· 325 331 val = gbe->dotclock; 326 332 SET_GBE_FIELD(DOTCLK, RUN, val, 1); 327 333 gbe->dotclock = val; 328 - udelay(10000); 334 + mdelay(10); 329 335 for (i = 0; i < 10000; i++) { 330 336 val = gbe->dotclock; 331 337 if (GET_GBE_FIELD(DOTCLK, RUN, val) != 1) ··· 340 346 val = 0; 341 347 SET_GBE_FIELD(VT_XY, FREEZE, val, 0); 342 348 gbe->vt_xy = val; 343 - udelay(10000); 349 + mdelay(10); 344 350 for (i = 0; i < 10000; i++) { 345 351 val = gbe->vt_xy; 346 352 if (GET_GBE_FIELD(VT_XY, FREEZE, val)) ··· 541 547 SET_GBE_FIELD(DOTCLK, P, val, timing->pll_p); 542 548 SET_GBE_FIELD(DOTCLK, RUN, val, 0); /* do not start yet */ 543 549 gbe->dotclock = val; 544 - udelay(10000); 550 + mdelay(10); 545 551 546 552 /* setup pixel counter */ 547 553 val = 0; ··· 1012 1018 1013 1019 /* remap using the fastest write-through mode on architecture */ 1014 1020 /* try not polluting the cache when possible */ 1021 + #ifdef CONFIG_MIPS 1015 1022 pgprot_val(vma->vm_page_prot) = 1016 1023 pgprot_fb(pgprot_val(vma->vm_page_prot)); 1017 - 1024 + #endif 1018 1025 /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */ 1019 1026 1020 1027 /* look for the starting tile */
+1 -3
drivers/video/fbdev/grvga.c
··· 336 336 char *options = NULL, *mode_opt = NULL; 337 337 338 338 info = framebuffer_alloc(sizeof(struct grvga_par), &dev->dev); 339 - if (!info) { 340 - dev_err(&dev->dev, "framebuffer_alloc failed\n"); 339 + if (!info) 341 340 return -ENOMEM; 342 - } 343 341 344 342 /* Expecting: "grvga: modestring, [addr:<framebuffer physical address>], [size:<framebuffer size>] 345 343 *
+2 -3
drivers/video/fbdev/gxt4500.c
··· 643 643 } 644 644 645 645 info = framebuffer_alloc(sizeof(struct gxt4500_par), &pdev->dev); 646 - if (!info) { 647 - dev_err(&pdev->dev, "gxt4500: cannot alloc FB info record\n"); 646 + if (!info) 648 647 goto err_free_fb; 649 - } 648 + 650 649 par = info->par; 651 650 cardtype = ent->driver_data; 652 651 par->refclk_ps = cardinfo[cardtype].refclk_ps;
+1 -3
drivers/video/fbdev/hyperv_fb.c
··· 762 762 int ret; 763 763 764 764 info = framebuffer_alloc(sizeof(struct hvfb_par), &hdev->device); 765 - if (!info) { 766 - pr_err("No memory for framebuffer info\n"); 765 + if (!info) 767 766 return -ENOMEM; 768 - } 769 767 770 768 par = info->par; 771 769 par->info = info;
+1 -3
drivers/video/fbdev/i740fb.c
··· 1006 1006 u8 *edid; 1007 1007 1008 1008 info = framebuffer_alloc(sizeof(struct i740fb_par), &(dev->dev)); 1009 - if (!info) { 1010 - dev_err(&(dev->dev), "cannot allocate framebuffer\n"); 1009 + if (!info) 1011 1010 return -ENOMEM; 1012 - } 1013 1011 1014 1012 par = info->par; 1015 1013 mutex_init(&par->open_lock);
+1 -4
drivers/video/fbdev/imsttfb.c
··· 1477 1477 printk(KERN_ERR "imsttfb: no OF node for pci device\n"); 1478 1478 1479 1479 info = framebuffer_alloc(sizeof(struct imstt_par), &pdev->dev); 1480 - 1481 - if (!info) { 1482 - printk(KERN_ERR "imsttfb: Can't allocate memory\n"); 1480 + if (!info) 1483 1481 return -ENOMEM; 1484 - } 1485 1482 1486 1483 par = info->par; 1487 1484
+5 -6
drivers/video/fbdev/imxfb.c
··· 974 974 } 975 975 976 976 fbi->map_size = PAGE_ALIGN(info->fix.smem_len); 977 - info->screen_base = dma_alloc_wc(&pdev->dev, fbi->map_size, 978 - &fbi->map_dma, GFP_KERNEL); 979 - 980 - if (!info->screen_base) { 977 + info->screen_buffer = dma_alloc_wc(&pdev->dev, fbi->map_size, 978 + &fbi->map_dma, GFP_KERNEL); 979 + if (!info->screen_buffer) { 981 980 dev_err(&pdev->dev, "Failed to allocate video RAM: %d\n", ret); 982 981 ret = -ENOMEM; 983 982 goto failed_map; ··· 1045 1046 if (pdata && pdata->exit) 1046 1047 pdata->exit(fbi->pdev); 1047 1048 failed_platform_init: 1048 - dma_free_wc(&pdev->dev, fbi->map_size, info->screen_base, 1049 + dma_free_wc(&pdev->dev, fbi->map_size, info->screen_buffer, 1049 1050 fbi->map_dma); 1050 1051 failed_map: 1051 1052 iounmap(fbi->regs); ··· 1076 1077 pdata = dev_get_platdata(&pdev->dev); 1077 1078 if (pdata && pdata->exit) 1078 1079 pdata->exit(fbi->pdev); 1079 - dma_free_wc(&pdev->dev, fbi->map_size, info->screen_base, 1080 + dma_free_wc(&pdev->dev, fbi->map_size, info->screen_buffer, 1080 1081 fbi->map_dma); 1081 1082 iounmap(fbi->regs); 1082 1083 release_mem_region(res->start, resource_size(res));
+3 -4
drivers/video/fbdev/intelfb/intelfbdrv.c
··· 491 491 } 492 492 493 493 info = framebuffer_alloc(sizeof(struct intelfb_info), &pdev->dev); 494 - if (!info) { 495 - ERR_MSG("Could not allocate memory for intelfb_info.\n"); 496 - return -ENODEV; 497 - } 494 + if (!info) 495 + return -ENOMEM; 496 + 498 497 if (fb_alloc_cmap(&info->cmap, 256, 1) < 0) { 499 498 ERR_MSG("Could not allocate cmap for intelfb_info.\n"); 500 499 goto err_out_cmap;
+1 -10
drivers/video/fbdev/jz4740_fb.c
··· 457 457 { 458 458 int max_videosize = 0; 459 459 struct fb_videomode *mode = jzfb->pdata->modes; 460 - void *page; 461 460 int i; 462 461 463 462 for (i = 0; i < jzfb->pdata->num_modes; ++mode, ++i) { ··· 480 481 481 482 if (!jzfb->vidmem) 482 483 goto err_free_framedesc; 483 - 484 - for (page = jzfb->vidmem; 485 - page < jzfb->vidmem + PAGE_ALIGN(jzfb->vidmem_size); 486 - page += PAGE_SIZE) { 487 - SetPageReserved(virt_to_page(page)); 488 - } 489 484 490 485 jzfb->framedesc->next = jzfb->framedesc_phys; 491 486 jzfb->framedesc->addr = jzfb->vidmem_phys; ··· 528 535 } 529 536 530 537 fb = framebuffer_alloc(sizeof(struct jzfb), &pdev->dev); 531 - if (!fb) { 532 - dev_err(&pdev->dev, "Failed to allocate framebuffer device\n"); 538 + if (!fb) 533 539 return -ENOMEM; 534 - } 535 540 536 541 fb->fbops = &jzfb_ops; 537 542 fb->flags = FBINFO_DEFAULT;
+1 -4
drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
··· 680 680 } 681 681 682 682 info = framebuffer_alloc(sizeof(struct mb862xxfb_par), dev); 683 - if (info == NULL) { 684 - dev_err(dev, "cannot allocate framebuffer\n"); 683 + if (!info) 685 684 return -ENOMEM; 686 - } 687 685 688 686 par = info->par; 689 687 par->info = info; ··· 1003 1005 1004 1006 info = framebuffer_alloc(sizeof(struct mb862xxfb_par), dev); 1005 1007 if (!info) { 1006 - dev_err(dev, "framebuffer alloc failed\n"); 1007 1008 ret = -ENOMEM; 1008 1009 goto dis_dev; 1009 1010 }
+1 -3
drivers/video/fbdev/mbx/mbxfb.c
··· 899 899 } 900 900 901 901 fbi = framebuffer_alloc(sizeof(struct mbxfb_info), &dev->dev); 902 - if (fbi == NULL) { 903 - dev_err(&dev->dev, "framebuffer_alloc failed\n"); 902 + if (!fbi) 904 903 return -ENOMEM; 905 - } 906 904 907 905 mfbi = fbi->par; 908 906 fbi->pseudo_palette = mfbi->pseudo_palette;
+4 -4
drivers/video/fbdev/mmp/hw/mmp_ctrl.c
··· 433 433 { 434 434 struct mmp_mach_plat_info *mi; 435 435 struct resource *res; 436 - int ret, i, size, irq; 436 + int ret, i, irq; 437 437 struct mmphw_path_plat *path_plat; 438 438 struct mmphw_ctrl *ctrl = NULL; 439 439 ··· 461 461 } 462 462 463 463 /* allocate */ 464 - size = sizeof(struct mmphw_ctrl) + sizeof(struct mmphw_path_plat) * 465 - mi->path_num; 466 - ctrl = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); 464 + ctrl = devm_kzalloc(&pdev->dev, 465 + struct_size(ctrl, path_plats, mi->path_num), 466 + GFP_KERNEL); 467 467 if (!ctrl) { 468 468 ret = -ENOMEM; 469 469 goto failed;
-1028
drivers/video/fbdev/mxsfb.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * Copyright (C) 2010 Juergen Beisert, Pengutronix 4 - * 5 - * This code is based on: 6 - * Author: Vitaly Wool <vital@embeddedalley.com> 7 - * 8 - * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved. 9 - * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. 10 - */ 11 - 12 - #define DRIVER_NAME "mxsfb" 13 - 14 - /** 15 - * @file 16 - * @brief LCDIF driver for i.MX23 and i.MX28 17 - * 18 - * The LCDIF support four modes of operation 19 - * - MPU interface (to drive smart displays) -> not supported yet 20 - * - VSYNC interface (like MPU interface plus Vsync) -> not supported yet 21 - * - Dotclock interface (to drive LC displays with RGB data and sync signals) 22 - * - DVI (to drive ITU-R BT656) -> not supported yet 23 - * 24 - * This driver depends on a correct setup of the pins used for this purpose 25 - * (platform specific). 26 - * 27 - * For the developer: Don't forget to set the data bus width to the display 28 - * in the imx_fb_videomode structure. You will else end up with ugly colours. 29 - * If you fight against jitter you can vary the clock delay. This is a feature 30 - * of the i.MX28 and you can vary it between 2 ns ... 8 ns in 2 ns steps. Give 31 - * the required value in the imx_fb_videomode structure. 32 - */ 33 - 34 - #include <linux/module.h> 35 - #include <linux/kernel.h> 36 - #include <linux/of_device.h> 37 - #include <linux/platform_device.h> 38 - #include <linux/clk.h> 39 - #include <linux/dma-mapping.h> 40 - #include <linux/io.h> 41 - #include <linux/fb.h> 42 - #include <linux/regulator/consumer.h> 43 - #include <video/of_display_timing.h> 44 - #include <video/of_videomode.h> 45 - #include <video/videomode.h> 46 - 47 - #define REG_SET 4 48 - #define REG_CLR 8 49 - 50 - #define LCDC_CTRL 0x00 51 - #define LCDC_CTRL1 0x10 52 - #define LCDC_V4_CTRL2 0x20 53 - #define LCDC_V3_TRANSFER_COUNT 0x20 54 - #define LCDC_V4_TRANSFER_COUNT 0x30 55 - #define LCDC_V4_CUR_BUF 0x40 56 - #define LCDC_V4_NEXT_BUF 0x50 57 - #define LCDC_V3_CUR_BUF 0x30 58 - #define LCDC_V3_NEXT_BUF 0x40 59 - #define LCDC_TIMING 0x60 60 - #define LCDC_VDCTRL0 0x70 61 - #define LCDC_VDCTRL1 0x80 62 - #define LCDC_VDCTRL2 0x90 63 - #define LCDC_VDCTRL3 0xa0 64 - #define LCDC_VDCTRL4 0xb0 65 - #define LCDC_DVICTRL0 0xc0 66 - #define LCDC_DVICTRL1 0xd0 67 - #define LCDC_DVICTRL2 0xe0 68 - #define LCDC_DVICTRL3 0xf0 69 - #define LCDC_DVICTRL4 0x100 70 - #define LCDC_V4_DATA 0x180 71 - #define LCDC_V3_DATA 0x1b0 72 - #define LCDC_V4_DEBUG0 0x1d0 73 - #define LCDC_V3_DEBUG0 0x1f0 74 - 75 - #define CTRL_SFTRST (1 << 31) 76 - #define CTRL_CLKGATE (1 << 30) 77 - #define CTRL_BYPASS_COUNT (1 << 19) 78 - #define CTRL_VSYNC_MODE (1 << 18) 79 - #define CTRL_DOTCLK_MODE (1 << 17) 80 - #define CTRL_DATA_SELECT (1 << 16) 81 - #define CTRL_SET_BUS_WIDTH(x) (((x) & 0x3) << 10) 82 - #define CTRL_GET_BUS_WIDTH(x) (((x) >> 10) & 0x3) 83 - #define CTRL_SET_WORD_LENGTH(x) (((x) & 0x3) << 8) 84 - #define CTRL_GET_WORD_LENGTH(x) (((x) >> 8) & 0x3) 85 - #define CTRL_MASTER (1 << 5) 86 - #define CTRL_DF16 (1 << 3) 87 - #define CTRL_DF18 (1 << 2) 88 - #define CTRL_DF24 (1 << 1) 89 - #define CTRL_RUN (1 << 0) 90 - 91 - #define CTRL1_FIFO_CLEAR (1 << 21) 92 - #define CTRL1_SET_BYTE_PACKAGING(x) (((x) & 0xf) << 16) 93 - #define CTRL1_GET_BYTE_PACKAGING(x) (((x) >> 16) & 0xf) 94 - 95 - #define TRANSFER_COUNT_SET_VCOUNT(x) (((x) & 0xffff) << 16) 96 - #define TRANSFER_COUNT_GET_VCOUNT(x) (((x) >> 16) & 0xffff) 97 - #define TRANSFER_COUNT_SET_HCOUNT(x) ((x) & 0xffff) 98 - #define TRANSFER_COUNT_GET_HCOUNT(x) ((x) & 0xffff) 99 - 100 - 101 - #define VDCTRL0_ENABLE_PRESENT (1 << 28) 102 - #define VDCTRL0_VSYNC_ACT_HIGH (1 << 27) 103 - #define VDCTRL0_HSYNC_ACT_HIGH (1 << 26) 104 - #define VDCTRL0_DOTCLK_ACT_FALLING (1 << 25) 105 - #define VDCTRL0_ENABLE_ACT_HIGH (1 << 24) 106 - #define VDCTRL0_VSYNC_PERIOD_UNIT (1 << 21) 107 - #define VDCTRL0_VSYNC_PULSE_WIDTH_UNIT (1 << 20) 108 - #define VDCTRL0_HALF_LINE (1 << 19) 109 - #define VDCTRL0_HALF_LINE_MODE (1 << 18) 110 - #define VDCTRL0_SET_VSYNC_PULSE_WIDTH(x) ((x) & 0x3ffff) 111 - #define VDCTRL0_GET_VSYNC_PULSE_WIDTH(x) ((x) & 0x3ffff) 112 - 113 - #define VDCTRL2_SET_HSYNC_PERIOD(x) ((x) & 0x3ffff) 114 - #define VDCTRL2_GET_HSYNC_PERIOD(x) ((x) & 0x3ffff) 115 - 116 - #define VDCTRL3_MUX_SYNC_SIGNALS (1 << 29) 117 - #define VDCTRL3_VSYNC_ONLY (1 << 28) 118 - #define SET_HOR_WAIT_CNT(x) (((x) & 0xfff) << 16) 119 - #define GET_HOR_WAIT_CNT(x) (((x) >> 16) & 0xfff) 120 - #define SET_VERT_WAIT_CNT(x) ((x) & 0xffff) 121 - #define GET_VERT_WAIT_CNT(x) ((x) & 0xffff) 122 - 123 - #define VDCTRL4_SET_DOTCLK_DLY(x) (((x) & 0x7) << 29) /* v4 only */ 124 - #define VDCTRL4_GET_DOTCLK_DLY(x) (((x) >> 29) & 0x7) /* v4 only */ 125 - #define VDCTRL4_SYNC_SIGNALS_ON (1 << 18) 126 - #define SET_DOTCLK_H_VALID_DATA_CNT(x) ((x) & 0x3ffff) 127 - 128 - #define DEBUG0_HSYNC (1 < 26) 129 - #define DEBUG0_VSYNC (1 < 25) 130 - 131 - #define MIN_XRES 120 132 - #define MIN_YRES 120 133 - 134 - #define RED 0 135 - #define GREEN 1 136 - #define BLUE 2 137 - #define TRANSP 3 138 - 139 - #define STMLCDIF_8BIT 1 /** pixel data bus to the display is of 8 bit width */ 140 - #define STMLCDIF_16BIT 0 /** pixel data bus to the display is of 16 bit width */ 141 - #define STMLCDIF_18BIT 2 /** pixel data bus to the display is of 18 bit width */ 142 - #define STMLCDIF_24BIT 3 /** pixel data bus to the display is of 24 bit width */ 143 - 144 - #define MXSFB_SYNC_DATA_ENABLE_HIGH_ACT (1 << 6) 145 - #define MXSFB_SYNC_DOTCLK_FALLING_ACT (1 << 7) /* negative edge sampling */ 146 - 147 - enum mxsfb_devtype { 148 - MXSFB_V3, 149 - MXSFB_V4, 150 - }; 151 - 152 - /* CPU dependent register offsets */ 153 - struct mxsfb_devdata { 154 - unsigned transfer_count; 155 - unsigned cur_buf; 156 - unsigned next_buf; 157 - unsigned debug0; 158 - unsigned hs_wdth_mask; 159 - unsigned hs_wdth_shift; 160 - unsigned ipversion; 161 - }; 162 - 163 - struct mxsfb_info { 164 - struct platform_device *pdev; 165 - struct clk *clk; 166 - struct clk *clk_axi; 167 - struct clk *clk_disp_axi; 168 - void __iomem *base; /* registers */ 169 - unsigned allocated_size; 170 - int enabled; 171 - unsigned ld_intf_width; 172 - unsigned dotclk_delay; 173 - const struct mxsfb_devdata *devdata; 174 - u32 sync; 175 - struct regulator *reg_lcd; 176 - int pre_init; 177 - }; 178 - 179 - #define mxsfb_is_v3(host) (host->devdata->ipversion == 3) 180 - #define mxsfb_is_v4(host) (host->devdata->ipversion == 4) 181 - 182 - static const struct mxsfb_devdata mxsfb_devdata[] = { 183 - [MXSFB_V3] = { 184 - .transfer_count = LCDC_V3_TRANSFER_COUNT, 185 - .cur_buf = LCDC_V3_CUR_BUF, 186 - .next_buf = LCDC_V3_NEXT_BUF, 187 - .debug0 = LCDC_V3_DEBUG0, 188 - .hs_wdth_mask = 0xff, 189 - .hs_wdth_shift = 24, 190 - .ipversion = 3, 191 - }, 192 - [MXSFB_V4] = { 193 - .transfer_count = LCDC_V4_TRANSFER_COUNT, 194 - .cur_buf = LCDC_V4_CUR_BUF, 195 - .next_buf = LCDC_V4_NEXT_BUF, 196 - .debug0 = LCDC_V4_DEBUG0, 197 - .hs_wdth_mask = 0x3fff, 198 - .hs_wdth_shift = 18, 199 - .ipversion = 4, 200 - }, 201 - }; 202 - 203 - /* mask and shift depends on architecture */ 204 - static inline u32 set_hsync_pulse_width(struct mxsfb_info *host, unsigned val) 205 - { 206 - return (val & host->devdata->hs_wdth_mask) << 207 - host->devdata->hs_wdth_shift; 208 - } 209 - 210 - static inline u32 get_hsync_pulse_width(struct mxsfb_info *host, unsigned val) 211 - { 212 - return (val >> host->devdata->hs_wdth_shift) & 213 - host->devdata->hs_wdth_mask; 214 - } 215 - 216 - static const struct fb_bitfield def_rgb565[] = { 217 - [RED] = { 218 - .offset = 11, 219 - .length = 5, 220 - }, 221 - [GREEN] = { 222 - .offset = 5, 223 - .length = 6, 224 - }, 225 - [BLUE] = { 226 - .offset = 0, 227 - .length = 5, 228 - }, 229 - [TRANSP] = { /* no support for transparency */ 230 - .length = 0, 231 - } 232 - }; 233 - 234 - static const struct fb_bitfield def_rgb888[] = { 235 - [RED] = { 236 - .offset = 16, 237 - .length = 8, 238 - }, 239 - [GREEN] = { 240 - .offset = 8, 241 - .length = 8, 242 - }, 243 - [BLUE] = { 244 - .offset = 0, 245 - .length = 8, 246 - }, 247 - [TRANSP] = { /* no support for transparency */ 248 - .length = 0, 249 - } 250 - }; 251 - 252 - static inline unsigned chan_to_field(unsigned chan, struct fb_bitfield *bf) 253 - { 254 - chan &= 0xffff; 255 - chan >>= 16 - bf->length; 256 - return chan << bf->offset; 257 - } 258 - 259 - static int mxsfb_check_var(struct fb_var_screeninfo *var, 260 - struct fb_info *fb_info) 261 - { 262 - struct mxsfb_info *host = fb_info->par; 263 - const struct fb_bitfield *rgb = NULL; 264 - 265 - if (var->xres < MIN_XRES) 266 - var->xres = MIN_XRES; 267 - if (var->yres < MIN_YRES) 268 - var->yres = MIN_YRES; 269 - 270 - var->xres_virtual = var->xres; 271 - 272 - var->yres_virtual = var->yres; 273 - 274 - switch (var->bits_per_pixel) { 275 - case 16: 276 - /* always expect RGB 565 */ 277 - rgb = def_rgb565; 278 - break; 279 - case 32: 280 - switch (host->ld_intf_width) { 281 - case STMLCDIF_8BIT: 282 - pr_debug("Unsupported LCD bus width mapping\n"); 283 - break; 284 - case STMLCDIF_16BIT: 285 - case STMLCDIF_18BIT: 286 - case STMLCDIF_24BIT: 287 - /* real 24 bit */ 288 - rgb = def_rgb888; 289 - break; 290 - } 291 - break; 292 - default: 293 - pr_err("Unsupported colour depth: %u\n", var->bits_per_pixel); 294 - return -EINVAL; 295 - } 296 - 297 - /* 298 - * Copy the RGB parameters for this display 299 - * from the machine specific parameters. 300 - */ 301 - var->red = rgb[RED]; 302 - var->green = rgb[GREEN]; 303 - var->blue = rgb[BLUE]; 304 - var->transp = rgb[TRANSP]; 305 - 306 - return 0; 307 - } 308 - 309 - static inline void mxsfb_enable_axi_clk(struct mxsfb_info *host) 310 - { 311 - if (host->clk_axi) 312 - clk_prepare_enable(host->clk_axi); 313 - } 314 - 315 - static inline void mxsfb_disable_axi_clk(struct mxsfb_info *host) 316 - { 317 - if (host->clk_axi) 318 - clk_disable_unprepare(host->clk_axi); 319 - } 320 - 321 - static void mxsfb_enable_controller(struct fb_info *fb_info) 322 - { 323 - struct mxsfb_info *host = fb_info->par; 324 - u32 reg; 325 - int ret; 326 - 327 - dev_dbg(&host->pdev->dev, "%s\n", __func__); 328 - 329 - if (host->reg_lcd) { 330 - ret = regulator_enable(host->reg_lcd); 331 - if (ret) { 332 - dev_err(&host->pdev->dev, 333 - "lcd regulator enable failed: %d\n", ret); 334 - return; 335 - } 336 - } 337 - 338 - if (host->clk_disp_axi) 339 - clk_prepare_enable(host->clk_disp_axi); 340 - clk_prepare_enable(host->clk); 341 - clk_set_rate(host->clk, PICOS2KHZ(fb_info->var.pixclock) * 1000U); 342 - 343 - mxsfb_enable_axi_clk(host); 344 - 345 - /* if it was disabled, re-enable the mode again */ 346 - writel(CTRL_DOTCLK_MODE, host->base + LCDC_CTRL + REG_SET); 347 - 348 - /* enable the SYNC signals first, then the DMA engine */ 349 - reg = readl(host->base + LCDC_VDCTRL4); 350 - reg |= VDCTRL4_SYNC_SIGNALS_ON; 351 - writel(reg, host->base + LCDC_VDCTRL4); 352 - 353 - writel(CTRL_RUN, host->base + LCDC_CTRL + REG_SET); 354 - 355 - host->enabled = 1; 356 - } 357 - 358 - static void mxsfb_disable_controller(struct fb_info *fb_info) 359 - { 360 - struct mxsfb_info *host = fb_info->par; 361 - unsigned loop; 362 - u32 reg; 363 - int ret; 364 - 365 - dev_dbg(&host->pdev->dev, "%s\n", __func__); 366 - 367 - /* 368 - * Even if we disable the controller here, it will still continue 369 - * until its FIFOs are running out of data 370 - */ 371 - writel(CTRL_DOTCLK_MODE, host->base + LCDC_CTRL + REG_CLR); 372 - 373 - loop = 1000; 374 - while (loop) { 375 - reg = readl(host->base + LCDC_CTRL); 376 - if (!(reg & CTRL_RUN)) 377 - break; 378 - loop--; 379 - } 380 - 381 - reg = readl(host->base + LCDC_VDCTRL4); 382 - writel(reg & ~VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4); 383 - 384 - mxsfb_disable_axi_clk(host); 385 - 386 - clk_disable_unprepare(host->clk); 387 - if (host->clk_disp_axi) 388 - clk_disable_unprepare(host->clk_disp_axi); 389 - 390 - host->enabled = 0; 391 - 392 - if (host->reg_lcd) { 393 - ret = regulator_disable(host->reg_lcd); 394 - if (ret) 395 - dev_err(&host->pdev->dev, 396 - "lcd regulator disable failed: %d\n", ret); 397 - } 398 - } 399 - 400 - static int mxsfb_set_par(struct fb_info *fb_info) 401 - { 402 - struct mxsfb_info *host = fb_info->par; 403 - u32 ctrl, vdctrl0, vdctrl4; 404 - int line_size, fb_size; 405 - int reenable = 0; 406 - 407 - line_size = fb_info->var.xres * (fb_info->var.bits_per_pixel >> 3); 408 - fb_size = fb_info->var.yres_virtual * line_size; 409 - 410 - if (fb_size > fb_info->fix.smem_len) 411 - return -ENOMEM; 412 - 413 - fb_info->fix.line_length = line_size; 414 - 415 - if (host->pre_init) { 416 - mxsfb_enable_controller(fb_info); 417 - host->pre_init = 0; 418 - return 0; 419 - } 420 - 421 - /* 422 - * It seems, you can't re-program the controller if it is still running. 423 - * This may lead into shifted pictures (FIFO issue?). 424 - * So, first stop the controller and drain its FIFOs 425 - */ 426 - if (host->enabled) { 427 - reenable = 1; 428 - mxsfb_disable_controller(fb_info); 429 - } 430 - 431 - mxsfb_enable_axi_clk(host); 432 - 433 - /* clear the FIFOs */ 434 - writel(CTRL1_FIFO_CLEAR, host->base + LCDC_CTRL1 + REG_SET); 435 - 436 - ctrl = CTRL_BYPASS_COUNT | CTRL_MASTER | 437 - CTRL_SET_BUS_WIDTH(host->ld_intf_width); 438 - 439 - switch (fb_info->var.bits_per_pixel) { 440 - case 16: 441 - dev_dbg(&host->pdev->dev, "Setting up RGB565 mode\n"); 442 - ctrl |= CTRL_SET_WORD_LENGTH(0); 443 - writel(CTRL1_SET_BYTE_PACKAGING(0xf), host->base + LCDC_CTRL1); 444 - break; 445 - case 32: 446 - dev_dbg(&host->pdev->dev, "Setting up RGB888/666 mode\n"); 447 - ctrl |= CTRL_SET_WORD_LENGTH(3); 448 - switch (host->ld_intf_width) { 449 - case STMLCDIF_8BIT: 450 - mxsfb_disable_axi_clk(host); 451 - dev_err(&host->pdev->dev, 452 - "Unsupported LCD bus width mapping\n"); 453 - return -EINVAL; 454 - case STMLCDIF_16BIT: 455 - case STMLCDIF_18BIT: 456 - case STMLCDIF_24BIT: 457 - /* real 24 bit */ 458 - break; 459 - } 460 - /* do not use packed pixels = one pixel per word instead */ 461 - writel(CTRL1_SET_BYTE_PACKAGING(0x7), host->base + LCDC_CTRL1); 462 - break; 463 - default: 464 - mxsfb_disable_axi_clk(host); 465 - dev_err(&host->pdev->dev, "Unhandled color depth of %u\n", 466 - fb_info->var.bits_per_pixel); 467 - return -EINVAL; 468 - } 469 - 470 - writel(ctrl, host->base + LCDC_CTRL); 471 - 472 - writel(TRANSFER_COUNT_SET_VCOUNT(fb_info->var.yres) | 473 - TRANSFER_COUNT_SET_HCOUNT(fb_info->var.xres), 474 - host->base + host->devdata->transfer_count); 475 - 476 - vdctrl0 = VDCTRL0_ENABLE_PRESENT | /* always in DOTCLOCK mode */ 477 - VDCTRL0_VSYNC_PERIOD_UNIT | 478 - VDCTRL0_VSYNC_PULSE_WIDTH_UNIT | 479 - VDCTRL0_SET_VSYNC_PULSE_WIDTH(fb_info->var.vsync_len); 480 - if (fb_info->var.sync & FB_SYNC_HOR_HIGH_ACT) 481 - vdctrl0 |= VDCTRL0_HSYNC_ACT_HIGH; 482 - if (fb_info->var.sync & FB_SYNC_VERT_HIGH_ACT) 483 - vdctrl0 |= VDCTRL0_VSYNC_ACT_HIGH; 484 - if (host->sync & MXSFB_SYNC_DATA_ENABLE_HIGH_ACT) 485 - vdctrl0 |= VDCTRL0_ENABLE_ACT_HIGH; 486 - if (host->sync & MXSFB_SYNC_DOTCLK_FALLING_ACT) 487 - vdctrl0 |= VDCTRL0_DOTCLK_ACT_FALLING; 488 - 489 - writel(vdctrl0, host->base + LCDC_VDCTRL0); 490 - 491 - /* frame length in lines */ 492 - writel(fb_info->var.upper_margin + fb_info->var.vsync_len + 493 - fb_info->var.lower_margin + fb_info->var.yres, 494 - host->base + LCDC_VDCTRL1); 495 - 496 - /* line length in units of clocks or pixels */ 497 - writel(set_hsync_pulse_width(host, fb_info->var.hsync_len) | 498 - VDCTRL2_SET_HSYNC_PERIOD(fb_info->var.left_margin + 499 - fb_info->var.hsync_len + fb_info->var.right_margin + 500 - fb_info->var.xres), 501 - host->base + LCDC_VDCTRL2); 502 - 503 - writel(SET_HOR_WAIT_CNT(fb_info->var.left_margin + 504 - fb_info->var.hsync_len) | 505 - SET_VERT_WAIT_CNT(fb_info->var.upper_margin + 506 - fb_info->var.vsync_len), 507 - host->base + LCDC_VDCTRL3); 508 - 509 - vdctrl4 = SET_DOTCLK_H_VALID_DATA_CNT(fb_info->var.xres); 510 - if (mxsfb_is_v4(host)) 511 - vdctrl4 |= VDCTRL4_SET_DOTCLK_DLY(host->dotclk_delay); 512 - writel(vdctrl4, host->base + LCDC_VDCTRL4); 513 - 514 - writel(fb_info->fix.smem_start + 515 - fb_info->fix.line_length * fb_info->var.yoffset, 516 - host->base + host->devdata->next_buf); 517 - 518 - mxsfb_disable_axi_clk(host); 519 - 520 - if (reenable) 521 - mxsfb_enable_controller(fb_info); 522 - 523 - return 0; 524 - } 525 - 526 - static int mxsfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, 527 - u_int transp, struct fb_info *fb_info) 528 - { 529 - unsigned int val; 530 - int ret = -EINVAL; 531 - 532 - /* 533 - * If greyscale is true, then we convert the RGB value 534 - * to greyscale no matter what visual we are using. 535 - */ 536 - if (fb_info->var.grayscale) 537 - red = green = blue = (19595 * red + 38470 * green + 538 - 7471 * blue) >> 16; 539 - 540 - switch (fb_info->fix.visual) { 541 - case FB_VISUAL_TRUECOLOR: 542 - /* 543 - * 12 or 16-bit True Colour. We encode the RGB value 544 - * according to the RGB bitfield information. 545 - */ 546 - if (regno < 16) { 547 - u32 *pal = fb_info->pseudo_palette; 548 - 549 - val = chan_to_field(red, &fb_info->var.red); 550 - val |= chan_to_field(green, &fb_info->var.green); 551 - val |= chan_to_field(blue, &fb_info->var.blue); 552 - 553 - pal[regno] = val; 554 - ret = 0; 555 - } 556 - break; 557 - 558 - case FB_VISUAL_STATIC_PSEUDOCOLOR: 559 - case FB_VISUAL_PSEUDOCOLOR: 560 - break; 561 - } 562 - 563 - return ret; 564 - } 565 - 566 - static int mxsfb_blank(int blank, struct fb_info *fb_info) 567 - { 568 - struct mxsfb_info *host = fb_info->par; 569 - 570 - switch (blank) { 571 - case FB_BLANK_POWERDOWN: 572 - case FB_BLANK_VSYNC_SUSPEND: 573 - case FB_BLANK_HSYNC_SUSPEND: 574 - case FB_BLANK_NORMAL: 575 - if (host->enabled) 576 - mxsfb_disable_controller(fb_info); 577 - break; 578 - 579 - case FB_BLANK_UNBLANK: 580 - if (!host->enabled) 581 - mxsfb_enable_controller(fb_info); 582 - break; 583 - } 584 - return 0; 585 - } 586 - 587 - static int mxsfb_pan_display(struct fb_var_screeninfo *var, 588 - struct fb_info *fb_info) 589 - { 590 - struct mxsfb_info *host = fb_info->par; 591 - unsigned offset; 592 - 593 - if (var->xoffset != 0) 594 - return -EINVAL; 595 - 596 - offset = fb_info->fix.line_length * var->yoffset; 597 - 598 - mxsfb_enable_axi_clk(host); 599 - 600 - /* update on next VSYNC */ 601 - writel(fb_info->fix.smem_start + offset, 602 - host->base + host->devdata->next_buf); 603 - 604 - mxsfb_disable_axi_clk(host); 605 - 606 - return 0; 607 - } 608 - 609 - static struct fb_ops mxsfb_ops = { 610 - .owner = THIS_MODULE, 611 - .fb_check_var = mxsfb_check_var, 612 - .fb_set_par = mxsfb_set_par, 613 - .fb_setcolreg = mxsfb_setcolreg, 614 - .fb_blank = mxsfb_blank, 615 - .fb_pan_display = mxsfb_pan_display, 616 - .fb_fillrect = cfb_fillrect, 617 - .fb_copyarea = cfb_copyarea, 618 - .fb_imageblit = cfb_imageblit, 619 - }; 620 - 621 - static int mxsfb_restore_mode(struct fb_info *fb_info, 622 - struct fb_videomode *vmode) 623 - { 624 - struct mxsfb_info *host = fb_info->par; 625 - unsigned period; 626 - unsigned long pa, fbsize; 627 - int bits_per_pixel, ofs, ret = 0; 628 - u32 transfer_count, vdctrl0, vdctrl2, vdctrl3, vdctrl4, ctrl; 629 - 630 - mxsfb_enable_axi_clk(host); 631 - 632 - /* Only restore the mode when the controller is running */ 633 - ctrl = readl(host->base + LCDC_CTRL); 634 - if (!(ctrl & CTRL_RUN)) { 635 - ret = -EINVAL; 636 - goto err; 637 - } 638 - 639 - vdctrl0 = readl(host->base + LCDC_VDCTRL0); 640 - vdctrl2 = readl(host->base + LCDC_VDCTRL2); 641 - vdctrl3 = readl(host->base + LCDC_VDCTRL3); 642 - vdctrl4 = readl(host->base + LCDC_VDCTRL4); 643 - 644 - transfer_count = readl(host->base + host->devdata->transfer_count); 645 - 646 - vmode->xres = TRANSFER_COUNT_GET_HCOUNT(transfer_count); 647 - vmode->yres = TRANSFER_COUNT_GET_VCOUNT(transfer_count); 648 - 649 - switch (CTRL_GET_WORD_LENGTH(ctrl)) { 650 - case 0: 651 - bits_per_pixel = 16; 652 - break; 653 - case 3: 654 - bits_per_pixel = 32; 655 - break; 656 - case 1: 657 - default: 658 - ret = -EINVAL; 659 - goto err; 660 - } 661 - 662 - fb_info->var.bits_per_pixel = bits_per_pixel; 663 - 664 - vmode->pixclock = KHZ2PICOS(clk_get_rate(host->clk) / 1000U); 665 - vmode->hsync_len = get_hsync_pulse_width(host, vdctrl2); 666 - vmode->left_margin = GET_HOR_WAIT_CNT(vdctrl3) - vmode->hsync_len; 667 - vmode->right_margin = VDCTRL2_GET_HSYNC_PERIOD(vdctrl2) - 668 - vmode->hsync_len - vmode->left_margin - vmode->xres; 669 - vmode->vsync_len = VDCTRL0_GET_VSYNC_PULSE_WIDTH(vdctrl0); 670 - period = readl(host->base + LCDC_VDCTRL1); 671 - vmode->upper_margin = GET_VERT_WAIT_CNT(vdctrl3) - vmode->vsync_len; 672 - vmode->lower_margin = period - vmode->vsync_len - 673 - vmode->upper_margin - vmode->yres; 674 - 675 - vmode->vmode = FB_VMODE_NONINTERLACED; 676 - 677 - vmode->sync = 0; 678 - if (vdctrl0 & VDCTRL0_HSYNC_ACT_HIGH) 679 - vmode->sync |= FB_SYNC_HOR_HIGH_ACT; 680 - if (vdctrl0 & VDCTRL0_VSYNC_ACT_HIGH) 681 - vmode->sync |= FB_SYNC_VERT_HIGH_ACT; 682 - 683 - pr_debug("Reconstructed video mode:\n"); 684 - pr_debug("%dx%d, hsync: %u left: %u, right: %u, vsync: %u, upper: %u, lower: %u\n", 685 - vmode->xres, vmode->yres, vmode->hsync_len, vmode->left_margin, 686 - vmode->right_margin, vmode->vsync_len, vmode->upper_margin, 687 - vmode->lower_margin); 688 - pr_debug("pixclk: %ldkHz\n", PICOS2KHZ(vmode->pixclock)); 689 - 690 - host->ld_intf_width = CTRL_GET_BUS_WIDTH(ctrl); 691 - host->dotclk_delay = VDCTRL4_GET_DOTCLK_DLY(vdctrl4); 692 - 693 - fb_info->fix.line_length = vmode->xres * (bits_per_pixel >> 3); 694 - 695 - pa = readl(host->base + host->devdata->cur_buf); 696 - fbsize = fb_info->fix.line_length * vmode->yres; 697 - if (pa < fb_info->fix.smem_start) { 698 - ret = -EINVAL; 699 - goto err; 700 - } 701 - if (pa + fbsize > fb_info->fix.smem_start + fb_info->fix.smem_len) { 702 - ret = -EINVAL; 703 - goto err; 704 - } 705 - ofs = pa - fb_info->fix.smem_start; 706 - if (ofs) { 707 - memmove(fb_info->screen_base, fb_info->screen_base + ofs, fbsize); 708 - writel(fb_info->fix.smem_start, host->base + host->devdata->next_buf); 709 - } 710 - 711 - fb_info->fix.ypanstep = 1; 712 - 713 - clk_prepare_enable(host->clk); 714 - host->enabled = 1; 715 - 716 - err: 717 - if (ret) 718 - mxsfb_disable_axi_clk(host); 719 - 720 - return ret; 721 - } 722 - 723 - static int mxsfb_init_fbinfo_dt(struct fb_info *fb_info, 724 - struct fb_videomode *vmode) 725 - { 726 - struct mxsfb_info *host = fb_info->par; 727 - struct fb_var_screeninfo *var = &fb_info->var; 728 - struct device *dev = &host->pdev->dev; 729 - struct device_node *np = host->pdev->dev.of_node; 730 - struct device_node *display_np; 731 - struct videomode vm; 732 - u32 width; 733 - int ret; 734 - 735 - display_np = of_parse_phandle(np, "display", 0); 736 - if (!display_np) { 737 - dev_err(dev, "failed to find display phandle\n"); 738 - return -ENOENT; 739 - } 740 - 741 - ret = of_property_read_u32(display_np, "bus-width", &width); 742 - if (ret < 0) { 743 - dev_err(dev, "failed to get property bus-width\n"); 744 - goto put_display_node; 745 - } 746 - 747 - switch (width) { 748 - case 8: 749 - host->ld_intf_width = STMLCDIF_8BIT; 750 - break; 751 - case 16: 752 - host->ld_intf_width = STMLCDIF_16BIT; 753 - break; 754 - case 18: 755 - host->ld_intf_width = STMLCDIF_18BIT; 756 - break; 757 - case 24: 758 - host->ld_intf_width = STMLCDIF_24BIT; 759 - break; 760 - default: 761 - dev_err(dev, "invalid bus-width value\n"); 762 - ret = -EINVAL; 763 - goto put_display_node; 764 - } 765 - 766 - ret = of_property_read_u32(display_np, "bits-per-pixel", 767 - &var->bits_per_pixel); 768 - if (ret < 0) { 769 - dev_err(dev, "failed to get property bits-per-pixel\n"); 770 - goto put_display_node; 771 - } 772 - 773 - ret = of_get_videomode(display_np, &vm, OF_USE_NATIVE_MODE); 774 - if (ret) { 775 - dev_err(dev, "failed to get videomode from DT\n"); 776 - goto put_display_node; 777 - } 778 - 779 - ret = fb_videomode_from_videomode(&vm, vmode); 780 - if (ret < 0) 781 - goto put_display_node; 782 - 783 - if (vm.flags & DISPLAY_FLAGS_DE_HIGH) 784 - host->sync |= MXSFB_SYNC_DATA_ENABLE_HIGH_ACT; 785 - 786 - /* 787 - * The PIXDATA flags of the display_flags enum are controller 788 - * centric, e.g. NEGEDGE means drive data on negative edge. 789 - * However, the drivers flag is display centric: Sample the 790 - * data on negative (falling) edge. Therefore, check for the 791 - * POSEDGE flag: 792 - * drive on positive edge => sample on negative edge 793 - */ 794 - if (vm.flags & DISPLAY_FLAGS_PIXDATA_POSEDGE) 795 - host->sync |= MXSFB_SYNC_DOTCLK_FALLING_ACT; 796 - 797 - put_display_node: 798 - of_node_put(display_np); 799 - return ret; 800 - } 801 - 802 - static int mxsfb_init_fbinfo(struct fb_info *fb_info, 803 - struct fb_videomode *vmode) 804 - { 805 - int ret; 806 - struct mxsfb_info *host = fb_info->par; 807 - struct device *dev = &host->pdev->dev; 808 - struct fb_var_screeninfo *var = &fb_info->var; 809 - dma_addr_t fb_phys; 810 - void *fb_virt; 811 - unsigned fb_size; 812 - 813 - fb_info->fbops = &mxsfb_ops; 814 - fb_info->flags = FBINFO_FLAG_DEFAULT | FBINFO_READS_FAST; 815 - strlcpy(fb_info->fix.id, "mxs", sizeof(fb_info->fix.id)); 816 - fb_info->fix.type = FB_TYPE_PACKED_PIXELS; 817 - fb_info->fix.ypanstep = 1; 818 - fb_info->fix.visual = FB_VISUAL_TRUECOLOR, 819 - fb_info->fix.accel = FB_ACCEL_NONE; 820 - 821 - ret = mxsfb_init_fbinfo_dt(fb_info, vmode); 822 - if (ret) 823 - return ret; 824 - 825 - var->nonstd = 0; 826 - var->activate = FB_ACTIVATE_NOW; 827 - var->accel_flags = 0; 828 - var->vmode = FB_VMODE_NONINTERLACED; 829 - 830 - /* Memory allocation for framebuffer */ 831 - fb_size = SZ_2M; 832 - fb_virt = dma_alloc_wc(dev, PAGE_ALIGN(fb_size), &fb_phys, GFP_KERNEL); 833 - if (!fb_virt) 834 - return -ENOMEM; 835 - 836 - fb_info->fix.smem_start = fb_phys; 837 - fb_info->screen_base = fb_virt; 838 - fb_info->screen_size = fb_info->fix.smem_len = fb_size; 839 - 840 - if (mxsfb_restore_mode(fb_info, vmode)) 841 - memset(fb_virt, 0, fb_size); 842 - 843 - return 0; 844 - } 845 - 846 - static void mxsfb_free_videomem(struct fb_info *fb_info) 847 - { 848 - struct mxsfb_info *host = fb_info->par; 849 - struct device *dev = &host->pdev->dev; 850 - 851 - dma_free_wc(dev, fb_info->screen_size, fb_info->screen_base, 852 - fb_info->fix.smem_start); 853 - } 854 - 855 - static const struct platform_device_id mxsfb_devtype[] = { 856 - { 857 - .name = "imx23-fb", 858 - .driver_data = MXSFB_V3, 859 - }, { 860 - .name = "imx28-fb", 861 - .driver_data = MXSFB_V4, 862 - }, { 863 - /* sentinel */ 864 - } 865 - }; 866 - MODULE_DEVICE_TABLE(platform, mxsfb_devtype); 867 - 868 - static const struct of_device_id mxsfb_dt_ids[] = { 869 - { .compatible = "fsl,imx23-lcdif", .data = &mxsfb_devtype[0], }, 870 - { .compatible = "fsl,imx28-lcdif", .data = &mxsfb_devtype[1], }, 871 - { /* sentinel */ } 872 - }; 873 - MODULE_DEVICE_TABLE(of, mxsfb_dt_ids); 874 - 875 - static int mxsfb_probe(struct platform_device *pdev) 876 - { 877 - const struct of_device_id *of_id = 878 - of_match_device(mxsfb_dt_ids, &pdev->dev); 879 - struct resource *res; 880 - struct mxsfb_info *host; 881 - struct fb_info *fb_info; 882 - struct fb_videomode *mode; 883 - int ret; 884 - 885 - if (of_id) 886 - pdev->id_entry = of_id->data; 887 - 888 - fb_info = framebuffer_alloc(sizeof(struct mxsfb_info), &pdev->dev); 889 - if (!fb_info) { 890 - dev_err(&pdev->dev, "Failed to allocate fbdev\n"); 891 - return -ENOMEM; 892 - } 893 - 894 - mode = devm_kzalloc(&pdev->dev, sizeof(struct fb_videomode), 895 - GFP_KERNEL); 896 - if (mode == NULL) 897 - return -ENOMEM; 898 - 899 - host = fb_info->par; 900 - 901 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 902 - host->base = devm_ioremap_resource(&pdev->dev, res); 903 - if (IS_ERR(host->base)) { 904 - ret = PTR_ERR(host->base); 905 - goto fb_release; 906 - } 907 - 908 - host->pdev = pdev; 909 - platform_set_drvdata(pdev, host); 910 - 911 - host->devdata = &mxsfb_devdata[pdev->id_entry->driver_data]; 912 - 913 - host->clk = devm_clk_get(&host->pdev->dev, NULL); 914 - if (IS_ERR(host->clk)) { 915 - ret = PTR_ERR(host->clk); 916 - goto fb_release; 917 - } 918 - 919 - host->clk_axi = devm_clk_get(&host->pdev->dev, "axi"); 920 - if (IS_ERR(host->clk_axi)) 921 - host->clk_axi = NULL; 922 - 923 - host->clk_disp_axi = devm_clk_get(&host->pdev->dev, "disp_axi"); 924 - if (IS_ERR(host->clk_disp_axi)) 925 - host->clk_disp_axi = NULL; 926 - 927 - host->reg_lcd = devm_regulator_get(&pdev->dev, "lcd"); 928 - if (IS_ERR(host->reg_lcd)) 929 - host->reg_lcd = NULL; 930 - 931 - #if defined(CONFIG_FB_PRE_INIT_FB) 932 - host->pre_init = 1; 933 - #endif 934 - 935 - fb_info->pseudo_palette = devm_kcalloc(&pdev->dev, 16, sizeof(u32), 936 - GFP_KERNEL); 937 - if (!fb_info->pseudo_palette) { 938 - ret = -ENOMEM; 939 - goto fb_release; 940 - } 941 - 942 - ret = mxsfb_init_fbinfo(fb_info, mode); 943 - if (ret != 0) 944 - goto fb_release; 945 - 946 - fb_videomode_to_var(&fb_info->var, mode); 947 - 948 - /* init the color fields */ 949 - mxsfb_check_var(&fb_info->var, fb_info); 950 - 951 - platform_set_drvdata(pdev, fb_info); 952 - 953 - ret = register_framebuffer(fb_info); 954 - if (ret != 0) { 955 - dev_err(&pdev->dev,"Failed to register framebuffer\n"); 956 - goto fb_destroy; 957 - } 958 - 959 - if (!host->enabled) { 960 - mxsfb_enable_axi_clk(host); 961 - writel(0, host->base + LCDC_CTRL); 962 - mxsfb_disable_axi_clk(host); 963 - mxsfb_set_par(fb_info); 964 - mxsfb_enable_controller(fb_info); 965 - } 966 - 967 - host->pre_init = 0; 968 - dev_info(&pdev->dev, "initialized\n"); 969 - 970 - return 0; 971 - 972 - fb_destroy: 973 - if (host->enabled) 974 - clk_disable_unprepare(host->clk); 975 - fb_release: 976 - framebuffer_release(fb_info); 977 - 978 - return ret; 979 - } 980 - 981 - static int mxsfb_remove(struct platform_device *pdev) 982 - { 983 - struct fb_info *fb_info = platform_get_drvdata(pdev); 984 - struct mxsfb_info *host = fb_info->par; 985 - 986 - if (host->enabled) 987 - mxsfb_disable_controller(fb_info); 988 - 989 - unregister_framebuffer(fb_info); 990 - mxsfb_free_videomem(fb_info); 991 - 992 - framebuffer_release(fb_info); 993 - 994 - return 0; 995 - } 996 - 997 - static void mxsfb_shutdown(struct platform_device *pdev) 998 - { 999 - struct fb_info *fb_info = platform_get_drvdata(pdev); 1000 - struct mxsfb_info *host = fb_info->par; 1001 - 1002 - mxsfb_enable_axi_clk(host); 1003 - 1004 - /* 1005 - * Force stop the LCD controller as keeping it running during reboot 1006 - * might interfere with the BootROM's boot mode pads sampling. 1007 - */ 1008 - writel(CTRL_RUN, host->base + LCDC_CTRL + REG_CLR); 1009 - 1010 - mxsfb_disable_axi_clk(host); 1011 - } 1012 - 1013 - static struct platform_driver mxsfb_driver = { 1014 - .probe = mxsfb_probe, 1015 - .remove = mxsfb_remove, 1016 - .shutdown = mxsfb_shutdown, 1017 - .id_table = mxsfb_devtype, 1018 - .driver = { 1019 - .name = DRIVER_NAME, 1020 - .of_match_table = mxsfb_dt_ids, 1021 - }, 1022 - }; 1023 - 1024 - module_platform_driver(mxsfb_driver); 1025 - 1026 - MODULE_DESCRIPTION("Freescale mxs framebuffer driver"); 1027 - MODULE_AUTHOR("Sascha Hauer, Pengutronix"); 1028 - MODULE_LICENSE("GPL");
+1 -8
drivers/video/fbdev/neofb.c
··· 2122 2122 DBG("neofb_remove"); 2123 2123 2124 2124 if (info) { 2125 - /* 2126 - * If unregister_framebuffer fails, then 2127 - * we will be leaving hooks that could cause 2128 - * oopsen laying around. 2129 - */ 2130 - if (unregister_framebuffer(info)) 2131 - printk(KERN_WARNING 2132 - "neofb: danger danger! Oopsen imminent!\n"); 2125 + unregister_framebuffer(info); 2133 2126 2134 2127 neo_unmap_video(info); 2135 2128 fb_destroy_modedb(info->monspecs.modedb);
-2
drivers/video/fbdev/omap/omapfb_main.c
··· 1502 1502 fbi = framebuffer_alloc(sizeof(struct omapfb_plane_struct), 1503 1503 fbdev->dev); 1504 1504 if (fbi == NULL) { 1505 - dev_err(fbdev->dev, 1506 - "unable to allocate memory for plane info\n"); 1507 1505 planes_cleanup(fbdev); 1508 1506 return -ENOMEM; 1509 1507 }
-12
drivers/video/fbdev/omap2/omapfb/dss/Kconfig
··· 39 39 help 40 40 DPI Interface. This is the Parallel Display Interface. 41 41 42 - config FB_OMAP2_DSS_RFBI 43 - bool "RFBI support" 44 - depends on BROKEN 45 - help 46 - MIPI DBI support (RFBI, Remote Framebuffer Interface, in Texas 47 - Instrument's terminology). 48 - 49 - DBI is a bus between the host processor and a peripheral, 50 - such as a display or a framebuffer chip. 51 - 52 - See http://www.mipi.org/ for DBI specifications. 53 - 54 42 config FB_OMAP2_DSS_VENC 55 43 bool "VENC support" 56 44 default y
-1
drivers/video/fbdev/omap2/omapfb/dss/Makefile
··· 8 8 omapdss-y += manager.o manager-sysfs.o overlay.o overlay-sysfs.o apply.o \ 9 9 dispc-compat.o display-sysfs.o 10 10 omapdss-$(CONFIG_FB_OMAP2_DSS_DPI) += dpi.o 11 - omapdss-$(CONFIG_FB_OMAP2_DSS_RFBI) += rfbi.o 12 11 omapdss-$(CONFIG_FB_OMAP2_DSS_VENC) += venc.o 13 12 omapdss-$(CONFIG_FB_OMAP2_DSS_SDI) += sdi.o 14 13 omapdss-$(CONFIG_FB_OMAP2_DSS_DSI) += dsi.o
-6
drivers/video/fbdev/omap2/omapfb/dss/core.c
··· 207 207 #ifdef CONFIG_FB_OMAP2_DSS_SDI 208 208 sdi_init_platform_driver, 209 209 #endif 210 - #ifdef CONFIG_FB_OMAP2_DSS_RFBI 211 - rfbi_init_platform_driver, 212 - #endif 213 210 #ifdef CONFIG_FB_OMAP2_DSS_VENC 214 211 venc_init_platform_driver, 215 212 #endif ··· 227 230 #endif 228 231 #ifdef CONFIG_FB_OMAP2_DSS_VENC 229 232 venc_uninit_platform_driver, 230 - #endif 231 - #ifdef CONFIG_FB_OMAP2_DSS_RFBI 232 - rfbi_uninit_platform_driver, 233 233 #endif 234 234 #ifdef CONFIG_FB_OMAP2_DSS_SDI 235 235 sdi_uninit_platform_driver,
-4
drivers/video/fbdev/omap2/omapfb/dss/dss.h
··· 461 461 int hdmi5_init_platform_driver(void) __init; 462 462 void hdmi5_uninit_platform_driver(void); 463 463 464 - /* RFBI */ 465 - int rfbi_init_platform_driver(void) __init; 466 - void rfbi_uninit_platform_driver(void); 467 - 468 464 469 465 #ifdef CONFIG_FB_OMAP2_DSS_COLLECT_IRQ_STATS 470 466 static inline void dss_collect_irq_stats(u32 irqstatus, unsigned *irq_arr)
-1067
drivers/video/fbdev/omap2/omapfb/dss/rfbi.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * linux/drivers/video/omap2/dss/rfbi.c 4 - * 5 - * Copyright (C) 2009 Nokia Corporation 6 - * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com> 7 - * 8 - * Some code and ideas taken from drivers/video/omap/ driver 9 - * by Imre Deak. 10 - */ 11 - 12 - #define DSS_SUBSYS_NAME "RFBI" 13 - 14 - #include <linux/kernel.h> 15 - #include <linux/dma-mapping.h> 16 - #include <linux/export.h> 17 - #include <linux/vmalloc.h> 18 - #include <linux/clk.h> 19 - #include <linux/io.h> 20 - #include <linux/delay.h> 21 - #include <linux/kfifo.h> 22 - #include <linux/ktime.h> 23 - #include <linux/hrtimer.h> 24 - #include <linux/seq_file.h> 25 - #include <linux/semaphore.h> 26 - #include <linux/platform_device.h> 27 - #include <linux/pm_runtime.h> 28 - #include <linux/component.h> 29 - 30 - #include <video/omapfb_dss.h> 31 - #include "dss.h" 32 - 33 - struct rfbi_reg { u16 idx; }; 34 - 35 - #define RFBI_REG(idx) ((const struct rfbi_reg) { idx }) 36 - 37 - #define RFBI_REVISION RFBI_REG(0x0000) 38 - #define RFBI_SYSCONFIG RFBI_REG(0x0010) 39 - #define RFBI_SYSSTATUS RFBI_REG(0x0014) 40 - #define RFBI_CONTROL RFBI_REG(0x0040) 41 - #define RFBI_PIXEL_CNT RFBI_REG(0x0044) 42 - #define RFBI_LINE_NUMBER RFBI_REG(0x0048) 43 - #define RFBI_CMD RFBI_REG(0x004c) 44 - #define RFBI_PARAM RFBI_REG(0x0050) 45 - #define RFBI_DATA RFBI_REG(0x0054) 46 - #define RFBI_READ RFBI_REG(0x0058) 47 - #define RFBI_STATUS RFBI_REG(0x005c) 48 - 49 - #define RFBI_CONFIG(n) RFBI_REG(0x0060 + (n)*0x18) 50 - #define RFBI_ONOFF_TIME(n) RFBI_REG(0x0064 + (n)*0x18) 51 - #define RFBI_CYCLE_TIME(n) RFBI_REG(0x0068 + (n)*0x18) 52 - #define RFBI_DATA_CYCLE1(n) RFBI_REG(0x006c + (n)*0x18) 53 - #define RFBI_DATA_CYCLE2(n) RFBI_REG(0x0070 + (n)*0x18) 54 - #define RFBI_DATA_CYCLE3(n) RFBI_REG(0x0074 + (n)*0x18) 55 - 56 - #define RFBI_VSYNC_WIDTH RFBI_REG(0x0090) 57 - #define RFBI_HSYNC_WIDTH RFBI_REG(0x0094) 58 - 59 - #define REG_FLD_MOD(idx, val, start, end) \ 60 - rfbi_write_reg(idx, FLD_MOD(rfbi_read_reg(idx), val, start, end)) 61 - 62 - enum omap_rfbi_cycleformat { 63 - OMAP_DSS_RFBI_CYCLEFORMAT_1_1 = 0, 64 - OMAP_DSS_RFBI_CYCLEFORMAT_2_1 = 1, 65 - OMAP_DSS_RFBI_CYCLEFORMAT_3_1 = 2, 66 - OMAP_DSS_RFBI_CYCLEFORMAT_3_2 = 3, 67 - }; 68 - 69 - enum omap_rfbi_datatype { 70 - OMAP_DSS_RFBI_DATATYPE_12 = 0, 71 - OMAP_DSS_RFBI_DATATYPE_16 = 1, 72 - OMAP_DSS_RFBI_DATATYPE_18 = 2, 73 - OMAP_DSS_RFBI_DATATYPE_24 = 3, 74 - }; 75 - 76 - enum omap_rfbi_parallelmode { 77 - OMAP_DSS_RFBI_PARALLELMODE_8 = 0, 78 - OMAP_DSS_RFBI_PARALLELMODE_9 = 1, 79 - OMAP_DSS_RFBI_PARALLELMODE_12 = 2, 80 - OMAP_DSS_RFBI_PARALLELMODE_16 = 3, 81 - }; 82 - 83 - static int rfbi_convert_timings(struct rfbi_timings *t); 84 - static void rfbi_get_clk_info(u32 *clk_period, u32 *max_clk_div); 85 - 86 - static struct { 87 - struct platform_device *pdev; 88 - void __iomem *base; 89 - 90 - unsigned long l4_khz; 91 - 92 - enum omap_rfbi_datatype datatype; 93 - enum omap_rfbi_parallelmode parallelmode; 94 - 95 - enum omap_rfbi_te_mode te_mode; 96 - int te_enabled; 97 - 98 - void (*framedone_callback)(void *data); 99 - void *framedone_callback_data; 100 - 101 - struct omap_dss_device *dssdev[2]; 102 - 103 - struct semaphore bus_lock; 104 - 105 - struct omap_video_timings timings; 106 - int pixel_size; 107 - int data_lines; 108 - struct rfbi_timings intf_timings; 109 - 110 - struct omap_dss_device output; 111 - } rfbi; 112 - 113 - static inline void rfbi_write_reg(const struct rfbi_reg idx, u32 val) 114 - { 115 - __raw_writel(val, rfbi.base + idx.idx); 116 - } 117 - 118 - static inline u32 rfbi_read_reg(const struct rfbi_reg idx) 119 - { 120 - return __raw_readl(rfbi.base + idx.idx); 121 - } 122 - 123 - static int rfbi_runtime_get(void) 124 - { 125 - int r; 126 - 127 - DSSDBG("rfbi_runtime_get\n"); 128 - 129 - r = pm_runtime_get_sync(&rfbi.pdev->dev); 130 - WARN_ON(r < 0); 131 - return r < 0 ? r : 0; 132 - } 133 - 134 - static void rfbi_runtime_put(void) 135 - { 136 - int r; 137 - 138 - DSSDBG("rfbi_runtime_put\n"); 139 - 140 - r = pm_runtime_put_sync(&rfbi.pdev->dev); 141 - WARN_ON(r < 0 && r != -ENOSYS); 142 - } 143 - 144 - static void rfbi_bus_lock(void) 145 - { 146 - down(&rfbi.bus_lock); 147 - } 148 - 149 - static void rfbi_bus_unlock(void) 150 - { 151 - up(&rfbi.bus_lock); 152 - } 153 - 154 - static void rfbi_write_command(const void *buf, u32 len) 155 - { 156 - switch (rfbi.parallelmode) { 157 - case OMAP_DSS_RFBI_PARALLELMODE_8: 158 - { 159 - const u8 *b = buf; 160 - for (; len; len--) 161 - rfbi_write_reg(RFBI_CMD, *b++); 162 - break; 163 - } 164 - 165 - case OMAP_DSS_RFBI_PARALLELMODE_16: 166 - { 167 - const u16 *w = buf; 168 - BUG_ON(len & 1); 169 - for (; len; len -= 2) 170 - rfbi_write_reg(RFBI_CMD, *w++); 171 - break; 172 - } 173 - 174 - case OMAP_DSS_RFBI_PARALLELMODE_9: 175 - case OMAP_DSS_RFBI_PARALLELMODE_12: 176 - default: 177 - BUG(); 178 - } 179 - } 180 - 181 - static void rfbi_read_data(void *buf, u32 len) 182 - { 183 - switch (rfbi.parallelmode) { 184 - case OMAP_DSS_RFBI_PARALLELMODE_8: 185 - { 186 - u8 *b = buf; 187 - for (; len; len--) { 188 - rfbi_write_reg(RFBI_READ, 0); 189 - *b++ = rfbi_read_reg(RFBI_READ); 190 - } 191 - break; 192 - } 193 - 194 - case OMAP_DSS_RFBI_PARALLELMODE_16: 195 - { 196 - u16 *w = buf; 197 - BUG_ON(len & ~1); 198 - for (; len; len -= 2) { 199 - rfbi_write_reg(RFBI_READ, 0); 200 - *w++ = rfbi_read_reg(RFBI_READ); 201 - } 202 - break; 203 - } 204 - 205 - case OMAP_DSS_RFBI_PARALLELMODE_9: 206 - case OMAP_DSS_RFBI_PARALLELMODE_12: 207 - default: 208 - BUG(); 209 - } 210 - } 211 - 212 - static void rfbi_write_data(const void *buf, u32 len) 213 - { 214 - switch (rfbi.parallelmode) { 215 - case OMAP_DSS_RFBI_PARALLELMODE_8: 216 - { 217 - const u8 *b = buf; 218 - for (; len; len--) 219 - rfbi_write_reg(RFBI_PARAM, *b++); 220 - break; 221 - } 222 - 223 - case OMAP_DSS_RFBI_PARALLELMODE_16: 224 - { 225 - const u16 *w = buf; 226 - BUG_ON(len & 1); 227 - for (; len; len -= 2) 228 - rfbi_write_reg(RFBI_PARAM, *w++); 229 - break; 230 - } 231 - 232 - case OMAP_DSS_RFBI_PARALLELMODE_9: 233 - case OMAP_DSS_RFBI_PARALLELMODE_12: 234 - default: 235 - BUG(); 236 - 237 - } 238 - } 239 - 240 - static void rfbi_write_pixels(const void __iomem *buf, int scr_width, 241 - u16 x, u16 y, 242 - u16 w, u16 h) 243 - { 244 - int start_offset = scr_width * y + x; 245 - int horiz_offset = scr_width - w; 246 - int i; 247 - 248 - if (rfbi.datatype == OMAP_DSS_RFBI_DATATYPE_16 && 249 - rfbi.parallelmode == OMAP_DSS_RFBI_PARALLELMODE_8) { 250 - const u16 __iomem *pd = buf; 251 - pd += start_offset; 252 - 253 - for (; h; --h) { 254 - for (i = 0; i < w; ++i) { 255 - const u8 __iomem *b = (const u8 __iomem *)pd; 256 - rfbi_write_reg(RFBI_PARAM, __raw_readb(b+1)); 257 - rfbi_write_reg(RFBI_PARAM, __raw_readb(b+0)); 258 - ++pd; 259 - } 260 - pd += horiz_offset; 261 - } 262 - } else if (rfbi.datatype == OMAP_DSS_RFBI_DATATYPE_24 && 263 - rfbi.parallelmode == OMAP_DSS_RFBI_PARALLELMODE_8) { 264 - const u32 __iomem *pd = buf; 265 - pd += start_offset; 266 - 267 - for (; h; --h) { 268 - for (i = 0; i < w; ++i) { 269 - const u8 __iomem *b = (const u8 __iomem *)pd; 270 - rfbi_write_reg(RFBI_PARAM, __raw_readb(b+2)); 271 - rfbi_write_reg(RFBI_PARAM, __raw_readb(b+1)); 272 - rfbi_write_reg(RFBI_PARAM, __raw_readb(b+0)); 273 - ++pd; 274 - } 275 - pd += horiz_offset; 276 - } 277 - } else if (rfbi.datatype == OMAP_DSS_RFBI_DATATYPE_16 && 278 - rfbi.parallelmode == OMAP_DSS_RFBI_PARALLELMODE_16) { 279 - const u16 __iomem *pd = buf; 280 - pd += start_offset; 281 - 282 - for (; h; --h) { 283 - for (i = 0; i < w; ++i) { 284 - rfbi_write_reg(RFBI_PARAM, __raw_readw(pd)); 285 - ++pd; 286 - } 287 - pd += horiz_offset; 288 - } 289 - } else { 290 - BUG(); 291 - } 292 - } 293 - 294 - static int rfbi_transfer_area(struct omap_dss_device *dssdev, 295 - void (*callback)(void *data), void *data) 296 - { 297 - u32 l; 298 - int r; 299 - struct omap_overlay_manager *mgr = rfbi.output.manager; 300 - u16 width = rfbi.timings.x_res; 301 - u16 height = rfbi.timings.y_res; 302 - 303 - /*BUG_ON(callback == 0);*/ 304 - BUG_ON(rfbi.framedone_callback != NULL); 305 - 306 - DSSDBG("rfbi_transfer_area %dx%d\n", width, height); 307 - 308 - dss_mgr_set_timings(mgr, &rfbi.timings); 309 - 310 - r = dss_mgr_enable(mgr); 311 - if (r) 312 - return r; 313 - 314 - rfbi.framedone_callback = callback; 315 - rfbi.framedone_callback_data = data; 316 - 317 - rfbi_write_reg(RFBI_PIXEL_CNT, width * height); 318 - 319 - l = rfbi_read_reg(RFBI_CONTROL); 320 - l = FLD_MOD(l, 1, 0, 0); /* enable */ 321 - if (!rfbi.te_enabled) 322 - l = FLD_MOD(l, 1, 4, 4); /* ITE */ 323 - 324 - rfbi_write_reg(RFBI_CONTROL, l); 325 - 326 - return 0; 327 - } 328 - 329 - static void framedone_callback(void *data) 330 - { 331 - void (*callback)(void *data); 332 - 333 - DSSDBG("FRAMEDONE\n"); 334 - 335 - REG_FLD_MOD(RFBI_CONTROL, 0, 0, 0); 336 - 337 - callback = rfbi.framedone_callback; 338 - rfbi.framedone_callback = NULL; 339 - 340 - if (callback != NULL) 341 - callback(rfbi.framedone_callback_data); 342 - } 343 - 344 - #if 1 /* VERBOSE */ 345 - static void rfbi_print_timings(void) 346 - { 347 - u32 l; 348 - u32 time; 349 - 350 - l = rfbi_read_reg(RFBI_CONFIG(0)); 351 - time = 1000000000 / rfbi.l4_khz; 352 - if (l & (1 << 4)) 353 - time *= 2; 354 - 355 - DSSDBG("Tick time %u ps\n", time); 356 - l = rfbi_read_reg(RFBI_ONOFF_TIME(0)); 357 - DSSDBG("CSONTIME %d, CSOFFTIME %d, WEONTIME %d, WEOFFTIME %d, " 358 - "REONTIME %d, REOFFTIME %d\n", 359 - l & 0x0f, (l >> 4) & 0x3f, (l >> 10) & 0x0f, (l >> 14) & 0x3f, 360 - (l >> 20) & 0x0f, (l >> 24) & 0x3f); 361 - 362 - l = rfbi_read_reg(RFBI_CYCLE_TIME(0)); 363 - DSSDBG("WECYCLETIME %d, RECYCLETIME %d, CSPULSEWIDTH %d, " 364 - "ACCESSTIME %d\n", 365 - (l & 0x3f), (l >> 6) & 0x3f, (l >> 12) & 0x3f, 366 - (l >> 22) & 0x3f); 367 - } 368 - #else 369 - static void rfbi_print_timings(void) {} 370 - #endif 371 - 372 - 373 - 374 - 375 - static u32 extif_clk_period; 376 - 377 - static inline unsigned long round_to_extif_ticks(unsigned long ps, int div) 378 - { 379 - int bus_tick = extif_clk_period * div; 380 - return (ps + bus_tick - 1) / bus_tick * bus_tick; 381 - } 382 - 383 - static int calc_reg_timing(struct rfbi_timings *t, int div) 384 - { 385 - t->clk_div = div; 386 - 387 - t->cs_on_time = round_to_extif_ticks(t->cs_on_time, div); 388 - 389 - t->we_on_time = round_to_extif_ticks(t->we_on_time, div); 390 - t->we_off_time = round_to_extif_ticks(t->we_off_time, div); 391 - t->we_cycle_time = round_to_extif_ticks(t->we_cycle_time, div); 392 - 393 - t->re_on_time = round_to_extif_ticks(t->re_on_time, div); 394 - t->re_off_time = round_to_extif_ticks(t->re_off_time, div); 395 - t->re_cycle_time = round_to_extif_ticks(t->re_cycle_time, div); 396 - 397 - t->access_time = round_to_extif_ticks(t->access_time, div); 398 - t->cs_off_time = round_to_extif_ticks(t->cs_off_time, div); 399 - t->cs_pulse_width = round_to_extif_ticks(t->cs_pulse_width, div); 400 - 401 - DSSDBG("[reg]cson %d csoff %d reon %d reoff %d\n", 402 - t->cs_on_time, t->cs_off_time, t->re_on_time, t->re_off_time); 403 - DSSDBG("[reg]weon %d weoff %d recyc %d wecyc %d\n", 404 - t->we_on_time, t->we_off_time, t->re_cycle_time, 405 - t->we_cycle_time); 406 - DSSDBG("[reg]rdaccess %d cspulse %d\n", 407 - t->access_time, t->cs_pulse_width); 408 - 409 - return rfbi_convert_timings(t); 410 - } 411 - 412 - static int calc_extif_timings(struct rfbi_timings *t) 413 - { 414 - u32 max_clk_div; 415 - int div; 416 - 417 - rfbi_get_clk_info(&extif_clk_period, &max_clk_div); 418 - for (div = 1; div <= max_clk_div; div++) { 419 - if (calc_reg_timing(t, div) == 0) 420 - break; 421 - } 422 - 423 - if (div <= max_clk_div) 424 - return 0; 425 - 426 - DSSERR("can't setup timings\n"); 427 - return -1; 428 - } 429 - 430 - 431 - static void rfbi_set_timings(int rfbi_module, struct rfbi_timings *t) 432 - { 433 - int r; 434 - 435 - if (!t->converted) { 436 - r = calc_extif_timings(t); 437 - if (r < 0) 438 - DSSERR("Failed to calc timings\n"); 439 - } 440 - 441 - BUG_ON(!t->converted); 442 - 443 - rfbi_write_reg(RFBI_ONOFF_TIME(rfbi_module), t->tim[0]); 444 - rfbi_write_reg(RFBI_CYCLE_TIME(rfbi_module), t->tim[1]); 445 - 446 - /* TIMEGRANULARITY */ 447 - REG_FLD_MOD(RFBI_CONFIG(rfbi_module), 448 - (t->tim[2] ? 1 : 0), 4, 4); 449 - 450 - rfbi_print_timings(); 451 - } 452 - 453 - static int ps_to_rfbi_ticks(int time, int div) 454 - { 455 - unsigned long tick_ps; 456 - int ret; 457 - 458 - /* Calculate in picosecs to yield more exact results */ 459 - tick_ps = 1000000000 / (rfbi.l4_khz) * div; 460 - 461 - ret = (time + tick_ps - 1) / tick_ps; 462 - 463 - return ret; 464 - } 465 - 466 - static void rfbi_get_clk_info(u32 *clk_period, u32 *max_clk_div) 467 - { 468 - *clk_period = 1000000000 / rfbi.l4_khz; 469 - *max_clk_div = 2; 470 - } 471 - 472 - static int rfbi_convert_timings(struct rfbi_timings *t) 473 - { 474 - u32 l; 475 - int reon, reoff, weon, weoff, cson, csoff, cs_pulse; 476 - int actim, recyc, wecyc; 477 - int div = t->clk_div; 478 - 479 - if (div <= 0 || div > 2) 480 - return -1; 481 - 482 - /* Make sure that after conversion it still holds that: 483 - * weoff > weon, reoff > reon, recyc >= reoff, wecyc >= weoff, 484 - * csoff > cson, csoff >= max(weoff, reoff), actim > reon 485 - */ 486 - weon = ps_to_rfbi_ticks(t->we_on_time, div); 487 - weoff = ps_to_rfbi_ticks(t->we_off_time, div); 488 - if (weoff <= weon) 489 - weoff = weon + 1; 490 - if (weon > 0x0f) 491 - return -1; 492 - if (weoff > 0x3f) 493 - return -1; 494 - 495 - reon = ps_to_rfbi_ticks(t->re_on_time, div); 496 - reoff = ps_to_rfbi_ticks(t->re_off_time, div); 497 - if (reoff <= reon) 498 - reoff = reon + 1; 499 - if (reon > 0x0f) 500 - return -1; 501 - if (reoff > 0x3f) 502 - return -1; 503 - 504 - cson = ps_to_rfbi_ticks(t->cs_on_time, div); 505 - csoff = ps_to_rfbi_ticks(t->cs_off_time, div); 506 - if (csoff <= cson) 507 - csoff = cson + 1; 508 - if (csoff < max(weoff, reoff)) 509 - csoff = max(weoff, reoff); 510 - if (cson > 0x0f) 511 - return -1; 512 - if (csoff > 0x3f) 513 - return -1; 514 - 515 - l = cson; 516 - l |= csoff << 4; 517 - l |= weon << 10; 518 - l |= weoff << 14; 519 - l |= reon << 20; 520 - l |= reoff << 24; 521 - 522 - t->tim[0] = l; 523 - 524 - actim = ps_to_rfbi_ticks(t->access_time, div); 525 - if (actim <= reon) 526 - actim = reon + 1; 527 - if (actim > 0x3f) 528 - return -1; 529 - 530 - wecyc = ps_to_rfbi_ticks(t->we_cycle_time, div); 531 - if (wecyc < weoff) 532 - wecyc = weoff; 533 - if (wecyc > 0x3f) 534 - return -1; 535 - 536 - recyc = ps_to_rfbi_ticks(t->re_cycle_time, div); 537 - if (recyc < reoff) 538 - recyc = reoff; 539 - if (recyc > 0x3f) 540 - return -1; 541 - 542 - cs_pulse = ps_to_rfbi_ticks(t->cs_pulse_width, div); 543 - if (cs_pulse > 0x3f) 544 - return -1; 545 - 546 - l = wecyc; 547 - l |= recyc << 6; 548 - l |= cs_pulse << 12; 549 - l |= actim << 22; 550 - 551 - t->tim[1] = l; 552 - 553 - t->tim[2] = div - 1; 554 - 555 - t->converted = 1; 556 - 557 - return 0; 558 - } 559 - 560 - /* xxx FIX module selection missing */ 561 - static int rfbi_setup_te(enum omap_rfbi_te_mode mode, 562 - unsigned hs_pulse_time, unsigned vs_pulse_time, 563 - int hs_pol_inv, int vs_pol_inv, int extif_div) 564 - { 565 - int hs, vs; 566 - int min; 567 - u32 l; 568 - 569 - hs = ps_to_rfbi_ticks(hs_pulse_time, 1); 570 - vs = ps_to_rfbi_ticks(vs_pulse_time, 1); 571 - if (hs < 2) 572 - return -EDOM; 573 - if (mode == OMAP_DSS_RFBI_TE_MODE_2) 574 - min = 2; 575 - else /* OMAP_DSS_RFBI_TE_MODE_1 */ 576 - min = 4; 577 - if (vs < min) 578 - return -EDOM; 579 - if (vs == hs) 580 - return -EINVAL; 581 - rfbi.te_mode = mode; 582 - DSSDBG("setup_te: mode %d hs %d vs %d hs_inv %d vs_inv %d\n", 583 - mode, hs, vs, hs_pol_inv, vs_pol_inv); 584 - 585 - rfbi_write_reg(RFBI_HSYNC_WIDTH, hs); 586 - rfbi_write_reg(RFBI_VSYNC_WIDTH, vs); 587 - 588 - l = rfbi_read_reg(RFBI_CONFIG(0)); 589 - if (hs_pol_inv) 590 - l &= ~(1 << 21); 591 - else 592 - l |= 1 << 21; 593 - if (vs_pol_inv) 594 - l &= ~(1 << 20); 595 - else 596 - l |= 1 << 20; 597 - 598 - return 0; 599 - } 600 - 601 - /* xxx FIX module selection missing */ 602 - static int rfbi_enable_te(bool enable, unsigned line) 603 - { 604 - u32 l; 605 - 606 - DSSDBG("te %d line %d mode %d\n", enable, line, rfbi.te_mode); 607 - if (line > (1 << 11) - 1) 608 - return -EINVAL; 609 - 610 - l = rfbi_read_reg(RFBI_CONFIG(0)); 611 - l &= ~(0x3 << 2); 612 - if (enable) { 613 - rfbi.te_enabled = 1; 614 - l |= rfbi.te_mode << 2; 615 - } else 616 - rfbi.te_enabled = 0; 617 - rfbi_write_reg(RFBI_CONFIG(0), l); 618 - rfbi_write_reg(RFBI_LINE_NUMBER, line); 619 - 620 - return 0; 621 - } 622 - 623 - static int rfbi_configure_bus(int rfbi_module, int bpp, int lines) 624 - { 625 - u32 l; 626 - int cycle1 = 0, cycle2 = 0, cycle3 = 0; 627 - enum omap_rfbi_cycleformat cycleformat; 628 - enum omap_rfbi_datatype datatype; 629 - enum omap_rfbi_parallelmode parallelmode; 630 - 631 - switch (bpp) { 632 - case 12: 633 - datatype = OMAP_DSS_RFBI_DATATYPE_12; 634 - break; 635 - case 16: 636 - datatype = OMAP_DSS_RFBI_DATATYPE_16; 637 - break; 638 - case 18: 639 - datatype = OMAP_DSS_RFBI_DATATYPE_18; 640 - break; 641 - case 24: 642 - datatype = OMAP_DSS_RFBI_DATATYPE_24; 643 - break; 644 - default: 645 - BUG(); 646 - return 1; 647 - } 648 - rfbi.datatype = datatype; 649 - 650 - switch (lines) { 651 - case 8: 652 - parallelmode = OMAP_DSS_RFBI_PARALLELMODE_8; 653 - break; 654 - case 9: 655 - parallelmode = OMAP_DSS_RFBI_PARALLELMODE_9; 656 - break; 657 - case 12: 658 - parallelmode = OMAP_DSS_RFBI_PARALLELMODE_12; 659 - break; 660 - case 16: 661 - parallelmode = OMAP_DSS_RFBI_PARALLELMODE_16; 662 - break; 663 - default: 664 - BUG(); 665 - return 1; 666 - } 667 - rfbi.parallelmode = parallelmode; 668 - 669 - if ((bpp % lines) == 0) { 670 - switch (bpp / lines) { 671 - case 1: 672 - cycleformat = OMAP_DSS_RFBI_CYCLEFORMAT_1_1; 673 - break; 674 - case 2: 675 - cycleformat = OMAP_DSS_RFBI_CYCLEFORMAT_2_1; 676 - break; 677 - case 3: 678 - cycleformat = OMAP_DSS_RFBI_CYCLEFORMAT_3_1; 679 - break; 680 - default: 681 - BUG(); 682 - return 1; 683 - } 684 - } else if ((2 * bpp % lines) == 0) { 685 - if ((2 * bpp / lines) == 3) 686 - cycleformat = OMAP_DSS_RFBI_CYCLEFORMAT_3_2; 687 - else { 688 - BUG(); 689 - return 1; 690 - } 691 - } else { 692 - BUG(); 693 - return 1; 694 - } 695 - 696 - switch (cycleformat) { 697 - case OMAP_DSS_RFBI_CYCLEFORMAT_1_1: 698 - cycle1 = lines; 699 - break; 700 - 701 - case OMAP_DSS_RFBI_CYCLEFORMAT_2_1: 702 - cycle1 = lines; 703 - cycle2 = lines; 704 - break; 705 - 706 - case OMAP_DSS_RFBI_CYCLEFORMAT_3_1: 707 - cycle1 = lines; 708 - cycle2 = lines; 709 - cycle3 = lines; 710 - break; 711 - 712 - case OMAP_DSS_RFBI_CYCLEFORMAT_3_2: 713 - cycle1 = lines; 714 - cycle2 = (lines / 2) | ((lines / 2) << 16); 715 - cycle3 = (lines << 16); 716 - break; 717 - } 718 - 719 - REG_FLD_MOD(RFBI_CONTROL, 0, 3, 2); /* clear CS */ 720 - 721 - l = 0; 722 - l |= FLD_VAL(parallelmode, 1, 0); 723 - l |= FLD_VAL(0, 3, 2); /* TRIGGERMODE: ITE */ 724 - l |= FLD_VAL(0, 4, 4); /* TIMEGRANULARITY */ 725 - l |= FLD_VAL(datatype, 6, 5); 726 - /* l |= FLD_VAL(2, 8, 7); */ /* L4FORMAT, 2pix/L4 */ 727 - l |= FLD_VAL(0, 8, 7); /* L4FORMAT, 1pix/L4 */ 728 - l |= FLD_VAL(cycleformat, 10, 9); 729 - l |= FLD_VAL(0, 12, 11); /* UNUSEDBITS */ 730 - l |= FLD_VAL(0, 16, 16); /* A0POLARITY */ 731 - l |= FLD_VAL(0, 17, 17); /* REPOLARITY */ 732 - l |= FLD_VAL(0, 18, 18); /* WEPOLARITY */ 733 - l |= FLD_VAL(0, 19, 19); /* CSPOLARITY */ 734 - l |= FLD_VAL(1, 20, 20); /* TE_VSYNC_POLARITY */ 735 - l |= FLD_VAL(1, 21, 21); /* HSYNCPOLARITY */ 736 - rfbi_write_reg(RFBI_CONFIG(rfbi_module), l); 737 - 738 - rfbi_write_reg(RFBI_DATA_CYCLE1(rfbi_module), cycle1); 739 - rfbi_write_reg(RFBI_DATA_CYCLE2(rfbi_module), cycle2); 740 - rfbi_write_reg(RFBI_DATA_CYCLE3(rfbi_module), cycle3); 741 - 742 - 743 - l = rfbi_read_reg(RFBI_CONTROL); 744 - l = FLD_MOD(l, rfbi_module+1, 3, 2); /* Select CSx */ 745 - l = FLD_MOD(l, 0, 1, 1); /* clear bypass */ 746 - rfbi_write_reg(RFBI_CONTROL, l); 747 - 748 - 749 - DSSDBG("RFBI config: bpp %d, lines %d, cycles: 0x%x 0x%x 0x%x\n", 750 - bpp, lines, cycle1, cycle2, cycle3); 751 - 752 - return 0; 753 - } 754 - 755 - static int rfbi_configure(struct omap_dss_device *dssdev) 756 - { 757 - return rfbi_configure_bus(dssdev->phy.rfbi.channel, rfbi.pixel_size, 758 - rfbi.data_lines); 759 - } 760 - 761 - static int rfbi_update(struct omap_dss_device *dssdev, void (*callback)(void *), 762 - void *data) 763 - { 764 - return rfbi_transfer_area(dssdev, callback, data); 765 - } 766 - 767 - static void rfbi_set_size(struct omap_dss_device *dssdev, u16 w, u16 h) 768 - { 769 - rfbi.timings.x_res = w; 770 - rfbi.timings.y_res = h; 771 - } 772 - 773 - static void rfbi_set_pixel_size(struct omap_dss_device *dssdev, int pixel_size) 774 - { 775 - rfbi.pixel_size = pixel_size; 776 - } 777 - 778 - static void rfbi_set_data_lines(struct omap_dss_device *dssdev, int data_lines) 779 - { 780 - rfbi.data_lines = data_lines; 781 - } 782 - 783 - static void rfbi_set_interface_timings(struct omap_dss_device *dssdev, 784 - struct rfbi_timings *timings) 785 - { 786 - rfbi.intf_timings = *timings; 787 - } 788 - 789 - static void rfbi_dump_regs(struct seq_file *s) 790 - { 791 - #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, rfbi_read_reg(r)) 792 - 793 - if (rfbi_runtime_get()) 794 - return; 795 - 796 - DUMPREG(RFBI_REVISION); 797 - DUMPREG(RFBI_SYSCONFIG); 798 - DUMPREG(RFBI_SYSSTATUS); 799 - DUMPREG(RFBI_CONTROL); 800 - DUMPREG(RFBI_PIXEL_CNT); 801 - DUMPREG(RFBI_LINE_NUMBER); 802 - DUMPREG(RFBI_CMD); 803 - DUMPREG(RFBI_PARAM); 804 - DUMPREG(RFBI_DATA); 805 - DUMPREG(RFBI_READ); 806 - DUMPREG(RFBI_STATUS); 807 - 808 - DUMPREG(RFBI_CONFIG(0)); 809 - DUMPREG(RFBI_ONOFF_TIME(0)); 810 - DUMPREG(RFBI_CYCLE_TIME(0)); 811 - DUMPREG(RFBI_DATA_CYCLE1(0)); 812 - DUMPREG(RFBI_DATA_CYCLE2(0)); 813 - DUMPREG(RFBI_DATA_CYCLE3(0)); 814 - 815 - DUMPREG(RFBI_CONFIG(1)); 816 - DUMPREG(RFBI_ONOFF_TIME(1)); 817 - DUMPREG(RFBI_CYCLE_TIME(1)); 818 - DUMPREG(RFBI_DATA_CYCLE1(1)); 819 - DUMPREG(RFBI_DATA_CYCLE2(1)); 820 - DUMPREG(RFBI_DATA_CYCLE3(1)); 821 - 822 - DUMPREG(RFBI_VSYNC_WIDTH); 823 - DUMPREG(RFBI_HSYNC_WIDTH); 824 - 825 - rfbi_runtime_put(); 826 - #undef DUMPREG 827 - } 828 - 829 - static void rfbi_config_lcd_manager(struct omap_dss_device *dssdev) 830 - { 831 - struct omap_overlay_manager *mgr = rfbi.output.manager; 832 - struct dss_lcd_mgr_config mgr_config; 833 - 834 - mgr_config.io_pad_mode = DSS_IO_PAD_MODE_RFBI; 835 - 836 - mgr_config.stallmode = true; 837 - /* Do we need fifohandcheck for RFBI? */ 838 - mgr_config.fifohandcheck = false; 839 - 840 - mgr_config.video_port_width = rfbi.pixel_size; 841 - mgr_config.lcden_sig_polarity = 0; 842 - 843 - dss_mgr_set_lcd_config(mgr, &mgr_config); 844 - 845 - /* 846 - * Set rfbi.timings with default values, the x_res and y_res fields 847 - * are expected to be already configured by the panel driver via 848 - * omapdss_rfbi_set_size() 849 - */ 850 - rfbi.timings.hsw = 1; 851 - rfbi.timings.hfp = 1; 852 - rfbi.timings.hbp = 1; 853 - rfbi.timings.vsw = 1; 854 - rfbi.timings.vfp = 0; 855 - rfbi.timings.vbp = 0; 856 - 857 - rfbi.timings.interlace = false; 858 - rfbi.timings.hsync_level = OMAPDSS_SIG_ACTIVE_HIGH; 859 - rfbi.timings.vsync_level = OMAPDSS_SIG_ACTIVE_HIGH; 860 - rfbi.timings.data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE; 861 - rfbi.timings.de_level = OMAPDSS_SIG_ACTIVE_HIGH; 862 - rfbi.timings.sync_pclk_edge = OMAPDSS_DRIVE_SIG_FALLING_EDGE; 863 - 864 - dss_mgr_set_timings(mgr, &rfbi.timings); 865 - } 866 - 867 - static int rfbi_display_enable(struct omap_dss_device *dssdev) 868 - { 869 - struct omap_dss_device *out = &rfbi.output; 870 - int r; 871 - 872 - if (out->manager == NULL) { 873 - DSSERR("failed to enable display: no output/manager\n"); 874 - return -ENODEV; 875 - } 876 - 877 - r = rfbi_runtime_get(); 878 - if (r) 879 - return r; 880 - 881 - r = dss_mgr_register_framedone_handler(out->manager, 882 - framedone_callback, NULL); 883 - if (r) { 884 - DSSERR("can't get FRAMEDONE irq\n"); 885 - goto err1; 886 - } 887 - 888 - rfbi_config_lcd_manager(dssdev); 889 - 890 - rfbi_configure_bus(dssdev->phy.rfbi.channel, rfbi.pixel_size, 891 - rfbi.data_lines); 892 - 893 - rfbi_set_timings(dssdev->phy.rfbi.channel, &rfbi.intf_timings); 894 - 895 - return 0; 896 - err1: 897 - rfbi_runtime_put(); 898 - return r; 899 - } 900 - 901 - static void rfbi_display_disable(struct omap_dss_device *dssdev) 902 - { 903 - struct omap_dss_device *out = &rfbi.output; 904 - 905 - dss_mgr_unregister_framedone_handler(out->manager, 906 - framedone_callback, NULL); 907 - 908 - rfbi_runtime_put(); 909 - } 910 - 911 - static int rfbi_init_display(struct omap_dss_device *dssdev) 912 - { 913 - rfbi.dssdev[dssdev->phy.rfbi.channel] = dssdev; 914 - return 0; 915 - } 916 - 917 - static void rfbi_init_output(struct platform_device *pdev) 918 - { 919 - struct omap_dss_device *out = &rfbi.output; 920 - 921 - out->dev = &pdev->dev; 922 - out->id = OMAP_DSS_OUTPUT_DBI; 923 - out->output_type = OMAP_DISPLAY_TYPE_DBI; 924 - out->name = "rfbi.0"; 925 - out->dispc_channel = OMAP_DSS_CHANNEL_LCD; 926 - out->owner = THIS_MODULE; 927 - 928 - omapdss_register_output(out); 929 - } 930 - 931 - static void rfbi_uninit_output(struct platform_device *pdev) 932 - { 933 - struct omap_dss_device *out = &rfbi.output; 934 - 935 - omapdss_unregister_output(out); 936 - } 937 - 938 - /* RFBI HW IP initialisation */ 939 - static int rfbi_bind(struct device *dev, struct device *master, void *data) 940 - { 941 - struct platform_device *pdev = to_platform_device(dev); 942 - u32 rev; 943 - struct resource *rfbi_mem; 944 - struct clk *clk; 945 - int r; 946 - 947 - rfbi.pdev = pdev; 948 - 949 - sema_init(&rfbi.bus_lock, 1); 950 - 951 - rfbi_mem = platform_get_resource(rfbi.pdev, IORESOURCE_MEM, 0); 952 - if (!rfbi_mem) { 953 - DSSERR("can't get IORESOURCE_MEM RFBI\n"); 954 - return -EINVAL; 955 - } 956 - 957 - rfbi.base = devm_ioremap(&pdev->dev, rfbi_mem->start, 958 - resource_size(rfbi_mem)); 959 - if (!rfbi.base) { 960 - DSSERR("can't ioremap RFBI\n"); 961 - return -ENOMEM; 962 - } 963 - 964 - clk = clk_get(&pdev->dev, "ick"); 965 - if (IS_ERR(clk)) { 966 - DSSERR("can't get ick\n"); 967 - return PTR_ERR(clk); 968 - } 969 - 970 - rfbi.l4_khz = clk_get_rate(clk) / 1000; 971 - 972 - clk_put(clk); 973 - 974 - pm_runtime_enable(&pdev->dev); 975 - 976 - r = rfbi_runtime_get(); 977 - if (r) 978 - goto err_runtime_get; 979 - 980 - msleep(10); 981 - 982 - rev = rfbi_read_reg(RFBI_REVISION); 983 - dev_dbg(&pdev->dev, "OMAP RFBI rev %d.%d\n", 984 - FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0)); 985 - 986 - rfbi_runtime_put(); 987 - 988 - dss_debugfs_create_file("rfbi", rfbi_dump_regs); 989 - 990 - rfbi_init_output(pdev); 991 - 992 - return 0; 993 - 994 - err_runtime_get: 995 - pm_runtime_disable(&pdev->dev); 996 - return r; 997 - } 998 - 999 - static void rfbi_unbind(struct device *dev, struct device *master, void *data) 1000 - { 1001 - struct platform_device *pdev = to_platform_device(dev); 1002 - 1003 - rfbi_uninit_output(pdev); 1004 - 1005 - pm_runtime_disable(&pdev->dev); 1006 - 1007 - return 0; 1008 - } 1009 - 1010 - static const struct component_ops rfbi_component_ops = { 1011 - .bind = rfbi_bind, 1012 - .unbind = rfbi_unbind, 1013 - }; 1014 - 1015 - static int rfbi_probe(struct platform_device *pdev) 1016 - { 1017 - return component_add(&pdev->dev, &rfbi_component_ops); 1018 - } 1019 - 1020 - static int rfbi_remove(struct platform_device *pdev) 1021 - { 1022 - component_del(&pdev->dev, &rfbi_component_ops); 1023 - return 0; 1024 - } 1025 - 1026 - static int rfbi_runtime_suspend(struct device *dev) 1027 - { 1028 - dispc_runtime_put(); 1029 - 1030 - return 0; 1031 - } 1032 - 1033 - static int rfbi_runtime_resume(struct device *dev) 1034 - { 1035 - int r; 1036 - 1037 - r = dispc_runtime_get(); 1038 - if (r < 0) 1039 - return r; 1040 - 1041 - return 0; 1042 - } 1043 - 1044 - static const struct dev_pm_ops rfbi_pm_ops = { 1045 - .runtime_suspend = rfbi_runtime_suspend, 1046 - .runtime_resume = rfbi_runtime_resume, 1047 - }; 1048 - 1049 - static struct platform_driver omap_rfbihw_driver = { 1050 - .probe = rfbi_probe, 1051 - .remove = rfbi_remove, 1052 - .driver = { 1053 - .name = "omapdss_rfbi", 1054 - .pm = &rfbi_pm_ops, 1055 - .suppress_bind_attrs = true, 1056 - }, 1057 - }; 1058 - 1059 - int __init rfbi_init_platform_driver(void) 1060 - { 1061 - return platform_driver_register(&omap_rfbihw_driver); 1062 - } 1063 - 1064 - void rfbi_uninit_platform_driver(void) 1065 - { 1066 - platform_driver_unregister(&omap_rfbihw_driver); 1067 - }
+1 -5
drivers/video/fbdev/omap2/omapfb/omapfb-main.c
··· 1881 1881 1882 1882 fbi = framebuffer_alloc(sizeof(struct omapfb_info), 1883 1883 fbdev->dev); 1884 - 1885 - if (fbi == NULL) { 1886 - dev_err(fbdev->dev, 1887 - "unable to allocate memory for plane info\n"); 1884 + if (!fbi) 1888 1885 return -ENOMEM; 1889 - } 1890 1886 1891 1887 clear_fb_info(fbi); 1892 1888
+7 -14
drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c
··· 49 49 if (rot_type != OMAP_DSS_ROT_DMA && rot_type != OMAP_DSS_ROT_VRFB) 50 50 return -EINVAL; 51 51 52 - if (!lock_fb_info(fbi)) 53 - return -ENODEV; 52 + lock_fb_info(fbi); 54 53 55 54 r = 0; 56 55 if (rot_type == ofbi->rotation_type) ··· 100 101 if (r) 101 102 return r; 102 103 103 - if (!lock_fb_info(fbi)) 104 - return -ENODEV; 104 + lock_fb_info(fbi); 105 105 106 106 ofbi->mirror = mirror; 107 107 ··· 136 138 ssize_t l = 0; 137 139 int t; 138 140 139 - if (!lock_fb_info(fbi)) 140 - return -ENODEV; 141 + lock_fb_info(fbi); 141 142 omapfb_lock(fbdev); 142 143 143 144 for (t = 0; t < ofbi->num_overlays; t++) { ··· 194 197 if (buf[len - 1] == '\n') 195 198 len = len - 1; 196 199 197 - if (!lock_fb_info(fbi)) 198 - return -ENODEV; 200 + lock_fb_info(fbi); 199 201 omapfb_lock(fbdev); 200 202 201 203 if (len > 0) { ··· 325 329 ssize_t l = 0; 326 330 int t; 327 331 328 - if (!lock_fb_info(fbi)) 329 - return -ENODEV; 332 + lock_fb_info(fbi); 330 333 331 334 for (t = 0; t < ofbi->num_overlays; t++) { 332 335 l += snprintf(buf + l, PAGE_SIZE - l, "%s%d", ··· 353 358 if (buf[len - 1] == '\n') 354 359 len = len - 1; 355 360 356 - if (!lock_fb_info(fbi)) 357 - return -ENODEV; 361 + lock_fb_info(fbi); 358 362 359 363 if (len > 0) { 360 364 char *p = (char *)buf; ··· 436 442 437 443 size = PAGE_ALIGN(size); 438 444 439 - if (!lock_fb_info(fbi)) 440 - return -ENODEV; 445 + lock_fb_info(fbi); 441 446 442 447 if (display && display->driver->sync) 443 448 display->driver->sync(display);
+2 -3
drivers/video/fbdev/platinumfb.c
··· 538 538 dev_info(&odev->dev, "Found Apple Platinum video hardware\n"); 539 539 540 540 info = framebuffer_alloc(sizeof(*pinfo), &odev->dev); 541 - if (info == NULL) { 542 - dev_err(&odev->dev, "Failed to allocate fbdev !\n"); 541 + if (!info) 543 542 return -ENOMEM; 544 - } 543 + 545 544 pinfo = info->par; 546 545 547 546 if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) ||
+1 -3
drivers/video/fbdev/pmag-aa-fb.c
··· 165 165 int err; 166 166 167 167 info = framebuffer_alloc(sizeof(struct aafb_par), dev); 168 - if (!info) { 169 - printk(KERN_ERR "%s: Cannot allocate memory\n", dev_name(dev)); 168 + if (!info) 170 169 return -ENOMEM; 171 - } 172 170 173 171 par = info->par; 174 172 dev_set_drvdata(dev, info);
+1 -3
drivers/video/fbdev/pmag-ba-fb.c
··· 150 150 int err; 151 151 152 152 info = framebuffer_alloc(sizeof(struct pmagbafb_par), dev); 153 - if (!info) { 154 - printk(KERN_ERR "%s: Cannot allocate memory\n", dev_name(dev)); 153 + if (!info) 155 154 return -ENOMEM; 156 - } 157 155 158 156 par = info->par; 159 157 dev_set_drvdata(dev, info);
+1 -3
drivers/video/fbdev/pmagb-b-fb.c
··· 257 257 int err; 258 258 259 259 info = framebuffer_alloc(sizeof(struct pmagbbfb_par), dev); 260 - if (!info) { 261 - printk(KERN_ERR "%s: Cannot allocate memory\n", dev_name(dev)); 260 + if (!info) 262 261 return -ENOMEM; 263 - } 264 262 265 263 par = info->par; 266 264 dev_set_drvdata(dev, info);
+87 -101
drivers/video/fbdev/pvr2fb.c
··· 140 140 unsigned char is_doublescan; /* Are scanlines output twice? (doublescan) */ 141 141 unsigned char is_lowres; /* Is horizontal pixel-doubling enabled? */ 142 142 143 - unsigned long mmio_base; /* MMIO base */ 143 + void __iomem *mmio_base; /* MMIO base */ 144 144 u32 palette[16]; 145 145 } *currentpar; 146 146 ··· 193 193 static unsigned int shdma = PVR2_CASCADE_CHAN; 194 194 static unsigned int pvr2dma = ONCHIP_NR_DMA_CHANNELS; 195 195 #endif 196 - 197 - static int pvr2fb_setcolreg(unsigned int regno, unsigned int red, unsigned int green, unsigned int blue, 198 - unsigned int transp, struct fb_info *info); 199 - static int pvr2fb_blank(int blank, struct fb_info *info); 200 - static unsigned long get_line_length(int xres_virtual, int bpp); 201 - static void set_color_bitfields(struct fb_var_screeninfo *var); 202 - static int pvr2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info); 203 - static int pvr2fb_set_par(struct fb_info *info); 204 - static void pvr2_update_display(struct fb_info *info); 205 - static void pvr2_init_display(struct fb_info *info); 206 - static void pvr2_do_blank(void); 207 - static irqreturn_t pvr2fb_interrupt(int irq, void *dev_id); 208 - static int pvr2_init_cable(void); 209 - static int pvr2_get_param(const struct pvr2_params *p, const char *s, 210 - int val, int size); 211 - #ifdef CONFIG_PVR2_DMA 212 - static ssize_t pvr2fb_write(struct fb_info *info, const char *buf, 213 - size_t count, loff_t *ppos); 214 - #endif 215 - 216 - static struct fb_ops pvr2fb_ops = { 217 - .owner = THIS_MODULE, 218 - .fb_setcolreg = pvr2fb_setcolreg, 219 - .fb_blank = pvr2fb_blank, 220 - .fb_check_var = pvr2fb_check_var, 221 - .fb_set_par = pvr2fb_set_par, 222 - #ifdef CONFIG_PVR2_DMA 223 - .fb_write = pvr2fb_write, 224 - #endif 225 - .fb_fillrect = cfb_fillrect, 226 - .fb_copyarea = cfb_copyarea, 227 - .fb_imageblit = cfb_imageblit, 228 - }; 229 196 230 197 static struct fb_videomode pvr2_modedb[] = { 231 198 /* ··· 319 352 ((u32*)(info->pseudo_palette))[regno] = tmp; 320 353 321 354 return 0; 355 + } 356 + 357 + /* 358 + * Determine the cable type and initialize the cable output format. Don't do 359 + * anything if the cable type has been overidden (via "cable:XX"). 360 + */ 361 + 362 + #define PCTRA ((void __iomem *)0xff80002c) 363 + #define PDTRA ((void __iomem *)0xff800030) 364 + #define VOUTC ((void __iomem *)0xa0702c00) 365 + 366 + static int pvr2_init_cable(void) 367 + { 368 + if (cable_type < 0) { 369 + fb_writel((fb_readl(PCTRA) & 0xfff0ffff) | 0x000a0000, 370 + PCTRA); 371 + cable_type = (fb_readw(PDTRA) >> 8) & 3; 372 + } 373 + 374 + /* Now select the output format (either composite or other) */ 375 + /* XXX: Save the previous val first, as this reg is also AICA 376 + related */ 377 + if (cable_type == CT_COMPOSITE) 378 + fb_writel(3 << 8, VOUTC); 379 + else if (cable_type == CT_RGB) 380 + fb_writel(1 << 9, VOUTC); 381 + else 382 + fb_writel(0, VOUTC); 383 + 384 + return cable_type; 322 385 } 323 386 324 387 static int pvr2fb_set_par(struct fb_info *info) ··· 620 623 is_blanked = do_blank > 0 ? do_blank : 0; 621 624 } 622 625 623 - static irqreturn_t pvr2fb_interrupt(int irq, void *dev_id) 626 + static irqreturn_t __maybe_unused pvr2fb_interrupt(int irq, void *dev_id) 624 627 { 625 628 struct fb_info *info = dev_id; 626 629 ··· 637 640 do_blank = 0; 638 641 } 639 642 return IRQ_HANDLED; 640 - } 641 - 642 - /* 643 - * Determine the cable type and initialize the cable output format. Don't do 644 - * anything if the cable type has been overidden (via "cable:XX"). 645 - */ 646 - 647 - #define PCTRA 0xff80002c 648 - #define PDTRA 0xff800030 649 - #define VOUTC 0xa0702c00 650 - 651 - static int pvr2_init_cable(void) 652 - { 653 - if (cable_type < 0) { 654 - fb_writel((fb_readl(PCTRA) & 0xfff0ffff) | 0x000a0000, 655 - PCTRA); 656 - cable_type = (fb_readw(PDTRA) >> 8) & 3; 657 - } 658 - 659 - /* Now select the output format (either composite or other) */ 660 - /* XXX: Save the previous val first, as this reg is also AICA 661 - related */ 662 - if (cable_type == CT_COMPOSITE) 663 - fb_writel(3 << 8, VOUTC); 664 - else if (cable_type == CT_RGB) 665 - fb_writel(1 << 9, VOUTC); 666 - else 667 - fb_writel(0, VOUTC); 668 - 669 - return cable_type; 670 643 } 671 644 672 645 #ifdef CONFIG_PVR2_DMA ··· 709 742 } 710 743 #endif /* CONFIG_PVR2_DMA */ 711 744 745 + static struct fb_ops pvr2fb_ops = { 746 + .owner = THIS_MODULE, 747 + .fb_setcolreg = pvr2fb_setcolreg, 748 + .fb_blank = pvr2fb_blank, 749 + .fb_check_var = pvr2fb_check_var, 750 + .fb_set_par = pvr2fb_set_par, 751 + #ifdef CONFIG_PVR2_DMA 752 + .fb_write = pvr2fb_write, 753 + #endif 754 + .fb_fillrect = cfb_fillrect, 755 + .fb_copyarea = cfb_copyarea, 756 + .fb_imageblit = cfb_imageblit, 757 + }; 758 + 759 + #ifndef MODULE 760 + static int pvr2_get_param_val(const struct pvr2_params *p, const char *s, 761 + int size) 762 + { 763 + int i; 764 + 765 + for (i = 0; i < size; i++) { 766 + if (!strncasecmp(p[i].name, s, strlen(s))) 767 + return p[i].val; 768 + } 769 + return -1; 770 + } 771 + #endif 772 + 773 + static char *pvr2_get_param_name(const struct pvr2_params *p, int val, 774 + int size) 775 + { 776 + int i; 777 + 778 + for (i = 0; i < size; i++) { 779 + if (p[i].val == val) 780 + return p[i].name; 781 + } 782 + return NULL; 783 + } 784 + 712 785 /** 713 786 * pvr2fb_common_init 714 787 * ··· 767 760 * in for flexibility anyways. Who knows, maybe someone has tv-out on a 768 761 * PCI-based version of these things ;-) 769 762 */ 770 - static int pvr2fb_common_init(void) 763 + static int __maybe_unused pvr2fb_common_init(void) 771 764 { 772 765 struct pvr2fb_par *par = currentpar; 773 766 unsigned long modememused, rev; ··· 780 773 goto out_err; 781 774 } 782 775 783 - par->mmio_base = (unsigned long)ioremap_nocache(pvr2_fix.mmio_start, 784 - pvr2_fix.mmio_len); 776 + par->mmio_base = ioremap_nocache(pvr2_fix.mmio_start, 777 + pvr2_fix.mmio_len); 785 778 if (!par->mmio_base) { 786 779 printk(KERN_ERR "pvr2fb: Failed to remap mmio space\n"); 787 780 goto out_err; ··· 829 822 fb_info->var.xres, fb_info->var.yres, 830 823 fb_info->var.bits_per_pixel, 831 824 get_line_length(fb_info->var.xres, fb_info->var.bits_per_pixel), 832 - (char *)pvr2_get_param(cables, NULL, cable_type, 3), 833 - (char *)pvr2_get_param(outputs, NULL, video_output, 3)); 825 + pvr2_get_param_name(cables, cable_type, 3), 826 + pvr2_get_param_name(outputs, video_output, 3)); 834 827 835 828 #ifdef CONFIG_SH_STORE_QUEUES 836 829 fb_notice(fb_info, "registering with SQ API\n"); ··· 848 841 if (fb_info->screen_base) 849 842 iounmap(fb_info->screen_base); 850 843 if (par->mmio_base) 851 - iounmap((void *)par->mmio_base); 844 + iounmap(par->mmio_base); 852 845 853 846 return -ENXIO; 854 847 } ··· 908 901 return pvr2fb_common_init(); 909 902 } 910 903 911 - static void __exit pvr2fb_dc_exit(void) 904 + static void pvr2fb_dc_exit(void) 912 905 { 913 906 if (fb_info->screen_base) { 914 907 iounmap(fb_info->screen_base); 915 908 fb_info->screen_base = NULL; 916 909 } 917 910 if (currentpar->mmio_base) { 918 - iounmap((void *)currentpar->mmio_base); 919 - currentpar->mmio_base = 0; 911 + iounmap(currentpar->mmio_base); 912 + currentpar->mmio_base = NULL; 920 913 } 921 914 922 915 free_irq(HW_EVENT_VSYNC, fb_info); ··· 965 958 fb_info->screen_base = NULL; 966 959 } 967 960 if (currentpar->mmio_base) { 968 - iounmap((void *)currentpar->mmio_base); 969 - currentpar->mmio_base = 0; 961 + iounmap(currentpar->mmio_base); 962 + currentpar->mmio_base = NULL; 970 963 } 971 964 972 965 pci_release_regions(pdev); ··· 992 985 return pci_register_driver(&pvr2fb_pci_driver); 993 986 } 994 987 995 - static void __exit pvr2fb_pci_exit(void) 988 + static void pvr2fb_pci_exit(void) 996 989 { 997 990 pci_unregister_driver(&pvr2fb_pci_driver); 998 991 } 999 992 #endif /* CONFIG_PCI */ 1000 - 1001 - static int pvr2_get_param(const struct pvr2_params *p, const char *s, int val, 1002 - int size) 1003 - { 1004 - int i; 1005 - 1006 - for (i = 0 ; i < size ; i++ ) { 1007 - if (s != NULL) { 1008 - if (!strncasecmp(p[i].name, s, strlen(s))) 1009 - return p[i].val; 1010 - } else { 1011 - if (p[i].val == val) 1012 - return (int)p[i].name; 1013 - } 1014 - } 1015 - return -1; 1016 - } 1017 993 1018 994 /* 1019 995 * Parse command arguments. Supported arguments are: ··· 1037 1047 } 1038 1048 1039 1049 if (*cable_arg) 1040 - cable_type = pvr2_get_param(cables, cable_arg, 0, 3); 1050 + cable_type = pvr2_get_param_val(cables, cable_arg, 3); 1041 1051 if (*output_arg) 1042 - video_output = pvr2_get_param(outputs, output_arg, 0, 3); 1052 + video_output = pvr2_get_param_val(outputs, output_arg, 3); 1043 1053 1044 1054 return 0; 1045 1055 } ··· 1072 1082 #endif 1073 1083 1074 1084 fb_info = framebuffer_alloc(sizeof(struct pvr2fb_par), NULL); 1075 - 1076 - if (!fb_info) { 1077 - printk(KERN_ERR "Failed to allocate memory for fb_info\n"); 1085 + if (!fb_info) 1078 1086 return -ENOMEM; 1079 - } 1080 - 1081 1087 1082 1088 currentpar = fb_info->par; 1083 1089
-1
drivers/video/fbdev/riva/fbdev.c
··· 1902 1902 1903 1903 info = framebuffer_alloc(sizeof(struct riva_par), &pd->dev); 1904 1904 if (!info) { 1905 - printk (KERN_ERR PFX "could not allocate memory\n"); 1906 1905 ret = -ENOMEM; 1907 1906 goto err_ret; 1908 1907 }
+11 -13
drivers/video/fbdev/s3c-fb.c
··· 284 284 /* 666 with one bit alpha/transparency */ 285 285 var->transp.offset = 18; 286 286 var->transp.length = 1; 287 - /* drop through */ 287 + /* fall through */ 288 288 case 18: 289 289 var->bits_per_pixel = 32; 290 290 ··· 312 312 case 25: 313 313 var->transp.length = var->bits_per_pixel - 24; 314 314 var->transp.offset = 24; 315 - /* drop through */ 315 + /* fall through */ 316 316 case 24: 317 317 /* our 24bpp is unpacked, so 32bpp */ 318 318 var->bits_per_pixel = 32; ··· 809 809 case FB_BLANK_POWERDOWN: 810 810 wincon &= ~WINCONx_ENWIN; 811 811 sfb->enabled &= ~(1 << index); 812 - /* fall through to FB_BLANK_NORMAL */ 812 + /* fall through - to FB_BLANK_NORMAL */ 813 813 814 814 case FB_BLANK_NORMAL: 815 815 /* disable the DMA and display 0x0 (black) */ ··· 1102 1102 1103 1103 dev_dbg(sfb->dev, "want %u bytes for window\n", size); 1104 1104 1105 - fbi->screen_base = dma_alloc_wc(sfb->dev, size, &map_dma, GFP_KERNEL); 1106 - if (!fbi->screen_base) 1105 + fbi->screen_buffer = dma_alloc_wc(sfb->dev, size, &map_dma, GFP_KERNEL); 1106 + if (!fbi->screen_buffer) 1107 1107 return -ENOMEM; 1108 1108 1109 1109 dev_dbg(sfb->dev, "mapped %x to %p\n", 1110 - (unsigned int)map_dma, fbi->screen_base); 1110 + (unsigned int)map_dma, fbi->screen_buffer); 1111 1111 1112 - memset(fbi->screen_base, 0x0, size); 1112 + memset(fbi->screen_buffer, 0x0, size); 1113 1113 fbi->fix.smem_start = map_dma; 1114 1114 1115 1115 return 0; ··· 1126 1126 { 1127 1127 struct fb_info *fbi = win->fbinfo; 1128 1128 1129 - if (fbi->screen_base) 1129 + if (fbi->screen_buffer) 1130 1130 dma_free_wc(sfb->dev, PAGE_ALIGN(fbi->fix.smem_len), 1131 - fbi->screen_base, fbi->fix.smem_start); 1131 + fbi->screen_buffer, fbi->fix.smem_start); 1132 1132 } 1133 1133 1134 1134 /** ··· 1186 1186 1187 1187 fbinfo = framebuffer_alloc(sizeof(struct s3c_fb_win) + 1188 1188 palette_size * sizeof(u32), sfb->dev); 1189 - if (!fbinfo) { 1190 - dev_err(sfb->dev, "failed to allocate framebuffer\n"); 1191 - return -ENOENT; 1192 - } 1189 + if (!fbinfo) 1190 + return -ENOMEM; 1193 1191 1194 1192 windata = sfb->pdata->win[win_no]; 1195 1193 initmode = *sfb->pdata->vtiming;
+1 -3
drivers/video/fbdev/s3fb.c
··· 1128 1128 1129 1129 /* Allocate and fill driver data structure */ 1130 1130 info = framebuffer_alloc(sizeof(struct s3fb_info), &(dev->dev)); 1131 - if (!info) { 1132 - dev_err(&(dev->dev), "cannot allocate memory\n"); 1131 + if (!info) 1133 1132 return -ENOMEM; 1134 - } 1135 1133 1136 1134 par = info->par; 1137 1135 mutex_init(&par->open_lock);
-25
drivers/video/fbdev/sa1100fb.c
··· 974 974 */ 975 975 static unsigned int sa1100fb_min_dma_period(struct sa1100fb_info *fbi) 976 976 { 977 - #if 0 978 - unsigned int min_period = (unsigned int)-1; 979 - int i; 980 - 981 - for (i = 0; i < MAX_NR_CONSOLES; i++) { 982 - struct display *disp = &fb_display[i]; 983 - unsigned int period; 984 - 985 - /* 986 - * Do we own this display? 987 - */ 988 - if (disp->fb_info != &fbi->fb) 989 - continue; 990 - 991 - /* 992 - * Ok, calculate its DMA period 993 - */ 994 - period = sa1100fb_display_dma_period(&disp->var); 995 - if (period < min_period) 996 - min_period = period; 997 - } 998 - 999 - return min_period; 1000 - #else 1001 977 /* 1002 978 * FIXME: we need to verify _all_ consoles. 1003 979 */ 1004 980 return sa1100fb_display_dma_period(&fbi->fb.var); 1005 - #endif 1006 981 } 1007 982 1008 983 /*
+1 -8
drivers/video/fbdev/savage/savagefb_driver.c
··· 2333 2333 DBG("savagefb_remove"); 2334 2334 2335 2335 if (info) { 2336 - /* 2337 - * If unregister_framebuffer fails, then 2338 - * we will be leaving hooks that could cause 2339 - * oopsen laying around. 2340 - */ 2341 - if (unregister_framebuffer(info)) 2342 - printk(KERN_WARNING "savagefb: danger danger! " 2343 - "Oopsen imminent!\n"); 2336 + unregister_framebuffer(info); 2344 2337 2345 2338 #ifdef CONFIG_FB_SAVAGE_I2C 2346 2339 savagefb_delete_i2c_busses(info);
+4 -136
drivers/video/fbdev/sh_mobile_lcdcfb.c
··· 15 15 #include <linux/ctype.h> 16 16 #include <linux/dma-mapping.h> 17 17 #include <linux/delay.h> 18 + #include <linux/fbcon.h> 18 19 #include <linux/gpio.h> 19 20 #include <linux/init.h> 20 21 #include <linux/interrupt.h> ··· 214 213 struct sh_mobile_lcdc_chan ch[2]; 215 214 struct sh_mobile_lcdc_overlay overlays[4]; 216 215 217 - struct notifier_block notifier; 218 216 int started; 219 217 int forced_fourcc; /* 2 channel LCDC must share fourcc setting */ 220 218 }; ··· 534 534 ch->tx_dev->ops->display_off(ch->tx_dev); 535 535 } 536 536 537 - static bool 538 - sh_mobile_lcdc_must_reconfigure(struct sh_mobile_lcdc_chan *ch, 539 - const struct fb_videomode *new_mode) 540 - { 541 - dev_dbg(ch->info->dev, "Old %ux%u, new %ux%u\n", 542 - ch->display.mode.xres, ch->display.mode.yres, 543 - new_mode->xres, new_mode->yres); 544 - 545 - /* It can be a different monitor with an equal video-mode */ 546 - if (fb_mode_is_equal(&ch->display.mode, new_mode)) 547 - return false; 548 - 549 - dev_dbg(ch->info->dev, "Switching %u -> %u lines\n", 550 - ch->display.mode.yres, new_mode->yres); 551 - ch->display.mode = *new_mode; 552 - 553 - return true; 554 - } 555 - 556 537 static int sh_mobile_lcdc_check_var(struct fb_var_screeninfo *var, 557 538 struct fb_info *info); 558 - 559 - static int sh_mobile_lcdc_display_notify(struct sh_mobile_lcdc_chan *ch, 560 - enum sh_mobile_lcdc_entity_event event, 561 - const struct fb_videomode *mode, 562 - const struct fb_monspecs *monspec) 563 - { 564 - struct fb_info *info = ch->info; 565 - struct fb_var_screeninfo var; 566 - int ret = 0; 567 - 568 - switch (event) { 569 - case SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT: 570 - /* HDMI plug in */ 571 - console_lock(); 572 - if (lock_fb_info(info)) { 573 - 574 - 575 - ch->display.width = monspec->max_x * 10; 576 - ch->display.height = monspec->max_y * 10; 577 - 578 - if (!sh_mobile_lcdc_must_reconfigure(ch, mode) && 579 - info->state == FBINFO_STATE_RUNNING) { 580 - /* First activation with the default monitor. 581 - * Just turn on, if we run a resume here, the 582 - * logo disappears. 583 - */ 584 - info->var.width = ch->display.width; 585 - info->var.height = ch->display.height; 586 - sh_mobile_lcdc_display_on(ch); 587 - } else { 588 - /* New monitor or have to wake up */ 589 - fb_set_suspend(info, 0); 590 - } 591 - 592 - 593 - unlock_fb_info(info); 594 - } 595 - console_unlock(); 596 - break; 597 - 598 - case SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT: 599 - /* HDMI disconnect */ 600 - console_lock(); 601 - if (lock_fb_info(info)) { 602 - fb_set_suspend(info, 1); 603 - unlock_fb_info(info); 604 - } 605 - console_unlock(); 606 - break; 607 - 608 - case SH_MOBILE_LCDC_EVENT_DISPLAY_MODE: 609 - /* Validate a proposed new mode */ 610 - fb_videomode_to_var(&var, mode); 611 - var.bits_per_pixel = info->var.bits_per_pixel; 612 - var.grayscale = info->var.grayscale; 613 - ret = sh_mobile_lcdc_check_var(&var, info); 614 - break; 615 - } 616 - 617 - return ret; 618 - } 619 539 620 540 /* ----------------------------------------------------------------------------- 621 541 * Format helpers ··· 1564 1644 1565 1645 /* Allocate and initialize the frame buffer device. */ 1566 1646 info = framebuffer_alloc(0, priv->dev); 1567 - if (info == NULL) { 1568 - dev_err(priv->dev, "unable to allocate fb_info\n"); 1647 + if (!info) 1569 1648 return -ENOMEM; 1570 - } 1571 1649 1572 1650 ovl->info = info; 1573 1651 ··· 1756 1838 struct sh_mobile_lcdc_chan *ch = info->par; 1757 1839 struct fb_var_screeninfo var; 1758 1840 struct fb_videomode mode; 1759 - struct fb_event event; 1760 - int evnt = FB_EVENT_MODE_CHANGE_ALL; 1761 1841 1762 1842 if (ch->use_count > 1 || (ch->use_count == 1 && !info->fbcon_par)) 1763 1843 /* More framebuffer users are active */ ··· 1777 1861 /* Couldn't reconfigure, hopefully, can continue as before */ 1778 1862 return; 1779 1863 1780 - /* 1781 - * fb_set_var() calls the notifier change internally, only if 1782 - * FBINFO_MISC_USEREVENT flag is set. Since we do not want to fake a 1783 - * user event, we have to call the chain ourselves. 1784 - */ 1785 - event.info = info; 1786 - event.data = &ch->display.mode; 1787 - fb_notifier_call_chain(evnt, &event); 1864 + fbcon_update_vcs(info, true); 1788 1865 } 1789 1866 1790 1867 /* ··· 2047 2138 * list and allocate the color map. 2048 2139 */ 2049 2140 info = framebuffer_alloc(0, priv->dev); 2050 - if (info == NULL) { 2051 - dev_err(priv->dev, "unable to allocate fb_info\n"); 2141 + if (!info) 2052 2142 return -ENOMEM; 2053 - } 2054 2143 2055 2144 ch->info = info; 2056 2145 ··· 2226 2319 * Framebuffer notifier 2227 2320 */ 2228 2321 2229 - /* locking: called with info->lock held */ 2230 - static int sh_mobile_lcdc_notify(struct notifier_block *nb, 2231 - unsigned long action, void *data) 2232 - { 2233 - struct fb_event *event = data; 2234 - struct fb_info *info = event->info; 2235 - struct sh_mobile_lcdc_chan *ch = info->par; 2236 - 2237 - if (&ch->lcdc->notifier != nb) 2238 - return NOTIFY_DONE; 2239 - 2240 - dev_dbg(info->dev, "%s(): action = %lu, data = %p\n", 2241 - __func__, action, event->data); 2242 - 2243 - switch(action) { 2244 - case FB_EVENT_SUSPEND: 2245 - sh_mobile_lcdc_display_off(ch); 2246 - sh_mobile_lcdc_stop(ch->lcdc); 2247 - break; 2248 - case FB_EVENT_RESUME: 2249 - mutex_lock(&ch->open_lock); 2250 - sh_mobile_fb_reconfig(info); 2251 - mutex_unlock(&ch->open_lock); 2252 - 2253 - sh_mobile_lcdc_display_on(ch); 2254 - sh_mobile_lcdc_start(ch->lcdc); 2255 - } 2256 - 2257 - return NOTIFY_OK; 2258 - } 2259 - 2260 2322 /* ----------------------------------------------------------------------------- 2261 2323 * Probe/remove and driver init/exit 2262 2324 */ ··· 2252 2376 { 2253 2377 struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev); 2254 2378 unsigned int i; 2255 - 2256 - fb_unregister_client(&priv->notifier); 2257 2379 2258 2380 for (i = 0; i < ARRAY_SIZE(priv->overlays); i++) 2259 2381 sh_mobile_lcdc_overlay_fb_unregister(&priv->overlays[i]); ··· 2413 2539 unsigned int num_modes; 2414 2540 unsigned int max_size; 2415 2541 unsigned int i; 2416 - 2417 - ch->notify = sh_mobile_lcdc_display_notify; 2418 2542 2419 2543 /* Validate the format. */ 2420 2544 format = sh_mobile_format_info(cfg->fourcc); ··· 2641 2769 if (error) 2642 2770 goto err1; 2643 2771 } 2644 - 2645 - /* Failure ignored */ 2646 - priv->notifier.notifier_call = sh_mobile_lcdc_notify; 2647 - fb_register_client(&priv->notifier); 2648 2772 2649 2773 return 0; 2650 2774 err1:
-5
drivers/video/fbdev/sh_mobile_lcdcfb.h
··· 87 87 unsigned long base_addr_c; 88 88 unsigned int line_size; 89 89 90 - int (*notify)(struct sh_mobile_lcdc_chan *ch, 91 - enum sh_mobile_lcdc_entity_event event, 92 - const struct fb_videomode *mode, 93 - const struct fb_monspecs *monspec); 94 - 95 90 /* Backlight */ 96 91 struct backlight_device *bl; 97 92 unsigned int bl_brightness;
+1 -3
drivers/video/fbdev/sm501fb.c
··· 1865 1865 } 1866 1866 1867 1867 fbi = framebuffer_alloc(sizeof(struct sm501fb_par), info->dev); 1868 - if (fbi == NULL) { 1869 - dev_err(info->dev, "cannot allocate %s framebuffer\n", name); 1868 + if (!fbi) 1870 1869 return -ENOMEM; 1871 - } 1872 1870 1873 1871 par = fbi->par; 1874 1872 par->info = info;
-1
drivers/video/fbdev/sm712fb.c
··· 1538 1538 1539 1539 info = framebuffer_alloc(sizeof(*sfb), &pdev->dev); 1540 1540 if (!info) { 1541 - dev_err(&pdev->dev, "framebuffer_alloc failed\n"); 1542 1541 err = -ENOMEM; 1543 1542 goto failed_free; 1544 1543 }
+1 -3
drivers/video/fbdev/smscufx.c
··· 1650 1650 1651 1651 /* allocates framebuffer driver structure, not framebuffer memory */ 1652 1652 info = framebuffer_alloc(0, &usbdev->dev); 1653 - if (!info) { 1654 - dev_err(dev->gdev, "framebuffer_alloc failed\n"); 1653 + if (!info) 1655 1654 goto e_nomem; 1656 - } 1657 1655 1658 1656 dev->info = info; 1659 1657 info->par = dev;
+1 -3
drivers/video/fbdev/ssd1307fb.c
··· 555 555 } 556 556 557 557 info = framebuffer_alloc(sizeof(struct ssd1307fb_par), &client->dev); 558 - if (!info) { 559 - dev_err(&client->dev, "Couldn't allocate framebuffer.\n"); 558 + if (!info) 560 559 return -ENOMEM; 561 - } 562 560 563 561 par = info->par; 564 562 par->info = info;
-1
drivers/video/fbdev/sunxvr1000.c
··· 121 121 122 122 info = framebuffer_alloc(sizeof(struct gfb_info), &op->dev); 123 123 if (!info) { 124 - printk(KERN_ERR "gfb: Cannot allocate fb_info\n"); 125 124 err = -ENOMEM; 126 125 goto err_out; 127 126 }
-1
drivers/video/fbdev/sunxvr2500.c
··· 132 132 133 133 info = framebuffer_alloc(sizeof(struct s3d_info), &pdev->dev); 134 134 if (!info) { 135 - printk(KERN_ERR "s3d: Cannot allocate fb_info\n"); 136 135 err = -ENOMEM; 137 136 goto err_disable; 138 137 }
-1
drivers/video/fbdev/sunxvr500.c
··· 272 272 273 273 info = framebuffer_alloc(sizeof(struct e3d_info), &pdev->dev); 274 274 if (!info) { 275 - printk(KERN_ERR "e3d: Cannot allocate fb_info\n"); 276 275 err = -ENOMEM; 277 276 goto err_disable; 278 277 }
+1 -3
drivers/video/fbdev/tgafb.c
··· 1416 1416 1417 1417 /* Allocate the fb and par structures. */ 1418 1418 info = framebuffer_alloc(sizeof(struct tga_par), dev); 1419 - if (!info) { 1420 - printk(KERN_ERR "tgafb: Cannot allocate memory\n"); 1419 + if (!info) 1421 1420 return -ENOMEM; 1422 - } 1423 1421 1424 1422 par = info->par; 1425 1423 dev_set_drvdata(dev, info);
+1 -3
drivers/video/fbdev/udlfb.c
··· 1686 1686 1687 1687 /* allocates framebuffer driver structure, not framebuffer memory */ 1688 1688 info = framebuffer_alloc(0, &dlfb->udev->dev); 1689 - if (!info) { 1690 - dev_err(&dlfb->udev->dev, "framebuffer_alloc failed\n"); 1689 + if (!info) 1691 1690 goto error; 1692 - } 1693 1691 1694 1692 dlfb->info = info; 1695 1693 info->par = dlfb;
+1 -5
drivers/video/fbdev/via/viafbdev.c
··· 1742 1742 viafbinfo = framebuffer_alloc(viafb_par_length + 1743 1743 ALIGN(sizeof(struct viafb_shared), BITS_PER_LONG/8), 1744 1744 &vdev->pdev->dev); 1745 - if (!viafbinfo) { 1746 - printk(KERN_ERR"Could not allocate memory for viafb_info.\n"); 1745 + if (!viafbinfo) 1747 1746 return -ENOMEM; 1748 - } 1749 1747 1750 1748 viaparinfo = (struct viafb_par *)viafbinfo->par; 1751 1749 viaparinfo->shared = viafbinfo->par + viafb_par_length; ··· 1818 1820 viafbinfo1 = framebuffer_alloc(viafb_par_length, 1819 1821 &vdev->pdev->dev); 1820 1822 if (!viafbinfo1) { 1821 - printk(KERN_ERR 1822 - "allocate the second framebuffer struct error\n"); 1823 1823 rc = -ENOMEM; 1824 1824 goto out_fb_release; 1825 1825 }
+1 -3
drivers/video/fbdev/vt8623fb.c
··· 669 669 670 670 /* Allocate and fill driver data structure */ 671 671 info = framebuffer_alloc(sizeof(struct vt8623fb_info), &(dev->dev)); 672 - if (! info) { 673 - dev_err(&(dev->dev), "cannot allocate memory\n"); 672 + if (!info) 674 673 return -ENOMEM; 675 - } 676 674 677 675 par = info->par; 678 676 mutex_init(&par->open_lock);
+1 -4
include/linux/console_struct.h
··· 168 168 169 169 #define CUR_DEFAULT CUR_UNDERLINE 170 170 171 - static inline bool con_is_visible(const struct vc_data *vc) 172 - { 173 - return *vc->vc_display_fg == vc; 174 - } 171 + bool con_is_visible(const struct vc_data *vc); 175 172 176 173 #endif /* _LINUX_CONSOLE_STRUCT_H */
+12 -33
include/linux/fb.h
··· 126 126 127 127 /* The resolution of the passed in fb_info about to change */ 128 128 #define FB_EVENT_MODE_CHANGE 0x01 129 - /* The display on this fb_info is being suspended, no access to the 130 - * framebuffer is allowed any more after that call returns 131 - */ 132 - #define FB_EVENT_SUSPEND 0x02 133 - /* The display on this fb_info was resumed, you can restore the display 134 - * if you own it 135 - */ 136 - #define FB_EVENT_RESUME 0x03 137 - /* An entry from the modelist was removed */ 138 - #define FB_EVENT_MODE_DELETE 0x04 139 - /* A driver registered itself */ 129 + 130 + #ifdef CONFIG_GUMSTIX_AM200EPD 131 + /* only used by mach-pxa/am200epd.c */ 140 132 #define FB_EVENT_FB_REGISTERED 0x05 141 - /* A driver unregistered itself */ 142 133 #define FB_EVENT_FB_UNREGISTERED 0x06 143 - /* CONSOLE-SPECIFIC: get console to framebuffer mapping */ 144 - #define FB_EVENT_GET_CONSOLE_MAP 0x07 145 - /* CONSOLE-SPECIFIC: set console to framebuffer mapping */ 146 - #define FB_EVENT_SET_CONSOLE_MAP 0x08 147 - /* A hardware display blank change occurred */ 134 + #endif 135 + 136 + /* A display blank is requested */ 148 137 #define FB_EVENT_BLANK 0x09 149 - /* Private modelist is to be replaced */ 150 - #define FB_EVENT_NEW_MODELIST 0x0A 151 - /* The resolution of the passed in fb_info about to change and 152 - all vc's should be changed */ 153 - #define FB_EVENT_MODE_CHANGE_ALL 0x0B 154 - /* A software display blank change occurred */ 155 - #define FB_EVENT_CONBLANK 0x0C 156 - /* Get drawing requirements */ 157 - #define FB_EVENT_GET_REQ 0x0D 158 - /* Unbind from the console if possible */ 159 - #define FB_EVENT_FB_UNBIND 0x0E 160 - /* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */ 161 - #define FB_EVENT_REMAP_ALL_CONSOLE 0x0F 162 138 /* A hardware display blank early change occurred */ 163 139 #define FB_EARLY_EVENT_BLANK 0x10 164 140 /* A hardware display blank revert early change occurred */ ··· 609 633 610 634 /* drivers/video/fbmem.c */ 611 635 extern int register_framebuffer(struct fb_info *fb_info); 612 - extern int unregister_framebuffer(struct fb_info *fb_info); 613 - extern int unlink_framebuffer(struct fb_info *fb_info); 636 + extern void unregister_framebuffer(struct fb_info *fb_info); 637 + extern void unlink_framebuffer(struct fb_info *fb_info); 614 638 extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, 615 639 const char *name); 616 640 extern int remove_conflicting_framebuffers(struct apertures_struct *a, ··· 636 660 for (i = 0; i < FB_MAX; i++) \ 637 661 if (!registered_fb[i]) {} else 638 662 639 - extern int lock_fb_info(struct fb_info *info); 663 + static inline void lock_fb_info(struct fb_info *info) 664 + { 665 + mutex_lock(&info->lock); 666 + } 640 667 641 668 static inline void unlock_fb_info(struct fb_info *info) 642 669 {
+30
include/linux/fbcon.h
··· 4 4 #ifdef CONFIG_FRAMEBUFFER_CONSOLE 5 5 void __init fb_console_init(void); 6 6 void __exit fb_console_exit(void); 7 + int fbcon_fb_registered(struct fb_info *info); 8 + void fbcon_fb_unregistered(struct fb_info *info); 9 + void fbcon_fb_unbind(struct fb_info *info); 10 + void fbcon_suspended(struct fb_info *info); 11 + void fbcon_resumed(struct fb_info *info); 12 + int fbcon_mode_deleted(struct fb_info *info, 13 + struct fb_videomode *mode); 14 + void fbcon_new_modelist(struct fb_info *info); 15 + void fbcon_get_requirement(struct fb_info *info, 16 + struct fb_blit_caps *caps); 17 + void fbcon_fb_blanked(struct fb_info *info, int blank); 18 + void fbcon_update_vcs(struct fb_info *info, bool all); 19 + void fbcon_remap_all(struct fb_info *info); 20 + int fbcon_set_con2fb_map_ioctl(void __user *argp); 21 + int fbcon_get_con2fb_map_ioctl(void __user *argp); 7 22 #else 8 23 static inline void fb_console_init(void) {} 9 24 static inline void fb_console_exit(void) {} 25 + static inline int fbcon_fb_registered(struct fb_info *info) { return 0; } 26 + static inline void fbcon_fb_unregistered(struct fb_info *info) {} 27 + static inline void fbcon_fb_unbind(struct fb_info *info) {} 28 + static inline void fbcon_suspended(struct fb_info *info) {} 29 + static inline void fbcon_resumed(struct fb_info *info) {} 30 + static inline int fbcon_mode_deleted(struct fb_info *info, 31 + struct fb_videomode *mode) { return 0; } 32 + static inline void fbcon_new_modelist(struct fb_info *info) {} 33 + static inline void fbcon_get_requirement(struct fb_info *info, 34 + struct fb_blit_caps *caps) {} 35 + static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {} 36 + static inline void fbcon_update_vcs(struct fb_info *info, bool all) {} 37 + static inline void fbcon_remap_all(struct fb_info *info) {} 38 + static inline int fbcon_set_con2fb_map_ioctl(void __user *argp) { return 0; } 39 + static inline int fbcon_get_con2fb_map_ioctl(void __user *argp) { return 0; } 10 40 #endif 11 41 12 42 #endif /* _LINUX_FBCON_H */
-32
include/video/omapfb_dss.h
··· 114 114 OMAP_DSS_COLOR_KEY_VID_SRC = 1, 115 115 }; 116 116 117 - enum omap_rfbi_te_mode { 118 - OMAP_DSS_RFBI_TE_MODE_1 = 1, 119 - OMAP_DSS_RFBI_TE_MODE_2 = 2, 120 - }; 121 - 122 117 enum omap_dss_signal_level { 123 118 OMAPDSS_SIG_ACTIVE_LOW, 124 119 OMAPDSS_SIG_ACTIVE_HIGH, ··· 182 187 OMAP_DSS_OUTPUT_DSI2 = 1 << 4, 183 188 OMAP_DSS_OUTPUT_VENC = 1 << 5, 184 189 OMAP_DSS_OUTPUT_HDMI = 1 << 6, 185 - }; 186 - 187 - /* RFBI */ 188 - 189 - struct rfbi_timings { 190 - int cs_on_time; 191 - int cs_off_time; 192 - int we_on_time; 193 - int we_off_time; 194 - int re_on_time; 195 - int re_off_time; 196 - int we_cycle_time; 197 - int re_cycle_time; 198 - int cs_pulse_width; 199 - int access_time; 200 - 201 - int clk_div; 202 - 203 - u32 tim[5]; /* set by rfbi_convert_timings() */ 204 - 205 - int converted; 206 190 }; 207 191 208 192 /* DSI */ ··· 615 641 } dpi; 616 642 617 643 struct { 618 - u8 channel; 619 - u8 data_lines; 620 - } rfbi; 621 - 622 - struct { 623 644 u8 datapairs; 624 645 } sdi; 625 646 ··· 637 668 638 669 struct { 639 670 u8 pixel_size; 640 - struct rfbi_timings rfbi_timings; 641 671 } ctrl; 642 672 643 673 const char *name;