2 * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public
7 * License as published by the Free Software Foundation;
8 * either version 2, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even
12 * the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE.See the GNU General Public License
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include <linux/module.h>
27 static int MAX_CURS
= 32;
28 static struct fb_var_screeninfo default_var
;
29 static char *viafb_name
= "Via";
30 static u32 pseudo_pal
[17];
33 static char *viafb_mode
= "640x480";
34 static char *viafb_mode1
= "640x480";
35 static int viafb_resMode
= VIA_RES_640X480
;
37 /* Added for specifying active devices.*/
38 char *viafb_active_dev
= "";
40 /* Added for specifying video on devices.*/
41 char *viafb_video_dev
= "";
43 /*Added for specify lcd output port*/
44 char *viafb_lcd_port
= "";
45 char *viafb_dvi_port
= "";
47 static void viafb_set_device(struct device_t active_dev
);
48 static int apply_device_setting(struct viafb_ioctl_setting setting_info
,
49 struct fb_info
*info
);
50 static void apply_second_mode_setting(struct fb_var_screeninfo
52 static void retrieve_device_setting(struct viafb_ioctl_setting
54 static void viafb_set_video_device(u32 video_dev_info
);
55 static void viafb_get_video_device(u32
*video_dev_info
);
57 /* Mode information */
58 static const struct viafb_modeinfo viafb_modentry
[] = {
59 {480, 640, VIA_RES_480X640
, "480x640"},
60 {640, 480, VIA_RES_640X480
, "640x480"},
61 {800, 480, VIA_RES_800X480
, "800x480"},
62 {800, 600, VIA_RES_800X600
, "800x600"},
63 {1024, 768, VIA_RES_1024X768
, "1024x768"},
64 {1152, 864, VIA_RES_1152X864
, "1152x864"},
65 {1280, 1024, VIA_RES_1280X1024
, "1280x1024"},
66 {1600, 1200, VIA_RES_1600X1200
, "1600x1200"},
67 {1440, 1050, VIA_RES_1440X1050
, "1440x1050"},
68 {1280, 768, VIA_RES_1280X768
, "1280x768"},
69 {1280, 800, VIA_RES_1280X800
, "1280x800"},
70 {1280, 960, VIA_RES_1280X960
, "1280x960"},
71 {1920, 1440, VIA_RES_1920X1440
, "1920x1440"},
72 {848, 480, VIA_RES_848X480
, "848x480"},
73 {1400, 1050, VIA_RES_1400X1050
, "1400x1050"},
74 {720, 480, VIA_RES_720X480
, "720x480"},
75 {720, 576, VIA_RES_720X576
, "720x576"},
76 {1024, 512, VIA_RES_1024X512
, "1024x512"},
77 {1024, 576, VIA_RES_1024X576
, "1024x576"},
78 {1024, 600, VIA_RES_1024X600
, "1024x600"},
79 {1280, 720, VIA_RES_1280X720
, "1280x720"},
80 {1920, 1080, VIA_RES_1920X1080
, "1920x1080"},
81 {1366, 768, VIA_RES_1368X768
, "1368x768"},
82 {1680, 1050, VIA_RES_1680X1050
, "1680x1050"},
83 {960, 600, VIA_RES_960X600
, "960x600"},
84 {1000, 600, VIA_RES_1000X600
, "1000x600"},
85 {1024, 576, VIA_RES_1024X576
, "1024x576"},
86 {1024, 600, VIA_RES_1024X600
, "1024x600"},
87 {1088, 612, VIA_RES_1088X612
, "1088x612"},
88 {1152, 720, VIA_RES_1152X720
, "1152x720"},
89 {1200, 720, VIA_RES_1200X720
, "1200x720"},
90 {1280, 600, VIA_RES_1280X600
, "1280x600"},
91 {1360, 768, VIA_RES_1360X768
, "1360x768"},
92 {1440, 900, VIA_RES_1440X900
, "1440x900"},
93 {1600, 900, VIA_RES_1600X900
, "1600x900"},
94 {1600, 1024, VIA_RES_1600X1024
, "1600x1024"},
95 {1792, 1344, VIA_RES_1792X1344
, "1792x1344"},
96 {1856, 1392, VIA_RES_1856X1392
, "1856x1392"},
97 {1920, 1200, VIA_RES_1920X1200
, "1920x1200"},
98 {2048, 1536, VIA_RES_2048X1536
, "2048x1536"},
99 {0, 0, VIA_RES_INVALID
, "640x480"}
102 static struct fb_ops viafb_ops
;
104 static int viafb_update_fix(struct fb_fix_screeninfo
*fix
, struct fb_info
*info
)
106 struct viafb_par
*ppar
;
109 DEBUG_MSG(KERN_INFO
"viafb_update_fix!\n");
112 ppar
->bpp
== 8 ? FB_VISUAL_PSEUDOCOLOR
: FB_VISUAL_TRUECOLOR
;
113 fix
->line_length
= ppar
->linelength
;
119 static void viafb_setup_fixinfo(struct fb_fix_screeninfo
*fix
,
120 struct viafb_par
*viaparinfo
)
122 memset(fix
, 0, sizeof(struct fb_fix_screeninfo
));
123 strcpy(fix
->id
, viafb_name
);
125 fix
->smem_start
= viaparinfo
->fbmem
;
126 fix
->smem_len
= viaparinfo
->fbmem_free
;
127 fix
->mmio_start
= viaparinfo
->mmio_base
;
128 fix
->mmio_len
= viaparinfo
->mmio_len
;
130 fix
->type
= FB_TYPE_PACKED_PIXELS
;
133 fix
->xpanstep
= fix
->ywrapstep
= 0;
136 /* Just tell the accel name */
137 viafbinfo
->fix
.accel
= FB_ACCEL_VIA_UNICHROME
;
139 static int viafb_open(struct fb_info
*info
, int user
)
141 DEBUG_MSG(KERN_INFO
"viafb_open!\n");
145 static int viafb_release(struct fb_info
*info
, int user
)
147 DEBUG_MSG(KERN_INFO
"viafb_release!\n");
151 static void viafb_update_viafb_par(struct fb_info
*info
)
153 struct viafb_par
*ppar
;
156 ppar
->bpp
= info
->var
.bits_per_pixel
;
157 ppar
->linelength
= ((info
->var
.xres_virtual
+ 7) & ~7) * ppar
->bpp
/ 8;
158 ppar
->hres
= info
->var
.xres
;
159 ppar
->vres
= info
->var
.yres
;
160 ppar
->xoffset
= info
->var
.xoffset
;
161 ppar
->yoffset
= info
->var
.yoffset
;
164 static int viafb_check_var(struct fb_var_screeninfo
*var
,
165 struct fb_info
*info
)
167 int vmode_index
, htotal
, vtotal
;
168 struct viafb_par
*ppar
;
170 struct viafb_par
*p_viafb_par
;
174 DEBUG_MSG(KERN_INFO
"viafb_check_var!\n");
176 /* HW neither support interlacte nor double-scaned mode */
177 if (var
->vmode
& FB_VMODE_INTERLACED
|| var
->vmode
& FB_VMODE_DOUBLE
)
180 vmode_index
= viafb_get_mode_index(var
->xres
, var
->yres
, 0);
181 if (vmode_index
== VIA_RES_INVALID
) {
183 "viafb: Mode %dx%dx%d not supported!!\n",
184 var
->xres
, var
->yres
, var
->bits_per_pixel
);
188 if (24 == var
->bits_per_pixel
)
189 var
->bits_per_pixel
= 32;
191 if (var
->bits_per_pixel
!= 8 && var
->bits_per_pixel
!= 16 &&
192 var
->bits_per_pixel
!= 32)
195 if ((var
->xres_virtual
* (var
->bits_per_pixel
>> 3)) & 0x1F)
196 /*32 pixel alignment */
197 var
->xres_virtual
= (var
->xres_virtual
+ 31) & ~31;
198 if (var
->xres_virtual
* var
->yres_virtual
* var
->bits_per_pixel
/ 8 >
202 /* Based on var passed in to calculate the refresh,
203 * because our driver use some modes special.
205 htotal
= var
->xres
+ var
->left_margin
+
206 var
->right_margin
+ var
->hsync_len
;
207 vtotal
= var
->yres
+ var
->upper_margin
+
208 var
->lower_margin
+ var
->vsync_len
;
209 long_refresh
= 1000000000UL / var
->pixclock
* 1000;
210 long_refresh
/= (htotal
* vtotal
);
212 viafb_refresh
= viafb_get_refresh(var
->xres
, var
->yres
, long_refresh
);
214 /* Adjust var according to our driver's own table */
215 viafb_fill_var_timing_info(var
, viafb_refresh
, vmode_index
);
217 /* This is indeed a patch for VT3353 */
220 p_viafb_par
= (struct viafb_par
*)info
->par
;
221 if (p_viafb_par
->chip_info
->gfx_chip_name
== UNICHROME_VX800
)
222 var
->accel_flags
= 0;
227 static int viafb_set_par(struct fb_info
*info
)
230 int vmode_index1
= 0;
231 DEBUG_MSG(KERN_INFO
"viafb_set_par!\n");
233 viafb_update_device_setting(info
->var
.xres
, info
->var
.yres
,
234 info
->var
.bits_per_pixel
, viafb_refresh
, 0);
236 vmode_index
= viafb_get_mode_index(info
->var
.xres
, info
->var
.yres
, 0);
238 if (viafb_SAMM_ON
== 1) {
240 "viafb_second_xres = %d, viafb_second_yres = %d, bpp = %d\n",
241 viafb_second_xres
, viafb_second_yres
, viafb_bpp1
);
242 vmode_index1
= viafb_get_mode_index(viafb_second_xres
,
243 viafb_second_yres
, 1);
244 DEBUG_MSG(KERN_INFO
"->viafb_SAMM_ON: index=%d\n",
247 viafb_update_device_setting(viafb_second_xres
,
248 viafb_second_yres
, viafb_bpp1
, viafb_refresh1
, 1);
251 if (vmode_index
!= VIA_RES_INVALID
) {
252 viafb_setmode(vmode_index
, info
->var
.xres
, info
->var
.yres
,
253 info
->var
.bits_per_pixel
, vmode_index1
,
254 viafb_second_xres
, viafb_second_yres
, viafb_bpp1
);
256 /*We should set memory offset according virtual_x */
257 /*Fix me:put this function into viafb_setmode */
258 viafb_memory_pitch_patch(info
);
260 /* Update ***fb_par information */
261 viafb_update_viafb_par(info
);
263 /* Update other fixed information */
264 viafb_update_fix(&info
->fix
, info
);
265 viafb_bpp
= info
->var
.bits_per_pixel
;
266 /* Update viafb_accel, it is necessary to our 2D accelerate */
267 viafb_accel
= info
->var
.accel_flags
;
270 viafb_set_2d_color_depth(info
->var
.bits_per_pixel
);
276 /* Set one color register */
277 static int viafb_setcolreg(unsigned regno
, unsigned red
, unsigned green
,
278 unsigned blue
, unsigned transp
, struct fb_info
*info
)
280 u8 sr1a
, sr1b
, cr67
, cr6a
, rev
= 0, shift
= 10;
281 unsigned cmap_entries
= (info
->var
.bits_per_pixel
== 8) ? 256 : 16;
282 DEBUG_MSG(KERN_INFO
"viafb_setcolreg!\n");
283 if (regno
>= cmap_entries
)
285 if (UNICHROME_CLE266
== viaparinfo
->chip_info
->gfx_chip_name
) {
287 * Read PCI bus 0,dev 0,function 0,index 0xF6 to get chip rev.
289 outl(0x80000000 | (0xf6 & ~3), (unsigned long)0xCF8);
290 rev
= (inl((unsigned long)0xCFC) >> ((0xf6 & 3) * 8)) & 0xff;
292 switch (info
->var
.bits_per_pixel
) {
303 /* Map the 3C6/7/8/9 to the IGA2 */
305 outb(sr1a
| 0x01, 0x3C5);
306 /* Second Display Engine colck always on */
308 outb(sr1b
| 0x80, 0x3C5);
309 /* Second Display Color Depth 8 */
311 outb(cr67
& 0x3F, 0x3D5);
313 /* Second Display Channel Reset CR6A[6]) */
314 outb(cr6a
& 0xBF, 0x3D5);
315 /* Second Display Channel Enable CR6A[7] */
316 outb(cr6a
| 0x80, 0x3D5);
317 /* Second Display Channel stop reset) */
318 outb(cr6a
| 0x40, 0x3D5);
320 /* Bit mask of palette */
322 /* Write one register of IGA2 */
324 if (UNICHROME_CLE266
== viaparinfo
->chip_info
->gfx_chip_name
&&
327 viafb_write_reg_mask(CR6A
, VIACR
, BIT5
, BIT5
);
328 viafb_write_reg_mask(SR15
, VIASR
, BIT7
, BIT7
);
331 viafb_write_reg_mask(CR6A
, VIACR
, 0, BIT5
);
332 viafb_write_reg_mask(SR15
, VIASR
, 0, BIT7
);
334 outb(red
>> shift
, 0x3C9);
335 outb(green
>> shift
, 0x3C9);
336 outb(blue
>> shift
, 0x3C9);
338 /* Map the 3C6/7/8/9 to the IGA1 */
340 outb(sr1a
& 0xFE, 0x3C5);
341 /* Bit mask of palette */
343 /* Write one register of IGA1 */
345 outb(red
>> shift
, 0x3C9);
346 outb(green
>> shift
, 0x3C9);
347 outb(blue
>> shift
, 0x3C9);
359 ((u32
*) info
->pseudo_palette
)[regno
] = (red
& 0xF800) |
360 ((green
& 0xFC00) >> 5) | ((blue
& 0xF800) >> 11);
363 ((u32
*) info
->pseudo_palette
)[regno
] =
364 ((transp
& 0xFF00) << 16) |
365 ((red
& 0xFF00) << 8) |
366 ((green
& 0xFF00)) | ((blue
& 0xFF00) >> 8);
374 /*CALLED BY: fb_set_cmap */
375 /* fb_set_var, pass 256 colors */
376 /*CALLED BY: fb_set_cmap */
377 /* fbcon_set_palette, pass 16 colors */
378 static int viafb_setcmap(struct fb_cmap
*cmap
, struct fb_info
*info
)
382 u16
*pred
= cmap
->red
;
383 u16
*pgreen
= cmap
->green
;
384 u16
*pblue
= cmap
->blue
;
385 u16
*ptransp
= cmap
->transp
;
386 u8 sr1a
, sr1b
, cr67
, cr6a
, rev
= 0, shift
= 10;
389 if (UNICHROME_CLE266
== viaparinfo
->chip_info
->gfx_chip_name
) {
391 * Read PCI bus 0, dev 0, function 0, index 0xF6 to get chip
394 outl(0x80000000 | (0xf6 & ~3), (unsigned long)0xCF8);
395 rev
= (inl((unsigned long)0xCFC) >> ((0xf6 & 3) * 8)) & 0xff;
397 switch (info
->var
.bits_per_pixel
) {
407 /* Map the 3C6/7/8/9 to the IGA2 */
409 outb(sr1a
| 0x01, 0x3C5);
411 /* Second Display Engine colck always on */
412 outb(sr1b
| 0x80, 0x3C5);
414 /* Second Display Color Depth 8 */
415 outb(cr67
& 0x3F, 0x3D5);
417 /* Second Display Channel Reset CR6A[6]) */
418 outb(cr6a
& 0xBF, 0x3D5);
419 /* Second Display Channel Enable CR6A[7] */
420 outb(cr6a
| 0x80, 0x3D5);
421 /* Second Display Channel stop reset) */
422 outb(cr6a
| 0xC0, 0x3D5);
424 /* Bit mask of palette */
427 if (UNICHROME_CLE266
== viaparinfo
->chip_info
->gfx_chip_name
&&
430 viafb_write_reg_mask(CR6A
, VIACR
, BIT5
, BIT5
);
431 viafb_write_reg_mask(SR15
, VIASR
, BIT7
, BIT7
);
434 viafb_write_reg_mask(CR6A
, VIACR
, 0, BIT5
);
435 viafb_write_reg_mask(SR15
, VIASR
, 0, BIT7
);
437 for (i
= 0; i
< len
; i
++) {
438 outb((*(pred
+ i
)) >> shift
, 0x3C9);
439 outb((*(pgreen
+ i
)) >> shift
, 0x3C9);
440 outb((*(pblue
+ i
)) >> shift
, 0x3C9);
444 /* Map the 3C6/7/8/9 to the IGA1 */
445 outb(sr1a
& 0xFE, 0x3C5);
446 /* Bit mask of palette */
449 for (i
= 0; i
< len
; i
++) {
450 outb((*(pred
+ i
)) >> shift
, 0x3C9);
451 outb((*(pgreen
+ i
)) >> shift
, 0x3C9);
452 outb((*(pblue
+ i
)) >> shift
, 0x3C9);
466 return 0; /* Because static u32 pseudo_pal[17]; */
467 for (i
= 0; i
< len
; i
++)
468 ((u32
*) info
->pseudo_palette
)[i
] =
469 (*(pred
+ i
) & 0xF800) |
470 ((*(pgreen
+ i
) & 0xFC00) >> 5) |
471 ((*(pblue
+ i
) & 0xF800) >> 11);
477 for (i
= 0; i
< len
; i
++)
478 ((u32
*) info
->pseudo_palette
)[i
] =
479 ((*(ptransp
+ i
) & 0xFF00) << 16) |
480 ((*(pred
+ i
) & 0xFF00) << 8) |
481 ((*(pgreen
+ i
) & 0xFF00)) |
482 ((*(pblue
+ i
) & 0xFF00) >> 8);
484 for (i
= 0; i
< len
; i
++)
485 ((u32
*) info
->pseudo_palette
)[i
] =
487 ((*(pred
+ i
) & 0xFF00) << 8) |
488 ((*(pgreen
+ i
) & 0xFF00)) |
489 ((*(pblue
+ i
) & 0xFF00) >> 8);
496 static int viafb_pan_display(struct fb_var_screeninfo
*var
,
497 struct fb_info
*info
)
501 DEBUG_MSG(KERN_INFO
"viafb_pan_display!\n");
503 offset
= (var
->xoffset
+ (var
->yoffset
* var
->xres_virtual
)) *
504 var
->bits_per_pixel
/ 16;
506 DEBUG_MSG(KERN_INFO
"\nviafb_pan_display,offset =%d ", offset
);
508 viafb_write_reg_mask(0x48, 0x3d4, ((offset
>> 24) & 0x3), 0x3);
509 viafb_write_reg_mask(0x34, 0x3d4, ((offset
>> 16) & 0xff), 0xff);
510 viafb_write_reg_mask(0x0c, 0x3d4, ((offset
>> 8) & 0xff), 0xff);
511 viafb_write_reg_mask(0x0d, 0x3d4, (offset
& 0xff), 0xff);
516 static int viafb_blank(int blank_mode
, struct fb_info
*info
)
518 DEBUG_MSG(KERN_INFO
"viafb_blank!\n");
519 /* clear DPMS setting */
521 switch (blank_mode
) {
522 case FB_BLANK_UNBLANK
:
523 /* Screen: On, HSync: On, VSync: On */
524 /* control CRT monitor power management */
525 viafb_write_reg_mask(CR36
, VIACR
, 0x00, BIT4
+ BIT5
);
527 case FB_BLANK_HSYNC_SUSPEND
:
528 /* Screen: Off, HSync: Off, VSync: On */
529 /* control CRT monitor power management */
530 viafb_write_reg_mask(CR36
, VIACR
, 0x10, BIT4
+ BIT5
);
532 case FB_BLANK_VSYNC_SUSPEND
:
533 /* Screen: Off, HSync: On, VSync: Off */
534 /* control CRT monitor power management */
535 viafb_write_reg_mask(CR36
, VIACR
, 0x20, BIT4
+ BIT5
);
537 case FB_BLANK_POWERDOWN
:
538 /* Screen: Off, HSync: Off, VSync: Off */
539 /* control CRT monitor power management */
540 viafb_write_reg_mask(CR36
, VIACR
, 0x30, BIT4
+ BIT5
);
547 static int viafb_ioctl(struct fb_info
*info
, u_int cmd
, u_long arg
)
550 struct viafb_ioctl_mode viamode
;
551 struct viafb_ioctl_samm viasamm
;
552 struct viafb_driver_version driver_version
;
553 struct fb_var_screeninfo sec_var
;
554 struct _panel_size_pos_info panel_pos_size_para
;
555 struct viafb_ioctl_setting viafb_setting
;
556 struct device_t active_dev
;
559 u32
*viafb_gamma_table
;
560 char driver_name
[] = "viafb";
562 u32 __user
*argp
= (u32 __user
*) arg
;
564 u32 video_dev_info
= 0;
566 DEBUG_MSG(KERN_INFO
"viafb_ioctl: 0x%X !!\n", cmd
);
567 memset(&u
, 0, sizeof(u
));
570 case VIAFB_GET_CHIP_INFO
:
571 if (copy_to_user(argp
, viaparinfo
->chip_info
,
572 sizeof(struct chip_information
)))
575 case VIAFB_GET_INFO_SIZE
:
576 return put_user((u32
)sizeof(struct viafb_ioctl_info
), argp
);
578 return viafb_ioctl_get_viafb_info(arg
);
580 return put_user(viafb_ioctl_hotplug(info
->var
.xres
,
582 info
->var
.bits_per_pixel
), argp
);
583 case VIAFB_SET_HOTPLUG_FLAG
:
584 if (copy_from_user(&gpu32
, argp
, sizeof(gpu32
)))
586 viafb_hotplug
= (gpu32
) ? 1 : 0;
588 case VIAFB_GET_RESOLUTION
:
589 u
.viamode
.xres
= (u32
) viafb_hotplug_Xres
;
590 u
.viamode
.yres
= (u32
) viafb_hotplug_Yres
;
591 u
.viamode
.refresh
= (u32
) viafb_hotplug_refresh
;
592 u
.viamode
.bpp
= (u32
) viafb_hotplug_bpp
;
593 if (viafb_SAMM_ON
== 1) {
594 u
.viamode
.xres_sec
= viafb_second_xres
;
595 u
.viamode
.yres_sec
= viafb_second_yres
;
596 u
.viamode
.virtual_xres_sec
= viafb_second_virtual_xres
;
597 u
.viamode
.virtual_yres_sec
= viafb_second_virtual_yres
;
598 u
.viamode
.refresh_sec
= viafb_refresh1
;
599 u
.viamode
.bpp_sec
= viafb_bpp1
;
601 u
.viamode
.xres_sec
= 0;
602 u
.viamode
.yres_sec
= 0;
603 u
.viamode
.virtual_xres_sec
= 0;
604 u
.viamode
.virtual_yres_sec
= 0;
605 u
.viamode
.refresh_sec
= 0;
606 u
.viamode
.bpp_sec
= 0;
608 if (copy_to_user(argp
, &u
.viamode
, sizeof(u
.viamode
)))
611 case VIAFB_GET_SAMM_INFO
:
612 u
.viasamm
.samm_status
= viafb_SAMM_ON
;
614 if (viafb_SAMM_ON
== 1) {
616 u
.viasamm
.size_prim
= viaparinfo
->fbmem_free
;
617 u
.viasamm
.size_sec
= viaparinfo1
->fbmem_free
;
619 if (viafb_second_size
) {
620 u
.viasamm
.size_prim
=
621 viaparinfo
->fbmem_free
-
622 viafb_second_size
* 1024 * 1024;
624 viafb_second_size
* 1024 * 1024;
626 u
.viasamm
.size_prim
=
627 viaparinfo
->fbmem_free
>> 1;
629 (viaparinfo
->fbmem_free
>> 1);
632 u
.viasamm
.mem_base
= viaparinfo
->fbmem
;
633 u
.viasamm
.offset_sec
= viafb_second_offset
;
635 u
.viasamm
.size_prim
=
636 viaparinfo
->memsize
- viaparinfo
->fbmem_used
;
637 u
.viasamm
.size_sec
= 0;
638 u
.viasamm
.mem_base
= viaparinfo
->fbmem
;
639 u
.viasamm
.offset_sec
= 0;
642 if (copy_to_user(argp
, &u
.viasamm
, sizeof(u
.viasamm
)))
646 case VIAFB_TURN_ON_OUTPUT_DEVICE
:
647 if (copy_from_user(&gpu32
, argp
, sizeof(gpu32
)))
649 if (gpu32
& CRT_Device
)
651 if (gpu32
& DVI_Device
)
653 if (gpu32
& LCD_Device
)
656 case VIAFB_TURN_OFF_OUTPUT_DEVICE
:
657 if (copy_from_user(&gpu32
, argp
, sizeof(gpu32
)))
659 if (gpu32
& CRT_Device
)
661 if (gpu32
& DVI_Device
)
663 if (gpu32
& LCD_Device
)
666 case VIAFB_SET_DEVICE
:
667 if (copy_from_user(&u
.active_dev
, (void *)argp
,
668 sizeof(u
.active_dev
)))
670 viafb_set_device(u
.active_dev
);
673 case VIAFB_GET_DEVICE
:
674 u
.active_dev
.crt
= viafb_CRT_ON
;
675 u
.active_dev
.dvi
= viafb_DVI_ON
;
676 u
.active_dev
.lcd
= viafb_LCD_ON
;
677 u
.active_dev
.samm
= viafb_SAMM_ON
;
678 u
.active_dev
.primary_dev
= viafb_primary_dev
;
680 u
.active_dev
.lcd_dsp_cent
= viafb_lcd_dsp_method
;
681 u
.active_dev
.lcd_panel_id
= viafb_lcd_panel_id
;
682 u
.active_dev
.lcd_mode
= viafb_lcd_mode
;
684 u
.active_dev
.xres
= viafb_hotplug_Xres
;
685 u
.active_dev
.yres
= viafb_hotplug_Yres
;
687 u
.active_dev
.xres1
= viafb_second_xres
;
688 u
.active_dev
.yres1
= viafb_second_yres
;
690 u
.active_dev
.bpp
= viafb_bpp
;
691 u
.active_dev
.bpp1
= viafb_bpp1
;
692 u
.active_dev
.refresh
= viafb_refresh
;
693 u
.active_dev
.refresh1
= viafb_refresh1
;
695 u
.active_dev
.epia_dvi
= viafb_platform_epia_dvi
;
696 u
.active_dev
.lcd_dual_edge
= viafb_device_lcd_dualedge
;
697 u
.active_dev
.bus_width
= viafb_bus_width
;
699 if (copy_to_user(argp
, &u
.active_dev
, sizeof(u
.active_dev
)))
703 case VIAFB_GET_DRIVER_VERSION
:
704 u
.driver_version
.iMajorNum
= VERSION_MAJOR
;
705 u
.driver_version
.iKernelNum
= VERSION_KERNEL
;
706 u
.driver_version
.iOSNum
= VERSION_OS
;
707 u
.driver_version
.iMinorNum
= VERSION_MINOR
;
709 if (copy_to_user(argp
, &u
.driver_version
,
710 sizeof(u
.driver_version
)))
715 case VIAFB_SET_DEVICE_INFO
:
716 if (copy_from_user(&u
.viafb_setting
,
717 argp
, sizeof(u
.viafb_setting
)))
719 if (apply_device_setting(u
.viafb_setting
, info
) < 0)
724 case VIAFB_SET_SECOND_MODE
:
725 if (copy_from_user(&u
.sec_var
, argp
, sizeof(u
.sec_var
)))
727 apply_second_mode_setting(&u
.sec_var
);
730 case VIAFB_GET_DEVICE_INFO
:
732 retrieve_device_setting(&u
.viafb_setting
);
734 if (copy_to_user(argp
, &u
.viafb_setting
,
735 sizeof(u
.viafb_setting
)))
740 case VIAFB_GET_DEVICE_SUPPORT
:
741 viafb_get_device_support_state(&state_info
);
742 if (put_user(state_info
, argp
))
746 case VIAFB_GET_DEVICE_CONNECT
:
747 viafb_get_device_connect_state(&state_info
);
748 if (put_user(state_info
, argp
))
752 case VIAFB_GET_PANEL_SUPPORT_EXPAND
:
754 viafb_lcd_get_support_expand_state(info
->var
.xres
,
756 if (put_user(state_info
, argp
))
760 case VIAFB_GET_DRIVER_NAME
:
761 if (copy_to_user(argp
, driver_name
, sizeof(driver_name
)))
765 case VIAFB_SET_GAMMA_LUT
:
766 viafb_gamma_table
= kmalloc(256 * sizeof(u32
), GFP_KERNEL
);
767 if (!viafb_gamma_table
)
769 if (copy_from_user(viafb_gamma_table
, argp
,
770 sizeof(viafb_gamma_table
))) {
771 kfree(viafb_gamma_table
);
774 viafb_set_gamma_table(viafb_bpp
, viafb_gamma_table
);
775 kfree(viafb_gamma_table
);
778 case VIAFB_GET_GAMMA_LUT
:
779 viafb_gamma_table
= kmalloc(256 * sizeof(u32
), GFP_KERNEL
);
780 if (!viafb_gamma_table
)
782 viafb_get_gamma_table(viafb_gamma_table
);
783 if (copy_to_user(argp
, viafb_gamma_table
,
784 sizeof(viafb_gamma_table
))) {
785 kfree(viafb_gamma_table
);
788 kfree(viafb_gamma_table
);
791 case VIAFB_GET_GAMMA_SUPPORT_STATE
:
792 viafb_get_gamma_support_state(viafb_bpp
, &state_info
);
793 if (put_user(state_info
, argp
))
796 case VIAFB_SET_VIDEO_DEVICE
:
797 get_user(video_dev_info
, argp
);
798 viafb_set_video_device(video_dev_info
);
800 case VIAFB_GET_VIDEO_DEVICE
:
801 viafb_get_video_device(&video_dev_info
);
802 if (put_user(video_dev_info
, argp
))
805 case VIAFB_SYNC_SURFACE
:
806 DEBUG_MSG(KERN_INFO
"lobo VIAFB_SYNC_SURFACE\n");
808 case VIAFB_GET_DRIVER_CAPS
:
811 case VIAFB_GET_PANEL_MAX_SIZE
:
812 if (copy_from_user(&u
.panel_pos_size_para
, argp
,
813 sizeof(u
.panel_pos_size_para
)))
815 u
.panel_pos_size_para
.x
= u
.panel_pos_size_para
.y
= 0;
816 if (copy_to_user(argp
, &u
.panel_pos_size_para
,
817 sizeof(u
.panel_pos_size_para
)))
820 case VIAFB_GET_PANEL_MAX_POSITION
:
821 if (copy_from_user(&u
.panel_pos_size_para
, argp
,
822 sizeof(u
.panel_pos_size_para
)))
824 u
.panel_pos_size_para
.x
= u
.panel_pos_size_para
.y
= 0;
825 if (copy_to_user(argp
, &u
.panel_pos_size_para
,
826 sizeof(u
.panel_pos_size_para
)))
830 case VIAFB_GET_PANEL_POSITION
:
831 if (copy_from_user(&u
.panel_pos_size_para
, argp
,
832 sizeof(u
.panel_pos_size_para
)))
834 u
.panel_pos_size_para
.x
= u
.panel_pos_size_para
.y
= 0;
835 if (copy_to_user(argp
, &u
.panel_pos_size_para
,
836 sizeof(u
.panel_pos_size_para
)))
839 case VIAFB_GET_PANEL_SIZE
:
840 if (copy_from_user(&u
.panel_pos_size_para
, argp
,
841 sizeof(u
.panel_pos_size_para
)))
843 u
.panel_pos_size_para
.x
= u
.panel_pos_size_para
.y
= 0;
844 if (copy_to_user(argp
, &u
.panel_pos_size_para
,
845 sizeof(u
.panel_pos_size_para
)))
849 case VIAFB_SET_PANEL_POSITION
:
850 if (copy_from_user(&u
.panel_pos_size_para
, argp
,
851 sizeof(u
.panel_pos_size_para
)))
854 case VIAFB_SET_PANEL_SIZE
:
855 if (copy_from_user(&u
.panel_pos_size_para
, argp
,
856 sizeof(u
.panel_pos_size_para
)))
867 static void viafb_fillrect(struct fb_info
*info
,
868 const struct fb_fillrect
*rect
)
870 u32 col
= 0, rop
= 0;
874 return cfb_fillrect(info
, rect
);
876 if (!rect
->width
|| !rect
->height
)
889 switch (info
->var
.bits_per_pixel
) {
894 col
= ((u32
*) (info
->pseudo_palette
))[rect
->color
];
897 col
= ((u32
*) (info
->pseudo_palette
))[rect
->color
];
901 /* BitBlt Source Address */
902 writel(0x0, viaparinfo
->io_virt
+ VIA_REG_SRCPOS
);
903 /* Source Base Address */
904 writel(0x0, viaparinfo
->io_virt
+ VIA_REG_SRCBASE
);
905 /* Destination Base Address */
906 writel(((unsigned long) (info
->screen_base
) -
907 (unsigned long) viafb_FB_MM
) >> 3,
908 viaparinfo
->io_virt
+ VIA_REG_DSTBASE
);
910 pitch
= (info
->var
.xres_virtual
+ 7) & ~7;
911 writel(VIA_PITCH_ENABLE
|
913 info
->var
.bits_per_pixel
>> 3) >> 3) |
915 var
.bits_per_pixel
>> 3) >> 3) << 16)),
916 viaparinfo
->io_virt
+ VIA_REG_PITCH
);
917 /* BitBlt Destination Address */
918 writel(((rect
->dy
<< 16) | rect
->dx
),
919 viaparinfo
->io_virt
+ VIA_REG_DSTPOS
);
920 /* Dimension: width & height */
921 writel((((rect
->height
- 1) << 16) | (rect
->width
- 1)),
922 viaparinfo
->io_virt
+ VIA_REG_DIMENSION
);
923 /* Forground color or Destination color */
924 writel(col
, viaparinfo
->io_virt
+ VIA_REG_FGCOLOR
);
926 writel((0x01 | 0x2000 | (rop
<< 24)),
927 viaparinfo
->io_virt
+ VIA_REG_GECMD
);
931 static void viafb_copyarea(struct fb_info
*info
,
932 const struct fb_copyarea
*area
)
934 u32 dy
= area
->dy
, sy
= area
->sy
, direction
= 0x0;
935 u32 sx
= area
->sx
, dx
= area
->dx
, width
= area
->width
;
938 DEBUG_MSG(KERN_INFO
"viafb_copyarea!!\n");
941 return cfb_copyarea(info
, area
);
943 if (!area
->width
|| !area
->height
)
947 dy
+= area
->height
- 1;
948 sy
+= area
->height
- 1;
958 /* Source Base Address */
959 writel(((unsigned long) (info
->screen_base
) -
960 (unsigned long) viafb_FB_MM
) >> 3,
961 viaparinfo
->io_virt
+ VIA_REG_SRCBASE
);
962 /* Destination Base Address */
963 writel(((unsigned long) (info
->screen_base
) -
964 (unsigned long) viafb_FB_MM
) >> 3,
965 viaparinfo
->io_virt
+ VIA_REG_DSTBASE
);
967 pitch
= (info
->var
.xres_virtual
+ 7) & ~7;
968 /* VIA_PITCH_ENABLE can be omitted now. */
969 writel(VIA_PITCH_ENABLE
|
971 info
->var
.bits_per_pixel
>> 3) >> 3) | (((pitch
*
976 viaparinfo
->io_virt
+ VIA_REG_PITCH
);
977 /* BitBlt Source Address */
978 writel(((sy
<< 16) | sx
), viaparinfo
->io_virt
+ VIA_REG_SRCPOS
);
979 /* BitBlt Destination Address */
980 writel(((dy
<< 16) | dx
), viaparinfo
->io_virt
+ VIA_REG_DSTPOS
);
981 /* Dimension: width & height */
982 writel((((area
->height
- 1) << 16) | (area
->width
- 1)),
983 viaparinfo
->io_virt
+ VIA_REG_DIMENSION
);
985 writel((0x01 | direction
| (0xCC << 24)),
986 viaparinfo
->io_virt
+ VIA_REG_GECMD
);
990 static void viafb_imageblit(struct fb_info
*info
,
991 const struct fb_image
*image
)
993 u32 size
, bg_col
= 0, fg_col
= 0, *udata
;
998 return cfb_imageblit(info
, image
);
1000 udata
= (u32
*) image
->data
;
1002 switch (info
->var
.bits_per_pixel
) {
1004 bg_col
= image
->bg_color
;
1005 fg_col
= image
->fg_color
;
1008 bg_col
= ((u32
*) (info
->pseudo_palette
))[image
->bg_color
];
1009 fg_col
= ((u32
*) (info
->pseudo_palette
))[image
->fg_color
];
1012 bg_col
= ((u32
*) (info
->pseudo_palette
))[image
->bg_color
];
1013 fg_col
= ((u32
*) (info
->pseudo_palette
))[image
->fg_color
];
1016 size
= image
->width
* image
->height
;
1018 /* Source Base Address */
1019 writel(0x0, viaparinfo
->io_virt
+ VIA_REG_SRCBASE
);
1020 /* Destination Base Address */
1021 writel(((unsigned long) (info
->screen_base
) -
1022 (unsigned long) viafb_FB_MM
) >> 3,
1023 viaparinfo
->io_virt
+ VIA_REG_DSTBASE
);
1025 pitch
= (info
->var
.xres_virtual
+ 7) & ~7;
1026 writel(VIA_PITCH_ENABLE
|
1028 info
->var
.bits_per_pixel
>> 3) >> 3) | (((pitch
*
1033 viaparinfo
->io_virt
+ VIA_REG_PITCH
);
1034 /* BitBlt Source Address */
1035 writel(0x0, viaparinfo
->io_virt
+ VIA_REG_SRCPOS
);
1036 /* BitBlt Destination Address */
1037 writel(((image
->dy
<< 16) | image
->dx
),
1038 viaparinfo
->io_virt
+ VIA_REG_DSTPOS
);
1039 /* Dimension: width & height */
1040 writel((((image
->height
- 1) << 16) | (image
->width
- 1)),
1041 viaparinfo
->io_virt
+ VIA_REG_DIMENSION
);
1043 writel(fg_col
, viaparinfo
->io_virt
+ VIA_REG_FGCOLOR
);
1045 writel(bg_col
, viaparinfo
->io_virt
+ VIA_REG_BGCOLOR
);
1047 writel(0xCC020142, viaparinfo
->io_virt
+ VIA_REG_GECMD
);
1049 for (i
= 0; i
< size
/ 4; i
++) {
1050 writel(*udata
, viaparinfo
->io_virt
+ VIA_MMIO_BLTBASE
);
1056 static int viafb_cursor(struct fb_info
*info
, struct fb_cursor
*cursor
)
1058 u32 temp
, xx
, yy
, bg_col
= 0, fg_col
= 0;
1060 static int hw_cursor
;
1061 struct viafb_par
*p_viafb_par
;
1068 viafb_show_hw_cursor(info
, HW_Cursor_OFF
);
1074 if ((((struct viafb_par
*)(info
->par
))->iga_path
== IGA2
)
1075 && (viaparinfo
->chip_info
->gfx_chip_name
== UNICHROME_CLE266
))
1078 /* When duoview and using lcd , use soft cursor */
1079 if (viafb_LCD_ON
|| ((struct viafb_par
*)(info
->par
))->duoview
)
1082 viafb_show_hw_cursor(info
, HW_Cursor_OFF
);
1083 viacursor
= *cursor
;
1085 if (cursor
->set
& FB_CUR_SETHOT
) {
1086 viacursor
.hot
= cursor
->hot
;
1087 temp
= ((viacursor
.hot
.x
) << 16) + viacursor
.hot
.y
;
1088 writel(temp
, viaparinfo
->io_virt
+ VIA_REG_CURSOR_ORG
);
1091 if (cursor
->set
& FB_CUR_SETPOS
) {
1092 viacursor
.image
.dx
= cursor
->image
.dx
;
1093 viacursor
.image
.dy
= cursor
->image
.dy
;
1094 yy
= cursor
->image
.dy
- info
->var
.yoffset
;
1095 xx
= cursor
->image
.dx
- info
->var
.xoffset
;
1098 writel(temp
, viaparinfo
->io_virt
+ VIA_REG_CURSOR_POS
);
1101 if (cursor
->set
& FB_CUR_SETSIZE
) {
1102 temp
= readl(viaparinfo
->io_virt
+ VIA_REG_CURSOR_MODE
);
1104 if ((cursor
->image
.width
<= 32)
1105 && (cursor
->image
.height
<= 32)) {
1108 } else if ((cursor
->image
.width
<= 64)
1109 && (cursor
->image
.height
<= 64)) {
1114 "The cursor image is biger than 64x64 bits...\n");
1117 writel(temp
, viaparinfo
->io_virt
+ VIA_REG_CURSOR_MODE
);
1119 viacursor
.image
.height
= cursor
->image
.height
;
1120 viacursor
.image
.width
= cursor
->image
.width
;
1123 if (cursor
->set
& FB_CUR_SETCMAP
) {
1124 viacursor
.image
.fg_color
= cursor
->image
.fg_color
;
1125 viacursor
.image
.bg_color
= cursor
->image
.bg_color
;
1127 switch (info
->var
.bits_per_pixel
) {
1133 (((info
->cmap
.red
)[viacursor
.image
.bg_color
] &
1135 ((info
->cmap
.green
)[viacursor
.image
.bg_color
] &
1137 (((info
->cmap
.blue
)[viacursor
.image
.bg_color
] &
1141 (((info
->cmap
.red
)[viacursor
.image
.fg_color
] &
1143 ((info
->cmap
.green
)[viacursor
.image
.fg_color
] &
1145 (((info
->cmap
.blue
)[viacursor
.image
.fg_color
] &
1152 /* This is indeed a patch for VT3324/VT3353 */
1155 p_viafb_par
= (struct viafb_par
*)info
->par
;
1157 if ((p_viafb_par
->chip_info
->gfx_chip_name
==
1159 ((p_viafb_par
->chip_info
->gfx_chip_name
==
1160 UNICHROME_VX800
))) {
1162 (((info
->cmap
.red
)[viacursor
.image
.bg_color
] &
1164 (((info
->cmap
.green
)[viacursor
.image
.bg_color
] &
1166 (((info
->cmap
.blue
)[viacursor
.image
.bg_color
] &
1169 (((info
->cmap
.red
)[viacursor
.image
.fg_color
] &
1171 (((info
->cmap
.green
)[viacursor
.image
.fg_color
] &
1173 (((info
->cmap
.blue
)[viacursor
.image
.fg_color
] &
1177 writel(bg_col
, viaparinfo
->io_virt
+ VIA_REG_CURSOR_BG
);
1178 writel(fg_col
, viaparinfo
->io_virt
+ VIA_REG_CURSOR_FG
);
1181 if (cursor
->set
& FB_CUR_SETSHAPE
) {
1183 u8 data
[CURSOR_SIZE
/ 8];
1184 u32 bak
[CURSOR_SIZE
/ 32];
1185 } *cr_data
= kzalloc(sizeof(*cr_data
), GFP_ATOMIC
);
1187 ((viacursor
.image
.width
+ 7) >> 3) *
1188 viacursor
.image
.height
;
1190 if (cr_data
== NULL
)
1193 if (MAX_CURS
== 32) {
1194 for (i
= 0; i
< (CURSOR_SIZE
/ 32); i
++) {
1195 cr_data
->bak
[i
] = 0x0;
1196 cr_data
->bak
[i
+ 1] = 0xFFFFFFFF;
1199 } else if (MAX_CURS
== 64) {
1200 for (i
= 0; i
< (CURSOR_SIZE
/ 32); i
++) {
1201 cr_data
->bak
[i
] = 0x0;
1202 cr_data
->bak
[i
+ 1] = 0x0;
1203 cr_data
->bak
[i
+ 2] = 0xFFFFFFFF;
1204 cr_data
->bak
[i
+ 3] = 0xFFFFFFFF;
1209 switch (viacursor
.rop
) {
1211 for (i
= 0; i
< size
; i
++)
1212 cr_data
->data
[i
] = viacursor
.mask
[i
];
1216 for (i
= 0; i
< size
; i
++)
1217 cr_data
->data
[i
] = viacursor
.mask
[i
];
1223 if (MAX_CURS
== 32) {
1224 for (i
= 0; i
< size
; i
++) {
1225 cr_data
->bak
[j
] = (u32
) cr_data
->data
[i
];
1226 cr_data
->bak
[j
+ 1] = ~cr_data
->bak
[j
];
1229 } else if (MAX_CURS
== 64) {
1230 for (i
= 0; i
< size
; i
++) {
1231 cr_data
->bak
[j
] = (u32
) cr_data
->data
[i
];
1232 cr_data
->bak
[j
+ 1] = 0x0;
1233 cr_data
->bak
[j
+ 2] = ~cr_data
->bak
[j
];
1234 cr_data
->bak
[j
+ 3] = ~cr_data
->bak
[j
+ 1];
1239 memcpy(((struct viafb_par
*)(info
->par
))->fbmem_virt
+
1240 ((struct viafb_par
*)(info
->par
))->cursor_start
,
1241 cr_data
->bak
, CURSOR_SIZE
);
1246 if (viacursor
.enable
)
1247 viafb_show_hw_cursor(info
, HW_Cursor_ON
);
1252 static int viafb_sync(struct fb_info
*info
)
1255 viafb_wait_engine_idle();
1259 int viafb_get_mode_index(int hres
, int vres
, int flag
)
1262 DEBUG_MSG(KERN_INFO
"viafb_get_mode_index!\n");
1264 for (i
= 0; viafb_modentry
[i
].mode_index
!= VIA_RES_INVALID
; i
++)
1265 if (viafb_modentry
[i
].xres
== hres
&&
1266 viafb_modentry
[i
].yres
== vres
)
1269 viafb_resMode
= viafb_modentry
[i
].mode_index
;
1271 viafb_mode1
= viafb_modentry
[i
].mode_res
;
1273 viafb_mode
= viafb_modentry
[i
].mode_res
;
1275 return viafb_resMode
;
1278 static void check_available_device_to_enable(int device_id
)
1283 viafb_CRT_ON
= STATE_OFF
;
1284 viafb_DVI_ON
= STATE_OFF
;
1285 viafb_LCD_ON
= STATE_OFF
;
1286 viafb_LCD2_ON
= STATE_OFF
;
1287 viafb_DeviceStatus
= None_Device
;
1289 if ((device_id
& CRT_Device
) && (device_num
< MAX_ACTIVE_DEV_NUM
)) {
1290 viafb_CRT_ON
= STATE_ON
;
1292 viafb_DeviceStatus
|= CRT_Device
;
1295 if ((device_id
& DVI_Device
) && (device_num
< MAX_ACTIVE_DEV_NUM
)) {
1296 viafb_DVI_ON
= STATE_ON
;
1298 viafb_DeviceStatus
|= DVI_Device
;
1301 if ((device_id
& LCD_Device
) && (device_num
< MAX_ACTIVE_DEV_NUM
)) {
1302 viafb_LCD_ON
= STATE_ON
;
1304 viafb_DeviceStatus
|= LCD_Device
;
1307 if ((device_id
& LCD2_Device
) && (device_num
< MAX_ACTIVE_DEV_NUM
)) {
1308 viafb_LCD2_ON
= STATE_ON
;
1310 viafb_DeviceStatus
|= LCD2_Device
;
1313 if (viafb_DeviceStatus
== None_Device
) {
1314 /* Use CRT as default active device: */
1315 viafb_CRT_ON
= STATE_ON
;
1316 viafb_DeviceStatus
= CRT_Device
;
1318 DEBUG_MSG(KERN_INFO
"Device Status:%x", viafb_DeviceStatus
);
1321 static void viafb_set_device(struct device_t active_dev
)
1323 /* Check available device to enable: */
1324 int device_id
= None_Device
;
1326 device_id
|= CRT_Device
;
1328 device_id
|= DVI_Device
;
1330 device_id
|= LCD_Device
;
1332 check_available_device_to_enable(device_id
);
1334 /* Check property of LCD: */
1336 if (active_dev
.lcd_dsp_cent
) {
1337 viaparinfo
->lvds_setting_info
->display_method
=
1338 viafb_lcd_dsp_method
= LCD_CENTERING
;
1340 viaparinfo
->lvds_setting_info
->display_method
=
1341 viafb_lcd_dsp_method
= LCD_EXPANDSION
;
1344 if (active_dev
.lcd_mode
== LCD_SPWG
) {
1345 viaparinfo
->lvds_setting_info
->lcd_mode
=
1346 viafb_lcd_mode
= LCD_SPWG
;
1348 viaparinfo
->lvds_setting_info
->lcd_mode
=
1349 viafb_lcd_mode
= LCD_OPENLDI
;
1352 if (active_dev
.lcd_panel_id
<= LCD_PANEL_ID_MAXIMUM
) {
1353 viafb_lcd_panel_id
= active_dev
.lcd_panel_id
;
1354 viafb_init_lcd_size();
1358 /* Check property of mode: */
1359 if (!active_dev
.xres1
)
1360 viafb_second_xres
= 640;
1362 viafb_second_xres
= active_dev
.xres1
;
1363 if (!active_dev
.yres1
)
1364 viafb_second_yres
= 480;
1366 viafb_second_yres
= active_dev
.yres1
;
1367 if (active_dev
.bpp
!= 0)
1368 viafb_bpp
= active_dev
.bpp
;
1369 if (active_dev
.bpp1
!= 0)
1370 viafb_bpp1
= active_dev
.bpp1
;
1371 if (active_dev
.refresh
!= 0)
1372 viafb_refresh
= active_dev
.refresh
;
1373 if (active_dev
.refresh1
!= 0)
1374 viafb_refresh1
= active_dev
.refresh1
;
1375 if ((active_dev
.samm
== STATE_OFF
) || (active_dev
.samm
== STATE_ON
))
1376 viafb_SAMM_ON
= active_dev
.samm
;
1377 viafb_primary_dev
= active_dev
.primary_dev
;
1379 viafb_set_start_addr();
1380 viafb_set_iga_path();
1383 static void viafb_set_video_device(u32 video_dev_info
)
1385 viaparinfo
->video_on_crt
= STATE_OFF
;
1386 viaparinfo
->video_on_dvi
= STATE_OFF
;
1387 viaparinfo
->video_on_lcd
= STATE_OFF
;
1389 /* Check available device to enable: */
1390 if ((video_dev_info
& CRT_Device
) == CRT_Device
)
1391 viaparinfo
->video_on_crt
= STATE_ON
;
1392 else if ((video_dev_info
& DVI_Device
) == DVI_Device
)
1393 viaparinfo
->video_on_dvi
= STATE_ON
;
1394 else if ((video_dev_info
& LCD_Device
) == LCD_Device
)
1395 viaparinfo
->video_on_lcd
= STATE_ON
;
1398 static void viafb_get_video_device(u32
*video_dev_info
)
1400 *video_dev_info
= None_Device
;
1401 if (viaparinfo
->video_on_crt
== STATE_ON
)
1402 *video_dev_info
|= CRT_Device
;
1403 else if (viaparinfo
->video_on_dvi
== STATE_ON
)
1404 *video_dev_info
|= DVI_Device
;
1405 else if (viaparinfo
->video_on_lcd
== STATE_ON
)
1406 *video_dev_info
|= LCD_Device
;
1409 static int get_primary_device(void)
1411 int primary_device
= 0;
1412 /* Rule: device on iga1 path are the primary device. */
1413 if (viafb_SAMM_ON
) {
1415 if (viaparinfo
->crt_setting_info
->iga_path
== IGA1
) {
1416 DEBUG_MSG(KERN_INFO
"CRT IGA Path:%d\n",
1418 crt_setting_info
->iga_path
);
1419 primary_device
= CRT_Device
;
1423 if (viaparinfo
->tmds_setting_info
->iga_path
== IGA1
) {
1424 DEBUG_MSG(KERN_INFO
"DVI IGA Path:%d\n",
1426 tmds_setting_info
->iga_path
);
1427 primary_device
= DVI_Device
;
1431 if (viaparinfo
->lvds_setting_info
->iga_path
== IGA1
) {
1432 DEBUG_MSG(KERN_INFO
"LCD IGA Path:%d\n",
1434 lvds_setting_info
->iga_path
);
1435 primary_device
= LCD_Device
;
1438 if (viafb_LCD2_ON
) {
1439 if (viaparinfo
->lvds_setting_info2
->iga_path
== IGA1
) {
1440 DEBUG_MSG(KERN_INFO
"LCD2 IGA Path:%d\n",
1442 lvds_setting_info2
->iga_path
);
1443 primary_device
= LCD2_Device
;
1447 return primary_device
;
1450 static u8
is_duoview(void)
1452 if (0 == viafb_SAMM_ON
) {
1453 if (viafb_LCD_ON
+ viafb_LCD2_ON
+
1454 viafb_DVI_ON
+ viafb_CRT_ON
== 2)
1462 static void apply_second_mode_setting(struct fb_var_screeninfo
1465 u32 htotal
, vtotal
, long_refresh
;
1467 htotal
= sec_var
->xres
+ sec_var
->left_margin
+
1468 sec_var
->right_margin
+ sec_var
->hsync_len
;
1469 vtotal
= sec_var
->yres
+ sec_var
->upper_margin
+
1470 sec_var
->lower_margin
+ sec_var
->vsync_len
;
1471 if ((sec_var
->xres_virtual
* (sec_var
->bits_per_pixel
>> 3)) & 0x1F) {
1472 /*Is 32 bytes alignment? */
1473 /*32 pixel alignment */
1474 sec_var
->xres_virtual
= (sec_var
->xres_virtual
+ 31) & ~31;
1477 htotal
= sec_var
->xres
+ sec_var
->left_margin
+
1478 sec_var
->right_margin
+ sec_var
->hsync_len
;
1479 vtotal
= sec_var
->yres
+ sec_var
->upper_margin
+
1480 sec_var
->lower_margin
+ sec_var
->vsync_len
;
1481 long_refresh
= 1000000000UL / sec_var
->pixclock
* 1000;
1482 long_refresh
/= (htotal
* vtotal
);
1484 viafb_second_xres
= sec_var
->xres
;
1485 viafb_second_yres
= sec_var
->yres
;
1486 viafb_second_virtual_xres
= sec_var
->xres_virtual
;
1487 viafb_second_virtual_yres
= sec_var
->yres_virtual
;
1488 viafb_bpp1
= sec_var
->bits_per_pixel
;
1489 viafb_refresh1
= viafb_get_refresh(sec_var
->xres
, sec_var
->yres
,
1493 static int apply_device_setting(struct viafb_ioctl_setting setting_info
,
1494 struct fb_info
*info
)
1496 int need_set_mode
= 0;
1497 DEBUG_MSG(KERN_INFO
"apply_device_setting\n");
1499 if (setting_info
.device_flag
) {
1501 check_available_device_to_enable(setting_info
.device_status
);
1504 /* Unlock LCD's operation according to LCD flag
1505 and check if the setting value is valid. */
1506 /* If the value is valid, apply the new setting value to the device. */
1508 if (setting_info
.lcd_operation_flag
& OP_LCD_CENTERING
) {
1510 if (setting_info
.lcd_attributes
.display_center
) {
1512 viaparinfo
->lvds_setting_info
->display_method
=
1514 viafb_lcd_dsp_method
= LCD_CENTERING
;
1515 viaparinfo
->lvds_setting_info2
->display_method
=
1516 viafb_lcd_dsp_method
= LCD_CENTERING
;
1519 viaparinfo
->lvds_setting_info
->display_method
=
1521 viafb_lcd_dsp_method
= LCD_EXPANDSION
;
1522 viaparinfo
->lvds_setting_info2
->display_method
=
1524 viafb_lcd_dsp_method
= LCD_EXPANDSION
;
1528 if (setting_info
.lcd_operation_flag
& OP_LCD_MODE
) {
1530 if (setting_info
.lcd_attributes
.lcd_mode
==
1532 viaparinfo
->lvds_setting_info
->lcd_mode
=
1533 viafb_lcd_mode
= LCD_SPWG
;
1535 viaparinfo
->lvds_setting_info
->lcd_mode
=
1536 viafb_lcd_mode
= LCD_OPENLDI
;
1538 viaparinfo
->lvds_setting_info2
->lcd_mode
=
1539 viaparinfo
->lvds_setting_info
->lcd_mode
;
1542 if (setting_info
.lcd_operation_flag
& OP_LCD_PANEL_ID
) {
1544 if (setting_info
.lcd_attributes
.panel_id
<=
1545 LCD_PANEL_ID_MAXIMUM
) {
1546 viafb_lcd_panel_id
=
1547 setting_info
.lcd_attributes
.panel_id
;
1548 viafb_init_lcd_size();
1553 if (0 != (setting_info
.samm_status
& OP_SAMM
)) {
1554 setting_info
.samm_status
=
1555 setting_info
.samm_status
& (~OP_SAMM
);
1556 if (setting_info
.samm_status
== 0
1557 || setting_info
.samm_status
== 1) {
1558 viafb_SAMM_ON
= setting_info
.samm_status
;
1561 viafb_primary_dev
= setting_info
.primary_device
;
1563 viafb_set_start_addr();
1564 viafb_set_iga_path();
1569 viaparinfo
->duoview
= is_duoview();
1571 if (!need_set_mode
) {
1574 viafb_set_iga_path();
1575 viafb_set_par(info
);
1580 static void retrieve_device_setting(struct viafb_ioctl_setting
1584 /* get device status */
1585 if (viafb_CRT_ON
== 1)
1586 setting_info
->device_status
= CRT_Device
;
1587 if (viafb_DVI_ON
== 1)
1588 setting_info
->device_status
|= DVI_Device
;
1589 if (viafb_LCD_ON
== 1)
1590 setting_info
->device_status
|= LCD_Device
;
1591 if (viafb_LCD2_ON
== 1)
1592 setting_info
->device_status
|= LCD2_Device
;
1593 if ((viaparinfo
->video_on_crt
== 1) && (viafb_CRT_ON
== 1)) {
1594 setting_info
->video_device_status
=
1595 viaparinfo
->crt_setting_info
->iga_path
;
1596 } else if ((viaparinfo
->video_on_dvi
== 1) && (viafb_DVI_ON
== 1)) {
1597 setting_info
->video_device_status
=
1598 viaparinfo
->tmds_setting_info
->iga_path
;
1599 } else if ((viaparinfo
->video_on_lcd
== 1) && (viafb_LCD_ON
== 1)) {
1600 setting_info
->video_device_status
=
1601 viaparinfo
->lvds_setting_info
->iga_path
;
1603 setting_info
->video_device_status
= 0;
1606 setting_info
->samm_status
= viafb_SAMM_ON
;
1607 setting_info
->primary_device
= get_primary_device();
1609 setting_info
->first_dev_bpp
= viafb_bpp
;
1610 setting_info
->second_dev_bpp
= viafb_bpp1
;
1612 setting_info
->first_dev_refresh
= viafb_refresh
;
1613 setting_info
->second_dev_refresh
= viafb_refresh1
;
1615 setting_info
->first_dev_hor_res
= viafb_hotplug_Xres
;
1616 setting_info
->first_dev_ver_res
= viafb_hotplug_Yres
;
1617 setting_info
->second_dev_hor_res
= viafb_second_xres
;
1618 setting_info
->second_dev_ver_res
= viafb_second_yres
;
1620 /* Get lcd attributes */
1621 setting_info
->lcd_attributes
.display_center
= viafb_lcd_dsp_method
;
1622 setting_info
->lcd_attributes
.panel_id
= viafb_lcd_panel_id
;
1623 setting_info
->lcd_attributes
.lcd_mode
= viafb_lcd_mode
;
1626 static void parse_active_dev(void)
1628 viafb_CRT_ON
= STATE_OFF
;
1629 viafb_DVI_ON
= STATE_OFF
;
1630 viafb_LCD_ON
= STATE_OFF
;
1631 viafb_LCD2_ON
= STATE_OFF
;
1632 /* 1. Modify the active status of devices. */
1633 /* 2. Keep the order of devices, so we can set corresponding
1634 IGA path to devices in SAMM case. */
1635 /* Note: The previous of active_dev is primary device,
1636 and the following is secondary device. */
1637 if (!strncmp(viafb_active_dev
, "CRT+DVI", 7)) {
1639 viafb_CRT_ON
= STATE_ON
;
1640 viafb_DVI_ON
= STATE_ON
;
1641 viafb_primary_dev
= CRT_Device
;
1642 } else if (!strncmp(viafb_active_dev
, "DVI+CRT", 7)) {
1644 viafb_CRT_ON
= STATE_ON
;
1645 viafb_DVI_ON
= STATE_ON
;
1646 viafb_primary_dev
= DVI_Device
;
1647 } else if (!strncmp(viafb_active_dev
, "CRT+LCD", 7)) {
1649 viafb_CRT_ON
= STATE_ON
;
1650 viafb_LCD_ON
= STATE_ON
;
1651 viafb_primary_dev
= CRT_Device
;
1652 } else if (!strncmp(viafb_active_dev
, "LCD+CRT", 7)) {
1654 viafb_CRT_ON
= STATE_ON
;
1655 viafb_LCD_ON
= STATE_ON
;
1656 viafb_primary_dev
= LCD_Device
;
1657 } else if (!strncmp(viafb_active_dev
, "DVI+LCD", 7)) {
1659 viafb_DVI_ON
= STATE_ON
;
1660 viafb_LCD_ON
= STATE_ON
;
1661 viafb_primary_dev
= DVI_Device
;
1662 } else if (!strncmp(viafb_active_dev
, "LCD+DVI", 7)) {
1664 viafb_DVI_ON
= STATE_ON
;
1665 viafb_LCD_ON
= STATE_ON
;
1666 viafb_primary_dev
= LCD_Device
;
1667 } else if (!strncmp(viafb_active_dev
, "LCD+LCD2", 8)) {
1668 viafb_LCD_ON
= STATE_ON
;
1669 viafb_LCD2_ON
= STATE_ON
;
1670 viafb_primary_dev
= LCD_Device
;
1671 } else if (!strncmp(viafb_active_dev
, "LCD2+LCD", 8)) {
1672 viafb_LCD_ON
= STATE_ON
;
1673 viafb_LCD2_ON
= STATE_ON
;
1674 viafb_primary_dev
= LCD2_Device
;
1675 } else if (!strncmp(viafb_active_dev
, "CRT", 3)) {
1677 viafb_CRT_ON
= STATE_ON
;
1678 viafb_SAMM_ON
= STATE_OFF
;
1679 } else if (!strncmp(viafb_active_dev
, "DVI", 3)) {
1681 viafb_DVI_ON
= STATE_ON
;
1682 viafb_SAMM_ON
= STATE_OFF
;
1683 } else if (!strncmp(viafb_active_dev
, "LCD", 3)) {
1685 viafb_LCD_ON
= STATE_ON
;
1686 viafb_SAMM_ON
= STATE_OFF
;
1688 viafb_CRT_ON
= STATE_ON
;
1689 viafb_SAMM_ON
= STATE_OFF
;
1691 viaparinfo
->duoview
= is_duoview();
1694 static void parse_video_dev(void)
1696 viaparinfo
->video_on_crt
= STATE_OFF
;
1697 viaparinfo
->video_on_dvi
= STATE_OFF
;
1698 viaparinfo
->video_on_lcd
= STATE_OFF
;
1700 if (!strncmp(viafb_video_dev
, "CRT", 3)) {
1702 viaparinfo
->video_on_crt
= STATE_ON
;
1703 } else if (!strncmp(viafb_video_dev
, "DVI", 3)) {
1705 viaparinfo
->video_on_dvi
= STATE_ON
;
1706 } else if (!strncmp(viafb_video_dev
, "LCD", 3)) {
1708 viaparinfo
->video_on_lcd
= STATE_ON
;
1712 static int parse_port(char *opt_str
, int *output_interface
)
1714 if (!strncmp(opt_str
, "DVP0", 4))
1715 *output_interface
= INTERFACE_DVP0
;
1716 else if (!strncmp(opt_str
, "DVP1", 4))
1717 *output_interface
= INTERFACE_DVP1
;
1718 else if (!strncmp(opt_str
, "DFP_HIGHLOW", 11))
1719 *output_interface
= INTERFACE_DFP
;
1720 else if (!strncmp(opt_str
, "DFP_HIGH", 8))
1721 *output_interface
= INTERFACE_DFP_HIGH
;
1722 else if (!strncmp(opt_str
, "DFP_LOW", 7))
1723 *output_interface
= INTERFACE_DFP_LOW
;
1725 *output_interface
= INTERFACE_NONE
;
1729 static void parse_lcd_port(void)
1731 parse_port(viafb_lcd_port
, &viaparinfo
->chip_info
->lvds_chip_info
.
1733 /*Initialize to avoid unexpected behavior */
1734 viaparinfo
->chip_info
->lvds_chip_info2
.output_interface
=
1737 DEBUG_MSG(KERN_INFO
"parse_lcd_port: viafb_lcd_port:%s,interface:%d\n",
1738 viafb_lcd_port
, viaparinfo
->chip_info
->lvds_chip_info
.
1742 static void parse_dvi_port(void)
1744 parse_port(viafb_dvi_port
, &viaparinfo
->chip_info
->tmds_chip_info
.
1747 DEBUG_MSG(KERN_INFO
"parse_dvi_port: viafb_dvi_port:%s,interface:%d\n",
1748 viafb_dvi_port
, viaparinfo
->chip_info
->tmds_chip_info
.
1753 * The proc filesystem read/write function, a simple proc implement to
1754 * get/set the value of DPA DVP0, DVP0DataDriving, DVP0ClockDriving, DVP1,
1755 * DVP1Driving, DFPHigh, DFPLow CR96, SR2A[5], SR1B[1], SR2A[4], SR1E[2],
1756 * CR9B, SR65, CR97, CR99
1758 static int viafb_dvp0_proc_read(char *buf
, char **start
, off_t offset
,
1759 int count
, int *eof
, void *data
)
1762 u8 dvp0_data_dri
= 0, dvp0_clk_dri
= 0, dvp0
= 0;
1764 (viafb_read_reg(VIASR
, SR2A
) & BIT5
) >> 4 |
1765 (viafb_read_reg(VIASR
, SR1B
) & BIT1
) >> 1;
1767 (viafb_read_reg(VIASR
, SR2A
) & BIT4
) >> 3 |
1768 (viafb_read_reg(VIASR
, SR1E
) & BIT2
) >> 2;
1769 dvp0
= viafb_read_reg(VIACR
, CR96
) & 0x0f;
1771 sprintf(buf
+ len
, "%x %x %x\n", dvp0
, dvp0_data_dri
, dvp0_clk_dri
);
1772 *eof
= 1; /*Inform kernel end of data */
1775 static int viafb_dvp0_proc_write(struct file
*file
,
1776 const char __user
*buffer
, unsigned long count
, void *data
)
1778 char buf
[20], *value
, *pbuf
;
1780 unsigned long length
, i
;
1783 length
= count
> 20 ? 20 : count
;
1784 if (copy_from_user(&buf
[0], buffer
, length
))
1786 buf
[length
- 1] = '\0'; /*Ensure end string */
1788 for (i
= 0; i
< 3; i
++) {
1789 value
= strsep(&pbuf
, " ");
1790 if (value
!= NULL
) {
1791 strict_strtoul(value
, 0, (unsigned long *)®_val
);
1792 DEBUG_MSG(KERN_INFO
"DVP0:reg_val[%l]=:%x\n", i
,
1796 viafb_write_reg_mask(CR96
, VIACR
,
1800 viafb_write_reg_mask(SR2A
, VIASR
,
1801 reg_val
<< 4, BIT5
);
1802 viafb_write_reg_mask(SR1B
, VIASR
,
1803 reg_val
<< 1, BIT1
);
1806 viafb_write_reg_mask(SR2A
, VIASR
,
1807 reg_val
<< 3, BIT4
);
1808 viafb_write_reg_mask(SR1E
, VIASR
,
1809 reg_val
<< 2, BIT2
);
1820 static int viafb_dvp1_proc_read(char *buf
, char **start
, off_t offset
,
1821 int count
, int *eof
, void *data
)
1824 u8 dvp1
= 0, dvp1_data_dri
= 0, dvp1_clk_dri
= 0;
1825 dvp1
= viafb_read_reg(VIACR
, CR9B
) & 0x0f;
1826 dvp1_data_dri
= (viafb_read_reg(VIASR
, SR65
) & 0x0c) >> 2;
1827 dvp1_clk_dri
= viafb_read_reg(VIASR
, SR65
) & 0x03;
1829 sprintf(buf
+ len
, "%x %x %x\n", dvp1
, dvp1_data_dri
, dvp1_clk_dri
);
1830 *eof
= 1; /*Inform kernel end of data */
1833 static int viafb_dvp1_proc_write(struct file
*file
,
1834 const char __user
*buffer
, unsigned long count
, void *data
)
1836 char buf
[20], *value
, *pbuf
;
1838 unsigned long length
, i
;
1841 length
= count
> 20 ? 20 : count
;
1842 if (copy_from_user(&buf
[0], buffer
, length
))
1844 buf
[length
- 1] = '\0'; /*Ensure end string */
1846 for (i
= 0; i
< 3; i
++) {
1847 value
= strsep(&pbuf
, " ");
1848 if (value
!= NULL
) {
1849 strict_strtoul(value
, 0, (unsigned long *)®_val
);
1852 viafb_write_reg_mask(CR9B
, VIACR
,
1856 viafb_write_reg_mask(SR65
, VIASR
,
1857 reg_val
<< 2, 0x0c);
1860 viafb_write_reg_mask(SR65
, VIASR
,
1873 static int viafb_dfph_proc_read(char *buf
, char **start
, off_t offset
,
1874 int count
, int *eof
, void *data
)
1878 dfp_high
= viafb_read_reg(VIACR
, CR97
) & 0x0f;
1879 len
+= sprintf(buf
+ len
, "%x\n", dfp_high
);
1880 *eof
= 1; /*Inform kernel end of data */
1883 static int viafb_dfph_proc_write(struct file
*file
,
1884 const char __user
*buffer
, unsigned long count
, void *data
)
1888 unsigned long length
;
1891 length
= count
> 20 ? 20 : count
;
1892 if (copy_from_user(&buf
[0], buffer
, length
))
1894 buf
[length
- 1] = '\0'; /*Ensure end string */
1895 strict_strtoul(&buf
[0], 0, (unsigned long *)®_val
);
1896 viafb_write_reg_mask(CR97
, VIACR
, reg_val
, 0x0f);
1899 static int viafb_dfpl_proc_read(char *buf
, char **start
, off_t offset
,
1900 int count
, int *eof
, void *data
)
1904 dfp_low
= viafb_read_reg(VIACR
, CR99
) & 0x0f;
1905 len
+= sprintf(buf
+ len
, "%x\n", dfp_low
);
1906 *eof
= 1; /*Inform kernel end of data */
1909 static int viafb_dfpl_proc_write(struct file
*file
,
1910 const char __user
*buffer
, unsigned long count
, void *data
)
1914 unsigned long length
;
1917 length
= count
> 20 ? 20 : count
;
1918 if (copy_from_user(&buf
[0], buffer
, length
))
1920 buf
[length
- 1] = '\0'; /*Ensure end string */
1921 strict_strtoul(&buf
[0], 0, (unsigned long *)®_val
);
1922 viafb_write_reg_mask(CR99
, VIACR
, reg_val
, 0x0f);
1925 static int viafb_vt1636_proc_read(char *buf
, char **start
,
1926 off_t offset
, int count
, int *eof
, void *data
)
1929 u8 vt1636_08
= 0, vt1636_09
= 0;
1930 switch (viaparinfo
->chip_info
->lvds_chip_info
.lvds_chip_name
) {
1933 viafb_gpio_i2c_read_lvds(viaparinfo
->lvds_setting_info
,
1934 &viaparinfo
->chip_info
->lvds_chip_info
, 0x08) & 0x0f;
1936 viafb_gpio_i2c_read_lvds(viaparinfo
->lvds_setting_info
,
1937 &viaparinfo
->chip_info
->lvds_chip_info
, 0x09) & 0x1f;
1938 len
+= sprintf(buf
+ len
, "%x %x\n", vt1636_08
, vt1636_09
);
1943 switch (viaparinfo
->chip_info
->lvds_chip_info2
.lvds_chip_name
) {
1946 viafb_gpio_i2c_read_lvds(viaparinfo
->lvds_setting_info2
,
1947 &viaparinfo
->chip_info
->lvds_chip_info2
, 0x08) & 0x0f;
1949 viafb_gpio_i2c_read_lvds(viaparinfo
->lvds_setting_info2
,
1950 &viaparinfo
->chip_info
->lvds_chip_info2
, 0x09) & 0x1f;
1951 len
+= sprintf(buf
+ len
, " %x %x\n", vt1636_08
, vt1636_09
);
1956 *eof
= 1; /*Inform kernel end of data */
1959 static int viafb_vt1636_proc_write(struct file
*file
,
1960 const char __user
*buffer
, unsigned long count
, void *data
)
1962 char buf
[30], *value
, *pbuf
;
1963 struct IODATA reg_val
;
1964 unsigned long length
, i
;
1967 length
= count
> 30 ? 30 : count
;
1968 if (copy_from_user(&buf
[0], buffer
, length
))
1970 buf
[length
- 1] = '\0'; /*Ensure end string */
1972 switch (viaparinfo
->chip_info
->lvds_chip_info
.lvds_chip_name
) {
1974 for (i
= 0; i
< 2; i
++) {
1975 value
= strsep(&pbuf
, " ");
1976 if (value
!= NULL
) {
1977 strict_strtoul(value
, 0,
1978 (unsigned long *)®_val
.Data
);
1981 reg_val
.Index
= 0x08;
1982 reg_val
.Mask
= 0x0f;
1983 viafb_gpio_i2c_write_mask_lvds
1984 (viaparinfo
->lvds_setting_info
,
1986 chip_info
->lvds_chip_info
,
1990 reg_val
.Index
= 0x09;
1991 reg_val
.Mask
= 0x1f;
1992 viafb_gpio_i2c_write_mask_lvds
1993 (viaparinfo
->lvds_setting_info
,
1995 chip_info
->lvds_chip_info
,
2009 switch (viaparinfo
->chip_info
->lvds_chip_info2
.lvds_chip_name
) {
2011 for (i
= 0; i
< 2; i
++) {
2012 value
= strsep(&pbuf
, " ");
2013 if (value
!= NULL
) {
2014 strict_strtoul(value
, 0,
2015 (unsigned long *)®_val
.Data
);
2018 reg_val
.Index
= 0x08;
2019 reg_val
.Mask
= 0x0f;
2020 viafb_gpio_i2c_write_mask_lvds
2021 (viaparinfo
->lvds_setting_info2
,
2023 chip_info
->lvds_chip_info2
,
2027 reg_val
.Index
= 0x09;
2028 reg_val
.Mask
= 0x1f;
2029 viafb_gpio_i2c_write_mask_lvds
2030 (viaparinfo
->lvds_setting_info2
,
2032 chip_info
->lvds_chip_info2
,
2049 static void viafb_init_proc(struct proc_dir_entry
**viafb_entry
)
2051 struct proc_dir_entry
*entry
;
2052 *viafb_entry
= proc_mkdir("viafb", NULL
);
2054 entry
= create_proc_entry("dvp0", 0, *viafb_entry
);
2056 entry
->owner
= THIS_MODULE
;
2057 entry
->read_proc
= viafb_dvp0_proc_read
;
2058 entry
->write_proc
= viafb_dvp0_proc_write
;
2060 entry
= create_proc_entry("dvp1", 0, *viafb_entry
);
2062 entry
->owner
= THIS_MODULE
;
2063 entry
->read_proc
= viafb_dvp1_proc_read
;
2064 entry
->write_proc
= viafb_dvp1_proc_write
;
2066 entry
= create_proc_entry("dfph", 0, *viafb_entry
);
2068 entry
->owner
= THIS_MODULE
;
2069 entry
->read_proc
= viafb_dfph_proc_read
;
2070 entry
->write_proc
= viafb_dfph_proc_write
;
2072 entry
= create_proc_entry("dfpl", 0, *viafb_entry
);
2074 entry
->owner
= THIS_MODULE
;
2075 entry
->read_proc
= viafb_dfpl_proc_read
;
2076 entry
->write_proc
= viafb_dfpl_proc_write
;
2078 if (VT1636_LVDS
== viaparinfo
->chip_info
->lvds_chip_info
.
2079 lvds_chip_name
|| VT1636_LVDS
==
2080 viaparinfo
->chip_info
->lvds_chip_info2
.lvds_chip_name
) {
2081 entry
= create_proc_entry("vt1636", 0, *viafb_entry
);
2083 entry
->owner
= THIS_MODULE
;
2084 entry
->read_proc
= viafb_vt1636_proc_read
;
2085 entry
->write_proc
= viafb_vt1636_proc_write
;
2091 static void viafb_remove_proc(struct proc_dir_entry
*viafb_entry
)
2093 /* no problem if it was not registered */
2094 remove_proc_entry("dvp0", viafb_entry
);/* parent dir */
2095 remove_proc_entry("dvp1", viafb_entry
);
2096 remove_proc_entry("dfph", viafb_entry
);
2097 remove_proc_entry("dfpl", viafb_entry
);
2098 remove_proc_entry("vt1636", viafb_entry
);
2099 remove_proc_entry("vt1625", viafb_entry
);
2100 remove_proc_entry("viafb", NULL
);
2103 static int __devinit
via_pci_probe(void)
2105 unsigned int default_xres
, default_yres
;
2107 char *tmpc_sec
, *tmpm_sec
;
2109 u32 tmds_length
, lvds_length
, crt_length
, chip_length
, viafb_par_length
;
2111 DEBUG_MSG(KERN_INFO
"VIAFB PCI Probe!!\n");
2113 viafb_par_length
= ALIGN(sizeof(struct viafb_par
), BITS_PER_LONG
/8);
2114 tmds_length
= ALIGN(sizeof(struct tmds_setting_information
),
2116 lvds_length
= ALIGN(sizeof(struct lvds_setting_information
),
2118 crt_length
= ALIGN(sizeof(struct lvds_setting_information
),
2120 chip_length
= ALIGN(sizeof(struct chip_information
), BITS_PER_LONG
/8);
2122 /* Allocate fb_info and ***_par here, also including some other needed
2125 viafbinfo
= framebuffer_alloc(viafb_par_length
+ 2 * lvds_length
+
2126 tmds_length
+ crt_length
+ chip_length
, NULL
);
2128 printk(KERN_ERR
"Could not allocate memory for viafb_info.\n");
2132 viaparinfo
= (struct viafb_par
*)viafbinfo
->par
;
2133 viaparinfo
->tmds_setting_info
= (struct tmds_setting_information
*)
2134 ((unsigned long)viaparinfo
+ viafb_par_length
);
2135 viaparinfo
->lvds_setting_info
= (struct lvds_setting_information
*)
2136 ((unsigned long)viaparinfo
->tmds_setting_info
+ tmds_length
);
2137 viaparinfo
->lvds_setting_info2
= (struct lvds_setting_information
*)
2138 ((unsigned long)viaparinfo
->lvds_setting_info
+ lvds_length
);
2139 viaparinfo
->crt_setting_info
= (struct crt_setting_information
*)
2140 ((unsigned long)viaparinfo
->lvds_setting_info2
+ lvds_length
);
2141 viaparinfo
->chip_info
= (struct chip_information
*)
2142 ((unsigned long)viaparinfo
->crt_setting_info
+ crt_length
);
2151 /* for dual-fb must viafb_SAMM_ON=1 and viafb_dual_fb=1 */
2155 /* Set up I2C bus stuff */
2156 viafb_create_i2c_bus(viaparinfo
);
2158 viafb_init_chip_info();
2159 viafb_get_fb_info(&viaparinfo
->fbmem
, &viaparinfo
->memsize
);
2160 viaparinfo
->fbmem_free
= viaparinfo
->memsize
;
2161 viaparinfo
->fbmem_used
= 0;
2162 viaparinfo
->fbmem_virt
= ioremap_nocache(viaparinfo
->fbmem
,
2163 viaparinfo
->memsize
);
2164 viafbinfo
->screen_base
= (char *)viaparinfo
->fbmem_virt
;
2166 if (!viaparinfo
->fbmem_virt
) {
2167 printk(KERN_INFO
"ioremap failed\n");
2171 viafb_get_mmio_info(&viaparinfo
->mmio_base
, &viaparinfo
->mmio_len
);
2172 viaparinfo
->io_virt
= ioremap_nocache(viaparinfo
->mmio_base
,
2173 viaparinfo
->mmio_len
);
2175 viafbinfo
->node
= 0;
2176 viafbinfo
->fbops
= &viafb_ops
;
2177 viafbinfo
->flags
= FBINFO_DEFAULT
| FBINFO_HWACCEL_YPAN
;
2179 viafbinfo
->pseudo_palette
= pseudo_pal
;
2182 viafb_init_2d_engine();
2183 viafb_hw_cursor_init();
2186 if (viafb_second_size
&& (viafb_second_size
< 8)) {
2187 viafb_second_offset
= viaparinfo
->fbmem_free
-
2188 viafb_second_size
* 1024 * 1024;
2190 viafb_second_size
= 8;
2191 viafb_second_offset
= viaparinfo
->fbmem_free
-
2192 viafb_second_size
* 1024 * 1024;
2195 viafb_FB_MM
= viaparinfo
->fbmem_virt
;
2197 tmpc
= strsep(&tmpm
, "x");
2198 strict_strtoul(tmpc
, 0, (unsigned long *)&default_xres
);
2199 strict_strtoul(tmpm
, 0, (unsigned long *)&default_yres
);
2201 vmode_index
= viafb_get_mode_index(default_xres
, default_yres
, 0);
2202 DEBUG_MSG(KERN_INFO
"0->index=%d\n", vmode_index
);
2204 if (viafb_SAMM_ON
== 1) {
2205 if (strcmp(viafb_mode
, viafb_mode1
)) {
2206 tmpm_sec
= viafb_mode1
;
2207 tmpc_sec
= strsep(&tmpm_sec
, "x");
2208 strict_strtoul(tmpc_sec
, 0,
2209 (unsigned long *)&viafb_second_xres
);
2210 strict_strtoul(tmpm_sec
, 0,
2211 (unsigned long *)&viafb_second_yres
);
2213 viafb_second_xres
= default_xres
;
2214 viafb_second_yres
= default_yres
;
2216 if (0 == viafb_second_virtual_xres
) {
2217 switch (viafb_second_xres
) {
2219 viafb_second_virtual_xres
= 1408;
2222 viafb_second_virtual_xres
= viafb_second_xres
;
2226 if (0 == viafb_second_virtual_yres
)
2227 viafb_second_virtual_yres
= viafb_second_yres
;
2230 switch (viafb_bpp
) {
2243 default_var
.xres
= default_xres
;
2244 default_var
.yres
= default_yres
;
2245 switch (default_xres
) {
2247 default_var
.xres_virtual
= 1408;
2250 default_var
.xres_virtual
= default_xres
;
2253 default_var
.yres_virtual
= default_yres
;
2254 default_var
.bits_per_pixel
= viafb_bpp
;
2255 if (default_var
.bits_per_pixel
== 15)
2256 default_var
.bits_per_pixel
= 16;
2257 default_var
.pixclock
=
2258 viafb_get_pixclock(default_xres
, default_yres
, viafb_refresh
);
2259 default_var
.left_margin
= (default_xres
>> 3) & 0xf8;
2260 default_var
.right_margin
= 32;
2261 default_var
.upper_margin
= 16;
2262 default_var
.lower_margin
= 4;
2263 default_var
.hsync_len
= default_var
.left_margin
;
2264 default_var
.vsync_len
= 4;
2265 default_var
.accel_flags
= 0;
2269 (FBINFO_HWACCEL_COPYAREA
| FBINFO_HWACCEL_FILLRECT
|
2270 FBINFO_HWACCEL_IMAGEBLIT
);
2271 default_var
.accel_flags
|= FB_ACCELF_TEXT
;
2273 viafbinfo
->flags
|= FBINFO_HWACCEL_DISABLED
;
2275 if (viafb_dual_fb
) {
2276 viafbinfo1
= framebuffer_alloc(viafb_par_length
, NULL
);
2279 "allocate the second framebuffer struct error\n");
2280 framebuffer_release(viafbinfo
);
2283 viaparinfo1
= viafbinfo1
->par
;
2284 memcpy(viaparinfo1
, viaparinfo
, viafb_par_length
);
2285 viaparinfo1
->memsize
= viaparinfo
->memsize
-
2286 viafb_second_offset
;
2287 viaparinfo
->memsize
= viafb_second_offset
;
2288 viaparinfo1
->fbmem_virt
= viaparinfo
->fbmem_virt
+
2289 viafb_second_offset
;
2290 viaparinfo1
->fbmem
= viaparinfo
->fbmem
+ viafb_second_offset
;
2292 viaparinfo1
->fbmem_used
= viaparinfo
->fbmem_used
;
2293 viaparinfo1
->fbmem_free
= viaparinfo1
->memsize
-
2294 viaparinfo1
->fbmem_used
;
2295 viaparinfo
->fbmem_free
= viaparinfo
->memsize
;
2296 viaparinfo
->fbmem_used
= 0;
2298 viaparinfo1
->cursor_start
=
2299 viaparinfo
->cursor_start
- viafb_second_offset
;
2300 viaparinfo1
->VQ_start
= viaparinfo
->VQ_start
-
2301 viafb_second_offset
;
2302 viaparinfo1
->VQ_end
= viaparinfo
->VQ_end
-
2303 viafb_second_offset
;
2306 memcpy(viafbinfo1
, viafbinfo
, sizeof(struct fb_info
));
2307 viafbinfo1
->screen_base
= viafbinfo
->screen_base
+
2308 viafb_second_offset
;
2309 viafbinfo1
->fix
.smem_start
= viaparinfo1
->fbmem
;
2310 viafbinfo1
->fix
.smem_len
= viaparinfo1
->fbmem_free
;
2312 default_var
.xres
= viafb_second_xres
;
2313 default_var
.yres
= viafb_second_yres
;
2314 default_var
.xres_virtual
= viafb_second_virtual_xres
;
2315 default_var
.yres_virtual
= viafb_second_virtual_yres
;
2316 if (viafb_bpp1
!= viafb_bpp
)
2317 viafb_bpp1
= viafb_bpp
;
2318 default_var
.bits_per_pixel
= viafb_bpp1
;
2319 default_var
.pixclock
=
2320 viafb_get_pixclock(viafb_second_xres
, viafb_second_yres
,
2322 default_var
.left_margin
= (viafb_second_xres
>> 3) & 0xf8;
2323 default_var
.right_margin
= 32;
2324 default_var
.upper_margin
= 16;
2325 default_var
.lower_margin
= 4;
2326 default_var
.hsync_len
= default_var
.left_margin
;
2327 default_var
.vsync_len
= 4;
2329 viafb_setup_fixinfo(&viafbinfo1
->fix
, viaparinfo1
);
2330 viafb_check_var(&default_var
, viafbinfo1
);
2331 viafbinfo1
->var
= default_var
;
2332 viafb_update_viafb_par(viafbinfo
);
2333 viafb_update_fix(&viafbinfo1
->fix
, viafbinfo1
);
2336 viafb_setup_fixinfo(&viafbinfo
->fix
, viaparinfo
);
2337 viafb_check_var(&default_var
, viafbinfo
);
2338 viafbinfo
->var
= default_var
;
2339 viafb_update_viafb_par(viafbinfo
);
2340 viafb_update_fix(&viafbinfo
->fix
, viafbinfo
);
2341 default_var
.activate
= FB_ACTIVATE_NOW
;
2342 fb_alloc_cmap(&viafbinfo
->cmap
, 256, 0);
2344 if (viafb_dual_fb
&& (viafb_primary_dev
== LCD_Device
)
2345 && (viaparinfo
->chip_info
->gfx_chip_name
== UNICHROME_CLE266
)) {
2346 if (register_framebuffer(viafbinfo1
) < 0)
2349 if (register_framebuffer(viafbinfo
) < 0)
2352 if (viafb_dual_fb
&& ((viafb_primary_dev
!= LCD_Device
)
2353 || (viaparinfo
->chip_info
->gfx_chip_name
!=
2354 UNICHROME_CLE266
))) {
2355 if (register_framebuffer(viafbinfo1
) < 0)
2358 DEBUG_MSG(KERN_INFO
"fb%d: %s frame buffer device %dx%d-%dbpp\n",
2359 viafbinfo
->node
, viafbinfo
->fix
.id
, default_var
.xres
,
2360 default_var
.yres
, default_var
.bits_per_pixel
);
2362 viafb_init_proc(&viaparinfo
->proc_entry
);
2363 viafb_init_dac(IGA2
);
2367 static void __devexit
via_pci_remove(void)
2369 DEBUG_MSG(KERN_INFO
"via_pci_remove!\n");
2370 fb_dealloc_cmap(&viafbinfo
->cmap
);
2371 unregister_framebuffer(viafbinfo
);
2373 unregister_framebuffer(viafbinfo1
);
2374 iounmap((void *)viaparinfo
->fbmem_virt
);
2375 iounmap(viaparinfo
->io_virt
);
2377 viafb_delete_i2c_buss(viaparinfo
);
2379 framebuffer_release(viafbinfo
);
2381 framebuffer_release(viafbinfo1
);
2383 viafb_remove_proc(viaparinfo
->proc_entry
);
2387 static int __init
viafb_setup(char *options
)
2390 DEBUG_MSG(KERN_INFO
"viafb_setup!\n");
2392 if (!options
|| !*options
)
2395 while ((this_opt
= strsep(&options
, ",")) != NULL
) {
2399 if (!strncmp(this_opt
, "viafb_mode1=", 12))
2400 viafb_mode1
= kstrdup(this_opt
+ 12, GFP_KERNEL
);
2401 else if (!strncmp(this_opt
, "viafb_mode=", 11))
2402 viafb_mode
= kstrdup(this_opt
+ 11, GFP_KERNEL
);
2403 else if (!strncmp(this_opt
, "viafb_bpp1=", 11))
2404 strict_strtoul(this_opt
+ 11, 0,
2405 (unsigned long *)&viafb_bpp1
);
2406 else if (!strncmp(this_opt
, "viafb_bpp=", 10))
2407 strict_strtoul(this_opt
+ 10, 0,
2408 (unsigned long *)&viafb_bpp
);
2409 else if (!strncmp(this_opt
, "viafb_refresh1=", 15))
2410 strict_strtoul(this_opt
+ 15, 0,
2411 (unsigned long *)&viafb_refresh1
);
2412 else if (!strncmp(this_opt
, "viafb_refresh=", 14))
2413 strict_strtoul(this_opt
+ 14, 0,
2414 (unsigned long *)&viafb_refresh
);
2415 else if (!strncmp(this_opt
, "viafb_lcd_dsp_method=", 21))
2416 strict_strtoul(this_opt
+ 21, 0,
2417 (unsigned long *)&viafb_lcd_dsp_method
);
2418 else if (!strncmp(this_opt
, "viafb_lcd_panel_id=", 19))
2419 strict_strtoul(this_opt
+ 19, 0,
2420 (unsigned long *)&viafb_lcd_panel_id
);
2421 else if (!strncmp(this_opt
, "viafb_accel=", 12))
2422 strict_strtoul(this_opt
+ 12, 0,
2423 (unsigned long *)&viafb_accel
);
2424 else if (!strncmp(this_opt
, "viafb_SAMM_ON=", 14))
2425 strict_strtoul(this_opt
+ 14, 0,
2426 (unsigned long *)&viafb_SAMM_ON
);
2427 else if (!strncmp(this_opt
, "viafb_active_dev=", 17))
2428 viafb_active_dev
= kstrdup(this_opt
+ 17, GFP_KERNEL
);
2429 else if (!strncmp(this_opt
,
2430 "viafb_display_hardware_layout=", 30))
2431 strict_strtoul(this_opt
+ 30, 0,
2432 (unsigned long *)&viafb_display_hardware_layout
);
2433 else if (!strncmp(this_opt
, "viafb_second_size=", 18))
2434 strict_strtoul(this_opt
+ 18, 0,
2435 (unsigned long *)&viafb_second_size
);
2436 else if (!strncmp(this_opt
,
2437 "viafb_platform_epia_dvi=", 24))
2438 strict_strtoul(this_opt
+ 24, 0,
2439 (unsigned long *)&viafb_platform_epia_dvi
);
2440 else if (!strncmp(this_opt
,
2441 "viafb_device_lcd_dualedge=", 26))
2442 strict_strtoul(this_opt
+ 26, 0,
2443 (unsigned long *)&viafb_device_lcd_dualedge
);
2444 else if (!strncmp(this_opt
, "viafb_bus_width=", 16))
2445 strict_strtoul(this_opt
+ 16, 0,
2446 (unsigned long *)&viafb_bus_width
);
2447 else if (!strncmp(this_opt
, "viafb_lcd_mode=", 15))
2448 strict_strtoul(this_opt
+ 15, 0,
2449 (unsigned long *)&viafb_lcd_mode
);
2450 else if (!strncmp(this_opt
, "viafb_video_dev=", 16))
2451 viafb_video_dev
= kstrdup(this_opt
+ 16, GFP_KERNEL
);
2452 else if (!strncmp(this_opt
, "viafb_lcd_port=", 15))
2453 viafb_lcd_port
= kstrdup(this_opt
+ 15, GFP_KERNEL
);
2454 else if (!strncmp(this_opt
, "viafb_dvi_port=", 15))
2455 viafb_dvi_port
= kstrdup(this_opt
+ 15, GFP_KERNEL
);
2461 static int __init
viafb_init(void)
2464 char *option
= NULL
;
2465 if (fb_get_options("viafb", &option
))
2467 viafb_setup(option
);
2470 "VIA Graphics Intergration Chipset framebuffer %d.%d initializing\n",
2471 VERSION_MAJOR
, VERSION_MINOR
);
2472 return via_pci_probe();
2475 static void __exit
viafb_exit(void)
2477 DEBUG_MSG(KERN_INFO
"viafb_exit!\n");
2481 static struct fb_ops viafb_ops
= {
2482 .owner
= THIS_MODULE
,
2483 .fb_open
= viafb_open
,
2484 .fb_release
= viafb_release
,
2485 .fb_check_var
= viafb_check_var
,
2486 .fb_set_par
= viafb_set_par
,
2487 .fb_setcolreg
= viafb_setcolreg
,
2488 .fb_pan_display
= viafb_pan_display
,
2489 .fb_blank
= viafb_blank
,
2490 .fb_fillrect
= viafb_fillrect
,
2491 .fb_copyarea
= viafb_copyarea
,
2492 .fb_imageblit
= viafb_imageblit
,
2493 .fb_cursor
= viafb_cursor
,
2494 .fb_ioctl
= viafb_ioctl
,
2495 .fb_sync
= viafb_sync
,
2496 .fb_setcmap
= viafb_setcmap
,
2499 module_init(viafb_init
);
2500 module_exit(viafb_exit
);
2503 module_param(viafb_memsize
, int, 0);
2505 module_param(viafb_mode
, charp
, 0);
2506 MODULE_PARM_DESC(viafb_mode
, "Set resolution (default=640x480)");
2508 module_param(viafb_mode1
, charp
, 0);
2509 MODULE_PARM_DESC(viafb_mode1
, "Set resolution (default=640x480)");
2511 module_param(viafb_bpp
, int, 0);
2512 MODULE_PARM_DESC(viafb_bpp
, "Set color depth (default=32bpp)");
2514 module_param(viafb_bpp1
, int, 0);
2515 MODULE_PARM_DESC(viafb_bpp1
, "Set color depth (default=32bpp)");
2517 module_param(viafb_refresh
, int, 0);
2518 MODULE_PARM_DESC(viafb_refresh
,
2519 "Set CRT viafb_refresh rate (default = 60)");
2521 module_param(viafb_refresh1
, int, 0);
2522 MODULE_PARM_DESC(viafb_refresh1
,
2523 "Set CRT refresh rate (default = 60)");
2525 module_param(viafb_lcd_panel_id
, int, 0);
2526 MODULE_PARM_DESC(viafb_lcd_panel_id
,
2527 "Set Flat Panel type(Default=1024x768)");
2529 module_param(viafb_lcd_dsp_method
, int, 0);
2530 MODULE_PARM_DESC(viafb_lcd_dsp_method
,
2531 "Set Flat Panel display scaling method.(Default=Expandsion)");
2533 module_param(viafb_SAMM_ON
, int, 0);
2534 MODULE_PARM_DESC(viafb_SAMM_ON
,
2535 "Turn on/off flag of SAMM(Default=OFF)");
2537 module_param(viafb_accel
, int, 0);
2538 MODULE_PARM_DESC(viafb_accel
,
2539 "Set 2D Hardware Acceleration.(Default = OFF)");
2541 module_param(viafb_active_dev
, charp
, 0);
2542 MODULE_PARM_DESC(viafb_active_dev
, "Specify active devices.");
2544 module_param(viafb_display_hardware_layout
, int, 0);
2545 MODULE_PARM_DESC(viafb_display_hardware_layout
,
2546 "Display Hardware Layout (LCD Only, DVI Only...,etc)");
2548 module_param(viafb_second_size
, int, 0);
2549 MODULE_PARM_DESC(viafb_second_size
,
2550 "Set secondary device memory size");
2552 module_param(viafb_dual_fb
, int, 0);
2553 MODULE_PARM_DESC(viafb_dual_fb
,
2554 "Turn on/off flag of dual framebuffer devices.(Default = OFF)");
2556 module_param(viafb_platform_epia_dvi
, int, 0);
2557 MODULE_PARM_DESC(viafb_platform_epia_dvi
,
2558 "Turn on/off flag of DVI devices on EPIA board.(Default = OFF)");
2560 module_param(viafb_device_lcd_dualedge
, int, 0);
2561 MODULE_PARM_DESC(viafb_device_lcd_dualedge
,
2562 "Turn on/off flag of dual edge panel.(Default = OFF)");
2564 module_param(viafb_bus_width
, int, 0);
2565 MODULE_PARM_DESC(viafb_bus_width
,
2566 "Set bus width of panel.(Default = 12)");
2568 module_param(viafb_lcd_mode
, int, 0);
2569 MODULE_PARM_DESC(viafb_lcd_mode
,
2570 "Set Flat Panel mode(Default=OPENLDI)");
2572 module_param(viafb_video_dev
, charp
, 0);
2573 MODULE_PARM_DESC(viafb_video_dev
, "Specify video devices.");
2575 module_param(viafb_lcd_port
, charp
, 0);
2576 MODULE_PARM_DESC(viafb_lcd_port
, "Specify LCD output port.");
2578 module_param(viafb_dvi_port
, charp
, 0);
2579 MODULE_PARM_DESC(viafb_dvi_port
, "Specify DVI output port.");
2581 MODULE_LICENSE("GPL");