Lines Matching +full:hw +full:- +full:settle +full:- +full:time

2  * linux/drivers/video/atafb.c -- Atari builtin chipset frame buffer device
11 * - 03 Jan 95: Original version by Martin Schaller: The TT driver and
13 * - 09 Jan 95: Roman: I've added the hardware abstraction (hw_switch)
16 * - 07 May 95: Martin: Added colormap operations for the external driver
17 * - 21 May 95: Martin: Added support for overscan
19 * - Jul 95: Guenther Kelleter <guenther@pool.informatik.rwth-aachen.de>:
23 * - 27 Dec 95: Guenther: Implemented user definable video modes "user[0-7]"
28 * - 23 Sep 97: Juergen: added xres_virtual for cards like ProMST
29 * The external-part is legacy, therefore hardware-specific
32 * - 29 Sep 97: Juergen: added Romans suggestion for pan_display
33 * (var->xoffset was changed even if no set_screen_base avail.)
34 * - 05 Oct 97: Juergen: extfb (PACKED_PIXEL) is FB_PSEUDOCOLOR 'cause
40 * - For the Falcon it is not possible to set random video modes on
79 #define up(x, r) (((x) + (r) - 1) & ~((r)-1))
86 static int hwscroll = -1;
132 } hw; member
141 #define HHT hw.falcon.hht
142 #define HBB hw.falcon.hbb
143 #define HBE hw.falcon.hbe
144 #define HDB hw.falcon.hdb
145 #define HDE hw.falcon.hde
146 #define HSS hw.falcon.hss
147 #define VFT hw.falcon.vft
148 #define VBB hw.falcon.vbb
149 #define VBE hw.falcon.vbe
150 #define VDB hw.falcon.vdb
151 #define VDE hw.falcon.vde
152 #define VSS hw.falcon.vss
189 * not needed - atafb will never support panning/hardwarescroll with external
267 * * set the video mode according to info->var *
353 * succeeded, !=0 if un-/blanking failed due to e.g. a video mode which
408 * yres_virtual == 0 means use hw-scrolling if possible, else yres
411 0, 0, 0, 0, 0, 0, 0, 0, /* xres-grayscale */
413 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
417 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
421 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
425 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
429 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
433 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
437 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
441 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
445 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
449 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
453 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
457 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
461 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
479 "st-low", 60, 320, 200, 32000, 32, 16, 31, 14, 96, 4,
483 "st-mid", 60, 640, 200, 32000, 32, 16, 31, 14, 96, 4,
487 "st-high", 63, 640, 400, 32000, 128, 0, 40, 14, 128, 4,
491 "tt-low", 60, 320, 480, 31041, 120, 100, 8, 16, 140, 30,
495 "tt-mid", 60, 640, 480, 31041, 120, 100, 8, 16, 140, 30,
499 "tt-high", 57, 640, 960, 31041, 120, 100, 8, 16, 140, 30,
534 #define DEFMODE_TT 5 /* "tt-high" for TT */
536 #define DEFMODE_STE 2 /* "st-high" for ST/E */
562 /* ------------------- TT specific functions ---------------------- */
570 strcpy(fix->id, "Atari Builtin"); in tt_encode_fix()
571 fix->smem_start = phys_screen_base; in tt_encode_fix()
572 fix->smem_len = screen_len; in tt_encode_fix()
573 fix->type = FB_TYPE_INTERLEAVED_PLANES; in tt_encode_fix()
574 fix->type_aux = 2; in tt_encode_fix()
575 fix->visual = FB_VISUAL_PSEUDOCOLOR; in tt_encode_fix()
576 mode = par->hw.tt.mode & TT_SHIFTER_MODEMASK; in tt_encode_fix()
578 fix->type = FB_TYPE_PACKED_PIXELS; in tt_encode_fix()
579 fix->type_aux = 0; in tt_encode_fix()
581 fix->visual = FB_VISUAL_MONO01; in tt_encode_fix()
583 fix->xpanstep = 0; in tt_encode_fix()
584 fix->ypanstep = 1; in tt_encode_fix()
585 fix->ywrapstep = 0; in tt_encode_fix()
586 fix->line_length = par->next_line; in tt_encode_fix()
587 fix->accel = FB_ACCEL_ATARIBLITT; in tt_encode_fix()
593 int xres = var->xres; in tt_decode_var()
594 int yres = var->yres; in tt_decode_var()
595 int bpp = var->bits_per_pixel; in tt_decode_var()
597 int yres_virtual = var->yres_virtual; in tt_decode_var()
601 return -EINVAL; in tt_decode_var()
602 par->hw.tt.mode = TT_SHIFTER_TTHIGH; in tt_decode_var()
608 return -EINVAL; in tt_decode_var()
611 return -EINVAL; in tt_decode_var()
612 par->hw.tt.mode = TT_SHIFTER_TTLOW; in tt_decode_var()
618 return -EINVAL; in tt_decode_var()
620 par->hw.tt.mode = TT_SHIFTER_TTMID; in tt_decode_var()
625 par->hw.tt.mode = TT_SHIFTER_STLOW; in tt_decode_var()
632 return -EINVAL; in tt_decode_var()
633 par->hw.tt.mode = TT_SHIFTER_STMID; in tt_decode_var()
637 } else if (var->xres > sttt_xres || var->yres > st_yres) { in tt_decode_var()
638 return -EINVAL; in tt_decode_var()
640 par->hw.tt.mode = TT_SHIFTER_STHIGH; in tt_decode_var()
650 if (var->sync & FB_SYNC_EXT) in tt_decode_var()
651 par->hw.tt.sync = 0; in tt_decode_var()
653 par->hw.tt.sync = 1; in tt_decode_var()
656 return -EINVAL; in tt_decode_var()
658 return -EINVAL; in tt_decode_var()
659 if (var->yoffset + yres > yres_virtual && yres_virtual) in tt_decode_var()
660 return -EINVAL; in tt_decode_var()
661 par->yres_virtual = yres_virtual; in tt_decode_var()
662 par->screen_base = screen_base + var->yoffset * linelen; in tt_decode_var()
663 par->next_line = linelen; in tt_decode_var()
671 var->red.offset = 0; in tt_encode_var()
672 var->red.length = 4; in tt_encode_var()
673 var->red.msb_right = 0; in tt_encode_var()
674 var->grayscale = 0; in tt_encode_var()
676 var->pixclock = 31041; in tt_encode_var()
677 var->left_margin = 120; /* these may be incorrect */ in tt_encode_var()
678 var->right_margin = 100; in tt_encode_var()
679 var->upper_margin = 8; in tt_encode_var()
680 var->lower_margin = 16; in tt_encode_var()
681 var->hsync_len = 140; in tt_encode_var()
682 var->vsync_len = 30; in tt_encode_var()
684 var->height = -1; in tt_encode_var()
685 var->width = -1; in tt_encode_var()
687 if (par->hw.tt.sync & 1) in tt_encode_var()
688 var->sync = 0; in tt_encode_var()
690 var->sync = FB_SYNC_EXT; in tt_encode_var()
692 switch (par->hw.tt.mode & TT_SHIFTER_MODEMASK) { in tt_encode_var()
694 var->xres = sttt_xres / 2; in tt_encode_var()
695 var->xres_virtual = sttt_xres_virtual / 2; in tt_encode_var()
696 var->yres = st_yres / 2; in tt_encode_var()
697 var->bits_per_pixel = 4; in tt_encode_var()
700 var->xres = sttt_xres; in tt_encode_var()
701 var->xres_virtual = sttt_xres_virtual; in tt_encode_var()
702 var->yres = st_yres / 2; in tt_encode_var()
703 var->bits_per_pixel = 2; in tt_encode_var()
706 var->xres = sttt_xres; in tt_encode_var()
707 var->xres_virtual = sttt_xres_virtual; in tt_encode_var()
708 var->yres = st_yres; in tt_encode_var()
709 var->bits_per_pixel = 1; in tt_encode_var()
712 var->xres = sttt_xres / 2; in tt_encode_var()
713 var->xres_virtual = sttt_xres_virtual / 2; in tt_encode_var()
714 var->yres = tt_yres; in tt_encode_var()
715 var->bits_per_pixel = 8; in tt_encode_var()
718 var->xres = sttt_xres; in tt_encode_var()
719 var->xres_virtual = sttt_xres_virtual; in tt_encode_var()
720 var->yres = tt_yres; in tt_encode_var()
721 var->bits_per_pixel = 4; in tt_encode_var()
724 var->red.length = 0; in tt_encode_var()
725 var->xres = sttt_xres * 2; in tt_encode_var()
726 var->xres_virtual = sttt_xres_virtual * 2; in tt_encode_var()
727 var->yres = tt_yres * 2; in tt_encode_var()
728 var->bits_per_pixel = 1; in tt_encode_var()
731 var->blue = var->green = var->red; in tt_encode_var()
732 var->transp.offset = 0; in tt_encode_var()
733 var->transp.length = 0; in tt_encode_var()
734 var->transp.msb_right = 0; in tt_encode_var()
735 linelen = var->xres_virtual * var->bits_per_pixel / 8; in tt_encode_var()
737 var->yres_virtual = var->yres; in tt_encode_var()
739 if (par->yres_virtual) in tt_encode_var()
740 var->yres_virtual = par->yres_virtual; in tt_encode_var()
743 var->yres_virtual = screen_len / linelen; in tt_encode_var()
746 var->yres_virtual = 2 * var->yres; in tt_encode_var()
748 var->yres_virtual = var->yres + hwscroll * 16; in tt_encode_var()
750 var->xoffset = 0; in tt_encode_var()
752 var->yoffset = (par->screen_base - screen_base) / linelen; in tt_encode_var()
754 var->yoffset = 0; in tt_encode_var()
755 var->nonstd = 0; in tt_encode_var()
756 var->activate = 0; in tt_encode_var()
757 var->vmode = FB_VMODE_NONINTERLACED; in tt_encode_var()
764 par->hw.tt.mode = shifter_tt.tt_shiftmode; in tt_get_par()
765 par->hw.tt.sync = shifter_st.syncmode; in tt_get_par()
769 par->screen_base = atari_stram_to_virt(addr); in tt_get_par()
774 shifter_tt.tt_shiftmode = par->hw.tt.mode; in tt_set_par()
775 shifter_st.syncmode = par->hw.tt.sync; in tt_set_par()
777 if (current_par.screen_base != par->screen_base) in tt_set_par()
778 fbhw->set_screen_base(par->screen_base); in tt_set_par()
811 udelay(20); /* wait a while for things to settle down */ in tt_detect()
823 /* ------------------- Falcon specific functions ---------------------- */
839 int sync_mask; /* or-mask for hw.falcon.sync to set this clock */
840 int control_mask; /* ditto, for hw.falcon.vid_control */
849 /* VIDEL-prescale values [mon_type][pixel_length from VCO] */
857 static inline int hxx_prescale(struct falcon_hw *hw) in hxx_prescale() argument
859 return hw->ste_mode ? 16 in hxx_prescale()
860 : vdl_prescale[mon_type][hw->vid_mode >> 2 & 0x3]; in hxx_prescale()
866 strcpy(fix->id, "Atari Builtin"); in falcon_encode_fix()
867 fix->smem_start = phys_screen_base; in falcon_encode_fix()
868 fix->smem_len = screen_len; in falcon_encode_fix()
869 fix->type = FB_TYPE_INTERLEAVED_PLANES; in falcon_encode_fix()
870 fix->type_aux = 2; in falcon_encode_fix()
871 fix->visual = FB_VISUAL_PSEUDOCOLOR; in falcon_encode_fix()
872 fix->xpanstep = 1; in falcon_encode_fix()
873 fix->ypanstep = 1; in falcon_encode_fix()
874 fix->ywrapstep = 0; in falcon_encode_fix()
875 if (par->hw.falcon.mono) { in falcon_encode_fix()
876 fix->type = FB_TYPE_PACKED_PIXELS; in falcon_encode_fix()
877 fix->type_aux = 0; in falcon_encode_fix()
879 fix->xpanstep = 32; in falcon_encode_fix()
880 } else if (par->hw.falcon.f_shift & 0x100) { in falcon_encode_fix()
881 fix->type = FB_TYPE_PACKED_PIXELS; in falcon_encode_fix()
882 fix->type_aux = 0; in falcon_encode_fix()
884 fix->visual = FB_VISUAL_TRUECOLOR; in falcon_encode_fix()
885 fix->xpanstep = 2; in falcon_encode_fix()
887 fix->line_length = par->next_line; in falcon_encode_fix()
888 fix->accel = FB_ACCEL_ATARIBLITT; in falcon_encode_fix()
895 int bpp = var->bits_per_pixel; in falcon_decode_var()
896 int xres = var->xres; in falcon_decode_var()
897 int yres = var->yres; in falcon_decode_var()
898 int xres_virtual = var->xres_virtual; in falcon_decode_var()
899 int yres_virtual = var->yres_virtual; in falcon_decode_var()
921 and minimum frame rate -- (X+hmarg.)*(Y+vmarg.)*vfmin <= pixelclock. in falcon_decode_var()
937 return -EINVAL; in falcon_decode_var()
940 return -EINVAL; in falcon_decode_var()
944 par->hw.falcon.f_shift = 0x400; in falcon_decode_var()
945 par->hw.falcon.st_shift = 0x200; in falcon_decode_var()
948 par->hw.falcon.f_shift = 0x000; in falcon_decode_var()
949 par->hw.falcon.st_shift = 0x100; in falcon_decode_var()
952 par->hw.falcon.f_shift = 0x000; in falcon_decode_var()
953 par->hw.falcon.st_shift = 0x000; in falcon_decode_var()
956 par->hw.falcon.f_shift = 0x010; in falcon_decode_var()
959 par->hw.falcon.f_shift = 0x100; /* hicolor, no overlay */ in falcon_decode_var()
961 return -EINVAL; in falcon_decode_var()
962 par->hw.falcon.bpp = bpp; in falcon_decode_var()
968 if (bpp > myvar->bits_per_pixel || in falcon_decode_var()
969 var->xres > myvar->xres || in falcon_decode_var()
970 var->yres > myvar->yres) in falcon_decode_var()
971 return -EINVAL; in falcon_decode_var()
972 fbhw->get_par(par); /* Current par will be new par */ in falcon_decode_var()
989 par->hw.falcon.ste_mode = bpp == 2; in falcon_decode_var()
990 par->hw.falcon.mono = bpp == 1; in falcon_decode_var()
1000 if (par->hw.falcon.ste_mode) in falcon_decode_var()
1023 /* backward bug-compatibility */ in falcon_decode_var()
1024 if (var->pixclock > 1) in falcon_decode_var()
1025 var->pixclock -= 1; in falcon_decode_var()
1027 par->hw.falcon.line_width = bpp * xres / 16; in falcon_decode_var()
1028 par->hw.falcon.line_offset = bpp * (xres_virtual - xres) / 16; in falcon_decode_var()
1036 return -EINVAL; in falcon_decode_var()
1039 /* SM124-mode is special */ in falcon_decode_var()
1040 par->hw.falcon.ste_mode = 1; in falcon_decode_var()
1041 par->hw.falcon.f_shift = 0x000; in falcon_decode_var()
1042 par->hw.falcon.st_shift = 0x200; in falcon_decode_var()
1050 if (var->pixclock > f32.t * plen) in falcon_decode_var()
1051 return -EINVAL; in falcon_decode_var()
1055 if (var->pixclock == 0) { in falcon_decode_var()
1059 hsync_len = pclock->hsync / plen; in falcon_decode_var()
1064 left_margin = var->left_margin; in falcon_decode_var()
1065 right_margin = var->right_margin; in falcon_decode_var()
1066 hsync_len = var->hsync_len; in falcon_decode_var()
1067 upper_margin = var->upper_margin; in falcon_decode_var()
1068 lower_margin = var->lower_margin; in falcon_decode_var()
1069 vsync_len = var->vsync_len; in falcon_decode_var()
1070 if (var->vmode & FB_VMODE_INTERLACED) { in falcon_decode_var()
1074 } else if (var->vmode & FB_VMODE_DOUBLE) { in falcon_decode_var()
1084 if (var->pixclock == 0) { in falcon_decode_var()
1100 return -EINVAL; in falcon_decode_var()
1102 left_margin = pclock->left / plen; in falcon_decode_var()
1103 right_margin = pclock->right / plen; in falcon_decode_var()
1104 hsync_len = pclock->hsync / plen; in falcon_decode_var()
1115 if (f25.t * i >= var->pixclock && in falcon_decode_var()
1120 if (f32.t * i >= var->pixclock && in falcon_decode_var()
1125 if (fext.t && fext.t * i >= var->pixclock && in falcon_decode_var()
1132 return -EINVAL; in falcon_decode_var()
1133 plen = pcl / pclock->t; in falcon_decode_var()
1135 left_margin = var->left_margin; in falcon_decode_var()
1136 right_margin = var->right_margin; in falcon_decode_var()
1137 hsync_len = var->hsync_len; in falcon_decode_var()
1138 upper_margin = var->upper_margin; in falcon_decode_var()
1139 lower_margin = var->lower_margin; in falcon_decode_var()
1140 vsync_len = var->vsync_len; in falcon_decode_var()
1141 /* Internal unit is [single lines per (half-)frame] */ in falcon_decode_var()
1142 if (var->vmode & FB_VMODE_INTERLACED) { in falcon_decode_var()
1148 } else if (var->vmode & FB_VMODE_DOUBLE) { in falcon_decode_var()
1160 if (pclock->f / plen / 8 * bpp > 32000000L) in falcon_decode_var()
1161 return -EINVAL; in falcon_decode_var()
1171 * (which is a full frame in non-interlace mode), so we can switch in falcon_decode_var()
1172 * between interlace and non-interlace without messing around in falcon_decode_var()
1177 par->hw.falcon.vid_control = mon_type | f030_bus_width; in falcon_decode_var()
1179 par->hw.falcon.vid_control |= VCO_SHORTOFFS; /* base_offset 64 */ in falcon_decode_var()
1180 if (var->sync & FB_SYNC_HOR_HIGH_ACT) in falcon_decode_var()
1181 par->hw.falcon.vid_control |= VCO_HSYPOS; in falcon_decode_var()
1182 if (var->sync & FB_SYNC_VERT_HIGH_ACT) in falcon_decode_var()
1183 par->hw.falcon.vid_control |= VCO_VSYPOS; in falcon_decode_var()
1185 par->hw.falcon.vid_control |= pclock->control_mask; in falcon_decode_var()
1187 par->hw.falcon.sync = pclock->sync_mask | 0x2; in falcon_decode_var()
1189 par->hw.falcon.vid_mode = (2 / plen) << 2; in falcon_decode_var()
1191 par->hw.falcon.vid_mode |= VMO_DOUBLE; in falcon_decode_var()
1193 par->hw.falcon.vid_mode |= VMO_INTER; in falcon_decode_var()
1197 * unit of hxx-registers: [master clock cycles * prescale] in falcon_decode_var()
1198 * Hxx-registers are 9 bit wide in falcon_decode_var()
1203 * ((hht + 2) * 2 - hdb + hde) * prescale - hdboff + hdeoff: in falcon_decode_var()
1204 * (hht + 2 - hdb + hde) * prescale - hdboff + hdeoff in falcon_decode_var()
1209 * (hdb - hht - 2) * prescale + hdboff : in falcon_decode_var()
1217 prescale = hxx_prescale(&par->hw.falcon); in falcon_decode_var()
1218 base_off = par->hw.falcon.vid_control & VCO_SHORTOFFS ? 64 : 128; in falcon_decode_var()
1222 * calculate hd[be]-registers in falcon_decode_var()
1224 if (par->hw.falcon.f_shift & 0x100) { in falcon_decode_var()
1231 if (par->hw.falcon.ste_mode) in falcon_decode_var()
1238 /* gend1 is for hde (gend-gstart multiple of align), shifter's xres */ in falcon_decode_var()
1242 par->HHT = plen * (left_margin + xres + right_margin) / in falcon_decode_var()
1243 (2 * prescale) - 2; in falcon_decode_var()
1244 /* par->HHT = (gend2 + plen * right_margin / prescale) / 2 - 2;*/ in falcon_decode_var()
1246 par->HDB = gstart - hdb_off / prescale; in falcon_decode_var()
1247 par->HBE = gstart; in falcon_decode_var()
1248 if (par->HDB < 0) in falcon_decode_var()
1249 par->HDB += par->HHT + 2 + 0x200; in falcon_decode_var()
1250 par->HDE = gend1 - par->HHT - 2 - hde_off / prescale; in falcon_decode_var()
1251 par->HBB = gend2 - par->HHT - 2; in falcon_decode_var()
1254 if ((par->HDB & 0x200) && (par->HDB & ~0x200) - par->HDE <= 5) { in falcon_decode_var()
1259 par->HBB++; /* compensate for non matching hde and hbb */ in falcon_decode_var()
1260 par->HSS = par->HHT + 2 - plen * hsync_len / prescale; in falcon_decode_var()
1261 if (par->HSS < par->HBB) in falcon_decode_var()
1262 par->HSS = par->HBB; in falcon_decode_var()
1266 hfreq = pclock->f / ((par->HHT + 2) * prescale * 2); in falcon_decode_var()
1269 /* Too high -> enlarge margin */ in falcon_decode_var()
1275 return -EINVAL; in falcon_decode_var()
1277 /* Vxx-registers */ in falcon_decode_var()
1278 /* All Vxx must be odd in non-interlace, since frame starts in the middle in falcon_decode_var()
1281 * non-interlace, odd in interlace mode for synchronisation. in falcon_decode_var()
1282 * Vxx-registers are 11 bit wide in falcon_decode_var()
1284 par->VBE = (upper_margin * 2 + 1); /* must begin on odd halfline */ in falcon_decode_var()
1285 par->VDB = par->VBE; in falcon_decode_var()
1286 par->VDE = yres; in falcon_decode_var()
1288 par->VDE <<= 1; in falcon_decode_var()
1290 par->VDE <<= 1; /* VDE now half lines per (half-)frame */ in falcon_decode_var()
1291 par->VDE += par->VDB; in falcon_decode_var()
1292 par->VBB = par->VDE; in falcon_decode_var()
1293 par->VFT = par->VBB + (lower_margin * 2 - 1) - 1; in falcon_decode_var()
1294 par->VSS = par->VFT + 1 - (vsync_len * 2 - 1); in falcon_decode_var()
1297 par->VBB++; in falcon_decode_var()
1298 par->VSS++; in falcon_decode_var()
1299 par->VFT++; in falcon_decode_var()
1302 /* V-frequency check, hope I didn't create any loop here. */ in falcon_decode_var()
1304 vfreq = (hfreq * 2) / (par->VFT + 1); in falcon_decode_var()
1306 /* Too high -> try again with doubleline */ in falcon_decode_var()
1310 /* Too low -> try again with interlace */ in falcon_decode_var()
1314 /* Doubleline too low -> clear doubleline and enlarge margins */ in falcon_decode_var()
1318 (hfreq * 2) / (par->VFT + 1 + 4 * lines - 2 * yres) > in falcon_decode_var()
1326 /* Doubleline too high -> enlarge margins */ in falcon_decode_var()
1329 (hfreq * 2) / (par->VFT + 1 + 4 * lines) > in falcon_decode_var()
1337 /* Interlace, too high -> enlarge margins */ in falcon_decode_var()
1340 (hfreq * 2) / (par->VFT + 1 + 4 * lines) > in falcon_decode_var()
1349 return -EINVAL; in falcon_decode_var()
1354 return -EINVAL; in falcon_decode_var()
1356 return -EINVAL; in falcon_decode_var()
1357 if (var->yoffset + yres > yres_virtual && yres_virtual) in falcon_decode_var()
1358 return -EINVAL; in falcon_decode_var()
1359 par->yres_virtual = yres_virtual; in falcon_decode_var()
1360 par->screen_base = screen_base + var->yoffset * linelen; in falcon_decode_var()
1361 par->hw.falcon.xoffset = 0; in falcon_decode_var()
1363 par->next_line = linelen; in falcon_decode_var()
1375 struct falcon_hw *hw = &par->hw.falcon; in falcon_encode_var() local
1379 var->pixclock = hw->sync & 0x1 ? fext.t : in falcon_encode_var()
1380 hw->vid_control & VCO_CLOCK25 ? f25.t : f32.t; in falcon_encode_var()
1382 var->height = -1; in falcon_encode_var()
1383 var->width = -1; in falcon_encode_var()
1385 var->sync = 0; in falcon_encode_var()
1386 if (hw->vid_control & VCO_HSYPOS) in falcon_encode_var()
1387 var->sync |= FB_SYNC_HOR_HIGH_ACT; in falcon_encode_var()
1388 if (hw->vid_control & VCO_VSYPOS) in falcon_encode_var()
1389 var->sync |= FB_SYNC_VERT_HIGH_ACT; in falcon_encode_var()
1391 var->vmode = FB_VMODE_NONINTERLACED; in falcon_encode_var()
1392 if (hw->vid_mode & VMO_INTER) in falcon_encode_var()
1393 var->vmode |= FB_VMODE_INTERLACED; in falcon_encode_var()
1394 if (hw->vid_mode & VMO_DOUBLE) in falcon_encode_var()
1395 var->vmode |= FB_VMODE_DOUBLE; in falcon_encode_var()
1399 * VDE. If interlace mode off unit of VC-registers is in falcon_encode_var()
1402 var->yres = hw->vde - hw->vdb; in falcon_encode_var()
1403 if (!(var->vmode & FB_VMODE_INTERLACED)) in falcon_encode_var()
1404 var->yres >>= 1; in falcon_encode_var()
1405 if (var->vmode & FB_VMODE_DOUBLE) in falcon_encode_var()
1406 var->yres >>= 1; in falcon_encode_var()
1416 if (hw->f_shift & 0x400) /* 2 colors */ in falcon_encode_var()
1417 var->bits_per_pixel = 1; in falcon_encode_var()
1418 else if (hw->f_shift & 0x100) /* hicolor */ in falcon_encode_var()
1419 var->bits_per_pixel = 16; in falcon_encode_var()
1420 else if (hw->f_shift & 0x010) /* 8 bitplanes */ in falcon_encode_var()
1421 var->bits_per_pixel = 8; in falcon_encode_var()
1422 else if (hw->st_shift == 0) in falcon_encode_var()
1423 var->bits_per_pixel = 4; in falcon_encode_var()
1424 else if (hw->st_shift == 0x100) in falcon_encode_var()
1425 var->bits_per_pixel = 2; in falcon_encode_var()
1426 else /* if (hw->st_shift == 0x200) */ in falcon_encode_var()
1427 var->bits_per_pixel = 1; in falcon_encode_var()
1429 var->xres = hw->line_width * 16 / var->bits_per_pixel; in falcon_encode_var()
1430 var->xres_virtual = var->xres + hw->line_offset * 16 / var->bits_per_pixel; in falcon_encode_var()
1431 if (hw->xoffset) in falcon_encode_var()
1432 var->xres_virtual += 16; in falcon_encode_var()
1434 if (var->bits_per_pixel == 16) { in falcon_encode_var()
1435 var->red.offset = 11; in falcon_encode_var()
1436 var->red.length = 5; in falcon_encode_var()
1437 var->red.msb_right = 0; in falcon_encode_var()
1438 var->green.offset = 5; in falcon_encode_var()
1439 var->green.length = 6; in falcon_encode_var()
1440 var->green.msb_right = 0; in falcon_encode_var()
1441 var->blue.offset = 0; in falcon_encode_var()
1442 var->blue.length = 5; in falcon_encode_var()
1443 var->blue.msb_right = 0; in falcon_encode_var()
1445 var->red.offset = 0; in falcon_encode_var()
1446 var->red.length = hw->ste_mode ? 4 : 6; in falcon_encode_var()
1447 if (var->red.length > var->bits_per_pixel) in falcon_encode_var()
1448 var->red.length = var->bits_per_pixel; in falcon_encode_var()
1449 var->red.msb_right = 0; in falcon_encode_var()
1450 var->grayscale = 0; in falcon_encode_var()
1451 var->blue = var->green = var->red; in falcon_encode_var()
1453 var->transp.offset = 0; in falcon_encode_var()
1454 var->transp.length = 0; in falcon_encode_var()
1455 var->transp.msb_right = 0; in falcon_encode_var()
1457 linelen = var->xres_virtual * var->bits_per_pixel / 8; in falcon_encode_var()
1459 if (par->yres_virtual) in falcon_encode_var()
1460 var->yres_virtual = par->yres_virtual; in falcon_encode_var()
1463 var->yres_virtual = screen_len / linelen; in falcon_encode_var()
1466 var->yres_virtual = 2 * var->yres; in falcon_encode_var()
1468 var->yres_virtual = var->yres + hwscroll * 16; in falcon_encode_var()
1470 var->xoffset = 0; /* TODO change this */ in falcon_encode_var()
1472 /* hdX-offsets */ in falcon_encode_var()
1473 prescale = hxx_prescale(hw); in falcon_encode_var()
1474 plen = 4 >> (hw->vid_mode >> 2 & 0x3); in falcon_encode_var()
1475 base_off = hw->vid_control & VCO_SHORTOFFS ? 64 : 128; in falcon_encode_var()
1476 if (hw->f_shift & 0x100) { in falcon_encode_var()
1480 hde_off = ((128 / var->bits_per_pixel + 2) * plen); in falcon_encode_var()
1481 if (hw->ste_mode) in falcon_encode_var()
1482 hdb_off = (64 + base_off + (128 / var->bits_per_pixel + 2) * plen) in falcon_encode_var()
1485 hdb_off = (base_off + (128 / var->bits_per_pixel + 18) * plen) in falcon_encode_var()
1490 var->left_margin = hdb_off + prescale * ((hw->hdb & 0x1ff) - in falcon_encode_var()
1491 (hw->hdb & 0x200 ? 2 + hw->hht : 0)); in falcon_encode_var()
1492 if (hw->ste_mode || mon_type != F_MON_VGA) in falcon_encode_var()
1493 var->right_margin = prescale * (hw->hht + 2 - hw->hde) - hde_off; in falcon_encode_var()
1496 var->right_margin = prescale * (hw->hht + 2 - hw->hbb); in falcon_encode_var()
1497 var->hsync_len = prescale * (hw->hht + 2 - hw->hss); in falcon_encode_var()
1500 var->upper_margin = hw->vdb / 2; /* round down to full lines */ in falcon_encode_var()
1501 var->lower_margin = (hw->vft + 1 - hw->vde + 1) / 2; /* round up */ in falcon_encode_var()
1502 var->vsync_len = (hw->vft + 1 - hw->vss + 1) / 2; /* round up */ in falcon_encode_var()
1503 if (var->vmode & FB_VMODE_INTERLACED) { in falcon_encode_var()
1504 var->upper_margin *= 2; in falcon_encode_var()
1505 var->lower_margin *= 2; in falcon_encode_var()
1506 var->vsync_len *= 2; in falcon_encode_var()
1507 } else if (var->vmode & FB_VMODE_DOUBLE) { in falcon_encode_var()
1508 var->upper_margin = (var->upper_margin + 1) / 2; in falcon_encode_var()
1509 var->lower_margin = (var->lower_margin + 1) / 2; in falcon_encode_var()
1510 var->vsync_len = (var->vsync_len + 1) / 2; in falcon_encode_var()
1513 var->pixclock *= plen; in falcon_encode_var()
1514 var->left_margin /= plen; in falcon_encode_var()
1515 var->right_margin /= plen; in falcon_encode_var()
1516 var->hsync_len /= plen; in falcon_encode_var()
1518 var->right_margin -= var->hsync_len; in falcon_encode_var()
1519 var->lower_margin -= var->vsync_len; in falcon_encode_var()
1522 var->yoffset = (par->screen_base - screen_base) / linelen; in falcon_encode_var()
1524 var->yoffset = 0; in falcon_encode_var()
1525 var->nonstd = 0; /* what is this for? */ in falcon_encode_var()
1526 var->activate = 0; in falcon_encode_var()
1537 struct falcon_hw *hw = &par->hw.falcon; in falcon_get_par() local
1539 hw->line_width = shifter_f030.scn_width; in falcon_get_par()
1540 hw->line_offset = shifter_f030.off_next; in falcon_get_par()
1541 hw->st_shift = videl.st_shift & 0x300; in falcon_get_par()
1542 hw->f_shift = videl.f_shift; in falcon_get_par()
1543 hw->vid_control = videl.control; in falcon_get_par()
1544 hw->vid_mode = videl.mode; in falcon_get_par()
1545 hw->sync = shifter_st.syncmode & 0x1; in falcon_get_par()
1546 hw->xoffset = videl.xoffset & 0xf; in falcon_get_par()
1547 hw->hht = videl.hht; in falcon_get_par()
1548 hw->hbb = videl.hbb; in falcon_get_par()
1549 hw->hbe = videl.hbe; in falcon_get_par()
1550 hw->hdb = videl.hdb; in falcon_get_par()
1551 hw->hde = videl.hde; in falcon_get_par()
1552 hw->hss = videl.hss; in falcon_get_par()
1553 hw->vft = videl.vft; in falcon_get_par()
1554 hw->vbb = videl.vbb; in falcon_get_par()
1555 hw->vbe = videl.vbe; in falcon_get_par()
1556 hw->vdb = videl.vdb; in falcon_get_par()
1557 hw->vde = videl.vde; in falcon_get_par()
1558 hw->vss = videl.vss; in falcon_get_par()
1563 par->screen_base = atari_stram_to_virt(addr); in falcon_get_par()
1566 hw->ste_mode = (hw->f_shift & 0x510) == 0 && hw->st_shift == 0x100; in falcon_get_par()
1567 hw->mono = (hw->f_shift & 0x400) || in falcon_get_par()
1568 ((hw->f_shift & 0x510) == 0 && hw->st_shift == 0x200); in falcon_get_par()
1576 if (current_par.screen_base != par->screen_base) in falcon_set_par()
1577 fbhw->set_screen_base(par->screen_base); in falcon_set_par()
1583 /* Tell vbl-handler to change video mode. in falcon_set_par()
1589 f_new_mode = par->hw.falcon; in falcon_set_par()
1595 struct falcon_hw *hw = &f_new_mode; in falcon_vbl_switcher() local
1600 if (hw->sync & 0x1) { in falcon_vbl_switcher()
1607 shifter_st.syncmode = hw->sync; in falcon_vbl_switcher()
1609 videl.hht = hw->hht; in falcon_vbl_switcher()
1610 videl.hbb = hw->hbb; in falcon_vbl_switcher()
1611 videl.hbe = hw->hbe; in falcon_vbl_switcher()
1612 videl.hdb = hw->hdb; in falcon_vbl_switcher()
1613 videl.hde = hw->hde; in falcon_vbl_switcher()
1614 videl.hss = hw->hss; in falcon_vbl_switcher()
1615 videl.vft = hw->vft; in falcon_vbl_switcher()
1616 videl.vbb = hw->vbb; in falcon_vbl_switcher()
1617 videl.vbe = hw->vbe; in falcon_vbl_switcher()
1618 videl.vdb = hw->vdb; in falcon_vbl_switcher()
1619 videl.vde = hw->vde; in falcon_vbl_switcher()
1620 videl.vss = hw->vss; in falcon_vbl_switcher()
1623 if (hw->ste_mode) { in falcon_vbl_switcher()
1624 videl.st_shift = hw->st_shift; /* write enables STE palette */ in falcon_vbl_switcher()
1627 * set st_shift 0, so we can tell the screen-depth if f_shift == 0. in falcon_vbl_switcher()
1634 videl.f_shift = hw->f_shift; in falcon_vbl_switcher()
1637 videl.xoffset = hw->xoffset; in falcon_vbl_switcher()
1638 shifter_f030.scn_width = hw->line_width; in falcon_vbl_switcher()
1639 shifter_f030.off_next = hw->line_offset; in falcon_vbl_switcher()
1640 videl.control = hw->vid_control; in falcon_vbl_switcher()
1641 videl.mode = hw->vid_mode; in falcon_vbl_switcher()
1645 videl.xoffset = current_par.hw.falcon.xoffset; in falcon_vbl_switcher()
1646 shifter_f030.off_next = current_par.hw.falcon.line_offset; in falcon_vbl_switcher()
1654 struct atafb_par *par = (struct atafb_par *)info->par; in falcon_pan_display()
1657 int bpp = info->var.bits_per_pixel; in falcon_pan_display()
1660 var->xoffset = up(var->xoffset, 32); in falcon_pan_display()
1662 par->hw.falcon.xoffset = var->xoffset & 15; in falcon_pan_display()
1664 par->hw.falcon.xoffset = 0; in falcon_pan_display()
1665 var->xoffset = up(var->xoffset, 2); in falcon_pan_display()
1667 par->hw.falcon.line_offset = bpp * in falcon_pan_display()
1668 (info->var.xres_virtual - info->var.xres) / 16; in falcon_pan_display()
1669 if (par->hw.falcon.xoffset) in falcon_pan_display()
1670 par->hw.falcon.line_offset -= bpp; in falcon_pan_display()
1671 xoffset = var->xoffset - par->hw.falcon.xoffset; in falcon_pan_display()
1673 par->screen_base = screen_base + in falcon_pan_display()
1674 (var->yoffset * info->var.xres_virtual + xoffset) * bpp / 8; in falcon_pan_display()
1675 if (fbhw->set_screen_base) in falcon_pan_display()
1676 fbhw->set_screen_base(par->screen_base); in falcon_pan_display()
1678 return -EINVAL; /* shouldn't happen */ in falcon_pan_display()
1697 ((u32 *)info->pseudo_palette)[regno] = ((red & 0xf800) | in falcon_setcolreg()
1768 /* initialize hsync-len */ in falcon_detect()
1783 /* ------------------- ST(E) specific functions ---------------------- */
1792 strcpy(fix->id, "Atari Builtin"); in stste_encode_fix()
1793 fix->smem_start = phys_screen_base; in stste_encode_fix()
1794 fix->smem_len = screen_len; in stste_encode_fix()
1795 fix->type = FB_TYPE_INTERLEAVED_PLANES; in stste_encode_fix()
1796 fix->type_aux = 2; in stste_encode_fix()
1797 fix->visual = FB_VISUAL_PSEUDOCOLOR; in stste_encode_fix()
1798 mode = par->hw.st.mode & 3; in stste_encode_fix()
1800 fix->type = FB_TYPE_PACKED_PIXELS; in stste_encode_fix()
1801 fix->type_aux = 0; in stste_encode_fix()
1802 fix->visual = FB_VISUAL_MONO10; in stste_encode_fix()
1805 fix->xpanstep = 16; in stste_encode_fix()
1806 fix->ypanstep = 1; in stste_encode_fix()
1808 fix->xpanstep = 0; in stste_encode_fix()
1809 fix->ypanstep = 0; in stste_encode_fix()
1811 fix->ywrapstep = 0; in stste_encode_fix()
1812 fix->line_length = par->next_line; in stste_encode_fix()
1813 fix->accel = FB_ACCEL_ATARIBLITT; in stste_encode_fix()
1820 int xres = var->xres; in stste_decode_var()
1821 int yres = var->yres; in stste_decode_var()
1822 int bpp = var->bits_per_pixel; in stste_decode_var()
1824 int yres_virtual = var->yres_virtual; in stste_decode_var()
1828 return -EINVAL; in stste_decode_var()
1829 par->hw.st.mode = ST_HIGH; in stste_decode_var()
1835 return -EINVAL; in stste_decode_var()
1838 return -EINVAL; in stste_decode_var()
1839 par->hw.st.mode = ST_LOW; in stste_decode_var()
1845 return -EINVAL; in stste_decode_var()
1846 par->hw.st.mode = ST_MID; in stste_decode_var()
1851 return -EINVAL; in stste_decode_var()
1857 if (var->sync & FB_SYNC_EXT) in stste_decode_var()
1858 par->hw.st.sync = (par->hw.st.sync & ~1) | 1; in stste_decode_var()
1860 par->hw.st.sync = (par->hw.st.sync & ~1); in stste_decode_var()
1863 return -EINVAL; in stste_decode_var()
1865 return -EINVAL; in stste_decode_var()
1866 if (var->yoffset + yres > yres_virtual && yres_virtual) in stste_decode_var()
1867 return -EINVAL; in stste_decode_var()
1868 par->yres_virtual = yres_virtual; in stste_decode_var()
1869 par->screen_base = screen_base + var->yoffset * linelen; in stste_decode_var()
1870 par->next_line = linelen; in stste_decode_var()
1879 var->red.offset = 0; in stste_encode_var()
1880 var->red.length = ATARIHW_PRESENT(EXTD_SHIFTER) ? 4 : 3; in stste_encode_var()
1881 var->red.msb_right = 0; in stste_encode_var()
1882 var->grayscale = 0; in stste_encode_var()
1884 var->pixclock = 31041; in stste_encode_var()
1885 var->left_margin = 120; /* these are incorrect */ in stste_encode_var()
1886 var->right_margin = 100; in stste_encode_var()
1887 var->upper_margin = 8; in stste_encode_var()
1888 var->lower_margin = 16; in stste_encode_var()
1889 var->hsync_len = 140; in stste_encode_var()
1890 var->vsync_len = 30; in stste_encode_var()
1892 var->height = -1; in stste_encode_var()
1893 var->width = -1; in stste_encode_var()
1895 if (!(par->hw.st.sync & 1)) in stste_encode_var()
1896 var->sync = 0; in stste_encode_var()
1898 var->sync = FB_SYNC_EXT; in stste_encode_var()
1900 switch (par->hw.st.mode & 3) { in stste_encode_var()
1902 var->xres = sttt_xres / 2; in stste_encode_var()
1903 var->yres = st_yres / 2; in stste_encode_var()
1904 var->bits_per_pixel = 4; in stste_encode_var()
1907 var->xres = sttt_xres; in stste_encode_var()
1908 var->yres = st_yres / 2; in stste_encode_var()
1909 var->bits_per_pixel = 2; in stste_encode_var()
1912 var->xres = sttt_xres; in stste_encode_var()
1913 var->yres = st_yres; in stste_encode_var()
1914 var->bits_per_pixel = 1; in stste_encode_var()
1917 var->blue = var->green = var->red; in stste_encode_var()
1918 var->transp.offset = 0; in stste_encode_var()
1919 var->transp.length = 0; in stste_encode_var()
1920 var->transp.msb_right = 0; in stste_encode_var()
1921 var->xres_virtual = sttt_xres_virtual; in stste_encode_var()
1922 linelen = var->xres_virtual * var->bits_per_pixel / 8; in stste_encode_var()
1923 ovsc_addlen = linelen * (sttt_yres_virtual - st_yres); in stste_encode_var()
1926 var->yres_virtual = var->yres; in stste_encode_var()
1928 if (par->yres_virtual) in stste_encode_var()
1929 var->yres_virtual = par->yres_virtual; in stste_encode_var()
1932 var->yres_virtual = screen_len / linelen; in stste_encode_var()
1935 var->yres_virtual = 2 * var->yres; in stste_encode_var()
1937 var->yres_virtual = var->yres + hwscroll * 16; in stste_encode_var()
1939 var->xoffset = 0; in stste_encode_var()
1941 var->yoffset = (par->screen_base - screen_base) / linelen; in stste_encode_var()
1943 var->yoffset = 0; in stste_encode_var()
1944 var->nonstd = 0; in stste_encode_var()
1945 var->activate = 0; in stste_encode_var()
1946 var->vmode = FB_VMODE_NONINTERLACED; in stste_encode_var()
1953 par->hw.st.mode = shifter_tt.st_shiftmode; in stste_get_par()
1954 par->hw.st.sync = shifter_st.syncmode; in stste_get_par()
1959 par->screen_base = atari_stram_to_virt(addr); in stste_get_par()
1964 shifter_tt.st_shiftmode = par->hw.st.mode; in stste_set_par()
1965 shifter_st.syncmode = par->hw.st.sync; in stste_set_par()
1967 if (current_par.screen_base != par->screen_base) in stste_set_par()
1968 fbhw->set_screen_base(par->screen_base); in stste_set_par()
2003 udelay(20); /* wait a while for things to settle down */ in stste_detect()
2033 * vertical blank interrupt is no longer in time on machines with
2085 /* ------------------- External Video ---------------------- */
2091 strcpy(fix->id, "Unknown Extern"); in ext_encode_fix()
2092 fix->smem_start = external_addr; in ext_encode_fix()
2093 fix->smem_len = PAGE_ALIGN(external_len); in ext_encode_fix()
2095 fix->type = FB_TYPE_PACKED_PIXELS; in ext_encode_fix()
2098 fix->visual = in ext_encode_fix()
2108 case -1: /* truecolor */ in ext_encode_fix()
2109 fix->type = FB_TYPE_PACKED_PIXELS; in ext_encode_fix()
2110 fix->visual = FB_VISUAL_TRUECOLOR; in ext_encode_fix()
2113 fix->type = FB_TYPE_PACKED_PIXELS; in ext_encode_fix()
2114 fix->visual = visual; in ext_encode_fix()
2117 fix->type = FB_TYPE_PLANES; in ext_encode_fix()
2118 fix->visual = visual; in ext_encode_fix()
2121 fix->type = FB_TYPE_INTERLEAVED_PLANES; in ext_encode_fix()
2122 fix->type_aux = 2; in ext_encode_fix()
2123 fix->visual = visual; in ext_encode_fix()
2127 fix->xpanstep = 0; in ext_encode_fix()
2128 fix->ypanstep = 0; in ext_encode_fix()
2129 fix->ywrapstep = 0; in ext_encode_fix()
2130 fix->line_length = par->next_line; in ext_encode_fix()
2138 if (var->bits_per_pixel > myvar->bits_per_pixel || in ext_decode_var()
2139 var->xres > myvar->xres || in ext_decode_var()
2140 var->xres_virtual > myvar->xres_virtual || in ext_decode_var()
2141 var->yres > myvar->yres || in ext_decode_var()
2142 var->xoffset > 0 || in ext_decode_var()
2143 var->yoffset > 0) in ext_decode_var()
2144 return -EINVAL; in ext_decode_var()
2146 par->next_line = external_xres_virtual * external_depth / 8; in ext_decode_var()
2153 var->red.offset = 0; in ext_encode_var()
2154 var->red.length = (external_pmode == -1) ? external_depth / 3 : in ext_encode_var()
2156 var->red.msb_right = 0; in ext_encode_var()
2157 var->grayscale = 0; in ext_encode_var()
2159 var->pixclock = 31041; in ext_encode_var()
2160 var->left_margin = 120; /* these are surely incorrect */ in ext_encode_var()
2161 var->right_margin = 100; in ext_encode_var()
2162 var->upper_margin = 8; in ext_encode_var()
2163 var->lower_margin = 16; in ext_encode_var()
2164 var->hsync_len = 140; in ext_encode_var()
2165 var->vsync_len = 30; in ext_encode_var()
2167 var->height = -1; in ext_encode_var()
2168 var->width = -1; in ext_encode_var()
2170 var->sync = 0; in ext_encode_var()
2172 var->xres = external_xres; in ext_encode_var()
2173 var->yres = external_yres; in ext_encode_var()
2174 var->xres_virtual = external_xres_virtual; in ext_encode_var()
2175 var->bits_per_pixel = external_depth; in ext_encode_var()
2177 var->blue = var->green = var->red; in ext_encode_var()
2178 var->transp.offset = 0; in ext_encode_var()
2179 var->transp.length = 0; in ext_encode_var()
2180 var->transp.msb_right = 0; in ext_encode_var()
2181 var->yres_virtual = var->yres; in ext_encode_var()
2182 var->xoffset = 0; in ext_encode_var()
2183 var->yoffset = 0; in ext_encode_var()
2184 var->nonstd = 0; in ext_encode_var()
2185 var->activate = 0; in ext_encode_var()
2186 var->vmode = FB_VMODE_NONINTERLACED; in ext_encode_var()
2192 par->screen_base = external_screen_base; in ext_get_par()
2213 unsigned char colmask = (1 << external_bitspercol) - 1; in ext_setcolreg()
2249 myvar->xres = external_xres; in ext_detect()
2250 myvar->xres_virtual = external_xres_virtual; in ext_detect()
2251 myvar->yres = external_yres; in ext_detect()
2252 myvar->bits_per_pixel = external_depth; in ext_detect()
2259 /* ------ This is the same for most hardware types -------- */
2274 struct atafb_par *par = (struct atafb_par *)info->par; in pan_display()
2276 if (!fbhw->set_screen_base || in pan_display()
2277 (!ATARIHW_PRESENT(EXTD_SHIFTER) && var->xoffset)) in pan_display()
2278 return -EINVAL; in pan_display()
2279 var->xoffset = up(var->xoffset, 16); in pan_display()
2280 par->screen_base = screen_base + in pan_display()
2281 (var->yoffset * info->var.xres_virtual + var->xoffset) in pan_display()
2282 * info->var.bits_per_pixel / 8; in pan_display()
2283 fbhw->set_screen_base(par->screen_base); in pan_display()
2287 /* ------------ Interfaces to hardware functions ------------ */
2345 fbhw->get_par(par); in ata_get_par()
2350 fbhw->set_par(par); in ata_set_par()
2367 err = fbhw->decode_var(var, &par); in do_fb_set_var()
2370 activate = var->activate; in do_fb_set_var()
2371 if (((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) && isactive) in do_fb_set_var()
2373 fbhw->encode_var(var, &par); in do_fb_set_var()
2374 var->activate = activate; in do_fb_set_var()
2378 /* fbhw->encode_fix() must be called with fb_info->mm_lock held
2379 * if it is called after the register_framebuffer() - not a case here
2385 // Get fix directly (case con == -1 before)?? in atafb_get_fix()
2386 err = fbhw->decode_var(&info->var, &par); in atafb_get_fix()
2390 err = fbhw->encode_fix(fix, &par); in atafb_get_fix()
2399 fbhw->encode_var(var, &par); in atafb_get_var()
2409 atafb_get_var(&info->var, info); in atafb_set_disp()
2410 atafb_get_fix(&info->fix, info); in atafb_set_disp()
2413 info->screen_base = (external_addr ? external_screen_base : in atafb_set_disp()
2414 atari_stram_to_virt(info->fix.smem_start)); in atafb_set_disp()
2424 return info->fbops->fb_setcolreg(regno, red, green, blue, transp, info); in atafb_setcolreg()
2430 int xoffset = var->xoffset; in atafb_pan_display()
2431 int yoffset = var->yoffset; in atafb_pan_display()
2434 if (var->vmode & FB_VMODE_YWRAP) { in atafb_pan_display()
2435 if (yoffset < 0 || yoffset >= info->var.yres_virtual || xoffset) in atafb_pan_display()
2436 return -EINVAL; in atafb_pan_display()
2438 if (xoffset + info->var.xres > info->var.xres_virtual || in atafb_pan_display()
2439 yoffset + info->var.yres > info->var.yres_virtual) in atafb_pan_display()
2440 return -EINVAL; in atafb_pan_display()
2443 if (fbhw->pan_display) { in atafb_pan_display()
2444 err = fbhw->pan_display(var, info); in atafb_pan_display()
2448 return -EINVAL; in atafb_pan_display()
2450 info->var.xoffset = xoffset; in atafb_pan_display()
2451 info->var.yoffset = yoffset; in atafb_pan_display()
2453 if (var->vmode & FB_VMODE_YWRAP) in atafb_pan_display()
2454 info->var.vmode |= FB_VMODE_YWRAP; in atafb_pan_display()
2456 info->var.vmode &= ~FB_VMODE_YWRAP; in atafb_pan_display()
2478 struct atafb_par *par = (struct atafb_par *)info->par; in atafb_fillrect()
2482 if (!rect->width || !rect->height) in atafb_fillrect()
2486 if (info->var.bits_per_pixel == 16) { in atafb_fillrect()
2496 x2 = rect->dx + rect->width; in atafb_fillrect()
2497 y2 = rect->dy + rect->height; in atafb_fillrect()
2498 x2 = x2 < info->var.xres_virtual ? x2 : info->var.xres_virtual; in atafb_fillrect()
2499 y2 = y2 < info->var.yres_virtual ? y2 : info->var.yres_virtual; in atafb_fillrect()
2500 width = x2 - rect->dx; in atafb_fillrect()
2501 height = y2 - rect->dy; in atafb_fillrect()
2503 if (info->var.bits_per_pixel == 1) in atafb_fillrect()
2504 atafb_mfb_fillrect(info, par->next_line, rect->color, in atafb_fillrect()
2505 rect->dy, rect->dx, height, width); in atafb_fillrect()
2506 else if (info->var.bits_per_pixel == 2) in atafb_fillrect()
2507 atafb_iplan2p2_fillrect(info, par->next_line, rect->color, in atafb_fillrect()
2508 rect->dy, rect->dx, height, width); in atafb_fillrect()
2509 else if (info->var.bits_per_pixel == 4) in atafb_fillrect()
2510 atafb_iplan2p4_fillrect(info, par->next_line, rect->color, in atafb_fillrect()
2511 rect->dy, rect->dx, height, width); in atafb_fillrect()
2513 atafb_iplan2p8_fillrect(info, par->next_line, rect->color, in atafb_fillrect()
2514 rect->dy, rect->dx, height, width); in atafb_fillrect()
2521 struct atafb_par *par = (struct atafb_par *)info->par; in atafb_copyarea()
2527 if (info->var.bits_per_pixel == 16) { in atafb_copyarea()
2534 x2 = area->dx + area->width; in atafb_copyarea()
2535 y2 = area->dy + area->height; in atafb_copyarea()
2536 dx = area->dx > 0 ? area->dx : 0; in atafb_copyarea()
2537 dy = area->dy > 0 ? area->dy : 0; in atafb_copyarea()
2538 x2 = x2 < info->var.xres_virtual ? x2 : info->var.xres_virtual; in atafb_copyarea()
2539 y2 = y2 < info->var.yres_virtual ? y2 : info->var.yres_virtual; in atafb_copyarea()
2540 width = x2 - dx; in atafb_copyarea()
2541 height = y2 - dy; in atafb_copyarea()
2543 if (area->sx + dx < area->dx || area->sy + dy < area->dy) in atafb_copyarea()
2547 sx = area->sx + (dx - area->dx); in atafb_copyarea()
2548 sy = area->sy + (dy - area->dy); in atafb_copyarea()
2551 if (sx + width > info->var.xres_virtual || in atafb_copyarea()
2552 sy + height > info->var.yres_virtual) in atafb_copyarea()
2561 if (info->var.bits_per_pixel == 1) in atafb_copyarea()
2562 atafb_mfb_copyarea(info, par->next_line, sy, sx, dy, dx, height, width); in atafb_copyarea()
2563 else if (info->var.bits_per_pixel == 2) in atafb_copyarea()
2564 atafb_iplan2p2_copyarea(info, par->next_line, sy, sx, dy, dx, height, width); in atafb_copyarea()
2565 else if (info->var.bits_per_pixel == 4) in atafb_copyarea()
2566 atafb_iplan2p4_copyarea(info, par->next_line, sy, sx, dy, dx, height, width); in atafb_copyarea()
2568 atafb_iplan2p8_copyarea(info, par->next_line, sy, sx, dy, dx, height, width); in atafb_copyarea()
2575 struct atafb_par *par = (struct atafb_par *)info->par; in atafb_imageblit()
2583 if (info->var.bits_per_pixel == 16) { in atafb_imageblit()
2594 x2 = image->dx + image->width; in atafb_imageblit()
2595 y2 = image->dy + image->height; in atafb_imageblit()
2596 dx = image->dx; in atafb_imageblit()
2597 dy = image->dy; in atafb_imageblit()
2598 x2 = x2 < info->var.xres_virtual ? x2 : info->var.xres_virtual; in atafb_imageblit()
2599 y2 = y2 < info->var.yres_virtual ? y2 : info->var.yres_virtual; in atafb_imageblit()
2600 width = x2 - dx; in atafb_imageblit()
2601 height = y2 - dy; in atafb_imageblit()
2603 if (image->depth == 1) { in atafb_imageblit()
2606 ((unsigned long)info->screen_base & ~(BYTES_PER_LONG - 1)); in atafb_imageblit()
2607 dst_idx = ((unsigned long)info->screen_base & (BYTES_PER_LONG - 1)) * 8; in atafb_imageblit()
2608 dst_idx += dy * par->next_line * 8 + dx; in atafb_imageblit()
2609 src = image->data; in atafb_imageblit()
2610 pitch = (image->width + 7) / 8; in atafb_imageblit()
2611 while (height--) { in atafb_imageblit()
2613 if (info->var.bits_per_pixel == 1) in atafb_imageblit()
2614 atafb_mfb_linefill(info, par->next_line, in atafb_imageblit()
2616 image->bg_color, image->fg_color); in atafb_imageblit()
2617 else if (info->var.bits_per_pixel == 2) in atafb_imageblit()
2618 atafb_iplan2p2_linefill(info, par->next_line, in atafb_imageblit()
2620 image->bg_color, image->fg_color); in atafb_imageblit()
2621 else if (info->var.bits_per_pixel == 4) in atafb_imageblit()
2622 atafb_iplan2p4_linefill(info, par->next_line, in atafb_imageblit()
2624 image->bg_color, image->fg_color); in atafb_imageblit()
2626 atafb_iplan2p8_linefill(info, par->next_line, in atafb_imageblit()
2628 image->bg_color, image->fg_color); in atafb_imageblit()
2633 c2p_iplan2(info->screen_base, image->data, dx, dy, width, in atafb_imageblit()
2634 height, par->next_line, image->width, in atafb_imageblit()
2635 info->var.bits_per_pixel); in atafb_imageblit()
2647 return -EFAULT; in atafb_ioctl()
2654 return -EFAULT; in atafb_ioctl()
2659 return -EINVAL; in atafb_ioctl()
2673 if (fbhw->blank && !fbhw->blank(blank)) in atafb_blank()
2696 /* check var by decoding var into hw par, rounding if necessary,
2697 * then encoding hw par back into new, validated var */
2705 err = fbhw->decode_var(var, &par); in atafb_check_var()
2710 fbhw->encode_var(var, &par); in atafb_check_var()
2714 /* actually set hw par by decoding var, then setting hardware from
2715 * hw par just decoded */
2718 struct atafb_par *par = (struct atafb_par *)info->par; in atafb_set_par()
2721 fbhw->decode_var(&info->var, par); in atafb_set_par()
2722 mutex_lock(&info->mm_lock); in atafb_set_par()
2723 fbhw->encode_fix(&info->fix, par); in atafb_set_par()
2724 mutex_unlock(&info->mm_lock); in atafb_set_par()
2755 var = atafb_predefined[default_par - 1]; in check_default_par()
2762 var = atafb_predefined[detected_mode - 1]; /* autodetect */ in check_default_par()
2775 var = atafb_predefined[default_par - 1]; in check_default_par()
2795 * [;<screen mem length>[;<vgaiobase>[;<bits-per-col>[;<colorreg-type> in atafb_setup_ext()
2796 * [;<xres-virtual>]]]]] in atafb_setup_ext()
2799 * <xres_virtual>: hardware's x-resolution (f.e. ProMST) in atafb_setup_ext()
2801 * Even xres_virtual is available, we neither support panning nor hw-scrolling! in atafb_setup_ext()
2835 planes = -1; /* true color */ in atafb_setup_ext()
2909 * <xres>: x-resolution in atafb_setup_int()
2910 * <yres>: y-resolution in atafb_setup_int()
2999 atafb_predefined[default_par - 1].xres = xres; in atafb_setup_user()
3000 atafb_predefined[default_par - 1].yres = yres; in atafb_setup_user()
3001 atafb_predefined[default_par - 1].bits_per_pixel = depth; in atafb_setup_user()
3040 /* external pixelclock in kHz --> ps */ in atafb_setup()
3062 return -ENODEV; in atafb_probe()
3064 dev_dbg(&pdev->dev, "%s: start\n", __func__); in atafb_probe()
3069 dev_dbg(&pdev->dev, "initializing external hw\n"); in atafb_probe()
3078 dev_dbg(&pdev->dev, "initializing TT hw\n"); in atafb_probe()
3087 dev_dbg(&pdev->dev, "initializing Falcon hw\n"); in atafb_probe()
3102 dev_dbg(&pdev->dev, "initializing ST/E hw\n"); in atafb_probe()
3110 dev_warn(&pdev->dev, in atafb_probe()
3114 /* Nobody will ever see this message :-) */ in atafb_probe()
3120 /* Atari-TOS defaults if no boot option present */ in atafb_probe()
3128 detected_mode = fbhw->detect(); in atafb_probe()
3139 pad = -(unsigned long)screen_base & (PAGE_SIZE - 1); in atafb_probe()
3142 screen_len = (mem_req - pad - ovsc_offset) & PAGE_MASK; in atafb_probe()
3146 * write-through also for internal video hardware! */ in atafb_probe()
3151 dev_info(&pdev->dev, "phys_screen_base %lx screen_len %d\n", in atafb_probe()
3169 // strcpy(fb_info.mode->name, "Atari Builtin "); in atafb_probe()
3172 do_fb_set_var(&atafb_predefined[default_par - 1], 1); in atafb_probe()
3173 // reads hw state into current par, which may not be sane yet in atafb_probe()
3176 // tries to read from HW which may not be initialized yet in atafb_probe()
3181 fb_info.pseudo_palette = current_par.hw.falcon.pseudo_palette; in atafb_probe()
3188 return -EINVAL; in atafb_probe()
3199 dev_info(&pdev->dev, "Determined %dx%d, depth %d\n", fb_info.var.xres, in atafb_probe()
3203 dev_info(&pdev->dev, " virtual %dx%d\n", in atafb_probe()
3217 return -EINVAL; in atafb_probe()
3230 if (fbhw->blank) in atafb_shutdown()
3231 fbhw->blank(0); in atafb_shutdown()
3246 return -ENODEV; in atafb_init()
3248 pdev = platform_device_register_simple("atafb", -1, NULL, 0); in atafb_init()