aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/fb/udlfb.txt (renamed from drivers/staging/udlfb/udlfb.txt)0
-rw-r--r--drivers/staging/Kconfig2
-rw-r--r--drivers/staging/Makefile1
-rw-r--r--drivers/staging/udlfb/Kconfig14
-rw-r--r--drivers/staging/udlfb/Makefile1
-rw-r--r--drivers/video/Kconfig14
-rw-r--r--drivers/video/Makefile1
-rw-r--r--drivers/video/udlfb.c (renamed from drivers/staging/udlfb/udlfb.c)135
-rw-r--r--include/video/udlfb.h (renamed from drivers/staging/udlfb/udlfb.h)22
9 files changed, 64 insertions, 126 deletions
diff --git a/drivers/staging/udlfb/udlfb.txt b/Documentation/fb/udlfb.txt
index 7fdde2a02a27..7fdde2a02a27 100644
--- a/drivers/staging/udlfb/udlfb.txt
+++ b/Documentation/fb/udlfb.txt
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 5eafdf435550..df31a7228079 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -111,8 +111,6 @@ source "drivers/staging/vt6655/Kconfig"
111 111
112source "drivers/staging/vt6656/Kconfig" 112source "drivers/staging/vt6656/Kconfig"
113 113
114source "drivers/staging/udlfb/Kconfig"
115
116source "drivers/staging/hv/Kconfig" 114source "drivers/staging/hv/Kconfig"
117 115
118source "drivers/staging/vme/Kconfig" 116source "drivers/staging/vme/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index a97a955c094b..7a15c0c82b69 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -38,7 +38,6 @@ obj-$(CONFIG_USB_SERIAL_QUATECH_USB2) += quatech_usb2/
38obj-$(CONFIG_OCTEON_ETHERNET) += octeon/ 38obj-$(CONFIG_OCTEON_ETHERNET) += octeon/
39obj-$(CONFIG_VT6655) += vt6655/ 39obj-$(CONFIG_VT6655) += vt6655/
40obj-$(CONFIG_VT6656) += vt6656/ 40obj-$(CONFIG_VT6656) += vt6656/
41obj-$(CONFIG_FB_UDL) += udlfb/
42obj-$(CONFIG_HYPERV) += hv/ 41obj-$(CONFIG_HYPERV) += hv/
43obj-$(CONFIG_VME_BUS) += vme/ 42obj-$(CONFIG_VME_BUS) += vme/
44obj-$(CONFIG_MRST_RAR_HANDLER) += memrar/ 43obj-$(CONFIG_MRST_RAR_HANDLER) += memrar/
diff --git a/drivers/staging/udlfb/Kconfig b/drivers/staging/udlfb/Kconfig
deleted file mode 100644
index 65bd5db4ca56..000000000000
--- a/drivers/staging/udlfb/Kconfig
+++ /dev/null
@@ -1,14 +0,0 @@
1config FB_UDL
2 tristate "Displaylink USB Framebuffer support"
3 depends on FB && USB
4 select FB_MODE_HELPERS
5 select FB_SYS_FILLRECT
6 select FB_SYS_COPYAREA
7 select FB_SYS_IMAGEBLIT
8 select FB_SYS_FOPS
9 select FB_DEFERRED_IO
10 ---help---
11 This is a kernel framebuffer driver for DisplayLink USB devices.
12 Supports fbdev clients like xf86-video-fbdev, kdrive, fbi, and
13 mplayer -vo fbdev. Supports all USB 2.0 era DisplayLink devices.
14 To compile as a module, choose M here: the module name is udlfb.
diff --git a/drivers/staging/udlfb/Makefile b/drivers/staging/udlfb/Makefile
deleted file mode 100644
index 30d9e675b10f..000000000000
--- a/drivers/staging/udlfb/Makefile
+++ /dev/null
@@ -1 +0,0 @@
1obj-$(CONFIG_FB_UDL) += udlfb.o
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index fdddf58bdaf5..9f36a29b10b4 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -2116,6 +2116,20 @@ config FB_SM501
2116 2116
2117 If unsure, say N. 2117 If unsure, say N.
2118 2118
2119config FB_UDL
2120 tristate "Displaylink USB Framebuffer support"
2121 depends on FB && USB
2122 select FB_MODE_HELPERS
2123 select FB_SYS_FILLRECT
2124 select FB_SYS_COPYAREA
2125 select FB_SYS_IMAGEBLIT
2126 select FB_SYS_FOPS
2127 select FB_DEFERRED_IO
2128 ---help---
2129 This is a kernel framebuffer driver for DisplayLink USB devices.
2130 Supports fbdev clients like xf86-video-fbdev, kdrive, fbi, and
2131 mplayer -vo fbdev. Supports all USB 2.0 era DisplayLink devices.
2132 To compile as a module, choose M here: the module name is udlfb.
2119 2133
2120config FB_PNX4008_DUM 2134config FB_PNX4008_DUM
2121 tristate "Display Update Module support on Philips PNX4008 board" 2135 tristate "Display Update Module support on Philips PNX4008 board"
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index bdf626419433..f9de51c39ad7 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -125,6 +125,7 @@ obj-$(CONFIG_FB_PNX4008_DUM_RGB) += pnx4008/
125obj-$(CONFIG_FB_IBM_GXT4500) += gxt4500.o 125obj-$(CONFIG_FB_IBM_GXT4500) += gxt4500.o
126obj-$(CONFIG_FB_PS3) += ps3fb.o 126obj-$(CONFIG_FB_PS3) += ps3fb.o
127obj-$(CONFIG_FB_SM501) += sm501fb.o 127obj-$(CONFIG_FB_SM501) += sm501fb.o
128obj-$(CONFIG_FB_UDL) += udlfb.o
128obj-$(CONFIG_FB_XILINX) += xilinxfb.o 129obj-$(CONFIG_FB_XILINX) += xilinxfb.o
129obj-$(CONFIG_SH_MIPI_DSI) += sh_mipi_dsi.o 130obj-$(CONFIG_SH_MIPI_DSI) += sh_mipi_dsi.o
130obj-$(CONFIG_FB_SH_MOBILE_HDMI) += sh_mobile_hdmi.o 131obj-$(CONFIG_FB_SH_MOBILE_HDMI) += sh_mobile_hdmi.o
diff --git a/drivers/staging/udlfb/udlfb.c b/drivers/video/udlfb.c
index b7ac16005265..020589a6bf02 100644
--- a/drivers/staging/udlfb/udlfb.c
+++ b/drivers/video/udlfb.c
@@ -16,6 +16,8 @@
16 * from Florian Echtler, Henrik Bjerregaard Pedersen, and others. 16 * from Florian Echtler, Henrik Bjerregaard Pedersen, and others.
17 */ 17 */
18 18
19#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
20
19#include <linux/module.h> 21#include <linux/module.h>
20#include <linux/kernel.h> 22#include <linux/kernel.h>
21#include <linux/init.h> 23#include <linux/init.h>
@@ -26,8 +28,8 @@
26#include <linux/vmalloc.h> 28#include <linux/vmalloc.h>
27#include <linux/slab.h> 29#include <linux/slab.h>
28#include <linux/delay.h> 30#include <linux/delay.h>
29 31#include <video/udlfb.h>
30#include "udlfb.h" 32#include "edid.h"
31 33
32static struct fb_fix_screeninfo dlfb_fix = { 34static struct fb_fix_screeninfo dlfb_fix = {
33 .id = "udlfb", 35 .id = "udlfb",
@@ -40,9 +42,7 @@ static struct fb_fix_screeninfo dlfb_fix = {
40}; 42};
41 43
42static const u32 udlfb_info_flags = FBINFO_DEFAULT | FBINFO_READS_FAST | 44static const u32 udlfb_info_flags = FBINFO_DEFAULT | FBINFO_READS_FAST |
43#ifdef FBINFO_VIRTFB
44 FBINFO_VIRTFB | 45 FBINFO_VIRTFB |
45#endif
46 FBINFO_HWACCEL_IMAGEBLIT | FBINFO_HWACCEL_FILLRECT | 46 FBINFO_HWACCEL_IMAGEBLIT | FBINFO_HWACCEL_FILLRECT |
47 FBINFO_HWACCEL_COPYAREA | FBINFO_MISC_ALWAYS_SETPAR; 47 FBINFO_HWACCEL_COPYAREA | FBINFO_MISC_ALWAYS_SETPAR;
48 48
@@ -293,7 +293,7 @@ static int dlfb_ops_mmap(struct fb_info *info, struct vm_area_struct *vma)
293 293
294 pos = (unsigned long)info->fix.smem_start + offset; 294 pos = (unsigned long)info->fix.smem_start + offset;
295 295
296 dl_notice("mmap() framebuffer addr:%lu size:%lu\n", 296 pr_notice("mmap() framebuffer addr:%lu size:%lu\n",
297 pos, size); 297 pos, size);
298 298
299 while (size > 0) { 299 while (size > 0) {
@@ -595,18 +595,6 @@ error:
595 return 0; 595 return 0;
596} 596}
597 597
598static ssize_t dlfb_ops_read(struct fb_info *info, char __user *buf,
599 size_t count, loff_t *ppos)
600{
601 ssize_t result = -ENOSYS;
602
603#if defined CONFIG_FB_SYS_FOPS || defined CONFIG_FB_SYS_FOPS_MODULE
604 result = fb_sys_read(info, buf, count, ppos);
605#endif
606
607 return result;
608}
609
610/* 598/*
611 * Path triggered by usermode clients who write to filesystem 599 * Path triggered by usermode clients who write to filesystem
612 * e.g. cat filename > /dev/fb1 600 * e.g. cat filename > /dev/fb1
@@ -616,12 +604,10 @@ static ssize_t dlfb_ops_read(struct fb_info *info, char __user *buf,
616static ssize_t dlfb_ops_write(struct fb_info *info, const char __user *buf, 604static ssize_t dlfb_ops_write(struct fb_info *info, const char __user *buf,
617 size_t count, loff_t *ppos) 605 size_t count, loff_t *ppos)
618{ 606{
619 ssize_t result = -ENOSYS; 607 ssize_t result;
620 struct dlfb_data *dev = info->par; 608 struct dlfb_data *dev = info->par;
621 u32 offset = (u32) *ppos; 609 u32 offset = (u32) *ppos;
622 610
623#if defined CONFIG_FB_SYS_FOPS || defined CONFIG_FB_SYS_FOPS_MODULE
624
625 result = fb_sys_write(info, buf, count, ppos); 611 result = fb_sys_write(info, buf, count, ppos);
626 612
627 if (result > 0) { 613 if (result > 0) {
@@ -632,7 +618,6 @@ static ssize_t dlfb_ops_write(struct fb_info *info, const char __user *buf,
632 dlfb_handle_damage(dev, 0, start, info->var.xres, 618 dlfb_handle_damage(dev, 0, start, info->var.xres,
633 lines, info->screen_base); 619 lines, info->screen_base);
634 } 620 }
635#endif
636 621
637 return result; 622 return result;
638} 623}
@@ -644,14 +629,10 @@ static void dlfb_ops_copyarea(struct fb_info *info,
644 629
645 struct dlfb_data *dev = info->par; 630 struct dlfb_data *dev = info->par;
646 631
647#if defined CONFIG_FB_SYS_COPYAREA || defined CONFIG_FB_SYS_COPYAREA_MODULE
648
649 sys_copyarea(info, area); 632 sys_copyarea(info, area);
650 633
651 dlfb_handle_damage(dev, area->dx, area->dy, 634 dlfb_handle_damage(dev, area->dx, area->dy,
652 area->width, area->height, info->screen_base); 635 area->width, area->height, info->screen_base);
653#endif
654
655} 636}
656 637
657static void dlfb_ops_imageblit(struct fb_info *info, 638static void dlfb_ops_imageblit(struct fb_info *info,
@@ -659,15 +640,10 @@ static void dlfb_ops_imageblit(struct fb_info *info,
659{ 640{
660 struct dlfb_data *dev = info->par; 641 struct dlfb_data *dev = info->par;
661 642
662#if defined CONFIG_FB_SYS_IMAGEBLIT || defined CONFIG_FB_SYS_IMAGEBLIT_MODULE
663
664 sys_imageblit(info, image); 643 sys_imageblit(info, image);
665 644
666 dlfb_handle_damage(dev, image->dx, image->dy, 645 dlfb_handle_damage(dev, image->dx, image->dy,
667 image->width, image->height, info->screen_base); 646 image->width, image->height, info->screen_base);
668
669#endif
670
671} 647}
672 648
673static void dlfb_ops_fillrect(struct fb_info *info, 649static void dlfb_ops_fillrect(struct fb_info *info,
@@ -675,17 +651,12 @@ static void dlfb_ops_fillrect(struct fb_info *info,
675{ 651{
676 struct dlfb_data *dev = info->par; 652 struct dlfb_data *dev = info->par;
677 653
678#if defined CONFIG_FB_SYS_FILLRECT || defined CONFIG_FB_SYS_FILLRECT_MODULE
679
680 sys_fillrect(info, rect); 654 sys_fillrect(info, rect);
681 655
682 dlfb_handle_damage(dev, rect->dx, rect->dy, rect->width, 656 dlfb_handle_damage(dev, rect->dx, rect->dy, rect->width,
683 rect->height, info->screen_base); 657 rect->height, info->screen_base);
684#endif
685
686} 658}
687 659
688#ifdef CONFIG_FB_DEFERRED_IO
689/* 660/*
690 * NOTE: fb_defio.c is holding info->fbdefio.mutex 661 * NOTE: fb_defio.c is holding info->fbdefio.mutex
691 * Touching ANY framebuffer memory that triggers a page fault 662 * Touching ANY framebuffer memory that triggers a page fault
@@ -747,8 +718,6 @@ error:
747 &dev->cpu_kcycles_used); 718 &dev->cpu_kcycles_used);
748} 719}
749 720
750#endif
751
752static int dlfb_get_edid(struct dlfb_data *dev, char *edid, int len) 721static int dlfb_get_edid(struct dlfb_data *dev, char *edid, int len)
753{ 722{
754 int i; 723 int i;
@@ -765,7 +734,7 @@ static int dlfb_get_edid(struct dlfb_data *dev, char *edid, int len)
765 (0x80 | (0x02 << 5)), i << 8, 0xA1, rbuf, 2, 734 (0x80 | (0x02 << 5)), i << 8, 0xA1, rbuf, 2,
766 HZ); 735 HZ);
767 if (ret < 1) { 736 if (ret < 1) {
768 dl_err("Read EDID byte %d failed err %x\n", i, ret); 737 pr_err("Read EDID byte %d failed err %x\n", i, ret);
769 i--; 738 i--;
770 break; 739 break;
771 } 740 }
@@ -881,7 +850,6 @@ static int dlfb_ops_open(struct fb_info *info, int user)
881 850
882 kref_get(&dev->kref); 851 kref_get(&dev->kref);
883 852
884#ifdef CONFIG_FB_DEFERRED_IO
885 if (fb_defio && (info->fbdefio == NULL)) { 853 if (fb_defio && (info->fbdefio == NULL)) {
886 /* enable defio at last moment if not disabled by client */ 854 /* enable defio at last moment if not disabled by client */
887 855
@@ -897,9 +865,8 @@ static int dlfb_ops_open(struct fb_info *info, int user)
897 info->fbdefio = fbdefio; 865 info->fbdefio = fbdefio;
898 fb_deferred_io_init(info); 866 fb_deferred_io_init(info);
899 } 867 }
900#endif
901 868
902 dl_notice("open /dev/fb%d user=%d fb_info=%p count=%d\n", 869 pr_notice("open /dev/fb%d user=%d fb_info=%p count=%d\n",
903 info->node, user, info, dev->fb_count); 870 info->node, user, info, dev->fb_count);
904 871
905 return 0; 872 return 0;
@@ -923,7 +890,7 @@ static void dlfb_free(struct kref *kref)
923 890
924 kfree(dev->edid); 891 kfree(dev->edid);
925 892
926 dl_warn("freeing dlfb_data %p\n", dev); 893 pr_warn("freeing dlfb_data %p\n", dev);
927 894
928 kfree(dev); 895 kfree(dev);
929} 896}
@@ -959,7 +926,7 @@ static void dlfb_free_framebuffer_work(struct work_struct *work)
959 /* Assume info structure is freed after this point */ 926 /* Assume info structure is freed after this point */
960 framebuffer_release(info); 927 framebuffer_release(info);
961 928
962 dl_warn("fb_info for /dev/fb%d has been freed\n", node); 929 pr_warn("fb_info for /dev/fb%d has been freed\n", node);
963 930
964 /* ref taken in probe() as part of registering framebfufer */ 931 /* ref taken in probe() as part of registering framebfufer */
965 kref_put(&dev->kref, dlfb_free); 932 kref_put(&dev->kref, dlfb_free);
@@ -978,16 +945,14 @@ static int dlfb_ops_release(struct fb_info *info, int user)
978 if (dev->virtualized && (dev->fb_count == 0)) 945 if (dev->virtualized && (dev->fb_count == 0))
979 schedule_delayed_work(&dev->free_framebuffer_work, HZ); 946 schedule_delayed_work(&dev->free_framebuffer_work, HZ);
980 947
981#ifdef CONFIG_FB_DEFERRED_IO
982 if ((dev->fb_count == 0) && (info->fbdefio)) { 948 if ((dev->fb_count == 0) && (info->fbdefio)) {
983 fb_deferred_io_cleanup(info); 949 fb_deferred_io_cleanup(info);
984 kfree(info->fbdefio); 950 kfree(info->fbdefio);
985 info->fbdefio = NULL; 951 info->fbdefio = NULL;
986 info->fbops->fb_mmap = dlfb_ops_mmap; 952 info->fbops->fb_mmap = dlfb_ops_mmap;
987 } 953 }
988#endif
989 954
990 dl_warn("released /dev/fb%d user=%d count=%d\n", 955 pr_warn("released /dev/fb%d user=%d count=%d\n",
991 info->node, user, dev->fb_count); 956 info->node, user, dev->fb_count);
992 957
993 kref_put(&dev->kref, dlfb_free); 958 kref_put(&dev->kref, dlfb_free);
@@ -1005,12 +970,12 @@ static int dlfb_is_valid_mode(struct fb_videomode *mode,
1005 struct dlfb_data *dev = info->par; 970 struct dlfb_data *dev = info->par;
1006 971
1007 if (mode->xres * mode->yres > dev->sku_pixel_limit) { 972 if (mode->xres * mode->yres > dev->sku_pixel_limit) {
1008 dl_warn("%dx%d beyond chip capabilities\n", 973 pr_warn("%dx%d beyond chip capabilities\n",
1009 mode->xres, mode->yres); 974 mode->xres, mode->yres);
1010 return 0; 975 return 0;
1011 } 976 }
1012 977
1013 dl_info("%dx%d valid mode\n", mode->xres, mode->yres); 978 pr_info("%dx%d valid mode\n", mode->xres, mode->yres);
1014 979
1015 return 1; 980 return 1;
1016} 981}
@@ -1054,7 +1019,7 @@ static int dlfb_ops_set_par(struct fb_info *info)
1054 u16 *pix_framebuffer; 1019 u16 *pix_framebuffer;
1055 int i; 1020 int i;
1056 1021
1057 dl_notice("set_par mode %dx%d\n", info->var.xres, info->var.yres); 1022 pr_notice("set_par mode %dx%d\n", info->var.xres, info->var.yres);
1058 1023
1059 result = dlfb_set_video_mode(dev, &info->var); 1024 result = dlfb_set_video_mode(dev, &info->var);
1060 1025
@@ -1104,7 +1069,7 @@ static int dlfb_ops_blank(int blank_mode, struct fb_info *info)
1104 1069
1105static struct fb_ops dlfb_ops = { 1070static struct fb_ops dlfb_ops = {
1106 .owner = THIS_MODULE, 1071 .owner = THIS_MODULE,
1107 .fb_read = dlfb_ops_read, 1072 .fb_read = fb_sys_read,
1108 .fb_write = dlfb_ops_write, 1073 .fb_write = dlfb_ops_write,
1109 .fb_setcolreg = dlfb_ops_setcolreg, 1074 .fb_setcolreg = dlfb_ops_setcolreg,
1110 .fb_fillrect = dlfb_ops_fillrect, 1075 .fb_fillrect = dlfb_ops_fillrect,
@@ -1133,7 +1098,7 @@ static int dlfb_realloc_framebuffer(struct dlfb_data *dev, struct fb_info *info)
1133 unsigned char *new_fb; 1098 unsigned char *new_fb;
1134 unsigned char *new_back; 1099 unsigned char *new_back;
1135 1100
1136 dl_warn("Reallocating framebuffer. Addresses will change!\n"); 1101 pr_warn("Reallocating framebuffer. Addresses will change!\n");
1137 1102
1138 new_len = info->fix.line_length * info->var.yres; 1103 new_len = info->fix.line_length * info->var.yres;
1139 1104
@@ -1143,7 +1108,7 @@ static int dlfb_realloc_framebuffer(struct dlfb_data *dev, struct fb_info *info)
1143 */ 1108 */
1144 new_fb = vmalloc(new_len); 1109 new_fb = vmalloc(new_len);
1145 if (!new_fb) { 1110 if (!new_fb) {
1146 dl_err("Virtual framebuffer alloc failed\n"); 1111 pr_err("Virtual framebuffer alloc failed\n");
1147 goto error; 1112 goto error;
1148 } 1113 }
1149 1114
@@ -1165,7 +1130,7 @@ static int dlfb_realloc_framebuffer(struct dlfb_data *dev, struct fb_info *info)
1165 */ 1130 */
1166 new_back = vmalloc(new_len); 1131 new_back = vmalloc(new_len);
1167 if (!new_back) 1132 if (!new_back)
1168 dl_info("No shadow/backing buffer allcoated\n"); 1133 pr_info("No shadow/backing buffer allcoated\n");
1169 else { 1134 else {
1170 if (dev->backing_buffer) 1135 if (dev->backing_buffer)
1171 vfree(dev->backing_buffer); 1136 vfree(dev->backing_buffer);
@@ -1207,7 +1172,7 @@ static int dlfb_setup_modes(struct dlfb_data *dev,
1207 if (info->dev) /* only use mutex if info has been registered */ 1172 if (info->dev) /* only use mutex if info has been registered */
1208 mutex_lock(&info->lock); 1173 mutex_lock(&info->lock);
1209 1174
1210 edid = kmalloc(MAX_EDID_SIZE, GFP_KERNEL); 1175 edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
1211 if (!edid) { 1176 if (!edid) {
1212 result = -ENOMEM; 1177 result = -ENOMEM;
1213 goto error; 1178 goto error;
@@ -1223,9 +1188,9 @@ static int dlfb_setup_modes(struct dlfb_data *dev,
1223 */ 1188 */
1224 while (tries--) { 1189 while (tries--) {
1225 1190
1226 i = dlfb_get_edid(dev, edid, MAX_EDID_SIZE); 1191 i = dlfb_get_edid(dev, edid, EDID_LENGTH);
1227 1192
1228 if (i >= MIN_EDID_SIZE) 1193 if (i >= EDID_LENGTH)
1229 fb_edid_to_monspecs(edid, &info->monspecs); 1194 fb_edid_to_monspecs(edid, &info->monspecs);
1230 1195
1231 if (info->monspecs.modedb_len > 0) { 1196 if (info->monspecs.modedb_len > 0) {
@@ -1238,24 +1203,24 @@ static int dlfb_setup_modes(struct dlfb_data *dev,
1238 /* If that fails, use a previously returned EDID if available */ 1203 /* If that fails, use a previously returned EDID if available */
1239 if (info->monspecs.modedb_len == 0) { 1204 if (info->monspecs.modedb_len == 0) {
1240 1205
1241 dl_err("Unable to get valid EDID from device/display\n"); 1206 pr_err("Unable to get valid EDID from device/display\n");
1242 1207
1243 if (dev->edid) { 1208 if (dev->edid) {
1244 fb_edid_to_monspecs(dev->edid, &info->monspecs); 1209 fb_edid_to_monspecs(dev->edid, &info->monspecs);
1245 if (info->monspecs.modedb_len > 0) 1210 if (info->monspecs.modedb_len > 0)
1246 dl_err("Using previously queried EDID\n"); 1211 pr_err("Using previously queried EDID\n");
1247 } 1212 }
1248 } 1213 }
1249 1214
1250 /* If that fails, use the default EDID we were handed */ 1215 /* If that fails, use the default EDID we were handed */
1251 if (info->monspecs.modedb_len == 0) { 1216 if (info->monspecs.modedb_len == 0) {
1252 if (default_edid_size >= MIN_EDID_SIZE) { 1217 if (default_edid_size >= EDID_LENGTH) {
1253 fb_edid_to_monspecs(default_edid, &info->monspecs); 1218 fb_edid_to_monspecs(default_edid, &info->monspecs);
1254 if (info->monspecs.modedb_len > 0) { 1219 if (info->monspecs.modedb_len > 0) {
1255 memcpy(edid, default_edid, default_edid_size); 1220 memcpy(edid, default_edid, default_edid_size);
1256 dev->edid = edid; 1221 dev->edid = edid;
1257 dev->edid_size = default_edid_size; 1222 dev->edid_size = default_edid_size;
1258 dl_err("Using default/backup EDID\n"); 1223 pr_err("Using default/backup EDID\n");
1259 } 1224 }
1260 } 1225 }
1261 } 1226 }
@@ -1381,7 +1346,7 @@ static ssize_t edid_show(
1381 if (off + count > dev->edid_size) 1346 if (off + count > dev->edid_size)
1382 count = dev->edid_size - off; 1347 count = dev->edid_size - off;
1383 1348
1384 dl_info("sysfs edid copy %p to %p, %d bytes\n", 1349 pr_info("sysfs edid copy %p to %p, %d bytes\n",
1385 dev->edid, buf, (int) count); 1350 dev->edid, buf, (int) count);
1386 1351
1387 memcpy(buf, dev->edid, count); 1352 memcpy(buf, dev->edid, count);
@@ -1398,15 +1363,13 @@ static ssize_t edid_store(
1398 struct dlfb_data *dev = fb_info->par; 1363 struct dlfb_data *dev = fb_info->par;
1399 1364
1400 /* We only support write of entire EDID at once, no offset*/ 1365 /* We only support write of entire EDID at once, no offset*/
1401 if ((src_size < MIN_EDID_SIZE) || 1366 if ((src_size != EDID_LENGTH) || (src_off != 0))
1402 (src_size > MAX_EDID_SIZE) ||
1403 (src_off != 0))
1404 return 0; 1367 return 0;
1405 1368
1406 dlfb_setup_modes(dev, fb_info, src, src_size); 1369 dlfb_setup_modes(dev, fb_info, src, src_size);
1407 1370
1408 if (dev->edid && (memcmp(src, dev->edid, src_size) == 0)) { 1371 if (dev->edid && (memcmp(src, dev->edid, src_size) == 0)) {
1409 dl_info("sysfs written EDID is new default\n"); 1372 pr_info("sysfs written EDID is new default\n");
1410 dlfb_ops_set_par(fb_info); 1373 dlfb_ops_set_par(fb_info);
1411 return src_size; 1374 return src_size;
1412 } else 1375 } else
@@ -1431,7 +1394,7 @@ static ssize_t metrics_reset_store(struct device *fbdev,
1431static struct bin_attribute edid_attr = { 1394static struct bin_attribute edid_attr = {
1432 .attr.name = "edid", 1395 .attr.name = "edid",
1433 .attr.mode = 0666, 1396 .attr.mode = 0666,
1434 .size = MAX_EDID_SIZE, 1397 .size = EDID_LENGTH,
1435 .read = edid_show, 1398 .read = edid_show,
1436 .write = edid_store 1399 .write = edid_store
1437}; 1400};
@@ -1479,7 +1442,7 @@ static int dlfb_parse_vendor_descriptor(struct dlfb_data *dev,
1479 total_len = usb_get_descriptor(usbdev, 0x5f, /* vendor specific */ 1442 total_len = usb_get_descriptor(usbdev, 0x5f, /* vendor specific */
1480 0, desc, MAX_VENDOR_DESCRIPTOR_SIZE); 1443 0, desc, MAX_VENDOR_DESCRIPTOR_SIZE);
1481 if (total_len > 5) { 1444 if (total_len > 5) {
1482 dl_info("vendor descriptor length:%x data:%02x %02x %02x %02x" \ 1445 pr_info("vendor descriptor length:%x data:%02x %02x %02x %02x" \
1483 "%02x %02x %02x %02x %02x %02x %02x\n", 1446 "%02x %02x %02x %02x %02x %02x %02x\n",
1484 total_len, desc[0], 1447 total_len, desc[0],
1485 desc[1], desc[2], desc[3], desc[4], desc[5], desc[6], 1448 desc[1], desc[2], desc[3], desc[4], desc[5], desc[6],
@@ -1508,7 +1471,7 @@ static int dlfb_parse_vendor_descriptor(struct dlfb_data *dev,
1508 case 0x0200: { /* max_area */ 1471 case 0x0200: { /* max_area */
1509 u32 max_area; 1472 u32 max_area;
1510 max_area = le32_to_cpu(*((u32 *)desc)); 1473 max_area = le32_to_cpu(*((u32 *)desc));
1511 dl_warn("DL chip limited to %d pixel modes\n", 1474 pr_warn("DL chip limited to %d pixel modes\n",
1512 max_area); 1475 max_area);
1513 dev->sku_pixel_limit = max_area; 1476 dev->sku_pixel_limit = max_area;
1514 break; 1477 break;
@@ -1524,7 +1487,7 @@ static int dlfb_parse_vendor_descriptor(struct dlfb_data *dev,
1524 1487
1525unrecognized: 1488unrecognized:
1526 /* allow udlfb to load for now even if firmware unrecognized */ 1489 /* allow udlfb to load for now even if firmware unrecognized */
1527 dl_err("Unrecognized vendor firmware descriptor\n"); 1490 pr_err("Unrecognized vendor firmware descriptor\n");
1528 1491
1529success: 1492success:
1530 kfree(buf); 1493 kfree(buf);
@@ -1557,24 +1520,24 @@ static int dlfb_usb_probe(struct usb_interface *interface,
1557 dev->gdev = &usbdev->dev; /* our generic struct device * */ 1520 dev->gdev = &usbdev->dev; /* our generic struct device * */
1558 usb_set_intfdata(interface, dev); 1521 usb_set_intfdata(interface, dev);
1559 1522
1560 dl_info("%s %s - serial #%s\n", 1523 pr_info("%s %s - serial #%s\n",
1561 usbdev->manufacturer, usbdev->product, usbdev->serial); 1524 usbdev->manufacturer, usbdev->product, usbdev->serial);
1562 dl_info("vid_%04x&pid_%04x&rev_%04x driver's dlfb_data struct at %p\n", 1525 pr_info("vid_%04x&pid_%04x&rev_%04x driver's dlfb_data struct at %p\n",
1563 usbdev->descriptor.idVendor, usbdev->descriptor.idProduct, 1526 usbdev->descriptor.idVendor, usbdev->descriptor.idProduct,
1564 usbdev->descriptor.bcdDevice, dev); 1527 usbdev->descriptor.bcdDevice, dev);
1565 dl_info("console enable=%d\n", console); 1528 pr_info("console enable=%d\n", console);
1566 dl_info("fb_defio enable=%d\n", fb_defio); 1529 pr_info("fb_defio enable=%d\n", fb_defio);
1567 1530
1568 dev->sku_pixel_limit = 2048 * 1152; /* default to maximum */ 1531 dev->sku_pixel_limit = 2048 * 1152; /* default to maximum */
1569 1532
1570 if (!dlfb_parse_vendor_descriptor(dev, usbdev)) { 1533 if (!dlfb_parse_vendor_descriptor(dev, usbdev)) {
1571 dl_err("firmware not recognized. Assume incompatible device\n"); 1534 pr_err("firmware not recognized. Assume incompatible device\n");
1572 goto error; 1535 goto error;
1573 } 1536 }
1574 1537
1575 if (!dlfb_alloc_urb_list(dev, WRITES_IN_FLIGHT, MAX_TRANSFER)) { 1538 if (!dlfb_alloc_urb_list(dev, WRITES_IN_FLIGHT, MAX_TRANSFER)) {
1576 retval = -ENOMEM; 1539 retval = -ENOMEM;
1577 dl_err("dlfb_alloc_urb_list failed\n"); 1540 pr_err("dlfb_alloc_urb_list failed\n");
1578 goto error; 1541 goto error;
1579 } 1542 }
1580 1543
@@ -1584,7 +1547,7 @@ static int dlfb_usb_probe(struct usb_interface *interface,
1584 info = framebuffer_alloc(0, &usbdev->dev); 1547 info = framebuffer_alloc(0, &usbdev->dev);
1585 if (!info) { 1548 if (!info) {
1586 retval = -ENOMEM; 1549 retval = -ENOMEM;
1587 dl_err("framebuffer_alloc failed\n"); 1550 pr_err("framebuffer_alloc failed\n");
1588 goto error; 1551 goto error;
1589 } 1552 }
1590 1553
@@ -1595,7 +1558,7 @@ static int dlfb_usb_probe(struct usb_interface *interface,
1595 1558
1596 retval = fb_alloc_cmap(&info->cmap, 256, 0); 1559 retval = fb_alloc_cmap(&info->cmap, 256, 0);
1597 if (retval < 0) { 1560 if (retval < 0) {
1598 dl_err("fb_alloc_cmap failed %x\n", retval); 1561 pr_err("fb_alloc_cmap failed %x\n", retval);
1599 goto error; 1562 goto error;
1600 } 1563 }
1601 1564
@@ -1606,7 +1569,7 @@ static int dlfb_usb_probe(struct usb_interface *interface,
1606 1569
1607 retval = dlfb_setup_modes(dev, info, NULL, 0); 1570 retval = dlfb_setup_modes(dev, info, NULL, 0);
1608 if (retval != 0) { 1571 if (retval != 0) {
1609 dl_err("unable to find common mode for display and adapter\n"); 1572 pr_err("unable to find common mode for display and adapter\n");
1610 goto error; 1573 goto error;
1611 } 1574 }
1612 1575
@@ -1620,7 +1583,7 @@ static int dlfb_usb_probe(struct usb_interface *interface,
1620 1583
1621 retval = register_framebuffer(info); 1584 retval = register_framebuffer(info);
1622 if (retval < 0) { 1585 if (retval < 0) {
1623 dl_err("register_framebuffer failed %d\n", retval); 1586 pr_err("register_framebuffer failed %d\n", retval);
1624 goto error; 1587 goto error;
1625 } 1588 }
1626 1589
@@ -1629,7 +1592,7 @@ static int dlfb_usb_probe(struct usb_interface *interface,
1629 1592
1630 device_create_bin_file(info->dev, &edid_attr); 1593 device_create_bin_file(info->dev, &edid_attr);
1631 1594
1632 dl_info("DisplayLink USB device /dev/fb%d attached. %dx%d resolution." 1595 pr_info("DisplayLink USB device /dev/fb%d attached. %dx%d resolution."
1633 " Using %dK framebuffer memory\n", info->node, 1596 " Using %dK framebuffer memory\n", info->node,
1634 info->var.xres, info->var.yres, 1597 info->var.xres, info->var.yres,
1635 ((dev->backing_buffer) ? 1598 ((dev->backing_buffer) ?
@@ -1673,7 +1636,7 @@ static void dlfb_usb_disconnect(struct usb_interface *interface)
1673 dev = usb_get_intfdata(interface); 1636 dev = usb_get_intfdata(interface);
1674 info = dev->info; 1637 info = dev->info;
1675 1638
1676 dl_info("USB disconnect starting\n"); 1639 pr_info("USB disconnect starting\n");
1677 1640
1678 /* we virtualize until all fb clients release. Then we free */ 1641 /* we virtualize until all fb clients release. Then we free */
1679 dev->virtualized = true; 1642 dev->virtualized = true;
@@ -1737,7 +1700,7 @@ static void dlfb_urb_completion(struct urb *urb)
1737 if (!(urb->status == -ENOENT || 1700 if (!(urb->status == -ENOENT ||
1738 urb->status == -ECONNRESET || 1701 urb->status == -ECONNRESET ||
1739 urb->status == -ESHUTDOWN)) { 1702 urb->status == -ESHUTDOWN)) {
1740 dl_err("%s - nonzero write bulk status received: %d\n", 1703 pr_err("%s - nonzero write bulk status received: %d\n",
1741 __func__, urb->status); 1704 __func__, urb->status);
1742 atomic_set(&dev->lost_pixels, 1); 1705 atomic_set(&dev->lost_pixels, 1);
1743 } 1706 }
@@ -1769,7 +1732,7 @@ static void dlfb_free_urb_list(struct dlfb_data *dev)
1769 int ret; 1732 int ret;
1770 unsigned long flags; 1733 unsigned long flags;
1771 1734
1772 dl_notice("Waiting for completes and freeing all render urbs\n"); 1735 pr_notice("Waiting for completes and freeing all render urbs\n");
1773 1736
1774 /* keep waiting and freeing, until we've got 'em all */ 1737 /* keep waiting and freeing, until we've got 'em all */
1775 while (count--) { 1738 while (count--) {
@@ -1848,7 +1811,7 @@ static int dlfb_alloc_urb_list(struct dlfb_data *dev, int count, size_t size)
1848 dev->urbs.count = i; 1811 dev->urbs.count = i;
1849 dev->urbs.available = i; 1812 dev->urbs.available = i;
1850 1813
1851 dl_notice("allocated %d %d byte urbs\n", i, (int) size); 1814 pr_notice("allocated %d %d byte urbs\n", i, (int) size);
1852 1815
1853 return i; 1816 return i;
1854} 1817}
@@ -1865,7 +1828,7 @@ static struct urb *dlfb_get_urb(struct dlfb_data *dev)
1865 ret = down_timeout(&dev->urbs.limit_sem, GET_URB_TIMEOUT); 1828 ret = down_timeout(&dev->urbs.limit_sem, GET_URB_TIMEOUT);
1866 if (ret) { 1829 if (ret) {
1867 atomic_set(&dev->lost_pixels, 1); 1830 atomic_set(&dev->lost_pixels, 1);
1868 dl_warn("wait for urb interrupted: %x available: %d\n", 1831 pr_warn("wait for urb interrupted: %x available: %d\n",
1869 ret, dev->urbs.available); 1832 ret, dev->urbs.available);
1870 goto error; 1833 goto error;
1871 } 1834 }
@@ -1897,7 +1860,7 @@ static int dlfb_submit_urb(struct dlfb_data *dev, struct urb *urb, size_t len)
1897 if (ret) { 1860 if (ret) {
1898 dlfb_urb_completion(urb); /* because no one else will */ 1861 dlfb_urb_completion(urb); /* because no one else will */
1899 atomic_set(&dev->lost_pixels, 1); 1862 atomic_set(&dev->lost_pixels, 1);
1900 dl_err("usb_submit_urb error %x\n", ret); 1863 pr_err("usb_submit_urb error %x\n", ret);
1901 } 1864 }
1902 return ret; 1865 return ret;
1903} 1866}
diff --git a/drivers/staging/udlfb/udlfb.h b/include/video/udlfb.h
index 6f9785e9d62e..69d485a4a026 100644
--- a/drivers/staging/udlfb/udlfb.h
+++ b/include/video/udlfb.h
@@ -65,9 +65,6 @@ struct dlfb_data {
65#define MAX_TRANSFER (PAGE_SIZE*16 - BULK_SIZE) 65#define MAX_TRANSFER (PAGE_SIZE*16 - BULK_SIZE)
66#define WRITES_IN_FLIGHT (4) 66#define WRITES_IN_FLIGHT (4)
67 67
68#define MIN_EDID_SIZE 128
69#define MAX_EDID_SIZE 128
70
71#define MAX_VENDOR_DESCRIPTOR_SIZE 256 68#define MAX_VENDOR_DESCRIPTOR_SIZE 256
72 69
73#define GET_URB_TIMEOUT HZ 70#define GET_URB_TIMEOUT HZ
@@ -95,23 +92,4 @@ struct dlfb_data {
95#define DL_ALIGN_UP(x, a) ALIGN(x, a) 92#define DL_ALIGN_UP(x, a) ALIGN(x, a)
96#define DL_ALIGN_DOWN(x, a) ALIGN(x-(a-1), a) 93#define DL_ALIGN_DOWN(x, a) ALIGN(x-(a-1), a)
97 94
98/* remove once this gets added to sysfs.h */
99#define __ATTR_RW(attr) __ATTR(attr, 0644, attr##_show, attr##_store)
100
101/*
102 * udlfb is both a usb device, and a framebuffer device.
103 * They may exist at the same time, but during various stages
104 * inactivity, teardown, or "virtual" operation, only one or the
105 * other will exist (one will outlive the other). So we can't
106 * call the dev_*() macros, because we don't have a stable dev object.
107 */
108#define dl_err(format, arg...) \
109 pr_err("udlfb: " format, ## arg)
110#define dl_warn(format, arg...) \
111 pr_warning("udlfb: " format, ## arg)
112#define dl_notice(format, arg...) \
113 pr_notice("udlfb: " format, ## arg)
114#define dl_info(format, arg...) \
115 pr_info("udlfb: " format, ## arg)
116
117#endif 95#endif