staging: udlfb: enhance EDID and mode handling support

Enhance EDID and mode table handling

* Adds support for lower-end DL chips on higher-end monitors
* Adds support for using fbdev standard EDID parsing and handling
* Adds support for more dynamic reallocation of framebuffer, based on new EDID

Queries EDID from hardware with several retries then
queries DisplayLink chip for max pixel area via vendor descriptor.
Uses existing fbdev mode handling service funcations to build mode list
of common modes between adapter and monitor.
This enables lower-end chips (e.g. DL-125) to successfully pick a compatible
mode on higher end monitors (e.g. whose default mode is over 1280x1024).
Reallocate framebuffer if necessary in response to new max mode.

Signed-off-by: Bernie Thompson <bernie@plugable.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
diff --git a/drivers/staging/udlfb/udlfb.h b/drivers/staging/udlfb/udlfb.h
index 7c46477..d28e783 100644
--- a/drivers/staging/udlfb/udlfb.h
+++ b/drivers/staging/udlfb/udlfb.h
@@ -44,7 +44,8 @@
 	atomic_t usb_active; /* 0 = update virtual buffer, but no usb traffic */
 	atomic_t lost_pixels; /* 1 = a render op failed. Need screen refresh */
 	atomic_t use_defio; /* 0 = rely on ioctls and blit/copy/fill rects */
-	char edid[128];
+	char *edid; /* null until we read edid from hw or get from sysfs */
+	size_t edid_size;
 	int sku_pixel_limit;
 	int base16;
 	int base8;
@@ -64,6 +65,11 @@
 #define MAX_TRANSFER (PAGE_SIZE*16 - BULK_SIZE)
 #define WRITES_IN_FLIGHT (4)
 
+#define MIN_EDID_SIZE 128
+#define MAX_EDID_SIZE 128
+
+#define MAX_VENDOR_DESCRIPTOR_SIZE 256
+
 #define GET_URB_TIMEOUT	HZ
 #define FREE_URB_TIMEOUT (HZ*2)