Lines Matching +full:timing +full:- +full:0
4 * Copyright (C) 1999 Silicon Graphics, Inc. - Jeffrey Newquist
5 * Copyright (C) 2002 Vivien Chappelier <vivien.chappelier@linux-mips.org>
14 #include <linux/dma-mapping.h>
37 struct gbe_timing_info timing; member
42 #define GBE_BASE 0x16000000 /* SGI O2 */
44 /* macro for fastest write-though access to the framebuffer */
63 #define TILE_MASK (TILE_SIZE - 1)
81 static int gbe_turned_on; /* 0 turned off, 1 turned on */
87 /* 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) */
92 .xoffset = 0,
93 .yoffset = 0,
95 .grayscale = 0,
96 .red = { 0, 8, 0 },
97 .green = { 0, 8, 0 },
98 .blue = { 0, 8, 0 },
99 .transp = { 0, 0, 0 },
100 .nonstd = 0,
101 .activate = 0,
102 .height = -1,
103 .width = -1,
104 .accel_flags = 0,
112 .sync = 0,
123 .xoffset = 0,
124 .yoffset = 0,
126 .grayscale = 0,
127 .red = { 0, 8, 0 },
128 .green = { 0, 8, 0 },
129 .blue = { 0, 8, 0 },
130 .transp = { 0, 0, 0 },
131 .nonstd = 0,
132 .activate = 0,
133 .height = -1,
134 .width = -1,
135 .accel_flags = 0,
143 .sync = 0,
148 /* 640x480, 60 Hz, Non-Interlaced (25.172 MHz dotclock) */
160 .sync = 0,
181 static int flat_panel_enabled = 0;
186 gbe->ctrlstat = 0x300aa000; in gbe_reset()
203 gbe_turned_on = 0; in gbe_turn_off()
206 val = gbe->vt_xy; in gbe_turn_off()
211 val = gbe->ovr_control; in gbe_turn_off()
212 SET_GBE_FIELD(OVR_CONTROL, OVR_DMA_ENABLE, val, 0); in gbe_turn_off()
213 gbe->ovr_control = val; in gbe_turn_off()
215 val = gbe->frm_control; in gbe_turn_off()
216 SET_GBE_FIELD(FRM_CONTROL, FRM_DMA_ENABLE, val, 0); in gbe_turn_off()
217 gbe->frm_control = val; in gbe_turn_off()
219 val = gbe->did_control; in gbe_turn_off()
220 SET_GBE_FIELD(DID_CONTROL, DID_DMA_ENABLE, val, 0); in gbe_turn_off()
221 gbe->did_control = val; in gbe_turn_off()
226 for (i = 0; i < 10000; i++) { in gbe_turn_off()
227 val = gbe->frm_inhwctrl; in gbe_turn_off()
231 val = gbe->ovr_inhwctrl; in gbe_turn_off()
235 val = gbe->did_inhwctrl; in gbe_turn_off()
247 val = gbe->vt_vpixen; in gbe_turn_off()
250 for (i = 0; i < 100000; i++) { in gbe_turn_off()
251 val = gbe->vt_xy; in gbe_turn_off()
260 for (i = 0; i < 10000; i++) { in gbe_turn_off()
261 val = gbe->vt_xy; in gbe_turn_off()
271 val = 0; in gbe_turn_off()
273 gbe->vt_xy = val; in gbe_turn_off()
275 for (i = 0; i < 10000; i++) { in gbe_turn_off()
276 val = gbe->vt_xy; in gbe_turn_off()
286 val = gbe->dotclock; in gbe_turn_off()
287 SET_GBE_FIELD(DOTCLK, RUN, val, 0); in gbe_turn_off()
288 gbe->dotclock = val; in gbe_turn_off()
290 for (i = 0; i < 10000; i++) { in gbe_turn_off()
291 val = gbe->dotclock; in gbe_turn_off()
301 val = gbe->frm_size_tile; in gbe_turn_off()
303 gbe->frm_size_tile = val; in gbe_turn_off()
304 SET_GBE_FIELD(FRM_SIZE_TILE, FRM_FIFO_RESET, val, 0); in gbe_turn_off()
305 gbe->frm_size_tile = val; in gbe_turn_off()
317 val = gbe->vt_xy; in gbe_turn_on()
318 if (GET_GBE_FIELD(VT_XY, FREEZE, val) == 0) in gbe_turn_on()
323 val = gbe->dotclock; in gbe_turn_on()
325 gbe->dotclock = val; in gbe_turn_on()
327 for (i = 0; i < 10000; i++) { in gbe_turn_on()
328 val = gbe->dotclock; in gbe_turn_on()
338 val = 0; in gbe_turn_on()
339 SET_GBE_FIELD(VT_XY, FREEZE, val, 0); in gbe_turn_on()
340 gbe->vt_xy = val; in gbe_turn_on()
342 for (i = 0; i < 10000; i++) { in gbe_turn_on()
343 val = gbe->vt_xy; in gbe_turn_on()
353 val = gbe->frm_control; in gbe_turn_on()
355 gbe->frm_control = val; in gbe_turn_on()
357 for (i = 0; i < 10000; i++) { in gbe_turn_on()
358 val = gbe->frm_inhwctrl; in gbe_turn_on()
374 for (i = 0; i < 256; i++) { in gbe_loadcmap()
375 for (j = 0; j < 1000 && gbe->cm_fifo >= 63; j++) in gbe_loadcmap()
380 gbe->cmap[i] = gbe_cmap[i]; in gbe_loadcmap()
389 /* 0 unblank, 1 blank, 2 no vsync, 3 no hsync, 4 off */ in gbefb_blank()
404 return 0; in gbefb_blank()
410 static void gbefb_setup_flatpanel(struct gbe_timing_info *timing) in gbefb_setup_flatpanel() argument
413 u32 outputVal = 0; in gbefb_setup_flatpanel()
416 (timing->flags & FB_SYNC_HOR_HIGH_ACT) ? 0 : 1); in gbefb_setup_flatpanel()
418 (timing->flags & FB_SYNC_VERT_HIGH_ACT) ? 0 : 1); in gbefb_setup_flatpanel()
419 gbe->vt_flags = outputVal; in gbefb_setup_flatpanel()
424 fp_vbs = 0; in gbefb_setup_flatpanel()
426 timing->pll_m = 4; in gbefb_setup_flatpanel()
427 timing->pll_n = 1; in gbefb_setup_flatpanel()
428 timing->pll_p = 0; in gbefb_setup_flatpanel()
430 outputVal = 0; in gbefb_setup_flatpanel()
433 gbe->fp_de = outputVal; in gbefb_setup_flatpanel()
434 outputVal = 0; in gbefb_setup_flatpanel()
436 gbe->fp_hdrv = outputVal; in gbefb_setup_flatpanel()
437 outputVal = 0; in gbefb_setup_flatpanel()
440 gbe->fp_vdrv = outputVal; in gbefb_setup_flatpanel()
455 struct gbe_timing_info *timing) in compute_gbe_timing() argument
462 gbe_pll = &gbe_pll_table[0]; in compute_gbe_timing()
466 /* Determine valid resolution and timing in compute_gbe_timing()
472 best_n = best_m = best_p = 0; in compute_gbe_timing()
473 for (pll_p = 0; pll_p < 4; pll_p++) in compute_gbe_timing()
476 pixclock = (1000000 / gbe_pll->clock_rate) * in compute_gbe_timing()
479 error = var->pixclock - pixclock; in compute_gbe_timing()
481 if (error < 0) in compute_gbe_timing()
482 error = -error; in compute_gbe_timing()
486 gbe_pll->fvco_min / gbe_pll->clock_rate && in compute_gbe_timing()
488 gbe_pll->fvco_max / gbe_pll->clock_rate) { in compute_gbe_timing()
497 return -EINVAL; /* Resolution to high */ in compute_gbe_timing()
499 pixclock = (1000000 / gbe_pll->clock_rate) * in compute_gbe_timing()
502 /* set video timing information */ in compute_gbe_timing()
503 if (timing) { in compute_gbe_timing()
504 timing->width = var->xres; in compute_gbe_timing()
505 timing->height = var->yres; in compute_gbe_timing()
506 timing->pll_m = best_m; in compute_gbe_timing()
507 timing->pll_n = best_n; in compute_gbe_timing()
508 timing->pll_p = best_p; in compute_gbe_timing()
509 timing->cfreq = gbe_pll->clock_rate * 1000 * timing->pll_m / in compute_gbe_timing()
510 (timing->pll_n << timing->pll_p); in compute_gbe_timing()
511 timing->htotal = var->left_margin + var->xres + in compute_gbe_timing()
512 var->right_margin + var->hsync_len; in compute_gbe_timing()
513 timing->vtotal = var->upper_margin + var->yres + in compute_gbe_timing()
514 var->lower_margin + var->vsync_len; in compute_gbe_timing()
515 timing->fields_sec = 1000 * timing->cfreq / timing->htotal * in compute_gbe_timing()
516 1000 / timing->vtotal; in compute_gbe_timing()
517 timing->hblank_start = var->xres; in compute_gbe_timing()
518 timing->vblank_start = var->yres; in compute_gbe_timing()
519 timing->hblank_end = timing->htotal; in compute_gbe_timing()
520 timing->hsync_start = var->xres + var->right_margin + 1; in compute_gbe_timing()
521 timing->hsync_end = timing->hsync_start + var->hsync_len; in compute_gbe_timing()
522 timing->vblank_end = timing->vtotal; in compute_gbe_timing()
523 timing->vsync_start = var->yres + var->lower_margin + 1; in compute_gbe_timing()
524 timing->vsync_end = timing->vsync_start + var->vsync_len; in compute_gbe_timing()
530 static void gbe_set_timing_info(struct gbe_timing_info *timing) in gbe_set_timing_info() argument
536 val = 0; in gbe_set_timing_info()
537 SET_GBE_FIELD(DOTCLK, M, val, timing->pll_m - 1); in gbe_set_timing_info()
538 SET_GBE_FIELD(DOTCLK, N, val, timing->pll_n - 1); in gbe_set_timing_info()
539 SET_GBE_FIELD(DOTCLK, P, val, timing->pll_p); in gbe_set_timing_info()
540 SET_GBE_FIELD(DOTCLK, RUN, val, 0); /* do not start yet */ in gbe_set_timing_info()
541 gbe->dotclock = val; in gbe_set_timing_info()
545 val = 0; in gbe_set_timing_info()
546 SET_GBE_FIELD(VT_XYMAX, MAXX, val, timing->htotal); in gbe_set_timing_info()
547 SET_GBE_FIELD(VT_XYMAX, MAXY, val, timing->vtotal); in gbe_set_timing_info()
548 gbe->vt_xymax = val; in gbe_set_timing_info()
550 /* setup video timing signals */ in gbe_set_timing_info()
551 val = 0; in gbe_set_timing_info()
552 SET_GBE_FIELD(VT_VSYNC, VSYNC_ON, val, timing->vsync_start); in gbe_set_timing_info()
553 SET_GBE_FIELD(VT_VSYNC, VSYNC_OFF, val, timing->vsync_end); in gbe_set_timing_info()
554 gbe->vt_vsync = val; in gbe_set_timing_info()
555 val = 0; in gbe_set_timing_info()
556 SET_GBE_FIELD(VT_HSYNC, HSYNC_ON, val, timing->hsync_start); in gbe_set_timing_info()
557 SET_GBE_FIELD(VT_HSYNC, HSYNC_OFF, val, timing->hsync_end); in gbe_set_timing_info()
558 gbe->vt_hsync = val; in gbe_set_timing_info()
559 val = 0; in gbe_set_timing_info()
560 SET_GBE_FIELD(VT_VBLANK, VBLANK_ON, val, timing->vblank_start); in gbe_set_timing_info()
561 SET_GBE_FIELD(VT_VBLANK, VBLANK_OFF, val, timing->vblank_end); in gbe_set_timing_info()
562 gbe->vt_vblank = val; in gbe_set_timing_info()
563 val = 0; in gbe_set_timing_info()
565 timing->hblank_start - 5); in gbe_set_timing_info()
567 timing->hblank_end - 3); in gbe_set_timing_info()
568 gbe->vt_hblank = val; in gbe_set_timing_info()
570 /* setup internal timing signals */ in gbe_set_timing_info()
571 val = 0; in gbe_set_timing_info()
572 SET_GBE_FIELD(VT_VCMAP, VCMAP_ON, val, timing->vblank_start); in gbe_set_timing_info()
573 SET_GBE_FIELD(VT_VCMAP, VCMAP_OFF, val, timing->vblank_end); in gbe_set_timing_info()
574 gbe->vt_vcmap = val; in gbe_set_timing_info()
575 val = 0; in gbe_set_timing_info()
576 SET_GBE_FIELD(VT_HCMAP, HCMAP_ON, val, timing->hblank_start); in gbe_set_timing_info()
577 SET_GBE_FIELD(VT_HCMAP, HCMAP_OFF, val, timing->hblank_end); in gbe_set_timing_info()
578 gbe->vt_hcmap = val; in gbe_set_timing_info()
580 val = 0; in gbe_set_timing_info()
581 temp = timing->vblank_start - timing->vblank_end - 1; in gbe_set_timing_info()
582 if (temp > 0) in gbe_set_timing_info()
583 temp = -temp; in gbe_set_timing_info()
586 gbefb_setup_flatpanel(timing); in gbe_set_timing_info()
589 if (timing->hblank_end >= 20) in gbe_set_timing_info()
591 timing->hblank_end - 20); in gbe_set_timing_info()
594 timing->htotal - (20 - timing->hblank_end)); in gbe_set_timing_info()
595 gbe->did_start_xy = val; in gbe_set_timing_info()
597 val = 0; in gbe_set_timing_info()
599 if (timing->hblank_end >= GBE_CRS_MAGIC) in gbe_set_timing_info()
601 timing->hblank_end - GBE_CRS_MAGIC); in gbe_set_timing_info()
604 timing->htotal - (GBE_CRS_MAGIC - in gbe_set_timing_info()
605 timing->hblank_end)); in gbe_set_timing_info()
606 gbe->crs_start_xy = val; in gbe_set_timing_info()
608 val = 0; in gbe_set_timing_info()
610 SET_GBE_FIELD(VC_START_XY, VC_STARTX, val, timing->hblank_end - 4); in gbe_set_timing_info()
611 gbe->vc_start_xy = val; in gbe_set_timing_info()
613 val = 0; in gbe_set_timing_info()
614 temp = timing->hblank_end - GBE_PIXEN_MAGIC_ON; in gbe_set_timing_info()
615 if (temp < 0) in gbe_set_timing_info()
616 temp += timing->htotal; /* allow blank to wrap around */ in gbe_set_timing_info()
620 ((temp + timing->width - in gbe_set_timing_info()
621 GBE_PIXEN_MAGIC_OFF) % timing->htotal)); in gbe_set_timing_info()
622 gbe->vt_hpixen = val; in gbe_set_timing_info()
624 val = 0; in gbe_set_timing_info()
625 SET_GBE_FIELD(VT_VPIXEN, VPIXEN_ON, val, timing->vblank_end); in gbe_set_timing_info()
626 SET_GBE_FIELD(VT_VPIXEN, VPIXEN_OFF, val, timing->vblank_start); in gbe_set_timing_info()
627 gbe->vt_vpixen = val; in gbe_set_timing_info()
630 val = 0; in gbe_set_timing_info()
632 gbe->vt_flags = val; in gbe_set_timing_info()
647 struct gbefb_par *par = (struct gbefb_par *) info->par; in gbefb_set_par()
649 compute_gbe_timing(&info->var, &par->timing); in gbefb_set_par()
651 bytesPerPixel = info->var.bits_per_pixel / 8; in gbefb_set_par()
652 info->fix.line_length = info->var.xres_virtual * bytesPerPixel; in gbefb_set_par()
653 xpmax = par->timing.width; in gbefb_set_par()
654 ypmax = par->timing.height; in gbefb_set_par()
659 /* set timing info */ in gbefb_set_par()
660 gbe_set_timing_info(&par->timing); in gbefb_set_par()
663 val = 0; in gbefb_set_par()
667 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; in gbefb_set_par()
671 info->fix.visual = FB_VISUAL_TRUECOLOR; in gbefb_set_par()
675 info->fix.visual = FB_VISUAL_TRUECOLOR; in gbefb_set_par()
680 for (i = 0; i < 32; i++) in gbefb_set_par()
681 gbe->mode_regs[i] = val; in gbefb_set_par()
684 gbe->vt_intr01 = 0xffffffff; in gbefb_set_par()
685 gbe->vt_intr23 = 0xffffffff; in gbefb_set_par()
694 <-------- 640 -----> in gbefb_set_par()
695 <---- 512 ----><128|384 offscreen> in gbefb_set_par()
697 | 128 [tile 0] [tile 1] in gbefb_set_par()
702 0 ^ in gbefb_set_par()
720 GBE -> tile list framebuffer TLB <------------ CPU in gbefb_set_par()
721 [ tile 0 ] -> [ 64KB ] <- [ 16x 4KB page entries ] ^ in gbefb_set_par()
723 [ tile n ] -> [ 64KB ] <- [ 16x 4KB page entries ] v in gbefb_set_par()
751 /* tile_ptr -> [ tile 1 ] -> FB mem */ in gbefb_set_par()
752 /* [ tile 2 ] -> FB mem */ in gbefb_set_par()
754 val = 0; in gbefb_set_par()
756 SET_GBE_FIELD(FRM_CONTROL, FRM_DMA_ENABLE, val, 0); /* do not start */ in gbefb_set_par()
757 SET_GBE_FIELD(FRM_CONTROL, FRM_LINEAR, val, 0); in gbefb_set_par()
758 gbe->frm_control = val; in gbefb_set_par()
762 partTilesX = 0; in gbefb_set_par()
765 val = 0; in gbefb_set_par()
783 gbe->frm_size_tile = val; in gbefb_set_par()
788 val = 0; in gbefb_set_par()
790 gbe->frm_size_pixel = val; in gbefb_set_par()
793 gbe->did_control = 0; in gbefb_set_par()
794 gbe->ovr_width_tile = 0; in gbefb_set_par()
797 gbe->crs_ctl = 0; in gbefb_set_par()
804 for (i = 0; i < 256; i++) in gbefb_set_par()
805 gbe->gmap[i] = (i << 24) | (i << 16) | (i << 8); in gbefb_set_par()
808 for (i = 0; i < 256; i++) in gbefb_set_par()
813 return 0; in gbefb_set_par()
819 memset(fix, 0, sizeof(struct fb_fix_screeninfo)); in gbefb_encode_fix()
820 strcpy(fix->id, "SGI GBE"); in gbefb_encode_fix()
821 fix->smem_start = (unsigned long) gbe_mem; in gbefb_encode_fix()
822 fix->smem_len = gbe_mem_size; in gbefb_encode_fix()
823 fix->type = FB_TYPE_PACKED_PIXELS; in gbefb_encode_fix()
824 fix->type_aux = 0; in gbefb_encode_fix()
825 fix->accel = FB_ACCEL_NONE; in gbefb_encode_fix()
826 switch (var->bits_per_pixel) { in gbefb_encode_fix()
828 fix->visual = FB_VISUAL_PSEUDOCOLOR; in gbefb_encode_fix()
831 fix->visual = FB_VISUAL_TRUECOLOR; in gbefb_encode_fix()
834 fix->ywrapstep = 0; in gbefb_encode_fix()
835 fix->xpanstep = 0; in gbefb_encode_fix()
836 fix->ypanstep = 0; in gbefb_encode_fix()
837 fix->line_length = var->xres_virtual * var->bits_per_pixel / 8; in gbefb_encode_fix()
838 fix->mmio_start = GBE_BASE; in gbefb_encode_fix()
839 fix->mmio_len = sizeof(struct sgi_gbe); in gbefb_encode_fix()
845 * entries in the var structure). Return != 0 for invalid regno.
860 if (info->var.bits_per_pixel <= 8) { in gbefb_setcolreg()
864 for (i = 0; i < 1000 && gbe->cm_fifo >= 63; i++) in gbefb_setcolreg()
870 gbe->cmap[regno] = gbe_cmap[regno]; in gbefb_setcolreg()
873 switch (info->var.bits_per_pixel) { in gbefb_setcolreg()
880 (red << info->var.red.offset) | in gbefb_setcolreg()
881 (green << info->var.green.offset) | in gbefb_setcolreg()
882 (blue << info->var.blue.offset); in gbefb_setcolreg()
886 (red << info->var.red.offset) | in gbefb_setcolreg()
887 (green << info->var.green.offset) | in gbefb_setcolreg()
888 (blue << info->var.blue.offset); in gbefb_setcolreg()
893 return 0; in gbefb_setcolreg()
902 struct gbe_timing_info timing; in gbefb_check_var() local
906 if (var->bits_per_pixel <= 8) in gbefb_check_var()
907 var->bits_per_pixel = 8; in gbefb_check_var()
908 else if (var->bits_per_pixel <= 16) in gbefb_check_var()
909 var->bits_per_pixel = 16; in gbefb_check_var()
910 else if (var->bits_per_pixel <= 32) in gbefb_check_var()
911 var->bits_per_pixel = 32; in gbefb_check_var()
913 return -EINVAL; in gbefb_check_var()
917 if ((var->xres * var->yres * var->bits_per_pixel) & 4095) in gbefb_check_var()
918 return -EINVAL; in gbefb_check_var()
920 var->grayscale = 0; /* No grayscale for now */ in gbefb_check_var()
922 ret = compute_gbe_timing(var, &timing); in gbefb_check_var()
923 var->pixclock = ret; in gbefb_check_var()
924 if (ret < 0) in gbefb_check_var()
925 return -EINVAL; in gbefb_check_var()
928 if (var->xres > var->xres_virtual || (!ywrap && !ypan)) in gbefb_check_var()
929 var->xres_virtual = var->xres; in gbefb_check_var()
930 if (var->yres > var->yres_virtual || (!ywrap && !ypan)) in gbefb_check_var()
931 var->yres_virtual = var->yres; in gbefb_check_var()
933 if (var->vmode & FB_VMODE_CONUPDATE) { in gbefb_check_var()
934 var->vmode |= FB_VMODE_YWRAP; in gbefb_check_var()
935 var->xoffset = info->var.xoffset; in gbefb_check_var()
936 var->yoffset = info->var.yoffset; in gbefb_check_var()
940 var->grayscale = 0; in gbefb_check_var()
943 line_length = var->xres_virtual * var->bits_per_pixel / 8; in gbefb_check_var()
944 if (line_length * var->yres_virtual > gbe_mem_size) in gbefb_check_var()
945 return -ENOMEM; /* Virtual resolution too high */ in gbefb_check_var()
947 switch (var->bits_per_pixel) { in gbefb_check_var()
949 var->red.offset = 0; in gbefb_check_var()
950 var->red.length = 8; in gbefb_check_var()
951 var->green.offset = 0; in gbefb_check_var()
952 var->green.length = 8; in gbefb_check_var()
953 var->blue.offset = 0; in gbefb_check_var()
954 var->blue.length = 8; in gbefb_check_var()
955 var->transp.offset = 0; in gbefb_check_var()
956 var->transp.length = 0; in gbefb_check_var()
959 var->red.offset = 10; in gbefb_check_var()
960 var->red.length = 5; in gbefb_check_var()
961 var->green.offset = 5; in gbefb_check_var()
962 var->green.length = 5; in gbefb_check_var()
963 var->blue.offset = 0; in gbefb_check_var()
964 var->blue.length = 5; in gbefb_check_var()
965 var->transp.offset = 0; in gbefb_check_var()
966 var->transp.length = 0; in gbefb_check_var()
969 var->red.offset = 24; in gbefb_check_var()
970 var->red.length = 8; in gbefb_check_var()
971 var->green.offset = 16; in gbefb_check_var()
972 var->green.length = 8; in gbefb_check_var()
973 var->blue.offset = 8; in gbefb_check_var()
974 var->blue.length = 8; in gbefb_check_var()
975 var->transp.offset = 0; in gbefb_check_var()
976 var->transp.length = 8; in gbefb_check_var()
979 var->red.msb_right = 0; in gbefb_check_var()
980 var->green.msb_right = 0; in gbefb_check_var()
981 var->blue.msb_right = 0; in gbefb_check_var()
982 var->transp.msb_right = 0; in gbefb_check_var()
984 var->left_margin = timing.htotal - timing.hsync_end; in gbefb_check_var()
985 var->right_margin = timing.hsync_start - timing.width; in gbefb_check_var()
986 var->upper_margin = timing.vtotal - timing.vsync_end; in gbefb_check_var()
987 var->lower_margin = timing.vsync_start - timing.height; in gbefb_check_var()
988 var->hsync_len = timing.hsync_end - timing.hsync_start; in gbefb_check_var()
989 var->vsync_len = timing.vsync_end - timing.vsync_start; in gbefb_check_var()
991 return 0; in gbefb_check_var()
997 unsigned long size = vma->vm_end - vma->vm_start; in gbefb_mmap()
998 unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; in gbefb_mmap()
1004 if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) in gbefb_mmap()
1005 return -EINVAL; in gbefb_mmap()
1007 return -EINVAL; in gbefb_mmap()
1008 if (offset > gbe_mem_size - size) in gbefb_mmap()
1009 return -EINVAL; in gbefb_mmap()
1011 /* remap using the fastest write-through mode on architecture */ in gbefb_mmap()
1014 pgprot_val(vma->vm_page_prot) = in gbefb_mmap()
1015 pgprot_fb(pgprot_val(vma->vm_page_prot)); in gbefb_mmap()
1021 addr = vma->vm_start; in gbefb_mmap()
1030 phys_size = TILE_SIZE - offset; in gbefb_mmap()
1033 phys_size, vma->vm_page_prot)) in gbefb_mmap()
1034 return -EAGAIN; in gbefb_mmap()
1036 offset = 0; in gbefb_mmap()
1037 size -= phys_size; in gbefb_mmap()
1042 return 0; in gbefb_mmap()
1091 return 0; in gbefb_setup()
1096 flat_panel_enabled = 0; in gbefb_setup()
1114 return 0; in gbefb_setup()
1119 int i, ret = 0; in gbefb_probe()
1126 info = framebuffer_alloc(sizeof(struct gbefb_par), &p_dev->dev); in gbefb_probe()
1128 return -ENOMEM; in gbefb_probe()
1132 ret = -ENODEV; in gbefb_probe()
1140 ret = -EBUSY; in gbefb_probe()
1144 gbe = (struct sgi_gbe *) devm_ioremap(&p_dev->dev, GBE_BASE, in gbefb_probe()
1148 ret = -ENXIO; in gbefb_probe()
1151 gbe_revision = gbe->ctrlstat & 15; in gbefb_probe()
1153 gbe_tiles.cpu = dmam_alloc_coherent(&p_dev->dev, in gbefb_probe()
1158 ret = -ENOMEM; in gbefb_probe()
1164 gbe_mem = devm_ioremap_wc(&p_dev->dev, gbe_mem_phys, in gbefb_probe()
1168 ret = -ENOMEM; in gbefb_probe()
1172 gbe_dma_addr = 0; in gbefb_probe()
1176 gbe_mem = dmam_alloc_attrs(&p_dev->dev, gbe_mem_size, in gbefb_probe()
1181 ret = -ENOMEM; in gbefb_probe()
1188 par = info->par; in gbefb_probe()
1189 par->wc_cookie = arch_phys_wc_add(gbe_mem_phys, gbe_mem_size); in gbefb_probe()
1192 for (i = 0; i < (gbe_mem_size >> TILE_SHIFT); i++) in gbefb_probe()
1195 info->fbops = &gbefb_ops; in gbefb_probe()
1196 info->pseudo_palette = pseudo_palette; in gbefb_probe()
1197 info->screen_base = gbe_mem; in gbefb_probe()
1198 fb_alloc_cmap(&info->cmap, 256, 0); in gbefb_probe()
1204 if (fb_find_mode(&par->var, info, mode_option, NULL, 0, in gbefb_probe()
1205 default_mode, 8) == 0) in gbefb_probe()
1206 par->var = *default_var; in gbefb_probe()
1207 info->var = par->var; in gbefb_probe()
1208 gbefb_check_var(&par->var, info); in gbefb_probe()
1209 gbefb_encode_fix(&info->fix, &info->var); in gbefb_probe()
1211 if (register_framebuffer(info) < 0) { in gbefb_probe()
1213 ret = -ENXIO; in gbefb_probe()
1219 fb_info(info, "%s rev %d @ 0x%08x using %dkB memory\n", in gbefb_probe()
1220 info->fix.id, gbe_revision, (unsigned)GBE_BASE, in gbefb_probe()
1223 return 0; in gbefb_probe()
1226 arch_phys_wc_del(par->wc_cookie); in gbefb_probe()
1238 struct gbefb_par *par = info->par; in gbefb_remove()
1242 arch_phys_wc_del(par->wc_cookie); in gbefb_remove()
1262 gbefb_device = platform_device_alloc("gbefb", 0); in gbefb_init()
1266 ret = -ENOMEM; in gbefb_init()