xref: /freebsd/sys/dev/usb/video/udl.h (revision 71625ec9ad2a9bc8c09784fbd23b759830e0ee5f)
10867995cSHans Petter Selasky /*	$OpenBSD: udl.h,v 1.21 2013/04/15 09:23:02 mglocker Exp $ */
20867995cSHans Petter Selasky 
30867995cSHans Petter Selasky /*
40867995cSHans Petter Selasky  * Copyright (c) 2009 Marcus Glocker <mglocker@openbsd.org>
50867995cSHans Petter Selasky  *
60867995cSHans Petter Selasky  * Permission to use, copy, modify, and distribute this software for any
70867995cSHans Petter Selasky  * purpose with or without fee is hereby granted, provided that the above
80867995cSHans Petter Selasky  * copyright notice and this permission notice appear in all copies.
90867995cSHans Petter Selasky  *
100867995cSHans Petter Selasky  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
110867995cSHans Petter Selasky  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
120867995cSHans Petter Selasky  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
130867995cSHans Petter Selasky  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
140867995cSHans Petter Selasky  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
150867995cSHans Petter Selasky  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
160867995cSHans Petter Selasky  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
170867995cSHans Petter Selasky  */
180867995cSHans Petter Selasky 
190867995cSHans Petter Selasky #ifndef _UDL_H_
200867995cSHans Petter Selasky #define	_UDL_H_
210867995cSHans Petter Selasky 
220867995cSHans Petter Selasky #include <sys/types.h>
230867995cSHans Petter Selasky #include <sys/queue.h>
240867995cSHans Petter Selasky 
250867995cSHans Petter Selasky /*
260867995cSHans Petter Selasky  * BULK command transfer structure.
270867995cSHans Petter Selasky  */
280867995cSHans Petter Selasky #define	UDL_CMD_MAX_FRAMES	64	/* units */
290867995cSHans Petter Selasky #define	UDL_CMD_MAX_DATA_SIZE	512	/* bytes */
300867995cSHans Petter Selasky #define	UDL_CMD_MAX_HEAD_SIZE	16	/* bytes */
310867995cSHans Petter Selasky #define	UDL_CMD_MAX_PIXEL_COUNT	((UDL_CMD_MAX_DATA_SIZE - UDL_CMD_MAX_HEAD_SIZE) / 2)
32537116c2SHans Petter Selasky #define	UDL_CMD_MAX_BUFFERS	(3 * UDL_CMD_MAX_FRAMES)
330867995cSHans Petter Selasky #define	UDL_FONT_HEIGHT		16	/* pixels */
340867995cSHans Petter Selasky #define	UDL_MAX_MODES		25	/* units */
350867995cSHans Petter Selasky 
36*55e11a03SHans Petter Selasky MALLOC_DECLARE(M_USB_DL);
37*55e11a03SHans Petter Selasky 
38*55e11a03SHans Petter Selasky struct udl_buffer {
39*55e11a03SHans Petter Selasky 	TAILQ_ENTRY(udl_buffer) entry;
40*55e11a03SHans Petter Selasky 	uint32_t size;
41*55e11a03SHans Petter Selasky };
42*55e11a03SHans Petter Selasky 
43*55e11a03SHans Petter Selasky TAILQ_HEAD(udl_buffer_head, udl_buffer);
44*55e11a03SHans Petter Selasky 
450867995cSHans Petter Selasky struct udl_cmd_buf {
460867995cSHans Petter Selasky 	TAILQ_ENTRY(udl_cmd_buf) entry;
470867995cSHans Petter Selasky 	uint32_t off;
480867995cSHans Petter Selasky 	uint8_t	buf[UDL_CMD_MAX_DATA_SIZE] __aligned(4);
490867995cSHans Petter Selasky };
500867995cSHans Petter Selasky 
510867995cSHans Petter Selasky TAILQ_HEAD(udl_cmd_head, udl_cmd_buf);
520867995cSHans Petter Selasky 
530867995cSHans Petter Selasky enum {
540867995cSHans Petter Selasky 	UDL_BULK_WRITE_0,
550867995cSHans Petter Selasky 	UDL_BULK_WRITE_1,
560867995cSHans Petter Selasky 	UDL_N_TRANSFER,
570867995cSHans Petter Selasky };
580867995cSHans Petter Selasky 
590867995cSHans Petter Selasky /*
600867995cSHans Petter Selasky  * Our per device structure.
610867995cSHans Petter Selasky  */
620867995cSHans Petter Selasky struct udl_softc {
630867995cSHans Petter Selasky 	struct mtx sc_mtx;
640867995cSHans Petter Selasky 	struct cv sc_cv;
650867995cSHans Petter Selasky 	struct callout sc_callout;
660867995cSHans Petter Selasky 	struct usb_xfer *sc_xfer[UDL_N_TRANSFER];
670867995cSHans Petter Selasky 	struct usb_device *sc_udev;
680867995cSHans Petter Selasky 	device_t sc_fbdev;
690867995cSHans Petter Selasky 	struct fb_info sc_fb_info;
700867995cSHans Petter Selasky 	uint8_t	sc_edid[128];
710867995cSHans Petter Selasky 	struct edid_info sc_edid_info;
720867995cSHans Petter Selasky 	struct udl_cmd_head sc_xfer_head[2];
730867995cSHans Petter Selasky 	struct udl_cmd_head sc_cmd_buf_free;
740867995cSHans Petter Selasky 	struct udl_cmd_head sc_cmd_buf_pending;
750867995cSHans Petter Selasky 	struct udl_cmd_buf sc_cmd_buf_temp[UDL_CMD_MAX_BUFFERS];
760867995cSHans Petter Selasky 	uint32_t sc_sync_off;
770867995cSHans Petter Selasky 	uint32_t sc_fb_size;
780867995cSHans Petter Selasky 	uint8_t *sc_fb_addr;
790867995cSHans Petter Selasky 	uint8_t *sc_fb_copy;
800867995cSHans Petter Selasky 	int	sc_def_chip;		/* default chip version */
810867995cSHans Petter Selasky 	int	sc_chip;
820867995cSHans Petter Selasky #define	DLALL	0x0000
830867995cSHans Petter Selasky #define	DL125	0x0000			/* max 1280x1024, 1440x900 */
840867995cSHans Petter Selasky #define	DL120	0x0001			/* max 1280x1024, 1440x1050 */
850867995cSHans Petter Selasky #define	DL160	0x0002			/* max 1600x1200, 1680x1050 */
860867995cSHans Petter Selasky #define	DL165	0x0003			/* max 1600x1200, 1920x1080 */
870867995cSHans Petter Selasky #define	DL195	0x0004			/* max 1920x1200, 2048x1152 */
880867995cSHans Petter Selasky #define	DLMAX	0x0004
890867995cSHans Petter Selasky #define	DLUNK	0x00ff			/* unknown */
900867995cSHans Petter Selasky 	int	sc_def_mode;		/* default mode */
910867995cSHans Petter Selasky 	int	sc_cur_mode;
920867995cSHans Petter Selasky 	uint8_t	sc_power_save;		/* set if power save is enabled */
930867995cSHans Petter Selasky 	uint8_t	sc_gone;
940867995cSHans Petter Selasky };
950867995cSHans Petter Selasky 
960867995cSHans Petter Selasky #define	UDL_LOCK(sc)	mtx_lock(&(sc)->sc_mtx)
970867995cSHans Petter Selasky #define	UDL_UNLOCK(sc)	mtx_unlock(&(sc)->sc_mtx)
980867995cSHans Petter Selasky 
990867995cSHans Petter Selasky /*
1000867995cSHans Petter Selasky  * Chip commands.
1010867995cSHans Petter Selasky  */
1020867995cSHans Petter Selasky #define	UDL_CTRL_CMD_READ_EDID		0x02
1030867995cSHans Petter Selasky #define	UDL_CTRL_CMD_WRITE_1		0x03
1040867995cSHans Petter Selasky #define	UDL_CTRL_CMD_READ_1		0x04
1050867995cSHans Petter Selasky #define	UDL_CTRL_CMD_POLL		0x06
1060867995cSHans Petter Selasky #define	UDL_CTRL_CMD_SET_KEY		0x12
1070867995cSHans Petter Selasky 
1080867995cSHans Petter Selasky #define	UDL_BULK_SOC			0xaf	/* start of command token */
1090867995cSHans Petter Selasky 
1100867995cSHans Petter Selasky #define	UDL_BULK_CMD_REG_WRITE_1	0x20	/* write 1 byte to register */
1110867995cSHans Petter Selasky #define	UDL_BULK_CMD_EOC		0xa0	/* end of command stack */
1120867995cSHans Petter Selasky #define	UDL_BULK_CMD_DECOMP		0xe0	/* send decompression table */
1130867995cSHans Petter Selasky 
1140867995cSHans Petter Selasky #define	UDL_BULK_CMD_FB_BASE		0x60
1150867995cSHans Petter Selasky #define	UDL_BULK_CMD_FB_WORD		0x08
1160867995cSHans Petter Selasky #define	UDL_BULK_CMD_FB_COMP		0x10
1170867995cSHans Petter Selasky #define	UDL_BULK_CMD_FB_WRITE		(UDL_BULK_CMD_FB_BASE | 0x00)
1180867995cSHans Petter Selasky #define	UDL_BULK_CMD_FB_COPY		(UDL_BULK_CMD_FB_BASE | 0x02)
1190867995cSHans Petter Selasky 
1200867995cSHans Petter Selasky /*
1210867995cSHans Petter Selasky  * Chip registers.
1220867995cSHans Petter Selasky  */
1230867995cSHans Petter Selasky #define	UDL_REG_ADDR_START16		0x20
1240867995cSHans Petter Selasky #define	UDL_REG_ADDR_STRIDE16		0x23
1250867995cSHans Petter Selasky #define	UDL_REG_ADDR_START8		0x26
1260867995cSHans Petter Selasky #define	UDL_REG_ADDR_STRIDE8		0x29
1270867995cSHans Petter Selasky 
1280867995cSHans Petter Selasky #define	UDL_REG_SCREEN			0x1f
1290867995cSHans Petter Selasky #define	UDL_REG_SCREEN_ON		0x00
1300867995cSHans Petter Selasky #define	UDL_REG_SCREEN_OFF		0x01
1310867995cSHans Petter Selasky #define	UDL_REG_SYNC			0xff
1320867995cSHans Petter Selasky 
1330867995cSHans Petter Selasky #define	UDL_MODE_SIZE 29
1340867995cSHans Petter Selasky 
1350867995cSHans Petter Selasky /*
1360867995cSHans Petter Selasky  * Register values for screen resolution initialization.
1370867995cSHans Petter Selasky  */
1380867995cSHans Petter Selasky static const uint8_t udl_reg_vals_640x480_60[UDL_MODE_SIZE] = {	/* 25.17 Mhz 59.9 Hz
1390867995cSHans Petter Selasky 								 * VESA std */
1400867995cSHans Petter Selasky 	0x00, 0x99, 0x30, 0x26, 0x94, 0x60, 0xa9, 0xce, 0x60, 0x07, 0xb3, 0x0f,
1410867995cSHans Petter Selasky 	0x79, 0xff, 0xff, 0x02, 0x80, 0x83, 0xbc, 0xff, 0xfc, 0xff, 0xff, 0x01,
1420867995cSHans Petter Selasky 	0xe0, 0x01, 0x02, 0xab, 0x13
1430867995cSHans Petter Selasky };
1440867995cSHans Petter Selasky static const uint8_t udl_reg_vals_640x480_67[UDL_MODE_SIZE] = {	/* 30.25 MHz 66.6 Hz MAC
1450867995cSHans Petter Selasky 								 * std */
1460867995cSHans Petter Selasky 	0x00, 0x1d, 0x33, 0x07, 0xb3, 0x60, 0xa9, 0xce, 0x60, 0xb6, 0xa8, 0xff,
1470867995cSHans Petter Selasky 	0xff, 0xbf, 0x70, 0x02, 0x80, 0x83, 0xbc, 0xff, 0xff, 0xff, 0xf9, 0x01,
1480867995cSHans Petter Selasky 	0xe0, 0x01, 0x02, 0xa2, 0x17
1490867995cSHans Petter Selasky };
1500867995cSHans Petter Selasky static const uint8_t udl_reg_vals_640x480_72[UDL_MODE_SIZE] = {	/* 31.50 Mhz 72.8 Hz
1510867995cSHans Petter Selasky 								 * VESA std */
1520867995cSHans Petter Selasky 	0x00, 0x2b, 0xeb, 0x35, 0xd3, 0x0a, 0x95, 0xe6, 0x0e, 0x0f, 0xb5, 0x15,
1530867995cSHans Petter Selasky 	0x2a, 0xff, 0xff, 0x02, 0x80, 0xcc, 0x1d, 0xff, 0xf9, 0xff, 0xff, 0x01,
1540867995cSHans Petter Selasky 	0xe0, 0x01, 0x02, 0x9c, 0x18
1550867995cSHans Petter Selasky };
1560867995cSHans Petter Selasky static const uint8_t udl_reg_vals_640x480_75[UDL_MODE_SIZE] = {	/* 31.50 Mhz 75.7 Hz
1570867995cSHans Petter Selasky 								 * VESA std */
1580867995cSHans Petter Selasky 	0x00, 0xeb, 0xf7, 0xd3, 0x0f, 0x4f, 0x93, 0xfa, 0x47, 0xb5, 0x58, 0xff,
1590867995cSHans Petter Selasky 	0xff, 0xbf, 0x70, 0x02, 0x80, 0xf4, 0x8f, 0xff, 0xff, 0xff, 0xf9, 0x01,
1600867995cSHans Petter Selasky 	0xe0, 0x01, 0x02, 0x9c, 0x18
1610867995cSHans Petter Selasky };
1620867995cSHans Petter Selasky static const uint8_t udl_reg_vals_800x480_61[UDL_MODE_SIZE] = {	/* 33.00 MHz 61.9 Hz */
1630867995cSHans Petter Selasky 	0x00, 0x20, 0x3c, 0x7a, 0xc9, 0xf2, 0x6c, 0x48, 0xf9, 0x70, 0x53, 0xff,
1640867995cSHans Petter Selasky 	0xff, 0x21, 0x27, 0x03, 0x20, 0x91, 0xf3, 0xff, 0xff, 0xff, 0xf9, 0x01,
1650867995cSHans Petter Selasky 	0xe0, 0x01, 0x02, 0xc8, 0x19
1660867995cSHans Petter Selasky };
1670867995cSHans Petter Selasky static const uint8_t udl_reg_vals_800x600_56[UDL_MODE_SIZE] = {	/* 36.00 MHz 56.2 Hz
1680867995cSHans Petter Selasky 								 * VESA std */
1690867995cSHans Petter Selasky 	0x00, 0x65, 0x35, 0x48, 0xf4, 0xf2, 0x6c, 0x19, 0x18, 0xc9, 0x4b, 0xff,
1700867995cSHans Petter Selasky 	0xff, 0x70, 0x35, 0x03, 0x20, 0x32, 0x31, 0xff, 0xff, 0xff, 0xfc, 0x02,
1710867995cSHans Petter Selasky 	0x58, 0x01, 0x02, 0x20, 0x1c
1720867995cSHans Petter Selasky };
1730867995cSHans Petter Selasky static const uint8_t udl_reg_vals_800x600_60[UDL_MODE_SIZE] = {	/* 40.00 MHz 60.3 Hz
1740867995cSHans Petter Selasky 								 * VESA std */
1750867995cSHans Petter Selasky 	0x00, 0x20, 0x3c, 0x7a, 0xc9, 0x93, 0x60, 0xc8, 0xc7, 0x70, 0x53, 0xff,
1760867995cSHans Petter Selasky 	0xff, 0x21, 0x27, 0x03, 0x20, 0x91, 0x8f, 0xff, 0xff, 0xff, 0xf2, 0x02,
1770867995cSHans Petter Selasky 	0x58, 0x01, 0x02, 0x40, 0x1f
1780867995cSHans Petter Selasky };
1790867995cSHans Petter Selasky static const uint8_t udl_reg_vals_800x600_72[UDL_MODE_SIZE] = {	/* 50.00 MHz 72.1 Hz
1800867995cSHans Petter Selasky 								 * VESA std */
1810867995cSHans Petter Selasky 	0x00, 0xeb, 0xf7, 0xd1, 0x90, 0x4d, 0x82, 0x23, 0x1f, 0x39, 0xcf, 0xff,
1820867995cSHans Petter Selasky 	0xff, 0x43, 0x21, 0x03, 0x20, 0x62, 0xc5, 0xff, 0xff, 0xff, 0xca, 0x02,
1830867995cSHans Petter Selasky 	0x58, 0x01, 0x02, 0x10, 0x27
1840867995cSHans Petter Selasky };
1850867995cSHans Petter Selasky static const uint8_t udl_reg_vals_800x600_74[UDL_MODE_SIZE] = {	/* 50.00 MHz 74.4 Hz */
1860867995cSHans Petter Selasky 	0x00, 0xb3, 0x76, 0x39, 0xcf, 0x60, 0xa9, 0xc7, 0xf4, 0x70, 0x53, 0xff,
1870867995cSHans Petter Selasky 	0xff, 0x35, 0x33, 0x03, 0x20, 0x8f, 0xe9, 0xff, 0xff, 0xff, 0xf9, 0x02,
1880867995cSHans Petter Selasky 	0x58, 0x01, 0x02, 0x10, 0x27
1890867995cSHans Petter Selasky };
1900867995cSHans Petter Selasky static const uint8_t udl_reg_vals_800x600_75[UDL_MODE_SIZE] = {	/* 49.50 MHz 75.0 Hz
1910867995cSHans Petter Selasky 								 * VESA std */
1920867995cSHans Petter Selasky 	0x00, 0xb3, 0x76, 0x39, 0xcf, 0xf2, 0x6c, 0x19, 0x18, 0x70, 0x53, 0xff,
1930867995cSHans Petter Selasky 	0xff, 0x35, 0x33, 0x03, 0x20, 0x32, 0x31, 0xff, 0xff, 0xff, 0xf9, 0x02,
1940867995cSHans Petter Selasky 	0x58, 0x01, 0x02, 0xac, 0x26
1950867995cSHans Petter Selasky };
1960867995cSHans Petter Selasky static const uint8_t udl_reg_vals_1024x768_60[UDL_MODE_SIZE] = {	/* 65.00 MHz 60.0 Hz
1970867995cSHans Petter Selasky 									 * VESA std */
1980867995cSHans Petter Selasky 	0x00, 0x36, 0x18, 0xd5, 0x10, 0x60, 0xa9, 0x7b, 0x33, 0xa1, 0x2b, 0x27,
1990867995cSHans Petter Selasky 	0x32, 0xff, 0xff, 0x04, 0x00, 0xd9, 0x9a, 0xff, 0xca, 0xff, 0xff, 0x03,
2000867995cSHans Petter Selasky 	0x00, 0x04, 0x03, 0xc8, 0x32
2010867995cSHans Petter Selasky };
2020867995cSHans Petter Selasky static const uint8_t udl_reg_vals_1024x768_70[UDL_MODE_SIZE] = {	/* 75.00 MHz 70.0 Hz
2030867995cSHans Petter Selasky 									 * VESA std */
2040867995cSHans Petter Selasky 	0x00, 0xb4, 0xed, 0x4c, 0x5e, 0x60, 0xa9, 0x7b, 0x33, 0x10, 0x4d, 0xff,
2050867995cSHans Petter Selasky 	0xff, 0x27, 0x32, 0x04, 0x00, 0xd9, 0x9a, 0xff, 0xff, 0xff, 0xca, 0x03,
2060867995cSHans Petter Selasky 	0x00, 0x04, 0x02, 0x98, 0x3a
2070867995cSHans Petter Selasky };
2080867995cSHans Petter Selasky static const uint8_t udl_reg_vals_1024x768_75[UDL_MODE_SIZE] = {	/* 78.75 MHz 75.0 Hz
2090867995cSHans Petter Selasky 									 * VESA std */
2100867995cSHans Petter Selasky 	0x00, 0xec, 0xb4, 0xa0, 0x4c, 0x36, 0x0a, 0x07, 0xb3, 0x5e, 0xd5, 0xff,
2110867995cSHans Petter Selasky 	0xff, 0x0f, 0x79, 0x04, 0x00, 0x0f, 0x66, 0xff, 0xff, 0xff, 0xf9, 0x03,
2120867995cSHans Petter Selasky 	0x00, 0x04, 0x02, 0x86, 0x3d
2130867995cSHans Petter Selasky };
2140867995cSHans Petter Selasky static const uint8_t udl_reg_vals_1280x800_60[UDL_MODE_SIZE] = {	/* 83.46 MHz 59.9 MHz */
2150867995cSHans Petter Selasky 	0x00, 0xb2, 0x19, 0x34, 0xdf, 0x93, 0x60, 0x30, 0xfb, 0x9f, 0xca, 0xff,
2160867995cSHans Petter Selasky 	0xff, 0x27, 0x32, 0x05, 0x00, 0x61, 0xf6, 0xff, 0xff, 0xff, 0xf9, 0x03,
2170867995cSHans Petter Selasky 	0x20, 0x04, 0x02, 0x34, 0x41
2180867995cSHans Petter Selasky };
2190867995cSHans Petter Selasky static const uint8_t udl_reg_vals_1280x960_60[UDL_MODE_SIZE] = {	/* 108.00 MHz 60.0 Hz
2200867995cSHans Petter Selasky 									 * VESA std */
2210867995cSHans Petter Selasky 	0x00, 0xa6, 0x03, 0x5c, 0x7e, 0x0a, 0x95, 0x48, 0xf4, 0x61, 0xbd, 0xff,
2220867995cSHans Petter Selasky 	0xff, 0x94, 0x43, 0x05, 0x00, 0x91, 0xe8, 0xff, 0xff, 0xff, 0xf9, 0x03,
2230867995cSHans Petter Selasky 	0xc0, 0x04, 0x02, 0x60, 0x54
2240867995cSHans Petter Selasky };
2250867995cSHans Petter Selasky static const uint8_t udl_reg_vals_1280x1024_60[UDL_MODE_SIZE] = {	/* 108.00 MHz 60.0 Hz
2260867995cSHans Petter Selasky 									 * VESA std */
2270867995cSHans Petter Selasky 	0x00, 0x98, 0xf8, 0x0d, 0x57, 0x2a, 0x55, 0x4d, 0x54, 0xca, 0x0d, 0xff,
2280867995cSHans Petter Selasky 	0xff, 0x94, 0x43, 0x05, 0x00, 0x9a, 0xa8, 0xff, 0xff, 0xff, 0xf9, 0x04,
2290867995cSHans Petter Selasky 	0x00, 0x04, 0x02, 0x60, 0x54
2300867995cSHans Petter Selasky };
2310867995cSHans Petter Selasky static const uint8_t udl_reg_vals_1280x1024_75[UDL_MODE_SIZE] = {	/* 135.00 MHz 75.0 Hz
2320867995cSHans Petter Selasky 									 * VESA std */
2330867995cSHans Petter Selasky 	0x00, 0xce, 0x12, 0x3f, 0x9f, 0x2a, 0x55, 0x4d, 0x54, 0xca, 0x0d, 0xff,
2340867995cSHans Petter Selasky 	0xff, 0x32, 0x60, 0x05, 0x00, 0x9a, 0xa8, 0xff, 0xff, 0xff, 0xf9, 0x04,
2350867995cSHans Petter Selasky 	0x00, 0x04, 0x02, 0x78, 0x69
2360867995cSHans Petter Selasky };
2370867995cSHans Petter Selasky static const uint8_t udl_reg_vals_1366x768_60[UDL_MODE_SIZE] = {	/* 90 MHz 60.0 Hz */
2380867995cSHans Petter Selasky 	0x01, 0x19, 0x1e, 0x1f, 0xb0, 0x93, 0x60, 0x40, 0x7b, 0x36, 0xe8, 0x27,
2390867995cSHans Petter Selasky 	0x32, 0xff, 0xff, 0x05, 0x56, 0x03, 0xd9, 0xff, 0xff, 0xfc, 0xa7, 0x03,
2400867995cSHans Petter Selasky 	0x00, 0x04, 0x02, 0x9a, 0x42
2410867995cSHans Petter Selasky };
2420867995cSHans Petter Selasky static const uint8_t udl_reg_vals_1440x900_60[UDL_MODE_SIZE] = {	/* 106.47 MHz 59.9 Hz */
2430867995cSHans Petter Selasky 	0x00, 0x24, 0xce, 0xe7, 0x72, 0x36, 0x0a, 0x86, 0xca, 0x1c, 0x10, 0xff,
2440867995cSHans Petter Selasky 	0xff, 0x60, 0x3a, 0x05, 0xa0, 0x0d, 0x94, 0xff, 0xff, 0xff, 0xf9, 0x03,
2450867995cSHans Petter Selasky 	0x84, 0x04, 0x02, 0x2e, 0x53
2460867995cSHans Petter Selasky };
2470867995cSHans Petter Selasky static const uint8_t udl_reg_vals_1440x900_59[UDL_MODE_SIZE] = {	/* 106.50 MHz 59.8 Hz */
2480867995cSHans Petter Selasky 	0x00, 0x24, 0xce, 0xe7, 0x72, 0xd8, 0x2a, 0x1b, 0x28, 0x1c, 0x10, 0xff,
2490867995cSHans Petter Selasky 	0xff, 0x60, 0x3a, 0x05, 0xa0, 0x36, 0x50, 0xff, 0xff, 0xff, 0xf9, 0x03,
2500867995cSHans Petter Selasky 	0x84, 0x04, 0x02, 0x34, 0x53
2510867995cSHans Petter Selasky };
2520867995cSHans Petter Selasky static const uint8_t udl_reg_vals_1440x900_75[UDL_MODE_SIZE] = {	/* 136.49 MHz 75.0 Hz */
2530867995cSHans Petter Selasky 	0x00, 0x73, 0xa6, 0x14, 0xea, 0x0a, 0x95, 0xca, 0x10, 0x7f, 0x46, 0xff,
2540867995cSHans Petter Selasky 	0xff, 0x60, 0x3a, 0x05, 0xa0, 0x94, 0x20, 0xff, 0xff, 0xff, 0xf9, 0x03,
2550867995cSHans Petter Selasky 	0x84, 0x04, 0x02, 0xa2, 0x6a
2560867995cSHans Petter Selasky };
2570867995cSHans Petter Selasky static const uint8_t udl_reg_vals_1680x1050_60[UDL_MODE_SIZE] = {	/* 147.14 MHz 60.0 Hz */
2580867995cSHans Petter Selasky 	0x00, 0x53, 0x43, 0xa6, 0x71, 0xc1, 0x52, 0xd9, 0x29, 0x69, 0x9f, 0xff,
2590867995cSHans Petter Selasky 	0xff, 0xd7, 0xee, 0x06, 0x90, 0xb2, 0x53, 0xff, 0xff, 0xff, 0xf9, 0x04,
2600867995cSHans Petter Selasky 	0x1a, 0x04, 0x02, 0xf4, 0x72
2610867995cSHans Petter Selasky };
2620867995cSHans Petter Selasky static const uint8_t udl_reg_vals_1600x1200_60[UDL_MODE_SIZE] = {	/* 162.00 MHz 60.0 Hz
2630867995cSHans Petter Selasky 									 * VESA std */
2640867995cSHans Petter Selasky 	0x00, 0xcf, 0xa4, 0x3c, 0x4e, 0x55, 0x73, 0x71, 0x2b, 0x71, 0x52, 0xff,
2650867995cSHans Petter Selasky 	0xff, 0xee, 0xca, 0x06, 0x40, 0xe2, 0x57, 0xff, 0xff, 0xff, 0xf9, 0x04,
2660867995cSHans Petter Selasky 	0xb0, 0x04, 0x02, 0x90, 0x7e
2670867995cSHans Petter Selasky };
2680867995cSHans Petter Selasky static const uint8_t udl_reg_vals_1920x1080_60[UDL_MODE_SIZE] = {	/* 138.50 MHz 59.9 Hz */
2690867995cSHans Petter Selasky 	0x00, 0x73, 0xa6, 0x28, 0xb3, 0x54, 0xaa, 0x41, 0x5d, 0x0d, 0x9f, 0x32,
2700867995cSHans Petter Selasky 	0x60, 0xff, 0xff, 0x07, 0x80, 0x0a, 0xea, 0xff, 0xf9, 0xff, 0xff, 0x04,
2710867995cSHans Petter Selasky 	0x38, 0x04, 0x02, 0xe0, 0x7c
2720867995cSHans Petter Selasky };
2730867995cSHans Petter Selasky 
2740867995cSHans Petter Selasky struct udl_mode {
2750867995cSHans Petter Selasky 	uint16_t hdisplay;
2760867995cSHans Petter Selasky 	uint16_t vdisplay;
2770867995cSHans Petter Selasky 	uint8_t	hz;
2780867995cSHans Petter Selasky 	uint16_t chip;
2790867995cSHans Petter Selasky 	uint32_t clock;
2800867995cSHans Petter Selasky 	const uint8_t *mode;
2810867995cSHans Petter Selasky };
2820867995cSHans Petter Selasky 
2830867995cSHans Petter Selasky static const struct udl_mode udl_modes[UDL_MAX_MODES] = {
2840867995cSHans Petter Selasky 	{640, 480, 60, DLALL, 2520, udl_reg_vals_640x480_60},
2850867995cSHans Petter Selasky 	{640, 480, 67, DLALL, 3025, udl_reg_vals_640x480_67},
2860867995cSHans Petter Selasky 	{640, 480, 72, DLALL, 3150, udl_reg_vals_640x480_72},
2870867995cSHans Petter Selasky 	{640, 480, 75, DLALL, 3150, udl_reg_vals_640x480_75},
2880867995cSHans Petter Selasky 	{800, 480, 59, DLALL, 5000, udl_reg_vals_800x480_61},
2890867995cSHans Petter Selasky 	{800, 480, 61, DLALL, 3300, udl_reg_vals_800x480_61},
2900867995cSHans Petter Selasky 	{800, 600, 56, DLALL, 3600, udl_reg_vals_800x600_56},
2910867995cSHans Petter Selasky 	{800, 600, 60, DLALL, 4000, udl_reg_vals_800x600_60},
2920867995cSHans Petter Selasky 	{800, 600, 72, DLALL, 5000, udl_reg_vals_800x600_72},
2930867995cSHans Petter Selasky 	{800, 600, 74, DLALL, 5000, udl_reg_vals_800x600_74},
2940867995cSHans Petter Selasky 	{800, 600, 75, DLALL, 4950, udl_reg_vals_800x600_75},
2950867995cSHans Petter Selasky 	{1024, 768, 60, DLALL, 6500, udl_reg_vals_1024x768_60},
2960867995cSHans Petter Selasky 	{1024, 768, 70, DLALL, 7500, udl_reg_vals_1024x768_70},
2970867995cSHans Petter Selasky 	{1024, 768, 75, DLALL, 7850, udl_reg_vals_1024x768_75},
2980867995cSHans Petter Selasky 	{1280, 800, 60, DLALL, 8346, udl_reg_vals_1280x800_60},
2990867995cSHans Petter Selasky 	{1280, 960, 60, DLALL, 10800, udl_reg_vals_1280x960_60},
3000867995cSHans Petter Selasky 	{1280, 1024, 60, DLALL, 10800, udl_reg_vals_1280x1024_60},
3010867995cSHans Petter Selasky 	{1280, 1024, 75, DLALL, 13500, udl_reg_vals_1280x1024_75},
3020867995cSHans Petter Selasky 	{1366, 768, 60, DLALL, 9000, udl_reg_vals_1366x768_60},
3030867995cSHans Petter Selasky 	{1440, 900, 59, DL125, 10650, udl_reg_vals_1440x900_59},
3040867995cSHans Petter Selasky 	{1440, 900, 60, DL125, 10647, udl_reg_vals_1440x900_60},
3050867995cSHans Petter Selasky 	{1440, 900, 75, DL125, 13649, udl_reg_vals_1440x900_75},
3060867995cSHans Petter Selasky 	{1680, 1050, 60, DL160, 14714, udl_reg_vals_1680x1050_60},
3070867995cSHans Petter Selasky 	{1600, 1200, 60, DL160, 16200, udl_reg_vals_1600x1200_60},
3080867995cSHans Petter Selasky 	{1920, 1080, 60, DL165, 13850, udl_reg_vals_1920x1080_60}
3090867995cSHans Petter Selasky };
3100867995cSHans Petter Selasky 
3110867995cSHans Petter Selasky /*
3120867995cSHans Petter Selasky  * Encryption.
3130867995cSHans Petter Selasky  */
3140867995cSHans Petter Selasky static const uint8_t udl_null_key_1[] = {
3150867995cSHans Petter Selasky 	0x57, 0xcd, 0xdc, 0xa7, 0x1c, 0x88, 0x5e, 0x15, 0x60, 0xfe, 0xc6, 0x97,
3160867995cSHans Petter Selasky 	0x16, 0x3d, 0x47, 0xf2
3170867995cSHans Petter Selasky };
3180867995cSHans Petter Selasky 
3190867995cSHans Petter Selasky #endif					/* _UDL_H_ */
320