2 * Copyright 1998-2009 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/compiler.h>
23 #include <linux/module.h>
24 #include <linux/seq_file.h>
25 #include <linux/slab.h>
26 #include <linux/stat.h>
27 #include <linux/via-core.h>
28 #include <linux/via_i2c.h>
34 static char *viafb_name = "Via";
35 static u32 pseudo_pal[17];
38 static char *viafb_mode;
39 static char *viafb_mode1;
40 static int viafb_bpp = 32;
41 static int viafb_bpp1 = 32;
43 static unsigned int viafb_second_offset;
44 static int viafb_second_size;
46 static int viafb_accel = 1;
48 /* Added for specifying active devices.*/
49 static char *viafb_active_dev;
51 /*Added for specify lcd output port*/
52 static char *viafb_lcd_port = "";
53 static char *viafb_dvi_port = "";
55 static void retrieve_device_setting(struct viafb_ioctl_setting
57 static int viafb_pan_display(struct fb_var_screeninfo *var,
58 struct fb_info *info);
60 static struct fb_ops viafb_ops;
62 /* supported output devices on each IGP
63 * only CX700, VX800, VX855, VX900 were documented
64 * VIA_CRT should be everywhere
65 * VIA_6C can be onle pre-CX700 (probably only on CLE266) as 6C is used for PLL
66 * source selection on CX700 and later
67 * K400 seems to support VIA_96, VIA_DVP1, VIA_LVDS{1,2} as in viamode.c
69 static const u32 supported_odev_map[] = {
70 [UNICHROME_CLE266] = VIA_CRT | VIA_LDVP0 | VIA_LDVP1,
71 [UNICHROME_K400] = VIA_CRT | VIA_DVP0 | VIA_DVP1 | VIA_LVDS1
73 [UNICHROME_K800] = VIA_CRT | VIA_DVP0 | VIA_DVP1 | VIA_LVDS1
75 [UNICHROME_PM800] = VIA_CRT | VIA_DVP0 | VIA_DVP1 | VIA_LVDS1
77 [UNICHROME_CN700] = VIA_CRT | VIA_DVP0 | VIA_DVP1 | VIA_LVDS1
79 [UNICHROME_CX700] = VIA_CRT | VIA_DVP1 | VIA_LVDS1 | VIA_LVDS2,
80 [UNICHROME_CN750] = VIA_CRT | VIA_DVP1 | VIA_LVDS1 | VIA_LVDS2,
81 [UNICHROME_K8M890] = VIA_CRT | VIA_DVP1 | VIA_LVDS1 | VIA_LVDS2,
82 [UNICHROME_P4M890] = VIA_CRT | VIA_DVP1 | VIA_LVDS1 | VIA_LVDS2,
83 [UNICHROME_P4M900] = VIA_CRT | VIA_DVP1 | VIA_LVDS1 | VIA_LVDS2,
84 [UNICHROME_VX800] = VIA_CRT | VIA_DVP1 | VIA_LVDS1 | VIA_LVDS2,
85 [UNICHROME_VX855] = VIA_CRT | VIA_DVP1 | VIA_LVDS1 | VIA_LVDS2,
86 [UNICHROME_VX900] = VIA_CRT | VIA_DVP1 | VIA_LVDS1 | VIA_LVDS2,
89 static void viafb_fill_var_color_info(struct fb_var_screeninfo *var, u8 depth)
92 var->red.msb_right = 0;
93 var->green.msb_right = 0;
94 var->blue.msb_right = 0;
95 var->transp.offset = 0;
96 var->transp.length = 0;
97 var->transp.msb_right = 0;
101 var->bits_per_pixel = 8;
103 var->green.offset = 0;
104 var->blue.offset = 0;
106 var->green.length = 8;
107 var->blue.length = 8;
110 var->bits_per_pixel = 16;
111 var->red.offset = 10;
112 var->green.offset = 5;
113 var->blue.offset = 0;
115 var->green.length = 5;
116 var->blue.length = 5;
119 var->bits_per_pixel = 16;
120 var->red.offset = 11;
121 var->green.offset = 5;
122 var->blue.offset = 0;
124 var->green.length = 6;
125 var->blue.length = 5;
128 var->bits_per_pixel = 32;
129 var->red.offset = 16;
130 var->green.offset = 8;
131 var->blue.offset = 0;
133 var->green.length = 8;
134 var->blue.length = 8;
137 var->bits_per_pixel = 32;
138 var->red.offset = 20;
139 var->green.offset = 10;
140 var->blue.offset = 0;
141 var->red.length = 10;
142 var->green.length = 10;
143 var->blue.length = 10;
148 static void viafb_update_fix(struct fb_info *info)
150 u32 bpp = info->var.bits_per_pixel;
153 bpp == 8 ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
154 info->fix.line_length = ALIGN(info->var.xres_virtual * bpp / 8,
158 static void viafb_setup_fixinfo(struct fb_fix_screeninfo *fix,
159 struct viafb_par *viaparinfo)
161 memset(fix, 0, sizeof(struct fb_fix_screeninfo));
162 strcpy(fix->id, viafb_name);
164 fix->smem_start = viaparinfo->fbmem;
165 fix->smem_len = viaparinfo->fbmem_free;
167 fix->type = FB_TYPE_PACKED_PIXELS;
169 fix->visual = FB_VISUAL_TRUECOLOR;
171 fix->xpanstep = fix->ywrapstep = 0;
174 /* Just tell the accel name */
175 viafbinfo->fix.accel = FB_ACCEL_VIA_UNICHROME;
177 static int viafb_open(struct fb_info *info, int user)
179 DEBUG_MSG(KERN_INFO "viafb_open!\n");
183 static int viafb_release(struct fb_info *info, int user)
185 DEBUG_MSG(KERN_INFO "viafb_release!\n");
189 static inline int get_var_refresh(struct fb_var_screeninfo *var)
193 htotal = var->left_margin + var->xres + var->right_margin
195 vtotal = var->upper_margin + var->yres + var->lower_margin
197 return PICOS2KHZ(var->pixclock) * 1000 / (htotal * vtotal);
200 static int viafb_check_var(struct fb_var_screeninfo *var,
201 struct fb_info *info)
204 struct viafb_par *ppar = info->par;
207 DEBUG_MSG(KERN_INFO "viafb_check_var!\n");
209 /* HW neither support interlacte nor double-scaned mode */
210 if (var->vmode & FB_VMODE_INTERLACED || var->vmode & FB_VMODE_DOUBLE)
213 /* the refresh rate is not important here, as we only want to know
214 * whether the resolution exists
216 if (!viafb_get_best_mode(var->xres, var->yres, 60)) {
218 "viafb: Mode %dx%dx%d not supported!!\n",
219 var->xres, var->yres, var->bits_per_pixel);
223 depth = fb_get_color_depth(var, &info->fix);
225 depth = var->bits_per_pixel;
227 if (depth < 0 || depth > 32)
231 else if (depth == 15 && viafb_dual_fb && ppar->iga_path == IGA1)
233 else if (depth == 30)
237 else if (depth <= 16)
242 viafb_fill_var_color_info(var, depth);
243 if (var->xres_virtual < var->xres)
244 var->xres_virtual = var->xres;
246 line = ALIGN(var->xres_virtual * var->bits_per_pixel / 8,
248 if (line > VIA_PITCH_MAX || line * var->yres_virtual > ppar->memsize)
251 /* Based on var passed in to calculate the refresh,
252 * because our driver use some modes special.
254 refresh = viafb_get_refresh(var->xres, var->yres,
255 get_var_refresh(var));
257 /* Adjust var according to our driver's own table */
258 viafb_fill_var_timing_info(var,
259 viafb_get_best_mode(var->xres, var->yres, refresh));
260 if (var->accel_flags & FB_ACCELF_TEXT &&
261 !ppar->shared->vdev->engine_mmio)
262 var->accel_flags = 0;
267 static int viafb_set_par(struct fb_info *info)
269 struct viafb_par *viapar = info->par;
271 DEBUG_MSG(KERN_INFO "viafb_set_par!\n");
273 viafb_update_fix(info);
274 viapar->depth = fb_get_color_depth(&info->var, &info->fix);
275 viafb_update_device_setting(viafbinfo->var.xres, viafbinfo->var.yres,
276 viafbinfo->var.bits_per_pixel, 0);
279 viafb_update_device_setting(viafbinfo1->var.xres,
280 viafbinfo1->var.yres, viafbinfo1->var.bits_per_pixel,
282 } else if (viafb_SAMM_ON == 1) {
284 "viafb_second_xres = %d, viafb_second_yres = %d, bpp = %d\n",
285 viafb_second_xres, viafb_second_yres, viafb_bpp1);
287 viafb_update_device_setting(viafb_second_xres,
288 viafb_second_yres, viafb_bpp1, 1);
291 refresh = get_var_refresh(&info->var);
292 if (viafb_dual_fb && viapar->iga_path == IGA2) {
293 viafb_bpp1 = info->var.bits_per_pixel;
294 viafb_refresh1 = refresh;
296 viafb_bpp = info->var.bits_per_pixel;
297 viafb_refresh = refresh;
300 if (info->var.accel_flags & FB_ACCELF_TEXT)
301 info->flags &= ~FBINFO_HWACCEL_DISABLED;
303 info->flags |= FBINFO_HWACCEL_DISABLED;
305 viafb_pan_display(&info->var, info);
310 /* Set one color register */
311 static int viafb_setcolreg(unsigned regno, unsigned red, unsigned green,
312 unsigned blue, unsigned transp, struct fb_info *info)
314 struct viafb_par *viapar = info->par;
317 if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR) {
321 if (!viafb_dual_fb || viapar->iga_path == IGA1)
322 viafb_set_primary_color_register(regno, red >> 8,
323 green >> 8, blue >> 8);
325 if (!viafb_dual_fb || viapar->iga_path == IGA2)
326 viafb_set_secondary_color_register(regno, red >> 8,
327 green >> 8, blue >> 8);
332 r = (red >> (16 - info->var.red.length))
333 << info->var.red.offset;
334 b = (blue >> (16 - info->var.blue.length))
335 << info->var.blue.offset;
336 g = (green >> (16 - info->var.green.length))
337 << info->var.green.offset;
338 ((u32 *) info->pseudo_palette)[regno] = r | g | b;
344 static int viafb_pan_display(struct fb_var_screeninfo *var,
345 struct fb_info *info)
347 struct viafb_par *viapar = info->par;
348 u32 vram_addr = viapar->vram_addr
349 + var->yoffset * info->fix.line_length
350 + var->xoffset * info->var.bits_per_pixel / 8;
352 DEBUG_MSG(KERN_DEBUG "viafb_pan_display, address = %d\n", vram_addr);
353 if (!viafb_dual_fb) {
354 via_set_primary_address(vram_addr);
355 via_set_secondary_address(vram_addr);
356 } else if (viapar->iga_path == IGA1)
357 via_set_primary_address(vram_addr);
359 via_set_secondary_address(vram_addr);
364 static int viafb_blank(int blank_mode, struct fb_info *info)
366 DEBUG_MSG(KERN_INFO "viafb_blank!\n");
367 /* clear DPMS setting */
369 switch (blank_mode) {
370 case FB_BLANK_UNBLANK:
371 /* Screen: On, HSync: On, VSync: On */
372 /* control CRT monitor power management */
373 via_set_state(VIA_CRT, VIA_STATE_ON);
375 case FB_BLANK_HSYNC_SUSPEND:
376 /* Screen: Off, HSync: Off, VSync: On */
377 /* control CRT monitor power management */
378 via_set_state(VIA_CRT, VIA_STATE_STANDBY);
380 case FB_BLANK_VSYNC_SUSPEND:
381 /* Screen: Off, HSync: On, VSync: Off */
382 /* control CRT monitor power management */
383 via_set_state(VIA_CRT, VIA_STATE_SUSPEND);
385 case FB_BLANK_POWERDOWN:
386 /* Screen: Off, HSync: Off, VSync: Off */
387 /* control CRT monitor power management */
388 via_set_state(VIA_CRT, VIA_STATE_OFF);
395 static int viafb_ioctl(struct fb_info *info, u_int cmd, u_long arg)
398 struct viafb_ioctl_mode viamode;
399 struct viafb_ioctl_samm viasamm;
400 struct viafb_driver_version driver_version;
401 struct fb_var_screeninfo sec_var;
402 struct _panel_size_pos_info panel_pos_size_para;
403 struct viafb_ioctl_setting viafb_setting;
404 struct device_t active_dev;
407 u32 *viafb_gamma_table;
408 char driver_name[] = "viafb";
410 u32 __user *argp = (u32 __user *) arg;
413 DEBUG_MSG(KERN_INFO "viafb_ioctl: 0x%X !!\n", cmd);
414 printk(KERN_WARNING "viafb_ioctl: Please avoid this interface as it is unstable and might change or vanish at any time!\n");
415 memset(&u, 0, sizeof(u));
418 case VIAFB_GET_CHIP_INFO:
419 if (copy_to_user(argp, viaparinfo->chip_info,
420 sizeof(struct chip_information)))
423 case VIAFB_GET_INFO_SIZE:
424 return put_user((u32)sizeof(struct viafb_ioctl_info), argp);
426 return viafb_ioctl_get_viafb_info(arg);
428 return put_user(viafb_ioctl_hotplug(info->var.xres,
430 info->var.bits_per_pixel), argp);
431 case VIAFB_SET_HOTPLUG_FLAG:
432 if (copy_from_user(&gpu32, argp, sizeof(gpu32)))
434 viafb_hotplug = (gpu32) ? 1 : 0;
436 case VIAFB_GET_RESOLUTION:
437 u.viamode.xres = (u32) viafb_hotplug_Xres;
438 u.viamode.yres = (u32) viafb_hotplug_Yres;
439 u.viamode.refresh = (u32) viafb_hotplug_refresh;
440 u.viamode.bpp = (u32) viafb_hotplug_bpp;
441 if (viafb_SAMM_ON == 1) {
442 u.viamode.xres_sec = viafb_second_xres;
443 u.viamode.yres_sec = viafb_second_yres;
444 u.viamode.virtual_xres_sec = viafb_dual_fb ? viafbinfo1->var.xres_virtual : viafbinfo->var.xres_virtual;
445 u.viamode.virtual_yres_sec = viafb_dual_fb ? viafbinfo1->var.yres_virtual : viafbinfo->var.yres_virtual;
446 u.viamode.refresh_sec = viafb_refresh1;
447 u.viamode.bpp_sec = viafb_bpp1;
449 u.viamode.xres_sec = 0;
450 u.viamode.yres_sec = 0;
451 u.viamode.virtual_xres_sec = 0;
452 u.viamode.virtual_yres_sec = 0;
453 u.viamode.refresh_sec = 0;
454 u.viamode.bpp_sec = 0;
456 if (copy_to_user(argp, &u.viamode, sizeof(u.viamode)))
459 case VIAFB_GET_SAMM_INFO:
460 u.viasamm.samm_status = viafb_SAMM_ON;
462 if (viafb_SAMM_ON == 1) {
464 u.viasamm.size_prim = viaparinfo->fbmem_free;
465 u.viasamm.size_sec = viaparinfo1->fbmem_free;
467 if (viafb_second_size) {
468 u.viasamm.size_prim =
469 viaparinfo->fbmem_free -
470 viafb_second_size * 1024 * 1024;
472 viafb_second_size * 1024 * 1024;
474 u.viasamm.size_prim =
475 viaparinfo->fbmem_free >> 1;
477 (viaparinfo->fbmem_free >> 1);
480 u.viasamm.mem_base = viaparinfo->fbmem;
481 u.viasamm.offset_sec = viafb_second_offset;
483 u.viasamm.size_prim =
484 viaparinfo->memsize - viaparinfo->fbmem_used;
485 u.viasamm.size_sec = 0;
486 u.viasamm.mem_base = viaparinfo->fbmem;
487 u.viasamm.offset_sec = 0;
490 if (copy_to_user(argp, &u.viasamm, sizeof(u.viasamm)))
494 case VIAFB_TURN_ON_OUTPUT_DEVICE:
495 if (copy_from_user(&gpu32, argp, sizeof(gpu32)))
497 if (gpu32 & CRT_Device)
498 via_set_state(VIA_CRT, VIA_STATE_ON);
499 if (gpu32 & DVI_Device)
501 if (gpu32 & LCD_Device)
504 case VIAFB_TURN_OFF_OUTPUT_DEVICE:
505 if (copy_from_user(&gpu32, argp, sizeof(gpu32)))
507 if (gpu32 & CRT_Device)
508 via_set_state(VIA_CRT, VIA_STATE_OFF);
509 if (gpu32 & DVI_Device)
511 if (gpu32 & LCD_Device)
514 case VIAFB_GET_DEVICE:
515 u.active_dev.crt = viafb_CRT_ON;
516 u.active_dev.dvi = viafb_DVI_ON;
517 u.active_dev.lcd = viafb_LCD_ON;
518 u.active_dev.samm = viafb_SAMM_ON;
519 u.active_dev.primary_dev = viafb_primary_dev;
521 u.active_dev.lcd_dsp_cent = viafb_lcd_dsp_method;
522 u.active_dev.lcd_panel_id = viafb_lcd_panel_id;
523 u.active_dev.lcd_mode = viafb_lcd_mode;
525 u.active_dev.xres = viafb_hotplug_Xres;
526 u.active_dev.yres = viafb_hotplug_Yres;
528 u.active_dev.xres1 = viafb_second_xres;
529 u.active_dev.yres1 = viafb_second_yres;
531 u.active_dev.bpp = viafb_bpp;
532 u.active_dev.bpp1 = viafb_bpp1;
533 u.active_dev.refresh = viafb_refresh;
534 u.active_dev.refresh1 = viafb_refresh1;
536 u.active_dev.epia_dvi = viafb_platform_epia_dvi;
537 u.active_dev.lcd_dual_edge = viafb_device_lcd_dualedge;
538 u.active_dev.bus_width = viafb_bus_width;
540 if (copy_to_user(argp, &u.active_dev, sizeof(u.active_dev)))
544 case VIAFB_GET_DRIVER_VERSION:
545 u.driver_version.iMajorNum = VERSION_MAJOR;
546 u.driver_version.iKernelNum = VERSION_KERNEL;
547 u.driver_version.iOSNum = VERSION_OS;
548 u.driver_version.iMinorNum = VERSION_MINOR;
550 if (copy_to_user(argp, &u.driver_version,
551 sizeof(u.driver_version)))
556 case VIAFB_GET_DEVICE_INFO:
558 retrieve_device_setting(&u.viafb_setting);
560 if (copy_to_user(argp, &u.viafb_setting,
561 sizeof(u.viafb_setting)))
566 case VIAFB_GET_DEVICE_SUPPORT:
567 viafb_get_device_support_state(&state_info);
568 if (put_user(state_info, argp))
572 case VIAFB_GET_DEVICE_CONNECT:
573 viafb_get_device_connect_state(&state_info);
574 if (put_user(state_info, argp))
578 case VIAFB_GET_PANEL_SUPPORT_EXPAND:
580 viafb_lcd_get_support_expand_state(info->var.xres,
582 if (put_user(state_info, argp))
586 case VIAFB_GET_DRIVER_NAME:
587 if (copy_to_user(argp, driver_name, sizeof(driver_name)))
591 case VIAFB_SET_GAMMA_LUT:
592 viafb_gamma_table = memdup_user(argp, 256 * sizeof(u32));
593 if (IS_ERR(viafb_gamma_table))
594 return PTR_ERR(viafb_gamma_table);
595 viafb_set_gamma_table(viafb_bpp, viafb_gamma_table);
596 kfree(viafb_gamma_table);
599 case VIAFB_GET_GAMMA_LUT:
600 viafb_gamma_table = kmalloc(256 * sizeof(u32), GFP_KERNEL);
601 if (!viafb_gamma_table)
603 viafb_get_gamma_table(viafb_gamma_table);
604 if (copy_to_user(argp, viafb_gamma_table,
605 256 * sizeof(u32))) {
606 kfree(viafb_gamma_table);
609 kfree(viafb_gamma_table);
612 case VIAFB_GET_GAMMA_SUPPORT_STATE:
613 viafb_get_gamma_support_state(viafb_bpp, &state_info);
614 if (put_user(state_info, argp))
617 case VIAFB_SYNC_SURFACE:
618 DEBUG_MSG(KERN_INFO "lobo VIAFB_SYNC_SURFACE\n");
620 case VIAFB_GET_DRIVER_CAPS:
623 case VIAFB_GET_PANEL_MAX_SIZE:
624 if (copy_from_user(&u.panel_pos_size_para, argp,
625 sizeof(u.panel_pos_size_para)))
627 u.panel_pos_size_para.x = u.panel_pos_size_para.y = 0;
628 if (copy_to_user(argp, &u.panel_pos_size_para,
629 sizeof(u.panel_pos_size_para)))
632 case VIAFB_GET_PANEL_MAX_POSITION:
633 if (copy_from_user(&u.panel_pos_size_para, argp,
634 sizeof(u.panel_pos_size_para)))
636 u.panel_pos_size_para.x = u.panel_pos_size_para.y = 0;
637 if (copy_to_user(argp, &u.panel_pos_size_para,
638 sizeof(u.panel_pos_size_para)))
642 case VIAFB_GET_PANEL_POSITION:
643 if (copy_from_user(&u.panel_pos_size_para, argp,
644 sizeof(u.panel_pos_size_para)))
646 u.panel_pos_size_para.x = u.panel_pos_size_para.y = 0;
647 if (copy_to_user(argp, &u.panel_pos_size_para,
648 sizeof(u.panel_pos_size_para)))
651 case VIAFB_GET_PANEL_SIZE:
652 if (copy_from_user(&u.panel_pos_size_para, argp,
653 sizeof(u.panel_pos_size_para)))
655 u.panel_pos_size_para.x = u.panel_pos_size_para.y = 0;
656 if (copy_to_user(argp, &u.panel_pos_size_para,
657 sizeof(u.panel_pos_size_para)))
661 case VIAFB_SET_PANEL_POSITION:
662 if (copy_from_user(&u.panel_pos_size_para, argp,
663 sizeof(u.panel_pos_size_para)))
666 case VIAFB_SET_PANEL_SIZE:
667 if (copy_from_user(&u.panel_pos_size_para, argp,
668 sizeof(u.panel_pos_size_para)))
679 static void viafb_fillrect(struct fb_info *info,
680 const struct fb_fillrect *rect)
682 struct viafb_par *viapar = info->par;
683 struct viafb_shared *shared = viapar->shared;
687 if (info->flags & FBINFO_HWACCEL_DISABLED || !shared->hw_bitblt) {
688 cfb_fillrect(info, rect);
692 if (!rect->width || !rect->height)
695 if (info->fix.visual == FB_VISUAL_TRUECOLOR)
696 fg_color = ((u32 *)info->pseudo_palette)[rect->color];
698 fg_color = rect->color;
700 if (rect->rop == ROP_XOR)
705 DEBUG_MSG(KERN_DEBUG "viafb 2D engine: fillrect\n");
706 if (shared->hw_bitblt(shared->vdev->engine_mmio, VIA_BITBLT_FILL,
707 rect->width, rect->height, info->var.bits_per_pixel,
708 viapar->vram_addr, info->fix.line_length, rect->dx, rect->dy,
709 NULL, 0, 0, 0, 0, fg_color, 0, rop))
710 cfb_fillrect(info, rect);
713 static void viafb_copyarea(struct fb_info *info,
714 const struct fb_copyarea *area)
716 struct viafb_par *viapar = info->par;
717 struct viafb_shared *shared = viapar->shared;
719 if (info->flags & FBINFO_HWACCEL_DISABLED || !shared->hw_bitblt) {
720 cfb_copyarea(info, area);
724 if (!area->width || !area->height)
727 DEBUG_MSG(KERN_DEBUG "viafb 2D engine: copyarea\n");
728 if (shared->hw_bitblt(shared->vdev->engine_mmio, VIA_BITBLT_COLOR,
729 area->width, area->height, info->var.bits_per_pixel,
730 viapar->vram_addr, info->fix.line_length, area->dx, area->dy,
731 NULL, viapar->vram_addr, info->fix.line_length,
732 area->sx, area->sy, 0, 0, 0))
733 cfb_copyarea(info, area);
736 static void viafb_imageblit(struct fb_info *info,
737 const struct fb_image *image)
739 struct viafb_par *viapar = info->par;
740 struct viafb_shared *shared = viapar->shared;
741 u32 fg_color = 0, bg_color = 0;
744 if (info->flags & FBINFO_HWACCEL_DISABLED || !shared->hw_bitblt ||
745 (image->depth != 1 && image->depth != viapar->depth)) {
746 cfb_imageblit(info, image);
750 if (image->depth == 1) {
751 op = VIA_BITBLT_MONO;
752 if (info->fix.visual == FB_VISUAL_TRUECOLOR) {
754 ((u32 *)info->pseudo_palette)[image->fg_color];
756 ((u32 *)info->pseudo_palette)[image->bg_color];
758 fg_color = image->fg_color;
759 bg_color = image->bg_color;
762 op = VIA_BITBLT_COLOR;
764 DEBUG_MSG(KERN_DEBUG "viafb 2D engine: imageblit\n");
765 if (shared->hw_bitblt(shared->vdev->engine_mmio, op,
766 image->width, image->height, info->var.bits_per_pixel,
767 viapar->vram_addr, info->fix.line_length, image->dx, image->dy,
768 (u32 *)image->data, 0, 0, 0, 0, fg_color, bg_color, 0))
769 cfb_imageblit(info, image);
772 static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
774 struct viafb_par *viapar = info->par;
775 void __iomem *engine = viapar->shared->vdev->engine_mmio;
776 u32 temp, xx, yy, bg_color = 0, fg_color = 0,
777 chip_name = viapar->shared->chip_info.gfx_chip_name;
778 int i, j = 0, cur_size = 64;
780 if (info->flags & FBINFO_HWACCEL_DISABLED || info != viafbinfo)
783 /* LCD ouput does not support hw cursors (at least on VN896) */
784 if ((chip_name == UNICHROME_CLE266 && viapar->iga_path == IGA2) ||
788 viafb_show_hw_cursor(info, HW_Cursor_OFF);
790 if (cursor->set & FB_CUR_SETHOT) {
791 temp = (cursor->hot.x << 16) + cursor->hot.y;
792 writel(temp, engine + VIA_REG_CURSOR_ORG);
795 if (cursor->set & FB_CUR_SETPOS) {
796 yy = cursor->image.dy - info->var.yoffset;
797 xx = cursor->image.dx - info->var.xoffset;
800 writel(temp, engine + VIA_REG_CURSOR_POS);
803 if (cursor->image.width <= 32 && cursor->image.height <= 32)
805 else if (cursor->image.width <= 64 && cursor->image.height <= 64)
808 printk(KERN_WARNING "viafb_cursor: The cursor is too large "
809 "%dx%d", cursor->image.width, cursor->image.height);
813 if (cursor->set & FB_CUR_SETSIZE) {
814 temp = readl(engine + VIA_REG_CURSOR_MODE);
820 writel(temp, engine + VIA_REG_CURSOR_MODE);
823 if (cursor->set & FB_CUR_SETCMAP) {
824 fg_color = cursor->image.fg_color;
825 bg_color = cursor->image.bg_color;
826 if (chip_name == UNICHROME_CX700 ||
827 chip_name == UNICHROME_VX800 ||
828 chip_name == UNICHROME_VX855 ||
829 chip_name == UNICHROME_VX900) {
831 ((info->cmap.red[fg_color] & 0xFFC0) << 14) |
832 ((info->cmap.green[fg_color] & 0xFFC0) << 4) |
833 ((info->cmap.blue[fg_color] & 0xFFC0) >> 6);
835 ((info->cmap.red[bg_color] & 0xFFC0) << 14) |
836 ((info->cmap.green[bg_color] & 0xFFC0) << 4) |
837 ((info->cmap.blue[bg_color] & 0xFFC0) >> 6);
840 ((info->cmap.red[fg_color] & 0xFF00) << 8) |
841 (info->cmap.green[fg_color] & 0xFF00) |
842 ((info->cmap.blue[fg_color] & 0xFF00) >> 8);
844 ((info->cmap.red[bg_color] & 0xFF00) << 8) |
845 (info->cmap.green[bg_color] & 0xFF00) |
846 ((info->cmap.blue[bg_color] & 0xFF00) >> 8);
849 writel(bg_color, engine + VIA_REG_CURSOR_BG);
850 writel(fg_color, engine + VIA_REG_CURSOR_FG);
853 if (cursor->set & FB_CUR_SETSHAPE) {
855 u8 data[CURSOR_SIZE];
856 u32 bak[CURSOR_SIZE / 4];
857 } *cr_data = kzalloc(sizeof(*cr_data), GFP_ATOMIC);
858 int size = ((cursor->image.width + 7) >> 3) *
859 cursor->image.height;
864 if (cur_size == 32) {
865 for (i = 0; i < (CURSOR_SIZE / 4); i++) {
866 cr_data->bak[i] = 0x0;
867 cr_data->bak[i + 1] = 0xFFFFFFFF;
871 for (i = 0; i < (CURSOR_SIZE / 4); i++) {
872 cr_data->bak[i] = 0x0;
873 cr_data->bak[i + 1] = 0x0;
874 cr_data->bak[i + 2] = 0xFFFFFFFF;
875 cr_data->bak[i + 3] = 0xFFFFFFFF;
880 switch (cursor->rop) {
882 for (i = 0; i < size; i++)
883 cr_data->data[i] = cursor->mask[i];
887 for (i = 0; i < size; i++)
888 cr_data->data[i] = cursor->mask[i];
894 if (cur_size == 32) {
895 for (i = 0; i < size; i++) {
896 cr_data->bak[j] = (u32) cr_data->data[i];
897 cr_data->bak[j + 1] = ~cr_data->bak[j];
901 for (i = 0; i < size; i++) {
902 cr_data->bak[j] = (u32) cr_data->data[i];
903 cr_data->bak[j + 1] = 0x0;
904 cr_data->bak[j + 2] = ~cr_data->bak[j];
905 cr_data->bak[j + 3] = ~cr_data->bak[j + 1];
910 memcpy_toio(viafbinfo->screen_base + viapar->shared->
911 cursor_vram_addr, cr_data->bak, CURSOR_SIZE);
916 viafb_show_hw_cursor(info, HW_Cursor_ON);
921 static int viafb_sync(struct fb_info *info)
923 if (!(info->flags & FBINFO_HWACCEL_DISABLED))
924 viafb_wait_engine_idle(info);
928 static int get_primary_device(void)
930 int primary_device = 0;
931 /* Rule: device on iga1 path are the primary device. */
934 if (viaparinfo->shared->iga1_devices & VIA_CRT) {
935 DEBUG_MSG(KERN_INFO "CRT IGA Path:%d\n", IGA1);
936 primary_device = CRT_Device;
940 if (viaparinfo->tmds_setting_info->iga_path == IGA1) {
941 DEBUG_MSG(KERN_INFO "DVI IGA Path:%d\n",
943 tmds_setting_info->iga_path);
944 primary_device = DVI_Device;
948 if (viaparinfo->lvds_setting_info->iga_path == IGA1) {
949 DEBUG_MSG(KERN_INFO "LCD IGA Path:%d\n",
951 lvds_setting_info->iga_path);
952 primary_device = LCD_Device;
956 if (viaparinfo->lvds_setting_info2->iga_path == IGA1) {
957 DEBUG_MSG(KERN_INFO "LCD2 IGA Path:%d\n",
959 lvds_setting_info2->iga_path);
960 primary_device = LCD2_Device;
964 return primary_device;
967 static void retrieve_device_setting(struct viafb_ioctl_setting
971 /* get device status */
972 if (viafb_CRT_ON == 1)
973 setting_info->device_status = CRT_Device;
974 if (viafb_DVI_ON == 1)
975 setting_info->device_status |= DVI_Device;
976 if (viafb_LCD_ON == 1)
977 setting_info->device_status |= LCD_Device;
978 if (viafb_LCD2_ON == 1)
979 setting_info->device_status |= LCD2_Device;
981 setting_info->samm_status = viafb_SAMM_ON;
982 setting_info->primary_device = get_primary_device();
984 setting_info->first_dev_bpp = viafb_bpp;
985 setting_info->second_dev_bpp = viafb_bpp1;
987 setting_info->first_dev_refresh = viafb_refresh;
988 setting_info->second_dev_refresh = viafb_refresh1;
990 setting_info->first_dev_hor_res = viafb_hotplug_Xres;
991 setting_info->first_dev_ver_res = viafb_hotplug_Yres;
992 setting_info->second_dev_hor_res = viafb_second_xres;
993 setting_info->second_dev_ver_res = viafb_second_yres;
995 /* Get lcd attributes */
996 setting_info->lcd_attributes.display_center = viafb_lcd_dsp_method;
997 setting_info->lcd_attributes.panel_id = viafb_lcd_panel_id;
998 setting_info->lcd_attributes.lcd_mode = viafb_lcd_mode;
1001 static int __init parse_active_dev(void)
1003 viafb_CRT_ON = STATE_OFF;
1004 viafb_DVI_ON = STATE_OFF;
1005 viafb_LCD_ON = STATE_OFF;
1006 viafb_LCD2_ON = STATE_OFF;
1007 /* 1. Modify the active status of devices. */
1008 /* 2. Keep the order of devices, so we can set corresponding
1009 IGA path to devices in SAMM case. */
1010 /* Note: The previous of active_dev is primary device,
1011 and the following is secondary device. */
1012 if (!viafb_active_dev) {
1013 if (machine_is_olpc()) { /* LCD only */
1014 viafb_LCD_ON = STATE_ON;
1015 viafb_SAMM_ON = STATE_OFF;
1017 viafb_CRT_ON = STATE_ON;
1018 viafb_SAMM_ON = STATE_OFF;
1020 } else if (!strcmp(viafb_active_dev, "CRT+DVI")) {
1022 viafb_CRT_ON = STATE_ON;
1023 viafb_DVI_ON = STATE_ON;
1024 viafb_primary_dev = CRT_Device;
1025 } else if (!strcmp(viafb_active_dev, "DVI+CRT")) {
1027 viafb_CRT_ON = STATE_ON;
1028 viafb_DVI_ON = STATE_ON;
1029 viafb_primary_dev = DVI_Device;
1030 } else if (!strcmp(viafb_active_dev, "CRT+LCD")) {
1032 viafb_CRT_ON = STATE_ON;
1033 viafb_LCD_ON = STATE_ON;
1034 viafb_primary_dev = CRT_Device;
1035 } else if (!strcmp(viafb_active_dev, "LCD+CRT")) {
1037 viafb_CRT_ON = STATE_ON;
1038 viafb_LCD_ON = STATE_ON;
1039 viafb_primary_dev = LCD_Device;
1040 } else if (!strcmp(viafb_active_dev, "DVI+LCD")) {
1042 viafb_DVI_ON = STATE_ON;
1043 viafb_LCD_ON = STATE_ON;
1044 viafb_primary_dev = DVI_Device;
1045 } else if (!strcmp(viafb_active_dev, "LCD+DVI")) {
1047 viafb_DVI_ON = STATE_ON;
1048 viafb_LCD_ON = STATE_ON;
1049 viafb_primary_dev = LCD_Device;
1050 } else if (!strcmp(viafb_active_dev, "LCD+LCD2")) {
1051 viafb_LCD_ON = STATE_ON;
1052 viafb_LCD2_ON = STATE_ON;
1053 viafb_primary_dev = LCD_Device;
1054 } else if (!strcmp(viafb_active_dev, "LCD2+LCD")) {
1055 viafb_LCD_ON = STATE_ON;
1056 viafb_LCD2_ON = STATE_ON;
1057 viafb_primary_dev = LCD2_Device;
1058 } else if (!strcmp(viafb_active_dev, "CRT")) {
1060 viafb_CRT_ON = STATE_ON;
1061 viafb_SAMM_ON = STATE_OFF;
1062 } else if (!strcmp(viafb_active_dev, "DVI")) {
1064 viafb_DVI_ON = STATE_ON;
1065 viafb_SAMM_ON = STATE_OFF;
1066 } else if (!strcmp(viafb_active_dev, "LCD")) {
1068 viafb_LCD_ON = STATE_ON;
1069 viafb_SAMM_ON = STATE_OFF;
1076 static int parse_port(char *opt_str, int *output_interface)
1078 if (!strncmp(opt_str, "DVP0", 4))
1079 *output_interface = INTERFACE_DVP0;
1080 else if (!strncmp(opt_str, "DVP1", 4))
1081 *output_interface = INTERFACE_DVP1;
1082 else if (!strncmp(opt_str, "DFP_HIGHLOW", 11))
1083 *output_interface = INTERFACE_DFP;
1084 else if (!strncmp(opt_str, "DFP_HIGH", 8))
1085 *output_interface = INTERFACE_DFP_HIGH;
1086 else if (!strncmp(opt_str, "DFP_LOW", 7))
1087 *output_interface = INTERFACE_DFP_LOW;
1089 *output_interface = INTERFACE_NONE;
1093 static void parse_lcd_port(void)
1095 parse_port(viafb_lcd_port, &viaparinfo->chip_info->lvds_chip_info.
1097 /*Initialize to avoid unexpected behavior */
1098 viaparinfo->chip_info->lvds_chip_info2.output_interface =
1101 DEBUG_MSG(KERN_INFO "parse_lcd_port: viafb_lcd_port:%s,interface:%d\n",
1102 viafb_lcd_port, viaparinfo->chip_info->lvds_chip_info.
1106 static void parse_dvi_port(void)
1108 parse_port(viafb_dvi_port, &viaparinfo->chip_info->tmds_chip_info.
1111 DEBUG_MSG(KERN_INFO "parse_dvi_port: viafb_dvi_port:%s,interface:%d\n",
1112 viafb_dvi_port, viaparinfo->chip_info->tmds_chip_info.
1116 #ifdef CONFIG_FB_VIA_DIRECT_PROCFS
1119 * The proc filesystem read/write function, a simple proc implement to
1120 * get/set the value of DPA DVP0, DVP0DataDriving, DVP0ClockDriving, DVP1,
1121 * DVP1Driving, DFPHigh, DFPLow CR96, SR2A[5], SR1B[1], SR2A[4], SR1E[2],
1122 * CR9B, SR65, CR97, CR99
1124 static int viafb_dvp0_proc_show(struct seq_file *m, void *v)
1126 u8 dvp0_data_dri = 0, dvp0_clk_dri = 0, dvp0 = 0;
1128 (viafb_read_reg(VIASR, SR2A) & BIT5) >> 4 |
1129 (viafb_read_reg(VIASR, SR1B) & BIT1) >> 1;
1131 (viafb_read_reg(VIASR, SR2A) & BIT4) >> 3 |
1132 (viafb_read_reg(VIASR, SR1E) & BIT2) >> 2;
1133 dvp0 = viafb_read_reg(VIACR, CR96) & 0x0f;
1134 seq_printf(m, "%x %x %x\n", dvp0, dvp0_data_dri, dvp0_clk_dri);
1138 static int viafb_dvp0_proc_open(struct inode *inode, struct file *file)
1140 return single_open(file, viafb_dvp0_proc_show, NULL);
1143 static ssize_t viafb_dvp0_proc_write(struct file *file,
1144 const char __user *buffer, size_t count, loff_t *pos)
1146 char buf[20], *value, *pbuf;
1148 unsigned long length, i;
1151 length = count > 20 ? 20 : count;
1152 if (copy_from_user(&buf[0], buffer, length))
1154 buf[length - 1] = '\0'; /*Ensure end string */
1156 for (i = 0; i < 3; i++) {
1157 value = strsep(&pbuf, " ");
1158 if (value != NULL) {
1159 if (kstrtou8(value, 0, ®_val) < 0)
1161 DEBUG_MSG(KERN_INFO "DVP0:reg_val[%l]=:%x\n", i,
1165 viafb_write_reg_mask(CR96, VIACR,
1169 viafb_write_reg_mask(SR2A, VIASR,
1170 reg_val << 4, BIT5);
1171 viafb_write_reg_mask(SR1B, VIASR,
1172 reg_val << 1, BIT1);
1175 viafb_write_reg_mask(SR2A, VIASR,
1176 reg_val << 3, BIT4);
1177 viafb_write_reg_mask(SR1E, VIASR,
1178 reg_val << 2, BIT2);
1190 static const struct file_operations viafb_dvp0_proc_fops = {
1191 .owner = THIS_MODULE,
1192 .open = viafb_dvp0_proc_open,
1194 .llseek = seq_lseek,
1195 .release = single_release,
1196 .write = viafb_dvp0_proc_write,
1199 static int viafb_dvp1_proc_show(struct seq_file *m, void *v)
1201 u8 dvp1 = 0, dvp1_data_dri = 0, dvp1_clk_dri = 0;
1202 dvp1 = viafb_read_reg(VIACR, CR9B) & 0x0f;
1203 dvp1_data_dri = (viafb_read_reg(VIASR, SR65) & 0x0c) >> 2;
1204 dvp1_clk_dri = viafb_read_reg(VIASR, SR65) & 0x03;
1205 seq_printf(m, "%x %x %x\n", dvp1, dvp1_data_dri, dvp1_clk_dri);
1209 static int viafb_dvp1_proc_open(struct inode *inode, struct file *file)
1211 return single_open(file, viafb_dvp1_proc_show, NULL);
1214 static ssize_t viafb_dvp1_proc_write(struct file *file,
1215 const char __user *buffer, size_t count, loff_t *pos)
1217 char buf[20], *value, *pbuf;
1219 unsigned long length, i;
1222 length = count > 20 ? 20 : count;
1223 if (copy_from_user(&buf[0], buffer, length))
1225 buf[length - 1] = '\0'; /*Ensure end string */
1227 for (i = 0; i < 3; i++) {
1228 value = strsep(&pbuf, " ");
1229 if (value != NULL) {
1230 if (kstrtou8(value, 0, ®_val) < 0)
1234 viafb_write_reg_mask(CR9B, VIACR,
1238 viafb_write_reg_mask(SR65, VIASR,
1239 reg_val << 2, 0x0c);
1242 viafb_write_reg_mask(SR65, VIASR,
1255 static const struct file_operations viafb_dvp1_proc_fops = {
1256 .owner = THIS_MODULE,
1257 .open = viafb_dvp1_proc_open,
1259 .llseek = seq_lseek,
1260 .release = single_release,
1261 .write = viafb_dvp1_proc_write,
1264 static int viafb_dfph_proc_show(struct seq_file *m, void *v)
1267 dfp_high = viafb_read_reg(VIACR, CR97) & 0x0f;
1268 seq_printf(m, "%x\n", dfp_high);
1272 static int viafb_dfph_proc_open(struct inode *inode, struct file *file)
1274 return single_open(file, viafb_dfph_proc_show, NULL);
1277 static ssize_t viafb_dfph_proc_write(struct file *file,
1278 const char __user *buffer, size_t count, loff_t *pos)
1282 err = kstrtou8_from_user(buffer, count, 0, ®_val);
1286 viafb_write_reg_mask(CR97, VIACR, reg_val, 0x0f);
1290 static const struct file_operations viafb_dfph_proc_fops = {
1291 .owner = THIS_MODULE,
1292 .open = viafb_dfph_proc_open,
1294 .llseek = seq_lseek,
1295 .release = single_release,
1296 .write = viafb_dfph_proc_write,
1299 static int viafb_dfpl_proc_show(struct seq_file *m, void *v)
1302 dfp_low = viafb_read_reg(VIACR, CR99) & 0x0f;
1303 seq_printf(m, "%x\n", dfp_low);
1307 static int viafb_dfpl_proc_open(struct inode *inode, struct file *file)
1309 return single_open(file, viafb_dfpl_proc_show, NULL);
1312 static ssize_t viafb_dfpl_proc_write(struct file *file,
1313 const char __user *buffer, size_t count, loff_t *pos)
1317 err = kstrtou8_from_user(buffer, count, 0, ®_val);
1321 viafb_write_reg_mask(CR99, VIACR, reg_val, 0x0f);
1325 static const struct file_operations viafb_dfpl_proc_fops = {
1326 .owner = THIS_MODULE,
1327 .open = viafb_dfpl_proc_open,
1329 .llseek = seq_lseek,
1330 .release = single_release,
1331 .write = viafb_dfpl_proc_write,
1334 static int viafb_vt1636_proc_show(struct seq_file *m, void *v)
1336 u8 vt1636_08 = 0, vt1636_09 = 0;
1337 switch (viaparinfo->chip_info->lvds_chip_info.lvds_chip_name) {
1340 viafb_gpio_i2c_read_lvds(viaparinfo->lvds_setting_info,
1341 &viaparinfo->chip_info->lvds_chip_info, 0x08) & 0x0f;
1343 viafb_gpio_i2c_read_lvds(viaparinfo->lvds_setting_info,
1344 &viaparinfo->chip_info->lvds_chip_info, 0x09) & 0x1f;
1345 seq_printf(m, "%x %x\n", vt1636_08, vt1636_09);
1350 switch (viaparinfo->chip_info->lvds_chip_info2.lvds_chip_name) {
1353 viafb_gpio_i2c_read_lvds(viaparinfo->lvds_setting_info2,
1354 &viaparinfo->chip_info->lvds_chip_info2, 0x08) & 0x0f;
1356 viafb_gpio_i2c_read_lvds(viaparinfo->lvds_setting_info2,
1357 &viaparinfo->chip_info->lvds_chip_info2, 0x09) & 0x1f;
1358 seq_printf(m, " %x %x\n", vt1636_08, vt1636_09);
1366 static int viafb_vt1636_proc_open(struct inode *inode, struct file *file)
1368 return single_open(file, viafb_vt1636_proc_show, NULL);
1371 static ssize_t viafb_vt1636_proc_write(struct file *file,
1372 const char __user *buffer, size_t count, loff_t *pos)
1374 char buf[30], *value, *pbuf;
1375 struct IODATA reg_val;
1376 unsigned long length, i;
1379 length = count > 30 ? 30 : count;
1380 if (copy_from_user(&buf[0], buffer, length))
1382 buf[length - 1] = '\0'; /*Ensure end string */
1384 switch (viaparinfo->chip_info->lvds_chip_info.lvds_chip_name) {
1386 for (i = 0; i < 2; i++) {
1387 value = strsep(&pbuf, " ");
1388 if (value != NULL) {
1389 if (kstrtou8(value, 0, ®_val.Data) < 0)
1393 reg_val.Index = 0x08;
1394 reg_val.Mask = 0x0f;
1395 viafb_gpio_i2c_write_mask_lvds
1396 (viaparinfo->lvds_setting_info,
1398 chip_info->lvds_chip_info,
1402 reg_val.Index = 0x09;
1403 reg_val.Mask = 0x1f;
1404 viafb_gpio_i2c_write_mask_lvds
1405 (viaparinfo->lvds_setting_info,
1407 chip_info->lvds_chip_info,
1421 switch (viaparinfo->chip_info->lvds_chip_info2.lvds_chip_name) {
1423 for (i = 0; i < 2; i++) {
1424 value = strsep(&pbuf, " ");
1425 if (value != NULL) {
1426 if (kstrtou8(value, 0, ®_val.Data) < 0)
1430 reg_val.Index = 0x08;
1431 reg_val.Mask = 0x0f;
1432 viafb_gpio_i2c_write_mask_lvds
1433 (viaparinfo->lvds_setting_info2,
1435 chip_info->lvds_chip_info2,
1439 reg_val.Index = 0x09;
1440 reg_val.Mask = 0x1f;
1441 viafb_gpio_i2c_write_mask_lvds
1442 (viaparinfo->lvds_setting_info2,
1444 chip_info->lvds_chip_info2,
1461 static const struct file_operations viafb_vt1636_proc_fops = {
1462 .owner = THIS_MODULE,
1463 .open = viafb_vt1636_proc_open,
1465 .llseek = seq_lseek,
1466 .release = single_release,
1467 .write = viafb_vt1636_proc_write,
1470 #endif /* CONFIG_FB_VIA_DIRECT_PROCFS */
1472 static int __maybe_unused viafb_sup_odev_proc_show(struct seq_file *m, void *v)
1474 via_odev_to_seq(m, supported_odev_map[
1475 viaparinfo->shared->chip_info.gfx_chip_name]);
1479 static int viafb_sup_odev_proc_open(struct inode *inode, struct file *file)
1481 return single_open(file, viafb_sup_odev_proc_show, NULL);
1484 static const struct file_operations viafb_sup_odev_proc_fops = {
1485 .owner = THIS_MODULE,
1486 .open = viafb_sup_odev_proc_open,
1488 .llseek = seq_lseek,
1489 .release = single_release,
1492 static ssize_t odev_update(const char __user *buffer, size_t count, u32 *odev)
1494 char buf[64], *ptr = buf;
1498 if (count < 1 || count > 63)
1500 if (copy_from_user(&buf[0], buffer, count))
1503 add = buf[0] == '+';
1504 sub = buf[0] == '-';
1507 devices = via_parse_odev(ptr, &ptr);
1521 static int viafb_iga1_odev_proc_show(struct seq_file *m, void *v)
1523 via_odev_to_seq(m, viaparinfo->shared->iga1_devices);
1527 static int viafb_iga1_odev_proc_open(struct inode *inode, struct file *file)
1529 return single_open(file, viafb_iga1_odev_proc_show, NULL);
1532 static ssize_t viafb_iga1_odev_proc_write(struct file *file,
1533 const char __user *buffer, size_t count, loff_t *pos)
1535 u32 dev_on, dev_off, dev_old, dev_new;
1538 dev_old = dev_new = viaparinfo->shared->iga1_devices;
1539 res = odev_update(buffer, count, &dev_new);
1542 dev_off = dev_old & ~dev_new;
1543 dev_on = dev_new & ~dev_old;
1544 viaparinfo->shared->iga1_devices = dev_new;
1545 viaparinfo->shared->iga2_devices &= ~dev_new;
1546 via_set_state(dev_off, VIA_STATE_OFF);
1547 via_set_source(dev_new, IGA1);
1548 via_set_state(dev_on, VIA_STATE_ON);
1552 static const struct file_operations viafb_iga1_odev_proc_fops = {
1553 .owner = THIS_MODULE,
1554 .open = viafb_iga1_odev_proc_open,
1556 .llseek = seq_lseek,
1557 .release = single_release,
1558 .write = viafb_iga1_odev_proc_write,
1561 static int viafb_iga2_odev_proc_show(struct seq_file *m, void *v)
1563 via_odev_to_seq(m, viaparinfo->shared->iga2_devices);
1567 static int viafb_iga2_odev_proc_open(struct inode *inode, struct file *file)
1569 return single_open(file, viafb_iga2_odev_proc_show, NULL);
1572 static ssize_t viafb_iga2_odev_proc_write(struct file *file,
1573 const char __user *buffer, size_t count, loff_t *pos)
1575 u32 dev_on, dev_off, dev_old, dev_new;
1578 dev_old = dev_new = viaparinfo->shared->iga2_devices;
1579 res = odev_update(buffer, count, &dev_new);
1582 dev_off = dev_old & ~dev_new;
1583 dev_on = dev_new & ~dev_old;
1584 viaparinfo->shared->iga2_devices = dev_new;
1585 viaparinfo->shared->iga1_devices &= ~dev_new;
1586 via_set_state(dev_off, VIA_STATE_OFF);
1587 via_set_source(dev_new, IGA2);
1588 via_set_state(dev_on, VIA_STATE_ON);
1592 static const struct file_operations viafb_iga2_odev_proc_fops = {
1593 .owner = THIS_MODULE,
1594 .open = viafb_iga2_odev_proc_open,
1596 .llseek = seq_lseek,
1597 .release = single_release,
1598 .write = viafb_iga2_odev_proc_write,
1601 #define IS_VT1636(lvds_chip) ((lvds_chip).lvds_chip_name == VT1636_LVDS)
1602 static void viafb_init_proc(struct viafb_shared *shared)
1604 struct proc_dir_entry *iga1_entry, *iga2_entry,
1605 *viafb_entry = proc_mkdir("viafb", NULL);
1607 shared->proc_entry = viafb_entry;
1609 #ifdef CONFIG_FB_VIA_DIRECT_PROCFS
1610 proc_create("dvp0", 0, viafb_entry, &viafb_dvp0_proc_fops);
1611 proc_create("dvp1", 0, viafb_entry, &viafb_dvp1_proc_fops);
1612 proc_create("dfph", 0, viafb_entry, &viafb_dfph_proc_fops);
1613 proc_create("dfpl", 0, viafb_entry, &viafb_dfpl_proc_fops);
1614 if (IS_VT1636(shared->chip_info.lvds_chip_info)
1615 || IS_VT1636(shared->chip_info.lvds_chip_info2))
1616 proc_create("vt1636", 0, viafb_entry,
1617 &viafb_vt1636_proc_fops);
1618 #endif /* CONFIG_FB_VIA_DIRECT_PROCFS */
1620 proc_create("supported_output_devices", 0, viafb_entry,
1621 &viafb_sup_odev_proc_fops);
1622 iga1_entry = proc_mkdir("iga1", viafb_entry);
1623 shared->iga1_proc_entry = iga1_entry;
1624 proc_create("output_devices", 0, iga1_entry,
1625 &viafb_iga1_odev_proc_fops);
1626 iga2_entry = proc_mkdir("iga2", viafb_entry);
1627 shared->iga2_proc_entry = iga2_entry;
1628 proc_create("output_devices", 0, iga2_entry,
1629 &viafb_iga2_odev_proc_fops);
1632 static void viafb_remove_proc(struct viafb_shared *shared)
1634 struct proc_dir_entry *viafb_entry = shared->proc_entry;
1639 remove_proc_entry("output_devices", shared->iga2_proc_entry);
1640 remove_proc_entry("iga2", viafb_entry);
1641 remove_proc_entry("output_devices", shared->iga1_proc_entry);
1642 remove_proc_entry("iga1", viafb_entry);
1643 remove_proc_entry("supported_output_devices", viafb_entry);
1645 #ifdef CONFIG_FB_VIA_DIRECT_PROCFS
1646 remove_proc_entry("dvp0", viafb_entry);/* parent dir */
1647 remove_proc_entry("dvp1", viafb_entry);
1648 remove_proc_entry("dfph", viafb_entry);
1649 remove_proc_entry("dfpl", viafb_entry);
1650 if (IS_VT1636(shared->chip_info.lvds_chip_info)
1651 || IS_VT1636(shared->chip_info.lvds_chip_info2))
1652 remove_proc_entry("vt1636", viafb_entry);
1653 #endif /* CONFIG_FB_VIA_DIRECT_PROCFS */
1655 remove_proc_entry("viafb", NULL);
1659 static int parse_mode(const char *str, u32 devices, u32 *xres, u32 *yres)
1661 const struct fb_videomode *mode = NULL;
1665 if (devices == VIA_CRT)
1666 mode = via_aux_get_preferred_mode(
1667 viaparinfo->shared->i2c_26);
1668 else if (devices == VIA_DVP1)
1669 mode = via_aux_get_preferred_mode(
1670 viaparinfo->shared->i2c_31);
1675 } else if (machine_is_olpc()) {
1685 *xres = simple_strtoul(str, &ptr, 10);
1689 *yres = simple_strtoul(&ptr[1], &ptr, 10);
1698 static int viafb_suspend(void *unused)
1701 fb_set_suspend(viafbinfo, 1);
1702 viafb_sync(viafbinfo);
1708 static int viafb_resume(void *unused)
1711 if (viaparinfo->shared->vdev->engine_mmio)
1712 viafb_reset_engine(viaparinfo);
1713 viafb_set_par(viafbinfo);
1715 viafb_set_par(viafbinfo1);
1716 fb_set_suspend(viafbinfo, 0);
1722 static struct viafb_pm_hooks viafb_fb_pm_hooks = {
1723 .suspend = viafb_suspend,
1724 .resume = viafb_resume
1729 static void i2c_bus_probe(struct viafb_shared *shared)
1731 /* should be always CRT */
1732 printk(KERN_INFO "viafb: Probing I2C bus 0x26\n");
1733 shared->i2c_26 = via_aux_probe(viafb_find_i2c_adapter(VIA_PORT_26));
1735 /* seems to be usually DVP1 */
1736 printk(KERN_INFO "viafb: Probing I2C bus 0x31\n");
1737 shared->i2c_31 = via_aux_probe(viafb_find_i2c_adapter(VIA_PORT_31));
1739 /* FIXME: what is this? */
1740 if (!machine_is_olpc()) {
1741 printk(KERN_INFO "viafb: Probing I2C bus 0x2C\n");
1742 shared->i2c_2C = via_aux_probe(viafb_find_i2c_adapter(VIA_PORT_2C));
1745 printk(KERN_INFO "viafb: Finished I2C bus probing");
1748 static void i2c_bus_free(struct viafb_shared *shared)
1750 via_aux_free(shared->i2c_26);
1751 via_aux_free(shared->i2c_31);
1752 via_aux_free(shared->i2c_2C);
1755 int via_fb_pci_probe(struct viafb_dev *vdev)
1757 u32 default_xres, default_yres;
1758 struct fb_var_screeninfo default_var;
1760 u32 viafb_par_length;
1762 DEBUG_MSG(KERN_INFO "VIAFB PCI Probe!!\n");
1763 memset(&default_var, 0, sizeof(default_var));
1764 viafb_par_length = ALIGN(sizeof(struct viafb_par), BITS_PER_LONG/8);
1766 /* Allocate fb_info and ***_par here, also including some other needed
1769 viafbinfo = framebuffer_alloc(viafb_par_length +
1770 ALIGN(sizeof(struct viafb_shared), BITS_PER_LONG/8),
1773 printk(KERN_ERR"Could not allocate memory for viafb_info.\n");
1777 viaparinfo = (struct viafb_par *)viafbinfo->par;
1778 viaparinfo->shared = viafbinfo->par + viafb_par_length;
1779 viaparinfo->shared->vdev = vdev;
1780 viaparinfo->vram_addr = 0;
1781 viaparinfo->tmds_setting_info = &viaparinfo->shared->tmds_setting_info;
1782 viaparinfo->lvds_setting_info = &viaparinfo->shared->lvds_setting_info;
1783 viaparinfo->lvds_setting_info2 =
1784 &viaparinfo->shared->lvds_setting_info2;
1785 viaparinfo->chip_info = &viaparinfo->shared->chip_info;
1787 i2c_bus_probe(viaparinfo->shared);
1793 viafb_init_chip_info(vdev->chip_type);
1795 * The framebuffer will have been successfully mapped by
1796 * the core (or we'd not be here), but we still need to
1797 * set up our own accounting.
1799 viaparinfo->fbmem = vdev->fbmem_start;
1800 viaparinfo->memsize = vdev->fbmem_len;
1801 viaparinfo->fbmem_free = viaparinfo->memsize;
1802 viaparinfo->fbmem_used = 0;
1803 viafbinfo->screen_base = vdev->fbmem;
1805 viafbinfo->fix.mmio_start = vdev->engine_start;
1806 viafbinfo->fix.mmio_len = vdev->engine_len;
1807 viafbinfo->node = 0;
1808 viafbinfo->fbops = &viafb_ops;
1809 viafbinfo->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
1811 viafbinfo->pseudo_palette = pseudo_pal;
1812 if (viafb_accel && !viafb_setup_engine(viafbinfo)) {
1813 viafbinfo->flags |= FBINFO_HWACCEL_COPYAREA |
1814 FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_IMAGEBLIT;
1815 default_var.accel_flags = FB_ACCELF_TEXT;
1817 viafbinfo->flags |= FBINFO_HWACCEL_DISABLED;
1818 default_var.accel_flags = 0;
1821 if (viafb_second_size && (viafb_second_size < 8)) {
1822 viafb_second_offset = viaparinfo->fbmem_free -
1823 viafb_second_size * 1024 * 1024;
1825 viafb_second_size = 8;
1826 viafb_second_offset = viaparinfo->fbmem_free -
1827 viafb_second_size * 1024 * 1024;
1830 parse_mode(viafb_mode, viaparinfo->shared->iga1_devices,
1831 &default_xres, &default_yres);
1832 if (viafb_SAMM_ON == 1)
1833 parse_mode(viafb_mode1, viaparinfo->shared->iga2_devices,
1834 &viafb_second_xres, &viafb_second_yres);
1836 default_var.xres = default_xres;
1837 default_var.yres = default_yres;
1838 default_var.xres_virtual = default_xres;
1839 default_var.yres_virtual = default_yres;
1840 default_var.bits_per_pixel = viafb_bpp;
1841 viafb_fill_var_timing_info(&default_var, viafb_get_best_mode(
1842 default_var.xres, default_var.yres, viafb_refresh));
1843 viafb_setup_fixinfo(&viafbinfo->fix, viaparinfo);
1844 viafbinfo->var = default_var;
1846 if (viafb_dual_fb) {
1847 viafbinfo1 = framebuffer_alloc(viafb_par_length,
1851 "allocate the second framebuffer struct error\n");
1853 goto out_fb_release;
1855 viaparinfo1 = viafbinfo1->par;
1856 memcpy(viaparinfo1, viaparinfo, viafb_par_length);
1857 viaparinfo1->vram_addr = viafb_second_offset;
1858 viaparinfo1->memsize = viaparinfo->memsize -
1859 viafb_second_offset;
1860 viaparinfo->memsize = viafb_second_offset;
1861 viaparinfo1->fbmem = viaparinfo->fbmem + viafb_second_offset;
1863 viaparinfo1->fbmem_used = viaparinfo->fbmem_used;
1864 viaparinfo1->fbmem_free = viaparinfo1->memsize -
1865 viaparinfo1->fbmem_used;
1866 viaparinfo->fbmem_free = viaparinfo->memsize;
1867 viaparinfo->fbmem_used = 0;
1869 viaparinfo->iga_path = IGA1;
1870 viaparinfo1->iga_path = IGA2;
1871 memcpy(viafbinfo1, viafbinfo, sizeof(struct fb_info));
1872 viafbinfo1->par = viaparinfo1;
1873 viafbinfo1->screen_base = viafbinfo->screen_base +
1874 viafb_second_offset;
1876 default_var.xres = viafb_second_xres;
1877 default_var.yres = viafb_second_yres;
1878 default_var.xres_virtual = viafb_second_xres;
1879 default_var.yres_virtual = viafb_second_yres;
1880 default_var.bits_per_pixel = viafb_bpp1;
1881 viafb_fill_var_timing_info(&default_var, viafb_get_best_mode(
1882 default_var.xres, default_var.yres, viafb_refresh1));
1884 viafb_setup_fixinfo(&viafbinfo1->fix, viaparinfo1);
1885 viafb_check_var(&default_var, viafbinfo1);
1886 viafbinfo1->var = default_var;
1887 viafb_update_fix(viafbinfo1);
1888 viaparinfo1->depth = fb_get_color_depth(&viafbinfo1->var,
1892 viafb_check_var(&viafbinfo->var, viafbinfo);
1893 viafb_update_fix(viafbinfo);
1894 viaparinfo->depth = fb_get_color_depth(&viafbinfo->var,
1896 default_var.activate = FB_ACTIVATE_NOW;
1897 rc = fb_alloc_cmap(&viafbinfo->cmap, 256, 0);
1899 goto out_fb1_release;
1901 if (viafb_dual_fb && (viafb_primary_dev == LCD_Device)
1902 && (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)) {
1903 rc = register_framebuffer(viafbinfo1);
1905 goto out_dealloc_cmap;
1907 rc = register_framebuffer(viafbinfo);
1909 goto out_fb1_unreg_lcd_cle266;
1911 if (viafb_dual_fb && ((viafb_primary_dev != LCD_Device)
1912 || (viaparinfo->chip_info->gfx_chip_name !=
1913 UNICHROME_CLE266))) {
1914 rc = register_framebuffer(viafbinfo1);
1918 DEBUG_MSG(KERN_INFO "fb%d: %s frame buffer device %dx%d-%dbpp\n",
1919 viafbinfo->node, viafbinfo->fix.id, default_var.xres,
1920 default_var.yres, default_var.bits_per_pixel);
1922 viafb_init_proc(viaparinfo->shared);
1923 viafb_init_dac(IGA2);
1926 viafb_pm_register(&viafb_fb_pm_hooks);
1931 unregister_framebuffer(viafbinfo);
1932 out_fb1_unreg_lcd_cle266:
1933 if (viafb_dual_fb && (viafb_primary_dev == LCD_Device)
1934 && (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266))
1935 unregister_framebuffer(viafbinfo1);
1937 fb_dealloc_cmap(&viafbinfo->cmap);
1939 framebuffer_release(viafbinfo1);
1941 i2c_bus_free(viaparinfo->shared);
1942 framebuffer_release(viafbinfo);
1946 void via_fb_pci_remove(struct pci_dev *pdev)
1948 DEBUG_MSG(KERN_INFO "via_pci_remove!\n");
1949 fb_dealloc_cmap(&viafbinfo->cmap);
1950 unregister_framebuffer(viafbinfo);
1952 unregister_framebuffer(viafbinfo1);
1953 viafb_remove_proc(viaparinfo->shared);
1954 i2c_bus_free(viaparinfo->shared);
1955 framebuffer_release(viafbinfo);
1957 framebuffer_release(viafbinfo1);
1961 static int __init viafb_setup(void)
1966 DEBUG_MSG(KERN_INFO "viafb_setup!\n");
1968 if (fb_get_options("viafb", &options))
1971 if (!options || !*options)
1974 while ((this_opt = strsep(&options, ",")) != NULL) {
1978 if (!strncmp(this_opt, "viafb_mode1=", 12)) {
1979 viafb_mode1 = kstrdup(this_opt + 12, GFP_KERNEL);
1980 } else if (!strncmp(this_opt, "viafb_mode=", 11)) {
1981 viafb_mode = kstrdup(this_opt + 11, GFP_KERNEL);
1982 } else if (!strncmp(this_opt, "viafb_bpp1=", 11)) {
1983 if (kstrtouint(this_opt + 11, 0, &viafb_bpp1) < 0)
1985 } else if (!strncmp(this_opt, "viafb_bpp=", 10)) {
1986 if (kstrtouint(this_opt + 10, 0, &viafb_bpp) < 0)
1988 } else if (!strncmp(this_opt, "viafb_refresh1=", 15)) {
1989 if (kstrtoint(this_opt + 15, 0, &viafb_refresh1) < 0)
1991 } else if (!strncmp(this_opt, "viafb_refresh=", 14)) {
1992 if (kstrtoint(this_opt + 14, 0, &viafb_refresh) < 0)
1994 } else if (!strncmp(this_opt, "viafb_lcd_dsp_method=", 21)) {
1995 if (kstrtoint(this_opt + 21, 0,
1996 &viafb_lcd_dsp_method) < 0)
1998 } else if (!strncmp(this_opt, "viafb_lcd_panel_id=", 19)) {
1999 if (kstrtoint(this_opt + 19, 0,
2000 &viafb_lcd_panel_id) < 0)
2002 } else if (!strncmp(this_opt, "viafb_accel=", 12)) {
2003 if (kstrtoint(this_opt + 12, 0, &viafb_accel) < 0)
2005 } else if (!strncmp(this_opt, "viafb_SAMM_ON=", 14)) {
2006 if (kstrtoint(this_opt + 14, 0, &viafb_SAMM_ON) < 0)
2008 } else if (!strncmp(this_opt, "viafb_active_dev=", 17)) {
2009 viafb_active_dev = kstrdup(this_opt + 17, GFP_KERNEL);
2010 } else if (!strncmp(this_opt,
2011 "viafb_display_hardware_layout=", 30)) {
2012 if (kstrtoint(this_opt + 30, 0,
2013 &viafb_display_hardware_layout) < 0)
2015 } else if (!strncmp(this_opt, "viafb_second_size=", 18)) {
2016 if (kstrtoint(this_opt + 18, 0, &viafb_second_size) < 0)
2018 } else if (!strncmp(this_opt,
2019 "viafb_platform_epia_dvi=", 24)) {
2020 if (kstrtoint(this_opt + 24, 0,
2021 &viafb_platform_epia_dvi) < 0)
2023 } else if (!strncmp(this_opt,
2024 "viafb_device_lcd_dualedge=", 26)) {
2025 if (kstrtoint(this_opt + 26, 0,
2026 &viafb_device_lcd_dualedge) < 0)
2028 } else if (!strncmp(this_opt, "viafb_bus_width=", 16)) {
2029 if (kstrtoint(this_opt + 16, 0, &viafb_bus_width) < 0)
2031 } else if (!strncmp(this_opt, "viafb_lcd_mode=", 15)) {
2032 if (kstrtoint(this_opt + 15, 0, &viafb_lcd_mode) < 0)
2034 } else if (!strncmp(this_opt, "viafb_lcd_port=", 15)) {
2035 viafb_lcd_port = kstrdup(this_opt + 15, GFP_KERNEL);
2036 } else if (!strncmp(this_opt, "viafb_dvi_port=", 15)) {
2037 viafb_dvi_port = kstrdup(this_opt + 15, GFP_KERNEL);
2045 * These are called out of via-core for now.
2047 int __init viafb_init(void)
2049 u32 dummy_x, dummy_y;
2052 if (machine_is_olpc())
2053 /* Apply XO-1.5-specific configuration. */
2054 viafb_lcd_panel_id = 23;
2061 if (parse_mode(viafb_mode, 0, &dummy_x, &dummy_y)
2062 || !viafb_get_best_mode(dummy_x, dummy_y, viafb_refresh)
2063 || parse_mode(viafb_mode1, 0, &dummy_x, &dummy_y)
2064 || !viafb_get_best_mode(dummy_x, dummy_y, viafb_refresh1)
2065 || viafb_bpp < 0 || viafb_bpp > 32
2066 || viafb_bpp1 < 0 || viafb_bpp1 > 32
2067 || parse_active_dev())
2071 "VIA Graphics Integration Chipset framebuffer %d.%d initializing\n",
2072 VERSION_MAJOR, VERSION_MINOR);
2076 void __exit viafb_exit(void)
2078 DEBUG_MSG(KERN_INFO "viafb_exit!\n");
2081 static struct fb_ops viafb_ops = {
2082 .owner = THIS_MODULE,
2083 .fb_open = viafb_open,
2084 .fb_release = viafb_release,
2085 .fb_check_var = viafb_check_var,
2086 .fb_set_par = viafb_set_par,
2087 .fb_setcolreg = viafb_setcolreg,
2088 .fb_pan_display = viafb_pan_display,
2089 .fb_blank = viafb_blank,
2090 .fb_fillrect = viafb_fillrect,
2091 .fb_copyarea = viafb_copyarea,
2092 .fb_imageblit = viafb_imageblit,
2093 .fb_cursor = viafb_cursor,
2094 .fb_ioctl = viafb_ioctl,
2095 .fb_sync = viafb_sync,
2100 module_param(viafb_mode, charp, S_IRUSR);
2101 MODULE_PARM_DESC(viafb_mode, "Set resolution (default=640x480)");
2103 module_param(viafb_mode1, charp, S_IRUSR);
2104 MODULE_PARM_DESC(viafb_mode1, "Set resolution (default=640x480)");
2106 module_param(viafb_bpp, int, S_IRUSR);
2107 MODULE_PARM_DESC(viafb_bpp, "Set color depth (default=32bpp)");
2109 module_param(viafb_bpp1, int, S_IRUSR);
2110 MODULE_PARM_DESC(viafb_bpp1, "Set color depth (default=32bpp)");
2112 module_param(viafb_refresh, int, S_IRUSR);
2113 MODULE_PARM_DESC(viafb_refresh,
2114 "Set CRT viafb_refresh rate (default = 60)");
2116 module_param(viafb_refresh1, int, S_IRUSR);
2117 MODULE_PARM_DESC(viafb_refresh1,
2118 "Set CRT refresh rate (default = 60)");
2120 module_param(viafb_lcd_panel_id, int, S_IRUSR);
2121 MODULE_PARM_DESC(viafb_lcd_panel_id,
2122 "Set Flat Panel type(Default=1024x768)");
2124 module_param(viafb_lcd_dsp_method, int, S_IRUSR);
2125 MODULE_PARM_DESC(viafb_lcd_dsp_method,
2126 "Set Flat Panel display scaling method.(Default=Expandsion)");
2128 module_param(viafb_SAMM_ON, int, S_IRUSR);
2129 MODULE_PARM_DESC(viafb_SAMM_ON,
2130 "Turn on/off flag of SAMM(Default=OFF)");
2132 module_param(viafb_accel, int, S_IRUSR);
2133 MODULE_PARM_DESC(viafb_accel,
2134 "Set 2D Hardware Acceleration: 0 = OFF, 1 = ON (default)");
2136 module_param(viafb_active_dev, charp, S_IRUSR);
2137 MODULE_PARM_DESC(viafb_active_dev, "Specify active devices.");
2139 module_param(viafb_display_hardware_layout, int, S_IRUSR);
2140 MODULE_PARM_DESC(viafb_display_hardware_layout,
2141 "Display Hardware Layout (LCD Only, DVI Only...,etc)");
2143 module_param(viafb_second_size, int, S_IRUSR);
2144 MODULE_PARM_DESC(viafb_second_size,
2145 "Set secondary device memory size");
2147 module_param(viafb_dual_fb, int, S_IRUSR);
2148 MODULE_PARM_DESC(viafb_dual_fb,
2149 "Turn on/off flag of dual framebuffer devices.(Default = OFF)");
2151 module_param(viafb_platform_epia_dvi, int, S_IRUSR);
2152 MODULE_PARM_DESC(viafb_platform_epia_dvi,
2153 "Turn on/off flag of DVI devices on EPIA board.(Default = OFF)");
2155 module_param(viafb_device_lcd_dualedge, int, S_IRUSR);
2156 MODULE_PARM_DESC(viafb_device_lcd_dualedge,
2157 "Turn on/off flag of dual edge panel.(Default = OFF)");
2159 module_param(viafb_bus_width, int, S_IRUSR);
2160 MODULE_PARM_DESC(viafb_bus_width,
2161 "Set bus width of panel.(Default = 12)");
2163 module_param(viafb_lcd_mode, int, S_IRUSR);
2164 MODULE_PARM_DESC(viafb_lcd_mode,
2165 "Set Flat Panel mode(Default=OPENLDI)");
2167 module_param(viafb_lcd_port, charp, S_IRUSR);
2168 MODULE_PARM_DESC(viafb_lcd_port, "Specify LCD output port.");
2170 module_param(viafb_dvi_port, charp, S_IRUSR);
2171 MODULE_PARM_DESC(viafb_dvi_port, "Specify DVI output port.");
2173 MODULE_LICENSE("GPL");