Lines Matching +full:ati +full:- +full:base

2  *  ATI Frame Buffer Device Driver Core
5 * Copyright (C) 1997-2001 Geert Uytterhoeven
9 * This driver supports the following ATI graphics chips:
10 * - ATI Mach64
13 * - ATI Rage128 (from aty128fb.c)
14 * - ATI Radeon (from radeonfb.c)
20 * and on the PowerMac ATI/mach64 display driver:
35 * Many thanks to Nitya from ATI devrel for support and patience !
42 - cursor support on all cards and all ramdacs.
43 - cursor parameters controlable via ioctl()s.
44 - guess PLL and MCLK based on the original PLL register values initialized
108 /* Make sure n * PAGE_SIZE is protected at end of Aperture for GUI-regs */
109 /* - must be large enough to catch all GUI-Regs */
110 /* - must be aligned to a PAGE boundary */
115 if (!(var->activate & FB_ACTIVATE_TEST)) \
117 return -EINVAL; \
121 if (!(var->activate & FB_ACTIVATE_TEST)) \
123 return -EINVAL; \
192 * ATIReduceRatio --
287 /* 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) */
290 0, 0, -1, -1, 0, 39722, 48, 16, 33, 10, 96, 2,
331 static int comp_sync = -1;
352 /* top -> down is an evolution of mach64 chipset, any corrections? */
431 { PCI_CHIP_MACH64GO, "3D RAGE XL (Mach64 GO, PCI-66)", 230, 83, 63, 135, ATI_CHIP_264XL },
432 { PCI_CHIP_MACH64GL, "3D RAGE XC (Mach64 GL, PCI-66)", 230, 83, 63, 135, ATI_CHIP_264XL },
433 …{ PCI_CHIP_MACH64GR, "3D RAGE XL (Mach64 GR, PCI-33)", 230, 83, 63, 135, ATI_CHIP_264XL | M64F_SDR…
434 { PCI_CHIP_MACH64GS, "3D RAGE XC (Mach64 GS, PCI-33)", 230, 83, 63, 135, ATI_CHIP_264XL },
449 struct atyfb_par *par = (struct atyfb_par *) info->par; in aty_fudge_framebuffer_len()
451 if (!par->aux_start && in aty_fudge_framebuffer_len()
452 (info->fix.smem_len == 0x800000 || in aty_fudge_framebuffer_len()
453 (par->bus_type == ISA && info->fix.smem_len == 0x400000))) in aty_fudge_framebuffer_len()
454 info->fix.smem_len -= GUI_RESERVE; in aty_fudge_framebuffer_len()
465 for (i = (int)ARRAY_SIZE(aty_chips) - 1; i >= 0; i--) in correct_chipset()
466 if (par->pci_id == aty_chips[i].pci_id) in correct_chipset()
470 return -ENODEV; in correct_chipset()
473 par->pll_limits.pll_max = aty_chips[i].pll; in correct_chipset()
474 par->pll_limits.mclk = aty_chips[i].mclk; in correct_chipset()
475 par->pll_limits.xclk = aty_chips[i].xclk; in correct_chipset()
476 par->pll_limits.ecp_max = aty_chips[i].ecp_max; in correct_chipset()
477 par->features = aty_chips[i].features; in correct_chipset()
483 switch (par->pci_id) { in correct_chipset()
487 return -ENODEV; in correct_chipset()
491 return -ENODEV; in correct_chipset()
501 par->pll_limits.pll_max = 170; in correct_chipset()
502 par->pll_limits.mclk = 67; in correct_chipset()
503 par->pll_limits.xclk = 67; in correct_chipset()
504 par->pll_limits.ecp_max = 80; in correct_chipset()
505 par->features = ATI_CHIP_264VT; in correct_chipset()
509 par->pll_limits.pll_max = 200; in correct_chipset()
510 par->pll_limits.mclk = 67; in correct_chipset()
511 par->pll_limits.xclk = 67; in correct_chipset()
512 par->pll_limits.ecp_max = 80; in correct_chipset()
513 par->features = ATI_CHIP_264VT | M64F_MAGIC_POSTDIV; in correct_chipset()
519 par->pll_limits.pll_max = 200; in correct_chipset()
520 par->pll_limits.mclk = 67; in correct_chipset()
521 par->pll_limits.xclk = 67; in correct_chipset()
522 par->pll_limits.ecp_max = 80; in correct_chipset()
523 par->features = ATI_CHIP_264VTB; in correct_chipset()
527 par->pll_limits.pll_max = 200; in correct_chipset()
528 par->pll_limits.mclk = 67; in correct_chipset()
529 par->pll_limits.xclk = 67; in correct_chipset()
530 par->pll_limits.ecp_max = 80; in correct_chipset()
531 par->features = ATI_CHIP_264VT3; in correct_chipset()
539 par->pll_limits.pll_max = 170; in correct_chipset()
540 par->pll_limits.mclk = 67; in correct_chipset()
541 par->pll_limits.xclk = 67; in correct_chipset()
542 par->pll_limits.ecp_max = 80; in correct_chipset()
543 par->features = ATI_CHIP_264GTB; in correct_chipset()
547 par->pll_limits.pll_max = 200; in correct_chipset()
548 par->pll_limits.mclk = 67; in correct_chipset()
549 par->pll_limits.xclk = 67; in correct_chipset()
550 par->pll_limits.ecp_max = 100; in correct_chipset()
551 par->features = ATI_CHIP_264GTB; in correct_chipset()
571 static char ram_sdram32[] = "SDRAM (2:1) (32-bit)";
598 u32 pixclock = var->pixclock; in atyfb_get_pixclock()
601 par->pll.ct.xres = 0; in atyfb_get_pixclock()
602 if (par->lcd_table != 0) { in atyfb_get_pixclock()
605 par->pll.ct.xres = var->xres; in atyfb_get_pixclock()
606 pixclock = par->lcd_pixclock; in atyfb_get_pixclock()
654 /* ------------------------------------------------------------------------- */
663 if (par->lcd_table != 0) { in aty_get_crtc()
665 crtc->lcd_index = aty_ld_le32(LCD_INDEX, par); in aty_get_crtc()
666 aty_st_le32(LCD_INDEX, crtc->lcd_index, par); in aty_get_crtc()
668 crtc->lcd_config_panel = aty_ld_lcd(CNFG_PANEL, par); in aty_get_crtc()
669 crtc->lcd_gen_cntl = aty_ld_lcd(LCD_GEN_CNTL, par); in aty_get_crtc()
673 aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl & in aty_get_crtc()
677 crtc->horz_stretching = aty_ld_lcd(HORZ_STRETCHING, par); in aty_get_crtc()
678 crtc->vert_stretching = aty_ld_lcd(VERT_STRETCHING, par); in aty_get_crtc()
680 crtc->ext_vert_stretch = aty_ld_lcd(EXT_VERT_STRETCH, par); in aty_get_crtc()
683 crtc->h_tot_disp = aty_ld_le32(CRTC_H_TOTAL_DISP, par); in aty_get_crtc()
684 crtc->h_sync_strt_wid = aty_ld_le32(CRTC_H_SYNC_STRT_WID, par); in aty_get_crtc()
685 crtc->v_tot_disp = aty_ld_le32(CRTC_V_TOTAL_DISP, par); in aty_get_crtc()
686 crtc->v_sync_strt_wid = aty_ld_le32(CRTC_V_SYNC_STRT_WID, par); in aty_get_crtc()
687 crtc->vline_crnt_vline = aty_ld_le32(CRTC_VLINE_CRNT_VLINE, par); in aty_get_crtc()
688 crtc->off_pitch = aty_ld_le32(CRTC_OFF_PITCH, par); in aty_get_crtc()
689 crtc->gen_cntl = aty_ld_le32(CRTC_GEN_CNTL, par); in aty_get_crtc()
692 if (par->lcd_table != 0) { in aty_get_crtc()
694 aty_st_lcd(LCD_GEN_CNTL, (crtc->lcd_gen_cntl & ~CRTC_RW_SELECT) | in aty_get_crtc()
697 crtc->shadow_h_tot_disp = aty_ld_le32(CRTC_H_TOTAL_DISP, par); in aty_get_crtc()
698 crtc->shadow_h_sync_strt_wid = aty_ld_le32(CRTC_H_SYNC_STRT_WID, par); in aty_get_crtc()
699 crtc->shadow_v_tot_disp = aty_ld_le32(CRTC_V_TOTAL_DISP, par); in aty_get_crtc()
700 crtc->shadow_v_sync_strt_wid = aty_ld_le32(CRTC_V_SYNC_STRT_WID, par); in aty_get_crtc()
702 aty_st_le32(LCD_GEN_CNTL, crtc->lcd_gen_cntl, par); in aty_get_crtc()
710 if (par->lcd_table != 0) { in aty_set_crtc()
712 aty_st_le32(CRTC_GEN_CNTL, crtc->gen_cntl & in aty_set_crtc()
715 /* update non-shadow registers first */ in aty_set_crtc()
716 aty_st_lcd(CNFG_PANEL, crtc->lcd_config_panel, par); in aty_set_crtc()
717 aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl & in aty_set_crtc()
721 aty_st_lcd(HORZ_STRETCHING, crtc->horz_stretching & in aty_set_crtc()
723 aty_st_lcd(VERT_STRETCHING, crtc->vert_stretching & in aty_set_crtc()
729 aty_st_le32(CRTC_GEN_CNTL, crtc->gen_cntl & ~CRTC_EN, par); in aty_set_crtc()
733 ((((crtc->h_tot_disp >> 16) & 0xff) + 1) << 3), in aty_set_crtc()
734 (((crtc->v_tot_disp >> 16) & 0x7ff) + 1), in aty_set_crtc()
735 (crtc->h_sync_strt_wid & 0x200000) ? 'N' : 'P', in aty_set_crtc()
736 (crtc->v_sync_strt_wid & 0x200000) ? 'N' : 'P', in aty_set_crtc()
737 (crtc->gen_cntl & CRTC_CSYNC_EN) ? 'P' : 'N'); in aty_set_crtc()
739 DPRINTK("CRTC_H_TOTAL_DISP: %x\n", crtc->h_tot_disp); in aty_set_crtc()
740 DPRINTK("CRTC_H_SYNC_STRT_WID: %x\n", crtc->h_sync_strt_wid); in aty_set_crtc()
741 DPRINTK("CRTC_V_TOTAL_DISP: %x\n", crtc->v_tot_disp); in aty_set_crtc()
742 DPRINTK("CRTC_V_SYNC_STRT_WID: %x\n", crtc->v_sync_strt_wid); in aty_set_crtc()
743 DPRINTK("CRTC_OFF_PITCH: %x\n", crtc->off_pitch); in aty_set_crtc()
744 DPRINTK("CRTC_VLINE_CRNT_VLINE: %x\n", crtc->vline_crnt_vline); in aty_set_crtc()
745 DPRINTK("CRTC_GEN_CNTL: %x\n", crtc->gen_cntl); in aty_set_crtc()
747 aty_st_le32(CRTC_H_TOTAL_DISP, crtc->h_tot_disp, par); in aty_set_crtc()
748 aty_st_le32(CRTC_H_SYNC_STRT_WID, crtc->h_sync_strt_wid, par); in aty_set_crtc()
749 aty_st_le32(CRTC_V_TOTAL_DISP, crtc->v_tot_disp, par); in aty_set_crtc()
750 aty_st_le32(CRTC_V_SYNC_STRT_WID, crtc->v_sync_strt_wid, par); in aty_set_crtc()
751 aty_st_le32(CRTC_OFF_PITCH, crtc->off_pitch, par); in aty_set_crtc()
752 aty_st_le32(CRTC_VLINE_CRNT_VLINE, crtc->vline_crnt_vline, par); in aty_set_crtc()
754 aty_st_le32(CRTC_GEN_CNTL, crtc->gen_cntl, par); in aty_set_crtc()
757 if (par->accel_flags & FB_ACCELF_TEXT) in aty_set_crtc()
762 if (par->lcd_table != 0) { in aty_set_crtc()
764 aty_st_lcd(LCD_GEN_CNTL, (crtc->lcd_gen_cntl & ~CRTC_RW_SELECT) | in aty_set_crtc()
768 ((((crtc->shadow_h_tot_disp >> 16) & 0xff) + 1) << 3), in aty_set_crtc()
769 (((crtc->shadow_v_tot_disp >> 16) & 0x7ff) + 1), in aty_set_crtc()
770 (crtc->shadow_h_sync_strt_wid & 0x200000) ? 'N' : 'P', in aty_set_crtc()
771 (crtc->shadow_v_sync_strt_wid & 0x200000) ? 'N' : 'P'); in aty_set_crtc()
774 crtc->shadow_h_tot_disp); in aty_set_crtc()
776 crtc->shadow_h_sync_strt_wid); in aty_set_crtc()
778 crtc->shadow_v_tot_disp); in aty_set_crtc()
780 crtc->shadow_v_sync_strt_wid); in aty_set_crtc()
782 aty_st_le32(CRTC_H_TOTAL_DISP, crtc->shadow_h_tot_disp, par); in aty_set_crtc()
783 aty_st_le32(CRTC_H_SYNC_STRT_WID, crtc->shadow_h_sync_strt_wid, par); in aty_set_crtc()
784 aty_st_le32(CRTC_V_TOTAL_DISP, crtc->shadow_v_tot_disp, par); in aty_set_crtc()
785 aty_st_le32(CRTC_V_SYNC_STRT_WID, crtc->shadow_v_sync_strt_wid, par); in aty_set_crtc()
788 DPRINTK("LCD_GEN_CNTL: %x\n", crtc->lcd_gen_cntl); in aty_set_crtc()
789 DPRINTK("HORZ_STRETCHING: %x\n", crtc->horz_stretching); in aty_set_crtc()
790 DPRINTK("VERT_STRETCHING: %x\n", crtc->vert_stretching); in aty_set_crtc()
792 DPRINTK("EXT_VERT_STRETCH: %x\n", crtc->ext_vert_stretch); in aty_set_crtc()
794 aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl, par); in aty_set_crtc()
795 aty_st_lcd(HORZ_STRETCHING, crtc->horz_stretching, par); in aty_set_crtc()
796 aty_st_lcd(VERT_STRETCHING, crtc->vert_stretching, par); in aty_set_crtc()
798 aty_st_lcd(EXT_VERT_STRETCH, crtc->ext_vert_stretch, par); in aty_set_crtc()
800 aty_st_le32(LCD_INDEX, crtc->lcd_index, par); in aty_set_crtc()
810 if (par->ram_type == SGRAM || in calc_line_length()
811 (!M64_HAS(XL_MEM) && par->ram_type == WRAM)) in calc_line_length()
821 struct atyfb_par *par = (struct atyfb_par *) info->par; in aty_var_to_crtc()
830 xres = (var->xres + 7) & ~7; in aty_var_to_crtc()
831 yres = var->yres; in aty_var_to_crtc()
832 vxres = (var->xres_virtual + 7) & ~7; in aty_var_to_crtc()
833 vyres = var->yres_virtual; in aty_var_to_crtc()
834 xoffset = (var->xoffset + 7) & ~7; in aty_var_to_crtc()
835 yoffset = var->yoffset; in aty_var_to_crtc()
836 bpp = var->bits_per_pixel; in aty_var_to_crtc()
838 bpp = (var->green.length == 5) ? 15 : 16; in aty_var_to_crtc()
839 sync = var->sync; in aty_var_to_crtc()
840 vmode = var->vmode; in aty_var_to_crtc()
886 if (vyres * line_length > info->fix.smem_len) in aty_var_to_crtc()
896 h_sync_strt = h_disp + var->right_margin; in aty_var_to_crtc()
897 h_sync_end = h_sync_strt + var->hsync_len; in aty_var_to_crtc()
898 h_sync_dly = var->right_margin & 7; in aty_var_to_crtc()
899 h_total = h_sync_end + h_sync_dly + var->left_margin; in aty_var_to_crtc()
901 v_sync_strt = v_disp + var->lower_margin; in aty_var_to_crtc()
902 v_sync_end = v_sync_strt + var->vsync_len; in aty_var_to_crtc()
903 v_total = v_sync_end + var->upper_margin; in aty_var_to_crtc()
906 if (par->lcd_table != 0) { in aty_var_to_crtc()
909 crtc->lcd_index = lcd_index & in aty_var_to_crtc()
916 crtc->lcd_index |= CRTC2_DISPLAY_DIS; in aty_var_to_crtc()
918 crtc->lcd_config_panel = aty_ld_lcd(CNFG_PANEL, par) | 0x4000; in aty_var_to_crtc()
919 crtc->lcd_gen_cntl = aty_ld_lcd(LCD_GEN_CNTL, par) & ~CRTC_RW_SELECT; in aty_var_to_crtc()
921 crtc->lcd_gen_cntl &= in aty_var_to_crtc()
925 crtc->lcd_gen_cntl |= DONT_SHADOW_VPAR | LOCK_8DOT; in aty_var_to_crtc()
927 if ((crtc->lcd_gen_cntl & LCD_ON) && in aty_var_to_crtc()
928 ((xres > par->lcd_width) || (yres > par->lcd_height))) { in aty_var_to_crtc()
936 if (crtc->lcd_gen_cntl & CRT_ON) { in aty_var_to_crtc()
937 if (!(var->activate & FB_ACTIVATE_TEST)) in aty_var_to_crtc()
939 crtc->lcd_gen_cntl &= ~LCD_ON; in aty_var_to_crtc()
940 /*aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl, par);*/ in aty_var_to_crtc()
942 if (!(var->activate & FB_ACTIVATE_TEST)) in aty_var_to_crtc()
944 return -EINVAL; in aty_var_to_crtc()
949 if ((par->lcd_table != 0) && (crtc->lcd_gen_cntl & LCD_ON)) { in aty_var_to_crtc()
951 /* bpp -> bytespp, 1,4 -> 0; 8 -> 2; 15,16 -> 1; 24 -> 6; 32 -> 5 in aty_var_to_crtc()
966 if (yres < par->lcd_height) { in aty_var_to_crtc()
967 VScan = par->lcd_height / yres; in aty_var_to_crtc()
974 h_sync_strt = h_disp + par->lcd_right_margin; in aty_var_to_crtc()
975 h_sync_end = h_sync_strt + par->lcd_hsync_len; in aty_var_to_crtc()
976 h_sync_dly = /*DFP_h_sync_dly[ ( bpp + 1 ) / 3 ]; */par->lcd_hsync_dly; in aty_var_to_crtc()
977 h_total = h_disp + par->lcd_hblank_len; in aty_var_to_crtc()
979 v_sync_strt = v_disp + par->lcd_lower_margin / VScan; in aty_var_to_crtc()
980 v_sync_end = v_sync_strt + par->lcd_vsync_len / VScan; in aty_var_to_crtc()
981 v_total = v_disp + par->lcd_vblank_len / VScan; in aty_var_to_crtc()
985 h_disp = (h_disp >> 3) - 1; in aty_var_to_crtc()
986 h_sync_strt = (h_sync_strt >> 3) - 1; in aty_var_to_crtc()
987 h_sync_end = (h_sync_end >> 3) - 1; in aty_var_to_crtc()
988 h_total = (h_total >> 3) - 1; in aty_var_to_crtc()
989 h_sync_wid = h_sync_end - h_sync_strt; in aty_var_to_crtc()
1005 v_disp--; in aty_var_to_crtc()
1006 v_sync_strt--; in aty_var_to_crtc()
1007 v_sync_end--; in aty_var_to_crtc()
1008 v_total--; in aty_var_to_crtc()
1009 v_sync_wid = v_sync_end - v_sync_strt; in aty_var_to_crtc()
1021 crtc->vxres = vxres; in aty_var_to_crtc()
1022 crtc->vyres = vyres; in aty_var_to_crtc()
1023 crtc->xoffset = xoffset; in aty_var_to_crtc()
1024 crtc->yoffset = yoffset; in aty_var_to_crtc()
1025 crtc->bpp = bpp; in aty_var_to_crtc()
1026 crtc->off_pitch = in aty_var_to_crtc()
1029 crtc->vline_crnt_vline = 0; in aty_var_to_crtc()
1031 crtc->h_tot_disp = h_total | (h_disp << 16); in aty_var_to_crtc()
1032 crtc->h_sync_strt_wid = (h_sync_strt & 0xff) | (h_sync_dly << 8) | in aty_var_to_crtc()
1035 crtc->v_tot_disp = v_total | (v_disp << 16); in aty_var_to_crtc()
1036 crtc->v_sync_strt_wid = v_sync_strt | (v_sync_wid << 16) | in aty_var_to_crtc()
1039 /* crtc->gen_cntl = aty_ld_le32(CRTC_GEN_CNTL, par) & CRTC_PRESERVED_MASK; */ in aty_var_to_crtc()
1040 crtc->gen_cntl = CRTC_EXT_DISP_EN | CRTC_EN | pix_width | c_sync; in aty_var_to_crtc()
1041 crtc->gen_cntl |= CRTC_VGA_LINEAR; in aty_var_to_crtc()
1045 crtc->gen_cntl |= CRTC_DBL_SCAN_EN; in aty_var_to_crtc()
1048 crtc->gen_cntl |= CRTC_INTERLACE_EN; in aty_var_to_crtc()
1050 if (par->lcd_table != 0) { in aty_var_to_crtc()
1054 crtc->gen_cntl &= ~(CRTC2_EN | CRTC2_PIX_WIDTH); in aty_var_to_crtc()
1055 crtc->lcd_gen_cntl &= ~(HORZ_DIVBY2_EN | DIS_HOR_CRT_DIVBY2 | in aty_var_to_crtc()
1060 crtc->lcd_gen_cntl |= DONT_SHADOW_VPAR/* | LOCK_8DOT*/; in aty_var_to_crtc()
1063 crtc->horz_stretching = aty_ld_lcd(HORZ_STRETCHING, par); in aty_var_to_crtc()
1065 crtc->ext_vert_stretch = aty_ld_lcd(EXT_VERT_STRETCH, par) & in aty_var_to_crtc()
1068 crtc->horz_stretching &= ~(HORZ_STRETCH_RATIO | in aty_var_to_crtc()
1071 if (xres < par->lcd_width && crtc->lcd_gen_cntl & LCD_ON) { in aty_var_to_crtc()
1076 * (440 for a 1024-wide panel). It doesn't in aty_var_to_crtc()
1081 * option allows the pixel-replicated mode to in aty_var_to_crtc()
1085 * pixel-replicated, rather than blended. in aty_var_to_crtc()
1088 int nStretch = par->lcd_width / HDisplay; in aty_var_to_crtc()
1089 int Remainder = par->lcd_width % HDisplay; in aty_var_to_crtc()
1092 (((HDisplay * 16) / par->lcd_width) < 7)) { in aty_var_to_crtc()
1094 int horz_stretch_loop = -1, BestRemainder; in aty_var_to_crtc()
1095 int Numerator = HDisplay, Denominator = par->lcd_width; in aty_var_to_crtc()
1100 while (--Index >= 0) { in aty_var_to_crtc()
1101 Remainder = ((Denominator - Numerator) * StretchLoops[Index]) % in aty_var_to_crtc()
1116 while (--Index >= 0) { in aty_var_to_crtc()
1121 Accumulator -= Numerator; in aty_var_to_crtc()
1125 crtc->horz_stretching |= (HORZ_STRETCH_EN | in aty_var_to_crtc()
1132 crtc->horz_stretching |= (HORZ_STRETCH_MODE | HORZ_STRETCH_EN | in aty_var_to_crtc()
1133 (((HDisplay * (HORZ_STRETCH_BLEND + 1)) / par->lcd_width) & HORZ_STRETCH_BLEND)); in aty_var_to_crtc()
1137 if (vdisplay < par->lcd_height && crtc->lcd_gen_cntl & LCD_ON) { in aty_var_to_crtc()
1138 crtc->vert_stretching = (VERT_STRETCH_USE0 | VERT_STRETCH_EN | in aty_var_to_crtc()
1139 (((vdisplay * (VERT_STRETCH_RATIO0 + 1)) / par->lcd_height) & VERT_STRETCH_RATIO0)); in aty_var_to_crtc()
1143 crtc->ext_vert_stretch |= VERT_STRETCH_MODE; in aty_var_to_crtc()
1149 crtc->vert_stretching = 0; in aty_var_to_crtc()
1152 crtc->shadow_h_tot_disp = crtc->h_tot_disp; in aty_var_to_crtc()
1153 crtc->shadow_h_sync_strt_wid = crtc->h_sync_strt_wid; in aty_var_to_crtc()
1154 crtc->shadow_v_tot_disp = crtc->v_tot_disp; in aty_var_to_crtc()
1155 crtc->shadow_v_sync_strt_wid = crtc->v_sync_strt_wid; in aty_var_to_crtc()
1161 crtc->gen_cntl |= (aty_ld_le32(CRTC_GEN_CNTL, par) & CRTC_FIFO_LWM); in aty_var_to_crtc()
1163 crtc->dp_pix_width = dp_pix_width; in aty_var_to_crtc()
1164 crtc->dp_chain_mask = dp_chain_mask; in aty_var_to_crtc()
1179 h_total = crtc->h_tot_disp & 0x1ff; in aty_crtc_to_var()
1180 h_disp = (crtc->h_tot_disp >> 16) & 0xff; in aty_crtc_to_var()
1181 h_sync_strt = (crtc->h_sync_strt_wid & 0xff) | ((crtc->h_sync_strt_wid >> 4) & 0x100); in aty_crtc_to_var()
1182 h_sync_dly = (crtc->h_sync_strt_wid >> 8) & 0x7; in aty_crtc_to_var()
1183 h_sync_wid = (crtc->h_sync_strt_wid >> 16) & 0x1f; in aty_crtc_to_var()
1184 h_sync_pol = (crtc->h_sync_strt_wid >> 21) & 0x1; in aty_crtc_to_var()
1185 v_total = crtc->v_tot_disp & 0x7ff; in aty_crtc_to_var()
1186 v_disp = (crtc->v_tot_disp >> 16) & 0x7ff; in aty_crtc_to_var()
1187 v_sync_strt = crtc->v_sync_strt_wid & 0x7ff; in aty_crtc_to_var()
1188 v_sync_wid = (crtc->v_sync_strt_wid >> 16) & 0x1f; in aty_crtc_to_var()
1189 v_sync_pol = (crtc->v_sync_strt_wid >> 21) & 0x1; in aty_crtc_to_var()
1190 c_sync = crtc->gen_cntl & CRTC_CSYNC_EN ? 1 : 0; in aty_crtc_to_var()
1191 pix_width = crtc->gen_cntl & CRTC_PIX_WIDTH_MASK; in aty_crtc_to_var()
1192 double_scan = crtc->gen_cntl & CRTC_DBL_SCAN_EN; in aty_crtc_to_var()
1193 interlace = crtc->gen_cntl & CRTC_INTERLACE_EN; in aty_crtc_to_var()
1198 left = (h_total - h_sync_strt - h_sync_wid) * 8 - h_sync_dly; in aty_crtc_to_var()
1199 right = (h_sync_strt - h_disp) * 8 + h_sync_dly; in aty_crtc_to_var()
1201 upper = v_total - v_sync_strt - v_sync_wid; in aty_crtc_to_var()
1202 lower = v_sync_strt - v_disp; in aty_crtc_to_var()
1211 var->red.offset = 0; in aty_crtc_to_var()
1212 var->red.length = 8; in aty_crtc_to_var()
1213 var->green.offset = 0; in aty_crtc_to_var()
1214 var->green.length = 8; in aty_crtc_to_var()
1215 var->blue.offset = 0; in aty_crtc_to_var()
1216 var->blue.length = 8; in aty_crtc_to_var()
1217 var->transp.offset = 0; in aty_crtc_to_var()
1218 var->transp.length = 0; in aty_crtc_to_var()
1222 var->red.offset = 10; in aty_crtc_to_var()
1223 var->red.length = 5; in aty_crtc_to_var()
1224 var->green.offset = 5; in aty_crtc_to_var()
1225 var->green.length = 5; in aty_crtc_to_var()
1226 var->blue.offset = 0; in aty_crtc_to_var()
1227 var->blue.length = 5; in aty_crtc_to_var()
1228 var->transp.offset = 0; in aty_crtc_to_var()
1229 var->transp.length = 0; in aty_crtc_to_var()
1233 var->red.offset = 11; in aty_crtc_to_var()
1234 var->red.length = 5; in aty_crtc_to_var()
1235 var->green.offset = 5; in aty_crtc_to_var()
1236 var->green.length = 6; in aty_crtc_to_var()
1237 var->blue.offset = 0; in aty_crtc_to_var()
1238 var->blue.length = 5; in aty_crtc_to_var()
1239 var->transp.offset = 0; in aty_crtc_to_var()
1240 var->transp.length = 0; in aty_crtc_to_var()
1244 var->red.offset = 16; in aty_crtc_to_var()
1245 var->red.length = 8; in aty_crtc_to_var()
1246 var->green.offset = 8; in aty_crtc_to_var()
1247 var->green.length = 8; in aty_crtc_to_var()
1248 var->blue.offset = 0; in aty_crtc_to_var()
1249 var->blue.length = 8; in aty_crtc_to_var()
1250 var->transp.offset = 0; in aty_crtc_to_var()
1251 var->transp.length = 0; in aty_crtc_to_var()
1255 var->red.offset = 16; in aty_crtc_to_var()
1256 var->red.length = 8; in aty_crtc_to_var()
1257 var->green.offset = 8; in aty_crtc_to_var()
1258 var->green.length = 8; in aty_crtc_to_var()
1259 var->blue.offset = 0; in aty_crtc_to_var()
1260 var->blue.length = 8; in aty_crtc_to_var()
1261 var->transp.offset = 24; in aty_crtc_to_var()
1262 var->transp.length = 8; in aty_crtc_to_var()
1266 return -EINVAL; in aty_crtc_to_var()
1270 var->xres = xres; in aty_crtc_to_var()
1271 var->yres = yres; in aty_crtc_to_var()
1272 var->xres_virtual = crtc->vxres; in aty_crtc_to_var()
1273 var->yres_virtual = crtc->vyres; in aty_crtc_to_var()
1274 var->bits_per_pixel = bpp; in aty_crtc_to_var()
1275 var->left_margin = left; in aty_crtc_to_var()
1276 var->right_margin = right; in aty_crtc_to_var()
1277 var->upper_margin = upper; in aty_crtc_to_var()
1278 var->lower_margin = lower; in aty_crtc_to_var()
1279 var->hsync_len = hslen; in aty_crtc_to_var()
1280 var->vsync_len = vslen; in aty_crtc_to_var()
1281 var->sync = sync; in aty_crtc_to_var()
1282 var->vmode = FB_VMODE_NONINTERLACED; in aty_crtc_to_var()
1290 var->vmode = FB_VMODE_INTERLACED; in aty_crtc_to_var()
1293 var->vmode = FB_VMODE_DOUBLE; in aty_crtc_to_var()
1294 var->yres >>= 1; in aty_crtc_to_var()
1295 var->upper_margin >>= 1; in aty_crtc_to_var()
1296 var->lower_margin >>= 1; in aty_crtc_to_var()
1297 var->vsync_len >>= 1; in aty_crtc_to_var()
1303 /* ------------------------------------------------------------------------- */
1307 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_set_par()
1308 struct fb_var_screeninfo *var = &info->var; in atyfb_set_par()
1315 if (par->asleep) in atyfb_set_par()
1318 err = aty_var_to_crtc(info, var, &par->crtc); in atyfb_set_par()
1326 return -EINVAL; in atyfb_set_par()
1328 err = par->pll_ops->var_to_pll(info, pixclock, in atyfb_set_par()
1329 var->bits_per_pixel, &par->pll); in atyfb_set_par()
1334 par->accel_flags = var->accel_flags; /* hack */ in atyfb_set_par()
1336 if (var->accel_flags) { in atyfb_set_par()
1338 info->flags &= ~FBINFO_HWACCEL_DISABLED; in atyfb_set_par()
1341 info->flags |= FBINFO_HWACCEL_DISABLED; in atyfb_set_par()
1344 if (par->blitter_may_be_busy) in atyfb_set_par()
1347 aty_set_crtc(par, &par->crtc); in atyfb_set_par()
1348 par->dac_ops->set_dac(info, &par->pll, in atyfb_set_par()
1349 var->bits_per_pixel, par->accel_flags); in atyfb_set_par()
1350 par->pll_ops->set_pll(info, &par->pll); in atyfb_set_par()
1353 if (par->pll_ops && par->pll_ops->pll_to_var) in atyfb_set_par()
1354 pixclock_in_ps = par->pll_ops->pll_to_var(info, &par->pll); in atyfb_set_par()
1359 PRINTKE("ALERT ops->pll_to_var get 0\n"); in atyfb_set_par()
1364 if (!aty_crtc_to_var(&par->crtc, &debug)) { in atyfb_set_par()
1380 if (par->crtc.gen_cntl & CRTC_INTERLACE_EN) in atyfb_set_par()
1382 if (par->crtc.gen_cntl & CRTC_DBL_SCAN_EN) in atyfb_set_par()
1386 DPRINTK(" Set Visible Mode to %ix%i-%i\n", in atyfb_set_par()
1387 var->xres, var->yres, var->bits_per_pixel); in atyfb_set_par()
1390 var->xres_virtual, var->yres_virtual, in atyfb_set_par()
1410 switch (var->bits_per_pixel) { in atyfb_set_par()
1425 tmp |= par->mem_refresh_rate << 20; in atyfb_set_par()
1426 switch (var->bits_per_pixel) { in atyfb_set_par()
1446 aty_st_le32(BUS_CNTL, 0x7b33a040 | (par->aux_start ? BUS_APER_REG_DIS : 0), par); in atyfb_set_par()
1450 aty_st_le32(BUS_CNTL, 0x7b23a040 | (par->aux_start ? BUS_APER_REG_DIS : 0), par); in atyfb_set_par()
1457 info->fix.line_length = calc_line_length(par, var->xres_virtual, in atyfb_set_par()
1458 var->bits_per_pixel); in atyfb_set_par()
1460 info->fix.visual = var->bits_per_pixel <= 8 ? in atyfb_set_par()
1464 if (par->accel_flags & FB_ACCELF_TEXT) in atyfb_set_par()
1468 btext_update_display(info->fix.smem_start, in atyfb_set_par()
1469 (((par->crtc.h_tot_disp >> 16) & 0xff) + 1) * 8, in atyfb_set_par()
1470 ((par->crtc.v_tot_disp >> 16) & 0x7ff) + 1, in atyfb_set_par()
1471 var->bits_per_pixel, in atyfb_set_par()
1472 par->crtc.vxres * var->bits_per_pixel / 8); in atyfb_set_par()
1477 int i; u32 base; in atyfb_set_par() local
1480 base = 0x2000; in atyfb_set_par()
1481 printk("debug atyfb: Mach64 non-shadow register values:"); in atyfb_set_par()
1485 printk("debug atyfb: 0x%04X: ", base + i); in atyfb_set_par()
1493 base = 0x00; in atyfb_set_par()
1498 printk("debug atyfb: 0x%02X: ", base + i); in atyfb_set_par()
1508 if (par->lcd_table != 0) { in atyfb_set_par()
1510 base = 0x00; in atyfb_set_par()
1524 base + i); in atyfb_set_par()
1538 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_check_var()
1544 memcpy(&pll, &par->pll, sizeof(pll)); in atyfb_check_var()
1553 if (!(var->activate & FB_ACTIVATE_TEST)) in atyfb_check_var()
1555 return -EINVAL; in atyfb_check_var()
1557 err = par->pll_ops->var_to_pll(info, pixclock, in atyfb_check_var()
1558 var->bits_per_pixel, &pll); in atyfb_check_var()
1563 if (var->accel_flags & FB_ACCELF_TEXT) in atyfb_check_var()
1564 info->var.accel_flags = FB_ACCELF_TEXT; in atyfb_check_var()
1566 info->var.accel_flags = 0; in atyfb_check_var()
1569 var->pixclock = par->pll_ops->pll_to_var(info, &pll); in atyfb_check_var()
1575 u32 xoffset = info->var.xoffset; in set_off_pitch()
1576 u32 yoffset = info->var.yoffset; in set_off_pitch()
1577 u32 line_length = info->fix.line_length; in set_off_pitch()
1578 u32 bpp = info->var.bits_per_pixel; in set_off_pitch()
1580 par->crtc.off_pitch = in set_off_pitch()
1592 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_open()
1595 par->open++; in atyfb_open()
1597 par->mmaped = 0; in atyfb_open()
1609 spin_lock(&par->int_lock); in aty_irq()
1617 par->vblank.count++; in aty_irq()
1618 if (par->vblank.pan_display) { in aty_irq()
1619 par->vblank.pan_display = 0; in aty_irq()
1620 aty_st_le32(CRTC_OFF_PITCH, par->crtc.off_pitch, par); in aty_irq()
1622 wake_up_interruptible(&par->vblank.wait); in aty_irq()
1626 spin_unlock(&par->int_lock); in aty_irq()
1635 if (!test_and_set_bit(0, &par->irq_flags)) { in aty_enable_irq()
1636 if (request_irq(par->irq, aty_irq, IRQF_SHARED, "atyfb", par)) { in aty_enable_irq()
1637 clear_bit(0, &par->irq_flags); in aty_enable_irq()
1638 return -EINVAL; in aty_enable_irq()
1640 spin_lock_irq(&par->int_lock); in aty_enable_irq()
1646 spin_unlock_irq(&par->int_lock); in aty_enable_irq()
1648 spin_lock_irq(&par->int_lock); in aty_enable_irq()
1653 /* re-enable interrupt */ in aty_enable_irq()
1657 spin_unlock_irq(&par->int_lock); in aty_enable_irq()
1667 if (test_and_clear_bit(0, &par->irq_flags)) { in aty_disable_irq()
1668 if (par->vblank.pan_display) { in aty_disable_irq()
1669 par->vblank.pan_display = 0; in aty_disable_irq()
1670 aty_st_le32(CRTC_OFF_PITCH, par->crtc.off_pitch, par); in aty_disable_irq()
1672 spin_lock_irq(&par->int_lock); in aty_disable_irq()
1676 spin_unlock_irq(&par->int_lock); in aty_disable_irq()
1677 free_irq(par->irq, par); in aty_disable_irq()
1685 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_release()
1693 par->open--; in atyfb_release()
1697 if (par->open) in atyfb_release()
1701 was_mmaped = par->mmaped; in atyfb_release()
1703 par->mmaped = 0; in atyfb_release()
1720 u32 videoram = (info->fix.smem_len - (PAGE_SIZE << 2)); in atyfb_release()
1743 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_pan_display()
1746 xres = (((par->crtc.h_tot_disp >> 16) & 0xff) + 1) * 8; in atyfb_pan_display()
1747 yres = ((par->crtc.v_tot_disp >> 16) & 0x7ff) + 1; in atyfb_pan_display()
1748 if (par->crtc.gen_cntl & CRTC_DBL_SCAN_EN) in atyfb_pan_display()
1750 xoffset = (var->xoffset + 7) & ~7; in atyfb_pan_display()
1751 yoffset = var->yoffset; in atyfb_pan_display()
1752 if (xoffset + xres > par->crtc.vxres || in atyfb_pan_display()
1753 yoffset + yres > par->crtc.vyres) in atyfb_pan_display()
1754 return -EINVAL; in atyfb_pan_display()
1755 info->var.xoffset = xoffset; in atyfb_pan_display()
1756 info->var.yoffset = yoffset; in atyfb_pan_display()
1757 if (par->asleep) in atyfb_pan_display()
1761 if ((var->activate & FB_ACTIVATE_VBL) && !aty_enable_irq(par, 0)) { in atyfb_pan_display()
1762 par->vblank.pan_display = 1; in atyfb_pan_display()
1764 par->vblank.pan_display = 0; in atyfb_pan_display()
1765 aty_st_le32(CRTC_OFF_PITCH, par->crtc.off_pitch, par); in atyfb_pan_display()
1779 vbl = &par->vblank; in aty_waitforvblank()
1782 return -ENODEV; in aty_waitforvblank()
1789 count = vbl->count; in aty_waitforvblank()
1790 ret = wait_event_interruptible_timeout(vbl->wait, in aty_waitforvblank()
1791 count != vbl->count, HZ/10); in aty_waitforvblank()
1796 return -ETIMEDOUT; in aty_waitforvblank()
1816 u32 dsp_xclks_per_row; /* 0-16383 */
1817 u32 dsp_loop_latency; /* 0-15 */
1818 u32 dsp_precision; /* 0-7 */
1819 u32 dsp_on; /* 0-2047 */
1820 u32 dsp_off; /* 0-2047 */
1829 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_ioctl()
1838 fbtyp.fb_width = par->crtc.vxres; in atyfb_ioctl()
1839 fbtyp.fb_height = par->crtc.vyres; in atyfb_ioctl()
1840 fbtyp.fb_depth = info->var.bits_per_pixel; in atyfb_ioctl()
1841 fbtyp.fb_cmsize = info->cmap.len; in atyfb_ioctl()
1842 fbtyp.fb_size = info->fix.smem_len; in atyfb_ioctl()
1845 return -EFAULT; in atyfb_ioctl()
1854 return -EFAULT; in atyfb_ioctl()
1863 union aty_pll *pll = &par->pll; in atyfb_ioctl()
1864 u32 dsp_config = pll->ct.dsp_config; in atyfb_ioctl()
1865 u32 dsp_on_off = pll->ct.dsp_on_off; in atyfb_ioctl()
1866 clk.ref_clk_per = par->ref_clk_per; in atyfb_ioctl()
1867 clk.pll_ref_div = pll->ct.pll_ref_div; in atyfb_ioctl()
1868 clk.mclk_fb_div = pll->ct.mclk_fb_div; in atyfb_ioctl()
1869 clk.mclk_post_div = pll->ct.mclk_post_div_real; in atyfb_ioctl()
1870 clk.mclk_fb_mult = pll->ct.mclk_fb_mult; in atyfb_ioctl()
1871 clk.xclk_post_div = pll->ct.xclk_post_div_real; in atyfb_ioctl()
1872 clk.vclk_fb_div = pll->ct.vclk_fb_div; in atyfb_ioctl()
1873 clk.vclk_post_div = pll->ct.vclk_post_div_real; in atyfb_ioctl()
1881 return -EFAULT; in atyfb_ioctl()
1883 return -EINVAL; in atyfb_ioctl()
1888 union aty_pll *pll = &par->pll; in atyfb_ioctl()
1891 return -EFAULT; in atyfb_ioctl()
1892 par->ref_clk_per = clk.ref_clk_per; in atyfb_ioctl()
1893 pll->ct.pll_ref_div = clk.pll_ref_div; in atyfb_ioctl()
1894 pll->ct.mclk_fb_div = clk.mclk_fb_div; in atyfb_ioctl()
1895 pll->ct.mclk_post_div_real = clk.mclk_post_div; in atyfb_ioctl()
1896 pll->ct.mclk_fb_mult = clk.mclk_fb_mult; in atyfb_ioctl()
1897 pll->ct.xclk_post_div_real = clk.xclk_post_div; in atyfb_ioctl()
1898 pll->ct.vclk_fb_div = clk.vclk_fb_div; in atyfb_ioctl()
1899 pll->ct.vclk_post_div_real = clk.vclk_post_div; in atyfb_ioctl()
1900 pll->ct.dsp_config = (clk.dsp_xclks_per_row & 0x3fff) | in atyfb_ioctl()
1903 pll->ct.dsp_on_off = (clk.dsp_off & 0x7ff) | in atyfb_ioctl()
1905 /*aty_calc_pll_ct(info, &pll->ct);*/ in atyfb_ioctl()
1908 return -EINVAL; in atyfb_ioctl()
1911 if (get_user(par->features, (u32 __user *) arg)) in atyfb_ioctl()
1912 return -EFAULT; in atyfb_ioctl()
1915 if (put_user(par->features, (u32 __user *) arg)) in atyfb_ioctl()
1916 return -EFAULT; in atyfb_ioctl()
1920 return -EINVAL; in atyfb_ioctl()
1927 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_sync()
1929 if (par->blitter_may_be_busy) in atyfb_sync()
1937 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_mmap()
1943 if (!par->mmap_map) in atyfb_mmap()
1944 return -ENXIO; in atyfb_mmap()
1946 if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) in atyfb_mmap()
1947 return -EINVAL; in atyfb_mmap()
1949 off = vma->vm_pgoff << PAGE_SHIFT; in atyfb_mmap()
1950 size = vma->vm_end - vma->vm_start; in atyfb_mmap()
1954 if (((vma->vm_pgoff == 0) && (size == info->fix.smem_len)) || in atyfb_mmap()
1955 ((off == info->fix.smem_len) && (size == PAGE_SIZE))) in atyfb_mmap()
1958 vma->vm_pgoff = off >> PAGE_SHIFT; /* propagate off changes */ in atyfb_mmap()
1963 for (i = 0; par->mmap_map[i].size; i++) { in atyfb_mmap()
1964 unsigned long start = par->mmap_map[i].voff; in atyfb_mmap()
1965 unsigned long end = start + par->mmap_map[i].size; in atyfb_mmap()
1973 map_size = par->mmap_map[i].size - (offset - start); in atyfb_mmap()
1974 map_offset = par->mmap_map[i].poff + (offset - start); in atyfb_mmap()
1982 map_size = size - page; in atyfb_mmap()
1984 pgprot_val(vma->vm_page_prot) &= ~(par->mmap_map[i].prot_mask); in atyfb_mmap()
1985 pgprot_val(vma->vm_page_prot) |= par->mmap_map[i].prot_flag; in atyfb_mmap()
1987 if (remap_pfn_range(vma, vma->vm_start + page, in atyfb_mmap()
1988 map_offset >> PAGE_SHIFT, map_size, vma->vm_page_prot)) in atyfb_mmap()
1989 return -EAGAIN; in atyfb_mmap()
1995 return -EINVAL; in atyfb_mmap()
1997 if (!par->mmaped) in atyfb_mmap()
1998 par->mmaped = 1; in atyfb_mmap()
2037 if ((--timeout) == 0) in aty_power_mgmt()
2056 if ((--timeout) == 0) in aty_power_mgmt()
2062 return timeout ? 0 : -EIO; in aty_power_mgmt()
2070 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_pci_suspend_late()
2072 if (state.event == pdev->dev.power.power_state.event) in atyfb_pci_suspend_late()
2086 par->asleep = 1; in atyfb_pci_suspend_late()
2087 par->lock_blank = 1; in atyfb_pci_suspend_late()
2098 par->asleep = 0; in atyfb_pci_suspend_late()
2099 par->lock_blank = 0; in atyfb_pci_suspend_late()
2103 return -EIO; in atyfb_pci_suspend_late()
2109 pdev->dev.power.power_state = state; in atyfb_pci_suspend_late()
2131 struct atyfb_par *par = info->par; in aty_resume_chip()
2133 aty_st_le32(MEM_CNTL, par->mem_cntl, par); in aty_resume_chip()
2135 if (par->pll_ops->resume_pll) in aty_resume_chip()
2136 par->pll_ops->resume_pll(info, &par->pll); in aty_resume_chip()
2138 if (par->aux_start) in aty_resume_chip()
2147 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_pci_resume()
2149 if (pdev->dev.power.power_state.event == PM_EVENT_ON) in atyfb_pci_resume()
2162 pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) in atyfb_pci_resume()
2168 par->asleep = 0; in atyfb_pci_resume()
2177 par->lock_blank = 0; in atyfb_pci_resume()
2182 pdev->dev.power.power_state = PMSG_ON; in atyfb_pci_resume()
2206 struct fb_info *info = pci_get_drvdata(par->pdev); in aty_bl_get_level_brightness()
2211 atylevel = info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_LEVEL; in aty_bl_get_level_brightness()
2247 struct fb_info *info = pci_get_drvdata(par->pdev); in aty_bl_init()
2252 if (!pmac_has_backlight_type("ati")) in aty_bl_init()
2256 snprintf(name, sizeof(name), "atybl%d", info->node); in aty_bl_init()
2260 props.max_brightness = FB_BACKLIGHT_LEVELS - 1; in aty_bl_init()
2261 bd = backlight_device_register(name, info->device, par, &aty_bl_data, in aty_bl_init()
2264 info->bl_dev = NULL; in aty_bl_init()
2269 info->bl_dev = bd; in aty_bl_init()
2274 bd->props.brightness = bd->props.max_brightness; in aty_bl_init()
2275 bd->props.power = FB_BLANK_UNBLANK; in aty_bl_init()
2320 par->mem_refresh_rate = i; in aty_calc_mem_refresh()
2333 int ret = -EINVAL; in atyfb_get_timings_from_lcd()
2335 if (par->lcd_table != 0 && (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) { in atyfb_get_timings_from_lcd()
2337 var->xres = var->xres_virtual = par->lcd_hdisp; in atyfb_get_timings_from_lcd()
2338 var->right_margin = par->lcd_right_margin; in atyfb_get_timings_from_lcd()
2339 var->left_margin = par->lcd_hblank_len - in atyfb_get_timings_from_lcd()
2340 (par->lcd_right_margin + par->lcd_hsync_dly + in atyfb_get_timings_from_lcd()
2341 par->lcd_hsync_len); in atyfb_get_timings_from_lcd()
2342 var->hsync_len = par->lcd_hsync_len + par->lcd_hsync_dly; in atyfb_get_timings_from_lcd()
2343 var->yres = var->yres_virtual = par->lcd_vdisp; in atyfb_get_timings_from_lcd()
2344 var->lower_margin = par->lcd_lower_margin; in atyfb_get_timings_from_lcd()
2345 var->upper_margin = par->lcd_vblank_len - in atyfb_get_timings_from_lcd()
2346 (par->lcd_lower_margin + par->lcd_vsync_len); in atyfb_get_timings_from_lcd()
2347 var->vsync_len = par->lcd_vsync_len; in atyfb_get_timings_from_lcd()
2348 var->pixclock = par->lcd_pixclock; in atyfb_get_timings_from_lcd()
2358 struct atyfb_par *par = (struct atyfb_par *) info->par; in aty_init()
2367 init_waitqueue_head(&par->vblank.wait); in aty_init()
2368 spin_lock_init(&par->int_lock); in aty_init()
2375 par->bus_type = (stat0 >> 0) & 0x07; in aty_init()
2376 par->ram_type = (stat0 >> 3) & 0x07; in aty_init()
2377 ramname = aty_gx_ram[par->ram_type]; in aty_init()
2392 par->dac_ops = &aty_dac_ibm514; in aty_init()
2397 par->dac_ops = &aty_dac_ati68860b; in aty_init()
2401 par->dac_ops = &aty_dac_att21c498; in aty_init()
2406 par->dac_ops = &aty_dac_unsupported; in aty_init()
2412 par->pll_ops = &aty_pll_ati18818_1; in aty_init()
2416 par->pll_ops = &aty_pll_ibm514; in aty_init()
2421 par->pll_ops = &aty_pll_unsupported; in aty_init()
2428 par->dac_ops = &aty_dac_ct; in aty_init()
2429 par->pll_ops = &aty_pll_ct; in aty_init()
2430 par->bus_type = PCI; in aty_init()
2431 par->ram_type = (aty_ld_le32(CNFG_STAT0, par) & 0x07); in aty_init()
2433 ramname = aty_xl_ram[par->ram_type]; in aty_init()
2435 ramname = aty_ct_ram[par->ram_type]; in aty_init()
2437 if (par->pll_limits.mclk == 67 && par->ram_type < SDRAM) in aty_init()
2438 par->pll_limits.mclk = 63; in aty_init()
2440 if (M64_HAS(MOBIL_BUS) && par->ram_type == SDRAM32) in aty_init()
2441 par->pll_limits.xclk = (par->pll_limits.xclk + 1) >> 1; in aty_init()
2446 * The Apple iBook1 uses non-standard memory frequencies. in aty_init()
2450 par->pll_limits.mclk = 70; in aty_init()
2451 par->pll_limits.xclk = 53; in aty_init()
2457 par->pll_limits.pll_max = pll; in aty_init()
2459 par->pll_limits.mclk = mclk; in aty_init()
2461 par->pll_limits.xclk = xclk; in aty_init()
2463 aty_calc_mem_refresh(par, par->pll_limits.xclk); in aty_init()
2464 par->pll_per = 1000000/par->pll_limits.pll_max; in aty_init()
2465 par->mclk_per = 1000000/par->pll_limits.mclk; in aty_init()
2466 par->xclk_per = 1000000/par->pll_limits.xclk; in aty_init()
2468 par->ref_clk_per = 1000000000000ULL / 14318180; in aty_init()
2477 diff1 = 510 * 14 / pll_ref_div - par->pll_limits.pll_max; in aty_init()
2478 diff2 = 510 * 29 / pll_ref_div - par->pll_limits.pll_max; in aty_init()
2480 diff1 = -diff1; in aty_init()
2482 diff2 = -diff2; in aty_init()
2484 par->ref_clk_per = 1000000000000ULL / 29498928; in aty_init()
2492 aty_get_crtc(par, &par->saved_crtc); in aty_init()
2493 if (par->pll_ops->get_pll) in aty_init()
2494 par->pll_ops->get_pll(info, &par->saved_pll); in aty_init()
2496 par->mem_cntl = aty_ld_le32(MEM_CNTL, par); in aty_init()
2500 switch (par->mem_cntl & 0xF) { in aty_init()
2502 info->fix.smem_len = 0x80000; in aty_init()
2505 info->fix.smem_len = 0x100000; in aty_init()
2508 info->fix.smem_len = 0x200000; in aty_init()
2511 info->fix.smem_len = 0x400000; in aty_init()
2514 info->fix.smem_len = 0x600000; in aty_init()
2517 info->fix.smem_len = 0x800000; in aty_init()
2520 info->fix.smem_len = 0x80000; in aty_init()
2522 switch (par->mem_cntl & MEM_SIZE_ALIAS) { in aty_init()
2524 info->fix.smem_len = 0x80000; in aty_init()
2527 info->fix.smem_len = 0x100000; in aty_init()
2530 info->fix.smem_len = 0x200000; in aty_init()
2533 info->fix.smem_len = 0x400000; in aty_init()
2536 info->fix.smem_len = 0x600000; in aty_init()
2539 info->fix.smem_len = 0x800000; in aty_init()
2542 info->fix.smem_len = 0x80000; in aty_init()
2547 info->fix.smem_len += 0x400000; in aty_init()
2551 info->fix.smem_len = vram * 1024; in aty_init()
2552 par->mem_cntl &= ~(gtb_memsize ? 0xF : MEM_SIZE_ALIAS); in aty_init()
2553 if (info->fix.smem_len <= 0x80000) in aty_init()
2554 par->mem_cntl |= MEM_SIZE_512K; in aty_init()
2555 else if (info->fix.smem_len <= 0x100000) in aty_init()
2556 par->mem_cntl |= MEM_SIZE_1M; in aty_init()
2557 else if (info->fix.smem_len <= 0x200000) in aty_init()
2558 par->mem_cntl |= gtb_memsize ? MEM_SIZE_2M_GTB : MEM_SIZE_2M; in aty_init()
2559 else if (info->fix.smem_len <= 0x400000) in aty_init()
2560 par->mem_cntl |= gtb_memsize ? MEM_SIZE_4M_GTB : MEM_SIZE_4M; in aty_init()
2561 else if (info->fix.smem_len <= 0x600000) in aty_init()
2562 par->mem_cntl |= gtb_memsize ? MEM_SIZE_6M_GTB : MEM_SIZE_6M; in aty_init()
2564 par->mem_cntl |= gtb_memsize ? MEM_SIZE_8M_GTB : MEM_SIZE_8M; in aty_init()
2565 aty_st_le32(MEM_CNTL, par->mem_cntl, par); in aty_init()
2569 * Reg Block 0 (CT-compatible block) is at mmio_start in aty_init()
2570 * Reg Block 1 (multimedia extensions) is at mmio_start - 0x400 in aty_init()
2573 info->fix.mmio_len = 0x400; in aty_init()
2574 info->fix.accel = FB_ACCEL_ATI_MACH64GX; in aty_init()
2576 info->fix.mmio_len = 0x400; in aty_init()
2577 info->fix.accel = FB_ACCEL_ATI_MACH64CT; in aty_init()
2579 info->fix.mmio_start -= 0x400; in aty_init()
2580 info->fix.mmio_len = 0x800; in aty_init()
2581 info->fix.accel = FB_ACCEL_ATI_MACH64VT; in aty_init()
2583 info->fix.mmio_start -= 0x400; in aty_init()
2584 info->fix.mmio_len = 0x800; in aty_init()
2585 info->fix.accel = FB_ACCEL_ATI_MACH64GT; in aty_init()
2589 info->fix.smem_len == 0x80000 ? 512 : (info->fix.smem_len>>20), in aty_init()
2590 info->fix.smem_len == 0x80000 ? 'K' : 'M', ramname, xtal, in aty_init()
2591 par->pll_limits.pll_max, par->pll_limits.mclk, in aty_init()
2592 par->pll_limits.xclk); in aty_init()
2617 if (par->pll_ops->init_pll) in aty_init()
2618 par->pll_ops->init_pll(info, &par->pll); in aty_init()
2619 if (par->pll_ops->resume_pll) in aty_init()
2620 par->pll_ops->resume_pll(info, &par->pll); in aty_init()
2629 if (par->aux_start) in aty_init()
2638 par->wc_cookie = arch_phys_wc_add(par->res_start, in aty_init()
2639 par->res_size); in aty_init()
2641 info->fbops = &atyfb_ops; in aty_init()
2642 info->pseudo_palette = par->pseudo_palette; in aty_init()
2643 info->flags = FBINFO_HWACCEL_IMAGEBLIT | in aty_init()
2653 * wake up from sleep -- paulus in aty_init()
2664 * FIXME: The NVRAM stuff should be put in a Mac-specific file, in aty_init()
2715 if (comp_sync != -1) { in aty_init()
2723 u32 videoram = (info->fix.smem_len - (PAGE_SIZE << 2)); in aty_init()
2739 info->var = var; in aty_init()
2741 ret = fb_alloc_cmap(&info->cmap, 256, 0); in aty_init()
2747 fb_dealloc_cmap(&info->cmap); in aty_init()
2760 info->node, info->fix.id, par->bus_type == ISA ? "ISA" : "PCI"); in aty_init()
2765 aty_set_crtc(par, &par->saved_crtc); in aty_init()
2766 par->pll_ops->set_pll(info, &par->saved_pll); in aty_init()
2767 arch_phys_wc_del(par->wc_cookie); in aty_init()
2799 return -1; in store_video_par()
2809 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_blank()
2812 if (par->lock_blank || par->asleep) in atyfb_blank()
2816 if (par->lcd_table && blank > FB_BLANK_NORMAL && in atyfb_blank()
2845 if (par->lcd_table && blank <= FB_BLANK_NORMAL && in atyfb_blank()
2875 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_setcolreg()
2877 u32 *pal = info->pseudo_palette; in atyfb_setcolreg()
2879 depth = info->var.bits_per_pixel; in atyfb_setcolreg()
2881 depth = (info->var.green.length == 5) ? 15 : 16; in atyfb_setcolreg()
2883 if (par->asleep) in atyfb_setcolreg()
2895 par->palette[regno].red = red; in atyfb_setcolreg()
2896 par->palette[regno].green = green; in atyfb_setcolreg()
2897 par->palette[regno].blue = blue; in atyfb_setcolreg()
2927 par->palette[regno << 1].green, in atyfb_setcolreg()
2929 red = par->palette[regno >> 1].red; in atyfb_setcolreg()
2930 blue = par->palette[regno >> 1].blue; in atyfb_setcolreg()
2950 struct atyfb_par *par = info->par; in atyfb_setup_sparc()
2956 * Map memory-mapped registers. in atyfb_setup_sparc()
2958 par->ati_regbase = (void *)addr + 0x7ffc00UL; in atyfb_setup_sparc()
2959 info->fix.mmio_start = addr + 0x7ffc00UL; in atyfb_setup_sparc()
2962 * Map in big-endian aperture. in atyfb_setup_sparc()
2964 info->screen_base = (char *) (addr + 0x800000UL); in atyfb_setup_sparc()
2965 info->fix.smem_start = addr + 0x800000UL; in atyfb_setup_sparc()
2969 * Split Framebuffer in big- and little-endian halfs. in atyfb_setup_sparc()
2971 for (i = 0; i < 6 && pdev->resource[i].start; i++) in atyfb_setup_sparc()
2975 par->mmap_map = kcalloc(j, sizeof(*par->mmap_map), GFP_ATOMIC); in atyfb_setup_sparc()
2976 if (!par->mmap_map) { in atyfb_setup_sparc()
2978 return -ENOMEM; in atyfb_setup_sparc()
2981 for (i = 0, j = 2; i < 6 && pdev->resource[i].start; i++) { in atyfb_setup_sparc()
2982 struct resource *rp = &pdev->resource[i]; in atyfb_setup_sparc()
2984 unsigned long base; in atyfb_setup_sparc() local
2987 base = rp->start; in atyfb_setup_sparc()
2989 io = (rp->flags & IORESOURCE_IO); in atyfb_setup_sparc()
2991 size = rp->end - base + 1; in atyfb_setup_sparc()
3004 if (base == addr) { in atyfb_setup_sparc()
3005 par->mmap_map[j].voff = (pbase + 0x10000000) & PAGE_MASK; in atyfb_setup_sparc()
3006 par->mmap_map[j].poff = base & PAGE_MASK; in atyfb_setup_sparc()
3007 par->mmap_map[j].size = (size + ~PAGE_MASK) & PAGE_MASK; in atyfb_setup_sparc()
3008 par->mmap_map[j].prot_mask = _PAGE_CACHE; in atyfb_setup_sparc()
3009 par->mmap_map[j].prot_flag = _PAGE_E; in atyfb_setup_sparc()
3017 if (base == addr) { in atyfb_setup_sparc()
3018 par->mmap_map[j].voff = (pbase + 0x800000) & PAGE_MASK; in atyfb_setup_sparc()
3019 par->mmap_map[j].poff = (base + 0x800000) & PAGE_MASK; in atyfb_setup_sparc()
3020 par->mmap_map[j].size = 0x800000; in atyfb_setup_sparc()
3021 par->mmap_map[j].prot_mask = _PAGE_CACHE; in atyfb_setup_sparc()
3022 par->mmap_map[j].prot_flag = _PAGE_E | _PAGE_IE; in atyfb_setup_sparc()
3023 size -= 0x800000; in atyfb_setup_sparc()
3027 par->mmap_map[j].voff = pbase & PAGE_MASK; in atyfb_setup_sparc()
3028 par->mmap_map[j].poff = base & PAGE_MASK; in atyfb_setup_sparc()
3029 par->mmap_map[j].size = (size + ~PAGE_MASK) & PAGE_MASK; in atyfb_setup_sparc()
3030 par->mmap_map[j].prot_mask = _PAGE_CACHE; in atyfb_setup_sparc()
3031 par->mmap_map[j].prot_flag = _PAGE_E; in atyfb_setup_sparc()
3039 if (IS_XL(pdev->device)) { in atyfb_setup_sparc()
3079 var->bits_per_pixel = of_getintprop_default(dp, "depth", 8); in atyfb_setup_sparc()
3080 var->xoffset = var->yoffset = 0; in atyfb_setup_sparc()
3121 * Q = ------- in atyfb_setup_sparc()
3126 if (IS_XL(pdev->device)) in atyfb_setup_sparc()
3152 * - Check the startup video mode and calculate the panel in aty_init_lcd()
3154 * - Read it from the driver information table in the video BIOS. in aty_init_lcd()
3167 par->lcd_table = 0; in aty_init_lcd()
3169 par->lcd_table = bios_base + lcd_ofs; in aty_init_lcd()
3172 if (par->lcd_table != 0) { in aty_init_lcd()
3191 id = *(u8 *)par->lcd_table; in aty_init_lcd()
3192 strscpy(model, (char *)par->lcd_table+1, sizeof(model)); in aty_init_lcd()
3194 width = par->lcd_width = *(u16 *)(par->lcd_table+25); in aty_init_lcd()
3195 height = par->lcd_height = *(u16 *)(par->lcd_table+27); in aty_init_lcd()
3196 panel_type = *(u16 *)(par->lcd_table+29); in aty_init_lcd()
3225 format = *(u32 *)(par->lcd_table+57); in aty_init_lcd()
3258 txtformat = "262144 colours (FDPI-2 mode)"; in aty_init_lcd()
3269 refresh_rates = *(u16 *)(par->lcd_table+62); in aty_init_lcd()
3286 default_refresh_rate = (*(u8 *)(par->lcd_table+61) & 0xf0) >> 4; in aty_init_lcd()
3289 par->lcd_refreshrate = lcd_refresh_rates[default_refresh_rate]; in aty_init_lcd()
3302 lcdmodeptr = (u16 *)(par->lcd_table + 64); in aty_init_lcd()
3312 par->lcd_pixclock = 100000000 / *((u16 *)(modeptr+9)); in aty_init_lcd()
3313 par->lcd_htotal = *((u16 *)(modeptr+17)) & 511; in aty_init_lcd()
3314 par->lcd_hdisp = *((u16 *)(modeptr+19)) & 511; in aty_init_lcd()
3316 par->lcd_hsync_dly = (*((u16 *)(modeptr+21)) >> 9) & 7; in aty_init_lcd()
3317 par->lcd_hsync_len = *((u8 *)(modeptr+23)) & 63; in aty_init_lcd()
3319 par->lcd_vtotal = *((u16 *)(modeptr+24)) & 2047; in aty_init_lcd()
3320 par->lcd_vdisp = *((u16 *)(modeptr+26)) & 2047; in aty_init_lcd()
3322 par->lcd_vsync_len = (*((u16 *)(modeptr+28)) >> 11) & 31; in aty_init_lcd()
3324 par->lcd_htotal = (par->lcd_htotal + 1) * 8; in aty_init_lcd()
3325 par->lcd_hdisp = (par->lcd_hdisp + 1) * 8; in aty_init_lcd()
3327 par->lcd_hsync_len = par->lcd_hsync_len * 8; in aty_init_lcd()
3329 par->lcd_vtotal++; in aty_init_lcd()
3330 par->lcd_vdisp++; in aty_init_lcd()
3333 par->lcd_right_margin = lcd_hsync_start - par->lcd_hdisp; in aty_init_lcd()
3334 par->lcd_lower_margin = lcd_vsync_start - par->lcd_vdisp; in aty_init_lcd()
3335 par->lcd_hblank_len = par->lcd_htotal - par->lcd_hdisp; in aty_init_lcd()
3336 par->lcd_vblank_len = par->lcd_vtotal - par->lcd_vdisp; in aty_init_lcd()
3347 1000000 / par->lcd_pixclock, 1000000 % par->lcd_pixclock, in aty_init_lcd()
3348 par->lcd_hdisp, in aty_init_lcd()
3349 par->lcd_hdisp + par->lcd_right_margin, in aty_init_lcd()
3350 par->lcd_hdisp + par->lcd_right_margin in aty_init_lcd()
3351 + par->lcd_hsync_dly + par->lcd_hsync_len, in aty_init_lcd()
3352 par->lcd_htotal, in aty_init_lcd()
3353 par->lcd_vdisp, in aty_init_lcd()
3354 par->lcd_vdisp + par->lcd_lower_margin, in aty_init_lcd()
3355 par->lcd_vdisp + par->lcd_lower_margin + par->lcd_vsync_len, in aty_init_lcd()
3356 par->lcd_vtotal); in aty_init_lcd()
3358 par->lcd_pixclock, in aty_init_lcd()
3359 par->lcd_hblank_len - (par->lcd_right_margin + in aty_init_lcd()
3360 par->lcd_hsync_dly + par->lcd_hsync_len), in aty_init_lcd()
3361 par->lcd_hdisp, in aty_init_lcd()
3362 par->lcd_right_margin, in aty_init_lcd()
3363 par->lcd_hsync_len, in aty_init_lcd()
3364 par->lcd_vblank_len - (par->lcd_lower_margin + par->lcd_vsync_len), in aty_init_lcd()
3365 par->lcd_vdisp, in aty_init_lcd()
3366 par->lcd_lower_margin, in aty_init_lcd()
3367 par->lcd_vsync_len); in aty_init_lcd()
3404 par->pll_limits.pll_min = pll_block.PCLK_min_freq/100; in init_from_bios()
3405 par->pll_limits.pll_max = pll_block.PCLK_max_freq/100; in init_from_bios()
3406 par->pll_limits.ref_clk = pll_block.ref_freq/100; in init_from_bios()
3407 par->pll_limits.ref_div = pll_block.ref_divider; in init_from_bios()
3408 par->pll_limits.sclk = pll_block.SCLK_freq/100; in init_from_bios()
3409 par->pll_limits.mclk = pll_block.MCLK_max_freq/100; in init_from_bios()
3410 par->pll_limits.mclk_pm = pll_block.MCLK_pwd/100; in init_from_bios()
3411 par->pll_limits.xclk = pll_block.XCLK_max_freq/100; in init_from_bios()
3418 ret = -ENXIO; in init_from_bios()
3429 struct atyfb_par *par = info->par; in atyfb_setup_generic()
3436 rrp = &pdev->resource[2]; in atyfb_setup_generic()
3437 if ((rrp->flags & IORESOURCE_MEM) && in atyfb_setup_generic()
3438 request_mem_region(rrp->start, resource_size(rrp), "atyfb")) { in atyfb_setup_generic()
3439 par->aux_start = rrp->start; in atyfb_setup_generic()
3440 par->aux_size = resource_size(rrp); in atyfb_setup_generic()
3441 raddr = rrp->start; in atyfb_setup_generic()
3445 info->fix.mmio_start = raddr; in atyfb_setup_generic()
3449 * effect on the MMIO region on both non-PAT and PAT systems. in atyfb_setup_generic()
3451 par->ati_regbase = ioremap_uc(info->fix.mmio_start, 0x1000); in atyfb_setup_generic()
3453 par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000); in atyfb_setup_generic()
3455 if (par->ati_regbase == NULL) in atyfb_setup_generic()
3456 return -ENOMEM; in atyfb_setup_generic()
3458 info->fix.mmio_start += par->aux_start ? 0x400 : 0xc00; in atyfb_setup_generic()
3459 par->ati_regbase += par->aux_start ? 0x400 : 0xc00; in atyfb_setup_generic()
3462 * Enable memory-space accesses using config-space in atyfb_setup_generic()
3471 /* Use the big-endian aperture */ in atyfb_setup_generic()
3476 info->fix.smem_start = addr; in atyfb_setup_generic()
3489 info->fix.smem_len = 0x800000; in atyfb_setup_generic()
3493 info->screen_base = ioremap_wc(info->fix.smem_start, in atyfb_setup_generic()
3494 info->fix.smem_len); in atyfb_setup_generic()
3495 if (info->screen_base == NULL) { in atyfb_setup_generic()
3496 ret = -ENOMEM; in atyfb_setup_generic()
3508 /* according to ATI, we should use clock 3 for acelerated mode */ in atyfb_setup_generic()
3509 par->clk_wr_offset = 3; in atyfb_setup_generic()
3514 iounmap(par->ati_regbase); in atyfb_setup_generic()
3515 par->ati_regbase = NULL; in atyfb_setup_generic()
3516 if (info->screen_base) { in atyfb_setup_generic()
3517 iounmap(info->screen_base); in atyfb_setup_generic()
3518 info->screen_base = NULL; in atyfb_setup_generic()
3541 return -ENXIO; in atyfb_pci_probe()
3545 rp = &pdev->resource[0]; in atyfb_pci_probe()
3546 if (rp->flags & IORESOURCE_IO) in atyfb_pci_probe()
3547 rp = &pdev->resource[1]; in atyfb_pci_probe()
3548 addr = rp->start; in atyfb_pci_probe()
3550 return -ENXIO; in atyfb_pci_probe()
3553 res_start = rp->start; in atyfb_pci_probe()
3556 return -EBUSY; in atyfb_pci_probe()
3559 info = framebuffer_alloc(sizeof(struct atyfb_par), &pdev->dev); in atyfb_pci_probe()
3561 return -ENOMEM; in atyfb_pci_probe()
3563 par = info->par; in atyfb_pci_probe()
3564 par->bus_type = PCI; in atyfb_pci_probe()
3565 info->fix = atyfb_fix; in atyfb_pci_probe()
3566 info->device = &pdev->dev; in atyfb_pci_probe()
3567 par->pci_id = pdev->device; in atyfb_pci_probe()
3568 par->res_start = res_start; in atyfb_pci_probe()
3569 par->res_size = res_size; in atyfb_pci_probe()
3570 par->irq = pdev->irq; in atyfb_pci_probe()
3571 par->pdev = pdev; in atyfb_pci_probe()
3593 par->mmap_map[0].voff = 0x8000000000000000UL; in atyfb_pci_probe()
3594 par->mmap_map[0].poff = (unsigned long) info->screen_base & PAGE_MASK; in atyfb_pci_probe()
3595 par->mmap_map[0].size = info->fix.smem_len; in atyfb_pci_probe()
3596 par->mmap_map[0].prot_mask = _PAGE_CACHE; in atyfb_pci_probe()
3597 par->mmap_map[0].prot_flag = _PAGE_E; in atyfb_pci_probe()
3598 par->mmap_map[1].voff = par->mmap_map[0].voff + info->fix.smem_len; in atyfb_pci_probe()
3599 par->mmap_map[1].poff = (long)par->ati_regbase & PAGE_MASK; in atyfb_pci_probe()
3600 par->mmap_map[1].size = PAGE_SIZE; in atyfb_pci_probe()
3601 par->mmap_map[1].prot_mask = _PAGE_CACHE; in atyfb_pci_probe()
3602 par->mmap_map[1].prot_flag = _PAGE_E; in atyfb_pci_probe()
3614 kfree(par->mmap_map); in atyfb_pci_probe()
3616 if (par->ati_regbase) in atyfb_pci_probe()
3617 iounmap(par->ati_regbase); in atyfb_pci_probe()
3618 if (info->screen_base) in atyfb_pci_probe()
3619 iounmap(info->screen_base); in atyfb_pci_probe()
3622 if (par->aux_start) in atyfb_pci_probe()
3623 release_mem_region(par->aux_start, par->aux_size); in atyfb_pci_probe()
3625 release_mem_region(par->res_start, par->res_size); in atyfb_pci_probe()
3653 return -ENOMEM; in atyfb_atari_probe()
3655 par = info->par; in atyfb_atari_probe()
3657 info->fix = atyfb_fix; in atyfb_atari_probe()
3659 par->irq = (unsigned int) -1; /* something invalid */ in atyfb_atari_probe()
3665 info->screen_base = ioremap_wc(phys_vmembase[m64_num], in atyfb_atari_probe()
3667 info->fix.smem_start = (unsigned long)info->screen_base; /* Fake! */ in atyfb_atari_probe()
3668 par->ati_regbase = ioremap(phys_guiregbase[m64_num], 0x10000) + in atyfb_atari_probe()
3670 info->fix.mmio_start = (unsigned long)par->ati_regbase; /* Fake! */ in atyfb_atari_probe()
3677 par->clk_wr_offset = 3; /* */ in atyfb_atari_probe()
3680 par->clk_wr_offset = 2; /* Medusa ST-IO ISA Adapter etc. */ in atyfb_atari_probe()
3683 par->clk_wr_offset = 1; /* */ in atyfb_atari_probe()
3686 par->clk_wr_offset = 0; /* Panther 1 ISA Adapter (Gerald) */ in atyfb_atari_probe()
3693 par->pci_id = PCI_CHIP_MACH64GX; in atyfb_atari_probe()
3696 par->pci_id = PCI_CHIP_MACH64CX; in atyfb_atari_probe()
3703 iounmap(info->screen_base); in atyfb_atari_probe()
3704 iounmap(par->ati_regbase); in atyfb_atari_probe()
3711 return num_found ? 0 : -ENXIO; in atyfb_atari_probe()
3720 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_remove()
3723 aty_set_crtc(par, &par->saved_crtc); in atyfb_remove()
3724 par->pll_ops->set_pll(info, &par->saved_pll); in atyfb_remove()
3728 aty_bl_exit(info->bl_dev); in atyfb_remove()
3733 arch_phys_wc_del(par->wc_cookie); in atyfb_remove()
3736 if (par->ati_regbase) in atyfb_remove()
3737 iounmap(par->ati_regbase); in atyfb_remove()
3738 if (info->screen_base) in atyfb_remove()
3739 iounmap(info->screen_base); in atyfb_remove()
3741 if (info->sprite.addr) in atyfb_remove()
3742 iounmap(info->sprite.addr); in atyfb_remove()
3746 kfree(par->mmap_map); in atyfb_remove()
3748 if (par->aux_start) in atyfb_remove()
3749 release_mem_region(par->aux_start, par->aux_size); in atyfb_remove()
3751 if (par->res_start) in atyfb_remove()
3752 release_mem_region(par->res_start, par->res_size); in atyfb_remove()
3924 par = reboot_info->par; in atyfb_reboot_notify()
3931 aty_set_crtc(par, &par->saved_crtc); in atyfb_reboot_notify()
3932 par->pll_ops->set_pll(reboot_info, &par->saved_pll); in atyfb_reboot_notify()
3949 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
3967 return -ENODEV; in atyfb_init()
3971 return -ENODEV; in atyfb_init()
3983 return -ENODEV; in atyfb_init()
4006 MODULE_DESCRIPTION("FBDev driver for ATI Mach64 cards");
4021 MODULE_PARM_DESC(mode, "Specify resolution as \"<xres>x<yres>[-<bpp>][@<refresh>]\" ");