Lines Matching +full:enforce +full:- +full:video +full:- +full:mode
2 * drivers/video/imsttfb.c -- frame buffer device for IMS TwinTurbo
40 #define eieio() /* Enforce In-order Execution of I/O */
172 TVPPMASK = 0x08, /* 2 Pixel Read-Mask */
182 TVPCXPOL = 0x30, /* 12 Cursor-Position X LSB */
183 TVPCXPOH = 0x34, /* 13 Cursor-Position X MSB */
184 TVPCYPOL = 0x38, /* 14 Cursor-Position Y LSB */
185 TVPCYPOH = 0x3c, /* 15 Cursor-Position Y MSB */
204 TVPIRCKL = 0x30, /* Color-Key Overlay Low */
205 TVPIRCKH = 0x31, /* Color-Key Overlay High */
206 TVPIRCRL = 0x32, /* Color-Key Red Low */
207 TVPIRCRH = 0x33, /* Color-Key Red High */
208 TVPIRCGL = 0x34, /* Color-Key Green Low */
209 TVPIRCGH = 0x35, /* Color-Key Green High */
210 TVPIRCBL = 0x36, /* Color-Key Blue Low */
211 TVPIRCBH = 0x37, /* Color-Key Blue High */
212 TVPIRCKC = 0x38, /* Color-Key Control (0x00) */
215 TVPIRTMD = 0x3b, /* Test Mode Data */
237 * Note that colors in X are correct only if all video data is
337 static signed char init_vmode = -1, init_cmode = -1;
428 clk_m = par->init.pclk_m; in getclkMHz()
429 clk_n = par->init.pclk_n; in getclkMHz()
430 clk_p = par->init.pclk_p; in getclkMHz()
462 par->init.pclk_m = clk_m; in setclkMHz()
463 par->init.pclk_n = clk_n; in setclkMHz()
464 par->init.pclk_p = 0; in setclkMHz()
470 struct imstt_regvals *init = &par->init; in compute_imstt_regvals_ibm()
504 init->hes = hes; in compute_imstt_regvals_ibm()
505 init->heb = heb; in compute_imstt_regvals_ibm()
506 init->hsb = init->heb + (xres >> 3); in compute_imstt_regvals_ibm()
507 init->ht = init->hsb + htp; in compute_imstt_regvals_ibm()
508 init->ves = 0x0003; in compute_imstt_regvals_ibm()
509 init->veb = veb; in compute_imstt_regvals_ibm()
510 init->vsb = init->veb + yres; in compute_imstt_regvals_ibm()
511 init->vt = init->vsb + vtp; in compute_imstt_regvals_ibm()
512 init->vil = init->vsb; in compute_imstt_regvals_ibm()
514 init->pitch = xres; in compute_imstt_regvals_ibm()
548 par->init = *init; in compute_imstt_regvals_tvp()
555 if (par->ramdac == IBM) in compute_imstt_regvals()
564 struct imstt_regvals *init = &par->init; in set_imstt_regvals_ibm()
567 par->cmap_regs[PIDXHI] = 0; eieio(); in set_imstt_regvals_ibm()
568 par->cmap_regs[PIDXLO] = PIXM0; eieio(); in set_imstt_regvals_ibm()
569 par->cmap_regs[PIDXDATA] = init->pclk_m;eieio(); in set_imstt_regvals_ibm()
570 par->cmap_regs[PIDXLO] = PIXN0; eieio(); in set_imstt_regvals_ibm()
571 par->cmap_regs[PIDXDATA] = init->pclk_n;eieio(); in set_imstt_regvals_ibm()
572 par->cmap_regs[PIDXLO] = PIXP0; eieio(); in set_imstt_regvals_ibm()
573 par->cmap_regs[PIDXDATA] = init->pclk_p;eieio(); in set_imstt_regvals_ibm()
574 par->cmap_regs[PIDXLO] = PIXC0; eieio(); in set_imstt_regvals_ibm()
575 par->cmap_regs[PIDXDATA] = 0x02; eieio(); in set_imstt_regvals_ibm()
577 par->cmap_regs[PIDXLO] = PIXFMT; eieio(); in set_imstt_regvals_ibm()
578 par->cmap_regs[PIDXDATA] = pformat; eieio(); in set_imstt_regvals_ibm()
584 struct imstt_regvals *init = &par->init; in set_imstt_regvals_tvp()
594 mlc = init->mlc[0]; in set_imstt_regvals_tvp()
595 lckl_p = init->lckl_p[0]; in set_imstt_regvals_tvp()
601 mlc = init->mlc[1]; in set_imstt_regvals_tvp()
602 lckl_p = init->lckl_p[1]; in set_imstt_regvals_tvp()
608 mlc = init->mlc[2]; in set_imstt_regvals_tvp()
609 lckl_p = init->lckl_p[2]; in set_imstt_regvals_tvp()
615 mlc = init->mlc[2]; in set_imstt_regvals_tvp()
616 lckl_p = init->lckl_p[2]; in set_imstt_regvals_tvp()
621 par->cmap_regs[TVPADDRW] = TVPIRPLA; eieio(); in set_imstt_regvals_tvp()
622 par->cmap_regs[TVPIDATA] = 0x00; eieio(); in set_imstt_regvals_tvp()
623 par->cmap_regs[TVPADDRW] = TVPIRPPD; eieio(); in set_imstt_regvals_tvp()
624 par->cmap_regs[TVPIDATA] = init->pclk_m; eieio(); in set_imstt_regvals_tvp()
625 par->cmap_regs[TVPADDRW] = TVPIRPPD; eieio(); in set_imstt_regvals_tvp()
626 par->cmap_regs[TVPIDATA] = init->pclk_n; eieio(); in set_imstt_regvals_tvp()
627 par->cmap_regs[TVPADDRW] = TVPIRPPD; eieio(); in set_imstt_regvals_tvp()
628 par->cmap_regs[TVPIDATA] = init->pclk_p; eieio(); in set_imstt_regvals_tvp()
630 par->cmap_regs[TVPADDRW] = TVPIRTCC; eieio(); in set_imstt_regvals_tvp()
631 par->cmap_regs[TVPIDATA] = tcc; eieio(); in set_imstt_regvals_tvp()
632 par->cmap_regs[TVPADDRW] = TVPIRMXC; eieio(); in set_imstt_regvals_tvp()
633 par->cmap_regs[TVPIDATA] = mxc; eieio(); in set_imstt_regvals_tvp()
634 par->cmap_regs[TVPADDRW] = TVPIRMIC; eieio(); in set_imstt_regvals_tvp()
635 par->cmap_regs[TVPIDATA] = mic; eieio(); in set_imstt_regvals_tvp()
637 par->cmap_regs[TVPADDRW] = TVPIRPLA; eieio(); in set_imstt_regvals_tvp()
638 par->cmap_regs[TVPIDATA] = 0x00; eieio(); in set_imstt_regvals_tvp()
639 par->cmap_regs[TVPADDRW] = TVPIRLPD; eieio(); in set_imstt_regvals_tvp()
640 par->cmap_regs[TVPIDATA] = lckl_n; eieio(); in set_imstt_regvals_tvp()
642 par->cmap_regs[TVPADDRW] = TVPIRPLA; eieio(); in set_imstt_regvals_tvp()
643 par->cmap_regs[TVPIDATA] = 0x15; eieio(); in set_imstt_regvals_tvp()
644 par->cmap_regs[TVPADDRW] = TVPIRMLC; eieio(); in set_imstt_regvals_tvp()
645 par->cmap_regs[TVPIDATA] = mlc; eieio(); in set_imstt_regvals_tvp()
647 par->cmap_regs[TVPADDRW] = TVPIRPLA; eieio(); in set_imstt_regvals_tvp()
648 par->cmap_regs[TVPIDATA] = 0x2a; eieio(); in set_imstt_regvals_tvp()
649 par->cmap_regs[TVPADDRW] = TVPIRLPD; eieio(); in set_imstt_regvals_tvp()
650 par->cmap_regs[TVPIDATA] = lckl_p; eieio(); in set_imstt_regvals_tvp()
656 struct imstt_par *par = info->par; in set_imstt_regvals()
657 struct imstt_regvals *init = &par->init; in set_imstt_regvals()
660 if (par->ramdac == IBM) in set_imstt_regvals()
680 pitch = init->pitch >> 2; in set_imstt_regvals()
685 pitch = init->pitch >> 1; in set_imstt_regvals()
690 pitch = init->pitch - (init->pitch >> 2); in set_imstt_regvals()
695 pitch = init->pitch; in set_imstt_regvals()
699 if (par->ramdac == TVP) in set_imstt_regvals()
700 ctl -= 0x30; in set_imstt_regvals()
702 write_reg_le32(par->dc_regs, HES, init->hes); in set_imstt_regvals()
703 write_reg_le32(par->dc_regs, HEB, init->heb); in set_imstt_regvals()
704 write_reg_le32(par->dc_regs, HSB, init->hsb); in set_imstt_regvals()
705 write_reg_le32(par->dc_regs, HT, init->ht); in set_imstt_regvals()
706 write_reg_le32(par->dc_regs, VES, init->ves); in set_imstt_regvals()
707 write_reg_le32(par->dc_regs, VEB, init->veb); in set_imstt_regvals()
708 write_reg_le32(par->dc_regs, VSB, init->vsb); in set_imstt_regvals()
709 write_reg_le32(par->dc_regs, VT, init->vt); in set_imstt_regvals()
710 write_reg_le32(par->dc_regs, VIL, init->vil); in set_imstt_regvals()
711 write_reg_le32(par->dc_regs, HCIV, 1); in set_imstt_regvals()
712 write_reg_le32(par->dc_regs, VCIV, 1); in set_imstt_regvals()
713 write_reg_le32(par->dc_regs, TCDR, 4); in set_imstt_regvals()
714 write_reg_le32(par->dc_regs, RRCIV, 1); in set_imstt_regvals()
715 write_reg_le32(par->dc_regs, RRSC, 0x980); in set_imstt_regvals()
716 write_reg_le32(par->dc_regs, RRCR, 0x11); in set_imstt_regvals()
718 if (par->ramdac == IBM) { in set_imstt_regvals()
719 write_reg_le32(par->dc_regs, HRIR, 0x0100); in set_imstt_regvals()
720 write_reg_le32(par->dc_regs, CMR, 0x00ff); in set_imstt_regvals()
721 write_reg_le32(par->dc_regs, SRGCTL, 0x0073); in set_imstt_regvals()
723 write_reg_le32(par->dc_regs, HRIR, 0x0200); in set_imstt_regvals()
724 write_reg_le32(par->dc_regs, CMR, 0x01ff); in set_imstt_regvals()
725 write_reg_le32(par->dc_regs, SRGCTL, 0x0003); in set_imstt_regvals()
728 switch (info->fix.smem_len) { in set_imstt_regvals()
740 write_reg_le32(par->dc_regs, SCR, scr); in set_imstt_regvals()
741 write_reg_le32(par->dc_regs, SPR, pitch); in set_imstt_regvals()
742 write_reg_le32(par->dc_regs, STGCTL, ctl); in set_imstt_regvals()
748 struct imstt_par *par = info->par; in set_offset()
749 __u32 off = var->yoffset * (info->fix.line_length >> 3) in set_offset()
750 + ((var->xoffset * (info->var.bits_per_pixel >> 3)) >> 3); in set_offset()
751 write_reg_le32(par->dc_regs, SSR, off); in set_offset()
757 if (par->ramdac == IBM) { in set_555()
758 par->cmap_regs[PIDXHI] = 0; eieio(); in set_555()
759 par->cmap_regs[PIDXLO] = BPP16; eieio(); in set_555()
760 par->cmap_regs[PIDXDATA] = 0x01; eieio(); in set_555()
762 par->cmap_regs[TVPADDRW] = TVPIRTCC; eieio(); in set_555()
763 par->cmap_regs[TVPIDATA] = 0x44; eieio(); in set_555()
770 if (par->ramdac == IBM) { in set_565()
771 par->cmap_regs[PIDXHI] = 0; eieio(); in set_565()
772 par->cmap_regs[PIDXLO] = BPP16; eieio(); in set_565()
773 par->cmap_regs[PIDXDATA] = 0x03; eieio(); in set_565()
775 par->cmap_regs[TVPADDRW] = TVPIRTCC; eieio(); in set_565()
776 par->cmap_regs[TVPIDATA] = 0x45; eieio(); in set_565()
783 if ((var->bits_per_pixel != 8 && var->bits_per_pixel != 16 in imsttfb_check_var()
784 && var->bits_per_pixel != 24 && var->bits_per_pixel != 32) in imsttfb_check_var()
785 || var->xres_virtual < var->xres || var->yres_virtual < var->yres in imsttfb_check_var()
786 || var->nonstd in imsttfb_check_var()
787 || (var->vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED) in imsttfb_check_var()
788 return -EINVAL; in imsttfb_check_var()
790 if ((var->xres * var->yres) * (var->bits_per_pixel >> 3) > info->fix.smem_len in imsttfb_check_var()
791 || (var->xres_virtual * var->yres_virtual) * (var->bits_per_pixel >> 3) > info->fix.smem_len) in imsttfb_check_var()
792 return -EINVAL; in imsttfb_check_var()
794 switch (var->bits_per_pixel) { in imsttfb_check_var()
796 var->red.offset = 0; in imsttfb_check_var()
797 var->red.length = 8; in imsttfb_check_var()
798 var->green.offset = 0; in imsttfb_check_var()
799 var->green.length = 8; in imsttfb_check_var()
800 var->blue.offset = 0; in imsttfb_check_var()
801 var->blue.length = 8; in imsttfb_check_var()
802 var->transp.offset = 0; in imsttfb_check_var()
803 var->transp.length = 0; in imsttfb_check_var()
806 if (var->green.length != 6) in imsttfb_check_var()
807 var->red.offset = 10; in imsttfb_check_var()
808 var->red.length = 5; in imsttfb_check_var()
809 var->green.offset = 5; in imsttfb_check_var()
810 if (var->green.length != 6) in imsttfb_check_var()
811 var->green.length = 5; in imsttfb_check_var()
812 var->blue.offset = 0; in imsttfb_check_var()
813 var->blue.length = 5; in imsttfb_check_var()
814 var->transp.offset = 0; in imsttfb_check_var()
815 var->transp.length = 0; in imsttfb_check_var()
818 var->red.offset = 16; in imsttfb_check_var()
819 var->red.length = 8; in imsttfb_check_var()
820 var->green.offset = 8; in imsttfb_check_var()
821 var->green.length = 8; in imsttfb_check_var()
822 var->blue.offset = 0; in imsttfb_check_var()
823 var->blue.length = 8; in imsttfb_check_var()
824 var->transp.offset = 0; in imsttfb_check_var()
825 var->transp.length = 0; in imsttfb_check_var()
828 var->red.offset = 16; in imsttfb_check_var()
829 var->red.length = 8; in imsttfb_check_var()
830 var->green.offset = 8; in imsttfb_check_var()
831 var->green.length = 8; in imsttfb_check_var()
832 var->blue.offset = 0; in imsttfb_check_var()
833 var->blue.length = 8; in imsttfb_check_var()
834 var->transp.offset = 24; in imsttfb_check_var()
835 var->transp.length = 8; in imsttfb_check_var()
839 if (var->yres == var->yres_virtual) { in imsttfb_check_var()
840 __u32 vram = (info->fix.smem_len - (PAGE_SIZE << 2)); in imsttfb_check_var()
841 var->yres_virtual = ((vram << 3) / var->bits_per_pixel) / var->xres_virtual; in imsttfb_check_var()
842 if (var->yres_virtual < var->yres) in imsttfb_check_var()
843 var->yres_virtual = var->yres; in imsttfb_check_var()
846 var->red.msb_right = 0; in imsttfb_check_var()
847 var->green.msb_right = 0; in imsttfb_check_var()
848 var->blue.msb_right = 0; in imsttfb_check_var()
849 var->transp.msb_right = 0; in imsttfb_check_var()
850 var->height = -1; in imsttfb_check_var()
851 var->width = -1; in imsttfb_check_var()
852 var->vmode = FB_VMODE_NONINTERLACED; in imsttfb_check_var()
853 var->left_margin = var->right_margin = 16; in imsttfb_check_var()
854 var->upper_margin = var->lower_margin = 16; in imsttfb_check_var()
855 var->hsync_len = var->vsync_len = 8; in imsttfb_check_var()
862 struct imstt_par *par = info->par; in imsttfb_set_par()
864 if (!compute_imstt_regvals(par, info->var.xres, info->var.yres)) in imsttfb_set_par()
865 return -EINVAL; in imsttfb_set_par()
867 if (info->var.green.length == 6) in imsttfb_set_par()
871 set_imstt_regvals(info, info->var.bits_per_pixel); in imsttfb_set_par()
872 info->var.pixclock = 1000000 / getclkMHz(par); in imsttfb_set_par()
880 struct imstt_par *par = info->par; in imsttfb_setcolreg()
881 u_int bpp = info->var.bits_per_pixel; in imsttfb_setcolreg()
892 par->cmap_regs[PADDRW] = regno << 3; in imsttfb_setcolreg()
894 par->cmap_regs[PADDRW] = regno; in imsttfb_setcolreg()
897 par->cmap_regs[PDATA] = red; eieio(); in imsttfb_setcolreg()
898 par->cmap_regs[PDATA] = green; eieio(); in imsttfb_setcolreg()
899 par->cmap_regs[PDATA] = blue; eieio(); in imsttfb_setcolreg()
904 par->palette[regno] = in imsttfb_setcolreg()
905 (regno << (info->var.green.length == in imsttfb_setcolreg()
909 par->palette[regno] = in imsttfb_setcolreg()
914 par->palette[regno] = (i << 16) |i; in imsttfb_setcolreg()
924 if (var->xoffset + info->var.xres > info->var.xres_virtual in imsttfb_pan_display()
925 || var->yoffset + info->var.yres > info->var.yres_virtual) in imsttfb_pan_display()
926 return -EINVAL; in imsttfb_pan_display()
928 info->var.xoffset = var->xoffset; in imsttfb_pan_display()
929 info->var.yoffset = var->yoffset; in imsttfb_pan_display()
937 struct imstt_par *par = info->par; in imsttfb_blank()
940 ctrl = read_reg_le32(par->dc_regs, STGCTL); in imsttfb_blank()
946 if (par->ramdac == IBM) { in imsttfb_blank()
947 par->cmap_regs[PIDXHI] = 0; eieio(); in imsttfb_blank()
948 par->cmap_regs[PIDXLO] = MISCTL2; eieio(); in imsttfb_blank()
949 par->cmap_regs[PIDXDATA] = 0x55; eieio(); in imsttfb_blank()
950 par->cmap_regs[PIDXLO] = MISCTL1; eieio(); in imsttfb_blank()
951 par->cmap_regs[PIDXDATA] = 0x11; eieio(); in imsttfb_blank()
952 par->cmap_regs[PIDXLO] = SYNCCTL; eieio(); in imsttfb_blank()
953 par->cmap_regs[PIDXDATA] = 0x0f; eieio(); in imsttfb_blank()
954 par->cmap_regs[PIDXLO] = PWRMNGMT; eieio(); in imsttfb_blank()
955 par->cmap_regs[PIDXDATA] = 0x1f; eieio(); in imsttfb_blank()
956 par->cmap_regs[PIDXLO] = CLKCTL; eieio(); in imsttfb_blank()
957 par->cmap_regs[PIDXDATA] = 0xc0; in imsttfb_blank()
968 if (par->ramdac == IBM) { in imsttfb_blank()
970 par->cmap_regs[PIDXHI] = 0; eieio(); in imsttfb_blank()
971 par->cmap_regs[PIDXLO] = CLKCTL; eieio(); in imsttfb_blank()
972 par->cmap_regs[PIDXDATA] = 0x01; eieio(); in imsttfb_blank()
973 par->cmap_regs[PIDXLO] = PWRMNGMT; eieio(); in imsttfb_blank()
974 par->cmap_regs[PIDXDATA] = 0x00; eieio(); in imsttfb_blank()
975 par->cmap_regs[PIDXLO] = SYNCCTL; eieio(); in imsttfb_blank()
976 par->cmap_regs[PIDXDATA] = 0x00; eieio(); in imsttfb_blank()
977 par->cmap_regs[PIDXLO] = MISCTL1; eieio(); in imsttfb_blank()
978 par->cmap_regs[PIDXDATA] = 0x01; eieio(); in imsttfb_blank()
979 par->cmap_regs[PIDXLO] = MISCTL2; eieio(); in imsttfb_blank()
980 par->cmap_regs[PIDXDATA] = 0x45; eieio(); in imsttfb_blank()
984 write_reg_le32(par->dc_regs, STGCTL, ctrl); in imsttfb_blank()
991 struct imstt_par *par = info->par; in imsttfb_fillrect()
994 bgc = rect->color; in imsttfb_fillrect()
998 Bpp = info->var.bits_per_pixel >> 3; in imsttfb_fillrect()
999 line_pitch = info->fix.line_length; in imsttfb_fillrect()
1001 dy = rect->dy * line_pitch; in imsttfb_fillrect()
1002 dx = rect->dx * Bpp; in imsttfb_fillrect()
1003 height = rect->height; in imsttfb_fillrect()
1004 height--; in imsttfb_fillrect()
1005 width = rect->width * Bpp; in imsttfb_fillrect()
1006 width--; in imsttfb_fillrect()
1008 if (rect->rop == ROP_COPY) { in imsttfb_fillrect()
1009 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x80); in imsttfb_fillrect()
1010 write_reg_le32(par->dc_regs, DSA, dy + dx); in imsttfb_fillrect()
1011 write_reg_le32(par->dc_regs, CNT, (height << 16) | width); in imsttfb_fillrect()
1012 write_reg_le32(par->dc_regs, DP_OCTL, line_pitch); in imsttfb_fillrect()
1013 write_reg_le32(par->dc_regs, BI, 0xffffffff); in imsttfb_fillrect()
1014 write_reg_le32(par->dc_regs, MBC, 0xffffffff); in imsttfb_fillrect()
1015 write_reg_le32(par->dc_regs, CLR, bgc); in imsttfb_fillrect()
1016 write_reg_le32(par->dc_regs, BLTCTL, 0x840); /* 0x200000 */ in imsttfb_fillrect()
1017 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x80); in imsttfb_fillrect()
1018 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x40); in imsttfb_fillrect()
1020 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x80); in imsttfb_fillrect()
1021 write_reg_le32(par->dc_regs, DSA, dy + dx); in imsttfb_fillrect()
1022 write_reg_le32(par->dc_regs, S1SA, dy + dx); in imsttfb_fillrect()
1023 write_reg_le32(par->dc_regs, CNT, (height << 16) | width); in imsttfb_fillrect()
1024 write_reg_le32(par->dc_regs, DP_OCTL, line_pitch); in imsttfb_fillrect()
1025 write_reg_le32(par->dc_regs, SP, line_pitch); in imsttfb_fillrect()
1026 write_reg_le32(par->dc_regs, BLTCTL, 0x40005); in imsttfb_fillrect()
1027 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x80); in imsttfb_fillrect()
1028 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x40); in imsttfb_fillrect()
1035 struct imstt_par *par = info->par; in imsttfb_copyarea()
1039 Bpp = info->var.bits_per_pixel >> 3; in imsttfb_copyarea()
1041 sx = area->sx * Bpp; in imsttfb_copyarea()
1042 sy = area->sy; in imsttfb_copyarea()
1043 dx = area->dx * Bpp; in imsttfb_copyarea()
1044 dy = area->dy; in imsttfb_copyarea()
1045 height = area->height; in imsttfb_copyarea()
1046 height--; in imsttfb_copyarea()
1047 width = area->width * Bpp; in imsttfb_copyarea()
1048 width--; in imsttfb_copyarea()
1050 line_pitch = info->fix.line_length; in imsttfb_copyarea()
1058 sp |= -(line_pitch) & 0xffff; in imsttfb_copyarea()
1059 dp_octl = -(line_pitch) & 0xffff; in imsttfb_copyarea()
1068 cnt |= -(width) & 0xffff; in imsttfb_copyarea()
1075 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x80); in imsttfb_copyarea()
1076 write_reg_le32(par->dc_regs, S1SA, fb_offset_old); in imsttfb_copyarea()
1077 write_reg_le32(par->dc_regs, SP, sp); in imsttfb_copyarea()
1078 write_reg_le32(par->dc_regs, DSA, fb_offset_new); in imsttfb_copyarea()
1079 write_reg_le32(par->dc_regs, CNT, cnt); in imsttfb_copyarea()
1080 write_reg_le32(par->dc_regs, DP_OCTL, dp_octl); in imsttfb_copyarea()
1081 write_reg_le32(par->dc_regs, BLTCTL, bltctl); in imsttfb_copyarea()
1082 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x80); in imsttfb_copyarea()
1083 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x40); in imsttfb_copyarea()
1093 return -EINVAL;
1095 if (par->ramdac == IBM) {
1096 par->cmap_regs[PIDXHI] = 1; eieio();
1098 par->cmap_regs[PIDXLO] = x; eieio();
1099 par->cmap_regs[PIDXDATA] = 0x00; eieio();
1101 par->cmap_regs[PIDXHI] = 1; eieio();
1104 par->cmap_regs[PIDXLO] = x + y * 8; eieio();
1105 par->cmap_regs[PIDXDATA] = 0xff; eieio();
1107 par->cmap_regs[PIDXHI] = 0; eieio();
1108 par->cmap_regs[PIDXLO] = CURS1R; eieio();
1109 par->cmap_regs[PIDXDATA] = fgc; eieio();
1110 par->cmap_regs[PIDXLO] = CURS1G; eieio();
1111 par->cmap_regs[PIDXDATA] = fgc; eieio();
1112 par->cmap_regs[PIDXLO] = CURS1B; eieio();
1113 par->cmap_regs[PIDXDATA] = fgc; eieio();
1114 par->cmap_regs[PIDXLO] = CURS2R; eieio();
1115 par->cmap_regs[PIDXDATA] = fgc; eieio();
1116 par->cmap_regs[PIDXLO] = CURS2G; eieio();
1117 par->cmap_regs[PIDXDATA] = fgc; eieio();
1118 par->cmap_regs[PIDXLO] = CURS2B; eieio();
1119 par->cmap_regs[PIDXDATA] = fgc; eieio();
1120 par->cmap_regs[PIDXLO] = CURS3R; eieio();
1121 par->cmap_regs[PIDXDATA] = fgc; eieio();
1122 par->cmap_regs[PIDXLO] = CURS3G; eieio();
1123 par->cmap_regs[PIDXDATA] = fgc; eieio();
1124 par->cmap_regs[PIDXLO] = CURS3B; eieio();
1125 par->cmap_regs[PIDXDATA] = fgc; eieio();
1127 par->cmap_regs[TVPADDRW] = TVPIRICC; eieio();
1128 par->cmap_regs[TVPIDATA] &= 0x03; eieio();
1129 par->cmap_regs[TVPADDRW] = 0; eieio();
1131 par->cmap_regs[TVPCRDAT] = 0x00; eieio();
1134 par->cmap_regs[TVPCRDAT] = 0xff; eieio();
1136 par->cmap_regs[TVPADDRW] = TVPIRICC; eieio();
1137 par->cmap_regs[TVPIDATA] &= 0x03; eieio();
1140 par->cmap_regs[TVPADDRW] = x + y * 8; eieio();
1141 par->cmap_regs[TVPCRDAT] = 0xff; eieio();
1143 par->cmap_regs[TVPADDRW] = TVPIRICC; eieio();
1144 par->cmap_regs[TVPIDATA] |= 0x08; eieio();
1147 par->cmap_regs[TVPADDRW] = x + y * 8; eieio();
1148 par->cmap_regs[TVPCRDAT] = 0xff; eieio();
1150 par->cmap_regs[TVPCADRW] = 0x00; eieio();
1152 par->cmap_regs[TVPCDATA] = fgc;
1162 if (par->ramdac == IBM) {
1163 par->cmap_regs[PIDXHI] = 0; eieio();
1165 par->cmap_regs[PIDXLO] = CURSCTL; eieio();
1166 par->cmap_regs[PIDXDATA] = 0x00; eieio();
1168 par->cmap_regs[PIDXLO] = CURSXHI; eieio();
1169 par->cmap_regs[PIDXDATA] = d->dx >> 8; eieio();
1170 par->cmap_regs[PIDXLO] = CURSXLO; eieio();
1171 par->cmap_regs[PIDXDATA] = d->dx & 0xff;eieio();
1172 par->cmap_regs[PIDXLO] = CURSYHI; eieio();
1173 par->cmap_regs[PIDXDATA] = d->dy >> 8; eieio();
1174 par->cmap_regs[PIDXLO] = CURSYLO; eieio();
1175 par->cmap_regs[PIDXDATA] = d->dy & 0xff;eieio();
1176 par->cmap_regs[PIDXLO] = CURSCTL; eieio();
1177 par->cmap_regs[PIDXDATA] = 0x02; eieio();
1181 par->cmap_regs[TVPADDRW] = TVPIRICC; eieio();
1182 par->cmap_regs[TVPIDATA] = 0x00; eieio();
1184 __u16 x = d->dx + 0x40, y = d->dy + 0x40;
1186 par->cmap_regs[TVPCXPOH] = x >> 8; eieio();
1187 par->cmap_regs[TVPCXPOL] = x & 0xff; eieio();
1188 par->cmap_regs[TVPCYPOH] = y >> 8; eieio();
1189 par->cmap_regs[TVPCYPOL] = y & 0xff; eieio();
1190 par->cmap_regs[TVPADDRW] = TVPIRICC; eieio();
1191 par->cmap_regs[TVPIDATA] = 0x02; eieio();
1199 struct imstt_par *par = info->par;
1200 u32 flags = cursor->set, fg, bg, xx, yy;
1202 if (cursor->dest == NULL && cursor->rop == ROP_XOR)
1208 xx = cursor->image.dx - info->var.xoffset;
1209 yy = cursor->image.dy - info->var.yoffset;
1216 int fg_idx = cursor->image.fg_color;
1217 int width = (cursor->image.width+7)/8;
1218 u8 *dat = (u8 *) cursor->image.data;
1219 u8 *dst = (u8 *) cursor->dest;
1220 u8 *msk = (u8 *) cursor->mask;
1222 switch (cursor->rop) {
1224 for (i = 0; i < cursor->image.height; i++) {
1236 for (i = 0; i < cursor->image.height; i++) {
1247 fg = ((info->cmap.red[fg_idx] & 0xf8) << 7) |
1248 ((info->cmap.green[fg_idx] & 0xf8) << 2) |
1249 ((info->cmap.blue[fg_idx] & 0xf8) >> 3) | 1 << 15;
1253 if (cursor->enable)
1269 struct imstt_par *par = info->par; in imsttfb_ioctl()
1276 if (copy_from_user(reg, argp, 8) || reg[0] > (0x1000 - sizeof(reg[0])) / sizeof(reg[0])) in imsttfb_ioctl()
1277 return -EFAULT; in imsttfb_ioctl()
1278 write_reg_le32(par->dc_regs, reg[0], reg[1]); in imsttfb_ioctl()
1281 if (copy_from_user(reg, argp, 4) || reg[0] > (0x1000 - sizeof(reg[0])) / sizeof(reg[0])) in imsttfb_ioctl()
1282 return -EFAULT; in imsttfb_ioctl()
1283 reg[1] = read_reg_le32(par->dc_regs, reg[0]); in imsttfb_ioctl()
1285 return -EFAULT; in imsttfb_ioctl()
1288 if (copy_from_user(reg, argp, 8) || reg[0] > (0x1000 - sizeof(reg[0])) / sizeof(reg[0])) in imsttfb_ioctl()
1289 return -EFAULT; in imsttfb_ioctl()
1290 write_reg_le32(((u_int __iomem *)par->cmap_regs), reg[0], reg[1]); in imsttfb_ioctl()
1293 if (copy_from_user(reg, argp, 4) || reg[0] > (0x1000 - sizeof(reg[0])) / sizeof(reg[0])) in imsttfb_ioctl()
1294 return -EFAULT; in imsttfb_ioctl()
1295 reg[1] = read_reg_le32(((u_int __iomem *)par->cmap_regs), reg[0]); in imsttfb_ioctl()
1297 return -EFAULT; in imsttfb_ioctl()
1301 return -EFAULT; in imsttfb_ioctl()
1302 par->cmap_regs[PIDXHI] = 0; eieio(); in imsttfb_ioctl()
1303 par->cmap_regs[PIDXLO] = idx[0]; eieio(); in imsttfb_ioctl()
1304 par->cmap_regs[PIDXDATA] = idx[1]; eieio(); in imsttfb_ioctl()
1308 return -EFAULT; in imsttfb_ioctl()
1309 par->cmap_regs[PIDXHI] = 0; eieio(); in imsttfb_ioctl()
1310 par->cmap_regs[PIDXLO] = idx[0]; eieio(); in imsttfb_ioctl()
1311 idx[1] = par->cmap_regs[PIDXDATA]; in imsttfb_ioctl()
1313 return -EFAULT; in imsttfb_ioctl()
1316 return -ENOIOCTLCMD; in imsttfb_ioctl()
1354 struct imstt_par *par = info->par; in init_imstt()
1357 tmp = read_reg_le32(par->dc_regs, PRC); in init_imstt()
1358 if (par->ramdac == IBM) in init_imstt()
1359 info->fix.smem_len = (tmp & 0x0004) ? 0x400000 : 0x200000; in init_imstt()
1361 info->fix.smem_len = 0x800000; in init_imstt()
1363 ip = (__u32 *)info->screen_base; in init_imstt()
1364 end = (__u32 *)(info->screen_base + info->fix.smem_len); in init_imstt()
1369 tmp = read_reg_le32(par->dc_regs, STGCTL); in init_imstt()
1370 write_reg_le32(par->dc_regs, STGCTL, tmp & ~0x1); in init_imstt()
1371 write_reg_le32(par->dc_regs, SSR, 0); in init_imstt()
1374 if (par->ramdac == IBM) { in init_imstt()
1375 par->cmap_regs[PPMASK] = 0xff; in init_imstt()
1377 par->cmap_regs[PIDXHI] = 0; in init_imstt()
1380 par->cmap_regs[PIDXLO] = ibm_initregs[i].addr; in init_imstt()
1382 par->cmap_regs[PIDXDATA] = ibm_initregs[i].value; in init_imstt()
1387 par->cmap_regs[TVPADDRW] = tvp_initregs[i].addr; in init_imstt()
1389 par->cmap_regs[TVPIDATA] = tvp_initregs[i].value; in init_imstt()
1398 if (vmode == -1) { in init_imstt()
1403 if (cmode == -1) { in init_imstt()
1408 if (mac_vmode_to_var(vmode, cmode, &info->var)) { in init_imstt()
1409 info->var.xres = info->var.xres_virtual = INIT_XRES; in init_imstt()
1410 info->var.yres = info->var.yres_virtual = INIT_YRES; in init_imstt()
1411 info->var.bits_per_pixel = INIT_BPP; in init_imstt()
1416 info->var.xres = info->var.xres_virtual = INIT_XRES; in init_imstt()
1417 info->var.yres = info->var.yres_virtual = INIT_YRES; in init_imstt()
1418 info->var.bits_per_pixel = INIT_BPP; in init_imstt()
1421 if ((info->var.xres * info->var.yres) * (info->var.bits_per_pixel >> 3) > info->fix.smem_len in init_imstt()
1422 || !(compute_imstt_regvals(par, info->var.xres, info->var.yres))) { in init_imstt()
1423 …printk("imsttfb: %ux%ux%u not supported\n", info->var.xres, info->var.yres, info->var.bits_per_pix… in init_imstt()
1424 return -ENODEV; in init_imstt()
1427 sprintf(info->fix.id, "IMS TT (%s)", par->ramdac == IBM ? "IBM" : "TVP"); in init_imstt()
1428 info->fix.mmio_len = 0x1000; in init_imstt()
1429 info->fix.accel = FB_ACCEL_IMS_TWINTURBO; in init_imstt()
1430 info->fix.type = FB_TYPE_PACKED_PIXELS; in init_imstt()
1431 info->fix.visual = info->var.bits_per_pixel == 8 ? FB_VISUAL_PSEUDOCOLOR in init_imstt()
1433 info->fix.line_length = info->var.xres * (info->var.bits_per_pixel >> 3); in init_imstt()
1434 info->fix.xpanstep = 8; in init_imstt()
1435 info->fix.ypanstep = 1; in init_imstt()
1436 info->fix.ywrapstep = 0; in init_imstt()
1438 info->var.accel_flags = FB_ACCELF_TEXT; in init_imstt()
1440 // if (par->ramdac == IBM) in init_imstt()
1442 if (info->var.green.length == 6) in init_imstt()
1446 set_imstt_regvals(info, info->var.bits_per_pixel); in init_imstt()
1448 info->var.pixclock = 1000000 / getclkMHz(par); in init_imstt()
1450 info->fbops = &imsttfb_ops; in init_imstt()
1451 info->flags = FBINFO_HWACCEL_COPYAREA | in init_imstt()
1455 if (fb_alloc_cmap(&info->cmap, 0, 0)) in init_imstt()
1456 return -ENODEV; in init_imstt()
1459 fb_dealloc_cmap(&info->cmap); in init_imstt()
1460 return -ENODEV; in init_imstt()
1463 tmp = (read_reg_le32(par->dc_regs, SSTATUS) & 0x0f00) >> 8; in init_imstt()
1465 info->fix.id, info->fix.smem_len >> 20, tmp); in init_imstt()
1480 ret = -ENOMEM; in imsttfb_probe()
1488 info = framebuffer_alloc(sizeof(struct imstt_par), &pdev->dev); in imsttfb_probe()
1490 return -ENOMEM; in imsttfb_probe()
1492 par = info->par; in imsttfb_probe()
1499 ret = -ENODEV; in imsttfb_probe()
1503 switch (pdev->device) { in imsttfb_probe()
1505 par->ramdac = IBM; in imsttfb_probe()
1508 par->ramdac = TVP; in imsttfb_probe()
1511 par->ramdac = TVP; in imsttfb_probe()
1515 "contact maintainer.\n", pdev->device); in imsttfb_probe()
1516 ret = -ENODEV; in imsttfb_probe()
1520 info->fix.smem_start = addr; in imsttfb_probe()
1521 info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ? in imsttfb_probe()
1523 if (!info->screen_base) in imsttfb_probe()
1525 info->fix.mmio_start = addr + 0x800000; in imsttfb_probe()
1526 par->dc_regs = ioremap(addr + 0x800000, 0x1000); in imsttfb_probe()
1527 if (!par->dc_regs) in imsttfb_probe()
1529 par->cmap_regs_phys = addr + 0x840000; in imsttfb_probe()
1530 par->cmap_regs = (__u8 *)ioremap(addr + 0x840000, 0x1000); in imsttfb_probe()
1531 if (!par->cmap_regs) in imsttfb_probe()
1533 info->pseudo_palette = par->palette; in imsttfb_probe()
1542 iounmap(par->cmap_regs); in imsttfb_probe()
1544 iounmap(par->dc_regs); in imsttfb_probe()
1546 iounmap(info->screen_base); in imsttfb_probe()
1557 struct imstt_par *par = info->par; in imsttfb_remove()
1561 iounmap(par->cmap_regs); in imsttfb_remove()
1562 iounmap(par->dc_regs); in imsttfb_remove()
1563 iounmap(info->screen_base); in imsttfb_remove()
1564 release_mem_region(info->fix.smem_start, size); in imsttfb_remove()
1583 for (i = 0; i < sizeof(fontname) - 1; i++) in imsttfb_setup()
1630 return -ENODEV; in imsttfb_init()
1634 return -ENODEV; in imsttfb_init()