Lines Matching +full:charge +full:- +full:ctrl +full:- +full:value

2  *  drivers/video/imsttfb.c -- frame buffer device for IMS TwinTurbo
39 #define eieio() /* Enforce In-order Execution of I/O */
134 * c is charge pump bias which depends on the VCO frequency
171 TVPPMASK = 0x08, /* 2 Pixel Read-Mask */
181 TVPCXPOL = 0x30, /* 12 Cursor-Position X LSB */
182 TVPCXPOH = 0x34, /* 13 Cursor-Position X MSB */
183 TVPCYPOL = 0x38, /* 14 Cursor-Position Y LSB */
184 TVPCYPOH = 0x3c, /* 15 Cursor-Position Y MSB */
203 TVPIRCKL = 0x30, /* Color-Key Overlay Low */
204 TVPIRCKH = 0x31, /* Color-Key Overlay High */
205 TVPIRCRL = 0x32, /* Color-Key Red Low */
206 TVPIRCRH = 0x33, /* Color-Key Red High */
207 TVPIRCGL = 0x34, /* Color-Key Green Low */
208 TVPIRCGH = 0x35, /* Color-Key Green High */
209 TVPIRCBL = 0x36, /* Color-Key Blue Low */
210 TVPIRCBH = 0x37, /* Color-Key Blue High */
211 TVPIRCKC = 0x38, /* Color-Key Control (0x00) */
223 __u8 addr, value; member
312 __u8 lckl_p[3]; /* P value of LCKL PLL */
336 static signed char init_vmode = -1, init_cmode = -1;
427 clk_m = par->init.pclk_m; in getclkMHz()
428 clk_n = par->init.pclk_n; in getclkMHz()
429 clk_p = par->init.pclk_p; in getclkMHz()
461 par->init.pclk_m = clk_m; in setclkMHz()
462 par->init.pclk_n = clk_n; in setclkMHz()
463 par->init.pclk_p = 0; in setclkMHz()
469 struct imstt_regvals *init = &par->init; in compute_imstt_regvals_ibm()
503 init->hes = hes; in compute_imstt_regvals_ibm()
504 init->heb = heb; in compute_imstt_regvals_ibm()
505 init->hsb = init->heb + (xres >> 3); in compute_imstt_regvals_ibm()
506 init->ht = init->hsb + htp; in compute_imstt_regvals_ibm()
507 init->ves = 0x0003; in compute_imstt_regvals_ibm()
508 init->veb = veb; in compute_imstt_regvals_ibm()
509 init->vsb = init->veb + yres; in compute_imstt_regvals_ibm()
510 init->vt = init->vsb + vtp; in compute_imstt_regvals_ibm()
511 init->vil = init->vsb; in compute_imstt_regvals_ibm()
513 init->pitch = xres; in compute_imstt_regvals_ibm()
547 par->init = *init; in compute_imstt_regvals_tvp()
554 if (par->ramdac == IBM) in compute_imstt_regvals()
563 struct imstt_regvals *init = &par->init; in set_imstt_regvals_ibm()
566 par->cmap_regs[PIDXHI] = 0; eieio(); in set_imstt_regvals_ibm()
567 par->cmap_regs[PIDXLO] = PIXM0; eieio(); in set_imstt_regvals_ibm()
568 par->cmap_regs[PIDXDATA] = init->pclk_m;eieio(); in set_imstt_regvals_ibm()
569 par->cmap_regs[PIDXLO] = PIXN0; eieio(); in set_imstt_regvals_ibm()
570 par->cmap_regs[PIDXDATA] = init->pclk_n;eieio(); in set_imstt_regvals_ibm()
571 par->cmap_regs[PIDXLO] = PIXP0; eieio(); in set_imstt_regvals_ibm()
572 par->cmap_regs[PIDXDATA] = init->pclk_p;eieio(); in set_imstt_regvals_ibm()
573 par->cmap_regs[PIDXLO] = PIXC0; eieio(); in set_imstt_regvals_ibm()
574 par->cmap_regs[PIDXDATA] = 0x02; eieio(); in set_imstt_regvals_ibm()
576 par->cmap_regs[PIDXLO] = PIXFMT; eieio(); in set_imstt_regvals_ibm()
577 par->cmap_regs[PIDXDATA] = pformat; eieio(); in set_imstt_regvals_ibm()
583 struct imstt_regvals *init = &par->init; in set_imstt_regvals_tvp()
593 mlc = init->mlc[0]; in set_imstt_regvals_tvp()
594 lckl_p = init->lckl_p[0]; in set_imstt_regvals_tvp()
600 mlc = init->mlc[1]; in set_imstt_regvals_tvp()
601 lckl_p = init->lckl_p[1]; in set_imstt_regvals_tvp()
607 mlc = init->mlc[2]; in set_imstt_regvals_tvp()
608 lckl_p = init->lckl_p[2]; in set_imstt_regvals_tvp()
614 mlc = init->mlc[2]; in set_imstt_regvals_tvp()
615 lckl_p = init->lckl_p[2]; in set_imstt_regvals_tvp()
620 par->cmap_regs[TVPADDRW] = TVPIRPLA; eieio(); in set_imstt_regvals_tvp()
621 par->cmap_regs[TVPIDATA] = 0x00; eieio(); in set_imstt_regvals_tvp()
622 par->cmap_regs[TVPADDRW] = TVPIRPPD; eieio(); in set_imstt_regvals_tvp()
623 par->cmap_regs[TVPIDATA] = init->pclk_m; eieio(); in set_imstt_regvals_tvp()
624 par->cmap_regs[TVPADDRW] = TVPIRPPD; eieio(); in set_imstt_regvals_tvp()
625 par->cmap_regs[TVPIDATA] = init->pclk_n; eieio(); in set_imstt_regvals_tvp()
626 par->cmap_regs[TVPADDRW] = TVPIRPPD; eieio(); in set_imstt_regvals_tvp()
627 par->cmap_regs[TVPIDATA] = init->pclk_p; eieio(); in set_imstt_regvals_tvp()
629 par->cmap_regs[TVPADDRW] = TVPIRTCC; eieio(); in set_imstt_regvals_tvp()
630 par->cmap_regs[TVPIDATA] = tcc; eieio(); in set_imstt_regvals_tvp()
631 par->cmap_regs[TVPADDRW] = TVPIRMXC; eieio(); in set_imstt_regvals_tvp()
632 par->cmap_regs[TVPIDATA] = mxc; eieio(); in set_imstt_regvals_tvp()
633 par->cmap_regs[TVPADDRW] = TVPIRMIC; eieio(); in set_imstt_regvals_tvp()
634 par->cmap_regs[TVPIDATA] = mic; eieio(); in set_imstt_regvals_tvp()
636 par->cmap_regs[TVPADDRW] = TVPIRPLA; eieio(); in set_imstt_regvals_tvp()
637 par->cmap_regs[TVPIDATA] = 0x00; eieio(); in set_imstt_regvals_tvp()
638 par->cmap_regs[TVPADDRW] = TVPIRLPD; eieio(); in set_imstt_regvals_tvp()
639 par->cmap_regs[TVPIDATA] = lckl_n; eieio(); in set_imstt_regvals_tvp()
641 par->cmap_regs[TVPADDRW] = TVPIRPLA; eieio(); in set_imstt_regvals_tvp()
642 par->cmap_regs[TVPIDATA] = 0x15; eieio(); in set_imstt_regvals_tvp()
643 par->cmap_regs[TVPADDRW] = TVPIRMLC; eieio(); in set_imstt_regvals_tvp()
644 par->cmap_regs[TVPIDATA] = mlc; eieio(); in set_imstt_regvals_tvp()
646 par->cmap_regs[TVPADDRW] = TVPIRPLA; eieio(); in set_imstt_regvals_tvp()
647 par->cmap_regs[TVPIDATA] = 0x2a; eieio(); in set_imstt_regvals_tvp()
648 par->cmap_regs[TVPADDRW] = TVPIRLPD; eieio(); in set_imstt_regvals_tvp()
649 par->cmap_regs[TVPIDATA] = lckl_p; eieio(); in set_imstt_regvals_tvp()
655 struct imstt_par *par = info->par; in set_imstt_regvals()
656 struct imstt_regvals *init = &par->init; in set_imstt_regvals()
659 if (par->ramdac == IBM) in set_imstt_regvals()
679 pitch = init->pitch >> 2; in set_imstt_regvals()
684 pitch = init->pitch >> 1; in set_imstt_regvals()
689 pitch = init->pitch - (init->pitch >> 2); in set_imstt_regvals()
694 pitch = init->pitch; in set_imstt_regvals()
698 if (par->ramdac == TVP) in set_imstt_regvals()
699 ctl -= 0x30; in set_imstt_regvals()
701 write_reg_le32(par->dc_regs, HES, init->hes); in set_imstt_regvals()
702 write_reg_le32(par->dc_regs, HEB, init->heb); in set_imstt_regvals()
703 write_reg_le32(par->dc_regs, HSB, init->hsb); in set_imstt_regvals()
704 write_reg_le32(par->dc_regs, HT, init->ht); in set_imstt_regvals()
705 write_reg_le32(par->dc_regs, VES, init->ves); in set_imstt_regvals()
706 write_reg_le32(par->dc_regs, VEB, init->veb); in set_imstt_regvals()
707 write_reg_le32(par->dc_regs, VSB, init->vsb); in set_imstt_regvals()
708 write_reg_le32(par->dc_regs, VT, init->vt); in set_imstt_regvals()
709 write_reg_le32(par->dc_regs, VIL, init->vil); in set_imstt_regvals()
710 write_reg_le32(par->dc_regs, HCIV, 1); in set_imstt_regvals()
711 write_reg_le32(par->dc_regs, VCIV, 1); in set_imstt_regvals()
712 write_reg_le32(par->dc_regs, TCDR, 4); in set_imstt_regvals()
713 write_reg_le32(par->dc_regs, RRCIV, 1); in set_imstt_regvals()
714 write_reg_le32(par->dc_regs, RRSC, 0x980); in set_imstt_regvals()
715 write_reg_le32(par->dc_regs, RRCR, 0x11); in set_imstt_regvals()
717 if (par->ramdac == IBM) { in set_imstt_regvals()
718 write_reg_le32(par->dc_regs, HRIR, 0x0100); in set_imstt_regvals()
719 write_reg_le32(par->dc_regs, CMR, 0x00ff); in set_imstt_regvals()
720 write_reg_le32(par->dc_regs, SRGCTL, 0x0073); in set_imstt_regvals()
722 write_reg_le32(par->dc_regs, HRIR, 0x0200); in set_imstt_regvals()
723 write_reg_le32(par->dc_regs, CMR, 0x01ff); in set_imstt_regvals()
724 write_reg_le32(par->dc_regs, SRGCTL, 0x0003); in set_imstt_regvals()
727 switch (info->fix.smem_len) { in set_imstt_regvals()
739 write_reg_le32(par->dc_regs, SCR, scr); in set_imstt_regvals()
740 write_reg_le32(par->dc_regs, SPR, pitch); in set_imstt_regvals()
741 write_reg_le32(par->dc_regs, STGCTL, ctl); in set_imstt_regvals()
747 struct imstt_par *par = info->par; in set_offset()
748 __u32 off = var->yoffset * (info->fix.line_length >> 3) in set_offset()
749 + ((var->xoffset * (info->var.bits_per_pixel >> 3)) >> 3); in set_offset()
750 write_reg_le32(par->dc_regs, SSR, off); in set_offset()
756 if (par->ramdac == IBM) { in set_555()
757 par->cmap_regs[PIDXHI] = 0; eieio(); in set_555()
758 par->cmap_regs[PIDXLO] = BPP16; eieio(); in set_555()
759 par->cmap_regs[PIDXDATA] = 0x01; eieio(); in set_555()
761 par->cmap_regs[TVPADDRW] = TVPIRTCC; eieio(); in set_555()
762 par->cmap_regs[TVPIDATA] = 0x44; eieio(); in set_555()
769 if (par->ramdac == IBM) { in set_565()
770 par->cmap_regs[PIDXHI] = 0; eieio(); in set_565()
771 par->cmap_regs[PIDXLO] = BPP16; eieio(); in set_565()
772 par->cmap_regs[PIDXDATA] = 0x03; eieio(); in set_565()
774 par->cmap_regs[TVPADDRW] = TVPIRTCC; eieio(); in set_565()
775 par->cmap_regs[TVPIDATA] = 0x45; eieio(); in set_565()
782 if ((var->bits_per_pixel != 8 && var->bits_per_pixel != 16 in imsttfb_check_var()
783 && var->bits_per_pixel != 24 && var->bits_per_pixel != 32) in imsttfb_check_var()
784 || var->xres_virtual < var->xres || var->yres_virtual < var->yres in imsttfb_check_var()
785 || var->nonstd in imsttfb_check_var()
786 || (var->vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED) in imsttfb_check_var()
787 return -EINVAL; in imsttfb_check_var()
789 if ((var->xres * var->yres) * (var->bits_per_pixel >> 3) > info->fix.smem_len in imsttfb_check_var()
790 || (var->xres_virtual * var->yres_virtual) * (var->bits_per_pixel >> 3) > info->fix.smem_len) in imsttfb_check_var()
791 return -EINVAL; in imsttfb_check_var()
793 switch (var->bits_per_pixel) { in imsttfb_check_var()
795 var->red.offset = 0; in imsttfb_check_var()
796 var->red.length = 8; in imsttfb_check_var()
797 var->green.offset = 0; in imsttfb_check_var()
798 var->green.length = 8; in imsttfb_check_var()
799 var->blue.offset = 0; in imsttfb_check_var()
800 var->blue.length = 8; in imsttfb_check_var()
801 var->transp.offset = 0; in imsttfb_check_var()
802 var->transp.length = 0; in imsttfb_check_var()
805 if (var->green.length != 6) in imsttfb_check_var()
806 var->red.offset = 10; in imsttfb_check_var()
807 var->red.length = 5; in imsttfb_check_var()
808 var->green.offset = 5; in imsttfb_check_var()
809 if (var->green.length != 6) in imsttfb_check_var()
810 var->green.length = 5; in imsttfb_check_var()
811 var->blue.offset = 0; in imsttfb_check_var()
812 var->blue.length = 5; in imsttfb_check_var()
813 var->transp.offset = 0; in imsttfb_check_var()
814 var->transp.length = 0; in imsttfb_check_var()
817 var->red.offset = 16; in imsttfb_check_var()
818 var->red.length = 8; in imsttfb_check_var()
819 var->green.offset = 8; in imsttfb_check_var()
820 var->green.length = 8; in imsttfb_check_var()
821 var->blue.offset = 0; in imsttfb_check_var()
822 var->blue.length = 8; in imsttfb_check_var()
823 var->transp.offset = 0; in imsttfb_check_var()
824 var->transp.length = 0; in imsttfb_check_var()
827 var->red.offset = 16; in imsttfb_check_var()
828 var->red.length = 8; in imsttfb_check_var()
829 var->green.offset = 8; in imsttfb_check_var()
830 var->green.length = 8; in imsttfb_check_var()
831 var->blue.offset = 0; in imsttfb_check_var()
832 var->blue.length = 8; in imsttfb_check_var()
833 var->transp.offset = 24; in imsttfb_check_var()
834 var->transp.length = 8; in imsttfb_check_var()
838 if (var->yres == var->yres_virtual) { in imsttfb_check_var()
839 __u32 vram = (info->fix.smem_len - (PAGE_SIZE << 2)); in imsttfb_check_var()
840 var->yres_virtual = ((vram << 3) / var->bits_per_pixel) / var->xres_virtual; in imsttfb_check_var()
841 if (var->yres_virtual < var->yres) in imsttfb_check_var()
842 var->yres_virtual = var->yres; in imsttfb_check_var()
845 var->red.msb_right = 0; in imsttfb_check_var()
846 var->green.msb_right = 0; in imsttfb_check_var()
847 var->blue.msb_right = 0; in imsttfb_check_var()
848 var->transp.msb_right = 0; in imsttfb_check_var()
849 var->height = -1; in imsttfb_check_var()
850 var->width = -1; in imsttfb_check_var()
851 var->vmode = FB_VMODE_NONINTERLACED; in imsttfb_check_var()
852 var->left_margin = var->right_margin = 16; in imsttfb_check_var()
853 var->upper_margin = var->lower_margin = 16; in imsttfb_check_var()
854 var->hsync_len = var->vsync_len = 8; in imsttfb_check_var()
861 struct imstt_par *par = info->par; in imsttfb_set_par()
863 if (!compute_imstt_regvals(par, info->var.xres, info->var.yres)) in imsttfb_set_par()
864 return -EINVAL; in imsttfb_set_par()
866 if (info->var.green.length == 6) in imsttfb_set_par()
870 set_imstt_regvals(info, info->var.bits_per_pixel); in imsttfb_set_par()
871 info->var.pixclock = 1000000 / getclkMHz(par); in imsttfb_set_par()
879 struct imstt_par *par = info->par; in imsttfb_setcolreg()
880 u_int bpp = info->var.bits_per_pixel; in imsttfb_setcolreg()
891 par->cmap_regs[PADDRW] = regno << 3; in imsttfb_setcolreg()
893 par->cmap_regs[PADDRW] = regno; in imsttfb_setcolreg()
896 par->cmap_regs[PDATA] = red; eieio(); in imsttfb_setcolreg()
897 par->cmap_regs[PDATA] = green; eieio(); in imsttfb_setcolreg()
898 par->cmap_regs[PDATA] = blue; eieio(); in imsttfb_setcolreg()
903 par->palette[regno] = in imsttfb_setcolreg()
904 (regno << (info->var.green.length == in imsttfb_setcolreg()
908 par->palette[regno] = in imsttfb_setcolreg()
913 par->palette[regno] = (i << 16) |i; in imsttfb_setcolreg()
923 if (var->xoffset + info->var.xres > info->var.xres_virtual in imsttfb_pan_display()
924 || var->yoffset + info->var.yres > info->var.yres_virtual) in imsttfb_pan_display()
925 return -EINVAL; in imsttfb_pan_display()
927 info->var.xoffset = var->xoffset; in imsttfb_pan_display()
928 info->var.yoffset = var->yoffset; in imsttfb_pan_display()
936 struct imstt_par *par = info->par; in imsttfb_blank()
937 __u32 ctrl; in imsttfb_blank() local
939 ctrl = read_reg_le32(par->dc_regs, STGCTL); in imsttfb_blank()
944 ctrl &= ~0x00000380; in imsttfb_blank()
945 if (par->ramdac == IBM) { in imsttfb_blank()
946 par->cmap_regs[PIDXHI] = 0; eieio(); in imsttfb_blank()
947 par->cmap_regs[PIDXLO] = MISCTL2; eieio(); in imsttfb_blank()
948 par->cmap_regs[PIDXDATA] = 0x55; eieio(); in imsttfb_blank()
949 par->cmap_regs[PIDXLO] = MISCTL1; eieio(); in imsttfb_blank()
950 par->cmap_regs[PIDXDATA] = 0x11; eieio(); in imsttfb_blank()
951 par->cmap_regs[PIDXLO] = SYNCCTL; eieio(); in imsttfb_blank()
952 par->cmap_regs[PIDXDATA] = 0x0f; eieio(); in imsttfb_blank()
953 par->cmap_regs[PIDXLO] = PWRMNGMT; eieio(); in imsttfb_blank()
954 par->cmap_regs[PIDXDATA] = 0x1f; eieio(); in imsttfb_blank()
955 par->cmap_regs[PIDXLO] = CLKCTL; eieio(); in imsttfb_blank()
956 par->cmap_regs[PIDXDATA] = 0xc0; in imsttfb_blank()
960 ctrl &= ~0x00000020; in imsttfb_blank()
963 ctrl &= ~0x00000010; in imsttfb_blank()
967 if (par->ramdac == IBM) { in imsttfb_blank()
968 ctrl |= 0x000017b0; in imsttfb_blank()
969 par->cmap_regs[PIDXHI] = 0; eieio(); in imsttfb_blank()
970 par->cmap_regs[PIDXLO] = CLKCTL; eieio(); in imsttfb_blank()
971 par->cmap_regs[PIDXDATA] = 0x01; eieio(); in imsttfb_blank()
972 par->cmap_regs[PIDXLO] = PWRMNGMT; eieio(); in imsttfb_blank()
973 par->cmap_regs[PIDXDATA] = 0x00; eieio(); in imsttfb_blank()
974 par->cmap_regs[PIDXLO] = SYNCCTL; eieio(); in imsttfb_blank()
975 par->cmap_regs[PIDXDATA] = 0x00; eieio(); in imsttfb_blank()
976 par->cmap_regs[PIDXLO] = MISCTL1; eieio(); in imsttfb_blank()
977 par->cmap_regs[PIDXDATA] = 0x01; eieio(); in imsttfb_blank()
978 par->cmap_regs[PIDXLO] = MISCTL2; eieio(); in imsttfb_blank()
979 par->cmap_regs[PIDXDATA] = 0x45; eieio(); in imsttfb_blank()
981 ctrl |= 0x00001780; in imsttfb_blank()
983 write_reg_le32(par->dc_regs, STGCTL, ctrl); in imsttfb_blank()
990 struct imstt_par *par = info->par; in imsttfb_fillrect()
993 bgc = rect->color; in imsttfb_fillrect()
997 Bpp = info->var.bits_per_pixel >> 3, in imsttfb_fillrect()
998 line_pitch = info->fix.line_length; in imsttfb_fillrect()
1000 dy = rect->dy * line_pitch; in imsttfb_fillrect()
1001 dx = rect->dx * Bpp; in imsttfb_fillrect()
1002 height = rect->height; in imsttfb_fillrect()
1003 height--; in imsttfb_fillrect()
1004 width = rect->width * Bpp; in imsttfb_fillrect()
1005 width--; in imsttfb_fillrect()
1007 if (rect->rop == ROP_COPY) { in imsttfb_fillrect()
1008 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x80); in imsttfb_fillrect()
1009 write_reg_le32(par->dc_regs, DSA, dy + dx); in imsttfb_fillrect()
1010 write_reg_le32(par->dc_regs, CNT, (height << 16) | width); in imsttfb_fillrect()
1011 write_reg_le32(par->dc_regs, DP_OCTL, line_pitch); in imsttfb_fillrect()
1012 write_reg_le32(par->dc_regs, BI, 0xffffffff); in imsttfb_fillrect()
1013 write_reg_le32(par->dc_regs, MBC, 0xffffffff); in imsttfb_fillrect()
1014 write_reg_le32(par->dc_regs, CLR, bgc); in imsttfb_fillrect()
1015 write_reg_le32(par->dc_regs, BLTCTL, 0x840); /* 0x200000 */ in imsttfb_fillrect()
1016 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x80); in imsttfb_fillrect()
1017 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x40); in imsttfb_fillrect()
1019 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x80); in imsttfb_fillrect()
1020 write_reg_le32(par->dc_regs, DSA, dy + dx); in imsttfb_fillrect()
1021 write_reg_le32(par->dc_regs, S1SA, dy + dx); in imsttfb_fillrect()
1022 write_reg_le32(par->dc_regs, CNT, (height << 16) | width); in imsttfb_fillrect()
1023 write_reg_le32(par->dc_regs, DP_OCTL, line_pitch); in imsttfb_fillrect()
1024 write_reg_le32(par->dc_regs, SP, line_pitch); in imsttfb_fillrect()
1025 write_reg_le32(par->dc_regs, BLTCTL, 0x40005); in imsttfb_fillrect()
1026 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x80); in imsttfb_fillrect()
1027 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x40); in imsttfb_fillrect()
1034 struct imstt_par *par = info->par; in imsttfb_copyarea()
1038 Bpp = info->var.bits_per_pixel >> 3, in imsttfb_copyarea()
1040 sx = area->sx * Bpp; in imsttfb_copyarea()
1041 sy = area->sy; in imsttfb_copyarea()
1042 dx = area->dx * Bpp; in imsttfb_copyarea()
1043 dy = area->dy; in imsttfb_copyarea()
1044 height = area->height; in imsttfb_copyarea()
1045 height--; in imsttfb_copyarea()
1046 width = area->width * Bpp; in imsttfb_copyarea()
1047 width--; in imsttfb_copyarea()
1049 line_pitch = info->fix.line_length; in imsttfb_copyarea()
1057 sp |= -(line_pitch) & 0xffff; in imsttfb_copyarea()
1058 dp_octl = -(line_pitch) & 0xffff; in imsttfb_copyarea()
1067 cnt |= -(width) & 0xffff; in imsttfb_copyarea()
1074 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x80); in imsttfb_copyarea()
1075 write_reg_le32(par->dc_regs, S1SA, fb_offset_old); in imsttfb_copyarea()
1076 write_reg_le32(par->dc_regs, SP, sp); in imsttfb_copyarea()
1077 write_reg_le32(par->dc_regs, DSA, fb_offset_new); in imsttfb_copyarea()
1078 write_reg_le32(par->dc_regs, CNT, cnt); in imsttfb_copyarea()
1079 write_reg_le32(par->dc_regs, DP_OCTL, dp_octl); in imsttfb_copyarea()
1080 write_reg_le32(par->dc_regs, BLTCTL, bltctl); in imsttfb_copyarea()
1081 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x80); in imsttfb_copyarea()
1082 while(read_reg_le32(par->dc_regs, SSTATUS) & 0x40); in imsttfb_copyarea()
1092 return -EINVAL;
1094 if (par->ramdac == IBM) {
1095 par->cmap_regs[PIDXHI] = 1; eieio();
1097 par->cmap_regs[PIDXLO] = x; eieio();
1098 par->cmap_regs[PIDXDATA] = 0x00; eieio();
1100 par->cmap_regs[PIDXHI] = 1; eieio();
1103 par->cmap_regs[PIDXLO] = x + y * 8; eieio();
1104 par->cmap_regs[PIDXDATA] = 0xff; eieio();
1106 par->cmap_regs[PIDXHI] = 0; eieio();
1107 par->cmap_regs[PIDXLO] = CURS1R; eieio();
1108 par->cmap_regs[PIDXDATA] = fgc; eieio();
1109 par->cmap_regs[PIDXLO] = CURS1G; eieio();
1110 par->cmap_regs[PIDXDATA] = fgc; eieio();
1111 par->cmap_regs[PIDXLO] = CURS1B; eieio();
1112 par->cmap_regs[PIDXDATA] = fgc; eieio();
1113 par->cmap_regs[PIDXLO] = CURS2R; eieio();
1114 par->cmap_regs[PIDXDATA] = fgc; eieio();
1115 par->cmap_regs[PIDXLO] = CURS2G; eieio();
1116 par->cmap_regs[PIDXDATA] = fgc; eieio();
1117 par->cmap_regs[PIDXLO] = CURS2B; eieio();
1118 par->cmap_regs[PIDXDATA] = fgc; eieio();
1119 par->cmap_regs[PIDXLO] = CURS3R; eieio();
1120 par->cmap_regs[PIDXDATA] = fgc; eieio();
1121 par->cmap_regs[PIDXLO] = CURS3G; eieio();
1122 par->cmap_regs[PIDXDATA] = fgc; eieio();
1123 par->cmap_regs[PIDXLO] = CURS3B; eieio();
1124 par->cmap_regs[PIDXDATA] = fgc; eieio();
1126 par->cmap_regs[TVPADDRW] = TVPIRICC; eieio();
1127 par->cmap_regs[TVPIDATA] &= 0x03; eieio();
1128 par->cmap_regs[TVPADDRW] = 0; eieio();
1130 par->cmap_regs[TVPCRDAT] = 0x00; eieio();
1133 par->cmap_regs[TVPCRDAT] = 0xff; eieio();
1135 par->cmap_regs[TVPADDRW] = TVPIRICC; eieio();
1136 par->cmap_regs[TVPIDATA] &= 0x03; eieio();
1139 par->cmap_regs[TVPADDRW] = x + y * 8; eieio();
1140 par->cmap_regs[TVPCRDAT] = 0xff; eieio();
1142 par->cmap_regs[TVPADDRW] = TVPIRICC; eieio();
1143 par->cmap_regs[TVPIDATA] |= 0x08; eieio();
1146 par->cmap_regs[TVPADDRW] = x + y * 8; eieio();
1147 par->cmap_regs[TVPCRDAT] = 0xff; eieio();
1149 par->cmap_regs[TVPCADRW] = 0x00; eieio();
1151 par->cmap_regs[TVPCDATA] = fgc;
1161 if (par->ramdac == IBM) {
1162 par->cmap_regs[PIDXHI] = 0; eieio();
1164 par->cmap_regs[PIDXLO] = CURSCTL; eieio();
1165 par->cmap_regs[PIDXDATA] = 0x00; eieio();
1167 par->cmap_regs[PIDXLO] = CURSXHI; eieio();
1168 par->cmap_regs[PIDXDATA] = d->dx >> 8; eieio();
1169 par->cmap_regs[PIDXLO] = CURSXLO; eieio();
1170 par->cmap_regs[PIDXDATA] = d->dx & 0xff;eieio();
1171 par->cmap_regs[PIDXLO] = CURSYHI; eieio();
1172 par->cmap_regs[PIDXDATA] = d->dy >> 8; eieio();
1173 par->cmap_regs[PIDXLO] = CURSYLO; eieio();
1174 par->cmap_regs[PIDXDATA] = d->dy & 0xff;eieio();
1175 par->cmap_regs[PIDXLO] = CURSCTL; eieio();
1176 par->cmap_regs[PIDXDATA] = 0x02; eieio();
1180 par->cmap_regs[TVPADDRW] = TVPIRICC; eieio();
1181 par->cmap_regs[TVPIDATA] = 0x00; eieio();
1183 __u16 x = d->dx + 0x40, y = d->dy + 0x40;
1185 par->cmap_regs[TVPCXPOH] = x >> 8; eieio();
1186 par->cmap_regs[TVPCXPOL] = x & 0xff; eieio();
1187 par->cmap_regs[TVPCYPOH] = y >> 8; eieio();
1188 par->cmap_regs[TVPCYPOL] = y & 0xff; eieio();
1189 par->cmap_regs[TVPADDRW] = TVPIRICC; eieio();
1190 par->cmap_regs[TVPIDATA] = 0x02; eieio();
1198 struct imstt_par *par = info->par;
1199 u32 flags = cursor->set, fg, bg, xx, yy;
1201 if (cursor->dest == NULL && cursor->rop == ROP_XOR)
1207 xx = cursor->image.dx - info->var.xoffset;
1208 yy = cursor->image.dy - info->var.yoffset;
1215 int fg_idx = cursor->image.fg_color;
1216 int width = (cursor->image.width+7)/8;
1217 u8 *dat = (u8 *) cursor->image.data;
1218 u8 *dst = (u8 *) cursor->dest;
1219 u8 *msk = (u8 *) cursor->mask;
1221 switch (cursor->rop) {
1223 for (i = 0; i < cursor->image.height; i++) {
1235 for (i = 0; i < cursor->image.height; i++) {
1246 fg = ((info->cmap.red[fg_idx] & 0xf8) << 7) |
1247 ((info->cmap.green[fg_idx] & 0xf8) << 2) |
1248 ((info->cmap.blue[fg_idx] & 0xf8) >> 3) | 1 << 15;
1252 if (cursor->enable)
1268 struct imstt_par *par = info->par; in imsttfb_ioctl()
1275 if (copy_from_user(reg, argp, 8) || reg[0] > (0x1000 - sizeof(reg[0])) / sizeof(reg[0])) in imsttfb_ioctl()
1276 return -EFAULT; in imsttfb_ioctl()
1277 write_reg_le32(par->dc_regs, reg[0], reg[1]); in imsttfb_ioctl()
1280 if (copy_from_user(reg, argp, 4) || reg[0] > (0x1000 - sizeof(reg[0])) / sizeof(reg[0])) in imsttfb_ioctl()
1281 return -EFAULT; in imsttfb_ioctl()
1282 reg[1] = read_reg_le32(par->dc_regs, reg[0]); in imsttfb_ioctl()
1284 return -EFAULT; in imsttfb_ioctl()
1287 if (copy_from_user(reg, argp, 8) || reg[0] > (0x1000 - sizeof(reg[0])) / sizeof(reg[0])) in imsttfb_ioctl()
1288 return -EFAULT; in imsttfb_ioctl()
1289 write_reg_le32(((u_int __iomem *)par->cmap_regs), reg[0], reg[1]); in imsttfb_ioctl()
1292 if (copy_from_user(reg, argp, 4) || reg[0] > (0x1000 - sizeof(reg[0])) / sizeof(reg[0])) in imsttfb_ioctl()
1293 return -EFAULT; in imsttfb_ioctl()
1294 reg[1] = read_reg_le32(((u_int __iomem *)par->cmap_regs), reg[0]); in imsttfb_ioctl()
1296 return -EFAULT; in imsttfb_ioctl()
1300 return -EFAULT; in imsttfb_ioctl()
1301 par->cmap_regs[PIDXHI] = 0; eieio(); in imsttfb_ioctl()
1302 par->cmap_regs[PIDXLO] = idx[0]; eieio(); in imsttfb_ioctl()
1303 par->cmap_regs[PIDXDATA] = idx[1]; eieio(); in imsttfb_ioctl()
1307 return -EFAULT; in imsttfb_ioctl()
1308 par->cmap_regs[PIDXHI] = 0; eieio(); in imsttfb_ioctl()
1309 par->cmap_regs[PIDXLO] = idx[0]; eieio(); in imsttfb_ioctl()
1310 idx[1] = par->cmap_regs[PIDXDATA]; in imsttfb_ioctl()
1312 return -EFAULT; in imsttfb_ioctl()
1315 return -ENOIOCTLCMD; in imsttfb_ioctl()
1351 struct imstt_par *par = info->par; in init_imstt()
1354 tmp = read_reg_le32(par->dc_regs, PRC); in init_imstt()
1355 if (par->ramdac == IBM) in init_imstt()
1356 info->fix.smem_len = (tmp & 0x0004) ? 0x400000 : 0x200000; in init_imstt()
1358 info->fix.smem_len = 0x800000; in init_imstt()
1360 ip = (__u32 *)info->screen_base; in init_imstt()
1361 end = (__u32 *)(info->screen_base + info->fix.smem_len); in init_imstt()
1366 tmp = read_reg_le32(par->dc_regs, STGCTL); in init_imstt()
1367 write_reg_le32(par->dc_regs, STGCTL, tmp & ~0x1); in init_imstt()
1368 write_reg_le32(par->dc_regs, SSR, 0); in init_imstt()
1371 if (par->ramdac == IBM) { in init_imstt()
1372 par->cmap_regs[PPMASK] = 0xff; in init_imstt()
1374 par->cmap_regs[PIDXHI] = 0; in init_imstt()
1377 par->cmap_regs[PIDXLO] = ibm_initregs[i].addr; in init_imstt()
1379 par->cmap_regs[PIDXDATA] = ibm_initregs[i].value; in init_imstt()
1384 par->cmap_regs[TVPADDRW] = tvp_initregs[i].addr; in init_imstt()
1386 par->cmap_regs[TVPIDATA] = tvp_initregs[i].value; in init_imstt()
1395 if (vmode == -1) { in init_imstt()
1400 if (cmode == -1) { in init_imstt()
1405 if (mac_vmode_to_var(vmode, cmode, &info->var)) { in init_imstt()
1406 info->var.xres = info->var.xres_virtual = INIT_XRES; in init_imstt()
1407 info->var.yres = info->var.yres_virtual = INIT_YRES; in init_imstt()
1408 info->var.bits_per_pixel = INIT_BPP; in init_imstt()
1413 info->var.xres = info->var.xres_virtual = INIT_XRES; in init_imstt()
1414 info->var.yres = info->var.yres_virtual = INIT_YRES; in init_imstt()
1415 info->var.bits_per_pixel = INIT_BPP; in init_imstt()
1418 if ((info->var.xres * info->var.yres) * (info->var.bits_per_pixel >> 3) > info->fix.smem_len in init_imstt()
1419 || !(compute_imstt_regvals(par, info->var.xres, info->var.yres))) { in init_imstt()
1420 …printk("imsttfb: %ux%ux%u not supported\n", info->var.xres, info->var.yres, info->var.bits_per_pix… in init_imstt()
1425 sprintf(info->fix.id, "IMS TT (%s)", par->ramdac == IBM ? "IBM" : "TVP"); in init_imstt()
1426 info->fix.mmio_len = 0x1000; in init_imstt()
1427 info->fix.accel = FB_ACCEL_IMS_TWINTURBO; in init_imstt()
1428 info->fix.type = FB_TYPE_PACKED_PIXELS; in init_imstt()
1429 info->fix.visual = info->var.bits_per_pixel == 8 ? FB_VISUAL_PSEUDOCOLOR in init_imstt()
1431 info->fix.line_length = info->var.xres * (info->var.bits_per_pixel >> 3); in init_imstt()
1432 info->fix.xpanstep = 8; in init_imstt()
1433 info->fix.ypanstep = 1; in init_imstt()
1434 info->fix.ywrapstep = 0; in init_imstt()
1436 info->var.accel_flags = FB_ACCELF_TEXT; in init_imstt()
1438 // if (par->ramdac == IBM) in init_imstt()
1440 if (info->var.green.length == 6) in init_imstt()
1444 set_imstt_regvals(info, info->var.bits_per_pixel); in init_imstt()
1446 info->var.pixclock = 1000000 / getclkMHz(par); in init_imstt()
1448 info->fbops = &imsttfb_ops; in init_imstt()
1449 info->flags = FBINFO_DEFAULT | in init_imstt()
1454 fb_alloc_cmap(&info->cmap, 0, 0); in init_imstt()
1461 tmp = (read_reg_le32(par->dc_regs, SSTATUS) & 0x0f00) >> 8; in init_imstt()
1463 info->fix.id, info->fix.smem_len >> 20, tmp); in init_imstt()
1479 info = framebuffer_alloc(sizeof(struct imstt_par), &pdev->dev); in imsttfb_probe()
1481 return -ENOMEM; in imsttfb_probe()
1483 par = info->par; in imsttfb_probe()
1491 return -ENODEV; in imsttfb_probe()
1494 switch (pdev->device) { in imsttfb_probe()
1496 par->ramdac = IBM; in imsttfb_probe()
1499 par->ramdac = TVP; in imsttfb_probe()
1502 par->ramdac = TVP; in imsttfb_probe()
1506 "contact maintainer.\n", pdev->device); in imsttfb_probe()
1509 return -ENODEV; in imsttfb_probe()
1512 info->fix.smem_start = addr; in imsttfb_probe()
1513 info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ? in imsttfb_probe()
1515 if (!info->screen_base) { in imsttfb_probe()
1518 return -ENOMEM; in imsttfb_probe()
1520 info->fix.mmio_start = addr + 0x800000; in imsttfb_probe()
1521 par->dc_regs = ioremap(addr + 0x800000, 0x1000); in imsttfb_probe()
1522 par->cmap_regs_phys = addr + 0x840000; in imsttfb_probe()
1523 par->cmap_regs = (__u8 *)ioremap(addr + 0x840000, 0x1000); in imsttfb_probe()
1524 info->pseudo_palette = par->palette; in imsttfb_probe()
1534 struct imstt_par *par = info->par; in imsttfb_remove()
1538 iounmap(par->cmap_regs); in imsttfb_remove()
1539 iounmap(par->dc_regs); in imsttfb_remove()
1540 iounmap(info->screen_base); in imsttfb_remove()
1541 release_mem_region(info->fix.smem_start, size); in imsttfb_remove()
1560 for (i = 0; i < sizeof(fontname) - 1; i++) in imsttfb_setup()
1606 return -ENODEV; in imsttfb_init()