History

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 ...

Linus Torvalds committed 7 years ago

Commit 2d41ef52 parents ed63b9c 732146a82 files · +582 −3259Browse files

Unified · Split

82 files
  1. arch/arm/mach-pxa/am200epd.c +11 −2
  2. drivers/gpu/vga/Kconfig +1 −0
  3. drivers/gpu/vga/vga_switcheroo.c +3 −8
  4. drivers/hid/hid-picolcd_fb.c +1 −3
  5. drivers/media/pci/ivtv/ivtvfb.c +1 −5
  6. drivers/staging/fbtft/fbtft-core.c +3 −1
  7. drivers/staging/olpc_dcon/TODO +7 −0
  8. drivers/staging/olpc_dcon/olpc_dcon.c +1 −5
  9. drivers/tty/vt/vt.c +18 −0
  10. drivers/video/backlight/backlight.c +1 −1
  11. drivers/video/backlight/lcd.c +0 −12
  12. drivers/video/console/dummycon.c +6 −0
  13. drivers/video/fbdev/Kconfig +15 −19
  14. drivers/video/fbdev/Makefile +0 −1
  15. drivers/video/fbdev/amifb.c +1 −3
  16. drivers/video/fbdev/arkfb.c +1 −3
  17. drivers/video/fbdev/atafb.c +0 −21
  18. drivers/video/fbdev/atmel_lcdfb.c +4 −6
  19. drivers/video/fbdev/aty/aty128fb.c +2 −67
  20. drivers/video/fbdev/aty/atyfb_base.c +5 −8
  21. drivers/video/fbdev/aty/radeon_base.c +0 −2
  22. drivers/video/fbdev/au1200fb.c +4 −15
  23. drivers/video/fbdev/chipsfb.c +0 −1
  24. drivers/video/fbdev/cirrusfb.c +1 −4
  25. drivers/video/fbdev/controlfb.c +4 −4
  26. drivers/video/fbdev/core/fbcmap.c +1 −5
  27. drivers/video/fbdev/core/fbcon.c +134 −180
  28. drivers/video/fbdev/core/fbcon.h +3 −3
  29. drivers/video/fbdev/core/fbmem.c +145 −254
  30. drivers/video/fbdev/core/fbsysfs.c +8 −12
  31. drivers/video/fbdev/cyber2000fb.c +0 −6
  32. drivers/video/fbdev/da8xx-fb.c +0 −1
  33. drivers/video/fbdev/efifb.c +5 −1
  34. drivers/video/fbdev/gbefb.c +7 −12
  35. drivers/video/fbdev/grvga.c +1 −3
  36. drivers/video/fbdev/gxt4500.c +2 −3
  37. drivers/video/fbdev/hyperv_fb.c +1 −3
  38. drivers/video/fbdev/i740fb.c +1 −3
  39. drivers/video/fbdev/imsttfb.c +1 −4
  40. drivers/video/fbdev/imxfb.c +5 −6
  41. drivers/video/fbdev/intelfb/intelfbdrv.c +3 −4
  42. drivers/video/fbdev/jz4740_fb.c +1 −10
  43. drivers/video/fbdev/mb862xx/mb862xxfbdrv.c +1 −4
  44. drivers/video/fbdev/mbx/mbxfb.c +1 −3
  45. drivers/video/fbdev/mmp/hw/mmp_ctrl.c +4 −4
  46. drivers/video/fbdev/mxsfb.c +0 −1028
  47. drivers/video/fbdev/neofb.c +1 −8
  48. drivers/video/fbdev/omap/omapfb_main.c +0 −2
  49. drivers/video/fbdev/omap2/omapfb/dss/Kconfig +0 −12
  50. drivers/video/fbdev/omap2/omapfb/dss/Makefile +0 −1
  51. drivers/video/fbdev/omap2/omapfb/dss/core.c +0 −6
  52. drivers/video/fbdev/omap2/omapfb/dss/dss.h +0 −4
  53. drivers/video/fbdev/omap2/omapfb/dss/rfbi.c +0 −1067
  54. drivers/video/fbdev/omap2/omapfb/omapfb-main.c +1 −5
  55. drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c +7 −14
  56. drivers/video/fbdev/platinumfb.c +2 −3
  57. drivers/video/fbdev/pmag-aa-fb.c +1 −3
  58. drivers/video/fbdev/pmag-ba-fb.c +1 −3
  59. drivers/video/fbdev/pmagb-b-fb.c +1 −3
  60. drivers/video/fbdev/pvr2fb.c +87 −101
  61. drivers/video/fbdev/riva/fbdev.c +0 −1
  62. drivers/video/fbdev/s3c-fb.c +11 −13
  63. drivers/video/fbdev/s3fb.c +1 −3
  64. drivers/video/fbdev/sa1100fb.c +0 −25
  65. drivers/video/fbdev/savage/savagefb_driver.c +1 −8
  66. drivers/video/fbdev/sh_mobile_lcdcfb.c +4 −136
  67. drivers/video/fbdev/sh_mobile_lcdcfb.h +0 −5
  68. drivers/video/fbdev/sm501fb.c +1 −3
  69. drivers/video/fbdev/sm712fb.c +0 −1
  70. drivers/video/fbdev/smscufx.c +1 −3
  71. drivers/video/fbdev/ssd1307fb.c +1 −3
  72. drivers/video/fbdev/sunxvr1000.c +0 −1
  73. drivers/video/fbdev/sunxvr2500.c +0 −1
  74. drivers/video/fbdev/sunxvr500.c +0 −1
  75. drivers/video/fbdev/tgafb.c +1 −3
  76. drivers/video/fbdev/udlfb.c +1 −3
  77. drivers/video/fbdev/via/viafbdev.c +1 −5
  78. drivers/video/fbdev/vt8623fb.c +1 −3
  79. include/linux/console_struct.h +1 −4
  80. include/linux/fb.h +12 −33
  81. include/linux/fbcon.h +30 −0
  82. include/video/omapfb_dss.h +0 −32
arch/arm/mach-pxa/am200epd.c+11−2
@@ -347,8 +347,17 @@ int __init am200_init(void) · 346 unmodified lines
347347 {
348348 int ret;
349349
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+ */
352361 fb_register_client(&am200_fb_notif);
353362
354363 pxa2xx_mfp_config(ARRAY_AND_SIZE(am200_pin_config));
drivers/gpu/vga/Kconfig+1−0
@@ -23,6 +23,7 @@ config VGA_SWITCHEROO · 22 unmodified lines
2323 depends on X86
2424 depends on ACPI
2525 depends on PCI
26+ depends on (FRAMEBUFFER_CONSOLE=n || FB=y)
2627 select VGA_ARB
2728 help
2829 Many laptops released in 2008/9/10 have two GPUs with a multiplexer
drivers/gpu/vga/vga_switcheroo.c+3−8
@@ -35,6 +35,7 @@ · 34 unmodified lines
3535 #include <linux/debugfs.h>
3636 #include <linux/fb.h>
3737 #include <linux/fs.h>
38+#include <linux/fbcon.h>
3839 #include <linux/module.h>
3940 #include <linux/pci.h>
4041 #include <linux/pm_domain.h>
@@ -736,14 +737,8 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client) · 695 unmodified lines
736737 if (!active->driver_power_control)
737738 set_audio_state(active->id, VGA_SWITCHEROO_OFF);
738739
739− if (new_client->fb_info) {
740− struct fb_event event;
741−
742− console_lock();
743− event.info = new_client->fb_info;
744− fb_notifier_call_chain(FB_EVENT_REMAP_ALL_CONSOLE, &event);
745− console_unlock();
746− }
740+ if (new_client->fb_info)
741+ fbcon_remap_all(new_client->fb_info);
747742
748743 mutex_lock(&vgasr_priv.mux_hw_lock);
749744 ret = vgasr_priv.handler->switchto(new_client->id);
drivers/hid/hid-picolcd_fb.c+1−3
@@ -512,10 +512,8 @@ int picolcd_init_framebuffer(struct picolcd_data *data) · 511 unmodified lines
512512 sizeof(struct fb_deferred_io) +
513513 sizeof(struct picolcd_fb_data) +
514514 PICOLCDFB_SIZE, dev);
515− if (info == NULL) {
516− dev_err(dev, "failed to allocate a framebuffer\n");
515+ if (!info)
517516 goto err_nomem;
518− }
519517
520518 info->fbdefio = info->par;
521519 *info->fbdefio = picolcd_fb_defio;
drivers/media/pci/ivtv/ivtvfb.c+1−5
@@ -1256,11 +1256,7 @@ static int ivtvfb_callback_cleanup(struct device *dev, void *p) · 1255 unmodified lines
12561256 itv->streams[IVTV_DEC_STREAM_TYPE_MPG].vdev.device_caps &=
12571257 ~V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
12581258 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);
12641260 IVTVFB_INFO("Unregister framebuffer %d\n", itv->instance);
12651261 itv->ivtvfb_restore = NULL;
12661262 ivtvfb_blank(FB_BLANK_VSYNC_SUSPEND, &oi->ivtvfb_info);
drivers/staging/fbtft/fbtft-core.c+3−1
@@ -891,7 +891,9 @@ int fbtft_unregister_framebuffer(struct fb_info *fb_info) · 890 unmodified lines
891891 if (par->fbtftops.unregister_backlight)
892892 par->fbtftops.unregister_backlight(par);
893893 fbtft_sysfs_exit(par);
894− return unregister_framebuffer(fb_info);
894+ unregister_framebuffer(fb_info);
895+
896+ return 0;
895897 }
896898 EXPORT_SYMBOL(fbtft_unregister_framebuffer);
897899
drivers/staging/olpc_dcon/TODO+7−0
@@ -1,4 +1,11 @@
11 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.
29 - see if vx855 gpio API can be made similar enough to cs5535 so we can
310 share more code
411 - convert all uses of the old GPIO API from <linux/gpio.h> to the
drivers/staging/olpc_dcon/olpc_dcon.c+1−5
@@ -250,11 +250,7 @@ static bool dcon_blank_fb(struct dcon_priv *dcon, bool blank) · 249 unmodified lines
250250 int err;
251251
252252 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);
258254
259255 dcon->ignore_fb_events = true;
260256 err = fb_blank(dcon->fbinfo,
drivers/tty/vt/vt.c+18−0
@@ -3822,6 +3822,8 @@ int con_is_bound(const struct consw *csw) · 3821 unmodified lines
38223822 {
38233823 int i, bound = 0;
38243824
3825+ WARN_CONSOLE_UNLOCKED();
3826+
38253827 for (i = 0; i < MAX_NR_CONSOLES; i++) {
38263828 if (con_driver_map[i] == csw) {
38273829 bound = 1;
@@ -3833,6 +3835,20 @@ int con_is_bound(const struct consw *csw) · 5 unmodified lines
38333835 }
38343836 EXPORT_SYMBOL(con_is_bound);
38353837
3838+/**
3839+ * con_is_visible - checks whether the current console is visible
3840+ * @vc: virtual console
3841+ *
3842+ * RETURNS: zero if not visible, nonzero if visible
3843+ */
3844+bool con_is_visible(const struct vc_data *vc)
3845+{
3846+ WARN_CONSOLE_UNLOCKED();
3847+
3848+ return *vc->vc_display_fg == vc;
3849+}
3850+EXPORT_SYMBOL(con_is_visible);
3851+
38363852 /**
38373853 * con_debug_enter - prepare the console for the kernel debugger
38383854 * @sw: console driver
@@ -4166,6 +4182,8 @@ void do_blank_screen(int entering_gfx) · 327 unmodified lines
41664182 struct vc_data *vc = vc_cons[fg_console].d;
41674183 int i;
41684184
4185+ might_sleep();
4186+
41694187 WARN_CONSOLE_UNLOCKED();
41704188
41714189 if (console_blanked) {
drivers/video/backlight/backlight.c+1−1
@@ -47,7 +47,7 @@ static int fb_notifier_callback(struct notifier_block *self, · 46 unmodified lines
4747 int fb_blank = 0;
4848
4949 /* 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)
5151 return 0;
5252
5353 bd = container_of(self, struct backlight_device, fb_notif);
drivers/video/backlight/lcd.c+0−12
@@ -30,18 +30,6 @@ static int fb_notifier_callback(struct notifier_block *self, · 29 unmodified lines
3030 struct lcd_device *ld;
3131 struct fb_event *evdata = data;
3232
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−
4533 ld = container_of(self, struct lcd_device, fb_notif);
4634 if (!ld->ops)
4735 return 0;
drivers/video/console/dummycon.c+6−0
@@ -34,6 +34,8 @@ static bool dummycon_putc_called; · 33 unmodified lines
3434
3535 void dummycon_register_output_notifier(struct notifier_block *nb)
3636 {
37+ WARN_CONSOLE_UNLOCKED();
38+
3739 raw_notifier_chain_register(&dummycon_output_nh, nb);
3840
3941 if (dummycon_putc_called)
@@ -42,11 +44,15 @@ void dummycon_register_output_notifier(struct notifier_block *nb) · 2 unmodified lines
4244
4345 void dummycon_unregister_output_notifier(struct notifier_block *nb)
4446 {
47+ WARN_CONSOLE_UNLOCKED();
48+
4549 raw_notifier_chain_unregister(&dummycon_output_nh, nb);
4650 }
4751
4852 static void dummycon_putc(struct vc_data *vc, int c, int ypos, int xpos)
4953 {
54+ WARN_CONSOLE_UNLOCKED();
55+
5056 dummycon_putc_called = true;
5157 raw_notifier_call_chain(&dummycon_output_nh, 0, NULL);
5258 }
drivers/video/fbdev/Kconfig+15−19
@@ -332,7 +332,8 @@ config FB_SA1100 · 331 unmodified lines
332332
333333 config FB_IMX
334334 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
336337 select LCD_CLASS_DEVICE
337338 select FB_CFB_FILLRECT
338339 select FB_CFB_COPYAREA
@@ -670,7 +671,8 @@ config FB_HGA · 331 unmodified lines
670671
671672 config FB_GBE
672673 bool "SGI Graphics Backend frame buffer support"
673− depends on (FB = y) && SGI_IP32
674+ depends on (FB = y) && HAS_IOMEM
675+ depends on SGI_IP32 || COMPILE_TEST
674676 select FB_CFB_FILLRECT
675677 select FB_CFB_COPYAREA
676678 select FB_CFB_IMAGEBLIT
@@ -808,7 +810,8 @@ config FB_XVR1000 · 131 unmodified lines
808810
809811 config FB_PVR2
810812 tristate "NEC PowerVR 2 display support"
811− depends on FB && SH_DREAMCAST
813+ depends on FB && HAS_IOMEM
814+ depends on SH_DREAMCAST || COMPILE_TEST
812815 select FB_CFB_FILLRECT
813816 select FB_CFB_COPYAREA
814817 select FB_CFB_IMAGEBLIT
@@ -856,7 +859,8 @@ config FB_S1D13XXX · 41 unmodified lines
856859
857860 config FB_ATMEL
858861 tristate "AT91 LCD Controller support"
859− depends on FB && OF && HAVE_FB_ATMEL
862+ depends on FB && OF && HAVE_CLK && HAS_IOMEM
863+ depends on HAVE_FB_ATMEL || COMPILE_TEST
860864 select FB_BACKLIGHT
861865 select FB_CFB_FILLRECT
862866 select FB_CFB_COPYAREA
@@ -1729,7 +1733,8 @@ config FB_68328 · 866 unmodified lines
17291733
17301734 config FB_PXA168
17311735 tristate "PXA168/910 LCD framebuffer support"
1732− depends on FB && (CPU_PXA168 || CPU_PXA910)
1736+ depends on FB && HAVE_CLK && HAS_IOMEM
1737+ depends on CPU_PXA168 || CPU_PXA910 || COMPILE_TEST
17331738 select FB_CFB_FILLRECT
17341739 select FB_CFB_COPYAREA
17351740 select FB_CFB_IMAGEBLIT
@@ -1873,7 +1878,8 @@ config FB_TMIO_ACCELL · 137 unmodified lines
18731878
18741879 config FB_S3C
18751880 tristate "Samsung S3C framebuffer support"
1876− depends on FB && (CPU_S3C2416 || ARCH_S3C64XX)
1881+ depends on FB && HAVE_CLK && HAS_IOMEM
1882+ depends on (CPU_S3C2416 || ARCH_S3C64XX) || COMPILE_TEST
18771883 select FB_CFB_FILLRECT
18781884 select FB_CFB_COPYAREA
18791885 select FB_CFB_IMAGEBLIT
@@ -2055,7 +2061,8 @@ config FB_SH7760 · 175 unmodified lines
20552061
20562062 config FB_DA8XX
20572063 tristate "DA8xx/OMAP-L1xx/AM335x Framebuffer support"
2058− depends on FB && (ARCH_DAVINCI_DA8XX || SOC_AM33XX)
2064+ depends on FB && HAVE_CLK && HAS_IOMEM
2065+ depends on ARCH_DAVINCI_DA8XX || SOC_AM33XX || COMPILE_TEST
20592066 select FB_CFB_FILLRECT
20602067 select FB_CFB_COPYAREA
20612068 select FB_CFB_IMAGEBLIT
@@ -2172,7 +2179,7 @@ config FB_EP93XX · 110 unmodified lines
21722179
21732180 config FB_PRE_INIT_FB
21742181 bool "Don't reinitialize, use bootloader's GDC/Display configuration"
2175− depends on FB && (FB_MB862XX_LIME || FB_MXS)
2182+ depends on FB && FB_MB862XX_LIME
21762183 ---help---
21772184 Select this option if display contents should be inherited as set by
21782185 the bootloader.
@@ -2213,17 +2220,6 @@ config FB_JZ4740 · 34 unmodified lines
22132220 help
22142221 Framebuffer support for the JZ4740 SoC.
22152222
2216−config FB_MXS
2217− tristate "MXS LCD framebuffer support"
2218− depends on FB && (ARCH_MXS || ARCH_MXC)
2219− select FB_CFB_FILLRECT
2220− select FB_CFB_COPYAREA
2221− select FB_CFB_IMAGEBLIT
2222− select FB_MODE_HELPERS
2223− select VIDEOMODE_HELPERS
2224− help
2225− Framebuffer support for the MXS SoC.
2226−
22272223 config FB_PUV3_UNIGFX
22282224 tristate "PKUnity v3 Unigfx framebuffer support"
22292225 depends on FB && UNICORE32 && ARCH_PUV3
drivers/video/fbdev/Makefile+0−1
@@ -131,7 +131,6 @@ obj-$(CONFIG_FB_VGA16) += vga16fb.o · 130 unmodified lines
131131 obj-$(CONFIG_FB_OF) += offb.o
132132 obj-$(CONFIG_FB_MX3) += mx3fb.o
133133 obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o
134−obj-$(CONFIG_FB_MXS) += mxsfb.o
135134 obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o
136135 obj-$(CONFIG_FB_SIMPLE) += simplefb.o
137136
drivers/video/fbdev/amifb.c+1−3
@@ -3554,10 +3554,8 @@ static int __init amifb_probe(struct platform_device *pdev) · 3553 unmodified lines
35543554 custom.dmacon = DMAF_ALL | DMAF_MASTER;
35553555
35563556 info = framebuffer_alloc(sizeof(struct amifb_par), &pdev->dev);
3557− if (!info) {
3558− dev_err(&pdev->dev, "framebuffer_alloc failed\n");
3557+ if (!info)
35593558 return -ENOMEM;
3560− }
35613559
35623560 strcpy(info->fix.id, "Amiga ");
35633561 info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
drivers/video/fbdev/arkfb.c+1−3
@@ -954,10 +954,8 @@ static int ark_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) · 953 unmodified lines
954954
955955 /* Allocate and fill driver data structure */
956956 info = framebuffer_alloc(sizeof(struct arkfb_info), &(dev->dev));
957− if (! info) {
958− dev_err(&(dev->dev), "cannot allocate memory\n");
957+ if (!info)
959958 return -ENOMEM;
960− }
961959
962960 par = info->par;
963961 mutex_init(&par->open_lock);
drivers/video/fbdev/atafb.c+0−21
@@ -77,29 +77,8 @@ · 76 unmodified lines
7777 #define SWITCH_SND7 0x80
7878 #define SWITCH_NONE 0x00
7979
80−
8180 #define up(x, r) (((x) + (r) - 1) & ~((r)-1))
8281
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−
10382
10483 static int default_par; /* default resolution (0=none) */
10584
drivers/video/fbdev/atmel_lcdfb.c+4−6
@@ -673,7 +673,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info) · 672 unmodified lines
673673 lcdc_writel(sinfo, ATMEL_LCDC_MVAL, 0);
674674
675675 /* Disable all interrupts */
676− lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0UL);
676+ lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0U);
677677 /* Enable FIFO & DMA errors */
678678 lcdc_writel(sinfo, ATMEL_LCDC_IER, ATMEL_LCDC_UFLWI | ATMEL_LCDC_OWRI | ATMEL_LCDC_MERI);
679679
@@ -950,7 +950,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) · 270 unmodified lines
950950 struct fb_videomode fb_vm;
951951 struct gpio_desc *gpiod;
952952 struct videomode vm;
953− int ret = -ENOENT;
953+ int ret;
954954 int i;
955955
956956 sinfo->config = (struct atmel_lcdfb_config*)
@@ -1053,10 +1053,8 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) · 96 unmodified lines
10531053
10541054 ret = -ENOMEM;
10551055 info = framebuffer_alloc(sizeof(struct atmel_lcdfb_info), dev);
1056− if (!info) {
1057− dev_err(dev, "cannot allocate memory\n");
1056+ if (!info)
10581057 goto out;
1059− }
10601058
10611059 sinfo = info->par;
10621060 sinfo->pdev = pdev;
@@ -1291,7 +1289,7 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg) · 228 unmodified lines
12911289 * We don't want to handle interrupts while the clock is
12921290 * stopped. It may take forever.
12931291 */
1294− lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0UL);
1292+ lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0U);
12951293
12961294 sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_CTR);
12971295 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0);
drivers/video/fbdev/aty/aty128fb.c+2−67
@@ -2103,10 +2103,9 @@ static int aty128_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 2102 unmodified lines
21032103
21042104 /* We have the resources. Now virtualize them */
21052105 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)
21082107 goto err_free_mmio;
2109− }
2108+
21102109 par = info->par;
21112110
21122111 info->pseudo_palette = par->pseudo_palette;
@@ -2350,70 +2349,6 @@ static int aty128fb_ioctl(struct fb_info *info, u_int cmd, u_long arg) · 237 unmodified lines
23502349 return -EINVAL;
23512350 }
23522351
2353−#if 0
2354− /*
2355− * Accelerated functions
2356− */
2357−
2358−static inline void aty128_rectcopy(int srcx, int srcy, int dstx, int dsty,
2359− u_int width, u_int height,
2360− struct fb_info_aty128 *par)
2361−{
2362− u32 save_dp_datatype, save_dp_cntl, dstval;
2363−
2364− if (!width || !height)
2365− return;
2366−
2367− dstval = depth_to_dst(par->current_par.crtc.depth);
2368− if (dstval == DST_24BPP) {
2369− srcx *= 3;
2370− dstx *= 3;
2371− width *= 3;
2372− } else if (dstval == -EINVAL) {
2373− printk("aty128fb: invalid depth or RGBA\n");
2374− return;
2375− }
2376−
2377− wait_for_fifo(2, par);
2378− save_dp_datatype = aty_ld_le32(DP_DATATYPE);
2379− save_dp_cntl = aty_ld_le32(DP_CNTL);
2380−
2381− wait_for_fifo(6, par);
2382− aty_st_le32(SRC_Y_X, (srcy << 16) | srcx);
2383− aty_st_le32(DP_MIX, ROP3_SRCCOPY | DP_SRC_RECT);
2384− aty_st_le32(DP_CNTL, DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM);
2385− aty_st_le32(DP_DATATYPE, save_dp_datatype | dstval | SRC_DSTCOLOR);
2386−
2387− aty_st_le32(DST_Y_X, (dsty << 16) | dstx);
2388− aty_st_le32(DST_HEIGHT_WIDTH, (height << 16) | width);
2389−
2390− par->blitter_may_be_busy = 1;
2391−
2392− wait_for_fifo(2, par);
2393− aty_st_le32(DP_DATATYPE, save_dp_datatype);
2394− aty_st_le32(DP_CNTL, save_dp_cntl);
2395−}
2396−
2397−
2398− /*
2399− * Text mode accelerated functions
2400− */
2401−
2402−static void fbcon_aty128_bmove(struct display *p, int sy, int sx, int dy,
2403− int dx, int height, int width)
2404−{
2405− sx *= fontwidth(p);
2406− sy *= fontheight(p);
2407− dx *= fontwidth(p);
2408− dy *= fontheight(p);
2409− width *= fontwidth(p);
2410− height *= fontheight(p);
2411−
2412− aty128_rectcopy(sx, sy, dx, dy, width, height,
2413− (struct fb_info_aty128 *)p->fb_info);
2414−}
2415−#endif /* 0 */
2416−
24172352 static void aty128_set_suspend(struct aty128fb_par *par, int suspend)
24182353 {
24192354 u32 pmgt;
drivers/video/fbdev/aty/atyfb_base.c+5−8
@@ -3550,10 +3550,9 @@ static int atyfb_pci_probe(struct pci_dev *pdev, · 3549 unmodified lines
35503550
35513551 /* Allocate framebuffer */
35523552 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)
35553554 return -ENOMEM;
3556− }
3555+
35573556 par = info->par;
35583557 par->bus_type = PCI;
35593558 info->fix = atyfb_fix;
@@ -3643,10 +3642,9 @@ static int __init atyfb_atari_probe(void) · 83 unmodified lines
36433642 }
36443643
36453644 info = framebuffer_alloc(sizeof(struct atyfb_par), NULL);
3646− if (!info) {
3647− PRINTKE("atyfb_atari_probe() can't alloc fb_info\n");
3645+ if (!info)
36483646 return -ENOMEM;
3649− }
3647+
36503648 par = info->par;
36513649
36523650 info->fix = atyfb_fix;
@@ -3916,8 +3914,7 @@ static int atyfb_reboot_notify(struct notifier_block *nb, · 263 unmodified lines
39163914 if (!reboot_info)
39173915 goto out;
39183916
3919− if (!lock_fb_info(reboot_info))
3920− goto out;
3917+ lock_fb_info(reboot_info);
39213918
39223919 par = reboot_info->par;
39233920
drivers/video/fbdev/aty/radeon_base.c+0−2
@@ -2294,8 +2294,6 @@ static int radeonfb_pci_register(struct pci_dev *pdev, · 2293 unmodified lines
22942294
22952295 info = framebuffer_alloc(sizeof(struct radeonfb_info), &pdev->dev);
22962296 if (!info) {
2297− printk (KERN_ERR "radeonfb (%s): could not allocate memory\n",
2298− pci_name(pdev));
22992297 ret = -ENOMEM;
23002298 goto err_disable;
23012299 }
drivers/video/fbdev/au1200fb.c+4−15
@@ -147,6 +147,7 @@ struct au1200_lcd_iodata_t { · 146 unmodified lines
147147 struct au1200fb_device {
148148 struct fb_info *fb_info; /* FB driver info record */
149149 struct au1200fb_platdata *pd;
150+ struct device *dev;
150151
151152 int plane;
152153 unsigned char* fb_mem; /* FrameBuffer memory map */
@@ -1232,10 +1233,8 @@ static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) · 1079 unmodified lines
12321233 {
12331234 struct au1200fb_device *fbdev = info->par;
12341235
1235− vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1236− pgprot_val(vma->vm_page_prot) |= _CACHE_MASK; /* CCA=7 */
1237−
1238− return vm_iomap_memory(vma, fbdev->fb_phys, fbdev->fb_len);
1236+ return dma_mmap_attrs(fbdev->dev, vma, fbdev->fb_mem, fbdev->fb_phys,
1237+ fbdev->fb_len, DMA_ATTR_NON_CONSISTENT);
12391238 }
12401239
12411240 static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata)
@@ -1647,7 +1646,6 @@ static int au1200fb_drv_probe(struct platform_device *dev) · 405 unmodified lines
16471646 struct au1200fb_device *fbdev;
16481647 struct au1200fb_platdata *pd;
16491648 struct fb_info *fbi = NULL;
1650− unsigned long page;
16511649 int bpp, plane, ret, irq;
16521650
16531651 print_info("" DRIVER_DESC "");
@@ -1685,6 +1683,7 @@ static int au1200fb_drv_probe(struct platform_device *dev) · 31 unmodified lines
16851683 fbdev = fbi->par;
16861684 fbdev->fb_info = fbi;
16871685 fbdev->pd = pd;
1686+ fbdev->dev = &dev->dev;
16881687
16891688 fbdev->plane = plane;
16901689
@@ -1702,16 +1701,6 @@ static int au1200fb_drv_probe(struct platform_device *dev) · 11 unmodified lines
17021701 goto failed;
17031702 }
17041703
1705− /*
1706− * Set page reserved so that mmap will work. This is necessary
1707− * since we'll be remapping normal memory.
1708− */
1709− for (page = (unsigned long)fbdev->fb_phys;
1710− page < PAGE_ALIGN((unsigned long)fbdev->fb_phys +
1711− fbdev->fb_len);
1712− page += PAGE_SIZE) {
1713− SetPageReserved(pfn_to_page(page >> PAGE_SHIFT)); /* LCD DMA is NOT coherent on Au1200 */
1714− }
17151704 print_dbg("Framebuffer memory map at %p", fbdev->fb_mem);
17161705 print_dbg("phys=0x%08x, size=%dK", fbdev->fb_phys, fbdev->fb_len / 1024);
17171706
drivers/video/fbdev/chipsfb.c+0−1
@@ -366,7 +366,6 @@ static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent) · 365 unmodified lines
366366
367367 p = framebuffer_alloc(0, &dp->dev);
368368 if (p == NULL) {
369− dev_err(&dp->dev, "Cannot allocate framebuffer structure\n");
370369 rc = -ENOMEM;
371370 goto err_disable;
372371 }
drivers/video/fbdev/cirrusfb.c+1−4
@@ -2093,7 +2093,6 @@ static int cirrusfb_pci_register(struct pci_dev *pdev, · 2092 unmodified lines
20932093
20942094 info = framebuffer_alloc(sizeof(struct cirrusfb_info), &pdev->dev);
20952095 if (!info) {
2096− printk(KERN_ERR "cirrusfb: could not allocate memory\n");
20972096 ret = -ENOMEM;
20982097 goto err_out;
20992098 }
@@ -2206,10 +2205,8 @@ static int cirrusfb_zorro_register(struct zorro_dev *z, · 106 unmodified lines
22062205 struct cirrusfb_info *cinfo;
22072206
22082207 info = framebuffer_alloc(sizeof(struct cirrusfb_info), &z->dev);
2209− if (!info) {
2210− printk(KERN_ERR "cirrusfb: could not allocate memory\n");
2208+ if (!info)
22112209 return -ENOMEM;
2212− }
22132210
22142211 zcl = (const struct zorrocl *)ent->driver_data;
22152212 btype = zcl->type;
drivers/video/fbdev/controlfb.c+4−4
@@ -182,7 +182,7 @@ int init_module(void) · 181 unmodified lines
182182 int ret = -ENXIO;
183183
184184 dp = of_find_node_by_name(NULL, "control");
185− if (dp != 0 && !control_of_init(dp))
185+ if (dp && !control_of_init(dp))
186186 ret = 0;
187187 of_node_put(dp);
188188
@@ -580,7 +580,7 @@ static int __init control_init(void) · 391 unmodified lines
580580 control_setup(option);
581581
582582 dp = of_find_node_by_name(NULL, "control");
583− if (dp != 0 && !control_of_init(dp))
583+ if (dp && !control_of_init(dp))
584584 ret = 0;
585585 of_node_put(dp);
586586
@@ -683,8 +683,8 @@ static int __init control_of_init(struct device_node *dp) · 96 unmodified lines
683683 return -ENXIO;
684684 }
685685 p = kzalloc(sizeof(*p), GFP_KERNEL);
686− if (p == 0)
687− return -ENXIO;
686+ if (!p)
687+ return -ENOMEM;
688688 control_fb = p; /* save it for cleanups */
689689
690690 /* Map in frame buffer and registers */
drivers/video/fbdev/core/fbcmap.c+1−5
@@ -285,11 +285,7 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info) · 284 unmodified lines
285285 goto out;
286286 }
287287 umap.start = cmap->start;
288− if (!lock_fb_info(info)) {
289− rc = -ENODEV;
290− goto out;
291− }
292−
288+ lock_fb_info(info);
293289 rc = fb_set_cmap(&umap, info);
294290 unlock_fb_info(info);
295291 out:
drivers/video/fbdev/core/fbcon.c+134−180
@@ -76,6 +76,7 @@ · 75 unmodified lines
7676 #include <linux/init.h>
7777 #include <linux/interrupt.h>
7878 #include <linux/crc32.h> /* For counting font checksums */
79+#include <linux/uaccess.h>
7980 #include <asm/fb.h>
8081 #include <asm/irq.h>
8182
@@ -87,13 +88,32 @@ · 5 unmodified lines
8788 # define DPRINTK(fmt, args...)
8889 #endif
8990
91+/*
92+ * FIXME: Locking
93+ *
94+ * - fbcon state itself is protected by the console_lock, and the code does a
95+ * pretty good job at making sure that lock is held everywhere it's needed.
96+ *
97+ * - access to the registered_fb array is entirely unprotected. This should use
98+ * proper object lifetime handling, i.e. get/put_fb_info. This also means
99+ * switching from indices to proper pointers for fb_info everywhere.
100+ *
101+ * - fbcon doesn't bother with fb_lock/unlock at all. This is buggy, since it
102+ * means concurrent access to the same fbdev from both fbcon and userspace
103+ * will blow up. To fix this all fbcon calls from fbmem.c need to be moved out
104+ * of fb_lock/unlock protected sections, since otherwise we'll recurse and
105+ * deadlock eventually. Aside: Due to these deadlock issues the fbdev code in
106+ * fbmem.c cannot use locking asserts, and there's lots of callers which get
107+ * the rules wrong, e.g. fbsysfs.c entirely missed fb_lock/unlock calls too.
108+ */
109+
90110 enum {
91111 FBCON_LOGO_CANSHOW = -1, /* the logo can be shown */
92112 FBCON_LOGO_DRAW = -2, /* draw the logo to a console */
93113 FBCON_LOGO_DONTSHOW = -3 /* do not show the logo */
94114 };
95115
96−static struct display fb_display[MAX_NR_CONSOLES];
116+static struct fbcon_display fb_display[MAX_NR_CONSOLES];
97117
98118 static signed char con2fb_map[MAX_NR_CONSOLES];
99119 static signed char con2fb_map_boot[MAX_NR_CONSOLES];
@@ -112,7 +132,6 @@ static int softback_lines; · 12 unmodified lines
112132 static int first_fb_vc;
113133 static int last_fb_vc = MAX_NR_CONSOLES - 1;
114134 static int fbcon_is_default = 1;
115−static int fbcon_has_exited;
116135 static int primary_device = -1;
117136 static int fbcon_has_console_bind;
118137
@@ -185,11 +204,11 @@ static __inline__ void ywrap_up(struct vc_data *vc, int count); · 66 unmodified lines
185204 static __inline__ void ywrap_down(struct vc_data *vc, int count);
186205 static __inline__ void ypan_up(struct vc_data *vc, int count);
187206 static __inline__ void ypan_down(struct vc_data *vc, int count);
188−static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int sx,
207+static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx,
189208 int dy, int dx, int height, int width, u_int y_break);
190209 static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var,
191210 int unit);
192−static void fbcon_redraw_move(struct vc_data *vc, struct display *p,
211+static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
193212 int line, int count, int dy);
194213 static void fbcon_modechanged(struct fb_info *info);
195214 static void fbcon_set_all_vcs(struct fb_info *info);
@@ -220,7 +239,7 @@ static void fbcon_rotate(struct fb_info *info, u32 rotate) · 24 unmodified lines
220239 fb_info = registered_fb[con2fb_map[ops->currcon]];
221240
222241 if (info == fb_info) {
223− struct display *p = &fb_display[ops->currcon];
242+ struct fbcon_display *p = &fb_display[ops->currcon];
224243
225244 if (rotate < 4)
226245 p->con_rotate = rotate;
@@ -235,7 +254,7 @@ static void fbcon_rotate_all(struct fb_info *info, u32 rotate) · 8 unmodified lines
235254 {
236255 struct fbcon_ops *ops = info->fbcon_par;
237256 struct vc_data *vc;
238− struct display *p;
257+ struct fbcon_display *p;
239258 int i;
240259
241260 if (!ops || ops->currcon < 0 || rotate > 3)
@@ -900,7 +919,7 @@ static int set_con2fb_map(int unit, int newidx, int user) · 658 unmodified lines
900919 * Low Level Operations
901920 */
902921 /* NOTE: fbcon cannot be __init: it may be called from do_take_over_console later */
903−static int var_to_display(struct display *disp,
922+static int var_to_display(struct fbcon_display *disp,
904923 struct fb_var_screeninfo *var,
905924 struct fb_info *info)
906925 {
@@ -925,7 +944,7 @@ static int var_to_display(struct display *disp, · 18 unmodified lines
925944 }
926945
927946 static void display_to_var(struct fb_var_screeninfo *var,
928− struct display *disp)
947+ struct fbcon_display *disp)
929948 {
930949 fb_videomode_to_var(var, disp->mode);
931950 var->xres_virtual = disp->xres_virtual;
@@ -946,7 +965,7 @@ static void display_to_var(struct fb_var_screeninfo *var, · 14 unmodified lines
946965 static const char *fbcon_startup(void)
947966 {
948967 const char *display_desc = "frame buffer device";
949− struct display *p = &fb_display[fg_console];
968+ struct fbcon_display *p = &fb_display[fg_console];
950969 struct vc_data *vc = vc_cons[fg_console].d;
951970 const struct font_desc *font = NULL;
952971 struct module *owner;
@@ -1050,23 +1069,26 @@ static const char *fbcon_startup(void) · 97 unmodified lines
10501069 info->var.bits_per_pixel);
10511070
10521071 fbcon_add_cursor_timer(info);
1053− fbcon_has_exited = 0;
10541072 return display_desc;
10551073 }
10561074
10571075 static void fbcon_init(struct vc_data *vc, int init)
10581076 {
1059− struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1077+ struct fb_info *info;
10601078 struct fbcon_ops *ops;
10611079 struct vc_data **default_mode = vc->vc_display_fg;
10621080 struct vc_data *svc = *default_mode;
1063− struct display *t, *p = &fb_display[vc->vc_num];
1081+ struct fbcon_display *t, *p = &fb_display[vc->vc_num];
10641082 int logo = 1, new_rows, new_cols, rows, cols, charcnt = 256;
10651083 int cap, ret;
10661084
1067− if (info_idx == -1 || info == NULL)
1085+ if (WARN_ON(info_idx == -1))
10681086 return;
10691087
1088+ if (con2fb_map[vc->vc_num] == -1)
1089+ con2fb_map[vc->vc_num] = info_idx;
1090+
1091+ info = registered_fb[con2fb_map[vc->vc_num]];
10701092 cap = info->flags;
10711093
10721094 if (logo_shown < 0 && console_loglevel <= CONSOLE_LOGLEVEL_QUIET)
@@ -1203,7 +1225,7 @@ static void fbcon_init(struct vc_data *vc, int init) · 130 unmodified lines
12031225 ops->p = &fb_display[fg_console];
12041226 }
12051227
1206−static void fbcon_free_font(struct display *p, bool freefont)
1228+static void fbcon_free_font(struct fbcon_display *p, bool freefont)
12071229 {
12081230 if (freefont && p->userfont && p->fontdata && (--REFCOUNT(p->fontdata) == 0))
12091231 kfree(p->fontdata - FONT_EXTRA_WORDS * sizeof(int));
@@ -1215,7 +1237,7 @@ static void set_vc_hi_font(struct vc_data *vc, bool set); · 5 unmodified lines
12151237
12161238 static void fbcon_deinit(struct vc_data *vc)
12171239 {
1218− struct display *p = &fb_display[vc->vc_num];
1240+ struct fbcon_display *p = &fb_display[vc->vc_num];
12191241 struct fb_info *info;
12201242 struct fbcon_ops *ops;
12211243 int idx;
@@ -1288,7 +1310,7 @@ static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height, · 66 unmodified lines
12881310 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
12891311 struct fbcon_ops *ops = info->fbcon_par;
12901312
1291− struct display *p = &fb_display[vc->vc_num];
1313+ struct fbcon_display *p = &fb_display[vc->vc_num];
12921314 u_int y_break;
12931315
12941316 if (fbcon_is_inactive(vc, info))
@@ -1324,7 +1346,7 @@ static void fbcon_putcs(struct vc_data *vc, const unsigned short *s, · 29 unmodified lines
13241346 int count, int ypos, int xpos)
13251347 {
13261348 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1327− struct display *p = &fb_display[vc->vc_num];
1349+ struct fbcon_display *p = &fb_display[vc->vc_num];
13281350 struct fbcon_ops *ops = info->fbcon_par;
13291351
13301352 if (!fbcon_is_inactive(vc, info))
@@ -1388,7 +1410,7 @@ static int scrollback_current = 0; · 57 unmodified lines
13881410 static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var,
13891411 int unit)
13901412 {
1391− struct display *p, *t;
1413+ struct fbcon_display *p, *t;
13921414 struct vc_data **default_mode, *vc;
13931415 struct vc_data *svc;
13941416 struct fbcon_ops *ops = info->fbcon_par;
@@ -1457,7 +1479,7 @@ static __inline__ void ywrap_up(struct vc_data *vc, int count) · 62 unmodified lines
14571479 {
14581480 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
14591481 struct fbcon_ops *ops = info->fbcon_par;
1460− struct display *p = &fb_display[vc->vc_num];
1482+ struct fbcon_display *p = &fb_display[vc->vc_num];
14611483
14621484 p->yscroll += count;
14631485 if (p->yscroll >= p->vrows) /* Deal with wrap */
@@ -1476,7 +1498,7 @@ static __inline__ void ywrap_down(struct vc_data *vc, int count) · 12 unmodified lines
14761498 {
14771499 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
14781500 struct fbcon_ops *ops = info->fbcon_par;
1479− struct display *p = &fb_display[vc->vc_num];
1501+ struct fbcon_display *p = &fb_display[vc->vc_num];
14801502
14811503 p->yscroll -= count;
14821504 if (p->yscroll < 0) /* Deal with wrap */
@@ -1494,7 +1516,7 @@ static __inline__ void ywrap_down(struct vc_data *vc, int count) · 11 unmodified lines
14941516 static __inline__ void ypan_up(struct vc_data *vc, int count)
14951517 {
14961518 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1497− struct display *p = &fb_display[vc->vc_num];
1519+ struct fbcon_display *p = &fb_display[vc->vc_num];
14981520 struct fbcon_ops *ops = info->fbcon_par;
14991521
15001522 p->yscroll += count;
@@ -1519,7 +1541,7 @@ static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) · 18 unmodified lines
15191541 {
15201542 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
15211543 struct fbcon_ops *ops = info->fbcon_par;
1522− struct display *p = &fb_display[vc->vc_num];
1544+ struct fbcon_display *p = &fb_display[vc->vc_num];
15231545
15241546 p->yscroll += count;
15251547
@@ -1542,7 +1564,7 @@ static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) · 16 unmodified lines
15421564 static __inline__ void ypan_down(struct vc_data *vc, int count)
15431565 {
15441566 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1545− struct display *p = &fb_display[vc->vc_num];
1567+ struct fbcon_display *p = &fb_display[vc->vc_num];
15461568 struct fbcon_ops *ops = info->fbcon_par;
15471569
15481570 p->yscroll -= count;
@@ -1567,7 +1589,7 @@ static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) · 18 unmodified lines
15671589 {
15681590 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
15691591 struct fbcon_ops *ops = info->fbcon_par;
1570− struct display *p = &fb_display[vc->vc_num];
1592+ struct fbcon_display *p = &fb_display[vc->vc_num];
15711593
15721594 p->yscroll -= count;
15731595
@@ -1587,7 +1609,7 @@ static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) · 13 unmodified lines
15871609 scrollback_current = 0;
15881610 }
15891611
1590−static void fbcon_redraw_softback(struct vc_data *vc, struct display *p,
1612+static void fbcon_redraw_softback(struct vc_data *vc, struct fbcon_display *p,
15911613 long delta)
15921614 {
15931615 int count = vc->vc_rows;
@@ -1680,7 +1702,7 @@ static void fbcon_redraw_softback(struct vc_data *vc, struct display *p, · 86 unmodified lines
16801702 }
16811703 }
16821704
1683−static void fbcon_redraw_move(struct vc_data *vc, struct display *p,
1705+static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
16841706 int line, int count, int dy)
16851707 {
16861708 unsigned short *s = (unsigned short *)
@@ -1715,7 +1737,7 @@ static void fbcon_redraw_move(struct vc_data *vc, struct display *p, · 28 unmodified lines
17151737 }
17161738
17171739 static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info,
1718− struct display *p, int line, int count, int ycount)
1740+ struct fbcon_display *p, int line, int count, int ycount)
17191741 {
17201742 int offset = ycount * vc->vc_cols;
17211743 unsigned short *d = (unsigned short *)
@@ -1764,7 +1786,7 @@ static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, · 42 unmodified lines
17641786 }
17651787 }
17661788
1767−static void fbcon_redraw(struct vc_data *vc, struct display *p,
1789+static void fbcon_redraw(struct vc_data *vc, struct fbcon_display *p,
17681790 int line, int count, int offset)
17691791 {
17701792 unsigned short *d = (unsigned short *)
@@ -1848,7 +1870,7 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, · 77 unmodified lines
18481870 enum con_scroll dir, unsigned int count)
18491871 {
18501872 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1851− struct display *p = &fb_display[vc->vc_num];
1873+ struct fbcon_display *p = &fb_display[vc->vc_num];
18521874 int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK;
18531875
18541876 if (fbcon_is_inactive(vc, info))
@@ -2052,7 +2074,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx, · 197 unmodified lines
20522074 int height, int width)
20532075 {
20542076 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
2055− struct display *p = &fb_display[vc->vc_num];
2077+ struct fbcon_display *p = &fb_display[vc->vc_num];
20562078
20572079 if (fbcon_is_inactive(vc, info))
20582080 return;
@@ -2071,7 +2093,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx, · 12 unmodified lines
20712093 p->vrows - p->yscroll);
20722094 }
20732095
2074−static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int sx,
2096+static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx,
20752097 int dy, int dx, int height, int width, u_int y_break)
20762098 {
20772099 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
@@ -2113,7 +2135,7 @@ static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s · 35 unmodified lines
21132135 height, width);
21142136 }
21152137
2116−static void updatescrollmode(struct display *p,
2138+static void updatescrollmode(struct fbcon_display *p,
21172139 struct fb_info *info,
21182140 struct vc_data *vc)
21192141 {
@@ -2165,7 +2187,7 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width, · 45 unmodified lines
21652187 {
21662188 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
21672189 struct fbcon_ops *ops = info->fbcon_par;
2168− struct display *p = &fb_display[vc->vc_num];
2190+ struct fbcon_display *p = &fb_display[vc->vc_num];
21692191 struct fb_var_screeninfo var = info->var;
21702192 int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh;
21712193
@@ -2210,7 +2232,7 @@ static int fbcon_switch(struct vc_data *vc) · 38 unmodified lines
22102232 {
22112233 struct fb_info *info, *old_info = NULL;
22122234 struct fbcon_ops *ops;
2213− struct display *p = &fb_display[vc->vc_num];
2235+ struct fbcon_display *p = &fb_display[vc->vc_num];
22142236 struct fb_var_screeninfo var;
22152237 int i, ret, prev_console, charcnt = 256;
22162238
@@ -2348,8 +2370,6 @@ static int fbcon_switch(struct vc_data *vc) · 131 unmodified lines
23482370 static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info,
23492371 int blank)
23502372 {
2351− struct fb_event event;
2352−
23532373 if (blank) {
23542374 unsigned short charmask = vc->vc_hi_font_mask ?
23552375 0x1ff : 0xff;
@@ -2360,14 +2380,6 @@ static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, · 4 unmodified lines
23602380 fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols);
23612381 vc->vc_video_erase_char = oldc;
23622382 }
2363−
2364−
2365− if (!lock_fb_info(info))
2366− return;
2367− event.info = info;
2368− event.data = &blank;
2369− fb_notifier_call_chain(FB_EVENT_CONBLANK, &event);
2370− unlock_fb_info(info);
23712383 }
23722384
23732385 static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
@@ -2394,9 +2406,8 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) · 20 unmodified lines
23942406 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW);
23952407 ops->cursor_flash = (!blank);
23962408
2397− if (!(info->flags & FBINFO_MISC_USEREVENT))
2398− if (fb_blank(info, blank))
2399− fbcon_generic_blank(vc, info, blank);
2409+ if (fb_blank(info, blank))
2410+ fbcon_generic_blank(vc, info, blank);
24002411 }
24012412
24022413 if (!blank)
@@ -2553,7 +2564,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, · 150 unmodified lines
25532564 {
25542565 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
25552566 struct fbcon_ops *ops = info->fbcon_par;
2556− struct display *p = &fb_display[vc->vc_num];
2567+ struct fbcon_display *p = &fb_display[vc->vc_num];
25572568 int resize;
25582569 int cnt;
25592570 char *old_data = NULL;
@@ -2601,7 +2612,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, · 41 unmodified lines
26012612
26022613 static int fbcon_copy_font(struct vc_data *vc, int con)
26032614 {
2604− struct display *od = &fb_display[con];
2615+ struct fbcon_display *od = &fb_display[con];
26052616 struct console_font *f = &vc->vc_font;
26062617
26072618 if (od->fontdata == f->data)
@@ -2826,7 +2837,7 @@ static void fbcon_scrolldelta(struct vc_data *vc, int lines) · 218 unmodified lines
28262837 {
28272838 struct fb_info *info = registered_fb[con2fb_map[fg_console]];
28282839 struct fbcon_ops *ops = info->fbcon_par;
2829− struct display *disp = &fb_display[fg_console];
2840+ struct fbcon_display *disp = &fb_display[fg_console];
28302841 int offset, limit, scrollback_old;
28312842
28322843 if (softback_top) {
@@ -2918,7 +2929,7 @@ static int fbcon_set_origin(struct vc_data *vc) · 85 unmodified lines
29182929 return 0;
29192930 }
29202931
2921−static void fbcon_suspended(struct fb_info *info)
2932+void fbcon_suspended(struct fb_info *info)
29222933 {
29232934 struct vc_data *vc = NULL;
29242935 struct fbcon_ops *ops = info->fbcon_par;
@@ -2931,7 +2942,7 @@ static void fbcon_suspended(struct fb_info *info) · 6 unmodified lines
29312942 fbcon_cursor(vc, CM_ERASE);
29322943 }
29332944
2934−static void fbcon_resumed(struct fb_info *info)
2945+void fbcon_resumed(struct fb_info *info)
29352946 {
29362947 struct vc_data *vc;
29372948 struct fbcon_ops *ops = info->fbcon_par;
@@ -2947,7 +2958,7 @@ static void fbcon_modechanged(struct fb_info *info) · 9 unmodified lines
29472958 {
29482959 struct fbcon_ops *ops = info->fbcon_par;
29492960 struct vc_data *vc;
2950− struct display *p;
2961+ struct fbcon_display *p;
29512962 int rows, cols;
29522963
29532964 if (!ops || ops->currcon < 0)
@@ -2987,7 +2998,7 @@ static void fbcon_set_all_vcs(struct fb_info *info) · 33 unmodified lines
29872998 {
29882999 struct fbcon_ops *ops = info->fbcon_par;
29893000 struct vc_data *vc;
2990− struct display *p;
3001+ struct fbcon_display *p;
29913002 int i, rows, cols, fg = -1;
29923003
29933004 if (!ops || ops->currcon < 0)
@@ -3018,11 +3029,21 @@ static void fbcon_set_all_vcs(struct fb_info *info) · 24 unmodified lines
30183029 fbcon_modechanged(info);
30193030 }
30203031
3021−static int fbcon_mode_deleted(struct fb_info *info,
3022− struct fb_videomode *mode)
3032+
3033+void fbcon_update_vcs(struct fb_info *info, bool all)
3034+{
3035+ if (all)
3036+ fbcon_set_all_vcs(info);
3037+ else
3038+ fbcon_modechanged(info);
3039+}
3040+EXPORT_SYMBOL(fbcon_update_vcs);
3041+
3042+int fbcon_mode_deleted(struct fb_info *info,
3043+ struct fb_videomode *mode)
30233044 {
30243045 struct fb_info *fb_info;
3025− struct display *p;
3046+ struct fbcon_display *p;
30263047 int i, j, found = 0;
30273048
30283049 /* before deletion, ensure that mode is not in use */
@@ -3045,7 +3066,7 @@ static int fbcon_mode_deleted(struct fb_info *info, · 16 unmodified lines
30453066 }
30463067
30473068 #ifdef CONFIG_VT_HW_CONSOLE_BINDING
3048−static int fbcon_unbind(void)
3069+static void fbcon_unbind(void)
30493070 {
30503071 int ret;
30513072
@@ -3054,25 +3075,21 @@ static int fbcon_unbind(void) · 2 unmodified lines
30543075
30553076 if (!ret)
30563077 fbcon_has_console_bind = 0;
3057−
3058− return ret;
30593078 }
30603079 #else
3061−static inline int fbcon_unbind(void)
3062−{
3063− return -EINVAL;
3064−}
3080+static inline void fbcon_unbind(void) {}
30653081 #endif /* CONFIG_VT_HW_CONSOLE_BINDING */
30663082
30673083 /* called with console_lock held */
3068−static int fbcon_fb_unbind(int idx)
3084+void fbcon_fb_unbind(struct fb_info *info)
30693085 {
30703086 int i, new_idx = -1, ret = 0;
3087+ int idx = info->node;
30713088
30723089 WARN_CONSOLE_UNLOCKED();
30733090
30743091 if (!fbcon_has_console_bind)
3075− return 0;
3092+ return;
30763093
30773094 for (i = first_fb_vc; i <= last_fb_vc; i++) {
30783095 if (con2fb_map[i] != idx &&
@@ -3105,26 +3122,24 @@ static int fbcon_fb_unbind(int idx) · 26 unmodified lines
31053122 idx, 0);
31063123 if (ret) {
31073124 con2fb_map[i] = idx;
3108− return ret;
3125+ return;
31093126 }
31103127 }
31113128 }
31123129 }
3113− ret = fbcon_unbind();
3130+ fbcon_unbind();
31143131 }
3115−
3116− return ret;
31173132 }
31183133
31193134 /* called with console_lock held */
3120−static int fbcon_fb_unregistered(struct fb_info *info)
3135+void fbcon_fb_unregistered(struct fb_info *info)
31213136 {
31223137 int i, idx;
31233138
31243139 WARN_CONSOLE_UNLOCKED();
31253140
31263141 if (deferred_takeover)
3127− return 0;
3142+ return;
31283143
31293144 idx = info->node;
31303145 for (i = first_fb_vc; i <= last_fb_vc; i++) {
@@ -3153,21 +3168,18 @@ static int fbcon_fb_unregistered(struct fb_info *info) · 22 unmodified lines
31533168
31543169 if (!num_registered_fb)
31553170 do_unregister_con_driver(&fb_con);
3156−
3157− return 0;
31583171 }
31593172
3160−/* called with console_lock held */
3161−static void fbcon_remap_all(int idx)
3173+void fbcon_remap_all(struct fb_info *info)
31623174 {
3163− int i;
3164−
3165− WARN_CONSOLE_UNLOCKED();
3175+ int i, idx = info->node;
31663176
3177+ console_lock();
31673178 if (deferred_takeover) {
31683179 for (i = first_fb_vc; i <= last_fb_vc; i++)
31693180 con2fb_map_boot[i] = idx;
31703181 fbcon_map_override();
3182+ console_unlock();
31713183 return;
31723184 }
31733185
@@ -3180,6 +3192,7 @@ static void fbcon_remap_all(int idx) · 6 unmodified lines
31803192 first_fb_vc + 1, last_fb_vc + 1);
31813193 info_idx = idx;
31823194 }
3195+ console_unlock();
31833196 }
31843197
31853198 #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
@@ -3213,7 +3226,7 @@ static inline void fbcon_select_primary(struct fb_info *info) · 27 unmodified lines
32133226 #endif /* CONFIG_FRAMEBUFFER_DETECT_PRIMARY */
32143227
32153228 /* called with console_lock held */
3216−static int fbcon_fb_registered(struct fb_info *info)
3229+int fbcon_fb_registered(struct fb_info *info)
32173230 {
32183231 int ret = 0, i, idx;
32193232
@@ -3247,7 +3260,7 @@ static int fbcon_fb_registered(struct fb_info *info) · 27 unmodified lines
32473260 return ret;
32483261 }
32493262
3250−static void fbcon_fb_blanked(struct fb_info *info, int blank)
3263+void fbcon_fb_blanked(struct fb_info *info, int blank)
32513264 {
32523265 struct fbcon_ops *ops = info->fbcon_par;
32533266 struct vc_data *vc;
@@ -3269,7 +3282,7 @@ static void fbcon_fb_blanked(struct fb_info *info, int blank) · 15 unmodified lines
32693282 ops->blank_state = blank;
32703283 }
32713284
3272−static void fbcon_new_modelist(struct fb_info *info)
3285+void fbcon_new_modelist(struct fb_info *info)
32733286 {
32743287 int i;
32753288 struct vc_data *vc;
@@ -3290,11 +3303,11 @@ static void fbcon_new_modelist(struct fb_info *info) · 14 unmodified lines
32903303 }
32913304 }
32923305
3293−static void fbcon_get_requirement(struct fb_info *info,
3294− struct fb_blit_caps *caps)
3306+void fbcon_get_requirement(struct fb_info *info,
3307+ struct fb_blit_caps *caps)
32953308 {
32963309 struct vc_data *vc;
3297− struct display *p;
3310+ struct fbcon_display *p;
32983311
32993312 if (caps->flags) {
33003313 int i, charcnt;
@@ -3326,80 +3339,47 @@ static void fbcon_get_requirement(struct fb_info *info, · 25 unmodified lines
33263339 }
33273340 }
33283341
3329−static int fbcon_event_notify(struct notifier_block *self,
3330− unsigned long action, void *data)
3342+int fbcon_set_con2fb_map_ioctl(void __user *argp)
33313343 {
3332− struct fb_event *event = data;
3333− struct fb_info *info = event->info;
3334− struct fb_videomode *mode;
3335− struct fb_con2fbmap *con2fb;
3336− struct fb_blit_caps *caps;
3337− int idx, ret = 0;
3338−
3339− /*
3340− * ignore all events except driver registration and deregistration
3341− * if fbcon is not active
3342− */
3343− if (fbcon_has_exited && !(action == FB_EVENT_FB_REGISTERED ||
3344− action == FB_EVENT_FB_UNREGISTERED))
3345− goto done;
3344+ struct fb_con2fbmap con2fb;
3345+ int ret;
33463346
3347− switch(action) {
3348− case FB_EVENT_SUSPEND:
3349− fbcon_suspended(info);
3350− break;
3351− case FB_EVENT_RESUME:
3352− fbcon_resumed(info);
3353− break;
3354− case FB_EVENT_MODE_CHANGE:
3355− fbcon_modechanged(info);
3356− break;
3357− case FB_EVENT_MODE_CHANGE_ALL:
3358− fbcon_set_all_vcs(info);
3359− break;
3360− case FB_EVENT_MODE_DELETE:
3361− mode = event->data;
3362− ret = fbcon_mode_deleted(info, mode);
3363− break;
3364− case FB_EVENT_FB_UNBIND:
3365− idx = info->node;
3366− ret = fbcon_fb_unbind(idx);
3367− break;
3368− case FB_EVENT_FB_REGISTERED:
3369− ret = fbcon_fb_registered(info);
3370− break;
3371− case FB_EVENT_FB_UNREGISTERED:
3372− ret = fbcon_fb_unregistered(info);
3373− break;
3374− case FB_EVENT_SET_CONSOLE_MAP:
3375− /* called with console lock held */
3376− con2fb = event->data;
3377− ret = set_con2fb_map(con2fb->console - 1,
3378− con2fb->framebuffer, 1);
3379− break;
3380− case FB_EVENT_GET_CONSOLE_MAP:
3381− con2fb = event->data;
3382− con2fb->framebuffer = con2fb_map[con2fb->console - 1];
3383− break;
3384− case FB_EVENT_BLANK:
3385− fbcon_fb_blanked(info, *(int *)event->data);
3386− break;
3387− case FB_EVENT_NEW_MODELIST:
3388− fbcon_new_modelist(info);
3389− break;
3390− case FB_EVENT_GET_REQ:
3391− caps = event->data;
3392− fbcon_get_requirement(info, caps);
3393− break;
3394− case FB_EVENT_REMAP_ALL_CONSOLE:
3395− idx = info->node;
3396− fbcon_remap_all(idx);
3397− break;
3347+ if (copy_from_user(&con2fb, argp, sizeof(con2fb)))
3348+ return -EFAULT;
3349+ if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES)
3350+ return -EINVAL;
3351+ if (con2fb.framebuffer >= FB_MAX)
3352+ return -EINVAL;
3353+ if (!registered_fb[con2fb.framebuffer])
3354+ request_module("fb%d", con2fb.framebuffer);
3355+ if (!registered_fb[con2fb.framebuffer]) {
3356+ return -EINVAL;
33983357 }
3399−done:
3358+
3359+ console_lock();
3360+ ret = set_con2fb_map(con2fb.console - 1,
3361+ con2fb.framebuffer, 1);
3362+ console_unlock();
3363+
34003364 return ret;
34013365 }
34023366
3367+int fbcon_get_con2fb_map_ioctl(void __user *argp)
3368+{
3369+ struct fb_con2fbmap con2fb;
3370+
3371+ if (copy_from_user(&con2fb, argp, sizeof(con2fb)))
3372+ return -EFAULT;
3373+ if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES)
3374+ return -EINVAL;
3375+
3376+ console_lock();
3377+ con2fb.framebuffer = con2fb_map[con2fb.console - 1];
3378+ console_unlock();
3379+
3380+ return copy_to_user(argp, &con2fb, sizeof(con2fb)) ? -EFAULT : 0;
3381+}
3382+
34033383 /*
34043384 * The console `switch' structure for the frame buffer based console
34053385 */
@@ -3431,10 +3411,6 @@ static const struct consw fb_con = { · 25 unmodified lines
34313411 .con_debug_leave = fbcon_debug_leave,
34323412 };
34333413
3434−static struct notifier_block fbcon_event_notifier = {
3435− .notifier_call = fbcon_event_notify,
3436−};
3437−
34383414 static ssize_t store_rotate(struct device *device,
34393415 struct device_attribute *attr, const char *buf,
34403416 size_t count)
@@ -3443,9 +3419,6 @@ static ssize_t store_rotate(struct device *device, · 2 unmodified lines
34433419 int rotate, idx;
34443420 char **last = NULL;
34453421
3446− if (fbcon_has_exited)
3447− return count;
3448−
34493422 console_lock();
34503423 idx = con2fb_map[fg_console];
34513424
@@ -3468,9 +3441,6 @@ static ssize_t store_rotate_all(struct device *device, · 16 unmodified lines
34683441 int rotate, idx;
34693442 char **last = NULL;
34703443
3471− if (fbcon_has_exited)
3472− return count;
3473−
34743444 console_lock();
34753445 idx = con2fb_map[fg_console];
34763446
@@ -3491,9 +3461,6 @@ static ssize_t show_rotate(struct device *device, · 14 unmodified lines
34913461 struct fb_info *info;
34923462 int rotate = 0, idx;
34933463
3494− if (fbcon_has_exited)
3495− return 0;
3496−
34973464 console_lock();
34983465 idx = con2fb_map[fg_console];
34993466
@@ -3514,9 +3481,6 @@ static ssize_t show_cursor_blink(struct device *device, · 14 unmodified lines
35143481 struct fbcon_ops *ops;
35153482 int idx, blink = -1;
35163483
3517− if (fbcon_has_exited)
3518− return 0;
3519−
35203484 console_lock();
35213485 idx = con2fb_map[fg_console];
35223486
@@ -3543,9 +3507,6 @@ static ssize_t store_cursor_blink(struct device *device, · 20 unmodified lines
35433507 int blink, idx;
35443508 char **last = NULL;
35453509
3546− if (fbcon_has_exited)
3547− return count;
3548−
35493510 console_lock();
35503511 idx = con2fb_map[fg_console];
35513512
@@ -3668,9 +3629,6 @@ static void fbcon_exit(void) · 116 unmodified lines
36683629 struct fb_info *info;
36693630 int i, j, mapped;
36703631
3671− if (fbcon_has_exited)
3672− return;
3673−
36743632 #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER
36753633 if (deferred_takeover) {
36763634 dummycon_unregister_output_notifier(&fbcon_output_nb);
@@ -3695,7 +3653,7 @@ static void fbcon_exit(void) · 18 unmodified lines
36953653 for (j = first_fb_vc; j <= last_fb_vc; j++) {
36963654 if (con2fb_map[j] == i) {
36973655 mapped = 1;
3698− break;
3656+ con2fb_map[j] = -1;
36993657 }
37003658 }
37013659
@@ -3718,8 +3676,6 @@ static void fbcon_exit(void) · 16 unmodified lines
37183676 info->queue.func = NULL;
37193677 }
37203678 }
3721−
3722− fbcon_has_exited = 1;
37233679 }
37243680
37253681 void __init fb_console_init(void)
@@ -3727,7 +3683,6 @@ void __init fb_console_init(void) · 1 unmodified line
37273683 int i;
37283684
37293685 console_lock();
3730− fb_register_client(&fbcon_event_notifier);
37313686 fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), NULL,
37323687 "fbcon");
37333688
@@ -3763,7 +3718,6 @@ static void __exit fbcon_deinit_device(void) · 29 unmodified lines
37633718 void __exit fb_console_exit(void)
37643719 {
37653720 console_lock();
3766− fb_unregister_client(&fbcon_event_notifier);
37673721 fbcon_deinit_device();
37683722 device_destroy(fb_class, MKDEV(0, 0));
37693723 fbcon_exit();
drivers/video/fbdev/core/fbcon.h+3−3
@@ -25,7 +25,7 @@ · 24 unmodified lines
2525 * low-level frame buffer device
2626 */
2727
28−struct display {
28+struct fbcon_display {
2929 /* Filled in by the low-level console driver */
3030 const u_char *fontdata;
3131 int userfont; /* != 0 if fontdata kmalloc()ed */
@@ -68,7 +68,7 @@ struct fbcon_ops { · 36 unmodified lines
6868 struct fb_var_screeninfo var; /* copy of the current fb_var_screeninfo */
6969 struct timer_list cursor_timer; /* Cursor timer */
7070 struct fb_cursor cursor_state;
71− struct display *p;
71+ struct fbcon_display *p;
7272 struct fb_info *info;
7373 int currcon; /* Current VC. */
7474 int cur_blink_jiffies;
@@ -225,7 +225,7 @@ extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor); · 150 unmodified lines
225225 #define FBCON_ATTRIBUTE_REVERSE 2
226226 #define FBCON_ATTRIBUTE_BOLD 4
227227
228−static inline int real_y(struct display *p, int ypos)
228+static inline int real_y(struct fbcon_display *p, int ypos)
229229 {
230230 int rows = p->vrows;
231231
drivers/video/fbdev/core/fbmem.c+145−254
@@ -80,17 +80,6 @@ static void put_fb_info(struct fb_info *fb_info) · 79 unmodified lines
8080 fb_info->fbops->fb_destroy(fb_info);
8181 }
8282
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−
9483 /*
9584 * Helpers
9685 */
@@ -943,16 +932,13 @@ EXPORT_SYMBOL(fb_pan_display); · 846 unmodified lines
943932 static int fb_check_caps(struct fb_info *info, struct fb_var_screeninfo *var,
944933 u32 activate)
945934 {
946− struct fb_event event;
947935 struct fb_blit_caps caps, fbcaps;
948936 int err = 0;
949937
950938 memset(&caps, 0, sizeof(caps));
951939 memset(&fbcaps, 0, sizeof(fbcaps));
952940 caps.flags = (activate & FB_ACTIVATE_ALL) ? 1 : 0;
953− event.info = info;
954− event.data = &caps;
955− fb_notifier_call_chain(FB_EVENT_GET_REQ, &event);
941+ fbcon_get_requirement(info, &caps);
956942 info->fbops->fb_get_caps(info, &fbcaps, var);
957943
958944 if (((fbcaps.x ^ caps.x) & caps.x) ||
@@ -968,6 +954,10 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) · 9 unmodified lines
968954 {
969955 int flags = info->flags;
970956 int ret = 0;
957+ u32 activate;
958+ struct fb_var_screeninfo old_var;
959+ struct fb_videomode mode;
960+ struct fb_event event;
971961
972962 if (var->activate & FB_ACTIVATE_INV_MODE) {
973963 struct fb_videomode mode1, mode2;
@@ -977,100 +967,90 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) · 3 unmodified lines
977967 /* make sure we don't delete the videomode of current var */
978968 ret = fb_mode_is_equal(&mode1, &mode2);
979969
980− if (!ret) {
981− struct fb_event event;
982−
983− event.info = info;
984− event.data = &mode1;
985− ret = fb_notifier_call_chain(FB_EVENT_MODE_DELETE, &event);
986− }
970+ if (!ret)
971+ fbcon_mode_deleted(info, &mode1);
987972
988973 if (!ret)
989− fb_delete_videomode(&mode1, &info->modelist);
974+ fb_delete_videomode(&mode1, &info->modelist);
990975
991976
992− ret = (ret) ? -EINVAL : 0;
993− goto done;
977+ return ret ? -EINVAL : 0;
994978 }
995979
996− if ((var->activate & FB_ACTIVATE_FORCE) ||
997− memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) {
998− u32 activate = var->activate;
980+ if (!(var->activate & FB_ACTIVATE_FORCE) &&
981+ !memcmp(&info->var, var, sizeof(struct fb_var_screeninfo)))
982+ return 0;
999983
1000− /* When using FOURCC mode, make sure the red, green, blue and
1001− * transp fields are set to 0.
1002− */
1003− if ((info->fix.capabilities & FB_CAP_FOURCC) &&
1004− var->grayscale > 1) {
1005− if (var->red.offset || var->green.offset ||
1006− var->blue.offset || var->transp.offset ||
1007− var->red.length || var->green.length ||
1008− var->blue.length || var->transp.length ||
1009− var->red.msb_right || var->green.msb_right ||
1010− var->blue.msb_right || var->transp.msb_right)
1011− return -EINVAL;
1012− }
984+ activate = var->activate;
1013985
1014− if (!info->fbops->fb_check_var) {
1015− *var = info->var;
1016− goto done;
1017− }
986+ /* When using FOURCC mode, make sure the red, green, blue and
987+ * transp fields are set to 0.
988+ */
989+ if ((info->fix.capabilities & FB_CAP_FOURCC) &&
990+ var->grayscale > 1) {
991+ if (var->red.offset || var->green.offset ||
992+ var->blue.offset || var->transp.offset ||
993+ var->red.length || var->green.length ||
994+ var->blue.length || var->transp.length ||
995+ var->red.msb_right || var->green.msb_right ||
996+ var->blue.msb_right || var->transp.msb_right)
997+ return -EINVAL;
998+ }
1018999
1019− ret = info->fbops->fb_check_var(var, info);
1000+ if (!info->fbops->fb_check_var) {
1001+ *var = info->var;
1002+ return 0;
1003+ }
10201004
1021− if (ret)
1022− goto done;
1005+ ret = info->fbops->fb_check_var(var, info);
10231006
1024− if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) {
1025− struct fb_var_screeninfo old_var;
1026− struct fb_videomode mode;
1007+ if (ret)
1008+ return ret;
10271009
1028− if (info->fbops->fb_get_caps) {
1029− ret = fb_check_caps(info, var, activate);
1010+ if ((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NOW)
1011+ return 0;
10301012
1031− if (ret)
1032− goto done;
1033− }
1013+ if (info->fbops->fb_get_caps) {
1014+ ret = fb_check_caps(info, var, activate);
10341015
1035− old_var = info->var;
1036− info->var = *var;
1016+ if (ret)
1017+ return ret;
1018+ }
10371019
1038− if (info->fbops->fb_set_par) {
1039− ret = info->fbops->fb_set_par(info);
1020+ old_var = info->var;
1021+ info->var = *var;
10401022
1041− if (ret) {
1042− info->var = old_var;
1043− printk(KERN_WARNING "detected "
1044− "fb_set_par error, "
1045− "error code: %d\n", ret);
1046− goto done;
1047− }
1048− }
1023+ if (info->fbops->fb_set_par) {
1024+ ret = info->fbops->fb_set_par(info);
10491025
1050− fb_pan_display(info, &info->var);
1051− fb_set_cmap(&info->cmap, info);
1052− fb_var_to_videomode(&mode, &info->var);
1026+ if (ret) {
1027+ info->var = old_var;
1028+ printk(KERN_WARNING "detected "
1029+ "fb_set_par error, "
1030+ "error code: %d\n", ret);
1031+ return ret;
1032+ }
1033+ }
10531034
1054− if (info->modelist.prev && info->modelist.next &&
1055− !list_empty(&info->modelist))
1056− ret = fb_add_videomode(&mode, &info->modelist);
1035+ fb_pan_display(info, &info->var);
1036+ fb_set_cmap(&info->cmap, info);
1037+ fb_var_to_videomode(&mode, &info->var);
10571038
1058− if (!ret && (flags & FBINFO_MISC_USEREVENT)) {
1059− struct fb_event event;
1060− int evnt = (activate & FB_ACTIVATE_ALL) ?
1061− FB_EVENT_MODE_CHANGE_ALL :
1062− FB_EVENT_MODE_CHANGE;
1039+ if (info->modelist.prev && info->modelist.next &&
1040+ !list_empty(&info->modelist))
1041+ ret = fb_add_videomode(&mode, &info->modelist);
10631042
1064− info->flags &= ~FBINFO_MISC_USEREVENT;
1065− event.info = info;
1066− event.data = &mode;
1067− fb_notifier_call_chain(evnt, &event);
1068− }
1069− }
1070− }
1043+ if (ret)
1044+ return ret;
10711045
1072− done:
1073− return ret;
1046+ event.info = info;
1047+ event.data = &mode;
1048+ fb_notifier_call_chain(FB_EVENT_MODE_CHANGE, &event);
1049+
1050+ if (flags & FBINFO_MISC_USEREVENT)
1051+ fbcon_update_vcs(info, activate & FB_ACTIVATE_ALL);
1052+
1053+ return 0;
10741054 }
10751055 EXPORT_SYMBOL(fb_set_var);
10761056
@@ -1112,17 +1092,14 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, · 35 unmodified lines
11121092 struct fb_ops *fb;
11131093 struct fb_var_screeninfo var;
11141094 struct fb_fix_screeninfo fix;
1115− struct fb_con2fbmap con2fb;
11161095 struct fb_cmap cmap_from;
11171096 struct fb_cmap_user cmap;
1118− struct fb_event event;
11191097 void __user *argp = (void __user *)arg;
11201098 long ret = 0;
11211099
11221100 switch (cmd) {
11231101 case FBIOGET_VSCREENINFO:
1124− if (!lock_fb_info(info))
1125− return -ENODEV;
1102+ lock_fb_info(info);
11261103 var = info->var;
11271104 unlock_fb_info(info);
11281105
@@ -1132,10 +1109,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, · 3 unmodified lines
11321109 if (copy_from_user(&var, argp, sizeof(var)))
11331110 return -EFAULT;
11341111 console_lock();
1135− if (!lock_fb_info(info)) {
1136− console_unlock();
1137− return -ENODEV;
1138− }
1112+ lock_fb_info(info);
11391113 info->flags |= FBINFO_MISC_USEREVENT;
11401114 ret = fb_set_var(info, &var);
11411115 info->flags &= ~FBINFO_MISC_USEREVENT;
@@ -1145,8 +1119,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, · 3 unmodified lines
11451119 ret = -EFAULT;
11461120 break;
11471121 case FBIOGET_FSCREENINFO:
1148− if (!lock_fb_info(info))
1149− return -ENODEV;
1122+ lock_fb_info(info);
11501123 fix = info->fix;
11511124 if (info->flags & FBINFO_HIDE_SMEM_START)
11521125 fix.smem_start = 0;
@@ -1162,8 +1135,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, · 9 unmodified lines
11621135 case FBIOGETCMAP:
11631136 if (copy_from_user(&cmap, argp, sizeof(cmap)))
11641137 return -EFAULT;
1165− if (!lock_fb_info(info))
1166− return -ENODEV;
1138+ lock_fb_info(info);
11671139 cmap_from = info->cmap;
11681140 unlock_fb_info(info);
11691141 ret = fb_cmap_to_user(&cmap_from, &cmap);
@@ -1172,10 +1144,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, · 2 unmodified lines
11721144 if (copy_from_user(&var, argp, sizeof(var)))
11731145 return -EFAULT;
11741146 console_lock();
1175− if (!lock_fb_info(info)) {
1176− console_unlock();
1177− return -ENODEV;
1178− }
1147+ lock_fb_info(info);
11791148 ret = fb_pan_display(info, &var);
11801149 unlock_fb_info(info);
11811150 console_unlock();
@@ -1186,58 +1155,22 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, · 4 unmodified lines
11861155 ret = -EINVAL;
11871156 break;
11881157 case FBIOGET_CON2FBMAP:
1189− if (copy_from_user(&con2fb, argp, sizeof(con2fb)))
1190− return -EFAULT;
1191− if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES)
1192− return -EINVAL;
1193− con2fb.framebuffer = -1;
1194− event.data = &con2fb;
1195− if (!lock_fb_info(info))
1196− return -ENODEV;
1197− event.info = info;
1198− fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP, &event);
1199− unlock_fb_info(info);
1200− ret = copy_to_user(argp, &con2fb, sizeof(con2fb)) ? -EFAULT : 0;
1158+ ret = fbcon_get_con2fb_map_ioctl(argp);
12011159 break;
12021160 case FBIOPUT_CON2FBMAP:
1203− if (copy_from_user(&con2fb, argp, sizeof(con2fb)))
1204− return -EFAULT;
1205− if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES)
1206− return -EINVAL;
1207− if (con2fb.framebuffer >= FB_MAX)
1208− return -EINVAL;
1209− if (!registered_fb[con2fb.framebuffer])
1210− request_module("fb%d", con2fb.framebuffer);
1211− if (!registered_fb[con2fb.framebuffer]) {
1212− ret = -EINVAL;
1213− break;
1214− }
1215− event.data = &con2fb;
1216− console_lock();
1217− if (!lock_fb_info(info)) {
1218− console_unlock();
1219− return -ENODEV;
1220− }
1221− event.info = info;
1222− ret = fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP, &event);
1223− unlock_fb_info(info);
1224− console_unlock();
1161+ ret = fbcon_set_con2fb_map_ioctl(argp);
12251162 break;
12261163 case FBIOBLANK:
12271164 console_lock();
1228− if (!lock_fb_info(info)) {
1229− console_unlock();
1230− return -ENODEV;
1231− }
1232− info->flags |= FBINFO_MISC_USEREVENT;
1165+ lock_fb_info(info);
12331166 ret = fb_blank(info, arg);
1234− info->flags &= ~FBINFO_MISC_USEREVENT;
1167+ /* might again call into fb_blank */
1168+ fbcon_fb_blanked(info, arg);
12351169 unlock_fb_info(info);
12361170 console_unlock();
12371171 break;
12381172 default:
1239− if (!lock_fb_info(info))
1240− return -ENODEV;
1173+ lock_fb_info(info);
12411174 fb = info->fbops;
12421175 if (fb->fb_ioctl)
12431176 ret = fb->fb_ioctl(info, cmd, arg);
@@ -1357,8 +1290,7 @@ static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd, · 113 unmodified lines
13571290 {
13581291 struct fb_fix_screeninfo fix;
13591292
1360− if (!lock_fb_info(info))
1361− return -ENODEV;
1293+ lock_fb_info(info);
13621294 fix = info->fix;
13631295 if (info->flags & FBINFO_HIDE_SMEM_START)
13641296 fix.smem_start = 0;
@@ -1418,8 +1350,6 @@ fb_mmap(struct file *file, struct vm_area_struct * vma) · 53 unmodified lines
14181350 if (!info)
14191351 return -ENODEV;
14201352 fb = info->fbops;
1421− if (!fb)
1422− return -ENODEV;
14231353 mutex_lock(&info->mm_lock);
14241354 if (fb->fb_mmap) {
14251355 int res;
@@ -1483,7 +1413,7 @@ __releases(&info->lock) · 57 unmodified lines
14831413 if (IS_ERR(info))
14841414 return PTR_ERR(info);
14851415
1486− mutex_lock(&info->lock);
1416+ lock_fb_info(info);
14871417 if (!try_module_get(info->fbops->owner)) {
14881418 res = -ENODEV;
14891419 goto out;
@@ -1499,7 +1429,7 @@ __releases(&info->lock) · 9 unmodified lines
14991429 fb_deferred_io_open(info, inode, file);
15001430 #endif
15011431 out:
1502− mutex_unlock(&info->lock);
1432+ unlock_fb_info(info);
15031433 if (res)
15041434 put_fb_info(info);
15051435 return res;
@@ -1512,11 +1442,11 @@ __releases(&info->lock) · 6 unmodified lines
15121442 {
15131443 struct fb_info * const info = file->private_data;
15141444
1515− mutex_lock(&info->lock);
1445+ lock_fb_info(info);
15161446 if (info->fbops->fb_release)
15171447 info->fbops->fb_release(info,1);
15181448 module_put(info->fbops->owner);
1519− mutex_unlock(&info->lock);
1449+ unlock_fb_info(info);
15201450 put_fb_info(info);
15211451 return 0;
15221452 }
@@ -1621,13 +1551,13 @@ static bool fb_do_apertures_overlap(struct apertures_struct *gena, · 98 unmodified lines
16211551 return false;
16221552 }
16231553
1624−static int do_unregister_framebuffer(struct fb_info *fb_info);
1554+static void do_unregister_framebuffer(struct fb_info *fb_info);
16251555
16261556 #define VGA_FB_PHYS 0xA0000
1627−static int do_remove_conflicting_framebuffers(struct apertures_struct *a,
1628− const char *name, bool primary)
1557+static void do_remove_conflicting_framebuffers(struct apertures_struct *a,
1558+ const char *name, bool primary)
16291559 {
1630− int i, ret;
1560+ int i;
16311561
16321562 /* check all firmware fbs and kick off if the base addr overlaps */
16331563 for_each_registered_fb(i) {
@@ -1643,13 +1573,9 @@ static int do_remove_conflicting_framebuffers(struct apertures_struct *a, · 9 unmodified lines
16431573
16441574 printk(KERN_INFO "fb%d: switching to %s from %s\n",
16451575 i, name, registered_fb[i]->fix.id);
1646− ret = do_unregister_framebuffer(registered_fb[i]);
1647− if (ret)
1648− return ret;
1576+ do_unregister_framebuffer(registered_fb[i]);
16491577 }
16501578 }
1651−
1652− return 0;
16531579 }
16541580
16551581 static bool lockless_register_fb;
@@ -1660,17 +1586,14 @@ MODULE_PARM_DESC(lockless_register_fb, · 4 unmodified lines
16601586 static int do_register_framebuffer(struct fb_info *fb_info)
16611587 {
16621588 int i, ret;
1663− struct fb_event event;
16641589 struct fb_videomode mode;
16651590
16661591 if (fb_check_foreignness(fb_info))
16671592 return -ENOSYS;
16681593
1669− ret = do_remove_conflicting_framebuffers(fb_info->apertures,
1670− fb_info->fix.id,
1671− fb_is_primary_device(fb_info));
1672− if (ret)
1673− return ret;
1594+ do_remove_conflicting_framebuffers(fb_info->apertures,
1595+ fb_info->fix.id,
1596+ fb_is_primary_device(fb_info));
16741597
16751598 if (num_registered_fb == FB_MAX)
16761599 return -ENXIO;
@@ -1723,20 +1646,22 @@ static int do_register_framebuffer(struct fb_info *fb_info) · 46 unmodified lines
17231646 fb_add_videomode(&mode, &fb_info->modelist);
17241647 registered_fb[i] = fb_info;
17251648
1726− event.info = fb_info;
1649+#ifdef CONFIG_GUMSTIX_AM200EPD
1650+ {
1651+ struct fb_event event;
1652+ event.info = fb_info;
1653+ fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
1654+ }
1655+#endif
1656+
17271657 if (!lockless_register_fb)
17281658 console_lock();
17291659 else
17301660 atomic_inc(&ignore_console_lock_warning);
1731− if (!lock_fb_info(fb_info)) {
1732− ret = -ENODEV;
1733− goto unlock_console;
1734− }
1735− ret = 0;
1736−
1737− fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
1661+ lock_fb_info(fb_info);
1662+ ret = fbcon_fb_registered(fb_info);
17381663 unlock_fb_info(fb_info);
1739−unlock_console:
1664+
17401665 if (!lockless_register_fb)
17411666 console_unlock();
17421667 else
@@ -1744,44 +1669,44 @@ unlock_console: · 1 unmodified line
17441669 return ret;
17451670 }
17461671
1747−static int unbind_console(struct fb_info *fb_info)
1672+static void unbind_console(struct fb_info *fb_info)
17481673 {
1749− struct fb_event event;
1750− int ret;
17511674 int i = fb_info->node;
17521675
1753− if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)
1754− return -EINVAL;
1676+ if (WARN_ON(i < 0 || i >= FB_MAX || registered_fb[i] != fb_info))
1677+ return;
17551678
17561679 console_lock();
1757− if (!lock_fb_info(fb_info)) {
1758− console_unlock();
1759− return -ENODEV;
1760− }
1761−
1762− event.info = fb_info;
1763− ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event);
1680+ lock_fb_info(fb_info);
1681+ fbcon_fb_unbind(fb_info);
17641682 unlock_fb_info(fb_info);
17651683 console_unlock();
1766−
1767− return ret;
17681684 }
17691685
1770−static int __unlink_framebuffer(struct fb_info *fb_info);
1771−
1772−static int do_unregister_framebuffer(struct fb_info *fb_info)
1686+void unlink_framebuffer(struct fb_info *fb_info)
17731687 {
1774− struct fb_event event;
1775− int ret;
1688+ int i;
1689+
1690+ i = fb_info->node;
1691+ if (WARN_ON(i < 0 || i >= FB_MAX || registered_fb[i] != fb_info))
1692+ return;
17761693
1777− ret = unbind_console(fb_info);
1694+ if (!fb_info->dev)
1695+ return;
17781696
1779− if (ret)
1780− return -EINVAL;
1697+ device_destroy(fb_class, MKDEV(FB_MAJOR, i));
17811698
17821699 pm_vt_switch_unregister(fb_info->dev);
17831700
1784− __unlink_framebuffer(fb_info);
1701+ unbind_console(fb_info);
1702+
1703+ fb_info->dev = NULL;
1704+}
1705+EXPORT_SYMBOL(unlink_framebuffer);
1706+
1707+static void do_unregister_framebuffer(struct fb_info *fb_info)
1708+{
1709+ unlink_framebuffer(fb_info);
17851710 if (fb_info->pixmap.addr &&
17861711 (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT))
17871712 kfree(fb_info->pixmap.addr);
@@ -1789,46 +1714,21 @@ static int do_unregister_framebuffer(struct fb_info *fb_info) · 1 unmodified line
17891714 registered_fb[fb_info->node] = NULL;
17901715 num_registered_fb--;
17911716 fb_cleanup_device(fb_info);
1792− event.info = fb_info;
1717+#ifdef CONFIG_GUMSTIX_AM200EPD
1718+ {
1719+ struct fb_event event;
1720+ event.info = fb_info;
1721+ fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event);
1722+ }
1723+#endif
17931724 console_lock();
1794− fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event);
1725+ fbcon_fb_unregistered(fb_info);
17951726 console_unlock();
17961727
17971728 /* this may free fb info */
17981729 put_fb_info(fb_info);
1799− return 0;
18001730 }
18011731
1802−static int __unlink_framebuffer(struct fb_info *fb_info)
1803−{
1804− int i;
1805−
1806− i = fb_info->node;
1807− if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)
1808− return -EINVAL;
1809−
1810− if (fb_info->dev) {
1811− device_destroy(fb_class, MKDEV(FB_MAJOR, i));
1812− fb_info->dev = NULL;
1813− }
1814−
1815− return 0;
1816−}
1817−
1818−int unlink_framebuffer(struct fb_info *fb_info)
1819−{
1820− int ret;
1821−
1822− ret = __unlink_framebuffer(fb_info);
1823− if (ret)
1824− return ret;
1825−
1826− unbind_console(fb_info);
1827−
1828− return 0;
1829−}
1830−EXPORT_SYMBOL(unlink_framebuffer);
1831−
18321732 /**
18331733 * remove_conflicting_framebuffers - remove firmware-configured framebuffers
18341734 * @a: memory range, users of which are to be removed
@@ -1842,7 +1742,6 @@ EXPORT_SYMBOL(unlink_framebuffer); · 7 unmodified lines
18421742 int remove_conflicting_framebuffers(struct apertures_struct *a,
18431743 const char *name, bool primary)
18441744 {
1845− int ret;
18461745 bool do_free = false;
18471746
18481747 if (!a) {
@@ -1856,13 +1755,13 @@ int remove_conflicting_framebuffers(struct apertures_struct *a, · 7 unmodified lines
18561755 }
18571756
18581757 mutex_lock(&registration_lock);
1859− ret = do_remove_conflicting_framebuffers(a, name, primary);
1758+ do_remove_conflicting_framebuffers(a, name, primary);
18601759 mutex_unlock(&registration_lock);
18611760
18621761 if (do_free)
18631762 kfree(a);
18641763
1865− return ret;
1764+ return 0;
18661765 }
18671766 EXPORT_SYMBOL(remove_conflicting_framebuffers);
18681767
@@ -1959,16 +1858,12 @@ EXPORT_SYMBOL(register_framebuffer); · 90 unmodified lines
19591858 * that the driver implements fb_open() and fb_release() to
19601859 * check that no processes are using the device.
19611860 */
1962−int
1861+void
19631862 unregister_framebuffer(struct fb_info *fb_info)
19641863 {
1965− int ret;
1966−
19671864 mutex_lock(&registration_lock);
1968− ret = do_unregister_framebuffer(fb_info);
1865+ do_unregister_framebuffer(fb_info);
19691866 mutex_unlock(&registration_lock);
1970−
1971− return ret;
19721867 }
19731868 EXPORT_SYMBOL(unregister_framebuffer);
19741869
@@ -1983,15 +1878,14 @@ EXPORT_SYMBOL(unregister_framebuffer); · 8 unmodified lines
19831878 */
19841879 void fb_set_suspend(struct fb_info *info, int state)
19851880 {
1986− struct fb_event event;
1881+ WARN_CONSOLE_UNLOCKED();
19871882
1988− event.info = info;
19891883 if (state) {
1990− fb_notifier_call_chain(FB_EVENT_SUSPEND, &event);
1884+ fbcon_suspended(info);
19911885 info->state = FBINFO_STATE_SUSPENDED;
19921886 } else {
19931887 info->state = FBINFO_STATE_RUNNING;
1994− fb_notifier_call_chain(FB_EVENT_RESUME, &event);
1888+ fbcon_resumed(info);
19951889 }
19961890 }
19971891 EXPORT_SYMBOL(fb_set_suspend);
@@ -2059,7 +1953,6 @@ subsys_initcall(fbmem_init); · 61 unmodified lines
20591953
20601954 int fb_new_modelist(struct fb_info *info)
20611955 {
2062− struct fb_event event;
20631956 struct fb_var_screeninfo var = info->var;
20641957 struct list_head *pos, *n;
20651958 struct fb_modelist *modelist;
@@ -2079,14 +1972,12 @@ int fb_new_modelist(struct fb_info *info) · 13 unmodified lines
20791972 }
20801973 }
20811974
2082− err = 1;
1975+ if (list_empty(&info->modelist))
1976+ return 1;
20831977
2084− if (!list_empty(&info->modelist)) {
2085− event.info = info;
2086− err = fb_notifier_call_chain(FB_EVENT_NEW_MODELIST, &event);
2087− }
1978+ fbcon_new_modelist(info);
20881979
2089− return err;
1980+ return 0;
20901981 }
20911982
20921983 MODULE_LICENSE("GPL");
drivers/video/fbdev/core/fbsysfs.c+8−12
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <linux/kernel.h>
1515 #include <linux/slab.h>
1616 #include <linux/fb.h>
17+#include <linux/fbcon.h>
1718 #include <linux/console.h>
1819 #include <linux/module.h>
1920
@@ -175,10 +176,7 @@ static ssize_t store_modes(struct device *device, · 155 unmodified lines
175176 return -EINVAL;
176177
177178 console_lock();
178− if (!lock_fb_info(fb_info)) {
179− console_unlock();
180− return -ENODEV;
181− }
179+ lock_fb_info(fb_info);
182180
183181 list_splice(&fb_info->modelist, &old_list);
184182 fb_videomode_to_modelist((const struct fb_videomode *)buf, i,
@@ -304,12 +302,13 @@ static ssize_t store_blank(struct device *device, · 119 unmodified lines
304302 {
305303 struct fb_info *fb_info = dev_get_drvdata(device);
306304 char *last = NULL;
307− int err;
305+ int err, arg;
308306
307+ arg = simple_strtoul(buf, &last, 0);
309308 console_lock();
310− fb_info->flags |= FBINFO_MISC_USEREVENT;
311− err = fb_blank(fb_info, simple_strtoul(buf, &last, 0));
312− fb_info->flags &= ~FBINFO_MISC_USEREVENT;
309+ err = fb_blank(fb_info, arg);
310+ /* might again call into fb_blank */
311+ fbcon_fb_blanked(fb_info, arg);
313312 console_unlock();
314313 if (err < 0)
315314 return err;
@@ -405,10 +404,7 @@ static ssize_t store_fbstate(struct device *device, · 89 unmodified lines
405404 state = simple_strtoul(buf, &last, 0);
406405
407406 console_lock();
408− if (!lock_fb_info(fb_info)) {
409− console_unlock();
410− return -ENODEV;
411− }
407+ lock_fb_info(fb_info);
412408
413409 fb_set_suspend(fb_info, (int)state);
414410
drivers/video/fbdev/cyber2000fb.c+0−6
@@ -58,7 +58,6 @@ · 57 unmodified lines
5858 struct cfb_info {
5959 struct fb_info fb;
6060 struct display_switch *dispsw;
61− struct display *display;
6261 unsigned char __iomem *region;
6362 unsigned char __iomem *regs;
6463 u_int id;
@@ -1638,10 +1637,6 @@ static void cyberpro_common_resume(struct cfb_info *cfb) · 1573 unmodified lines
16381637 cyber2000fb_set_par(&cfb->fb);
16391638 }
16401639
1641−/*
1642− * PCI specific support.
1643− */
1644−#ifdef CONFIG_PCI
16451640 /*
16461641 * We need to wake up the CyberPro, and make sure its in linear memory
16471642 * mode. Unfortunately, this is specific to the platform and card that
@@ -1858,7 +1853,6 @@ static struct pci_driver cyberpro_driver = { · 210 unmodified lines
18581853 .resume = cyberpro_pci_resume,
18591854 .id_table = cyberpro_pci_table
18601855 };
1861−#endif
18621856
18631857 /*
18641858 * I don't think we can use the "module_init" stuff here because
drivers/video/fbdev/da8xx-fb.c+0−1
@@ -1387,7 +1387,6 @@ static int fb_probe(struct platform_device *device) · 1386 unmodified lines
13871387 da8xx_fb_info = framebuffer_alloc(sizeof(struct da8xx_fb_par),
13881388 &device->dev);
13891389 if (!da8xx_fb_info) {
1390− dev_dbg(&device->dev, "Memory allocation failed for fb_info\n");
13911390 ret = -ENOMEM;
13921391 goto err_pm_runtime_disable;
13931392 }
drivers/video/fbdev/efifb.c+5−1
@@ -169,6 +169,11 @@ static void efifb_show_boot_graphics(struct fb_info *info) · 168 unmodified lines
169169 return;
170170 }
171171
172+ if (bgrt_tab.status & 0x06) {
173+ pr_info("efifb: BGRT rotation bits set, not showing boot graphics\n");
174+ return;
175+ }
176+
172177 /* Avoid flashing the logo if we're going to print std probe messages */
173178 if (console_loglevel > CONSOLE_LOGLEVEL_QUIET)
174179 return;
@@ -448,7 +453,6 @@ static int efifb_probe(struct platform_device *dev) · 273 unmodified lines
448453
449454 info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev);
450455 if (!info) {
451− pr_err("efifb: cannot allocate framebuffer\n");
452456 err = -ENOMEM;
453457 goto err_release_mem;
454458 }
drivers/video/fbdev/gbefb.c+7−12
@@ -39,9 +39,7 @@ struct gbefb_par { · 38 unmodified lines
3939 int valid;
4040 };
4141
42−#ifdef CONFIG_SGI_IP32
4342 #define GBE_BASE 0x16000000 /* SGI O2 */
44−#endif
4543
4644 /* macro for fastest write-though access to the framebuffer */
4745 #ifdef CONFIG_MIPS
@@ -51,10 +49,6 @@ struct gbefb_par { · 3 unmodified lines
5149 #define pgprot_fb(_prot) (((_prot) & (~_CACHE_MASK)) | _CACHE_CACHABLE_NO_WA)
5250 #endif
5351 #endif
54−#ifdef CONFIG_X86
55−#define pgprot_fb(_prot) (((_prot) & ~_PAGE_CACHE_MASK) | \
56− cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS))
57−#endif
5852
5953 /*
6054 * RAM we reserve for the frame buffer. This defines the maximum screen
@@ -279,7 +273,7 @@ static void gbe_turn_off(void) · 218 unmodified lines
279273 val = 0;
280274 SET_GBE_FIELD(VT_XY, FREEZE, val, 1);
281275 gbe->vt_xy = val;
282− udelay(10000);
276+ mdelay(10);
283277 for (i = 0; i < 10000; i++) {
284278 val = gbe->vt_xy;
285279 if (GET_GBE_FIELD(VT_XY, FREEZE, val) != 1)
@@ -294,7 +288,7 @@ static void gbe_turn_off(void) · 8 unmodified lines
294288 val = gbe->dotclock;
295289 SET_GBE_FIELD(DOTCLK, RUN, val, 0);
296290 gbe->dotclock = val;
297− udelay(10000);
291+ mdelay(10);
298292 for (i = 0; i < 10000; i++) {
299293 val = gbe->dotclock;
300294 if (GET_GBE_FIELD(DOTCLK, RUN, val))
@@ -331,7 +325,7 @@ static void gbe_turn_on(void) · 30 unmodified lines
331325 val = gbe->dotclock;
332326 SET_GBE_FIELD(DOTCLK, RUN, val, 1);
333327 gbe->dotclock = val;
334− udelay(10000);
328+ mdelay(10);
335329 for (i = 0; i < 10000; i++) {
336330 val = gbe->dotclock;
337331 if (GET_GBE_FIELD(DOTCLK, RUN, val) != 1)
@@ -346,7 +340,7 @@ static void gbe_turn_on(void) · 8 unmodified lines
346340 val = 0;
347341 SET_GBE_FIELD(VT_XY, FREEZE, val, 0);
348342 gbe->vt_xy = val;
349− udelay(10000);
343+ mdelay(10);
350344 for (i = 0; i < 10000; i++) {
351345 val = gbe->vt_xy;
352346 if (GET_GBE_FIELD(VT_XY, FREEZE, val))
@@ -547,7 +541,7 @@ static void gbe_set_timing_info(struct gbe_timing_info *timing) · 194 unmodified lines
547541 SET_GBE_FIELD(DOTCLK, P, val, timing->pll_p);
548542 SET_GBE_FIELD(DOTCLK, RUN, val, 0); /* do not start yet */
549543 gbe->dotclock = val;
550− udelay(10000);
544+ mdelay(10);
551545
552546 /* setup pixel counter */
553547 val = 0;
@@ -1018,9 +1012,10 @@ static int gbefb_mmap(struct fb_info *info, · 464 unmodified lines
10181012
10191013 /* remap using the fastest write-through mode on architecture */
10201014 /* try not polluting the cache when possible */
1015+#ifdef CONFIG_MIPS
10211016 pgprot_val(vma->vm_page_prot) =
10221017 pgprot_fb(pgprot_val(vma->vm_page_prot));
1023−
1018+#endif
10241019 /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */
10251020
10261021 /* look for the starting tile */
drivers/video/fbdev/grvga.c+1−3
@@ -336,10 +336,8 @@ static int grvga_probe(struct platform_device *dev) · 335 unmodified lines
336336 char *options = NULL, *mode_opt = NULL;
337337
338338 info = framebuffer_alloc(sizeof(struct grvga_par), &dev->dev);
339− if (!info) {
340− dev_err(&dev->dev, "framebuffer_alloc failed\n");
339+ if (!info)
341340 return -ENOMEM;
342− }
343341
344342 /* Expecting: "grvga: modestring, [addr:<framebuffer physical address>], [size:<framebuffer size>]
345343 *
drivers/video/fbdev/gxt4500.c+2−3
@@ -643,10 +643,9 @@ static int gxt4500_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 642 unmodified lines
643643 }
644644
645645 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)
648647 goto err_free_fb;
649− }
648+
650649 par = info->par;
651650 cardtype = ent->driver_data;
652651 par->refclk_ps = cardinfo[cardtype].refclk_ps;
drivers/video/fbdev/hyperv_fb.c+1−3
@@ -762,10 +762,8 @@ static int hvfb_probe(struct hv_device *hdev, · 761 unmodified lines
762762 int ret;
763763
764764 info = framebuffer_alloc(sizeof(struct hvfb_par), &hdev->device);
765− if (!info) {
766− pr_err("No memory for framebuffer info\n");
765+ if (!info)
767766 return -ENOMEM;
768− }
769767
770768 par = info->par;
771769 par->info = info;
drivers/video/fbdev/i740fb.c+1−3
@@ -1006,10 +1006,8 @@ static int i740fb_probe(struct pci_dev *dev, const struct pci_device_id *ent) · 1005 unmodified lines
10061006 u8 *edid;
10071007
10081008 info = framebuffer_alloc(sizeof(struct i740fb_par), &(dev->dev));
1009− if (!info) {
1010− dev_err(&(dev->dev), "cannot allocate framebuffer\n");
1009+ if (!info)
10111010 return -ENOMEM;
1012− }
10131011
10141012 par = info->par;
10151013 mutex_init(&par->open_lock);
drivers/video/fbdev/imsttfb.c+1−4
@@ -1477,11 +1477,8 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 1476 unmodified lines
14771477 printk(KERN_ERR "imsttfb: no OF node for pci device\n");
14781478
14791479 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)
14831481 return -ENOMEM;
1484− }
14851482
14861483 par = info->par;
14871484
drivers/video/fbdev/imxfb.c+5−6
@@ -974,10 +974,9 @@ static int imxfb_probe(struct platform_device *pdev) · 973 unmodified lines
974974 }
975975
976976 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) {
981980 dev_err(&pdev->dev, "Failed to allocate video RAM: %d\n", ret);
982981 ret = -ENOMEM;
983982 goto failed_map;
@@ -1046,7 +1045,7 @@ failed_cmap: · 62 unmodified lines
10461045 if (pdata && pdata->exit)
10471046 pdata->exit(fbi->pdev);
10481047 failed_platform_init:
1049− dma_free_wc(&pdev->dev, fbi->map_size, info->screen_base,
1048+ dma_free_wc(&pdev->dev, fbi->map_size, info->screen_buffer,
10501049 fbi->map_dma);
10511050 failed_map:
10521051 iounmap(fbi->regs);
@@ -1077,7 +1076,7 @@ static int imxfb_remove(struct platform_device *pdev) · 24 unmodified lines
10771076 pdata = dev_get_platdata(&pdev->dev);
10781077 if (pdata && pdata->exit)
10791078 pdata->exit(fbi->pdev);
1080− dma_free_wc(&pdev->dev, fbi->map_size, info->screen_base,
1079+ dma_free_wc(&pdev->dev, fbi->map_size, info->screen_buffer,
10811080 fbi->map_dma);
10821081 iounmap(fbi->regs);
10831082 release_mem_region(res->start, resource_size(res));
drivers/video/fbdev/intelfb/intelfbdrv.c+3−4
@@ -491,10 +491,9 @@ static int intelfb_pci_register(struct pci_dev *pdev, · 490 unmodified lines
491491 }
492492
493493 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+
498497 if (fb_alloc_cmap(&info->cmap, 256, 1) < 0) {
499498 ERR_MSG("Could not allocate cmap for intelfb_info.\n");
500499 goto err_out_cmap;
drivers/video/fbdev/jz4740_fb.c+1−10
@@ -457,7 +457,6 @@ static int jzfb_alloc_devmem(struct jzfb *jzfb) · 456 unmodified lines
457457 {
458458 int max_videosize = 0;
459459 struct fb_videomode *mode = jzfb->pdata->modes;
460− void *page;
461460 int i;
462461
463462 for (i = 0; i < jzfb->pdata->num_modes; ++mode, ++i) {
@@ -482,12 +481,6 @@ static int jzfb_alloc_devmem(struct jzfb *jzfb) · 18 unmodified lines
482481 if (!jzfb->vidmem)
483482 goto err_free_framedesc;
484483
485− for (page = jzfb->vidmem;
486− page < jzfb->vidmem + PAGE_ALIGN(jzfb->vidmem_size);
487− page += PAGE_SIZE) {
488− SetPageReserved(virt_to_page(page));
489− }
490−
491484 jzfb->framedesc->next = jzfb->framedesc_phys;
492485 jzfb->framedesc->addr = jzfb->vidmem_phys;
493486 jzfb->framedesc->id = 0xdeafbead;
@@ -535,10 +528,8 @@ static int jzfb_probe(struct platform_device *pdev) · 41 unmodified lines
535528 }
536529
537530 fb = framebuffer_alloc(sizeof(struct jzfb), &pdev->dev);
538− if (!fb) {
539− dev_err(&pdev->dev, "Failed to allocate framebuffer device\n");
531+ if (!fb)
540532 return -ENOMEM;
541− }
542533
543534 fb->fbops = &jzfb_ops;
544535 fb->flags = FBINFO_DEFAULT;
drivers/video/fbdev/mb862xx/mb862xxfbdrv.c+1−4
@@ -680,10 +680,8 @@ static int of_platform_mb862xx_probe(struct platform_device *ofdev) · 679 unmodified lines
680680 }
681681
682682 info = framebuffer_alloc(sizeof(struct mb862xxfb_par), dev);
683− if (info == NULL) {
684− dev_err(dev, "cannot allocate framebuffer\n");
683+ if (!info)
685684 return -ENOMEM;
686− }
687685
688686 par = info->par;
689687 par->info = info;
@@ -1005,7 +1003,6 @@ static int mb862xx_pci_probe(struct pci_dev *pdev, · 315 unmodified lines
10051003
10061004 info = framebuffer_alloc(sizeof(struct mb862xxfb_par), dev);
10071005 if (!info) {
1008− dev_err(dev, "framebuffer alloc failed\n");
10091006 ret = -ENOMEM;
10101007 goto dis_dev;
10111008 }
drivers/video/fbdev/mbx/mbxfb.c+1−3
@@ -899,10 +899,8 @@ static int mbxfb_probe(struct platform_device *dev) · 898 unmodified lines
899899 }
900900
901901 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)
904903 return -ENOMEM;
905− }
906904
907905 mfbi = fbi->par;
908906 fbi->pseudo_palette = mfbi->pseudo_palette;
drivers/video/fbdev/mmp/hw/mmp_ctrl.c+4−4
@@ -433,7 +433,7 @@ static int mmphw_probe(struct platform_device *pdev) · 432 unmodified lines
433433 {
434434 struct mmp_mach_plat_info *mi;
435435 struct resource *res;
436− int ret, i, size, irq;
436+ int ret, i, irq;
437437 struct mmphw_path_plat *path_plat;
438438 struct mmphw_ctrl *ctrl = NULL;
439439
@@ -461,9 +461,9 @@ static int mmphw_probe(struct platform_device *pdev) · 21 unmodified lines
461461 }
462462
463463 /* 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);
467467 if (!ctrl) {
468468 ret = -ENOMEM;
469469 goto failed;
drivers/video/fbdev/mxsfb.c+0−1028
@@ -1,1028 +0,0 @@
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");
drivers/video/fbdev/neofb.c+1−8
@@ -2122,14 +2122,7 @@ static void neofb_remove(struct pci_dev *dev) · 2121 unmodified lines
21222122 DBG("neofb_remove");
21232123
21242124 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);
21332126
21342127 neo_unmap_video(info);
21352128 fb_destroy_modedb(info->monspecs.modedb);
drivers/video/fbdev/omap/omapfb_main.c+0−2
@@ -1502,8 +1502,6 @@ static int planes_init(struct omapfb_device *fbdev) · 1501 unmodified lines
15021502 fbi = framebuffer_alloc(sizeof(struct omapfb_plane_struct),
15031503 fbdev->dev);
15041504 if (fbi == NULL) {
1505− dev_err(fbdev->dev,
1506− "unable to allocate memory for plane info\n");
15071505 planes_cleanup(fbdev);
15081506 return -ENOMEM;
15091507 }
drivers/video/fbdev/omap2/omapfb/dss/Kconfig+0−12
@@ -39,18 +39,6 @@ config FB_OMAP2_DSS_DPI · 38 unmodified lines
3939 help
4040 DPI Interface. This is the Parallel Display Interface.
4141
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−
5442 config FB_OMAP2_DSS_VENC
5543 bool "VENC support"
5644 default y
drivers/video/fbdev/omap2/omapfb/dss/Makefile+0−1
@@ -8,7 +8,6 @@ omapdss-y := core.o dss.o dss_features.o dispc.o dispc_coefs.o display.o \ · 7 unmodified lines
88 omapdss-y += manager.o manager-sysfs.o overlay.o overlay-sysfs.o apply.o \
99 dispc-compat.o display-sysfs.o
1010 omapdss-$(CONFIG_FB_OMAP2_DSS_DPI) += dpi.o
11−omapdss-$(CONFIG_FB_OMAP2_DSS_RFBI) += rfbi.o
1211 omapdss-$(CONFIG_FB_OMAP2_DSS_VENC) += venc.o
1312 omapdss-$(CONFIG_FB_OMAP2_DSS_SDI) += sdi.o
1413 omapdss-$(CONFIG_FB_OMAP2_DSS_DSI) += dsi.o
drivers/video/fbdev/omap2/omapfb/dss/core.c+0−6
@@ -207,9 +207,6 @@ static int (*dss_output_drv_reg_funcs[])(void) __initdata = { · 206 unmodified lines
207207 #ifdef CONFIG_FB_OMAP2_DSS_SDI
208208 sdi_init_platform_driver,
209209 #endif
210−#ifdef CONFIG_FB_OMAP2_DSS_RFBI
211− rfbi_init_platform_driver,
212−#endif
213210 #ifdef CONFIG_FB_OMAP2_DSS_VENC
214211 venc_init_platform_driver,
215212 #endif
@@ -231,9 +228,6 @@ static void (*dss_output_drv_unreg_funcs[])(void) = { · 15 unmodified lines
231228 #ifdef CONFIG_FB_OMAP2_DSS_VENC
232229 venc_uninit_platform_driver,
233230 #endif
234−#ifdef CONFIG_FB_OMAP2_DSS_RFBI
235− rfbi_uninit_platform_driver,
236−#endif
237231 #ifdef CONFIG_FB_OMAP2_DSS_SDI
238232 sdi_uninit_platform_driver,
239233 #endif
drivers/video/fbdev/omap2/omapfb/dss/dss.h+0−4
@@ -461,10 +461,6 @@ void hdmi4_uninit_platform_driver(void); · 460 unmodified lines
461461 int hdmi5_init_platform_driver(void) __init;
462462 void hdmi5_uninit_platform_driver(void);
463463
464−/* RFBI */
465−int rfbi_init_platform_driver(void) __init;
466−void rfbi_uninit_platform_driver(void);
467−
468464
469465 #ifdef CONFIG_FB_OMAP2_DSS_COLLECT_IRQ_STATS
470466 static inline void dss_collect_irq_stats(u32 irqstatus, unsigned *irq_arr)
drivers/video/fbdev/omap2/omapfb/dss/rfbi.c+0−1067
@@ -1,1067 +0,0 @@
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−}
drivers/video/fbdev/omap2/omapfb/omapfb-main.c+1−5
@@ -1881,12 +1881,8 @@ static int omapfb_create_framebuffers(struct omapfb2_device *fbdev) · 1880 unmodified lines
18811881
18821882 fbi = framebuffer_alloc(sizeof(struct omapfb_info),
18831883 fbdev->dev);
1884−
1885− if (fbi == NULL) {
1886− dev_err(fbdev->dev,
1887− "unable to allocate memory for plane info\n");
1884+ if (!fbi)
18881885 return -ENOMEM;
1889− }
18901886
18911887 clear_fb_info(fbi);
18921888
drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c+7−14
@@ -49,8 +49,7 @@ static ssize_t store_rotate_type(struct device *dev, · 48 unmodified lines
4949 if (rot_type != OMAP_DSS_ROT_DMA && rot_type != OMAP_DSS_ROT_VRFB)
5050 return -EINVAL;
5151
52− if (!lock_fb_info(fbi))
53− return -ENODEV;
52+ lock_fb_info(fbi);
5453
5554 r = 0;
5655 if (rot_type == ofbi->rotation_type)
@@ -101,8 +100,7 @@ static ssize_t store_mirror(struct device *dev, · 44 unmodified lines
101100 if (r)
102101 return r;
103102
104− if (!lock_fb_info(fbi))
105− return -ENODEV;
103+ lock_fb_info(fbi);
106104
107105 ofbi->mirror = mirror;
108106
@@ -138,8 +136,7 @@ static ssize_t show_overlays(struct device *dev, · 29 unmodified lines
138136 ssize_t l = 0;
139137 int t;
140138
141− if (!lock_fb_info(fbi))
142− return -ENODEV;
139+ lock_fb_info(fbi);
143140 omapfb_lock(fbdev);
144141
145142 for (t = 0; t < ofbi->num_overlays; t++) {
@@ -197,8 +194,7 @@ static ssize_t store_overlays(struct device *dev, struct device_attribute *attr, · 51 unmodified lines
197194 if (buf[len - 1] == '\n')
198195 len = len - 1;
199196
200− if (!lock_fb_info(fbi))
201− return -ENODEV;
197+ lock_fb_info(fbi);
202198 omapfb_lock(fbdev);
203199
204200 if (len > 0) {
@@ -329,8 +325,7 @@ static ssize_t show_overlays_rotate(struct device *dev, · 124 unmodified lines
329325 ssize_t l = 0;
330326 int t;
331327
332− if (!lock_fb_info(fbi))
333− return -ENODEV;
328+ lock_fb_info(fbi);
334329
335330 for (t = 0; t < ofbi->num_overlays; t++) {
336331 l += snprintf(buf + l, PAGE_SIZE - l, "%s%d",
@@ -358,8 +353,7 @@ static ssize_t store_overlays_rotate(struct device *dev, · 21 unmodified lines
358353 if (buf[len - 1] == '\n')
359354 len = len - 1;
360355
361− if (!lock_fb_info(fbi))
362− return -ENODEV;
356+ lock_fb_info(fbi);
363357
364358 if (len > 0) {
365359 char *p = (char *)buf;
@@ -442,8 +436,7 @@ static ssize_t store_size(struct device *dev, struct device_attribute *attr, · 76 unmodified lines
442436
443437 size = PAGE_ALIGN(size);
444438
445− if (!lock_fb_info(fbi))
446− return -ENODEV;
439+ lock_fb_info(fbi);
447440
448441 if (display && display->driver->sync)
449442 display->driver->sync(display);
drivers/video/fbdev/platinumfb.c+2−3
@@ -538,10 +538,9 @@ static int platinumfb_probe(struct platform_device* odev) · 537 unmodified lines
538538 dev_info(&odev->dev, "Found Apple Platinum video hardware\n");
539539
540540 info = framebuffer_alloc(sizeof(*pinfo), &odev->dev);
541− if (info == NULL) {
542− dev_err(&odev->dev, "Failed to allocate fbdev !\n");
541+ if (!info)
543542 return -ENOMEM;
544− }
543+
545544 pinfo = info->par;
546545
547546 if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) ||
drivers/video/fbdev/pmag-aa-fb.c+1−3
@@ -165,10 +165,8 @@ static int pmagaafb_probe(struct device *dev) · 164 unmodified lines
165165 int err;
166166
167167 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)
170169 return -ENOMEM;
171− }
172170
173171 par = info->par;
174172 dev_set_drvdata(dev, info);
drivers/video/fbdev/pmag-ba-fb.c+1−3
@@ -150,10 +150,8 @@ static int pmagbafb_probe(struct device *dev) · 149 unmodified lines
150150 int err;
151151
152152 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)
155154 return -ENOMEM;
156− }
157155
158156 par = info->par;
159157 dev_set_drvdata(dev, info);
drivers/video/fbdev/pmagb-b-fb.c+1−3
@@ -257,10 +257,8 @@ static int pmagbbfb_probe(struct device *dev) · 256 unmodified lines
257257 int err;
258258
259259 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)
262261 return -ENOMEM;
263− }
264262
265263 par = info->par;
266264 dev_set_drvdata(dev, info);
drivers/video/fbdev/pvr2fb.c+87−101
@@ -140,7 +140,7 @@ static struct pvr2fb_par { · 139 unmodified lines
140140 unsigned char is_doublescan; /* Are scanlines output twice? (doublescan) */
141141 unsigned char is_lowres; /* Is horizontal pixel-doubling enabled? */
142142
143− unsigned long mmio_base; /* MMIO base */
143+ void __iomem *mmio_base; /* MMIO base */
144144 u32 palette[16];
145145 } *currentpar;
146146
@@ -194,39 +194,6 @@ static unsigned int shdma = PVR2_CASCADE_CHAN; · 47 unmodified lines
194194 static unsigned int pvr2dma = ONCHIP_NR_DMA_CHANNELS;
195195 #endif
196196
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−
230197 static struct fb_videomode pvr2_modedb[] = {
231198 /*
232199 * Broadcast video modes (PAL and NTSC). I'm unfamiliar with
@@ -354,6 +321,36 @@ static int pvr2fb_setcolreg(unsigned int regno, unsigned int red, · 121 unmodified lines
354321 return 0;
355322 }
356323
324+/*
325+ * Determine the cable type and initialize the cable output format. Don't do
326+ * anything if the cable type has been overidden (via "cable:XX").
327+ */
328+
329+#define PCTRA ((void __iomem *)0xff80002c)
330+#define PDTRA ((void __iomem *)0xff800030)
331+#define VOUTC ((void __iomem *)0xa0702c00)
332+
333+static int pvr2_init_cable(void)
334+{
335+ if (cable_type < 0) {
336+ fb_writel((fb_readl(PCTRA) & 0xfff0ffff) | 0x000a0000,
337+ PCTRA);
338+ cable_type = (fb_readw(PDTRA) >> 8) & 3;
339+ }
340+
341+ /* Now select the output format (either composite or other) */
342+ /* XXX: Save the previous val first, as this reg is also AICA
343+ related */
344+ if (cable_type == CT_COMPOSITE)
345+ fb_writel(3 << 8, VOUTC);
346+ else if (cable_type == CT_RGB)
347+ fb_writel(1 << 9, VOUTC);
348+ else
349+ fb_writel(0, VOUTC);
350+
351+ return cable_type;
352+}
353+
357354 static int pvr2fb_set_par(struct fb_info *info)
358355 {
359356 struct pvr2fb_par *par = (struct pvr2fb_par *)info->par;
@@ -623,7 +620,7 @@ static void pvr2_do_blank(void) · 263 unmodified lines
623620 is_blanked = do_blank > 0 ? do_blank : 0;
624621 }
625622
626−static irqreturn_t pvr2fb_interrupt(int irq, void *dev_id)
623+static irqreturn_t __maybe_unused pvr2fb_interrupt(int irq, void *dev_id)
627624 {
628625 struct fb_info *info = dev_id;
629626
@@ -642,36 +639,6 @@ static irqreturn_t pvr2fb_interrupt(int irq, void *dev_id) · 12 unmodified lines
642639 return IRQ_HANDLED;
643640 }
644641
645−/*
646− * Determine the cable type and initialize the cable output format. Don't do
647− * anything if the cable type has been overidden (via "cable:XX").
648− */
649−
650−#define PCTRA 0xff80002c
651−#define PDTRA 0xff800030
652−#define VOUTC 0xa0702c00
653−
654−static int pvr2_init_cable(void)
655−{
656− if (cable_type < 0) {
657− fb_writel((fb_readl(PCTRA) & 0xfff0ffff) | 0x000a0000,
658− PCTRA);
659− cable_type = (fb_readw(PDTRA) >> 8) & 3;
660− }
661−
662− /* Now select the output format (either composite or other) */
663− /* XXX: Save the previous val first, as this reg is also AICA
664− related */
665− if (cable_type == CT_COMPOSITE)
666− fb_writel(3 << 8, VOUTC);
667− else if (cable_type == CT_RGB)
668− fb_writel(1 << 9, VOUTC);
669− else
670− fb_writel(0, VOUTC);
671−
672− return cable_type;
673−}
674−
675642 #ifdef CONFIG_PVR2_DMA
676643 static ssize_t pvr2fb_write(struct fb_info *info, const char *buf,
677644 size_t count, loff_t *ppos)
@@ -742,6 +709,46 @@ out_unmap: · 64 unmodified lines
742709 }
743710 #endif /* CONFIG_PVR2_DMA */
744711
712+static struct fb_ops pvr2fb_ops = {
713+ .owner = THIS_MODULE,
714+ .fb_setcolreg = pvr2fb_setcolreg,
715+ .fb_blank = pvr2fb_blank,
716+ .fb_check_var = pvr2fb_check_var,
717+ .fb_set_par = pvr2fb_set_par,
718+#ifdef CONFIG_PVR2_DMA
719+ .fb_write = pvr2fb_write,
720+#endif
721+ .fb_fillrect = cfb_fillrect,
722+ .fb_copyarea = cfb_copyarea,
723+ .fb_imageblit = cfb_imageblit,
724+};
725+
726+#ifndef MODULE
727+static int pvr2_get_param_val(const struct pvr2_params *p, const char *s,
728+ int size)
729+{
730+ int i;
731+
732+ for (i = 0; i < size; i++) {
733+ if (!strncasecmp(p[i].name, s, strlen(s)))
734+ return p[i].val;
735+ }
736+ return -1;
737+}
738+#endif
739+
740+static char *pvr2_get_param_name(const struct pvr2_params *p, int val,
741+ int size)
742+{
743+ int i;
744+
745+ for (i = 0; i < size; i++) {
746+ if (p[i].val == val)
747+ return p[i].name;
748+ }
749+ return NULL;
750+}
751+
745752 /**
746753 * pvr2fb_common_init
747754 *
@@ -760,7 +767,7 @@ out_unmap: · 12 unmodified lines
760767 * in for flexibility anyways. Who knows, maybe someone has tv-out on a
761768 * PCI-based version of these things ;-)
762769 */
763−static int pvr2fb_common_init(void)
770+static int __maybe_unused pvr2fb_common_init(void)
764771 {
765772 struct pvr2fb_par *par = currentpar;
766773 unsigned long modememused, rev;
@@ -773,8 +780,8 @@ static int pvr2fb_common_init(void) · 6 unmodified lines
773780 goto out_err;
774781 }
775782
776− par->mmio_base = (unsigned long)ioremap_nocache(pvr2_fix.mmio_start,
777− pvr2_fix.mmio_len);
783+ par->mmio_base = ioremap_nocache(pvr2_fix.mmio_start,
784+ pvr2_fix.mmio_len);
778785 if (!par->mmio_base) {
779786 printk(KERN_ERR "pvr2fb: Failed to remap mmio space\n");
780787 goto out_err;
@@ -822,8 +829,8 @@ static int pvr2fb_common_init(void) · 41 unmodified lines
822829 fb_info->var.xres, fb_info->var.yres,
823830 fb_info->var.bits_per_pixel,
824831 get_line_length(fb_info->var.xres, fb_info->var.bits_per_pixel),
825− (char *)pvr2_get_param(cables, NULL, cable_type, 3),
826− (char *)pvr2_get_param(outputs, NULL, video_output, 3));
832+ pvr2_get_param_name(cables, cable_type, 3),
833+ pvr2_get_param_name(outputs, video_output, 3));
827834
828835 #ifdef CONFIG_SH_STORE_QUEUES
829836 fb_notice(fb_info, "registering with SQ API\n");
@@ -841,7 +848,7 @@ out_err: · 11 unmodified lines
841848 if (fb_info->screen_base)
842849 iounmap(fb_info->screen_base);
843850 if (par->mmio_base)
844− iounmap((void *)par->mmio_base);
851+ iounmap(par->mmio_base);
845852
846853 return -ENXIO;
847854 }
@@ -901,15 +908,15 @@ static int __init pvr2fb_dc_init(void) · 53 unmodified lines
901908 return pvr2fb_common_init();
902909 }
903910
904−static void __exit pvr2fb_dc_exit(void)
911+static void pvr2fb_dc_exit(void)
905912 {
906913 if (fb_info->screen_base) {
907914 iounmap(fb_info->screen_base);
908915 fb_info->screen_base = NULL;
909916 }
910917 if (currentpar->mmio_base) {
911− iounmap((void *)currentpar->mmio_base);
912− currentpar->mmio_base = 0;
918+ iounmap(currentpar->mmio_base);
919+ currentpar->mmio_base = NULL;
913920 }
914921
915922 free_irq(HW_EVENT_VSYNC, fb_info);
@@ -958,8 +965,8 @@ static void pvr2fb_pci_remove(struct pci_dev *pdev) · 42 unmodified lines
958965 fb_info->screen_base = NULL;
959966 }
960967 if (currentpar->mmio_base) {
961− iounmap((void *)currentpar->mmio_base);
962− currentpar->mmio_base = 0;
968+ iounmap(currentpar->mmio_base);
969+ currentpar->mmio_base = NULL;
963970 }
964971
965972 pci_release_regions(pdev);
@@ -985,29 +992,12 @@ static int __init pvr2fb_pci_init(void) · 19 unmodified lines
985992 return pci_register_driver(&pvr2fb_pci_driver);
986993 }
987994
988−static void __exit pvr2fb_pci_exit(void)
995+static void pvr2fb_pci_exit(void)
989996 {
990997 pci_unregister_driver(&pvr2fb_pci_driver);
991998 }
992999 #endif /* CONFIG_PCI */
9931000
994−static int pvr2_get_param(const struct pvr2_params *p, const char *s, int val,
995− int size)
996−{
997− int i;
998−
999− for (i = 0 ; i < size ; i++ ) {
1000− if (s != NULL) {
1001− if (!strncasecmp(p[i].name, s, strlen(s)))
1002− return p[i].val;
1003− } else {
1004− if (p[i].val == val)
1005− return (int)p[i].name;
1006− }
1007− }
1008− return -1;
1009−}
1010−
10111001 /*
10121002 * Parse command arguments. Supported arguments are:
10131003 * inverse Use inverse color maps
@@ -1047,9 +1037,9 @@ static int __init pvr2fb_setup(char *options) · 33 unmodified lines
10471037 }
10481038
10491039 if (*cable_arg)
1050− cable_type = pvr2_get_param(cables, cable_arg, 0, 3);
1040+ cable_type = pvr2_get_param_val(cables, cable_arg, 3);
10511041 if (*output_arg)
1052− video_output = pvr2_get_param(outputs, output_arg, 0, 3);
1042+ video_output = pvr2_get_param_val(outputs, output_arg, 3);
10531043
10541044 return 0;
10551045 }
@@ -1082,12 +1072,8 @@ static int __init pvr2fb_init(void) · 26 unmodified lines
10821072 #endif
10831073
10841074 fb_info = framebuffer_alloc(sizeof(struct pvr2fb_par), NULL);
1085−
1086− if (!fb_info) {
1087− printk(KERN_ERR "Failed to allocate memory for fb_info\n");
1075+ if (!fb_info)
10881076 return -ENOMEM;
1089− }
1090−
10911077
10921078 currentpar = fb_info->par;
10931079
drivers/video/fbdev/riva/fbdev.c+0−1
@@ -1902,7 +1902,6 @@ static int rivafb_probe(struct pci_dev *pd, const struct pci_device_id *ent) · 1901 unmodified lines
19021902
19031903 info = framebuffer_alloc(sizeof(struct riva_par), &pd->dev);
19041904 if (!info) {
1905− printk (KERN_ERR PFX "could not allocate memory\n");
19061905 ret = -ENOMEM;
19071906 goto err_ret;
19081907 }
drivers/video/fbdev/s3c-fb.c+11−13
@@ -284,7 +284,7 @@ static int s3c_fb_check_var(struct fb_var_screeninfo *var, · 283 unmodified lines
284284 /* 666 with one bit alpha/transparency */
285285 var->transp.offset = 18;
286286 var->transp.length = 1;
287− /* drop through */
287+ /* fall through */
288288 case 18:
289289 var->bits_per_pixel = 32;
290290
@@ -312,7 +312,7 @@ static int s3c_fb_check_var(struct fb_var_screeninfo *var, · 21 unmodified lines
312312 case 25:
313313 var->transp.length = var->bits_per_pixel - 24;
314314 var->transp.offset = 24;
315− /* drop through */
315+ /* fall through */
316316 case 24:
317317 /* our 24bpp is unpacked, so 32bpp */
318318 var->bits_per_pixel = 32;
@@ -809,7 +809,7 @@ static int s3c_fb_blank(int blank_mode, struct fb_info *info) · 490 unmodified lines
809809 case FB_BLANK_POWERDOWN:
810810 wincon &= ~WINCONx_ENWIN;
811811 sfb->enabled &= ~(1 << index);
812− /* fall through to FB_BLANK_NORMAL */
812+ /* fall through - to FB_BLANK_NORMAL */
813813
814814 case FB_BLANK_NORMAL:
815815 /* disable the DMA and display 0x0 (black) */
@@ -1102,14 +1102,14 @@ static int s3c_fb_alloc_memory(struct s3c_fb *sfb, struct s3c_fb_win *win) · 286 unmodified lines
11021102
11031103 dev_dbg(sfb->dev, "want %u bytes for window\n", size);
11041104
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)
11071107 return -ENOMEM;
11081108
11091109 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);
11111111
1112− memset(fbi->screen_base, 0x0, size);
1112+ memset(fbi->screen_buffer, 0x0, size);
11131113 fbi->fix.smem_start = map_dma;
11141114
11151115 return 0;
@@ -1126,9 +1126,9 @@ static void s3c_fb_free_memory(struct s3c_fb *sfb, struct s3c_fb_win *win) · 10 unmodified lines
11261126 {
11271127 struct fb_info *fbi = win->fbinfo;
11281128
1129− if (fbi->screen_base)
1129+ if (fbi->screen_buffer)
11301130 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);
11321132 }
11331133
11341134 /**
@@ -1186,10 +1186,8 @@ static int s3c_fb_probe_win(struct s3c_fb *sfb, unsigned int win_no, · 51 unmodified lines
11861186
11871187 fbinfo = framebuffer_alloc(sizeof(struct s3c_fb_win) +
11881188 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;
11931191
11941192 windata = sfb->pdata->win[win_no];
11951193 initmode = *sfb->pdata->vtiming;
drivers/video/fbdev/s3fb.c+1−3
@@ -1128,10 +1128,8 @@ static int s3_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) · 1127 unmodified lines
11281128
11291129 /* Allocate and fill driver data structure */
11301130 info = framebuffer_alloc(sizeof(struct s3fb_info), &(dev->dev));
1131− if (!info) {
1132− dev_err(&(dev->dev), "cannot allocate memory\n");
1131+ if (!info)
11331132 return -ENOMEM;
1134− }
11351133
11361134 par = info->par;
11371135 mutex_init(&par->open_lock);
drivers/video/fbdev/sa1100fb.c+0−25
@@ -974,35 +974,10 @@ static void sa1100fb_task(struct work_struct *w) · 973 unmodified lines
974974 */
975975 static unsigned int sa1100fb_min_dma_period(struct sa1100fb_info *fbi)
976976 {
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
1001977 /*
1002978 * FIXME: we need to verify _all_ consoles.
1003979 */
1004980 return sa1100fb_display_dma_period(&fbi->fb.var);
1005−#endif
1006981 }
1007982
1008983 /*
drivers/video/fbdev/savage/savagefb_driver.c+1−8
@@ -2333,14 +2333,7 @@ static void savagefb_remove(struct pci_dev *dev) · 2332 unmodified lines
23332333 DBG("savagefb_remove");
23342334
23352335 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);
23442337
23452338 #ifdef CONFIG_FB_SAVAGE_I2C
23462339 savagefb_delete_i2c_busses(info);
drivers/video/fbdev/sh_mobile_lcdcfb.c+4−136
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <linux/ctype.h>
1616 #include <linux/dma-mapping.h>
1717 #include <linux/delay.h>
18+#include <linux/fbcon.h>
1819 #include <linux/gpio.h>
1920 #include <linux/init.h>
2021 #include <linux/interrupt.h>
@@ -213,7 +214,6 @@ struct sh_mobile_lcdc_priv { · 192 unmodified lines
213214 struct sh_mobile_lcdc_chan ch[2];
214215 struct sh_mobile_lcdc_overlay overlays[4];
215216
216− struct notifier_block notifier;
217217 int started;
218218 int forced_fourcc; /* 2 channel LCDC must share fourcc setting */
219219 };
@@ -534,89 +534,9 @@ static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch) · 314 unmodified lines
534534 ch->tx_dev->ops->display_off(ch->tx_dev);
535535 }
536536
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−
556537 static int sh_mobile_lcdc_check_var(struct fb_var_screeninfo *var,
557538 struct fb_info *info);
558539
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−
620540 /* -----------------------------------------------------------------------------
621541 * Format helpers
622542 */
@@ -1644,10 +1564,8 @@ sh_mobile_lcdc_overlay_fb_init(struct sh_mobile_lcdc_overlay *ovl) · 1021 unmodified lines
16441564
16451565 /* Allocate and initialize the frame buffer device. */
16461566 info = framebuffer_alloc(0, priv->dev);
1647− if (info == NULL) {
1648− dev_err(priv->dev, "unable to allocate fb_info\n");
1567+ if (!info)
16491568 return -ENOMEM;
1650− }
16511569
16521570 ovl->info = info;
16531571
@@ -1838,8 +1756,6 @@ static void sh_mobile_fb_reconfig(struct fb_info *info) · 184 unmodified lines
18381756 struct sh_mobile_lcdc_chan *ch = info->par;
18391757 struct fb_var_screeninfo var;
18401758 struct fb_videomode mode;
1841− struct fb_event event;
1842− int evnt = FB_EVENT_MODE_CHANGE_ALL;
18431759
18441760 if (ch->use_count > 1 || (ch->use_count == 1 && !info->fbcon_par))
18451761 /* More framebuffer users are active */
@@ -1861,14 +1777,7 @@ static void sh_mobile_fb_reconfig(struct fb_info *info) · 15 unmodified lines
18611777 /* Couldn't reconfigure, hopefully, can continue as before */
18621778 return;
18631779
1864− /*
1865− * fb_set_var() calls the notifier change internally, only if
1866− * FBINFO_MISC_USEREVENT flag is set. Since we do not want to fake a
1867− * user event, we have to call the chain ourselves.
1868− */
1869− event.info = info;
1870− event.data = &ch->display.mode;
1871− fb_notifier_call_chain(evnt, &event);
1780+ fbcon_update_vcs(info, true);
18721781 }
18731782
18741783 /*
@@ -2138,10 +2047,8 @@ sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch, · 263 unmodified lines
21382047 * list and allocate the color map.
21392048 */
21402049 info = framebuffer_alloc(0, priv->dev);
2141− if (info == NULL) {
2142− dev_err(priv->dev, "unable to allocate fb_info\n");
2050+ if (!info)
21432051 return -ENOMEM;
2144− }
21452052
21462053 ch->info = info;
21472054
@@ -2319,37 +2226,6 @@ static const struct dev_pm_ops sh_mobile_lcdc_dev_pm_ops = { · 171 unmodified lines
23192226 * Framebuffer notifier
23202227 */
23212228
2322−/* locking: called with info->lock held */
2323−static int sh_mobile_lcdc_notify(struct notifier_block *nb,
2324− unsigned long action, void *data)
2325−{
2326− struct fb_event *event = data;
2327− struct fb_info *info = event->info;
2328− struct sh_mobile_lcdc_chan *ch = info->par;
2329−
2330− if (&ch->lcdc->notifier != nb)
2331− return NOTIFY_DONE;
2332−
2333− dev_dbg(info->dev, "%s(): action = %lu, data = %p\n",
2334− __func__, action, event->data);
2335−
2336− switch(action) {
2337− case FB_EVENT_SUSPEND:
2338− sh_mobile_lcdc_display_off(ch);
2339− sh_mobile_lcdc_stop(ch->lcdc);
2340− break;
2341− case FB_EVENT_RESUME:
2342− mutex_lock(&ch->open_lock);
2343− sh_mobile_fb_reconfig(info);
2344− mutex_unlock(&ch->open_lock);
2345−
2346− sh_mobile_lcdc_display_on(ch);
2347− sh_mobile_lcdc_start(ch->lcdc);
2348− }
2349−
2350− return NOTIFY_OK;
2351−}
2352−
23532229 /* -----------------------------------------------------------------------------
23542230 * Probe/remove and driver init/exit
23552231 */
@@ -2377,8 +2253,6 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev) · 21 unmodified lines
23772253 struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev);
23782254 unsigned int i;
23792255
2380− fb_unregister_client(&priv->notifier);
2381−
23822256 for (i = 0; i < ARRAY_SIZE(priv->overlays); i++)
23832257 sh_mobile_lcdc_overlay_fb_unregister(&priv->overlays[i]);
23842258 for (i = 0; i < ARRAY_SIZE(priv->ch); i++)
@@ -2540,8 +2414,6 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch) · 155 unmodified lines
25402414 unsigned int max_size;
25412415 unsigned int i;
25422416
2543− ch->notify = sh_mobile_lcdc_display_notify;
2544−
25452417 /* Validate the format. */
25462418 format = sh_mobile_format_info(cfg->fourcc);
25472419 if (format == NULL) {
@@ -2770,10 +2642,6 @@ static int sh_mobile_lcdc_probe(struct platform_device *pdev) · 222 unmodified lines
27702642 goto err1;
27712643 }
27722644
2773− /* Failure ignored */
2774− priv->notifier.notifier_call = sh_mobile_lcdc_notify;
2775− fb_register_client(&priv->notifier);
2776−
27772645 return 0;
27782646 err1:
27792647 sh_mobile_lcdc_remove(pdev);
drivers/video/fbdev/sh_mobile_lcdcfb.h+0−5
@@ -87,11 +87,6 @@ struct sh_mobile_lcdc_chan { · 86 unmodified lines
8787 unsigned long base_addr_c;
8888 unsigned int line_size;
8989
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−
9590 /* Backlight */
9691 struct backlight_device *bl;
9792 unsigned int bl_brightness;
drivers/video/fbdev/sm501fb.c+1−3
@@ -1865,10 +1865,8 @@ static int sm501fb_probe_one(struct sm501fb_info *info, · 1864 unmodified lines
18651865 }
18661866
18671867 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)
18701869 return -ENOMEM;
1871− }
18721870
18731871 par = fbi->par;
18741872 par->info = info;
drivers/video/fbdev/sm712fb.c+0−1
@@ -1538,7 +1538,6 @@ static int smtcfb_pci_probe(struct pci_dev *pdev, · 1537 unmodified lines
15381538
15391539 info = framebuffer_alloc(sizeof(*sfb), &pdev->dev);
15401540 if (!info) {
1541− dev_err(&pdev->dev, "framebuffer_alloc failed\n");
15421541 err = -ENOMEM;
15431542 goto failed_free;
15441543 }
drivers/video/fbdev/smscufx.c+1−3
@@ -1650,10 +1650,8 @@ static int ufx_usb_probe(struct usb_interface *interface, · 1649 unmodified lines
16501650
16511651 /* allocates framebuffer driver structure, not framebuffer memory */
16521652 info = framebuffer_alloc(0, &usbdev->dev);
1653− if (!info) {
1654− dev_err(dev->gdev, "framebuffer_alloc failed\n");
1653+ if (!info)
16551654 goto e_nomem;
1656− }
16571655
16581656 dev->info = info;
16591657 info->par = dev;
drivers/video/fbdev/ssd1307fb.c+1−3
@@ -555,10 +555,8 @@ static int ssd1307fb_probe(struct i2c_client *client, · 554 unmodified lines
555555 }
556556
557557 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)
560559 return -ENOMEM;
561− }
562560
563561 par = info->par;
564562 par->info = info;
drivers/video/fbdev/sunxvr1000.c+0−1
@@ -121,7 +121,6 @@ static int gfb_probe(struct platform_device *op) · 120 unmodified lines
121121
122122 info = framebuffer_alloc(sizeof(struct gfb_info), &op->dev);
123123 if (!info) {
124− printk(KERN_ERR "gfb: Cannot allocate fb_info\n");
125124 err = -ENOMEM;
126125 goto err_out;
127126 }
drivers/video/fbdev/sunxvr2500.c+0−1
@@ -132,7 +132,6 @@ static int s3d_pci_register(struct pci_dev *pdev, · 131 unmodified lines
132132
133133 info = framebuffer_alloc(sizeof(struct s3d_info), &pdev->dev);
134134 if (!info) {
135− printk(KERN_ERR "s3d: Cannot allocate fb_info\n");
136135 err = -ENOMEM;
137136 goto err_disable;
138137 }
drivers/video/fbdev/sunxvr500.c+0−1
@@ -272,7 +272,6 @@ static int e3d_pci_register(struct pci_dev *pdev, · 271 unmodified lines
272272
273273 info = framebuffer_alloc(sizeof(struct e3d_info), &pdev->dev);
274274 if (!info) {
275− printk(KERN_ERR "e3d: Cannot allocate fb_info\n");
276275 err = -ENOMEM;
277276 goto err_disable;
278277 }
drivers/video/fbdev/tgafb.c+1−3
@@ -1416,10 +1416,8 @@ static int tgafb_register(struct device *dev) · 1415 unmodified lines
14161416
14171417 /* Allocate the fb and par structures. */
14181418 info = framebuffer_alloc(sizeof(struct tga_par), dev);
1419− if (!info) {
1420− printk(KERN_ERR "tgafb: Cannot allocate memory\n");
1419+ if (!info)
14211420 return -ENOMEM;
1422− }
14231421
14241422 par = info->par;
14251423 dev_set_drvdata(dev, info);
drivers/video/fbdev/udlfb.c+1−3
@@ -1686,10 +1686,8 @@ static int dlfb_usb_probe(struct usb_interface *intf, · 1685 unmodified lines
16861686
16871687 /* allocates framebuffer driver structure, not framebuffer memory */
16881688 info = framebuffer_alloc(0, &dlfb->udev->dev);
1689− if (!info) {
1690− dev_err(&dlfb->udev->dev, "framebuffer_alloc failed\n");
1689+ if (!info)
16911690 goto error;
1692− }
16931691
16941692 dlfb->info = info;
16951693 info->par = dlfb;
drivers/video/fbdev/via/viafbdev.c+1−5
@@ -1742,10 +1742,8 @@ int via_fb_pci_probe(struct viafb_dev *vdev) · 1741 unmodified lines
17421742 viafbinfo = framebuffer_alloc(viafb_par_length +
17431743 ALIGN(sizeof(struct viafb_shared), BITS_PER_LONG/8),
17441744 &vdev->pdev->dev);
1745− if (!viafbinfo) {
1746− printk(KERN_ERR"Could not allocate memory for viafb_info.\n");
1745+ if (!viafbinfo)
17471746 return -ENOMEM;
1748− }
17491747
17501748 viaparinfo = (struct viafb_par *)viafbinfo->par;
17511749 viaparinfo->shared = viafbinfo->par + viafb_par_length;
@@ -1820,8 +1818,6 @@ int via_fb_pci_probe(struct viafb_dev *vdev) · 68 unmodified lines
18201818 viafbinfo1 = framebuffer_alloc(viafb_par_length,
18211819 &vdev->pdev->dev);
18221820 if (!viafbinfo1) {
1823− printk(KERN_ERR
1824− "allocate the second framebuffer struct error\n");
18251821 rc = -ENOMEM;
18261822 goto out_fb_release;
18271823 }
drivers/video/fbdev/vt8623fb.c+1−3
@@ -669,10 +669,8 @@ static int vt8623_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) · 668 unmodified lines
669669
670670 /* Allocate and fill driver data structure */
671671 info = framebuffer_alloc(sizeof(struct vt8623fb_info), &(dev->dev));
672− if (! info) {
673− dev_err(&(dev->dev), "cannot allocate memory\n");
672+ if (!info)
674673 return -ENOMEM;
675− }
676674
677675 par = info->par;
678676 mutex_init(&par->open_lock);
include/linux/console_struct.h+1−4
@@ -168,9 +168,6 @@ extern void vc_SAK(struct work_struct *work); · 167 unmodified lines
168168
169169 #define CUR_DEFAULT CUR_UNDERLINE
170170
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);
175172
176173 #endif /* _LINUX_CONSOLE_STRUCT_H */
include/linux/fb.h+12−33
@@ -126,39 +126,15 @@ struct fb_cursor_user { · 125 unmodified lines
126126
127127 /* The resolution of the passed in fb_info about to change */
128128 #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 */
140132 #define FB_EVENT_FB_REGISTERED 0x05
141−/* A driver unregistered itself */
142133 #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 */
148137 #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
162138 /* A hardware display blank early change occurred */
163139 #define FB_EARLY_EVENT_BLANK 0x10
164140 /* A hardware display blank revert early change occurred */
@@ -633,8 +609,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, · 468 unmodified lines
633609
634610 /* drivers/video/fbmem.c */
635611 extern int register_framebuffer(struct fb_info *fb_info);
636−extern int unregister_framebuffer(struct fb_info *fb_info);
637−extern int unlink_framebuffer(struct fb_info *fb_info);
612+extern void unregister_framebuffer(struct fb_info *fb_info);
613+extern void unlink_framebuffer(struct fb_info *fb_info);
638614 extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id,
639615 const char *name);
640616 extern int remove_conflicting_framebuffers(struct apertures_struct *a,
@@ -660,7 +636,10 @@ extern struct class *fb_class; · 19 unmodified lines
660636 for (i = 0; i < FB_MAX; i++) \
661637 if (!registered_fb[i]) {} else
662638
663−extern int lock_fb_info(struct fb_info *info);
639+static inline void lock_fb_info(struct fb_info *info)
640+{
641+ mutex_lock(&info->lock);
642+}
664643
665644 static inline void unlock_fb_info(struct fb_info *info)
666645 {
include/linux/fbcon.h+30−0
@@ -4,9 +4,39 @@ · 3 unmodified lines
44 #ifdef CONFIG_FRAMEBUFFER_CONSOLE
55 void __init fb_console_init(void);
66 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);
722 #else
823 static inline void fb_console_init(void) {}
924 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; }
1040 #endif
1141
1242 #endif /* _LINUX_FBCON_H */
include/video/omapfb_dss.h+0−32
@@ -114,11 +114,6 @@ enum omap_dss_trans_key_type { · 113 unmodified lines
114114 OMAP_DSS_COLOR_KEY_VID_SRC = 1,
115115 };
116116
117−enum omap_rfbi_te_mode {
118− OMAP_DSS_RFBI_TE_MODE_1 = 1,
119− OMAP_DSS_RFBI_TE_MODE_2 = 2,
120−};
121−
122117 enum omap_dss_signal_level {
123118 OMAPDSS_SIG_ACTIVE_LOW,
124119 OMAPDSS_SIG_ACTIVE_HIGH,
@@ -189,27 +184,6 @@ enum omap_dss_output_id { · 64 unmodified lines
189184 OMAP_DSS_OUTPUT_HDMI = 1 << 6,
190185 };
191186
192−/* RFBI */
193−
194−struct rfbi_timings {
195− int cs_on_time;
196− int cs_off_time;
197− int we_on_time;
198− int we_off_time;
199− int re_on_time;
200− int re_off_time;
201− int we_cycle_time;
202− int re_cycle_time;
203− int cs_pulse_width;
204− int access_time;
205−
206− int clk_div;
207−
208− u32 tim[5]; /* set by rfbi_convert_timings() */
209−
210− int converted;
211−};
212−
213187 /* DSI */
214188
215189 enum omap_dss_dsi_trans_mode {
@@ -640,11 +614,6 @@ struct omap_dss_device { · 424 unmodified lines
640614 u8 data_lines;
641615 } dpi;
642616
643− struct {
644− u8 channel;
645− u8 data_lines;
646− } rfbi;
647−
648617 struct {
649618 u8 datapairs;
650619 } sdi;
@@ -668,7 +637,6 @@ struct omap_dss_device { · 17 unmodified lines
668637
669638 struct {
670639 u8 pixel_size;
671− struct rfbi_timings rfbi_timings;
672640 } ctrl;
673641
674642 const char *name;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t