Lines Matching +full:ouput +full:- +full:only

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved.
4 * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
13 #include <linux/via-core.h>
48 * only CX700, VX800, VX855, VX900 were documented
50 * VIA_6C can be onle pre-CX700 (probably only on CLE266) as 6C is used for PLL
76 var->grayscale = 0; in viafb_fill_var_color_info()
77 var->red.msb_right = 0; in viafb_fill_var_color_info()
78 var->green.msb_right = 0; in viafb_fill_var_color_info()
79 var->blue.msb_right = 0; in viafb_fill_var_color_info()
80 var->transp.offset = 0; in viafb_fill_var_color_info()
81 var->transp.length = 0; in viafb_fill_var_color_info()
82 var->transp.msb_right = 0; in viafb_fill_var_color_info()
83 var->nonstd = 0; in viafb_fill_var_color_info()
86 var->bits_per_pixel = 8; in viafb_fill_var_color_info()
87 var->red.offset = 0; in viafb_fill_var_color_info()
88 var->green.offset = 0; in viafb_fill_var_color_info()
89 var->blue.offset = 0; in viafb_fill_var_color_info()
90 var->red.length = 8; in viafb_fill_var_color_info()
91 var->green.length = 8; in viafb_fill_var_color_info()
92 var->blue.length = 8; in viafb_fill_var_color_info()
95 var->bits_per_pixel = 16; in viafb_fill_var_color_info()
96 var->red.offset = 10; in viafb_fill_var_color_info()
97 var->green.offset = 5; in viafb_fill_var_color_info()
98 var->blue.offset = 0; in viafb_fill_var_color_info()
99 var->red.length = 5; in viafb_fill_var_color_info()
100 var->green.length = 5; in viafb_fill_var_color_info()
101 var->blue.length = 5; in viafb_fill_var_color_info()
104 var->bits_per_pixel = 16; in viafb_fill_var_color_info()
105 var->red.offset = 11; in viafb_fill_var_color_info()
106 var->green.offset = 5; in viafb_fill_var_color_info()
107 var->blue.offset = 0; in viafb_fill_var_color_info()
108 var->red.length = 5; in viafb_fill_var_color_info()
109 var->green.length = 6; in viafb_fill_var_color_info()
110 var->blue.length = 5; in viafb_fill_var_color_info()
113 var->bits_per_pixel = 32; in viafb_fill_var_color_info()
114 var->red.offset = 16; in viafb_fill_var_color_info()
115 var->green.offset = 8; in viafb_fill_var_color_info()
116 var->blue.offset = 0; in viafb_fill_var_color_info()
117 var->red.length = 8; in viafb_fill_var_color_info()
118 var->green.length = 8; in viafb_fill_var_color_info()
119 var->blue.length = 8; in viafb_fill_var_color_info()
122 var->bits_per_pixel = 32; in viafb_fill_var_color_info()
123 var->red.offset = 20; in viafb_fill_var_color_info()
124 var->green.offset = 10; in viafb_fill_var_color_info()
125 var->blue.offset = 0; in viafb_fill_var_color_info()
126 var->red.length = 10; in viafb_fill_var_color_info()
127 var->green.length = 10; in viafb_fill_var_color_info()
128 var->blue.length = 10; in viafb_fill_var_color_info()
135 u32 bpp = info->var.bits_per_pixel; in viafb_update_fix()
137 info->fix.visual = in viafb_update_fix()
139 info->fix.line_length = ALIGN(info->var.xres_virtual * bpp / 8, in viafb_update_fix()
147 strcpy(fix->id, viafb_name); in viafb_setup_fixinfo()
149 fix->smem_start = viaparinfo->fbmem; in viafb_setup_fixinfo()
150 fix->smem_len = viaparinfo->fbmem_free; in viafb_setup_fixinfo()
152 fix->type = FB_TYPE_PACKED_PIXELS; in viafb_setup_fixinfo()
153 fix->type_aux = 0; in viafb_setup_fixinfo()
154 fix->visual = FB_VISUAL_TRUECOLOR; in viafb_setup_fixinfo()
156 fix->xpanstep = fix->ywrapstep = 0; in viafb_setup_fixinfo()
157 fix->ypanstep = 1; in viafb_setup_fixinfo()
160 viafbinfo->fix.accel = FB_ACCEL_VIA_UNICHROME; in viafb_setup_fixinfo()
178 htotal = var->left_margin + var->xres + var->right_margin in get_var_refresh()
179 + var->hsync_len; in get_var_refresh()
180 vtotal = var->upper_margin + var->yres + var->lower_margin in get_var_refresh()
181 + var->vsync_len; in get_var_refresh()
182 return PICOS2KHZ(var->pixclock) * 1000 / (htotal * vtotal); in get_var_refresh()
189 struct viafb_par *ppar = info->par; in viafb_check_var()
194 /* HW neither support interlacte nor double-scaned mode */ in viafb_check_var()
195 if (var->vmode & FB_VMODE_INTERLACED || var->vmode & FB_VMODE_DOUBLE) in viafb_check_var()
196 return -EINVAL; in viafb_check_var()
198 /* the refresh rate is not important here, as we only want to know in viafb_check_var()
201 if (!viafb_get_best_mode(var->xres, var->yres, 60)) { in viafb_check_var()
204 var->xres, var->yres, var->bits_per_pixel); in viafb_check_var()
205 return -EINVAL; in viafb_check_var()
208 depth = fb_get_color_depth(var, &info->fix); in viafb_check_var()
210 depth = var->bits_per_pixel; in viafb_check_var()
213 return -EINVAL; in viafb_check_var()
216 else if (depth == 15 && viafb_dual_fb && ppar->iga_path == IGA1) in viafb_check_var()
228 if (var->xres_virtual < var->xres) in viafb_check_var()
229 var->xres_virtual = var->xres; in viafb_check_var()
231 line = ALIGN(var->xres_virtual * var->bits_per_pixel / 8, in viafb_check_var()
233 if (line > VIA_PITCH_MAX || line * var->yres_virtual > ppar->memsize) in viafb_check_var()
234 return -EINVAL; in viafb_check_var()
239 refresh = viafb_get_refresh(var->xres, var->yres, in viafb_check_var()
244 viafb_get_best_mode(var->xres, var->yres, refresh)); in viafb_check_var()
245 if (var->accel_flags & FB_ACCELF_TEXT && in viafb_check_var()
246 !ppar->shared->vdev->engine_mmio) in viafb_check_var()
247 var->accel_flags = 0; in viafb_check_var()
254 struct viafb_par *viapar = info->par; in viafb_set_par()
259 viapar->depth = fb_get_color_depth(&info->var, &info->fix); in viafb_set_par()
260 viafb_update_device_setting(viafbinfo->var.xres, viafbinfo->var.yres, in viafb_set_par()
261 viafbinfo->var.bits_per_pixel, 0); in viafb_set_par()
264 viafb_update_device_setting(viafbinfo1->var.xres, in viafb_set_par()
265 viafbinfo1->var.yres, viafbinfo1->var.bits_per_pixel, in viafb_set_par()
276 refresh = get_var_refresh(&info->var); in viafb_set_par()
277 if (viafb_dual_fb && viapar->iga_path == IGA2) { in viafb_set_par()
278 viafb_bpp1 = info->var.bits_per_pixel; in viafb_set_par()
281 viafb_bpp = info->var.bits_per_pixel; in viafb_set_par()
285 if (info->var.accel_flags & FB_ACCELF_TEXT) in viafb_set_par()
286 info->flags &= ~FBINFO_HWACCEL_DISABLED; in viafb_set_par()
288 info->flags |= FBINFO_HWACCEL_DISABLED; in viafb_set_par()
290 viafb_pan_display(&info->var, info); in viafb_set_par()
299 struct viafb_par *viapar = info->par; in viafb_setcolreg()
302 if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR) { in viafb_setcolreg()
304 return -EINVAL; in viafb_setcolreg()
306 if (!viafb_dual_fb || viapar->iga_path == IGA1) in viafb_setcolreg()
310 if (!viafb_dual_fb || viapar->iga_path == IGA2) in viafb_setcolreg()
315 return -EINVAL; in viafb_setcolreg()
317 r = (red >> (16 - info->var.red.length)) in viafb_setcolreg()
318 << info->var.red.offset; in viafb_setcolreg()
319 b = (blue >> (16 - info->var.blue.length)) in viafb_setcolreg()
320 << info->var.blue.offset; in viafb_setcolreg()
321 g = (green >> (16 - info->var.green.length)) in viafb_setcolreg()
322 << info->var.green.offset; in viafb_setcolreg()
323 ((u32 *) info->pseudo_palette)[regno] = r | g | b; in viafb_setcolreg()
332 struct viafb_par *viapar = info->par; in viafb_pan_display()
333 u32 vram_addr = viapar->vram_addr in viafb_pan_display()
334 + var->yoffset * info->fix.line_length in viafb_pan_display()
335 + var->xoffset * info->var.bits_per_pixel / 8; in viafb_pan_display()
341 } else if (viapar->iga_path == IGA1) in viafb_pan_display()
404 if (copy_to_user(argp, viaparinfo->chip_info, in viafb_ioctl()
406 return -EFAULT; in viafb_ioctl()
413 return put_user(viafb_ioctl_hotplug(info->var.xres, in viafb_ioctl()
414 info->var.yres, in viafb_ioctl()
415 info->var.bits_per_pixel), argp); in viafb_ioctl()
418 return -EFAULT; in viafb_ioctl()
429 …u.viamode.virtual_xres_sec = viafb_dual_fb ? viafbinfo1->var.xres_virtual : viafbinfo->var.xres_vi… in viafb_ioctl()
430 …u.viamode.virtual_yres_sec = viafb_dual_fb ? viafbinfo1->var.yres_virtual : viafbinfo->var.yres_vi… in viafb_ioctl()
442 return -EFAULT; in viafb_ioctl()
449 u.viasamm.size_prim = viaparinfo->fbmem_free; in viafb_ioctl()
450 u.viasamm.size_sec = viaparinfo1->fbmem_free; in viafb_ioctl()
454 viaparinfo->fbmem_free - in viafb_ioctl()
460 viaparinfo->fbmem_free >> 1; in viafb_ioctl()
462 (viaparinfo->fbmem_free >> 1); in viafb_ioctl()
465 u.viasamm.mem_base = viaparinfo->fbmem; in viafb_ioctl()
469 viaparinfo->memsize - viaparinfo->fbmem_used; in viafb_ioctl()
471 u.viasamm.mem_base = viaparinfo->fbmem; in viafb_ioctl()
476 return -EFAULT; in viafb_ioctl()
481 return -EFAULT; in viafb_ioctl()
491 return -EFAULT; in viafb_ioctl()
526 return -EFAULT; in viafb_ioctl()
537 return -EFAULT; in viafb_ioctl()
547 return -EFAULT; in viafb_ioctl()
554 return -EFAULT; in viafb_ioctl()
560 return -EFAULT; in viafb_ioctl()
565 viafb_lcd_get_support_expand_state(info->var.xres, in viafb_ioctl()
566 info->var.yres); in viafb_ioctl()
568 return -EFAULT; in viafb_ioctl()
573 return -EFAULT; in viafb_ioctl()
588 return -ENOMEM; in viafb_ioctl()
593 return -EFAULT; in viafb_ioctl()
601 return -EFAULT; in viafb_ioctl()
612 return -EFAULT; in viafb_ioctl()
616 return -EFAULT; in viafb_ioctl()
621 return -EFAULT; in viafb_ioctl()
625 return -EFAULT; in viafb_ioctl()
631 return -EFAULT; in viafb_ioctl()
635 return -EFAULT; in viafb_ioctl()
640 return -EFAULT; in viafb_ioctl()
644 return -EFAULT; in viafb_ioctl()
650 return -EFAULT; in viafb_ioctl()
655 return -EFAULT; in viafb_ioctl()
659 return -EINVAL; in viafb_ioctl()
668 struct viafb_par *viapar = info->par; in viafb_fillrect()
669 struct viafb_shared *shared = viapar->shared; in viafb_fillrect()
673 if (info->flags & FBINFO_HWACCEL_DISABLED || !shared->hw_bitblt) { in viafb_fillrect()
678 if (!rect->width || !rect->height) in viafb_fillrect()
681 if (info->fix.visual == FB_VISUAL_TRUECOLOR) in viafb_fillrect()
682 fg_color = ((u32 *)info->pseudo_palette)[rect->color]; in viafb_fillrect()
684 fg_color = rect->color; in viafb_fillrect()
686 if (rect->rop == ROP_XOR) in viafb_fillrect()
692 if (shared->hw_bitblt(shared->vdev->engine_mmio, VIA_BITBLT_FILL, in viafb_fillrect()
693 rect->width, rect->height, info->var.bits_per_pixel, in viafb_fillrect()
694 viapar->vram_addr, info->fix.line_length, rect->dx, rect->dy, in viafb_fillrect()
702 struct viafb_par *viapar = info->par; in viafb_copyarea()
703 struct viafb_shared *shared = viapar->shared; in viafb_copyarea()
705 if (info->flags & FBINFO_HWACCEL_DISABLED || !shared->hw_bitblt) { in viafb_copyarea()
710 if (!area->width || !area->height) in viafb_copyarea()
714 if (shared->hw_bitblt(shared->vdev->engine_mmio, VIA_BITBLT_COLOR, in viafb_copyarea()
715 area->width, area->height, info->var.bits_per_pixel, in viafb_copyarea()
716 viapar->vram_addr, info->fix.line_length, area->dx, area->dy, in viafb_copyarea()
717 NULL, viapar->vram_addr, info->fix.line_length, in viafb_copyarea()
718 area->sx, area->sy, 0, 0, 0)) in viafb_copyarea()
725 struct viafb_par *viapar = info->par; in viafb_imageblit()
726 struct viafb_shared *shared = viapar->shared; in viafb_imageblit()
730 if (info->flags & FBINFO_HWACCEL_DISABLED || !shared->hw_bitblt || in viafb_imageblit()
731 (image->depth != 1 && image->depth != viapar->depth)) { in viafb_imageblit()
736 if (image->depth == 1) { in viafb_imageblit()
738 if (info->fix.visual == FB_VISUAL_TRUECOLOR) { in viafb_imageblit()
740 ((u32 *)info->pseudo_palette)[image->fg_color]; in viafb_imageblit()
742 ((u32 *)info->pseudo_palette)[image->bg_color]; in viafb_imageblit()
744 fg_color = image->fg_color; in viafb_imageblit()
745 bg_color = image->bg_color; in viafb_imageblit()
751 if (shared->hw_bitblt(shared->vdev->engine_mmio, op, in viafb_imageblit()
752 image->width, image->height, info->var.bits_per_pixel, in viafb_imageblit()
753 viapar->vram_addr, info->fix.line_length, image->dx, image->dy, in viafb_imageblit()
754 (u32 *)image->data, 0, 0, 0, 0, fg_color, bg_color, 0)) in viafb_imageblit()
760 struct viafb_par *viapar = info->par; in viafb_cursor()
761 void __iomem *engine = viapar->shared->vdev->engine_mmio; in viafb_cursor()
763 chip_name = viapar->shared->chip_info.gfx_chip_name; in viafb_cursor()
766 if (info->flags & FBINFO_HWACCEL_DISABLED || info != viafbinfo) in viafb_cursor()
767 return -ENODEV; in viafb_cursor()
769 /* LCD ouput does not support hw cursors (at least on VN896) */ in viafb_cursor()
770 if ((chip_name == UNICHROME_CLE266 && viapar->iga_path == IGA2) || in viafb_cursor()
772 return -ENODEV; in viafb_cursor()
776 if (cursor->set & FB_CUR_SETHOT) { in viafb_cursor()
777 temp = (cursor->hot.x << 16) + cursor->hot.y; in viafb_cursor()
781 if (cursor->set & FB_CUR_SETPOS) { in viafb_cursor()
782 yy = cursor->image.dy - info->var.yoffset; in viafb_cursor()
783 xx = cursor->image.dx - info->var.xoffset; in viafb_cursor()
789 if (cursor->image.width <= 32 && cursor->image.height <= 32) in viafb_cursor()
791 else if (cursor->image.width <= 64 && cursor->image.height <= 64) in viafb_cursor()
795 "%dx%d", cursor->image.width, cursor->image.height); in viafb_cursor()
796 return -ENXIO; in viafb_cursor()
799 if (cursor->set & FB_CUR_SETSIZE) { in viafb_cursor()
809 if (cursor->set & FB_CUR_SETCMAP) { in viafb_cursor()
810 fg_color = cursor->image.fg_color; in viafb_cursor()
811 bg_color = cursor->image.bg_color; in viafb_cursor()
817 ((info->cmap.red[fg_color] & 0xFFC0) << 14) | in viafb_cursor()
818 ((info->cmap.green[fg_color] & 0xFFC0) << 4) | in viafb_cursor()
819 ((info->cmap.blue[fg_color] & 0xFFC0) >> 6); in viafb_cursor()
821 ((info->cmap.red[bg_color] & 0xFFC0) << 14) | in viafb_cursor()
822 ((info->cmap.green[bg_color] & 0xFFC0) << 4) | in viafb_cursor()
823 ((info->cmap.blue[bg_color] & 0xFFC0) >> 6); in viafb_cursor()
826 ((info->cmap.red[fg_color] & 0xFF00) << 8) | in viafb_cursor()
827 (info->cmap.green[fg_color] & 0xFF00) | in viafb_cursor()
828 ((info->cmap.blue[fg_color] & 0xFF00) >> 8); in viafb_cursor()
830 ((info->cmap.red[bg_color] & 0xFF00) << 8) | in viafb_cursor()
831 (info->cmap.green[bg_color] & 0xFF00) | in viafb_cursor()
832 ((info->cmap.blue[bg_color] & 0xFF00) >> 8); in viafb_cursor()
839 if (cursor->set & FB_CUR_SETSHAPE) { in viafb_cursor()
844 int size = ((cursor->image.width + 7) >> 3) * in viafb_cursor()
845 cursor->image.height; in viafb_cursor()
848 return -ENOMEM; in viafb_cursor()
852 cr_data->bak[i] = 0x0; in viafb_cursor()
853 cr_data->bak[i + 1] = 0xFFFFFFFF; in viafb_cursor()
858 cr_data->bak[i] = 0x0; in viafb_cursor()
859 cr_data->bak[i + 1] = 0x0; in viafb_cursor()
860 cr_data->bak[i + 2] = 0xFFFFFFFF; in viafb_cursor()
861 cr_data->bak[i + 3] = 0xFFFFFFFF; in viafb_cursor()
866 switch (cursor->rop) { in viafb_cursor()
869 cr_data->data[i] = cursor->mask[i]; in viafb_cursor()
874 cr_data->data[i] = cursor->mask[i]; in viafb_cursor()
882 cr_data->bak[j] = (u32) cr_data->data[i]; in viafb_cursor()
883 cr_data->bak[j + 1] = ~cr_data->bak[j]; in viafb_cursor()
888 cr_data->bak[j] = (u32) cr_data->data[i]; in viafb_cursor()
889 cr_data->bak[j + 1] = 0x0; in viafb_cursor()
890 cr_data->bak[j + 2] = ~cr_data->bak[j]; in viafb_cursor()
891 cr_data->bak[j + 3] = ~cr_data->bak[j + 1]; in viafb_cursor()
896 memcpy_toio(viafbinfo->screen_base + viapar->shared-> in viafb_cursor()
897 cursor_vram_addr, cr_data->bak, CURSOR_SIZE); in viafb_cursor()
901 if (cursor->enable) in viafb_cursor()
909 if (!(info->flags & FBINFO_HWACCEL_DISABLED)) in viafb_sync()
920 if (viaparinfo->shared->iga1_devices & VIA_CRT) { in get_primary_device()
926 if (viaparinfo->tmds_setting_info->iga_path == IGA1) { in get_primary_device()
928 viaparinfo-> in get_primary_device()
929 tmds_setting_info->iga_path); in get_primary_device()
934 if (viaparinfo->lvds_setting_info->iga_path == IGA1) { in get_primary_device()
936 viaparinfo-> in get_primary_device()
937 lvds_setting_info->iga_path); in get_primary_device()
942 if (viaparinfo->lvds_setting_info2->iga_path == IGA1) { in get_primary_device()
944 viaparinfo-> in get_primary_device()
945 lvds_setting_info2->iga_path); in get_primary_device()
959 setting_info->device_status = CRT_Device; in retrieve_device_setting()
961 setting_info->device_status |= DVI_Device; in retrieve_device_setting()
963 setting_info->device_status |= LCD_Device; in retrieve_device_setting()
965 setting_info->device_status |= LCD2_Device; in retrieve_device_setting()
967 setting_info->samm_status = viafb_SAMM_ON; in retrieve_device_setting()
968 setting_info->primary_device = get_primary_device(); in retrieve_device_setting()
970 setting_info->first_dev_bpp = viafb_bpp; in retrieve_device_setting()
971 setting_info->second_dev_bpp = viafb_bpp1; in retrieve_device_setting()
973 setting_info->first_dev_refresh = viafb_refresh; in retrieve_device_setting()
974 setting_info->second_dev_refresh = viafb_refresh1; in retrieve_device_setting()
976 setting_info->first_dev_hor_res = viafb_hotplug_Xres; in retrieve_device_setting()
977 setting_info->first_dev_ver_res = viafb_hotplug_Yres; in retrieve_device_setting()
978 setting_info->second_dev_hor_res = viafb_second_xres; in retrieve_device_setting()
979 setting_info->second_dev_ver_res = viafb_second_yres; in retrieve_device_setting()
982 setting_info->lcd_attributes.display_center = viafb_lcd_dsp_method; in retrieve_device_setting()
983 setting_info->lcd_attributes.panel_id = viafb_lcd_panel_id; in retrieve_device_setting()
984 setting_info->lcd_attributes.lcd_mode = viafb_lcd_mode; in retrieve_device_setting()
999 if (machine_is_olpc()) { /* LCD only */ in parse_active_dev()
1045 /* CRT only */ in parse_active_dev()
1049 /* DVI only */ in parse_active_dev()
1053 /* LCD only */ in parse_active_dev()
1057 return -EINVAL; in parse_active_dev()
1081 parse_port(viafb_lcd_port, &viaparinfo->chip_info->lvds_chip_info. in parse_lcd_port()
1084 viaparinfo->chip_info->lvds_chip_info2.output_interface = in parse_lcd_port()
1088 viafb_lcd_port, viaparinfo->chip_info->lvds_chip_info. in parse_lcd_port()
1094 parse_port(viafb_dvi_port, &viaparinfo->chip_info->tmds_chip_info. in parse_dvi_port()
1098 viafb_dvi_port, viaparinfo->chip_info->tmds_chip_info. in parse_dvi_port()
1136 return -EINVAL; in viafb_dvp0_proc_write()
1139 return -EFAULT; in viafb_dvp0_proc_write()
1140 buf[length - 1] = '\0'; /*Ensure end string */ in viafb_dvp0_proc_write()
1146 return -EINVAL; in viafb_dvp0_proc_write()
1206 return -EINVAL; in viafb_dvp1_proc_write()
1209 return -EFAULT; in viafb_dvp1_proc_write()
1210 buf[length - 1] = '\0'; /*Ensure end string */ in viafb_dvp1_proc_write()
1216 return -EINVAL; in viafb_dvp1_proc_write()
1319 switch (viaparinfo->chip_info->lvds_chip_info.lvds_chip_name) { in viafb_vt1636_proc_show()
1322 viafb_gpio_i2c_read_lvds(viaparinfo->lvds_setting_info, in viafb_vt1636_proc_show()
1323 &viaparinfo->chip_info->lvds_chip_info, 0x08) & 0x0f; in viafb_vt1636_proc_show()
1325 viafb_gpio_i2c_read_lvds(viaparinfo->lvds_setting_info, in viafb_vt1636_proc_show()
1326 &viaparinfo->chip_info->lvds_chip_info, 0x09) & 0x1f; in viafb_vt1636_proc_show()
1332 switch (viaparinfo->chip_info->lvds_chip_info2.lvds_chip_name) { in viafb_vt1636_proc_show()
1335 viafb_gpio_i2c_read_lvds(viaparinfo->lvds_setting_info2, in viafb_vt1636_proc_show()
1336 &viaparinfo->chip_info->lvds_chip_info2, 0x08) & 0x0f; in viafb_vt1636_proc_show()
1338 viafb_gpio_i2c_read_lvds(viaparinfo->lvds_setting_info2, in viafb_vt1636_proc_show()
1339 &viaparinfo->chip_info->lvds_chip_info2, 0x09) & 0x1f; in viafb_vt1636_proc_show()
1360 return -EINVAL; in viafb_vt1636_proc_write()
1363 return -EFAULT; in viafb_vt1636_proc_write()
1364 buf[length - 1] = '\0'; /*Ensure end string */ in viafb_vt1636_proc_write()
1366 switch (viaparinfo->chip_info->lvds_chip_info.lvds_chip_name) { in viafb_vt1636_proc_write()
1372 return -EINVAL; in viafb_vt1636_proc_write()
1378 (viaparinfo->lvds_setting_info, in viafb_vt1636_proc_write()
1379 &viaparinfo-> in viafb_vt1636_proc_write()
1380 chip_info->lvds_chip_info, in viafb_vt1636_proc_write()
1387 (viaparinfo->lvds_setting_info, in viafb_vt1636_proc_write()
1388 &viaparinfo-> in viafb_vt1636_proc_write()
1389 chip_info->lvds_chip_info, in viafb_vt1636_proc_write()
1403 switch (viaparinfo->chip_info->lvds_chip_info2.lvds_chip_name) { in viafb_vt1636_proc_write()
1409 return -EINVAL; in viafb_vt1636_proc_write()
1415 (viaparinfo->lvds_setting_info2, in viafb_vt1636_proc_write()
1416 &viaparinfo-> in viafb_vt1636_proc_write()
1417 chip_info->lvds_chip_info2, in viafb_vt1636_proc_write()
1424 (viaparinfo->lvds_setting_info2, in viafb_vt1636_proc_write()
1425 &viaparinfo-> in viafb_vt1636_proc_write()
1426 chip_info->lvds_chip_info2, in viafb_vt1636_proc_write()
1456 viaparinfo->shared->chip_info.gfx_chip_name]); in viafb_sup_odev_proc_show()
1467 return -EINVAL; in odev_update()
1469 return -EFAULT; in odev_update()
1472 sub = buf[0] == '-'; in odev_update()
1479 return -EINVAL; in odev_update()
1491 via_odev_to_seq(m, viaparinfo->shared->iga1_devices); in viafb_iga1_odev_proc_show()
1506 dev_old = dev_new = viaparinfo->shared->iga1_devices; in viafb_iga1_odev_proc_write()
1512 viaparinfo->shared->iga1_devices = dev_new; in viafb_iga1_odev_proc_write()
1513 viaparinfo->shared->iga2_devices &= ~dev_new; in viafb_iga1_odev_proc_write()
1530 via_odev_to_seq(m, viaparinfo->shared->iga2_devices); in viafb_iga2_odev_proc_show()
1545 dev_old = dev_new = viaparinfo->shared->iga2_devices; in viafb_iga2_odev_proc_write()
1551 viaparinfo->shared->iga2_devices = dev_new; in viafb_iga2_odev_proc_write()
1552 viaparinfo->shared->iga1_devices &= ~dev_new; in viafb_iga2_odev_proc_write()
1573 shared->proc_entry = viafb_entry; in viafb_init_proc()
1580 if (IS_VT1636(shared->chip_info.lvds_chip_info) in viafb_init_proc()
1581 || IS_VT1636(shared->chip_info.lvds_chip_info2)) in viafb_init_proc()
1589 shared->iga1_proc_entry = iga1_entry; in viafb_init_proc()
1593 shared->iga2_proc_entry = iga2_entry; in viafb_init_proc()
1600 struct proc_dir_entry *viafb_entry = shared->proc_entry; in viafb_remove_proc()
1605 remove_proc_entry("output_devices", shared->iga2_proc_entry); in viafb_remove_proc()
1607 remove_proc_entry("output_devices", shared->iga1_proc_entry); in viafb_remove_proc()
1616 if (IS_VT1636(shared->chip_info.lvds_chip_info) in viafb_remove_proc()
1617 || IS_VT1636(shared->chip_info.lvds_chip_info2)) in viafb_remove_proc()
1633 viaparinfo->shared->i2c_26); in parse_mode()
1636 viaparinfo->shared->i2c_31); in parse_mode()
1639 *xres = mode->xres; in parse_mode()
1640 *yres = mode->yres; in parse_mode()
1653 return -EINVAL; in parse_mode()
1657 return -EINVAL; in parse_mode()
1677 if (viaparinfo->shared->vdev->engine_mmio) in viafb_resume()
1699 shared->i2c_26 = via_aux_probe(viafb_find_i2c_adapter(VIA_PORT_26)); in i2c_bus_probe()
1703 shared->i2c_31 = via_aux_probe(viafb_find_i2c_adapter(VIA_PORT_31)); in i2c_bus_probe()
1708 shared->i2c_2C = via_aux_probe(viafb_find_i2c_adapter(VIA_PORT_2C)); in i2c_bus_probe()
1716 via_aux_free(shared->i2c_26); in i2c_bus_free()
1717 via_aux_free(shared->i2c_31); in i2c_bus_free()
1718 via_aux_free(shared->i2c_2C); in i2c_bus_free()
1737 &vdev->pdev->dev); in via_fb_pci_probe()
1739 return -ENOMEM; in via_fb_pci_probe()
1741 viaparinfo = (struct viafb_par *)viafbinfo->par; in via_fb_pci_probe()
1742 viaparinfo->shared = viafbinfo->par + viafb_par_length; in via_fb_pci_probe()
1743 viaparinfo->shared->vdev = vdev; in via_fb_pci_probe()
1744 viaparinfo->vram_addr = 0; in via_fb_pci_probe()
1745 viaparinfo->tmds_setting_info = &viaparinfo->shared->tmds_setting_info; in via_fb_pci_probe()
1746 viaparinfo->lvds_setting_info = &viaparinfo->shared->lvds_setting_info; in via_fb_pci_probe()
1747 viaparinfo->lvds_setting_info2 = in via_fb_pci_probe()
1748 &viaparinfo->shared->lvds_setting_info2; in via_fb_pci_probe()
1749 viaparinfo->chip_info = &viaparinfo->shared->chip_info; in via_fb_pci_probe()
1751 i2c_bus_probe(viaparinfo->shared); in via_fb_pci_probe()
1757 viafb_init_chip_info(vdev->chip_type); in via_fb_pci_probe()
1763 viaparinfo->fbmem = vdev->fbmem_start; in via_fb_pci_probe()
1764 viaparinfo->memsize = vdev->fbmem_len; in via_fb_pci_probe()
1765 viaparinfo->fbmem_free = viaparinfo->memsize; in via_fb_pci_probe()
1766 viaparinfo->fbmem_used = 0; in via_fb_pci_probe()
1767 viafbinfo->screen_base = vdev->fbmem; in via_fb_pci_probe()
1769 viafbinfo->fix.mmio_start = vdev->engine_start; in via_fb_pci_probe()
1770 viafbinfo->fix.mmio_len = vdev->engine_len; in via_fb_pci_probe()
1771 viafbinfo->node = 0; in via_fb_pci_probe()
1772 viafbinfo->fbops = &viafb_ops; in via_fb_pci_probe()
1773 viafbinfo->flags = FBINFO_HWACCEL_YPAN; in via_fb_pci_probe()
1775 viafbinfo->pseudo_palette = pseudo_pal; in via_fb_pci_probe()
1777 viafbinfo->flags |= FBINFO_HWACCEL_COPYAREA | in via_fb_pci_probe()
1781 viafbinfo->flags |= FBINFO_HWACCEL_DISABLED; in via_fb_pci_probe()
1786 viafb_second_offset = viaparinfo->fbmem_free - in via_fb_pci_probe()
1790 viafb_second_offset = viaparinfo->fbmem_free - in via_fb_pci_probe()
1794 parse_mode(viafb_mode, viaparinfo->shared->iga1_devices, in via_fb_pci_probe()
1797 parse_mode(viafb_mode1, viaparinfo->shared->iga2_devices, in via_fb_pci_probe()
1807 viafb_setup_fixinfo(&viafbinfo->fix, viaparinfo); in via_fb_pci_probe()
1808 viafbinfo->var = default_var; in via_fb_pci_probe()
1812 &vdev->pdev->dev); in via_fb_pci_probe()
1814 rc = -ENOMEM; in via_fb_pci_probe()
1817 viaparinfo1 = viafbinfo1->par; in via_fb_pci_probe()
1819 viaparinfo1->vram_addr = viafb_second_offset; in via_fb_pci_probe()
1820 viaparinfo1->memsize = viaparinfo->memsize - in via_fb_pci_probe()
1822 viaparinfo->memsize = viafb_second_offset; in via_fb_pci_probe()
1823 viaparinfo1->fbmem = viaparinfo->fbmem + viafb_second_offset; in via_fb_pci_probe()
1825 viaparinfo1->fbmem_used = viaparinfo->fbmem_used; in via_fb_pci_probe()
1826 viaparinfo1->fbmem_free = viaparinfo1->memsize - in via_fb_pci_probe()
1827 viaparinfo1->fbmem_used; in via_fb_pci_probe()
1828 viaparinfo->fbmem_free = viaparinfo->memsize; in via_fb_pci_probe()
1829 viaparinfo->fbmem_used = 0; in via_fb_pci_probe()
1831 viaparinfo->iga_path = IGA1; in via_fb_pci_probe()
1832 viaparinfo1->iga_path = IGA2; in via_fb_pci_probe()
1834 viafbinfo1->par = viaparinfo1; in via_fb_pci_probe()
1835 viafbinfo1->screen_base = viafbinfo->screen_base + in via_fb_pci_probe()
1846 viafb_setup_fixinfo(&viafbinfo1->fix, viaparinfo1); in via_fb_pci_probe()
1848 viafbinfo1->var = default_var; in via_fb_pci_probe()
1850 viaparinfo1->depth = fb_get_color_depth(&viafbinfo1->var, in via_fb_pci_probe()
1851 &viafbinfo1->fix); in via_fb_pci_probe()
1854 viafb_check_var(&viafbinfo->var, viafbinfo); in via_fb_pci_probe()
1856 viaparinfo->depth = fb_get_color_depth(&viafbinfo->var, in via_fb_pci_probe()
1857 &viafbinfo->fix); in via_fb_pci_probe()
1859 rc = fb_alloc_cmap(&viafbinfo->cmap, 256, 0); in via_fb_pci_probe()
1864 && (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)) { in via_fb_pci_probe()
1874 || (viaparinfo->chip_info->gfx_chip_name != in via_fb_pci_probe()
1880 DEBUG_MSG(KERN_INFO "fb%d: %s frame buffer device %dx%d-%dbpp\n", in via_fb_pci_probe()
1881 viafbinfo->node, viafbinfo->fix.id, default_var.xres, in via_fb_pci_probe()
1884 viafb_init_proc(viaparinfo->shared); in via_fb_pci_probe()
1896 && (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)) in via_fb_pci_probe()
1899 fb_dealloc_cmap(&viafbinfo->cmap); in via_fb_pci_probe()
1903 i2c_bus_free(viaparinfo->shared); in via_fb_pci_probe()
1911 fb_dealloc_cmap(&viafbinfo->cmap); in via_fb_pci_remove()
1915 viafb_remove_proc(viaparinfo->shared); in via_fb_pci_remove()
1916 i2c_bus_free(viaparinfo->shared); in via_fb_pci_remove()
1931 return -ENODEV; in viafb_setup()
1943 return -ENOMEM; in viafb_setup()
1947 return -ENOMEM; in viafb_setup()
1950 return -EINVAL; in viafb_setup()
1953 return -EINVAL; in viafb_setup()
1956 return -EINVAL; in viafb_setup()
1959 return -EINVAL; in viafb_setup()
1963 return -EINVAL; in viafb_setup()
1967 return -EINVAL; in viafb_setup()
1970 return -EINVAL; in viafb_setup()
1973 return -EINVAL; in viafb_setup()
1977 return -ENOMEM; in viafb_setup()
1982 return -EINVAL; in viafb_setup()
1985 return -EINVAL; in viafb_setup()
1990 return -EINVAL; in viafb_setup()
1995 return -EINVAL; in viafb_setup()
1998 return -EINVAL; in viafb_setup()
2001 return -EINVAL; in viafb_setup()
2005 return -ENOMEM; in viafb_setup()
2009 return -ENOMEM; in viafb_setup()
2017 * These are called out of via-core for now.
2025 /* Apply XO-1.5-specific configuration. */ in viafb_init()
2040 return -EINVAL; in viafb_init()
2115 "Display Hardware Layout (LCD Only, DVI Only...,etc)");