some init script cleanup
[openadk.git] / target / mips64 / lemote-yeelong / patches / 3.18.12 / sm7xx-fb.patch
bloba2b95433738ffd988cabc7e9e6b5196d042175a1
1 diff -Nur linux-3.18.12.orig/drivers/staging/Kconfig linux-3.18.12/drivers/staging/Kconfig
2 --- linux-3.18.12.orig/drivers/staging/Kconfig 2015-04-20 14:48:02.000000000 -0500
3 +++ linux-3.18.12/drivers/staging/Kconfig 2015-05-02 10:04:55.623427001 -0500
4 @@ -58,6 +58,8 @@
6 source "drivers/staging/iio/Kconfig"
8 +source "drivers/staging/sm7xxfb/Kconfig"
10 source "drivers/staging/xgifb/Kconfig"
12 source "drivers/staging/emxx_udc/Kconfig"
13 diff -Nur linux-3.18.12.orig/drivers/staging/Kconfig.orig linux-3.18.12/drivers/staging/Kconfig.orig
14 --- linux-3.18.12.orig/drivers/staging/Kconfig.orig 1969-12-31 18:00:00.000000000 -0600
15 +++ linux-3.18.12/drivers/staging/Kconfig.orig 2015-04-20 14:48:02.000000000 -0500
16 @@ -0,0 +1,111 @@
17 +menuconfig STAGING
18 + bool "Staging drivers"
19 + default n
20 + ---help---
21 + This option allows you to select a number of drivers that are
22 + not of the "normal" Linux kernel quality level. These drivers
23 + are placed here in order to get a wider audience to make use of
24 + them. Please note that these drivers are under heavy
25 + development, may or may not work, and may contain userspace
26 + interfaces that most likely will be changed in the near
27 + future.
29 + Using any of these drivers will taint your kernel which might
30 + affect support options from both the community, and various
31 + commercial support organizations.
33 + If you wish to work on these drivers, to help improve them, or
34 + to report problems you have with them, please see the
35 + driver_name.README file in the drivers/staging/ directory to
36 + see what needs to be worked on, and who to contact.
38 + If in doubt, say N here.
41 +if STAGING
43 +source "drivers/staging/slicoss/Kconfig"
45 +source "drivers/staging/wlan-ng/Kconfig"
47 +source "drivers/staging/comedi/Kconfig"
49 +source "drivers/staging/olpc_dcon/Kconfig"
51 +source "drivers/staging/panel/Kconfig"
53 +source "drivers/staging/rtl8192u/Kconfig"
55 +source "drivers/staging/rtl8192e/Kconfig"
57 +source "drivers/staging/rtl8712/Kconfig"
59 +source "drivers/staging/rtl8188eu/Kconfig"
61 +source "drivers/staging/rtl8723au/Kconfig"
63 +source "drivers/staging/rts5208/Kconfig"
65 +source "drivers/staging/line6/Kconfig"
67 +source "drivers/staging/octeon/Kconfig"
69 +source "drivers/staging/octeon-usb/Kconfig"
71 +source "drivers/staging/vt6655/Kconfig"
73 +source "drivers/staging/vt6656/Kconfig"
75 +source "drivers/staging/iio/Kconfig"
77 +source "drivers/staging/xgifb/Kconfig"
79 +source "drivers/staging/emxx_udc/Kconfig"
81 +source "drivers/staging/bcm/Kconfig"
83 +source "drivers/staging/ft1000/Kconfig"
85 +source "drivers/staging/speakup/Kconfig"
87 +source "drivers/staging/cptm1217/Kconfig"
89 +source "drivers/staging/ste_rmi4/Kconfig"
91 +source "drivers/staging/nvec/Kconfig"
93 +source "drivers/staging/media/Kconfig"
95 +source "drivers/staging/android/Kconfig"
97 +source "drivers/staging/board/Kconfig"
99 +source "drivers/staging/ozwpan/Kconfig"
101 +source "drivers/staging/gdm72xx/Kconfig"
103 +source "drivers/staging/gdm724x/Kconfig"
105 +source "drivers/staging/imx-drm/Kconfig"
107 +source "drivers/staging/fwserial/Kconfig"
109 +source "drivers/staging/goldfish/Kconfig"
111 +source "drivers/staging/netlogic/Kconfig"
113 +source "drivers/staging/mt29f_spinand/Kconfig"
115 +source "drivers/staging/lustre/Kconfig"
117 +source "drivers/staging/dgnc/Kconfig"
119 +source "drivers/staging/dgap/Kconfig"
121 +source "drivers/staging/gs_fpgaboot/Kconfig"
123 +source "drivers/staging/skein/Kconfig"
125 +source "drivers/staging/unisys/Kconfig"
127 +endif # STAGING
128 diff -Nur linux-3.18.12.orig/drivers/staging/Makefile linux-3.18.12/drivers/staging/Makefile
129 --- linux-3.18.12.orig/drivers/staging/Makefile 2015-04-20 14:48:02.000000000 -0500
130 +++ linux-3.18.12/drivers/staging/Makefile 2015-05-02 10:04:55.623427001 -0500
131 @@ -24,6 +24,7 @@
132 obj-$(CONFIG_VME_BUS) += vme/
133 obj-$(CONFIG_IIO) += iio/
134 obj-$(CONFIG_FB_XGI) += xgifb/
135 +obj-$(CONFIG_FB_SM7XX) += sm7xxfb/
136 obj-$(CONFIG_USB_EMXX) += emxx_udc/
137 obj-$(CONFIG_BCM_WIMAX) += bcm/
138 obj-$(CONFIG_FT1000) += ft1000/
139 diff -Nur linux-3.18.12.orig/drivers/staging/Makefile.orig linux-3.18.12/drivers/staging/Makefile.orig
140 --- linux-3.18.12.orig/drivers/staging/Makefile.orig 1969-12-31 18:00:00.000000000 -0600
141 +++ linux-3.18.12/drivers/staging/Makefile.orig 2015-04-20 14:48:02.000000000 -0500
142 @@ -0,0 +1,48 @@
143 +# Makefile for staging directory
145 +# fix for build system bug...
146 +obj-$(CONFIG_STAGING) += staging.o
148 +obj-y += media/
149 +obj-$(CONFIG_SLICOSS) += slicoss/
150 +obj-$(CONFIG_PRISM2_USB) += wlan-ng/
151 +obj-$(CONFIG_COMEDI) += comedi/
152 +obj-$(CONFIG_FB_OLPC_DCON) += olpc_dcon/
153 +obj-$(CONFIG_PANEL) += panel/
154 +obj-$(CONFIG_RTL8192U) += rtl8192u/
155 +obj-$(CONFIG_RTL8192E) += rtl8192e/
156 +obj-$(CONFIG_R8712U) += rtl8712/
157 +obj-$(CONFIG_R8188EU) += rtl8188eu/
158 +obj-$(CONFIG_R8723AU) += rtl8723au/
159 +obj-$(CONFIG_RTS5208) += rts5208/
160 +obj-$(CONFIG_LINE6_USB) += line6/
161 +obj-$(CONFIG_NETLOGIC_XLR_NET) += netlogic/
162 +obj-$(CONFIG_OCTEON_ETHERNET) += octeon/
163 +obj-$(CONFIG_OCTEON_USB) += octeon-usb/
164 +obj-$(CONFIG_VT6655) += vt6655/
165 +obj-$(CONFIG_VT6656) += vt6656/
166 +obj-$(CONFIG_VME_BUS) += vme/
167 +obj-$(CONFIG_IIO) += iio/
168 +obj-$(CONFIG_FB_XGI) += xgifb/
169 +obj-$(CONFIG_USB_EMXX) += emxx_udc/
170 +obj-$(CONFIG_BCM_WIMAX) += bcm/
171 +obj-$(CONFIG_FT1000) += ft1000/
172 +obj-$(CONFIG_SPEAKUP) += speakup/
173 +obj-$(CONFIG_TOUCHSCREEN_CLEARPAD_TM1217) += cptm1217/
174 +obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += ste_rmi4/
175 +obj-$(CONFIG_MFD_NVEC) += nvec/
176 +obj-$(CONFIG_ANDROID) += android/
177 +obj-$(CONFIG_STAGING_BOARD) += board/
178 +obj-$(CONFIG_USB_WPAN_HCD) += ozwpan/
179 +obj-$(CONFIG_WIMAX_GDM72XX) += gdm72xx/
180 +obj-$(CONFIG_LTE_GDM724X) += gdm724x/
181 +obj-$(CONFIG_DRM_IMX) += imx-drm/
182 +obj-$(CONFIG_FIREWIRE_SERIAL) += fwserial/
183 +obj-$(CONFIG_GOLDFISH) += goldfish/
184 +obj-$(CONFIG_LUSTRE_FS) += lustre/
185 +obj-$(CONFIG_DGNC) += dgnc/
186 +obj-$(CONFIG_DGAP) += dgap/
187 +obj-$(CONFIG_MTD_SPINAND_MT29F) += mt29f_spinand/
188 +obj-$(CONFIG_GS_FPGABOOT) += gs_fpgaboot/
189 +obj-$(CONFIG_CRYPTO_SKEIN) += skein/
190 +obj-$(CONFIG_UNISYSSPAR) += unisys/
191 diff -Nur linux-3.18.12.orig/drivers/staging/sm7xxfb/Kconfig linux-3.18.12/drivers/staging/sm7xxfb/Kconfig
192 --- linux-3.18.12.orig/drivers/staging/sm7xxfb/Kconfig 1969-12-31 18:00:00.000000000 -0600
193 +++ linux-3.18.12/drivers/staging/sm7xxfb/Kconfig 2015-05-02 10:04:55.623427001 -0500
194 @@ -0,0 +1,13 @@
195 +config FB_SM7XX
196 + tristate "Silicon Motion SM7XX framebuffer support"
197 + depends on FB && PCI
198 + select FB_CFB_FILLRECT
199 + select FB_CFB_COPYAREA
200 + select FB_CFB_IMAGEBLIT
201 + help
202 + Frame buffer driver for the Silicon Motion SM710, SM712, SM721
203 + and SM722 chips.
205 + This driver is also available as a module. The module will be
206 + called sm7xxfb. If you want to compile it as a module, say M
207 + here and read <file:Documentation/kbuild/modules.txt>.
208 diff -Nur linux-3.18.12.orig/drivers/staging/sm7xxfb/Makefile linux-3.18.12/drivers/staging/sm7xxfb/Makefile
209 --- linux-3.18.12.orig/drivers/staging/sm7xxfb/Makefile 1969-12-31 18:00:00.000000000 -0600
210 +++ linux-3.18.12/drivers/staging/sm7xxfb/Makefile 2015-05-02 10:04:55.623427001 -0500
211 @@ -0,0 +1 @@
212 +obj-$(CONFIG_FB_SM7XX) += sm7xxfb.o
213 diff -Nur linux-3.18.12.orig/drivers/staging/sm7xxfb/sm7xxfb.c linux-3.18.12/drivers/staging/sm7xxfb/sm7xxfb.c
214 --- linux-3.18.12.orig/drivers/staging/sm7xxfb/sm7xxfb.c 1969-12-31 18:00:00.000000000 -0600
215 +++ linux-3.18.12/drivers/staging/sm7xxfb/sm7xxfb.c 2015-05-02 10:04:55.627427001 -0500
216 @@ -0,0 +1,1026 @@
218 + * Silicon Motion SM7XX frame buffer device
220 + * Copyright (C) 2006 Silicon Motion Technology Corp.
221 + * Authors: Ge Wang, gewang@siliconmotion.com
222 + * Boyod boyod.yang@siliconmotion.com.cn
224 + * Copyright (C) 2009 Lemote, Inc.
225 + * Author: Wu Zhangjin, wuzhangjin@gmail.com
227 + * Copyright (C) 2011 Igalia, S.L.
228 + * Author: Javier M. Mellid <jmunhoz@igalia.com>
230 + * This file is subject to the terms and conditions of the GNU General Public
231 + * License. See the file COPYING in the main directory of this archive for
232 + * more details.
234 + * Framebuffer driver for Silicon Motion SM710, SM712, SM721 and SM722 chips
235 + */
237 +#include <linux/io.h>
238 +#include <linux/fb.h>
239 +#include <linux/pci.h>
240 +#include <linux/init.h>
241 +#include <linux/slab.h>
242 +#include <linux/uaccess.h>
243 +#include <linux/module.h>
244 +#include <linux/console.h>
245 +#include <linux/screen_info.h>
247 +#ifdef CONFIG_PM
248 +#include <linux/pm.h>
249 +#endif
251 +#include "sm7xx.h"
254 +* Private structure
256 +struct smtcfb_info {
257 + struct pci_dev *pdev;
258 + struct fb_info fb;
259 + u16 chip_id;
260 + u8 chip_rev_id;
262 + void __iomem *lfb; /* linear frame buffer */
263 + void __iomem *dp_regs; /* drawing processor control regs */
264 + void __iomem *vp_regs; /* video processor control regs */
265 + void __iomem *cp_regs; /* capture processor control regs */
266 + void __iomem *mmio; /* memory map IO port */
268 + u_int width;
269 + u_int height;
270 + u_int hz;
272 + u32 colreg[17];
275 +void __iomem *smtc_RegBaseAddress; /* Memory Map IO starting address */
277 +static struct fb_var_screeninfo smtcfb_var = {
278 + .xres = 1024,
279 + .yres = 600,
280 + .xres_virtual = 1024,
281 + .yres_virtual = 600,
282 + .bits_per_pixel = 16,
283 + .red = {16, 8, 0},
284 + .green = {8, 8, 0},
285 + .blue = {0, 8, 0},
286 + .activate = FB_ACTIVATE_NOW,
287 + .height = -1,
288 + .width = -1,
289 + .vmode = FB_VMODE_NONINTERLACED,
290 + .nonstd = 0,
291 + .accel_flags = FB_ACCELF_TEXT,
294 +static struct fb_fix_screeninfo smtcfb_fix = {
295 + .id = "smXXXfb",
296 + .type = FB_TYPE_PACKED_PIXELS,
297 + .visual = FB_VISUAL_TRUECOLOR,
298 + .line_length = 800 * 3,
299 + .accel = FB_ACCEL_SMI_LYNX,
300 + .type_aux = 0,
301 + .xpanstep = 0,
302 + .ypanstep = 0,
303 + .ywrapstep = 0,
306 +struct vesa_mode {
307 + char index[6];
308 + u16 lfb_width;
309 + u16 lfb_height;
310 + u16 lfb_depth;
313 +static struct vesa_mode vesa_mode_table[] = {
314 + {"0x301", 640, 480, 8},
315 + {"0x303", 800, 600, 8},
316 + {"0x305", 1024, 768, 8},
317 + {"0x307", 1280, 1024, 8},
319 + {"0x311", 640, 480, 16},
320 + {"0x314", 800, 600, 16},
321 + {"0x317", 1024, 768, 16},
322 + {"0x31A", 1280, 1024, 16},
324 + {"0x312", 640, 480, 24},
325 + {"0x315", 800, 600, 24},
326 + {"0x318", 1024, 768, 24},
327 + {"0x31B", 1280, 1024, 24},
330 +struct screen_info smtc_scr_info;
332 +/* process command line options, get vga parameter */
333 +static int __init sm7xx_vga_setup(char *options)
335 + int i;
337 + if (!options || !*options)
338 + return -EINVAL;
340 + smtc_scr_info.lfb_width = 0;
341 + smtc_scr_info.lfb_height = 0;
342 + smtc_scr_info.lfb_depth = 0;
344 + pr_debug("sm7xx_vga_setup = %s\n", options);
346 + for (i = 0; i < ARRAY_SIZE(vesa_mode_table); i++) {
347 + if (strstr(options, vesa_mode_table[i].index)) {
348 + smtc_scr_info.lfb_width = vesa_mode_table[i].lfb_width;
349 + smtc_scr_info.lfb_height =
350 + vesa_mode_table[i].lfb_height;
351 + smtc_scr_info.lfb_depth = vesa_mode_table[i].lfb_depth;
352 + return 0;
356 + return -1;
358 +__setup("vga=", sm7xx_vga_setup);
360 +static void sm712_setpalette(int regno, unsigned red, unsigned green,
361 + unsigned blue, struct fb_info *info)
363 + /* set bit 5:4 = 01 (write LCD RAM only) */
364 + smtc_seqw(0x66, (smtc_seqr(0x66) & 0xC3) | 0x10);
366 + smtc_mmiowb(regno, dac_reg);
367 + smtc_mmiowb(red >> 10, dac_val);
368 + smtc_mmiowb(green >> 10, dac_val);
369 + smtc_mmiowb(blue >> 10, dac_val);
372 +/* chan_to_field
374 + * convert a colour value into a field position
376 + * from pxafb.c
377 + */
379 +static inline unsigned int chan_to_field(unsigned int chan,
380 + struct fb_bitfield *bf)
382 + chan &= 0xffff;
383 + chan >>= 16 - bf->length;
384 + return chan << bf->offset;
387 +static int smtc_blank(int blank_mode, struct fb_info *info)
389 + /* clear DPMS setting */
390 + switch (blank_mode) {
391 + case FB_BLANK_UNBLANK:
392 + /* Screen On: HSync: On, VSync : On */
393 + smtc_seqw(0x01, (smtc_seqr(0x01) & (~0x20)));
394 + smtc_seqw(0x6a, 0x16);
395 + smtc_seqw(0x6b, 0x02);
396 + smtc_seqw(0x21, (smtc_seqr(0x21) & 0x77));
397 + smtc_seqw(0x22, (smtc_seqr(0x22) & (~0x30)));
398 + smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0)));
399 + smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01));
400 + smtc_seqw(0x31, (smtc_seqr(0x31) | 0x03));
401 + break;
402 + case FB_BLANK_NORMAL:
403 + /* Screen Off: HSync: On, VSync : On Soft blank */
404 + smtc_seqw(0x01, (smtc_seqr(0x01) & (~0x20)));
405 + smtc_seqw(0x6a, 0x16);
406 + smtc_seqw(0x6b, 0x02);
407 + smtc_seqw(0x22, (smtc_seqr(0x22) & (~0x30)));
408 + smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0)));
409 + smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01));
410 + smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
411 + break;
412 + case FB_BLANK_VSYNC_SUSPEND:
413 + /* Screen On: HSync: On, VSync : Off */
414 + smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20));
415 + smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
416 + smtc_seqw(0x6a, 0x0c);
417 + smtc_seqw(0x6b, 0x02);
418 + smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88));
419 + smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x20));
420 + smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0x20));
421 + smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
422 + smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
423 + smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80));
424 + break;
425 + case FB_BLANK_HSYNC_SUSPEND:
426 + /* Screen On: HSync: Off, VSync : On */
427 + smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20));
428 + smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
429 + smtc_seqw(0x6a, 0x0c);
430 + smtc_seqw(0x6b, 0x02);
431 + smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88));
432 + smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x10));
433 + smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8));
434 + smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
435 + smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
436 + smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80));
437 + break;
438 + case FB_BLANK_POWERDOWN:
439 + /* Screen On: HSync: Off, VSync : Off */
440 + smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20));
441 + smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
442 + smtc_seqw(0x6a, 0x0c);
443 + smtc_seqw(0x6b, 0x02);
444 + smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88));
445 + smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x30));
446 + smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8));
447 + smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
448 + smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
449 + smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80));
450 + break;
451 + default:
452 + return -EINVAL;
455 + return 0;
458 +static int smtc_setcolreg(unsigned regno, unsigned red, unsigned green,
459 + unsigned blue, unsigned trans, struct fb_info *info)
461 + struct smtcfb_info *sfb;
462 + u32 val;
464 + sfb = info->par;
466 + if (regno > 255)
467 + return 1;
469 + switch (sfb->fb.fix.visual) {
470 + case FB_VISUAL_DIRECTCOLOR:
471 + case FB_VISUAL_TRUECOLOR:
472 + /*
473 + * 16/32 bit true-colour, use pseudo-palette for 16 base color
474 + */
475 + if (regno < 16) {
476 + if (sfb->fb.var.bits_per_pixel == 16) {
477 + u32 *pal = sfb->fb.pseudo_palette;
478 + val = chan_to_field(red, &sfb->fb.var.red);
479 + val |= chan_to_field(green, &sfb->fb.var.green);
480 + val |= chan_to_field(blue, &sfb->fb.var.blue);
481 +#ifdef __BIG_ENDIAN
482 + pal[regno] =
483 + ((red & 0xf800) >> 8) |
484 + ((green & 0xe000) >> 13) |
485 + ((green & 0x1c00) << 3) |
486 + ((blue & 0xf800) >> 3);
487 +#else
488 + pal[regno] = val;
489 +#endif
490 + } else {
491 + u32 *pal = sfb->fb.pseudo_palette;
492 + val = chan_to_field(red, &sfb->fb.var.red);
493 + val |= chan_to_field(green, &sfb->fb.var.green);
494 + val |= chan_to_field(blue, &sfb->fb.var.blue);
495 +#ifdef __BIG_ENDIAN
496 + val =
497 + (val & 0xff00ff00 >> 8) |
498 + (val & 0x00ff00ff << 8);
499 +#endif
500 + pal[regno] = val;
503 + break;
505 + case FB_VISUAL_PSEUDOCOLOR:
506 + /* color depth 8 bit */
507 + sm712_setpalette(regno, red, green, blue, info);
508 + break;
510 + default:
511 + return 1; /* unknown type */
514 + return 0;
518 +#ifdef __BIG_ENDIAN
519 +static ssize_t smtcfb_read(struct fb_info *info, char __user *buf, size_t
520 + count, loff_t *ppos)
522 + unsigned long p = *ppos;
524 + u32 *buffer, *dst;
525 + u32 __iomem *src;
526 + int c, i, cnt = 0, err = 0;
527 + unsigned long total_size;
529 + if (!info || !info->screen_base)
530 + return -ENODEV;
532 + if (info->state != FBINFO_STATE_RUNNING)
533 + return -EPERM;
535 + total_size = info->screen_size;
537 + if (total_size == 0)
538 + total_size = info->fix.smem_len;
540 + if (p >= total_size)
541 + return 0;
543 + if (count >= total_size)
544 + count = total_size;
546 + if (count + p > total_size)
547 + count = total_size - p;
549 + buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL);
550 + if (!buffer)
551 + return -ENOMEM;
553 + src = (u32 __iomem *) (info->screen_base + p);
555 + if (info->fbops->fb_sync)
556 + info->fbops->fb_sync(info);
558 + while (count) {
559 + c = (count > PAGE_SIZE) ? PAGE_SIZE : count;
560 + dst = buffer;
561 + for (i = c >> 2; i--;) {
562 + *dst = fb_readl(src++);
563 + *dst =
564 + (*dst & 0xff00ff00 >> 8) |
565 + (*dst & 0x00ff00ff << 8);
566 + dst++;
568 + if (c & 3) {
569 + u8 *dst8 = (u8 *) dst;
570 + u8 __iomem *src8 = (u8 __iomem *) src;
572 + for (i = c & 3; i--;) {
573 + if (i & 1) {
574 + *dst8++ = fb_readb(++src8);
575 + } else {
576 + *dst8++ = fb_readb(--src8);
577 + src8 += 2;
580 + src = (u32 __iomem *) src8;
583 + if (copy_to_user(buf, buffer, c)) {
584 + err = -EFAULT;
585 + break;
587 + *ppos += c;
588 + buf += c;
589 + cnt += c;
590 + count -= c;
593 + kfree(buffer);
595 + return (err) ? err : cnt;
598 +static ssize_t
599 +smtcfb_write(struct fb_info *info, const char __user *buf, size_t count,
600 + loff_t *ppos)
602 + unsigned long p = *ppos;
604 + u32 *buffer, *src;
605 + u32 __iomem *dst;
606 + int c, i, cnt = 0, err = 0;
607 + unsigned long total_size;
609 + if (!info || !info->screen_base)
610 + return -ENODEV;
612 + if (info->state != FBINFO_STATE_RUNNING)
613 + return -EPERM;
615 + total_size = info->screen_size;
617 + if (total_size == 0)
618 + total_size = info->fix.smem_len;
620 + if (p > total_size)
621 + return -EFBIG;
623 + if (count > total_size) {
624 + err = -EFBIG;
625 + count = total_size;
628 + if (count + p > total_size) {
629 + if (!err)
630 + err = -ENOSPC;
632 + count = total_size - p;
635 + buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL);
636 + if (!buffer)
637 + return -ENOMEM;
639 + dst = (u32 __iomem *) (info->screen_base + p);
641 + if (info->fbops->fb_sync)
642 + info->fbops->fb_sync(info);
644 + while (count) {
645 + c = (count > PAGE_SIZE) ? PAGE_SIZE : count;
646 + src = buffer;
648 + if (copy_from_user(src, buf, c)) {
649 + err = -EFAULT;
650 + break;
653 + for (i = c >> 2; i--;) {
654 + fb_writel((*src & 0xff00ff00 >> 8) |
655 + (*src & 0x00ff00ff << 8), dst++);
656 + src++;
658 + if (c & 3) {
659 + u8 *src8 = (u8 *) src;
660 + u8 __iomem *dst8 = (u8 __iomem *) dst;
662 + for (i = c & 3; i--;) {
663 + if (i & 1) {
664 + fb_writeb(*src8++, ++dst8);
665 + } else {
666 + fb_writeb(*src8++, --dst8);
667 + dst8 += 2;
670 + dst = (u32 __iomem *) dst8;
673 + *ppos += c;
674 + buf += c;
675 + cnt += c;
676 + count -= c;
679 + kfree(buffer);
681 + return (cnt) ? cnt : err;
683 +#endif /* ! __BIG_ENDIAN */
685 +static void sm7xx_set_timing(struct smtcfb_info *sfb)
687 + int i = 0, j = 0;
688 + u32 m_nScreenStride;
690 + dev_dbg(&sfb->pdev->dev,
691 + "sfb->width=%d sfb->height=%d sfb->fb.var.bits_per_pixel=%d sfb->hz=%d\n",
692 + sfb->width, sfb->height, sfb->fb.var.bits_per_pixel, sfb->hz);
694 + for (j = 0; j < numVGAModes; j++) {
695 + if (VGAMode[j].mmSizeX == sfb->width &&
696 + VGAMode[j].mmSizeY == sfb->height &&
697 + VGAMode[j].bpp == sfb->fb.var.bits_per_pixel &&
698 + VGAMode[j].hz == sfb->hz) {
700 + dev_dbg(&sfb->pdev->dev,
701 + "VGAMode[j].mmSizeX=%d VGAMode[j].mmSizeY=%d VGAMode[j].bpp=%d VGAMode[j].hz=%d\n",
702 + VGAMode[j].mmSizeX, VGAMode[j].mmSizeY,
703 + VGAMode[j].bpp, VGAMode[j].hz);
705 + dev_dbg(&sfb->pdev->dev, "VGAMode index=%d\n", j);
707 + smtc_mmiowb(0x0, 0x3c6);
709 + smtc_seqw(0, 0x1);
711 + smtc_mmiowb(VGAMode[j].Init_MISC, 0x3c2);
713 + /* init SEQ register SR00 - SR04 */
714 + for (i = 0; i < SIZE_SR00_SR04; i++)
715 + smtc_seqw(i, VGAMode[j].Init_SR00_SR04[i]);
717 + /* init SEQ register SR10 - SR24 */
718 + for (i = 0; i < SIZE_SR10_SR24; i++)
719 + smtc_seqw(i + 0x10,
720 + VGAMode[j].Init_SR10_SR24[i]);
722 + /* init SEQ register SR30 - SR75 */
723 + for (i = 0; i < SIZE_SR30_SR75; i++)
724 + if ((i + 0x30) != 0x62 &&
725 + (i + 0x30) != 0x6a &&
726 + (i + 0x30) != 0x6b)
727 + smtc_seqw(i + 0x30,
728 + VGAMode[j].Init_SR30_SR75[i]);
730 + /* init SEQ register SR80 - SR93 */
731 + for (i = 0; i < SIZE_SR80_SR93; i++)
732 + smtc_seqw(i + 0x80,
733 + VGAMode[j].Init_SR80_SR93[i]);
735 + /* init SEQ register SRA0 - SRAF */
736 + for (i = 0; i < SIZE_SRA0_SRAF; i++)
737 + smtc_seqw(i + 0xa0,
738 + VGAMode[j].Init_SRA0_SRAF[i]);
740 + /* init Graphic register GR00 - GR08 */
741 + for (i = 0; i < SIZE_GR00_GR08; i++)
742 + smtc_grphw(i, VGAMode[j].Init_GR00_GR08[i]);
744 + /* init Attribute register AR00 - AR14 */
745 + for (i = 0; i < SIZE_AR00_AR14; i++)
746 + smtc_attrw(i, VGAMode[j].Init_AR00_AR14[i]);
748 + /* init CRTC register CR00 - CR18 */
749 + for (i = 0; i < SIZE_CR00_CR18; i++)
750 + smtc_crtcw(i, VGAMode[j].Init_CR00_CR18[i]);
752 + /* init CRTC register CR30 - CR4D */
753 + for (i = 0; i < SIZE_CR30_CR4D; i++)
754 + smtc_crtcw(i + 0x30,
755 + VGAMode[j].Init_CR30_CR4D[i]);
757 + /* init CRTC register CR90 - CRA7 */
758 + for (i = 0; i < SIZE_CR90_CRA7; i++)
759 + smtc_crtcw(i + 0x90,
760 + VGAMode[j].Init_CR90_CRA7[i]);
763 + smtc_mmiowb(0x67, 0x3c2);
765 + /* set VPR registers */
766 + writel(0x0, sfb->vp_regs + 0x0C);
767 + writel(0x0, sfb->vp_regs + 0x40);
769 + /* set data width */
770 + m_nScreenStride =
771 + (sfb->width * sfb->fb.var.bits_per_pixel) / 64;
772 + switch (sfb->fb.var.bits_per_pixel) {
773 + case 8:
774 + writel(0x0, sfb->vp_regs + 0x0);
775 + break;
776 + case 16:
777 + writel(0x00020000, sfb->vp_regs + 0x0);
778 + break;
779 + case 24:
780 + writel(0x00040000, sfb->vp_regs + 0x0);
781 + break;
782 + case 32:
783 + writel(0x00030000, sfb->vp_regs + 0x0);
784 + break;
786 + writel((u32) (((m_nScreenStride + 2) << 16) | m_nScreenStride),
787 + sfb->vp_regs + 0x10);
791 +static void smtc_set_timing(struct smtcfb_info *sfb)
793 + switch (sfb->chip_id) {
794 + case 0x710:
795 + case 0x712:
796 + case 0x720:
797 + sm7xx_set_timing(sfb);
798 + break;
802 +static void smtcfb_setmode(struct smtcfb_info *sfb)
804 + switch (sfb->fb.var.bits_per_pixel) {
805 + case 32:
806 + sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR;
807 + sfb->fb.fix.line_length = sfb->fb.var.xres * 4;
808 + sfb->fb.var.red.length = 8;
809 + sfb->fb.var.green.length = 8;
810 + sfb->fb.var.blue.length = 8;
811 + sfb->fb.var.red.offset = 16;
812 + sfb->fb.var.green.offset = 8;
813 + sfb->fb.var.blue.offset = 0;
814 + break;
815 + case 24:
816 + sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR;
817 + sfb->fb.fix.line_length = sfb->fb.var.xres * 3;
818 + sfb->fb.var.red.length = 8;
819 + sfb->fb.var.green.length = 8;
820 + sfb->fb.var.blue.length = 8;
821 + sfb->fb.var.red.offset = 16;
822 + sfb->fb.var.green.offset = 8;
823 + sfb->fb.var.blue.offset = 0;
824 + break;
825 + case 8:
826 + sfb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR;
827 + sfb->fb.fix.line_length = sfb->fb.var.xres;
828 + sfb->fb.var.red.length = 3;
829 + sfb->fb.var.green.length = 3;
830 + sfb->fb.var.blue.length = 2;
831 + sfb->fb.var.red.offset = 5;
832 + sfb->fb.var.green.offset = 2;
833 + sfb->fb.var.blue.offset = 0;
834 + break;
835 + case 16:
836 + default:
837 + sfb->fb.fix.visual = FB_VISUAL_TRUECOLOR;
838 + sfb->fb.fix.line_length = sfb->fb.var.xres * 2;
839 + sfb->fb.var.red.length = 5;
840 + sfb->fb.var.green.length = 6;
841 + sfb->fb.var.blue.length = 5;
842 + sfb->fb.var.red.offset = 11;
843 + sfb->fb.var.green.offset = 5;
844 + sfb->fb.var.blue.offset = 0;
845 + break;
848 + sfb->width = sfb->fb.var.xres;
849 + sfb->height = sfb->fb.var.yres;
850 + sfb->hz = 60;
851 + smtc_set_timing(sfb);
854 +static int smtc_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
856 + /* sanity checks */
857 + if (var->xres_virtual < var->xres)
858 + var->xres_virtual = var->xres;
860 + if (var->yres_virtual < var->yres)
861 + var->yres_virtual = var->yres;
863 + /* set valid default bpp */
864 + if ((var->bits_per_pixel != 8) && (var->bits_per_pixel != 16) &&
865 + (var->bits_per_pixel != 24) && (var->bits_per_pixel != 32))
866 + var->bits_per_pixel = 16;
868 + return 0;
871 +static int smtc_set_par(struct fb_info *info)
873 + smtcfb_setmode(info->par);
875 + return 0;
878 +static struct fb_ops smtcfb_ops = {
879 + .owner = THIS_MODULE,
880 + .fb_check_var = smtc_check_var,
881 + .fb_set_par = smtc_set_par,
882 + .fb_setcolreg = smtc_setcolreg,
883 + .fb_blank = smtc_blank,
884 + .fb_fillrect = cfb_fillrect,
885 + .fb_imageblit = cfb_imageblit,
886 + .fb_copyarea = cfb_copyarea,
887 +#ifdef __BIG_ENDIAN
888 + .fb_read = smtcfb_read,
889 + .fb_write = smtcfb_write,
890 +#endif
894 + * alloc struct smtcfb_info and assign default values
895 + */
896 +static struct smtcfb_info *smtc_alloc_fb_info(struct pci_dev *pdev)
898 + struct smtcfb_info *sfb;
900 + sfb = kzalloc(sizeof(*sfb), GFP_KERNEL);
902 + if (!sfb)
903 + return NULL;
905 + sfb->pdev = pdev;
907 + sfb->fb.flags = FBINFO_FLAG_DEFAULT;
908 + sfb->fb.fbops = &smtcfb_ops;
909 + sfb->fb.fix = smtcfb_fix;
910 + sfb->fb.var = smtcfb_var;
911 + sfb->fb.pseudo_palette = sfb->colreg;
912 + sfb->fb.par = sfb;
914 + return sfb;
918 + * free struct smtcfb_info
919 + */
920 +static void smtc_free_fb_info(struct smtcfb_info *sfb)
922 + kfree(sfb);
926 + * Unmap in the memory mapped IO registers
927 + */
929 +static void smtc_unmap_mmio(struct smtcfb_info *sfb)
931 + if (sfb && smtc_RegBaseAddress)
932 + smtc_RegBaseAddress = NULL;
936 + * Map in the screen memory
937 + */
939 +static int smtc_map_smem(struct smtcfb_info *sfb,
940 + struct pci_dev *pdev, u_long smem_len)
943 + sfb->fb.fix.smem_start = pci_resource_start(pdev, 0);
945 +#ifdef __BIG_ENDIAN
946 + if (sfb->fb.var.bits_per_pixel == 32)
947 + sfb->fb.fix.smem_start += 0x800000;
948 +#endif
950 + sfb->fb.fix.smem_len = smem_len;
952 + sfb->fb.screen_base = sfb->lfb;
954 + if (!sfb->fb.screen_base) {
955 + dev_err(&pdev->dev,
956 + "%s: unable to map screen memory\n", sfb->fb.fix.id);
957 + return -ENOMEM;
960 + return 0;
964 + * Unmap in the screen memory
966 + */
967 +static void smtc_unmap_smem(struct smtcfb_info *sfb)
969 + if (sfb && sfb->fb.screen_base) {
970 + iounmap(sfb->fb.screen_base);
971 + sfb->fb.screen_base = NULL;
976 + * We need to wake up the device and make sure its in linear memory mode.
977 + */
978 +static inline void sm7xx_init_hw(void)
980 + outb_p(0x18, 0x3c4);
981 + outb_p(0x11, 0x3c5);
984 +static int smtcfb_pci_probe(struct pci_dev *pdev,
985 + const struct pci_device_id *ent)
987 + struct smtcfb_info *sfb;
988 + u_long smem_size = 0x00800000; /* default 8MB */
989 + int err;
990 + unsigned long mmio_base;
992 + dev_info(&pdev->dev, "Silicon Motion display driver.");
994 + err = pci_enable_device(pdev); /* enable SMTC chip */
995 + if (err)
996 + return err;
998 + sprintf(smtcfb_fix.id, "sm%Xfb", ent->device);
1000 + sfb = smtc_alloc_fb_info(pdev);
1002 + if (!sfb) {
1003 + err = -ENOMEM;
1004 + goto failed_free;
1007 + sfb->chip_id = ent->device;
1009 + pci_set_drvdata(pdev, sfb);
1011 + sm7xx_init_hw();
1013 + /* get mode parameter from smtc_scr_info */
1014 + if (smtc_scr_info.lfb_width != 0) {
1015 + sfb->fb.var.xres = smtc_scr_info.lfb_width;
1016 + sfb->fb.var.yres = smtc_scr_info.lfb_height;
1017 + sfb->fb.var.bits_per_pixel = smtc_scr_info.lfb_depth;
1018 + } else {
1019 + /* default resolution 1024x600 16bit mode */
1020 + sfb->fb.var.xres = SCREEN_X_RES;
1021 + sfb->fb.var.yres = SCREEN_Y_RES;
1022 + sfb->fb.var.bits_per_pixel = SCREEN_BPP;
1025 +#ifdef __BIG_ENDIAN
1026 + if (sfb->fb.var.bits_per_pixel == 24)
1027 + sfb->fb.var.bits_per_pixel = (smtc_scr_info.lfb_depth = 32);
1028 +#endif
1029 + /* Map address and memory detection */
1030 + mmio_base = pci_resource_start(pdev, 0);
1031 + pci_read_config_byte(pdev, PCI_REVISION_ID, &sfb->chip_rev_id);
1033 + switch (sfb->chip_id) {
1034 + case 0x710:
1035 + case 0x712:
1036 + sfb->fb.fix.mmio_start = mmio_base + 0x00400000;
1037 + sfb->fb.fix.mmio_len = 0x00400000;
1038 + smem_size = SM712_VIDEOMEMORYSIZE;
1039 +#ifdef __BIG_ENDIAN
1040 + sfb->lfb = ioremap(mmio_base, 0x00c00000);
1041 +#else
1042 + sfb->lfb = ioremap(mmio_base, 0x00800000);
1043 +#endif
1044 + sfb->mmio = (smtc_RegBaseAddress =
1045 + sfb->lfb + 0x00700000);
1046 + sfb->dp_regs = sfb->lfb + 0x00408000;
1047 + sfb->vp_regs = sfb->lfb + 0x0040c000;
1048 +#ifdef __BIG_ENDIAN
1049 + if (sfb->fb.var.bits_per_pixel == 32) {
1050 + sfb->lfb += 0x800000;
1051 + dev_info(&pdev->dev, "sfb->lfb=%p", sfb->lfb);
1053 +#endif
1054 + if (!smtc_RegBaseAddress) {
1055 + dev_err(&pdev->dev,
1056 + "%s: unable to map memory mapped IO!",
1057 + sfb->fb.fix.id);
1058 + err = -ENOMEM;
1059 + goto failed_fb;
1062 + /* set MCLK = 14.31818 * (0x16 / 0x2) */
1063 + smtc_seqw(0x6a, 0x16);
1064 + smtc_seqw(0x6b, 0x02);
1065 + smtc_seqw(0x62, 0x3e);
1066 + /* enable PCI burst */
1067 + smtc_seqw(0x17, 0x20);
1068 + /* enable word swap */
1069 +#ifdef __BIG_ENDIAN
1070 + if (sfb->fb.var.bits_per_pixel == 32)
1071 + smtc_seqw(0x17, 0x30);
1072 +#endif
1073 + break;
1074 + case 0x720:
1075 + sfb->fb.fix.mmio_start = mmio_base;
1076 + sfb->fb.fix.mmio_len = 0x00200000;
1077 + smem_size = SM722_VIDEOMEMORYSIZE;
1078 + sfb->dp_regs = ioremap(mmio_base, 0x00a00000);
1079 + sfb->lfb = sfb->dp_regs + 0x00200000;
1080 + sfb->mmio = (smtc_RegBaseAddress =
1081 + sfb->dp_regs + 0x000c0000);
1082 + sfb->vp_regs = sfb->dp_regs + 0x800;
1084 + smtc_seqw(0x62, 0xff);
1085 + smtc_seqw(0x6a, 0x0d);
1086 + smtc_seqw(0x6b, 0x02);
1087 + break;
1088 + default:
1089 + dev_err(&pdev->dev,
1090 + "No valid Silicon Motion display chip was detected!");
1092 + goto failed_fb;
1095 + /* can support 32 bpp */
1096 + if (15 == sfb->fb.var.bits_per_pixel)
1097 + sfb->fb.var.bits_per_pixel = 16;
1099 + sfb->fb.var.xres_virtual = sfb->fb.var.xres;
1100 + sfb->fb.var.yres_virtual = sfb->fb.var.yres;
1101 + err = smtc_map_smem(sfb, pdev, smem_size);
1102 + if (err)
1103 + goto failed;
1105 + smtcfb_setmode(sfb);
1107 + err = register_framebuffer(&sfb->fb);
1108 + if (err < 0)
1109 + goto failed;
1111 + dev_info(&pdev->dev,
1112 + "Silicon Motion SM%X Rev%X primary display mode %dx%d-%d Init Complete.",
1113 + sfb->chip_id, sfb->chip_rev_id, sfb->fb.var.xres,
1114 + sfb->fb.var.yres, sfb->fb.var.bits_per_pixel);
1116 + return 0;
1118 +failed:
1119 + dev_err(&pdev->dev, "Silicon Motion, Inc. primary display init fail.");
1121 + smtc_unmap_smem(sfb);
1122 + smtc_unmap_mmio(sfb);
1123 +failed_fb:
1124 + smtc_free_fb_info(sfb);
1126 +failed_free:
1127 + pci_disable_device(pdev);
1129 + return err;
1133 + * 0x710 (LynxEM)
1134 + * 0x712 (LynxEM+)
1135 + * 0x720 (Lynx3DM, Lynx3DM+)
1136 + */
1137 +static const struct pci_device_id smtcfb_pci_table[] = {
1138 + { PCI_DEVICE(0x126f, 0x710), },
1139 + { PCI_DEVICE(0x126f, 0x712), },
1140 + { PCI_DEVICE(0x126f, 0x720), },
1141 + {0,}
1144 +static void smtcfb_pci_remove(struct pci_dev *pdev)
1146 + struct smtcfb_info *sfb;
1148 + sfb = pci_get_drvdata(pdev);
1149 + smtc_unmap_smem(sfb);
1150 + smtc_unmap_mmio(sfb);
1151 + unregister_framebuffer(&sfb->fb);
1152 + smtc_free_fb_info(sfb);
1155 +#ifdef CONFIG_PM
1156 +static int smtcfb_pci_suspend(struct device *device)
1158 + struct pci_dev *pdev = to_pci_dev(device);
1159 + struct smtcfb_info *sfb;
1161 + sfb = pci_get_drvdata(pdev);
1163 + /* set the hw in sleep mode use external clock and self memory refresh
1164 + * so that we can turn off internal PLLs later on
1165 + */
1166 + smtc_seqw(0x20, (smtc_seqr(0x20) | 0xc0));
1167 + smtc_seqw(0x69, (smtc_seqr(0x69) & 0xf7));
1169 + console_lock();
1170 + fb_set_suspend(&sfb->fb, 1);
1171 + console_unlock();
1173 + /* additionally turn off all function blocks including internal PLLs */
1174 + smtc_seqw(0x21, 0xff);
1176 + return 0;
1179 +static int smtcfb_pci_resume(struct device *device)
1181 + struct pci_dev *pdev = to_pci_dev(device);
1182 + struct smtcfb_info *sfb;
1184 + sfb = pci_get_drvdata(pdev);
1186 + /* reinit hardware */
1187 + sm7xx_init_hw();
1188 + switch (sfb->chip_id) {
1189 + case 0x710:
1190 + case 0x712:
1191 + /* set MCLK = 14.31818 * (0x16 / 0x2) */
1192 + smtc_seqw(0x6a, 0x16);
1193 + smtc_seqw(0x6b, 0x02);
1194 + smtc_seqw(0x62, 0x3e);
1195 + /* enable PCI burst */
1196 + smtc_seqw(0x17, 0x20);
1197 +#ifdef __BIG_ENDIAN
1198 + if (sfb->fb.var.bits_per_pixel == 32)
1199 + smtc_seqw(0x17, 0x30);
1200 +#endif
1201 + break;
1202 + case 0x720:
1203 + smtc_seqw(0x62, 0xff);
1204 + smtc_seqw(0x6a, 0x0d);
1205 + smtc_seqw(0x6b, 0x02);
1206 + break;
1209 + smtc_seqw(0x34, (smtc_seqr(0x34) | 0xc0));
1210 + smtc_seqw(0x33, ((smtc_seqr(0x33) | 0x08) & 0xfb));
1212 + smtcfb_setmode(sfb);
1214 + console_lock();
1215 + fb_set_suspend(&sfb->fb, 0);
1216 + console_unlock();
1218 + return 0;
1221 +static SIMPLE_DEV_PM_OPS(sm7xx_pm_ops, smtcfb_pci_suspend, smtcfb_pci_resume);
1222 +#define SM7XX_PM_OPS (&sm7xx_pm_ops)
1224 +#else /* !CONFIG_PM */
1226 +#define SM7XX_PM_OPS NULL
1228 +#endif /* !CONFIG_PM */
1230 +static struct pci_driver smtcfb_driver = {
1231 + .name = "smtcfb",
1232 + .id_table = smtcfb_pci_table,
1233 + .probe = smtcfb_pci_probe,
1234 + .remove = smtcfb_pci_remove,
1235 + .driver.pm = SM7XX_PM_OPS,
1238 +module_pci_driver(smtcfb_driver);
1240 +MODULE_AUTHOR("Siliconmotion ");
1241 +MODULE_DESCRIPTION("Framebuffer driver for SMI Graphic Cards");
1242 +MODULE_LICENSE("GPL");
1243 diff -Nur linux-3.18.12.orig/drivers/staging/sm7xxfb/sm7xx.h linux-3.18.12/drivers/staging/sm7xxfb/sm7xx.h
1244 --- linux-3.18.12.orig/drivers/staging/sm7xxfb/sm7xx.h 1969-12-31 18:00:00.000000000 -0600
1245 +++ linux-3.18.12/drivers/staging/sm7xxfb/sm7xx.h 2015-05-02 10:04:55.627427001 -0500
1246 @@ -0,0 +1,779 @@
1248 + * Silicon Motion SM712 frame buffer device
1250 + * Copyright (C) 2006 Silicon Motion Technology Corp.
1251 + * Authors: Ge Wang, gewang@siliconmotion.com
1252 + * Boyod boyod.yang@siliconmotion.com.cn
1254 + * Copyright (C) 2009 Lemote, Inc.
1255 + * Author: Wu Zhangjin, wuzhangjin@gmail.com
1257 + * This file is subject to the terms and conditions of the GNU General Public
1258 + * License. See the file COPYING in the main directory of this archive for
1259 + * more details.
1260 + */
1262 +#define NR_PALETTE 256
1264 +#define FB_ACCEL_SMI_LYNX 88
1266 +#define SCREEN_X_RES 1024
1267 +#define SCREEN_Y_RES 600
1268 +#define SCREEN_BPP 16
1270 +/*Assume SM712 graphics chip has 4MB VRAM */
1271 +#define SM712_VIDEOMEMORYSIZE 0x00400000
1272 +/*Assume SM722 graphics chip has 8MB VRAM */
1273 +#define SM722_VIDEOMEMORYSIZE 0x00800000
1275 +#define dac_reg (0x3c8)
1276 +#define dac_val (0x3c9)
1278 +extern void __iomem *smtc_RegBaseAddress;
1279 +#define smtc_mmiowb(dat, reg) writeb(dat, smtc_RegBaseAddress + reg)
1280 +#define smtc_mmioww(dat, reg) writew(dat, smtc_RegBaseAddress + reg)
1281 +#define smtc_mmiowl(dat, reg) writel(dat, smtc_RegBaseAddress + reg)
1283 +#define smtc_mmiorb(reg) readb(smtc_RegBaseAddress + reg)
1284 +#define smtc_mmiorw(reg) readw(smtc_RegBaseAddress + reg)
1285 +#define smtc_mmiorl(reg) readl(smtc_RegBaseAddress + reg)
1287 +#define SIZE_SR00_SR04 (0x04 - 0x00 + 1)
1288 +#define SIZE_SR10_SR24 (0x24 - 0x10 + 1)
1289 +#define SIZE_SR30_SR75 (0x75 - 0x30 + 1)
1290 +#define SIZE_SR80_SR93 (0x93 - 0x80 + 1)
1291 +#define SIZE_SRA0_SRAF (0xAF - 0xA0 + 1)
1292 +#define SIZE_GR00_GR08 (0x08 - 0x00 + 1)
1293 +#define SIZE_AR00_AR14 (0x14 - 0x00 + 1)
1294 +#define SIZE_CR00_CR18 (0x18 - 0x00 + 1)
1295 +#define SIZE_CR30_CR4D (0x4D - 0x30 + 1)
1296 +#define SIZE_CR90_CRA7 (0xA7 - 0x90 + 1)
1297 +#define SIZE_VPR (0x6C + 1)
1298 +#define SIZE_DPR (0x44 + 1)
1300 +static inline void smtc_crtcw(int reg, int val)
1302 + smtc_mmiowb(reg, 0x3d4);
1303 + smtc_mmiowb(val, 0x3d5);
1306 +static inline unsigned int smtc_crtcr(int reg)
1308 + smtc_mmiowb(reg, 0x3d4);
1309 + return smtc_mmiorb(0x3d5);
1312 +static inline void smtc_grphw(int reg, int val)
1314 + smtc_mmiowb(reg, 0x3ce);
1315 + smtc_mmiowb(val, 0x3cf);
1318 +static inline unsigned int smtc_grphr(int reg)
1320 + smtc_mmiowb(reg, 0x3ce);
1321 + return smtc_mmiorb(0x3cf);
1324 +static inline void smtc_attrw(int reg, int val)
1326 + smtc_mmiorb(0x3da);
1327 + smtc_mmiowb(reg, 0x3c0);
1328 + smtc_mmiorb(0x3c1);
1329 + smtc_mmiowb(val, 0x3c0);
1332 +static inline void smtc_seqw(int reg, int val)
1334 + smtc_mmiowb(reg, 0x3c4);
1335 + smtc_mmiowb(val, 0x3c5);
1338 +static inline unsigned int smtc_seqr(int reg)
1340 + smtc_mmiowb(reg, 0x3c4);
1341 + return smtc_mmiorb(0x3c5);
1344 +/* The next structure holds all information relevant for a specific video mode.
1345 + */
1347 +struct ModeInit {
1348 + int mmSizeX;
1349 + int mmSizeY;
1350 + int bpp;
1351 + int hz;
1352 + unsigned char Init_MISC;
1353 + unsigned char Init_SR00_SR04[SIZE_SR00_SR04];
1354 + unsigned char Init_SR10_SR24[SIZE_SR10_SR24];
1355 + unsigned char Init_SR30_SR75[SIZE_SR30_SR75];
1356 + unsigned char Init_SR80_SR93[SIZE_SR80_SR93];
1357 + unsigned char Init_SRA0_SRAF[SIZE_SRA0_SRAF];
1358 + unsigned char Init_GR00_GR08[SIZE_GR00_GR08];
1359 + unsigned char Init_AR00_AR14[SIZE_AR00_AR14];
1360 + unsigned char Init_CR00_CR18[SIZE_CR00_CR18];
1361 + unsigned char Init_CR30_CR4D[SIZE_CR30_CR4D];
1362 + unsigned char Init_CR90_CRA7[SIZE_CR90_CRA7];
1365 +/**********************************************************************
1366 + SM712 Mode table.
1367 + **********************************************************************/
1368 +struct ModeInit VGAMode[] = {
1370 + /* mode#0: 640 x 480 16Bpp 60Hz */
1371 + 640, 480, 16, 60,
1372 + /* Init_MISC */
1373 + 0xE3,
1374 + { /* Init_SR0_SR4 */
1375 + 0x03, 0x01, 0x0F, 0x00, 0x0E,
1376 + },
1377 + { /* Init_SR10_SR24 */
1378 + 0xFF, 0xBE, 0xEF, 0xFF, 0x00, 0x0E, 0x17, 0x2C,
1379 + 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1380 + 0xC4, 0x30, 0x02, 0x01, 0x01,
1381 + },
1382 + { /* Init_SR30_SR75 */
1383 + 0x32, 0x03, 0xA0, 0x09, 0xC0, 0x32, 0x32, 0x32,
1384 + 0x32, 0x32, 0x32, 0x32, 0x00, 0x00, 0x03, 0xFF,
1385 + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
1386 + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x32, 0x32, 0x32,
1387 + 0x04, 0x24, 0x63, 0x4F, 0x52, 0x0B, 0xDF, 0xEA,
1388 + 0x04, 0x50, 0x19, 0x32, 0x32, 0x00, 0x00, 0x32,
1389 + 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
1390 + 0x50, 0x03, 0x74, 0x14, 0x07, 0x82, 0x07, 0x04,
1391 + 0x00, 0x45, 0x30, 0x30, 0x40, 0x30,
1392 + },
1393 + { /* Init_SR80_SR93 */
1394 + 0xFF, 0x07, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x32,
1395 + 0xF7, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0x32, 0x32,
1396 + 0x00, 0x00, 0x00, 0x00,
1397 + },
1398 + { /* Init_SRA0_SRAF */
1399 + 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED,
1400 + 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xFF, 0xDF,
1401 + },
1402 + { /* Init_GR00_GR08 */
1403 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
1404 + 0xFF,
1405 + },
1406 + { /* Init_AR00_AR14 */
1407 + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1408 + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
1409 + 0x41, 0x00, 0x0F, 0x00, 0x00,
1410 + },
1411 + { /* Init_CR00_CR18 */
1412 + 0x5F, 0x4F, 0x4F, 0x00, 0x53, 0x1F, 0x0B, 0x3E,
1413 + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1414 + 0xEA, 0x0C, 0xDF, 0x50, 0x40, 0xDF, 0x00, 0xE3,
1415 + 0xFF,
1416 + },
1417 + { /* Init_CR30_CR4D */
1418 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x03, 0x20,
1419 + 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xFF, 0xFD,
1420 + 0x5F, 0x4F, 0x00, 0x54, 0x00, 0x0B, 0xDF, 0x00,
1421 + 0xEA, 0x0C, 0x2E, 0x00, 0x4F, 0xDF,
1422 + },
1423 + { /* Init_CR90_CRA7 */
1424 + 0x56, 0xDD, 0x5E, 0xEA, 0x87, 0x44, 0x8F, 0x55,
1425 + 0x0A, 0x8F, 0x55, 0x0A, 0x00, 0x00, 0x18, 0x00,
1426 + 0x11, 0x10, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x00,
1427 + },
1428 + },
1430 + /* mode#1: 640 x 480 24Bpp 60Hz */
1431 + 640, 480, 24, 60,
1432 + /* Init_MISC */
1433 + 0xE3,
1434 + { /* Init_SR0_SR4 */
1435 + 0x03, 0x01, 0x0F, 0x00, 0x0E,
1436 + },
1437 + { /* Init_SR10_SR24 */
1438 + 0xFF, 0xBE, 0xEF, 0xFF, 0x00, 0x0E, 0x17, 0x2C,
1439 + 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1440 + 0xC4, 0x30, 0x02, 0x01, 0x01,
1441 + },
1442 + { /* Init_SR30_SR75 */
1443 + 0x32, 0x03, 0xA0, 0x09, 0xC0, 0x32, 0x32, 0x32,
1444 + 0x32, 0x32, 0x32, 0x32, 0x00, 0x00, 0x03, 0xFF,
1445 + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
1446 + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x32, 0x32, 0x32,
1447 + 0x04, 0x24, 0x63, 0x4F, 0x52, 0x0B, 0xDF, 0xEA,
1448 + 0x04, 0x50, 0x19, 0x32, 0x32, 0x00, 0x00, 0x32,
1449 + 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
1450 + 0x50, 0x03, 0x74, 0x14, 0x07, 0x82, 0x07, 0x04,
1451 + 0x00, 0x45, 0x30, 0x30, 0x40, 0x30,
1452 + },
1453 + { /* Init_SR80_SR93 */
1454 + 0xFF, 0x07, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x32,
1455 + 0xF7, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0x32, 0x32,
1456 + 0x00, 0x00, 0x00, 0x00,
1457 + },
1458 + { /* Init_SRA0_SRAF */
1459 + 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED,
1460 + 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xFF, 0xDF,
1461 + },
1462 + { /* Init_GR00_GR08 */
1463 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
1464 + 0xFF,
1465 + },
1466 + { /* Init_AR00_AR14 */
1467 + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1468 + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
1469 + 0x41, 0x00, 0x0F, 0x00, 0x00,
1470 + },
1471 + { /* Init_CR00_CR18 */
1472 + 0x5F, 0x4F, 0x4F, 0x00, 0x53, 0x1F, 0x0B, 0x3E,
1473 + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1474 + 0xEA, 0x0C, 0xDF, 0x50, 0x40, 0xDF, 0x00, 0xE3,
1475 + 0xFF,
1476 + },
1477 + { /* Init_CR30_CR4D */
1478 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x03, 0x20,
1479 + 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xFF, 0xFD,
1480 + 0x5F, 0x4F, 0x00, 0x54, 0x00, 0x0B, 0xDF, 0x00,
1481 + 0xEA, 0x0C, 0x2E, 0x00, 0x4F, 0xDF,
1482 + },
1483 + { /* Init_CR90_CRA7 */
1484 + 0x56, 0xDD, 0x5E, 0xEA, 0x87, 0x44, 0x8F, 0x55,
1485 + 0x0A, 0x8F, 0x55, 0x0A, 0x00, 0x00, 0x18, 0x00,
1486 + 0x11, 0x10, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x00,
1487 + },
1488 + },
1490 + /* mode#0: 640 x 480 32Bpp 60Hz */
1491 + 640, 480, 32, 60,
1492 + /* Init_MISC */
1493 + 0xE3,
1494 + { /* Init_SR0_SR4 */
1495 + 0x03, 0x01, 0x0F, 0x00, 0x0E,
1496 + },
1497 + { /* Init_SR10_SR24 */
1498 + 0xFF, 0xBE, 0xEF, 0xFF, 0x00, 0x0E, 0x17, 0x2C,
1499 + 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1500 + 0xC4, 0x30, 0x02, 0x01, 0x01,
1501 + },
1502 + { /* Init_SR30_SR75 */
1503 + 0x32, 0x03, 0xA0, 0x09, 0xC0, 0x32, 0x32, 0x32,
1504 + 0x32, 0x32, 0x32, 0x32, 0x00, 0x00, 0x03, 0xFF,
1505 + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
1506 + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x32, 0x32, 0x32,
1507 + 0x04, 0x24, 0x63, 0x4F, 0x52, 0x0B, 0xDF, 0xEA,
1508 + 0x04, 0x50, 0x19, 0x32, 0x32, 0x00, 0x00, 0x32,
1509 + 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
1510 + 0x50, 0x03, 0x74, 0x14, 0x07, 0x82, 0x07, 0x04,
1511 + 0x00, 0x45, 0x30, 0x30, 0x40, 0x30,
1512 + },
1513 + { /* Init_SR80_SR93 */
1514 + 0xFF, 0x07, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x32,
1515 + 0xF7, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0x32, 0x32,
1516 + 0x00, 0x00, 0x00, 0x00,
1517 + },
1518 + { /* Init_SRA0_SRAF */
1519 + 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED,
1520 + 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xFF, 0xDF,
1521 + },
1522 + { /* Init_GR00_GR08 */
1523 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
1524 + 0xFF,
1525 + },
1526 + { /* Init_AR00_AR14 */
1527 + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1528 + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
1529 + 0x41, 0x00, 0x0F, 0x00, 0x00,
1530 + },
1531 + { /* Init_CR00_CR18 */
1532 + 0x5F, 0x4F, 0x4F, 0x00, 0x53, 0x1F, 0x0B, 0x3E,
1533 + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1534 + 0xEA, 0x0C, 0xDF, 0x50, 0x40, 0xDF, 0x00, 0xE3,
1535 + 0xFF,
1536 + },
1537 + { /* Init_CR30_CR4D */
1538 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x03, 0x20,
1539 + 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xFF, 0xFD,
1540 + 0x5F, 0x4F, 0x00, 0x54, 0x00, 0x0B, 0xDF, 0x00,
1541 + 0xEA, 0x0C, 0x2E, 0x00, 0x4F, 0xDF,
1542 + },
1543 + { /* Init_CR90_CRA7 */
1544 + 0x56, 0xDD, 0x5E, 0xEA, 0x87, 0x44, 0x8F, 0x55,
1545 + 0x0A, 0x8F, 0x55, 0x0A, 0x00, 0x00, 0x18, 0x00,
1546 + 0x11, 0x10, 0x0B, 0x0A, 0x0A, 0x0A, 0x0A, 0x00,
1547 + },
1548 + },
1550 + { /* mode#2: 800 x 600 16Bpp 60Hz */
1551 + 800, 600, 16, 60,
1552 + /* Init_MISC */
1553 + 0x2B,
1554 + { /* Init_SR0_SR4 */
1555 + 0x03, 0x01, 0x0F, 0x03, 0x0E,
1556 + },
1557 + { /* Init_SR10_SR24 */
1558 + 0xFF, 0xBE, 0xEE, 0xFF, 0x00, 0x0E, 0x17, 0x2C,
1559 + 0x99, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1560 + 0xC4, 0x30, 0x02, 0x01, 0x01,
1561 + },
1562 + { /* Init_SR30_SR75 */
1563 + 0x34, 0x03, 0x20, 0x09, 0xC0, 0x24, 0x24, 0x24,
1564 + 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x03, 0xFF,
1565 + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x38, 0x00, 0xFC,
1566 + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x24, 0x24, 0x24,
1567 + 0x04, 0x48, 0x83, 0x63, 0x68, 0x72, 0x57, 0x58,
1568 + 0x04, 0x55, 0x59, 0x24, 0x24, 0x00, 0x00, 0x24,
1569 + 0x01, 0x80, 0x7A, 0x1A, 0x1A, 0x00, 0x00, 0x00,
1570 + 0x50, 0x03, 0x74, 0x14, 0x1C, 0x85, 0x35, 0x13,
1571 + 0x02, 0x45, 0x30, 0x35, 0x40, 0x20,
1572 + },
1573 + { /* Init_SR80_SR93 */
1574 + 0x00, 0x00, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x24,
1575 + 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x24, 0x24,
1576 + 0x00, 0x00, 0x00, 0x00,
1577 + },
1578 + { /* Init_SRA0_SRAF */
1579 + 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED,
1580 + 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xBF, 0xDF,
1581 + },
1582 + { /* Init_GR00_GR08 */
1583 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
1584 + 0xFF,
1585 + },
1586 + { /* Init_AR00_AR14 */
1587 + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1588 + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
1589 + 0x41, 0x00, 0x0F, 0x00, 0x00,
1590 + },
1591 + { /* Init_CR00_CR18 */
1592 + 0x7F, 0x63, 0x63, 0x00, 0x68, 0x18, 0x72, 0xF0,
1593 + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1594 + 0x58, 0x0C, 0x57, 0x64, 0x40, 0x57, 0x00, 0xE3,
1595 + 0xFF,
1596 + },
1597 + { /* Init_CR30_CR4D */
1598 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x03, 0x20,
1599 + 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xBF, 0xFD,
1600 + 0x7F, 0x63, 0x00, 0x69, 0x18, 0x72, 0x57, 0x00,
1601 + 0x58, 0x0C, 0xE0, 0x20, 0x63, 0x57,
1602 + },
1603 + { /* Init_CR90_CRA7 */
1604 + 0x56, 0x4B, 0x5E, 0x55, 0x86, 0x9D, 0x8E, 0xAA,
1605 + 0xDB, 0x2A, 0xDF, 0x33, 0x00, 0x00, 0x18, 0x00,
1606 + 0x20, 0x1F, 0x1A, 0x19, 0x0F, 0x0F, 0x0F, 0x00,
1607 + },
1608 + },
1609 + { /* mode#3: 800 x 600 24Bpp 60Hz */
1610 + 800, 600, 24, 60,
1611 + 0x2B,
1612 + { /* Init_SR0_SR4 */
1613 + 0x03, 0x01, 0x0F, 0x03, 0x0E,
1614 + },
1615 + { /* Init_SR10_SR24 */
1616 + 0xFF, 0xBE, 0xEE, 0xFF, 0x00, 0x0E, 0x17, 0x2C,
1617 + 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1618 + 0xC4, 0x30, 0x02, 0x01, 0x01,
1619 + },
1620 + { /* Init_SR30_SR75 */
1621 + 0x36, 0x03, 0x20, 0x09, 0xC0, 0x36, 0x36, 0x36,
1622 + 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x03, 0xFF,
1623 + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
1624 + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x36, 0x36, 0x36,
1625 + 0x04, 0x48, 0x83, 0x63, 0x68, 0x72, 0x57, 0x58,
1626 + 0x04, 0x55, 0x59, 0x36, 0x36, 0x00, 0x00, 0x36,
1627 + 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
1628 + 0x50, 0x03, 0x74, 0x14, 0x1C, 0x85, 0x35, 0x13,
1629 + 0x02, 0x45, 0x30, 0x30, 0x40, 0x20,
1630 + },
1631 + { /* Init_SR80_SR93 */
1632 + 0xFF, 0x07, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x36,
1633 + 0xF7, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0x36, 0x36,
1634 + 0x00, 0x00, 0x00, 0x00,
1635 + },
1636 + { /* Init_SRA0_SRAF */
1637 + 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED,
1638 + 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xBF, 0xDF,
1639 + },
1640 + { /* Init_GR00_GR08 */
1641 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
1642 + 0xFF,
1643 + },
1644 + { /* Init_AR00_AR14 */
1645 + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1646 + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
1647 + 0x41, 0x00, 0x0F, 0x00, 0x00,
1648 + },
1649 + { /* Init_CR00_CR18 */
1650 + 0x7F, 0x63, 0x63, 0x00, 0x68, 0x18, 0x72, 0xF0,
1651 + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1652 + 0x58, 0x0C, 0x57, 0x64, 0x40, 0x57, 0x00, 0xE3,
1653 + 0xFF,
1654 + },
1655 + { /* Init_CR30_CR4D */
1656 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x03, 0x20,
1657 + 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xBF, 0xFD,
1658 + 0x7F, 0x63, 0x00, 0x69, 0x18, 0x72, 0x57, 0x00,
1659 + 0x58, 0x0C, 0xE0, 0x20, 0x63, 0x57,
1660 + },
1661 + { /* Init_CR90_CRA7 */
1662 + 0x56, 0x4B, 0x5E, 0x55, 0x86, 0x9D, 0x8E, 0xAA,
1663 + 0xDB, 0x2A, 0xDF, 0x33, 0x00, 0x00, 0x18, 0x00,
1664 + 0x20, 0x1F, 0x1A, 0x19, 0x0F, 0x0F, 0x0F, 0x00,
1665 + },
1666 + },
1667 + { /* mode#7: 800 x 600 32Bpp 60Hz */
1668 + 800, 600, 32, 60,
1669 + /* Init_MISC */
1670 + 0x2B,
1671 + { /* Init_SR0_SR4 */
1672 + 0x03, 0x01, 0x0F, 0x03, 0x0E,
1673 + },
1674 + { /* Init_SR10_SR24 */
1675 + 0xFF, 0xBE, 0xEE, 0xFF, 0x00, 0x0E, 0x17, 0x2C,
1676 + 0x99, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1677 + 0xC4, 0x30, 0x02, 0x01, 0x01,
1678 + },
1679 + { /* Init_SR30_SR75 */
1680 + 0x34, 0x03, 0x20, 0x09, 0xC0, 0x24, 0x24, 0x24,
1681 + 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x03, 0xFF,
1682 + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x38, 0x00, 0xFC,
1683 + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x24, 0x24, 0x24,
1684 + 0x04, 0x48, 0x83, 0x63, 0x68, 0x72, 0x57, 0x58,
1685 + 0x04, 0x55, 0x59, 0x24, 0x24, 0x00, 0x00, 0x24,
1686 + 0x01, 0x80, 0x7A, 0x1A, 0x1A, 0x00, 0x00, 0x00,
1687 + 0x50, 0x03, 0x74, 0x14, 0x1C, 0x85, 0x35, 0x13,
1688 + 0x02, 0x45, 0x30, 0x35, 0x40, 0x20,
1689 + },
1690 + { /* Init_SR80_SR93 */
1691 + 0x00, 0x00, 0x00, 0x6F, 0x7F, 0x7F, 0xFF, 0x24,
1692 + 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x24, 0x24,
1693 + 0x00, 0x00, 0x00, 0x00,
1694 + },
1695 + { /* Init_SRA0_SRAF */
1696 + 0x00, 0xFF, 0xBF, 0xFF, 0xFF, 0xED, 0xED, 0xED,
1697 + 0x7B, 0xFF, 0xFF, 0xFF, 0xBF, 0xEF, 0xBF, 0xDF,
1698 + },
1699 + { /* Init_GR00_GR08 */
1700 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
1701 + 0xFF,
1702 + },
1703 + { /* Init_AR00_AR14 */
1704 + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1705 + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
1706 + 0x41, 0x00, 0x0F, 0x00, 0x00,
1707 + },
1708 + { /* Init_CR00_CR18 */
1709 + 0x7F, 0x63, 0x63, 0x00, 0x68, 0x18, 0x72, 0xF0,
1710 + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1711 + 0x58, 0x0C, 0x57, 0x64, 0x40, 0x57, 0x00, 0xE3,
1712 + 0xFF,
1713 + },
1714 + { /* Init_CR30_CR4D */
1715 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x03, 0x20,
1716 + 0x00, 0x00, 0x00, 0x40, 0x00, 0xE7, 0xBF, 0xFD,
1717 + 0x7F, 0x63, 0x00, 0x69, 0x18, 0x72, 0x57, 0x00,
1718 + 0x58, 0x0C, 0xE0, 0x20, 0x63, 0x57,
1719 + },
1720 + { /* Init_CR90_CRA7 */
1721 + 0x56, 0x4B, 0x5E, 0x55, 0x86, 0x9D, 0x8E, 0xAA,
1722 + 0xDB, 0x2A, 0xDF, 0x33, 0x00, 0x00, 0x18, 0x00,
1723 + 0x20, 0x1F, 0x1A, 0x19, 0x0F, 0x0F, 0x0F, 0x00,
1724 + },
1725 + },
1726 + /* We use 1024x768 table to light 1024x600 panel for lemote */
1727 + { /* mode#4: 1024 x 600 16Bpp 60Hz */
1728 + 1024, 600, 16, 60,
1729 + /* Init_MISC */
1730 + 0xEB,
1731 + { /* Init_SR0_SR4 */
1732 + 0x03, 0x01, 0x0F, 0x00, 0x0E,
1733 + },
1734 + { /* Init_SR10_SR24 */
1735 + 0xC8, 0x40, 0x14, 0x60, 0x00, 0x0A, 0x17, 0x20,
1736 + 0x51, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1737 + 0xC4, 0x30, 0x02, 0x00, 0x01,
1738 + },
1739 + { /* Init_SR30_SR75 */
1740 + 0x22, 0x03, 0x24, 0x09, 0xC0, 0x22, 0x22, 0x22,
1741 + 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x03, 0xFF,
1742 + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
1743 + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x22, 0x22, 0x22,
1744 + 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03,
1745 + 0x00, 0x60, 0x59, 0x22, 0x22, 0x00, 0x00, 0x22,
1746 + 0x01, 0x80, 0x7A, 0x1A, 0x1A, 0x00, 0x00, 0x00,
1747 + 0x50, 0x03, 0x16, 0x02, 0x0D, 0x82, 0x09, 0x02,
1748 + 0x04, 0x45, 0x3F, 0x30, 0x40, 0x20,
1749 + },
1750 + { /* Init_SR80_SR93 */
1751 + 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A,
1752 + 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A,
1753 + 0x00, 0x00, 0x00, 0x00,
1754 + },
1755 + { /* Init_SRA0_SRAF */
1756 + 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED,
1757 + 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF,
1758 + },
1759 + { /* Init_GR00_GR08 */
1760 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
1761 + 0xFF,
1762 + },
1763 + { /* Init_AR00_AR14 */
1764 + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1765 + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
1766 + 0x41, 0x00, 0x0F, 0x00, 0x00,
1767 + },
1768 + { /* Init_CR00_CR18 */
1769 + 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5,
1770 + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1771 + 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3,
1772 + 0xFF,
1773 + },
1774 + { /* Init_CR30_CR4D */
1775 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20,
1776 + 0x00, 0x00, 0x00, 0x40, 0x00, 0xFF, 0xBF, 0xFF,
1777 + 0xA3, 0x7F, 0x00, 0x82, 0x0b, 0x6f, 0x57, 0x00,
1778 + 0x5c, 0x0f, 0xE0, 0xe0, 0x7F, 0x57,
1779 + },
1780 + { /* Init_CR90_CRA7 */
1781 + 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26,
1782 + 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00,
1783 + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03,
1784 + },
1785 + },
1786 + { /* mode#5: 1024 x 768 24Bpp 60Hz */
1787 + 1024, 768, 24, 60,
1788 + /* Init_MISC */
1789 + 0xEB,
1790 + { /* Init_SR0_SR4 */
1791 + 0x03, 0x01, 0x0F, 0x03, 0x0E,
1792 + },
1793 + { /* Init_SR10_SR24 */
1794 + 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C,
1795 + 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1796 + 0xC4, 0x30, 0x02, 0x01, 0x01,
1797 + },
1798 + { /* Init_SR30_SR75 */
1799 + 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A,
1800 + 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF,
1801 + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
1802 + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A,
1803 + 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03,
1804 + 0x00, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A,
1805 + 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
1806 + 0x50, 0x03, 0x74, 0x14, 0x3B, 0x0D, 0x09, 0x02,
1807 + 0x04, 0x45, 0x30, 0x30, 0x40, 0x20,
1808 + },
1809 + { /* Init_SR80_SR93 */
1810 + 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A,
1811 + 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A,
1812 + 0x00, 0x00, 0x00, 0x00,
1813 + },
1814 + { /* Init_SRA0_SRAF */
1815 + 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED,
1816 + 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF,
1817 + },
1818 + { /* Init_GR00_GR08 */
1819 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
1820 + 0xFF,
1821 + },
1822 + { /* Init_AR00_AR14 */
1823 + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1824 + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
1825 + 0x41, 0x00, 0x0F, 0x00, 0x00,
1826 + },
1827 + { /* Init_CR00_CR18 */
1828 + 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5,
1829 + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1830 + 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3,
1831 + 0xFF,
1832 + },
1833 + { /* Init_CR30_CR4D */
1834 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20,
1835 + 0x00, 0x00, 0x00, 0x40, 0x00, 0xFF, 0xBF, 0xFF,
1836 + 0xA3, 0x7F, 0x00, 0x86, 0x15, 0x24, 0xFF, 0x00,
1837 + 0x01, 0x07, 0xE5, 0x20, 0x7F, 0xFF,
1838 + },
1839 + { /* Init_CR90_CRA7 */
1840 + 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26,
1841 + 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00,
1842 + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03,
1843 + },
1844 + },
1845 + { /* mode#4: 1024 x 768 32Bpp 60Hz */
1846 + 1024, 768, 32, 60,
1847 + /* Init_MISC */
1848 + 0xEB,
1849 + { /* Init_SR0_SR4 */
1850 + 0x03, 0x01, 0x0F, 0x03, 0x0E,
1851 + },
1852 + { /* Init_SR10_SR24 */
1853 + 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C,
1854 + 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1855 + 0xC4, 0x32, 0x02, 0x01, 0x01,
1856 + },
1857 + { /* Init_SR30_SR75 */
1858 + 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A,
1859 + 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF,
1860 + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
1861 + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A,
1862 + 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03,
1863 + 0x00, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A,
1864 + 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
1865 + 0x50, 0x03, 0x74, 0x14, 0x3B, 0x0D, 0x09, 0x02,
1866 + 0x04, 0x45, 0x30, 0x30, 0x40, 0x20,
1867 + },
1868 + { /* Init_SR80_SR93 */
1869 + 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A,
1870 + 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A,
1871 + 0x00, 0x00, 0x00, 0x00,
1872 + },
1873 + { /* Init_SRA0_SRAF */
1874 + 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED,
1875 + 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF,
1876 + },
1877 + { /* Init_GR00_GR08 */
1878 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
1879 + 0xFF,
1880 + },
1881 + { /* Init_AR00_AR14 */
1882 + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1883 + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
1884 + 0x41, 0x00, 0x0F, 0x00, 0x00,
1885 + },
1886 + { /* Init_CR00_CR18 */
1887 + 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5,
1888 + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1889 + 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3,
1890 + 0xFF,
1891 + },
1892 + { /* Init_CR30_CR4D */
1893 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20,
1894 + 0x00, 0x00, 0x00, 0x40, 0x00, 0xFF, 0xBF, 0xFF,
1895 + 0xA3, 0x7F, 0x00, 0x86, 0x15, 0x24, 0xFF, 0x00,
1896 + 0x01, 0x07, 0xE5, 0x20, 0x7F, 0xFF,
1897 + },
1898 + { /* Init_CR90_CRA7 */
1899 + 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26,
1900 + 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00,
1901 + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03,
1902 + },
1903 + },
1904 + { /* mode#6: 320 x 240 16Bpp 60Hz */
1905 + 320, 240, 16, 60,
1906 + /* Init_MISC */
1907 + 0xEB,
1908 + { /* Init_SR0_SR4 */
1909 + 0x03, 0x01, 0x0F, 0x03, 0x0E,
1910 + },
1911 + { /* Init_SR10_SR24 */
1912 + 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C,
1913 + 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1914 + 0xC4, 0x32, 0x02, 0x01, 0x01,
1915 + },
1916 + { /* Init_SR30_SR75 */
1917 + 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A,
1918 + 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF,
1919 + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
1920 + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A,
1921 + 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03,
1922 + 0x00, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A,
1923 + 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
1924 + 0x50, 0x03, 0x74, 0x14, 0x08, 0x43, 0x08, 0x43,
1925 + 0x04, 0x45, 0x30, 0x30, 0x40, 0x20,
1926 + },
1927 + { /* Init_SR80_SR93 */
1928 + 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A,
1929 + 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A,
1930 + 0x00, 0x00, 0x00, 0x00,
1931 + },
1932 + { /* Init_SRA0_SRAF */
1933 + 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED,
1934 + 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF,
1935 + },
1936 + { /* Init_GR00_GR08 */
1937 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
1938 + 0xFF,
1939 + },
1940 + { /* Init_AR00_AR14 */
1941 + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1942 + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
1943 + 0x41, 0x00, 0x0F, 0x00, 0x00,
1944 + },
1945 + { /* Init_CR00_CR18 */
1946 + 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5,
1947 + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1948 + 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3,
1949 + 0xFF,
1950 + },
1951 + { /* Init_CR30_CR4D */
1952 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20,
1953 + 0x00, 0x00, 0x30, 0x40, 0x00, 0xFF, 0xBF, 0xFF,
1954 + 0x2E, 0x27, 0x00, 0x2b, 0x0c, 0x0F, 0xEF, 0x00,
1955 + 0xFe, 0x0f, 0x01, 0xC0, 0x27, 0xEF,
1956 + },
1957 + { /* Init_CR90_CRA7 */
1958 + 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26,
1959 + 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00,
1960 + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03,
1961 + },
1962 + },
1964 + { /* mode#8: 320 x 240 32Bpp 60Hz */
1965 + 320, 240, 32, 60,
1966 + /* Init_MISC */
1967 + 0xEB,
1968 + { /* Init_SR0_SR4 */
1969 + 0x03, 0x01, 0x0F, 0x03, 0x0E,
1970 + },
1971 + { /* Init_SR10_SR24 */
1972 + 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C,
1973 + 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1974 + 0xC4, 0x32, 0x02, 0x01, 0x01,
1975 + },
1976 + { /* Init_SR30_SR75 */
1977 + 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A,
1978 + 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF,
1979 + 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
1980 + 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A,
1981 + 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03,
1982 + 0x00, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A,
1983 + 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
1984 + 0x50, 0x03, 0x74, 0x14, 0x08, 0x43, 0x08, 0x43,
1985 + 0x04, 0x45, 0x30, 0x30, 0x40, 0x20,
1986 + },
1987 + { /* Init_SR80_SR93 */
1988 + 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A,
1989 + 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A,
1990 + 0x00, 0x00, 0x00, 0x00,
1991 + },
1992 + { /* Init_SRA0_SRAF */
1993 + 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED,
1994 + 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF,
1995 + },
1996 + { /* Init_GR00_GR08 */
1997 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
1998 + 0xFF,
1999 + },
2000 + { /* Init_AR00_AR14 */
2001 + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
2002 + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
2003 + 0x41, 0x00, 0x0F, 0x00, 0x00,
2004 + },
2005 + { /* Init_CR00_CR18 */
2006 + 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5,
2007 + 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2008 + 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3,
2009 + 0xFF,
2010 + },
2011 + { /* Init_CR30_CR4D */
2012 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20,
2013 + 0x00, 0x00, 0x30, 0x40, 0x00, 0xFF, 0xBF, 0xFF,
2014 + 0x2E, 0x27, 0x00, 0x2b, 0x0c, 0x0F, 0xEF, 0x00,
2015 + 0xFe, 0x0f, 0x01, 0xC0, 0x27, 0xEF,
2016 + },
2017 + { /* Init_CR90_CRA7 */
2018 + 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26,
2019 + 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00,
2020 + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03,
2021 + },
2022 + },
2025 +#define numVGAModes ARRAY_SIZE(VGAMode)
2026 diff -Nur linux-3.18.12.orig/drivers/staging/sm7xxfb/TODO linux-3.18.12/drivers/staging/sm7xxfb/TODO
2027 --- linux-3.18.12.orig/drivers/staging/sm7xxfb/TODO 1969-12-31 18:00:00.000000000 -0600
2028 +++ linux-3.18.12/drivers/staging/sm7xxfb/TODO 2015-05-02 10:04:55.627427001 -0500
2029 @@ -0,0 +1,9 @@
2030 +TODO:
2031 +- Dual head support
2032 +- 2D acceleration support
2033 +- use kernel coding style
2034 +- refine the code and remove unused code
2035 +- move it to drivers/video/sm7xxfb.c
2037 +Please send any patches to Greg Kroah-Hartman <greg@kroah.com> and
2038 +Teddy Wang <teddy.wang@siliconmotion.com.cn>.
2039 diff -Nur linux-3.18.12.orig/drivers/video/fbdev/core/fbmem.c linux-3.18.12/drivers/video/fbdev/core/fbmem.c
2040 --- linux-3.18.12.orig/drivers/video/fbdev/core/fbmem.c 2015-04-20 14:48:02.000000000 -0500
2041 +++ linux-3.18.12/drivers/video/fbdev/core/fbmem.c 2015-05-02 10:10:42.831427001 -0500
2042 @@ -1251,15 +1251,6 @@
2043 u16 reserved[3];
2046 -struct fb_cmap32 {
2047 - u32 start;
2048 - u32 len;
2049 - compat_caddr_t red;
2050 - compat_caddr_t green;
2051 - compat_caddr_t blue;
2052 - compat_caddr_t transp;
2055 static int fb_getput_cmap(struct fb_info *info, unsigned int cmd,
2056 unsigned long arg)