summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMats O Jansson <maja@cvs.openbsd.org>2009-10-10 08:59:19 +0000
committerMats O Jansson <maja@cvs.openbsd.org>2009-10-10 08:59:19 +0000
commit13837208b353da1fe2a2a8c8423937b4262ea09d (patch)
tree8b055a2b5f1b4814a75c48e6de9b79c91c592635
parent43f7b8ac4ce917215ef14cfee8b9eaad1278bac7 (diff)
Let udl select the maximum resolution supported by the udl device and the
monitor. Use the EDID parsing from videomode. -moj ok mglocker@
-rw-r--r--sys/dev/usb/files.usb4
-rw-r--r--sys/dev/usb/udl.c274
-rw-r--r--sys/dev/usb/udl.h148
3 files changed, 388 insertions, 38 deletions
diff --git a/sys/dev/usb/files.usb b/sys/dev/usb/files.usb
index 8cfbe15ba49..27a3099e128 100644
--- a/sys/dev/usb/files.usb
+++ b/sys/dev/usb/files.usb
@@ -1,4 +1,4 @@
-# $OpenBSD: files.usb,v 1.83 2009/05/09 19:23:07 mglocker Exp $
+# $OpenBSD: files.usb,v 1.84 2009/10/10 08:59:18 maja Exp $
# $NetBSD: files.usb,v 1.16 2000/02/14 20:29:54 augustss Exp $
#
# Config file and device description for machine-independent USB code.
@@ -39,7 +39,7 @@ device uvideo: video, firmload
attach uvideo at uhub
file dev/usb/uvideo.c uvideo
-device udl: wsemuldisplaydev, rasops16
+device udl: wsemuldisplaydev, rasops16, edid
attach udl at uhub
file dev/usb/udl.c udl
diff --git a/sys/dev/usb/udl.c b/sys/dev/usb/udl.c
index f875cce7cd0..34a728059e5 100644
--- a/sys/dev/usb/udl.c
+++ b/sys/dev/usb/udl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udl.c,v 1.52 2009/09/27 18:17:45 mglocker Exp $ */
+/* $OpenBSD: udl.c,v 1.53 2009/10/10 08:59:18 maja Exp $ */
/*
* Copyright (c) 2009 Marcus Glocker <mglocker@openbsd.org>
@@ -46,6 +46,9 @@
#include <dev/wscons/wsdisplayvar.h>
#include <dev/rasops/rasops.h>
+#include <dev/videomode/videomode.h>
+#include <dev/videomode/edidvar.h>
+
#include <dev/usb/udl.h>
#include <dev/usb/udlio.h>
@@ -102,6 +105,9 @@ usbd_status udl_poll(struct udl_softc *, uint32_t *);
usbd_status udl_read_1(struct udl_softc *, uint16_t, uint8_t *);
usbd_status udl_write_1(struct udl_softc *, uint16_t, uint8_t);
usbd_status udl_read_edid(struct udl_softc *, uint8_t *);
+uint8_t udl_lookup_mode(uint16_t, uint16_t, uint8_t, uint16_t,
+ uint32_t);
+int udl_select_chip(struct udl_softc *);
usbd_status udl_set_enc_key(struct udl_softc *, uint8_t *, uint8_t);
usbd_status udl_set_decomp_table(struct udl_softc *, uint8_t *, uint16_t);
@@ -135,8 +141,9 @@ void udl_cmd_send_async_cb(usbd_xfer_handle, usbd_private_handle,
usbd_status udl_init_chip(struct udl_softc *);
void udl_init_fb_offsets(struct udl_softc *, uint32_t, uint32_t,
uint32_t, uint32_t);
-usbd_status udl_init_resolution(struct udl_softc *, uint8_t *, uint8_t);
+usbd_status udl_init_resolution(struct udl_softc *);
usbd_status udl_clear_screen(struct udl_softc *);
+void udl_select_mode(struct udl_softc *);
int udl_fb_buf_write(struct udl_softc *, uint8_t *, uint32_t,
uint32_t, uint16_t);
int udl_fb_block_write(struct udl_softc *, uint16_t, uint32_t,
@@ -219,21 +226,27 @@ struct wsdisplay_accessops udl_accessops = {
/*
* Matching devices.
*/
-static const struct usb_devno udl_devs[] = {
- { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_LCD4300U },
- { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_LCD8000U },
- { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_LD220 },
- { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_VCUD60 },
- { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_DLDVI },
- { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_VGA10 },
- { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_WSDVI },
- { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_EC008 },
- { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_HPDOCK },
- { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_M01061 },
- { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_SWDVI },
- { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_UM7X0 }
+struct udl_type {
+ struct usb_devno udl_dev;
+ u_int16_t udl_chip;
};
+static const struct udl_type udl_devs[] = {
+ {{ USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_LCD4300U }, DL120 },
+ {{ USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_LCD8000U }, DL120 },
+ {{ USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_LD220 }, DL165 },
+ {{ USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_VCUD60 }, DL160 },
+ {{ USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_DLDVI }, DL160 },
+ {{ USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_VGA10 }, DL120 },
+ {{ USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_WSDVI }, DLUNK },
+ {{ USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_EC008 }, DL160 },
+ {{ USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_HPDOCK }, DL160 },
+ {{ USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_M01061 }, DL195 },
+ {{ USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_SWDVI }, DL160 },
+ {{ USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_UM7X0 }, DL120 }
+};
+#define udl_lookup(v, p) ((struct udl_type *)usb_lookup(udl_devs, v, p))
+
int
udl_match(struct device *parent, void *match, void *aux)
{
@@ -242,7 +255,7 @@ udl_match(struct device *parent, void *match, void *aux)
if (uaa->iface != NULL)
return (UMATCH_NONE);
- if (usb_lookup(udl_devs, uaa->vendor, uaa->product) != NULL)
+ if (udl_lookup(uaa->vendor, uaa->product) != NULL)
return (UMATCH_VENDOR_PRODUCT);
return (UMATCH_NONE);
@@ -258,6 +271,33 @@ udl_attach(struct device *parent, struct device *self, void *aux)
int err;
sc->sc_udev = uaa->device;
+ sc->sc_chip = udl_lookup(uaa->vendor, uaa->product)->udl_chip;
+ sc->sc_width = 0;
+ sc->sc_height = 0;
+ sc->sc_depth = 16;
+ sc->sc_cur_mode = MAX_DL_MODES;
+
+ /*
+ * Override chip if requested.
+ */
+ if ((sc->sc_dev.dv_cfdata->cf_flags & 0xff00) > 0) {
+ uint16_t i;
+
+ i = ((sc->sc_dev.dv_cfdata->cf_flags & 0xff00) >> 8) - 1;
+ if (i <= DLMAX) {
+ sc->sc_chip = i;
+ printf("%s: %s: cf_flags (0x%04x) forced chip to %d\n",
+ DN(sc), FUNC,
+ sc->sc_dev.dv_cfdata->cf_flags, i);
+ }
+ }
+
+ /*
+ * The product might have more than one chip
+ */
+ if (sc->sc_chip == DLUNK)
+ if (udl_select_chip(sc))
+ return;
/*
* Set device configuration descriptor number.
@@ -308,14 +348,29 @@ udl_attach(struct device *parent, struct device *self, void *aux)
return;
/*
- * Initialize resolution.
+ * Select edid mode.
*/
- sc->sc_width = 800; /* XXX shouldn't we do this somewhere else? */
- sc->sc_height = 600;
- sc->sc_depth = 16;
+ udl_select_mode(sc);
- error = udl_init_resolution(sc, udl_reg_vals_800,
- sizeof(udl_reg_vals_800));
+ /*
+ * Override mode if requested.
+ */
+ if ((sc->sc_dev.dv_cfdata->cf_flags & 0xff) > 0) {
+ uint8_t i = (sc->sc_dev.dv_cfdata->cf_flags & 0xff) - 1;
+
+ if (i < MAX_DL_MODES) {
+ if (udl_modes[i].chip <= sc->sc_chip) {
+ sc->sc_width = udl_modes[i].hdisplay;
+ sc->sc_height = udl_modes[i].vdisplay;
+ printf("%s: %s: cf_flags (0x%04x) forced mode to %d\n",
+ DN(sc), FUNC,
+ sc->sc_dev.dv_cfdata->cf_flags, i);
+ sc->sc_cur_mode = i;
+ }
+ }
+ }
+
+ error = udl_init_resolution(sc);
if (error != USBD_NORMAL_COMPLETION)
return;
@@ -573,7 +628,7 @@ udl_alloc_screen(void *v, const struct wsscreen_descr *type,
sc->sc_ri.ri_bpos = 0;
}
- rasops_init(&sc->sc_ri, 100, 100);
+ rasops_init(&sc->sc_ri, 100, 200);
sc->sc_ri.ri_ops.copycols = udl_copycols;
sc->sc_ri.ri_ops.copyrows = udl_copyrows;
@@ -612,6 +667,8 @@ udl_free_screen(void *v, void *cookie)
sc = v;
DPRINTF(1, "%s: %s\n", DN(sc), FUNC);
+
+ sc->sc_nscreens--;
}
int
@@ -1145,6 +1202,86 @@ fail:
return (error);
}
+uint8_t
+udl_lookup_mode(uint16_t hdisplay, uint16_t vdisplay, uint8_t hz,
+ uint16_t chip, uint32_t clock)
+{
+ uint8_t idx = 0;
+
+ /*
+ * Check first if we have a matching mode with pixelclock
+ */
+ while (idx < MAX_DL_MODES) {
+ if ((udl_modes[idx].hdisplay == hdisplay) &&
+ (udl_modes[idx].vdisplay == vdisplay) &&
+ (udl_modes[idx].clock == clock) &&
+ (udl_modes[idx].chip <= chip)) {
+ return(idx);
+ }
+ idx++;
+ }
+
+ /*
+ * If not, check for matching mode with update frequency
+ */
+ idx = 0;
+ while (idx < MAX_DL_MODES) {
+ if ((udl_modes[idx].hdisplay == hdisplay) &&
+ (udl_modes[idx].vdisplay == vdisplay) &&
+ (udl_modes[idx].hz == hz) &&
+ (udl_modes[idx].chip <= chip)) {
+ return(idx);
+ }
+ idx++;
+ }
+ return(idx);
+}
+
+int
+udl_select_chip(struct udl_softc *sc)
+{
+ char serialnum[USB_MAX_STRING_LEN];
+ usb_device_descriptor_t *dd;
+ usb_string_descriptor_t us;
+ usbd_status error;
+ int len, i, n;
+ char *s;
+ u_int16_t c;
+
+ sc->sc_chip = DL120;
+
+ dd = usbd_get_device_descriptor(sc->sc_udev);
+
+ bzero(serialnum, sizeof serialnum);
+ error = usbd_get_string_desc(sc->sc_udev, dd->iSerialNumber,
+ 0, &us, &len);
+ if (error != USBD_NORMAL_COMPLETION)
+ return (1);
+
+ s = &serialnum[0];
+ n = len / 2 - 1;
+ for (i = 0; i < n && i < USB_MAX_STRING_LEN; i++) {
+ c = UGETW(us.bString[i]);
+ /* Convert from Unicode, handle buggy strings. */
+ if ((c & 0xff00) == 0)
+ *s++ = c;
+ else if ((c & 0x00ff) == 0)
+ *s++ = c >> 8;
+ else
+ *s++ = '?';
+ }
+ *s++ = 0;
+
+ if (strlen(serialnum) > 7)
+ if (strncmp(serialnum, "0198-13", 7) == 0)
+ sc->sc_chip = DL160;
+
+ DPRINTF(1, "%s: %s: iSerialNumber (%s) used to select chip (%d)\n",
+ DN(sc), FUNC, serialnum, sc->sc_chip);
+
+ return (0);
+}
+
usbd_status
udl_set_enc_key(struct udl_softc *sc, uint8_t *buf, uint8_t len)
{
@@ -1684,7 +1821,6 @@ udl_init_chip(struct udl_softc *sc)
{
uint8_t ui8;
uint32_t ui32;
- int8_t edid[128];
usbd_status error;
error = udl_poll(sc, &ui32);
@@ -1702,13 +1838,11 @@ udl_init_chip(struct udl_softc *sc)
return (error);
DPRINTF(1, "%s: %s: write 0x01 to 0xc41f\n", DN(sc), FUNC);
- error = udl_read_edid(sc, edid);
+ error = udl_read_edid(sc, sc->sc_edid);
if (error != USBD_NORMAL_COMPLETION)
return (error);
- DPRINTF(1, "%s: %s: read EDID=\n", DN(sc), FUNC);
-#ifdef UDL_DEBUG
- udl_hexdump(edid, sizeof(edid), 0);
-#endif
+ DPRINTF(1, "%s: %s: read EDID\n", DN(sc), FUNC);
+
error = udl_set_enc_key(sc, udl_null_key_1, sizeof(udl_null_key_1));
if (error != USBD_NORMAL_COMPLETION)
return (error);
@@ -1741,14 +1875,15 @@ udl_init_fb_offsets(struct udl_softc *sc, uint32_t start16, uint32_t stride16,
}
usbd_status
-udl_init_resolution(struct udl_softc *sc, uint8_t *buf, uint8_t len)
+udl_init_resolution(struct udl_softc *sc)
{
int i;
usbd_status error;
+ uint8_t *buf = udl_modes[sc->sc_cur_mode].mode;
/* write resolution values and set video memory offsets */
udl_cmd_write_reg_1(sc, UDL_REG_SYNC, 0x00);
- for (i = 0; i < len; i++)
+ for (i = 0; i < UDL_MODE_SIZE; i++)
udl_cmd_write_reg_1(sc, i, buf[i]);
udl_cmd_write_reg_1(sc, UDL_REG_SYNC, 0xff);
@@ -1790,6 +1925,83 @@ udl_clear_screen(struct udl_softc *sc)
return (USBD_NORMAL_COMPLETION);
}
+void
+udl_select_mode(struct udl_softc *sc)
+{
+ struct udl_mode mode;
+ int index = MAX_DL_MODES, i;
+
+ /* try to get the preferred mode from EDID */
+ edid_parse(sc->sc_edid, &sc->sc_edid_info);
+#ifdef UDL_DEBUG
+ edid_print(&sc->sc_edid_info);
+#endif
+
+ if (sc->sc_edid_info.edid_preferred_mode != NULL) {
+ mode.hz =
+ (sc->sc_edid_info.edid_preferred_mode->dot_clock * 1000) /
+ (sc->sc_edid_info.edid_preferred_mode->htotal*
+ sc->sc_edid_info.edid_preferred_mode->vtotal);
+ mode.clock =
+ sc->sc_edid_info.edid_preferred_mode->dot_clock/10;
+ mode.hdisplay =
+ sc->sc_edid_info.edid_preferred_mode->hdisplay;
+ mode.vdisplay =
+ sc->sc_edid_info.edid_preferred_mode->vdisplay;
+ index = udl_lookup_mode(mode.hdisplay, mode.vdisplay, mode.hz,
+ sc->sc_chip, mode.clock);
+ sc->sc_cur_mode = index;
+ } else {
+ DPRINTF(1, "%s: %s: no preferred mode found!\n", DN(sc), FUNC);
+ }
+
+ if (index == MAX_DL_MODES) {
+
+ DPRINTF(1, "%s: %s: no mode line found for %dx%d @ %dHz!\n",
+ DN(sc), FUNC, mode.hdisplay, mode.vdisplay, mode.hz);
+
+ i = 0;
+ while (i < sc->sc_edid_info.edid_nmodes) {
+ mode.hz =
+ (sc->sc_edid_info.edid_modes[i].dot_clock * 1000) /
+ (sc->sc_edid_info.edid_modes[i].htotal*
+ sc->sc_edid_info.edid_modes[i].vtotal);
+ mode.clock =
+ sc->sc_edid_info.edid_modes[i].dot_clock/10;
+ mode.hdisplay =
+ sc->sc_edid_info.edid_modes[i].hdisplay;
+ mode.vdisplay =
+ sc->sc_edid_info.edid_modes[i].vdisplay;
+ index = udl_lookup_mode(mode.hdisplay, mode.vdisplay,
+ mode.hz, sc->sc_chip, mode.clock);
+ if (index < MAX_DL_MODES)
+ if ((sc->sc_cur_mode == MAX_DL_MODES) ||
+ (index > sc->sc_cur_mode))
+ sc->sc_cur_mode = index;
+ i++;
+ }
+ }
+
+ /*
+ * If no mode found. Use default.
+ */
+ if (sc->sc_cur_mode == MAX_DL_MODES) {
+ sc->sc_cur_mode = udl_lookup_mode(800, 600, 60, sc->sc_chip, 0);
+ }
+
+ mode = udl_modes[sc->sc_cur_mode];
+ sc->sc_width = mode.hdisplay;
+ sc->sc_height = mode.vdisplay;
+
+ /*
+ * we always use 16bit color depth for now
+ */
+ sc->sc_depth = 16;
+
+ DPRINTF(1, "%s: %s: %dx%d @ %dHz\n",
+ DN(sc), FUNC, mode.hdisplay, mode.vdisplay, mode.hz);
+}
+
int
udl_fb_buf_write(struct udl_softc *sc, uint8_t *buf, uint32_t x,
uint32_t y, uint16_t width)
diff --git a/sys/dev/usb/udl.h b/sys/dev/usb/udl.h
index c67d5980a40..abb89d3a148 100644
--- a/sys/dev/usb/udl.h
+++ b/sys/dev/usb/udl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: udl.h,v 1.13 2009/09/21 07:41:18 mglocker Exp $ */
+/* $OpenBSD: udl.h,v 1.14 2009/10/10 08:59:18 maja Exp $ */
/*
* Copyright (c) 2009 Marcus Glocker <mglocker@openbsd.org>
@@ -61,6 +61,8 @@ struct udl_softc {
uint8_t sc_nscreens;
int sc_mode;
+ uint8_t sc_edid[128];
+ struct edid_info sc_edid_info;
#define UDL_CMD_XFER_COUNT 8
int sc_cmd_xfer_cnt;
@@ -73,6 +75,16 @@ struct udl_softc {
uint8_t sc_depth;
uint8_t sc_cursor_on;
uint8_t *sc_fbmem; /* framebuffer for X11 */
+ uint16_t sc_chip;
+#define DLALL 0x0000
+#define DL125 0x0000 /* max 1280x1024, 1440x900 */
+#define DL120 0x0001 /* max 1280x1024, 1440x1050 */
+#define DL160 0x0002 /* max 1600x1200, 1680x1050 */
+#define DL165 0x0003 /* max 1600x1200, 1920x1080 */
+#define DL195 0x0004 /* max 1920x1200, 2048x1152 */
+#define DLMAX 0x0004
+#define DLUNK 0x00ff /* unknown */
+ uint8_t sc_cur_mode;
/*
* We use function pointers to the framebuffer manipulation
@@ -139,26 +151,152 @@ struct udl_softc {
/*
* Register values for screen resolution initialization.
*/
-uint8_t udl_reg_vals_640[] = {
+uint8_t udl_reg_vals_640x480_60[] = { /* 25.17 Mhz 59.9 Hz VESA std */
0x00, 0x99, 0x30, 0x26, 0x94, 0x60, 0xa9, 0xce, 0x60, 0x07, 0xb3, 0x0f,
0x79, 0xff, 0xff, 0x02, 0x80, 0x83, 0xbc, 0xff, 0xfc, 0xff, 0xff, 0x01,
0xe0, 0x01, 0x02, 0xab, 0x13
};
-uint8_t udl_reg_vals_800[] = {
+uint8_t udl_reg_vals_640x480_67[] = { /* 30.25 MHz 66.6 Hz MAC std */
+ 0x00, 0x1d, 0x33, 0x07, 0xb3, 0x60, 0xa9, 0xce, 0x60, 0xb6, 0xa8, 0xff,
+ 0xff, 0xbf, 0x70, 0x02, 0x80, 0x83, 0xbc, 0xff, 0xff, 0xff, 0xf9, 0x01,
+ 0xe0, 0x01, 0x02, 0xa2, 0x17
+};
+uint8_t udl_reg_vals_640x480_72[] = { /* 31.50 Mhz 72.8 Hz VESA std */
+ 0x00, 0x2b, 0xeb, 0x35, 0xd3, 0x0a, 0x95, 0xe6, 0x0e, 0x0f, 0xb5, 0x15,
+ 0x2a, 0xff, 0xff, 0x02, 0x80, 0xcc, 0x1d, 0xff, 0xf9, 0xff, 0xff, 0x01,
+ 0xe0, 0x01, 0x02, 0x9c, 0x18
+};
+uint8_t udl_reg_vals_640x480_75[] = { /* 31.50 Mhz 75.7 Hz VESA std */
+ 0x00, 0xeb, 0xf7, 0xd3, 0x0f, 0x4f, 0x93, 0xfa, 0x47, 0xb5, 0x58, 0xff,
+ 0xff, 0xbf, 0x70, 0x02, 0x80, 0xf4, 0x8f, 0xff, 0xff, 0xff, 0xf9, 0x01,
+ 0xe0, 0x01, 0x02, 0x9c, 0x18
+};
+uint8_t udl_reg_vals_800x600_56[] = { /* 36.00 MHz 56.2 Hz VESA std */
+ 0x00, 0x65, 0x35, 0x48, 0xf4, 0xf2, 0x6c, 0x19, 0x18, 0xc9, 0x4b, 0xff,
+ 0xff, 0x70, 0x35, 0x03, 0x20, 0x32, 0x31, 0xff, 0xff, 0xff, 0xfc, 0x02,
+ 0x58, 0x01, 0x02, 0x20, 0x1c
+};
+uint8_t udl_reg_vals_800x600_60[] = { /* 40.00 MHz 60.3 Hz VESA std */
0x00, 0x20, 0x3c, 0x7a, 0xc9, 0x93, 0x60, 0xc8, 0xc7, 0x70, 0x53, 0xff,
0xff, 0x21, 0x27, 0x03, 0x20, 0x91, 0x8f, 0xff, 0xff, 0xff, 0xf2, 0x02,
0x58, 0x01, 0x02, 0x40, 0x1f
};
-uint8_t udl_reg_vals_1024[] = {
+uint8_t udl_reg_vals_800x600_72[] = { /* 50.00 MHz 72.1 Hz VESA std */
+ 0x00, 0xeb, 0xf7, 0xd1, 0x90, 0x4d, 0x82, 0x23, 0x1f, 0x39, 0xcf, 0xff,
+ 0xff, 0x43, 0x21, 0x03, 0x20, 0x62, 0xc5, 0xff, 0xff, 0xff, 0xca, 0x02,
+ 0x58, 0x01, 0x02, 0x10, 0x27
+};
+uint8_t udl_reg_vals_800x600_74[] = { /* 50.00 MHz 74.4 Hz */
+ 0x00, 0xb3, 0x76, 0x39, 0xcf, 0x60, 0xa9, 0xc7, 0xf4, 0x70, 0x53, 0xff,
+ 0xff, 0x35, 0x33, 0x03, 0x20, 0x8f, 0xe9, 0xff, 0xff, 0xff, 0xf9, 0x02,
+ 0x58, 0x01, 0x02, 0x10, 0x27
+};
+uint8_t udl_reg_vals_800x600_75[] = { /* 49.50 MHz 75.0 Hz VESA std */
+ 0x00, 0xb3, 0x76, 0x39, 0xcf, 0xf2, 0x6c, 0x19, 0x18, 0x70, 0x53, 0xff,
+ 0xff, 0x35, 0x33, 0x03, 0x20, 0x32, 0x31, 0xff, 0xff, 0xff, 0xf9, 0x02,
+ 0x58, 0x01, 0x02, 0xac, 0x26
+};
+uint8_t udl_reg_vals_1024x768_60[] = { /* 65.00 MHz 60.0 Hz VESA std */
0x00, 0x36, 0x18, 0xd5, 0x10, 0x60, 0xa9, 0x7b, 0x33, 0xa1, 0x2b, 0x27,
0x32, 0xff, 0xff, 0x04, 0x00, 0xd9, 0x9a, 0xff, 0xca, 0xff, 0xff, 0x03,
0x00, 0x04, 0x03, 0xc8, 0x32
};
-uint8_t udl_reg_vals_1280[] = {
+uint8_t udl_reg_vals_1024x768_70[] = { /* 75.00 MHz 70.0 Hz VESA std */
+ 0x00, 0xb4, 0xed, 0x4c, 0x5e, 0x60, 0xa9, 0x7b, 0x33, 0x10, 0x4d, 0xff,
+ 0xff, 0x27, 0x32, 0x04, 0x00, 0xd9, 0x9a, 0xff, 0xff, 0xff, 0xca, 0x03,
+ 0x00, 0x04, 0x02, 0x98, 0x3a
+};
+uint8_t udl_reg_vals_1024x768_75[] = { /* 78.75 MHz 75.0 Hz VESA std */
+ 0x00, 0xec, 0xb4, 0xa0, 0x4c, 0x36, 0x0a, 0x07, 0xb3, 0x5e, 0xd5, 0xff,
+ 0xff, 0x0f, 0x79, 0x04, 0x00, 0x0f, 0x66, 0xff, 0xff, 0xff, 0xf9, 0x03,
+ 0x00, 0x04, 0x02, 0x86, 0x3d
+};
+uint8_t udl_reg_vals_1280x800_60[] = { /* 83.46 MHz 59.9 MHz */
+ 0x00, 0xb2, 0x19, 0x34, 0xdf, 0x93, 0x60, 0x30, 0xfb, 0x9f, 0xca, 0xff,
+ 0xff, 0x27, 0x32, 0x05, 0x00, 0x61, 0xf6, 0xff, 0xff, 0xff, 0xf9, 0x03,
+ 0x20, 0x04, 0x02, 0x34, 0x41
+};
+uint8_t udl_reg_vals_1280x960_60[] = { /* 108.00 MHz 60.0 Hz VESA std */
+ 0x00, 0xa6, 0x03, 0x5c, 0x7e, 0x0a, 0x95, 0x48, 0xf4, 0x61, 0xbd, 0xff,
+ 0xff, 0x94, 0x43, 0x05, 0x00, 0x91, 0xe8, 0xff, 0xff, 0xff, 0xf9, 0x03,
+ 0xc0, 0x04, 0x02, 0x60, 0x54
+};
+uint8_t udl_reg_vals_1280x1024_60[] = { /* 108.00 MHz 60.0 Hz VESA std */
0x00, 0x98, 0xf8, 0x0d, 0x57, 0x2a, 0x55, 0x4d, 0x54, 0xca, 0x0d, 0xff,
0xff, 0x94, 0x43, 0x05, 0x00, 0x9a, 0xa8, 0xff, 0xff, 0xff, 0xf9, 0x04,
0x00, 0x04, 0x02, 0x60, 0x54
};
+uint8_t udl_reg_vals_1280x1024_75[] = { /* 135.00 MHz 75.0 Hz VESA std */
+ 0x00, 0xce, 0x12, 0x3f, 0x9f, 0x2a, 0x55, 0x4d, 0x54, 0xca, 0x0d, 0xff,
+ 0xff, 0x32, 0x60, 0x05, 0x00, 0x9a, 0xa8, 0xff, 0xff, 0xff, 0xf9, 0x04,
+ 0x00, 0x04, 0x02, 0x78, 0x69
+};
+uint8_t udl_reg_vals_1440x900_60[] = { /* 106.47 MHz 59.9 Hz */
+ 0x00, 0x24, 0xce, 0xe7, 0x72, 0x36, 0x0a, 0x86, 0xca, 0x1c, 0x10, 0xff,
+ 0xff, 0x60, 0x3a, 0x05, 0xa0, 0x0d, 0x94, 0xff, 0xff, 0xff, 0xf9, 0x03,
+ 0x84, 0x04, 0x02, 0x2e, 0x53
+};
+uint8_t udl_reg_vals_1440x900_59[] = { /* 106.50 MHz 59.8 Hz */
+ 0x00, 0x24, 0xce, 0xe7, 0x72, 0xd8, 0x2a, 0x1b, 0x28, 0x1c, 0x10, 0xff,
+ 0xff, 0x60, 0x3a, 0x05, 0xa0, 0x36, 0x50, 0xff, 0xff, 0xff, 0xf9, 0x03,
+ 0x84, 0x04, 0x02, 0x34, 0x53
+};
+uint8_t udl_reg_vals_1440x900_75[] = { /* 136.49 MHz 75.0 Hz */
+ 0x00, 0x73, 0xa6, 0x14, 0xea, 0x0a, 0x95, 0xca, 0x10, 0x7f, 0x46, 0xff,
+ 0xff, 0x60, 0x3a, 0x05, 0xa0, 0x94, 0x20, 0xff, 0xff, 0xff, 0xf9, 0x03,
+ 0x84, 0x04, 0x02, 0xa2, 0x6a
+};
+uint8_t udl_reg_vals_1680x1050_60[] = { /* 147.14 MHz 60.0 Hz */
+ 0x00, 0x53, 0x43, 0xa6, 0x71, 0xc1, 0x52, 0xd9, 0x29, 0x69, 0x9f, 0xff,
+ 0xff, 0xd7, 0xee, 0x06, 0x90, 0xb2, 0x53, 0xff, 0xff, 0xff, 0xf9, 0x04,
+ 0x1a, 0x04, 0x02, 0xf4, 0x72
+};
+uint8_t udl_reg_vals_1600x1200_60[] = { /* 162.00 MHz 60.0 Hz VESA std */
+ 0x00, 0xcf, 0xa4, 0x3c, 0x4e, 0x55, 0x73, 0x71, 0x2b, 0x71, 0x52, 0xff,
+ 0xff, 0xee, 0xca, 0x06, 0x40, 0xe2, 0x57, 0xff, 0xff, 0xff, 0xf9, 0x04,
+ 0xb0, 0x04, 0x02, 0x90, 0x7e
+};
+uint8_t udl_reg_vals_1920x1080_60[] = { /* 138.50 MHz 59.9 Hz */
+ 0x00, 0x73, 0xa6, 0x28, 0xb3, 0x54, 0xaa, 0x41, 0x5d, 0x0d, 0x9f, 0x32,
+ 0x60, 0xff, 0xff, 0x07, 0x80, 0x0a, 0xea, 0xff, 0xf9, 0xff, 0xff, 0x04,
+ 0x38, 0x04, 0x02, 0xe0, 0x7c
+};
+
+struct udl_mode {
+ uint16_t hdisplay;
+ uint16_t vdisplay;
+ uint8_t hz;
+ uint16_t chip;
+ uint32_t clock;
+#define UDL_MODE_SIZE 29
+ uint8_t *mode;
+};
+
+static const struct udl_mode udl_modes[] = {
+ { 640, 480, 60, DLALL, 2520, udl_reg_vals_640x480_60 },
+ { 640, 480, 67, DLALL, 3025, udl_reg_vals_640x480_67 },
+ { 640, 480, 72, DLALL, 3150, udl_reg_vals_640x480_72 },
+ { 640, 480, 75, DLALL, 3150, udl_reg_vals_640x480_75 },
+ { 800, 600, 56, DLALL, 3600, udl_reg_vals_800x600_56 },
+ { 800, 600, 60, DLALL, 4000, udl_reg_vals_800x600_60 },
+ { 800, 600, 72, DLALL, 5000, udl_reg_vals_800x600_72 },
+ { 800, 600, 74, DLALL, 5000, udl_reg_vals_800x600_74 },
+ { 800, 600, 75, DLALL, 4950, udl_reg_vals_800x600_75 },
+ { 1024, 768, 60, DLALL, 6500, udl_reg_vals_1024x768_60 },
+ { 1024, 768, 70, DLALL, 7500, udl_reg_vals_1024x768_70 },
+ { 1024, 768, 75, DLALL, 7850, udl_reg_vals_1024x768_75 },
+ { 1280, 800, 60, DLALL, 8346, udl_reg_vals_1280x800_60 },
+ { 1280, 960, 60, DLALL, 10800, udl_reg_vals_1280x960_60 },
+ { 1280, 1024, 60, DLALL, 10800, udl_reg_vals_1280x1024_60 },
+ { 1280, 1024, 75, DLALL, 13500, udl_reg_vals_1280x1024_75 },
+ { 1440, 900, 59, DL125, 10650, udl_reg_vals_1440x900_59 },
+ { 1440, 900, 60, DL125, 10647, udl_reg_vals_1440x900_60 },
+ { 1440, 900, 75, DL125, 13649, udl_reg_vals_1440x900_75 },
+ { 1680, 1050, 60, DL160, 14714, udl_reg_vals_1680x1050_60 },
+ { 1600, 1200, 60, DL160, 16200, udl_reg_vals_1600x1200_60 },
+ { 1920, 1080, 60, DL165, 13850, udl_reg_vals_1920x1080_60 }
+};
+#define MAX_DL_MODES (sizeof(udl_modes)/sizeof(struct udl_mode))
/*
* Encryption.