18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * linux/drivers/video/platinumfb-hw.c -- Frame buffer device for the
38c2ecf20Sopenharmony_ci * Platinum on-board video in PowerMac 7200s (and some clones based
48c2ecf20Sopenharmony_ci * on the same motherboard.)
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci *  Created 09 Feb 1998 by Jon Howell <jonh@cs.dartmouth.edu>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Copyright (C) 1998 Jon Howell
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci *  based on drivers/macintosh/platinum.c: Console support
118c2ecf20Sopenharmony_ci * 	for PowerMac "platinum" display adaptor.
128c2ecf20Sopenharmony_ci *  Copyright (C) 1996 Paul Mackerras and Mark Abene.
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci *  based on skeletonfb.c:
158c2ecf20Sopenharmony_ci *  Created 28 Dec 1997 by Geert Uytterhoeven
168c2ecf20Sopenharmony_ci *
178c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
188c2ecf20Sopenharmony_ci * License.  See the file COPYING in the main directory of this archive
198c2ecf20Sopenharmony_ci * for more details.
208c2ecf20Sopenharmony_ci */
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/*
238c2ecf20Sopenharmony_ci * Structure of the registers for the DACula colormap device.
248c2ecf20Sopenharmony_ci */
258c2ecf20Sopenharmony_cistruct cmap_regs {
268c2ecf20Sopenharmony_ci	unsigned char addr;
278c2ecf20Sopenharmony_ci	char pad1[15];
288c2ecf20Sopenharmony_ci	unsigned char d1;
298c2ecf20Sopenharmony_ci	char pad2[15];
308c2ecf20Sopenharmony_ci	unsigned char d2;
318c2ecf20Sopenharmony_ci	char pad3[15];
328c2ecf20Sopenharmony_ci	unsigned char lut;
338c2ecf20Sopenharmony_ci	char pad4[15];
348c2ecf20Sopenharmony_ci};
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/*
378c2ecf20Sopenharmony_ci * Structure of the registers for the "platinum" display adaptor".
388c2ecf20Sopenharmony_ci */
398c2ecf20Sopenharmony_cistruct preg {			/* padded register */
408c2ecf20Sopenharmony_ci	unsigned r;			/* notice this is 32 bits. */
418c2ecf20Sopenharmony_ci	char pad[12];
428c2ecf20Sopenharmony_ci};
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cistruct platinum_regs {
458c2ecf20Sopenharmony_ci	struct preg reg[128];
468c2ecf20Sopenharmony_ci};
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/*
498c2ecf20Sopenharmony_ci * Register initialization tables for the platinum display.
508c2ecf20Sopenharmony_ci *
518c2ecf20Sopenharmony_ci * It seems that there are two different types of platinum display
528c2ecf20Sopenharmony_ci * out there.  Older ones use the values in clocksel[1], for which
538c2ecf20Sopenharmony_ci * the formula for the clock frequency seems to be
548c2ecf20Sopenharmony_ci *	F = 14.3MHz * c0 / (c1 & 0x1f) / (1 << (c1 >> 5))
558c2ecf20Sopenharmony_ci * Newer ones use the values in clocksel[0], for which the formula
568c2ecf20Sopenharmony_ci * seems to be
578c2ecf20Sopenharmony_ci *	F = 15MHz * c0 / ((c1 & 0x1f) + 2) / (1 << (c1 >> 5))
588c2ecf20Sopenharmony_ci */
598c2ecf20Sopenharmony_cistruct platinum_regvals {
608c2ecf20Sopenharmony_ci	int	fb_offset;
618c2ecf20Sopenharmony_ci	int	pitch[3];
628c2ecf20Sopenharmony_ci	unsigned regs[26];
638c2ecf20Sopenharmony_ci	unsigned char offset[3];
648c2ecf20Sopenharmony_ci	unsigned char mode[3];
658c2ecf20Sopenharmony_ci	unsigned char dacula_ctrl[3];
668c2ecf20Sopenharmony_ci	unsigned char clock_params[2][2];
678c2ecf20Sopenharmony_ci};
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci#define DIV2	0x20
708c2ecf20Sopenharmony_ci#define DIV4	0x40
718c2ecf20Sopenharmony_ci#define DIV8	0x60
728c2ecf20Sopenharmony_ci#define DIV16	0x80
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci/* 1280x1024, 75Hz (20) */
758c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_20 = {
768c2ecf20Sopenharmony_ci	0x5c00,
778c2ecf20Sopenharmony_ci	{ 1312, 2592, 2592 },
788c2ecf20Sopenharmony_ci	{ 0xffc, 4, 0, 0, 0, 0, 0x428, 0,
798c2ecf20Sopenharmony_ci	  0, 0xb3, 0xd3, 0x12, 0x1a5, 0x23, 0x28, 0x2d,
808c2ecf20Sopenharmony_ci	  0x5e, 0x19e, 0x1a4, 0x854, 0x852, 4, 9, 0x50,
818c2ecf20Sopenharmony_ci	  0x850, 0x851 }, { 0x58, 0x5d, 0x5d },
828c2ecf20Sopenharmony_ci	{ 0, 0xff, 0xff }, { 0x51, 0x55, 0x55 },
838c2ecf20Sopenharmony_ci	{{ 45, 3 }, { 66, 7 }}
848c2ecf20Sopenharmony_ci};
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci/* 1280x960, 75Hz (19) */
878c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_19 = {
888c2ecf20Sopenharmony_ci	0x5c00,
898c2ecf20Sopenharmony_ci	{ 1312, 2592, 2592 },
908c2ecf20Sopenharmony_ci	{ 0xffc, 4, 0, 0, 0, 0, 0x428, 0,
918c2ecf20Sopenharmony_ci	  0, 0xb2, 0xd2, 0x12, 0x1a3, 0x23, 0x28, 0x2d,
928c2ecf20Sopenharmony_ci	  0x5c, 0x19c, 0x1a2, 0x7d0, 0x7ce, 4, 9, 0x4c,
938c2ecf20Sopenharmony_ci	  0x7cc, 0x7cd }, { 0x56, 0x5b, 0x5b },
948c2ecf20Sopenharmony_ci	{ 0, 0xff, 0xff }, { 0x51, 0x55, 0x55 },
958c2ecf20Sopenharmony_ci	{{ 42, 3 }, { 44, 5 }}
968c2ecf20Sopenharmony_ci};
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci/* 1152x870, 75Hz (18) */
998c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_18 = {
1008c2ecf20Sopenharmony_ci	0x11b0,
1018c2ecf20Sopenharmony_ci	{ 1184, 2336, 4640 },
1028c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x38f, 0,
1038c2ecf20Sopenharmony_ci	  0, 0x294, 0x16c, 0x20, 0x2d7, 0x3f, 0x49, 0x53,
1048c2ecf20Sopenharmony_ci	  0x82, 0x2c2, 0x2d6, 0x726, 0x724, 4, 9, 0x52,
1058c2ecf20Sopenharmony_ci	  0x71e, 0x722 }, { 0x74, 0x7c, 0x81 },
1068c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
1078c2ecf20Sopenharmony_ci	{{ 26, 0 + DIV2 }, { 42, 6 }}
1088c2ecf20Sopenharmony_ci};
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci/* 1024x768, 75Hz (17) */
1118c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_17 = {
1128c2ecf20Sopenharmony_ci	0x10b0,
1138c2ecf20Sopenharmony_ci	{ 1056, 2080, 4128 },
1148c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x320, 0,
1158c2ecf20Sopenharmony_ci	  0, 0x254, 0x14b, 0x18, 0x295, 0x2f, 0x32, 0x3b,
1168c2ecf20Sopenharmony_ci	  0x80, 0x280, 0x296, 0x648, 0x646, 4, 9, 0x40,
1178c2ecf20Sopenharmony_ci	  0x640, 0x644 }, { 0x72, 0x7a, 0x7f },
1188c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
1198c2ecf20Sopenharmony_ci	{{ 54, 3 + DIV2 }, { 67, 12 }}
1208c2ecf20Sopenharmony_ci};
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci/* 1024x768, 75Hz (16) */
1238c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_16 = {
1248c2ecf20Sopenharmony_ci	0x10b0,
1258c2ecf20Sopenharmony_ci	{ 1056, 2080, 4128 },
1268c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x320, 0,
1278c2ecf20Sopenharmony_ci	  0, 0x250, 0x147, 0x17, 0x28f, 0x2f, 0x35, 0x47,
1288c2ecf20Sopenharmony_ci	  0x82, 0x282, 0x28e, 0x640, 0x63e, 4, 9, 0x3c,
1298c2ecf20Sopenharmony_ci	  0x63c, 0x63d }, { 0x74, 0x7c, 0x81 },
1308c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
1318c2ecf20Sopenharmony_ci	{{ 20, 0 + DIV2 }, { 11, 2 }}
1328c2ecf20Sopenharmony_ci};
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci/* 1024x768, 70Hz (15) */
1358c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_15 = {
1368c2ecf20Sopenharmony_ci	0x10b0,
1378c2ecf20Sopenharmony_ci	{ 1056, 2080, 4128 },
1388c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x320, 0,
1398c2ecf20Sopenharmony_ci	  0, 0x254, 0x14b, 0x22, 0x297, 0x43, 0x49, 0x5b,
1408c2ecf20Sopenharmony_ci	  0x86, 0x286, 0x296, 0x64c, 0x64a, 0xa, 0xf, 0x44,
1418c2ecf20Sopenharmony_ci	  0x644, 0x646 }, { 0x78, 0x80, 0x85 },
1428c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
1438c2ecf20Sopenharmony_ci	{{ 19, 0 + DIV2 }, { 110, 21 }}
1448c2ecf20Sopenharmony_ci};
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci/* 1024x768, 60Hz (14) */
1478c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_14 = {
1488c2ecf20Sopenharmony_ci	0x10b0,
1498c2ecf20Sopenharmony_ci	{ 1056, 2080, 4128 },
1508c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x320, 0,
1518c2ecf20Sopenharmony_ci	  0, 0x25a, 0x14f, 0x22, 0x29f, 0x43, 0x49, 0x5b,
1528c2ecf20Sopenharmony_ci	  0x8e, 0x28e, 0x29e, 0x64c, 0x64a, 0xa, 0xf, 0x44,
1538c2ecf20Sopenharmony_ci	  0x644, 0x646 }, { 0x80, 0x88, 0x8d },
1548c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
1558c2ecf20Sopenharmony_ci	{{ 71, 6 + DIV2 }, { 118, 13 + DIV2 }}
1568c2ecf20Sopenharmony_ci};
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci/* 832x624, 75Hz (13) */
1598c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_13 = {
1608c2ecf20Sopenharmony_ci	0x70,
1618c2ecf20Sopenharmony_ci	{ 864, 1680, 3344 },	/* MacOS does 1680 instead of 1696 to fit 16bpp in 1MB,
1628c2ecf20Sopenharmony_ci				 * and we use 3344 instead of 3360 to fit in 2Mb
1638c2ecf20Sopenharmony_ci				 */
1648c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x299, 0,
1658c2ecf20Sopenharmony_ci	  0, 0x21e, 0x120, 0x10, 0x23f, 0x1f, 0x25, 0x37,
1668c2ecf20Sopenharmony_ci	  0x8a, 0x22a, 0x23e, 0x536, 0x534, 4, 9, 0x52,
1678c2ecf20Sopenharmony_ci	  0x532, 0x533 }, { 0x7c, 0x84, 0x89 },
1688c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
1698c2ecf20Sopenharmony_ci	{{ 30, 0 + DIV4 }, { 56, 7 + DIV2 }}
1708c2ecf20Sopenharmony_ci};
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci/* 800x600, 75Hz (12) */
1738c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_12 = {
1748c2ecf20Sopenharmony_ci	0x1010,
1758c2ecf20Sopenharmony_ci	{ 832, 1632, 3232 },
1768c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x320, 0,
1778c2ecf20Sopenharmony_ci	  0, 0x1ce, 0x108, 0x14, 0x20f, 0x27, 0x30, 0x39,
1788c2ecf20Sopenharmony_ci	  0x72, 0x202, 0x20e, 0x4e2, 0x4e0, 4, 9, 0x2e,
1798c2ecf20Sopenharmony_ci	  0x4de, 0x4df }, { 0x64, 0x6c, 0x71 },
1808c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
1818c2ecf20Sopenharmony_ci	{{ 122, 7 + DIV4 }, { 62, 9 + DIV2 }}
1828c2ecf20Sopenharmony_ci};
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ci/* 800x600, 72Hz (11) */
1858c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_11 = {
1868c2ecf20Sopenharmony_ci	0x1010,
1878c2ecf20Sopenharmony_ci	{ 832, 1632, 3232 },
1888c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x320, 0,
1898c2ecf20Sopenharmony_ci	  0, 0x1ca, 0x104, 0x1e, 0x207, 0x3b, 0x44, 0x4d,
1908c2ecf20Sopenharmony_ci	  0x56, 0x1e6, 0x206, 0x534, 0x532, 0xa, 0xe, 0x38,
1918c2ecf20Sopenharmony_ci	  0x4e8, 0x4ec }, { 0x48, 0x50, 0x55 },
1928c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
1938c2ecf20Sopenharmony_ci	{{ 26, 0 + DIV4 }, { 42, 6 + DIV2 }}
1948c2ecf20Sopenharmony_ci};
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci/* 800x600, 60Hz (10) */
1978c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_10 = {
1988c2ecf20Sopenharmony_ci	0x1010,
1998c2ecf20Sopenharmony_ci	{ 832, 1632, 3232 },
2008c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x320, 0,
2018c2ecf20Sopenharmony_ci	  0, 0x1ce, 0x108, 0x20, 0x20f, 0x3f, 0x45, 0x5d,
2028c2ecf20Sopenharmony_ci	  0x66, 0x1f6, 0x20e, 0x4e8, 0x4e6, 6, 0xa, 0x34,
2038c2ecf20Sopenharmony_ci	  0x4e4, 0x4e5 }, { 0x58, 0x60, 0x65 },
2048c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
2058c2ecf20Sopenharmony_ci	{{ 54, 3 + DIV4 }, { 95, 1 + DIV8 }}
2068c2ecf20Sopenharmony_ci};
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci/* 800x600, 56Hz (9) --unsupported? copy of mode 10 for now... */
2098c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_9 = {
2108c2ecf20Sopenharmony_ci	0x1010,
2118c2ecf20Sopenharmony_ci	{ 832, 1632, 3232 },
2128c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x320, 0,
2138c2ecf20Sopenharmony_ci	  0, 0x1ce, 0x108, 0x20, 0x20f, 0x3f, 0x45, 0x5d,
2148c2ecf20Sopenharmony_ci	  0x66, 0x1f6, 0x20e, 0x4e8, 0x4e6, 6, 0xa, 0x34,
2158c2ecf20Sopenharmony_ci	  0x4e4, 0x4e5 }, { 0x58, 0x60, 0x65 },
2168c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
2178c2ecf20Sopenharmony_ci	{{ 54, 3 + DIV4 }, { 88, 1 + DIV8 }}
2188c2ecf20Sopenharmony_ci};
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci/* 768x576, 50Hz Interlaced-PAL (8) */
2218c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_8 = {
2228c2ecf20Sopenharmony_ci	0x1010,
2238c2ecf20Sopenharmony_ci	{ 800, 1568, 3104 },
2248c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x320, 0,
2258c2ecf20Sopenharmony_ci	  0, 0xc8, 0xec, 0x11, 0x1d7, 0x22, 0x25, 0x36,
2268c2ecf20Sopenharmony_ci	  0x47, 0x1c7, 0x1d6, 0x271, 0x270, 4, 9, 0x27,
2278c2ecf20Sopenharmony_ci	  0x267, 0x26b }, { 0x39, 0x41, 0x46 },
2288c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
2298c2ecf20Sopenharmony_ci	{{ 31, 0 + DIV16 }, { 74, 9 + DIV8 }}
2308c2ecf20Sopenharmony_ci};
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci/* 640x870, 75Hz Portrait (7) */
2338c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_7 = {
2348c2ecf20Sopenharmony_ci	0xb10,
2358c2ecf20Sopenharmony_ci	{ 672, 1312, 2592 },
2368c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x320, 0,
2378c2ecf20Sopenharmony_ci	  0, 0x176, 0xd0, 0x14, 0x19f, 0x27, 0x2d, 0x3f,
2388c2ecf20Sopenharmony_ci	  0x4a, 0x18a, 0x19e, 0x72c, 0x72a, 4, 9, 0x58,
2398c2ecf20Sopenharmony_ci	  0x724, 0x72a }, { 0x3c, 0x44, 0x49 },
2408c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
2418c2ecf20Sopenharmony_ci	{{ 30, 0 + DIV4 }, { 56, 7 + DIV2 }}
2428c2ecf20Sopenharmony_ci};
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci/* 640x480, 67Hz (6) */
2458c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_6 = {
2468c2ecf20Sopenharmony_ci	0x1010,
2478c2ecf20Sopenharmony_ci	{ 672, 1312, 2592 },
2488c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x209, 0,
2498c2ecf20Sopenharmony_ci	  0, 0x18e, 0xd8, 0x10, 0x1af, 0x1f, 0x25, 0x37,
2508c2ecf20Sopenharmony_ci	  0x4a, 0x18a, 0x1ae, 0x41a, 0x418, 4, 9, 0x52,
2518c2ecf20Sopenharmony_ci	  0x412, 0x416 }, { 0x3c, 0x44, 0x49 },
2528c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
2538c2ecf20Sopenharmony_ci	{{ 99, 4 + DIV8 }, { 42, 5 + DIV4 }}
2548c2ecf20Sopenharmony_ci};
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_ci/* 640x480, 60Hz (5) */
2578c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_5 = {
2588c2ecf20Sopenharmony_ci	0x1010,
2598c2ecf20Sopenharmony_ci	{ 672, 1312, 2592 },
2608c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x320, 0,
2618c2ecf20Sopenharmony_ci	  0, 0x15e, 0xc8, 0x18, 0x18f, 0x2f, 0x35, 0x3e,
2628c2ecf20Sopenharmony_ci	  0x42, 0x182, 0x18e, 0x41a, 0x418, 2, 7, 0x44,
2638c2ecf20Sopenharmony_ci	  0x404, 0x408 }, { 0x34, 0x3c, 0x41 },
2648c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
2658c2ecf20Sopenharmony_ci	{{ 26, 0 + DIV8 }, { 14, 2 + DIV4 }}
2668c2ecf20Sopenharmony_ci};
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci/* 640x480, 60Hz Interlaced-NTSC (4) */
2698c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_4 = {
2708c2ecf20Sopenharmony_ci	0x1010,
2718c2ecf20Sopenharmony_ci	{ 672, 1312, 2592 },
2728c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x320, 0,
2738c2ecf20Sopenharmony_ci	  0, 0xa5, 0xc3, 0xe, 0x185, 0x1c, 0x1f, 0x30,
2748c2ecf20Sopenharmony_ci	  0x37, 0x177, 0x184, 0x20d, 0x20c, 5, 0xb, 0x23,
2758c2ecf20Sopenharmony_ci	  0x203, 0x206 }, { 0x29, 0x31, 0x36 },
2768c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
2778c2ecf20Sopenharmony_ci	{{ 94, 5 + DIV16 }, { 48, 7 + DIV8 }}
2788c2ecf20Sopenharmony_ci};
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci/* 640x480, 50Hz Interlaced-PAL (3) */
2818c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_3 = {
2828c2ecf20Sopenharmony_ci	0x1010,
2838c2ecf20Sopenharmony_ci	{ 672, 1312, 2592 },
2848c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x320, 0,
2858c2ecf20Sopenharmony_ci	  0, 0xc8, 0xec, 0x11, 0x1d7, 0x22, 0x25, 0x36,
2868c2ecf20Sopenharmony_ci	  0x67, 0x1a7, 0x1d6, 0x271, 0x270, 4, 9, 0x57,
2878c2ecf20Sopenharmony_ci	  0x237, 0x26b }, { 0x59, 0x61, 0x66 },
2888c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
2898c2ecf20Sopenharmony_ci	{{ 31, 0 + DIV16 }, { 74, 9 + DIV8 }}
2908c2ecf20Sopenharmony_ci};
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ci/* 512x384, 60Hz (2) */
2938c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_2 = {
2948c2ecf20Sopenharmony_ci	0x1010,
2958c2ecf20Sopenharmony_ci	{ 544, 1056, 2080 },
2968c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x320, 0,
2978c2ecf20Sopenharmony_ci	  0, 0x25c, 0x140, 0x10, 0x27f, 0x1f, 0x2b, 0x4f,
2988c2ecf20Sopenharmony_ci	  0x68, 0x268, 0x27e, 0x32e, 0x32c, 4, 9, 0x2a,
2998c2ecf20Sopenharmony_ci	  0x32a, 0x32b }, { 0x5a, 0x62, 0x67 },
3008c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
3018c2ecf20Sopenharmony_ci	{{ 33, 2 + DIV8 }, { 79, 9 + DIV8 }}
3028c2ecf20Sopenharmony_ci};
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci/* 512x384, 60Hz Interlaced-NTSC (1) */
3058c2ecf20Sopenharmony_cistatic struct platinum_regvals platinum_reg_init_1 = {
3068c2ecf20Sopenharmony_ci	0x1010,
3078c2ecf20Sopenharmony_ci	{ 544, 1056, 2080 },
3088c2ecf20Sopenharmony_ci	{ 0xff0, 4, 0, 0, 0, 0, 0x320, 0,
3098c2ecf20Sopenharmony_ci	  0, 0xa5, 0xc3, 0xe, 0x185, 0x1c, 0x1f, 0x30,
3108c2ecf20Sopenharmony_ci	  0x57, 0x157, 0x184, 0x20d, 0x20c, 5, 0xb, 0x53,
3118c2ecf20Sopenharmony_ci	  0x1d3, 0x206 }, { 0x49, 0x51, 0x56 },
3128c2ecf20Sopenharmony_ci	{ 2, 0, 0xff }, { 0x11, 0x15, 0x19 },
3138c2ecf20Sopenharmony_ci	{{ 94, 5 + DIV16 }, { 48, 7 + DIV8 }}
3148c2ecf20Sopenharmony_ci};
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_cistatic struct platinum_regvals *platinum_reg_init[VMODE_MAX] = {
3178c2ecf20Sopenharmony_ci	&platinum_reg_init_1,
3188c2ecf20Sopenharmony_ci	&platinum_reg_init_2,
3198c2ecf20Sopenharmony_ci	&platinum_reg_init_3,
3208c2ecf20Sopenharmony_ci	&platinum_reg_init_4,
3218c2ecf20Sopenharmony_ci	&platinum_reg_init_5,
3228c2ecf20Sopenharmony_ci	&platinum_reg_init_6,
3238c2ecf20Sopenharmony_ci	&platinum_reg_init_7,
3248c2ecf20Sopenharmony_ci	&platinum_reg_init_8,
3258c2ecf20Sopenharmony_ci	&platinum_reg_init_9,
3268c2ecf20Sopenharmony_ci	&platinum_reg_init_10,
3278c2ecf20Sopenharmony_ci	&platinum_reg_init_11,
3288c2ecf20Sopenharmony_ci	&platinum_reg_init_12,
3298c2ecf20Sopenharmony_ci	&platinum_reg_init_13,
3308c2ecf20Sopenharmony_ci	&platinum_reg_init_14,
3318c2ecf20Sopenharmony_ci	&platinum_reg_init_15,
3328c2ecf20Sopenharmony_ci	&platinum_reg_init_16,
3338c2ecf20Sopenharmony_ci	&platinum_reg_init_17,
3348c2ecf20Sopenharmony_ci	&platinum_reg_init_18,
3358c2ecf20Sopenharmony_ci	&platinum_reg_init_19,
3368c2ecf20Sopenharmony_ci	&platinum_reg_init_20
3378c2ecf20Sopenharmony_ci};
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_cistruct vmode_attr {
3408c2ecf20Sopenharmony_ci	int hres;
3418c2ecf20Sopenharmony_ci	int vres;
3428c2ecf20Sopenharmony_ci	int vfreq;
3438c2ecf20Sopenharmony_ci	int interlaced;
3448c2ecf20Sopenharmony_ci};
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_cistruct vmode_attr vmode_attrs[VMODE_MAX] = {
3478c2ecf20Sopenharmony_ci	{512, 384, 60, 1},
3488c2ecf20Sopenharmony_ci	{512, 384, 60},
3498c2ecf20Sopenharmony_ci	{640, 480, 50, 1},
3508c2ecf20Sopenharmony_ci	{640, 480, 60, 1},
3518c2ecf20Sopenharmony_ci	{640, 480, 60},
3528c2ecf20Sopenharmony_ci	{640, 480, 67},
3538c2ecf20Sopenharmony_ci	{640, 870, 75},
3548c2ecf20Sopenharmony_ci	{768, 576, 50, 1},
3558c2ecf20Sopenharmony_ci	{800, 600, 56},
3568c2ecf20Sopenharmony_ci	{800, 600, 60},
3578c2ecf20Sopenharmony_ci	{800, 600, 72},
3588c2ecf20Sopenharmony_ci	{800, 600, 75},
3598c2ecf20Sopenharmony_ci	{832, 624, 75},
3608c2ecf20Sopenharmony_ci	{1024, 768, 60},
3618c2ecf20Sopenharmony_ci	{1024, 768, 72},
3628c2ecf20Sopenharmony_ci	{1024, 768, 75},
3638c2ecf20Sopenharmony_ci	{1024, 768, 75},
3648c2ecf20Sopenharmony_ci	{1152, 870, 75},
3658c2ecf20Sopenharmony_ci	{1280, 960, 75},
3668c2ecf20Sopenharmony_ci	{1280, 1024, 75}
3678c2ecf20Sopenharmony_ci};
3688c2ecf20Sopenharmony_ci
369