Lines Matching +full:ati +full:- +full:target

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,
328 static int comp_sync = -1;
349 /* top -> down is an evolution of mach64 chipset, any corrections? */
428 { PCI_CHIP_MACH64GO, "3D RAGE XL (Mach64 GO, PCI-66)", 230, 83, 63, 135, ATI_CHIP_264XL },
429 { PCI_CHIP_MACH64GL, "3D RAGE XC (Mach64 GL, PCI-66)", 230, 83, 63, 135, ATI_CHIP_264XL },
430 …{ PCI_CHIP_MACH64GR, "3D RAGE XL (Mach64 GR, PCI-33)", 230, 83, 63, 135, ATI_CHIP_264XL | M64F_SDR…
431 { PCI_CHIP_MACH64GS, "3D RAGE XC (Mach64 GS, PCI-33)", 230, 83, 63, 135, ATI_CHIP_264XL },
446 struct atyfb_par *par = (struct atyfb_par *) info->par; in aty_fudge_framebuffer_len()
448 if (!par->aux_start && in aty_fudge_framebuffer_len()
449 (info->fix.smem_len == 0x800000 || in aty_fudge_framebuffer_len()
450 (par->bus_type == ISA && info->fix.smem_len == 0x400000))) in aty_fudge_framebuffer_len()
451 info->fix.smem_len -= GUI_RESERVE; in aty_fudge_framebuffer_len()
462 for (i = (int)ARRAY_SIZE(aty_chips) - 1; i >= 0; i--) in correct_chipset()
463 if (par->pci_id == aty_chips[i].pci_id) in correct_chipset()
467 return -ENODEV; in correct_chipset()
470 par->pll_limits.pll_max = aty_chips[i].pll; in correct_chipset()
471 par->pll_limits.mclk = aty_chips[i].mclk; in correct_chipset()
472 par->pll_limits.xclk = aty_chips[i].xclk; in correct_chipset()
473 par->pll_limits.ecp_max = aty_chips[i].ecp_max; in correct_chipset()
474 par->features = aty_chips[i].features; in correct_chipset()
480 switch (par->pci_id) { in correct_chipset()
484 return -ENODEV; in correct_chipset()
488 return -ENODEV; in correct_chipset()
498 par->pll_limits.pll_max = 170; in correct_chipset()
499 par->pll_limits.mclk = 67; in correct_chipset()
500 par->pll_limits.xclk = 67; in correct_chipset()
501 par->pll_limits.ecp_max = 80; in correct_chipset()
502 par->features = ATI_CHIP_264VT; in correct_chipset()
506 par->pll_limits.pll_max = 200; in correct_chipset()
507 par->pll_limits.mclk = 67; in correct_chipset()
508 par->pll_limits.xclk = 67; in correct_chipset()
509 par->pll_limits.ecp_max = 80; in correct_chipset()
510 par->features = ATI_CHIP_264VT | M64F_MAGIC_POSTDIV; in correct_chipset()
516 par->pll_limits.pll_max = 200; in correct_chipset()
517 par->pll_limits.mclk = 67; in correct_chipset()
518 par->pll_limits.xclk = 67; in correct_chipset()
519 par->pll_limits.ecp_max = 80; in correct_chipset()
520 par->features = ATI_CHIP_264VTB; in correct_chipset()
524 par->pll_limits.pll_max = 200; in correct_chipset()
525 par->pll_limits.mclk = 67; in correct_chipset()
526 par->pll_limits.xclk = 67; in correct_chipset()
527 par->pll_limits.ecp_max = 80; in correct_chipset()
528 par->features = ATI_CHIP_264VT3; in correct_chipset()
536 par->pll_limits.pll_max = 170; in correct_chipset()
537 par->pll_limits.mclk = 67; in correct_chipset()
538 par->pll_limits.xclk = 67; in correct_chipset()
539 par->pll_limits.ecp_max = 80; in correct_chipset()
540 par->features = ATI_CHIP_264GTB; in correct_chipset()
544 par->pll_limits.pll_max = 200; in correct_chipset()
545 par->pll_limits.mclk = 67; in correct_chipset()
546 par->pll_limits.xclk = 67; in correct_chipset()
547 par->pll_limits.ecp_max = 100; in correct_chipset()
548 par->features = ATI_CHIP_264GTB; in correct_chipset()
568 static char ram_sdram32[] = "SDRAM (2:1) (32-bit)";
595 u32 pixclock = var->pixclock; in atyfb_get_pixclock()
598 par->pll.ct.xres = 0; in atyfb_get_pixclock()
599 if (par->lcd_table != 0) { in atyfb_get_pixclock()
602 par->pll.ct.xres = var->xres; in atyfb_get_pixclock()
603 pixclock = par->lcd_pixclock; in atyfb_get_pixclock()
651 /* ------------------------------------------------------------------------- */
660 if (par->lcd_table != 0) { in aty_get_crtc()
662 crtc->lcd_index = aty_ld_le32(LCD_INDEX, par); in aty_get_crtc()
663 aty_st_le32(LCD_INDEX, crtc->lcd_index, par); in aty_get_crtc()
665 crtc->lcd_config_panel = aty_ld_lcd(CNFG_PANEL, par); in aty_get_crtc()
666 crtc->lcd_gen_cntl = aty_ld_lcd(LCD_GEN_CNTL, par); in aty_get_crtc()
670 aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl & in aty_get_crtc()
674 crtc->horz_stretching = aty_ld_lcd(HORZ_STRETCHING, par); in aty_get_crtc()
675 crtc->vert_stretching = aty_ld_lcd(VERT_STRETCHING, par); in aty_get_crtc()
677 crtc->ext_vert_stretch = aty_ld_lcd(EXT_VERT_STRETCH, par); in aty_get_crtc()
680 crtc->h_tot_disp = aty_ld_le32(CRTC_H_TOTAL_DISP, par); in aty_get_crtc()
681 crtc->h_sync_strt_wid = aty_ld_le32(CRTC_H_SYNC_STRT_WID, par); in aty_get_crtc()
682 crtc->v_tot_disp = aty_ld_le32(CRTC_V_TOTAL_DISP, par); in aty_get_crtc()
683 crtc->v_sync_strt_wid = aty_ld_le32(CRTC_V_SYNC_STRT_WID, par); in aty_get_crtc()
684 crtc->vline_crnt_vline = aty_ld_le32(CRTC_VLINE_CRNT_VLINE, par); in aty_get_crtc()
685 crtc->off_pitch = aty_ld_le32(CRTC_OFF_PITCH, par); in aty_get_crtc()
686 crtc->gen_cntl = aty_ld_le32(CRTC_GEN_CNTL, par); in aty_get_crtc()
689 if (par->lcd_table != 0) { in aty_get_crtc()
691 aty_st_lcd(LCD_GEN_CNTL, (crtc->lcd_gen_cntl & ~CRTC_RW_SELECT) | in aty_get_crtc()
694 crtc->shadow_h_tot_disp = aty_ld_le32(CRTC_H_TOTAL_DISP, par); in aty_get_crtc()
695 crtc->shadow_h_sync_strt_wid = aty_ld_le32(CRTC_H_SYNC_STRT_WID, par); in aty_get_crtc()
696 crtc->shadow_v_tot_disp = aty_ld_le32(CRTC_V_TOTAL_DISP, par); in aty_get_crtc()
697 crtc->shadow_v_sync_strt_wid = aty_ld_le32(CRTC_V_SYNC_STRT_WID, par); in aty_get_crtc()
699 aty_st_le32(LCD_GEN_CNTL, crtc->lcd_gen_cntl, par); in aty_get_crtc()
707 if (par->lcd_table != 0) { in aty_set_crtc()
709 aty_st_le32(CRTC_GEN_CNTL, crtc->gen_cntl & in aty_set_crtc()
712 /* update non-shadow registers first */ in aty_set_crtc()
713 aty_st_lcd(CNFG_PANEL, crtc->lcd_config_panel, par); in aty_set_crtc()
714 aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl & in aty_set_crtc()
718 aty_st_lcd(HORZ_STRETCHING, crtc->horz_stretching & in aty_set_crtc()
720 aty_st_lcd(VERT_STRETCHING, crtc->vert_stretching & in aty_set_crtc()
726 aty_st_le32(CRTC_GEN_CNTL, crtc->gen_cntl & ~CRTC_EN, par); in aty_set_crtc()
730 ((((crtc->h_tot_disp >> 16) & 0xff) + 1) << 3), in aty_set_crtc()
731 (((crtc->v_tot_disp >> 16) & 0x7ff) + 1), in aty_set_crtc()
732 (crtc->h_sync_strt_wid & 0x200000) ? 'N' : 'P', in aty_set_crtc()
733 (crtc->v_sync_strt_wid & 0x200000) ? 'N' : 'P', in aty_set_crtc()
734 (crtc->gen_cntl & CRTC_CSYNC_EN) ? 'P' : 'N'); in aty_set_crtc()
736 DPRINTK("CRTC_H_TOTAL_DISP: %x\n", crtc->h_tot_disp); in aty_set_crtc()
737 DPRINTK("CRTC_H_SYNC_STRT_WID: %x\n", crtc->h_sync_strt_wid); in aty_set_crtc()
738 DPRINTK("CRTC_V_TOTAL_DISP: %x\n", crtc->v_tot_disp); in aty_set_crtc()
739 DPRINTK("CRTC_V_SYNC_STRT_WID: %x\n", crtc->v_sync_strt_wid); in aty_set_crtc()
740 DPRINTK("CRTC_OFF_PITCH: %x\n", crtc->off_pitch); in aty_set_crtc()
741 DPRINTK("CRTC_VLINE_CRNT_VLINE: %x\n", crtc->vline_crnt_vline); in aty_set_crtc()
742 DPRINTK("CRTC_GEN_CNTL: %x\n", crtc->gen_cntl); in aty_set_crtc()
744 aty_st_le32(CRTC_H_TOTAL_DISP, crtc->h_tot_disp, par); in aty_set_crtc()
745 aty_st_le32(CRTC_H_SYNC_STRT_WID, crtc->h_sync_strt_wid, par); in aty_set_crtc()
746 aty_st_le32(CRTC_V_TOTAL_DISP, crtc->v_tot_disp, par); in aty_set_crtc()
747 aty_st_le32(CRTC_V_SYNC_STRT_WID, crtc->v_sync_strt_wid, par); in aty_set_crtc()
748 aty_st_le32(CRTC_OFF_PITCH, crtc->off_pitch, par); in aty_set_crtc()
749 aty_st_le32(CRTC_VLINE_CRNT_VLINE, crtc->vline_crnt_vline, par); in aty_set_crtc()
751 aty_st_le32(CRTC_GEN_CNTL, crtc->gen_cntl, par); in aty_set_crtc()
754 if (par->accel_flags & FB_ACCELF_TEXT) in aty_set_crtc()
759 if (par->lcd_table != 0) { in aty_set_crtc()
761 aty_st_lcd(LCD_GEN_CNTL, (crtc->lcd_gen_cntl & ~CRTC_RW_SELECT) | in aty_set_crtc()
765 ((((crtc->shadow_h_tot_disp >> 16) & 0xff) + 1) << 3), in aty_set_crtc()
766 (((crtc->shadow_v_tot_disp >> 16) & 0x7ff) + 1), in aty_set_crtc()
767 (crtc->shadow_h_sync_strt_wid & 0x200000) ? 'N' : 'P', in aty_set_crtc()
768 (crtc->shadow_v_sync_strt_wid & 0x200000) ? 'N' : 'P'); in aty_set_crtc()
771 crtc->shadow_h_tot_disp); in aty_set_crtc()
773 crtc->shadow_h_sync_strt_wid); in aty_set_crtc()
775 crtc->shadow_v_tot_disp); in aty_set_crtc()
777 crtc->shadow_v_sync_strt_wid); in aty_set_crtc()
779 aty_st_le32(CRTC_H_TOTAL_DISP, crtc->shadow_h_tot_disp, par); in aty_set_crtc()
780 aty_st_le32(CRTC_H_SYNC_STRT_WID, crtc->shadow_h_sync_strt_wid, par); in aty_set_crtc()
781 aty_st_le32(CRTC_V_TOTAL_DISP, crtc->shadow_v_tot_disp, par); in aty_set_crtc()
782 aty_st_le32(CRTC_V_SYNC_STRT_WID, crtc->shadow_v_sync_strt_wid, par); in aty_set_crtc()
785 DPRINTK("LCD_GEN_CNTL: %x\n", crtc->lcd_gen_cntl); in aty_set_crtc()
786 DPRINTK("HORZ_STRETCHING: %x\n", crtc->horz_stretching); in aty_set_crtc()
787 DPRINTK("VERT_STRETCHING: %x\n", crtc->vert_stretching); in aty_set_crtc()
789 DPRINTK("EXT_VERT_STRETCH: %x\n", crtc->ext_vert_stretch); in aty_set_crtc()
791 aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl, par); in aty_set_crtc()
792 aty_st_lcd(HORZ_STRETCHING, crtc->horz_stretching, par); in aty_set_crtc()
793 aty_st_lcd(VERT_STRETCHING, crtc->vert_stretching, par); in aty_set_crtc()
795 aty_st_lcd(EXT_VERT_STRETCH, crtc->ext_vert_stretch, par); in aty_set_crtc()
797 aty_st_le32(LCD_INDEX, crtc->lcd_index, par); in aty_set_crtc()
807 if (par->ram_type == SGRAM || in calc_line_length()
808 (!M64_HAS(XL_MEM) && par->ram_type == WRAM)) in calc_line_length()
818 struct atyfb_par *par = (struct atyfb_par *) info->par; in aty_var_to_crtc()
827 xres = (var->xres + 7) & ~7; in aty_var_to_crtc()
828 yres = var->yres; in aty_var_to_crtc()
829 vxres = (var->xres_virtual + 7) & ~7; in aty_var_to_crtc()
830 vyres = var->yres_virtual; in aty_var_to_crtc()
831 xoffset = (var->xoffset + 7) & ~7; in aty_var_to_crtc()
832 yoffset = var->yoffset; in aty_var_to_crtc()
833 bpp = var->bits_per_pixel; in aty_var_to_crtc()
835 bpp = (var->green.length == 5) ? 15 : 16; in aty_var_to_crtc()
836 sync = var->sync; in aty_var_to_crtc()
837 vmode = var->vmode; in aty_var_to_crtc()
883 if (vyres * line_length > info->fix.smem_len) in aty_var_to_crtc()
893 h_sync_strt = h_disp + var->right_margin; in aty_var_to_crtc()
894 h_sync_end = h_sync_strt + var->hsync_len; in aty_var_to_crtc()
895 h_sync_dly = var->right_margin & 7; in aty_var_to_crtc()
896 h_total = h_sync_end + h_sync_dly + var->left_margin; in aty_var_to_crtc()
898 v_sync_strt = v_disp + var->lower_margin; in aty_var_to_crtc()
899 v_sync_end = v_sync_strt + var->vsync_len; in aty_var_to_crtc()
900 v_total = v_sync_end + var->upper_margin; in aty_var_to_crtc()
903 if (par->lcd_table != 0) { in aty_var_to_crtc()
906 crtc->lcd_index = lcd_index & in aty_var_to_crtc()
913 crtc->lcd_index |= CRTC2_DISPLAY_DIS; in aty_var_to_crtc()
915 crtc->lcd_config_panel = aty_ld_lcd(CNFG_PANEL, par) | 0x4000; in aty_var_to_crtc()
916 crtc->lcd_gen_cntl = aty_ld_lcd(LCD_GEN_CNTL, par) & ~CRTC_RW_SELECT; in aty_var_to_crtc()
918 crtc->lcd_gen_cntl &= in aty_var_to_crtc()
922 crtc->lcd_gen_cntl |= DONT_SHADOW_VPAR | LOCK_8DOT; in aty_var_to_crtc()
924 if ((crtc->lcd_gen_cntl & LCD_ON) && in aty_var_to_crtc()
925 ((xres > par->lcd_width) || (yres > par->lcd_height))) { in aty_var_to_crtc()
933 if (crtc->lcd_gen_cntl & CRT_ON) { in aty_var_to_crtc()
934 if (!(var->activate & FB_ACTIVATE_TEST)) in aty_var_to_crtc()
936 crtc->lcd_gen_cntl &= ~LCD_ON; in aty_var_to_crtc()
937 /*aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl, par);*/ in aty_var_to_crtc()
939 if (!(var->activate & FB_ACTIVATE_TEST)) in aty_var_to_crtc()
941 return -EINVAL; in aty_var_to_crtc()
946 if ((par->lcd_table != 0) && (crtc->lcd_gen_cntl & LCD_ON)) { in aty_var_to_crtc()
948 /* bpp -> bytespp, 1,4 -> 0; 8 -> 2; 15,16 -> 1; 24 -> 6; 32 -> 5 in aty_var_to_crtc()
963 if (yres < par->lcd_height) { in aty_var_to_crtc()
964 VScan = par->lcd_height / yres; in aty_var_to_crtc()
971 h_sync_strt = h_disp + par->lcd_right_margin; in aty_var_to_crtc()
972 h_sync_end = h_sync_strt + par->lcd_hsync_len; in aty_var_to_crtc()
973 h_sync_dly = /*DFP_h_sync_dly[ ( bpp + 1 ) / 3 ]; */par->lcd_hsync_dly; in aty_var_to_crtc()
974 h_total = h_disp + par->lcd_hblank_len; in aty_var_to_crtc()
976 v_sync_strt = v_disp + par->lcd_lower_margin / VScan; in aty_var_to_crtc()
977 v_sync_end = v_sync_strt + par->lcd_vsync_len / VScan; in aty_var_to_crtc()
978 v_total = v_disp + par->lcd_vblank_len / VScan; in aty_var_to_crtc()
982 h_disp = (h_disp >> 3) - 1; in aty_var_to_crtc()
983 h_sync_strt = (h_sync_strt >> 3) - 1; in aty_var_to_crtc()
984 h_sync_end = (h_sync_end >> 3) - 1; in aty_var_to_crtc()
985 h_total = (h_total >> 3) - 1; in aty_var_to_crtc()
986 h_sync_wid = h_sync_end - h_sync_strt; in aty_var_to_crtc()
1002 v_disp--; in aty_var_to_crtc()
1003 v_sync_strt--; in aty_var_to_crtc()
1004 v_sync_end--; in aty_var_to_crtc()
1005 v_total--; in aty_var_to_crtc()
1006 v_sync_wid = v_sync_end - v_sync_strt; in aty_var_to_crtc()
1018 crtc->vxres = vxres; in aty_var_to_crtc()
1019 crtc->vyres = vyres; in aty_var_to_crtc()
1020 crtc->xoffset = xoffset; in aty_var_to_crtc()
1021 crtc->yoffset = yoffset; in aty_var_to_crtc()
1022 crtc->bpp = bpp; in aty_var_to_crtc()
1023 crtc->off_pitch = in aty_var_to_crtc()
1026 crtc->vline_crnt_vline = 0; in aty_var_to_crtc()
1028 crtc->h_tot_disp = h_total | (h_disp << 16); in aty_var_to_crtc()
1029 crtc->h_sync_strt_wid = (h_sync_strt & 0xff) | (h_sync_dly << 8) | in aty_var_to_crtc()
1032 crtc->v_tot_disp = v_total | (v_disp << 16); in aty_var_to_crtc()
1033 crtc->v_sync_strt_wid = v_sync_strt | (v_sync_wid << 16) | in aty_var_to_crtc()
1036 /* crtc->gen_cntl = aty_ld_le32(CRTC_GEN_CNTL, par) & CRTC_PRESERVED_MASK; */ in aty_var_to_crtc()
1037 crtc->gen_cntl = CRTC_EXT_DISP_EN | CRTC_EN | pix_width | c_sync; in aty_var_to_crtc()
1038 crtc->gen_cntl |= CRTC_VGA_LINEAR; in aty_var_to_crtc()
1042 crtc->gen_cntl |= CRTC_DBL_SCAN_EN; in aty_var_to_crtc()
1045 crtc->gen_cntl |= CRTC_INTERLACE_EN; in aty_var_to_crtc()
1047 if (par->lcd_table != 0) { in aty_var_to_crtc()
1051 crtc->gen_cntl &= ~(CRTC2_EN | CRTC2_PIX_WIDTH); in aty_var_to_crtc()
1052 crtc->lcd_gen_cntl &= ~(HORZ_DIVBY2_EN | DIS_HOR_CRT_DIVBY2 | in aty_var_to_crtc()
1057 crtc->lcd_gen_cntl |= DONT_SHADOW_VPAR/* | LOCK_8DOT*/; in aty_var_to_crtc()
1060 crtc->horz_stretching = aty_ld_lcd(HORZ_STRETCHING, par); in aty_var_to_crtc()
1062 crtc->ext_vert_stretch = aty_ld_lcd(EXT_VERT_STRETCH, par) & in aty_var_to_crtc()
1065 crtc->horz_stretching &= ~(HORZ_STRETCH_RATIO | in aty_var_to_crtc()
1068 if (xres < par->lcd_width && crtc->lcd_gen_cntl & LCD_ON) { in aty_var_to_crtc()
1073 * (440 for a 1024-wide panel). It doesn't in aty_var_to_crtc()
1078 * option allows the pixel-replicated mode to in aty_var_to_crtc()
1082 * pixel-replicated, rather than blended. in aty_var_to_crtc()
1085 int nStretch = par->lcd_width / HDisplay; in aty_var_to_crtc()
1086 int Remainder = par->lcd_width % HDisplay; in aty_var_to_crtc()
1089 (((HDisplay * 16) / par->lcd_width) < 7)) { in aty_var_to_crtc()
1091 int horz_stretch_loop = -1, BestRemainder; in aty_var_to_crtc()
1092 int Numerator = HDisplay, Denominator = par->lcd_width; in aty_var_to_crtc()
1097 while (--Index >= 0) { in aty_var_to_crtc()
1098 Remainder = ((Denominator - Numerator) * StretchLoops[Index]) % in aty_var_to_crtc()
1113 while (--Index >= 0) { in aty_var_to_crtc()
1118 Accumulator -= Numerator; in aty_var_to_crtc()
1122 crtc->horz_stretching |= (HORZ_STRETCH_EN | in aty_var_to_crtc()
1129 crtc->horz_stretching |= (HORZ_STRETCH_MODE | HORZ_STRETCH_EN | in aty_var_to_crtc()
1130 (((HDisplay * (HORZ_STRETCH_BLEND + 1)) / par->lcd_width) & HORZ_STRETCH_BLEND)); in aty_var_to_crtc()
1134 if (vdisplay < par->lcd_height && crtc->lcd_gen_cntl & LCD_ON) { in aty_var_to_crtc()
1135 crtc->vert_stretching = (VERT_STRETCH_USE0 | VERT_STRETCH_EN | in aty_var_to_crtc()
1136 (((vdisplay * (VERT_STRETCH_RATIO0 + 1)) / par->lcd_height) & VERT_STRETCH_RATIO0)); in aty_var_to_crtc()
1140 crtc->ext_vert_stretch |= VERT_STRETCH_MODE; in aty_var_to_crtc()
1146 crtc->vert_stretching = 0; in aty_var_to_crtc()
1149 crtc->shadow_h_tot_disp = crtc->h_tot_disp; in aty_var_to_crtc()
1150 crtc->shadow_h_sync_strt_wid = crtc->h_sync_strt_wid; in aty_var_to_crtc()
1151 crtc->shadow_v_tot_disp = crtc->v_tot_disp; in aty_var_to_crtc()
1152 crtc->shadow_v_sync_strt_wid = crtc->v_sync_strt_wid; in aty_var_to_crtc()
1158 crtc->gen_cntl |= (aty_ld_le32(CRTC_GEN_CNTL, par) & CRTC_FIFO_LWM); in aty_var_to_crtc()
1160 crtc->dp_pix_width = dp_pix_width; in aty_var_to_crtc()
1161 crtc->dp_chain_mask = dp_chain_mask; in aty_var_to_crtc()
1176 h_total = crtc->h_tot_disp & 0x1ff; in aty_crtc_to_var()
1177 h_disp = (crtc->h_tot_disp >> 16) & 0xff; in aty_crtc_to_var()
1178 h_sync_strt = (crtc->h_sync_strt_wid & 0xff) | ((crtc->h_sync_strt_wid >> 4) & 0x100); in aty_crtc_to_var()
1179 h_sync_dly = (crtc->h_sync_strt_wid >> 8) & 0x7; in aty_crtc_to_var()
1180 h_sync_wid = (crtc->h_sync_strt_wid >> 16) & 0x1f; in aty_crtc_to_var()
1181 h_sync_pol = (crtc->h_sync_strt_wid >> 21) & 0x1; in aty_crtc_to_var()
1182 v_total = crtc->v_tot_disp & 0x7ff; in aty_crtc_to_var()
1183 v_disp = (crtc->v_tot_disp >> 16) & 0x7ff; in aty_crtc_to_var()
1184 v_sync_strt = crtc->v_sync_strt_wid & 0x7ff; in aty_crtc_to_var()
1185 v_sync_wid = (crtc->v_sync_strt_wid >> 16) & 0x1f; in aty_crtc_to_var()
1186 v_sync_pol = (crtc->v_sync_strt_wid >> 21) & 0x1; in aty_crtc_to_var()
1187 c_sync = crtc->gen_cntl & CRTC_CSYNC_EN ? 1 : 0; in aty_crtc_to_var()
1188 pix_width = crtc->gen_cntl & CRTC_PIX_WIDTH_MASK; in aty_crtc_to_var()
1189 double_scan = crtc->gen_cntl & CRTC_DBL_SCAN_EN; in aty_crtc_to_var()
1190 interlace = crtc->gen_cntl & CRTC_INTERLACE_EN; in aty_crtc_to_var()
1195 left = (h_total - h_sync_strt - h_sync_wid) * 8 - h_sync_dly; in aty_crtc_to_var()
1196 right = (h_sync_strt - h_disp) * 8 + h_sync_dly; in aty_crtc_to_var()
1198 upper = v_total - v_sync_strt - v_sync_wid; in aty_crtc_to_var()
1199 lower = v_sync_strt - v_disp; in aty_crtc_to_var()
1208 var->red.offset = 0; in aty_crtc_to_var()
1209 var->red.length = 8; in aty_crtc_to_var()
1210 var->green.offset = 0; in aty_crtc_to_var()
1211 var->green.length = 8; in aty_crtc_to_var()
1212 var->blue.offset = 0; in aty_crtc_to_var()
1213 var->blue.length = 8; in aty_crtc_to_var()
1214 var->transp.offset = 0; in aty_crtc_to_var()
1215 var->transp.length = 0; in aty_crtc_to_var()
1219 var->red.offset = 10; in aty_crtc_to_var()
1220 var->red.length = 5; in aty_crtc_to_var()
1221 var->green.offset = 5; in aty_crtc_to_var()
1222 var->green.length = 5; in aty_crtc_to_var()
1223 var->blue.offset = 0; in aty_crtc_to_var()
1224 var->blue.length = 5; in aty_crtc_to_var()
1225 var->transp.offset = 0; in aty_crtc_to_var()
1226 var->transp.length = 0; in aty_crtc_to_var()
1230 var->red.offset = 11; in aty_crtc_to_var()
1231 var->red.length = 5; in aty_crtc_to_var()
1232 var->green.offset = 5; in aty_crtc_to_var()
1233 var->green.length = 6; in aty_crtc_to_var()
1234 var->blue.offset = 0; in aty_crtc_to_var()
1235 var->blue.length = 5; in aty_crtc_to_var()
1236 var->transp.offset = 0; in aty_crtc_to_var()
1237 var->transp.length = 0; in aty_crtc_to_var()
1241 var->red.offset = 16; in aty_crtc_to_var()
1242 var->red.length = 8; in aty_crtc_to_var()
1243 var->green.offset = 8; in aty_crtc_to_var()
1244 var->green.length = 8; in aty_crtc_to_var()
1245 var->blue.offset = 0; in aty_crtc_to_var()
1246 var->blue.length = 8; in aty_crtc_to_var()
1247 var->transp.offset = 0; in aty_crtc_to_var()
1248 var->transp.length = 0; in aty_crtc_to_var()
1252 var->red.offset = 16; in aty_crtc_to_var()
1253 var->red.length = 8; in aty_crtc_to_var()
1254 var->green.offset = 8; in aty_crtc_to_var()
1255 var->green.length = 8; in aty_crtc_to_var()
1256 var->blue.offset = 0; in aty_crtc_to_var()
1257 var->blue.length = 8; in aty_crtc_to_var()
1258 var->transp.offset = 24; in aty_crtc_to_var()
1259 var->transp.length = 8; in aty_crtc_to_var()
1263 return -EINVAL; in aty_crtc_to_var()
1267 var->xres = xres; in aty_crtc_to_var()
1268 var->yres = yres; in aty_crtc_to_var()
1269 var->xres_virtual = crtc->vxres; in aty_crtc_to_var()
1270 var->yres_virtual = crtc->vyres; in aty_crtc_to_var()
1271 var->bits_per_pixel = bpp; in aty_crtc_to_var()
1272 var->left_margin = left; in aty_crtc_to_var()
1273 var->right_margin = right; in aty_crtc_to_var()
1274 var->upper_margin = upper; in aty_crtc_to_var()
1275 var->lower_margin = lower; in aty_crtc_to_var()
1276 var->hsync_len = hslen; in aty_crtc_to_var()
1277 var->vsync_len = vslen; in aty_crtc_to_var()
1278 var->sync = sync; in aty_crtc_to_var()
1279 var->vmode = FB_VMODE_NONINTERLACED; in aty_crtc_to_var()
1287 var->vmode = FB_VMODE_INTERLACED; in aty_crtc_to_var()
1290 var->vmode = FB_VMODE_DOUBLE; in aty_crtc_to_var()
1291 var->yres >>= 1; in aty_crtc_to_var()
1292 var->upper_margin >>= 1; in aty_crtc_to_var()
1293 var->lower_margin >>= 1; in aty_crtc_to_var()
1294 var->vsync_len >>= 1; in aty_crtc_to_var()
1300 /* ------------------------------------------------------------------------- */
1304 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_set_par()
1305 struct fb_var_screeninfo *var = &info->var; in atyfb_set_par()
1312 if (par->asleep) in atyfb_set_par()
1315 err = aty_var_to_crtc(info, var, &par->crtc); in atyfb_set_par()
1323 return -EINVAL; in atyfb_set_par()
1325 err = par->pll_ops->var_to_pll(info, pixclock, in atyfb_set_par()
1326 var->bits_per_pixel, &par->pll); in atyfb_set_par()
1331 par->accel_flags = var->accel_flags; /* hack */ in atyfb_set_par()
1333 if (var->accel_flags) { in atyfb_set_par()
1335 info->flags &= ~FBINFO_HWACCEL_DISABLED; in atyfb_set_par()
1338 info->flags |= FBINFO_HWACCEL_DISABLED; in atyfb_set_par()
1341 if (par->blitter_may_be_busy) in atyfb_set_par()
1344 aty_set_crtc(par, &par->crtc); in atyfb_set_par()
1345 par->dac_ops->set_dac(info, &par->pll, in atyfb_set_par()
1346 var->bits_per_pixel, par->accel_flags); in atyfb_set_par()
1347 par->pll_ops->set_pll(info, &par->pll); in atyfb_set_par()
1350 if (par->pll_ops && par->pll_ops->pll_to_var) in atyfb_set_par()
1351 pixclock_in_ps = par->pll_ops->pll_to_var(info, &par->pll); in atyfb_set_par()
1356 PRINTKE("ALERT ops->pll_to_var get 0\n"); in atyfb_set_par()
1361 if (!aty_crtc_to_var(&par->crtc, &debug)) { in atyfb_set_par()
1377 if (par->crtc.gen_cntl & CRTC_INTERLACE_EN) in atyfb_set_par()
1379 if (par->crtc.gen_cntl & CRTC_DBL_SCAN_EN) in atyfb_set_par()
1383 DPRINTK(" Set Visible Mode to %ix%i-%i\n", in atyfb_set_par()
1384 var->xres, var->yres, var->bits_per_pixel); in atyfb_set_par()
1387 var->xres_virtual, var->yres_virtual, in atyfb_set_par()
1407 switch (var->bits_per_pixel) { in atyfb_set_par()
1422 tmp |= par->mem_refresh_rate << 20; in atyfb_set_par()
1423 switch (var->bits_per_pixel) { in atyfb_set_par()
1443 aty_st_le32(BUS_CNTL, 0x7b33a040 | (par->aux_start ? BUS_APER_REG_DIS : 0), par); in atyfb_set_par()
1447 aty_st_le32(BUS_CNTL, 0x7b23a040 | (par->aux_start ? BUS_APER_REG_DIS : 0), par); in atyfb_set_par()
1454 info->fix.line_length = calc_line_length(par, var->xres_virtual, in atyfb_set_par()
1455 var->bits_per_pixel); in atyfb_set_par()
1457 info->fix.visual = var->bits_per_pixel <= 8 ? in atyfb_set_par()
1461 if (par->accel_flags & FB_ACCELF_TEXT) in atyfb_set_par()
1465 btext_update_display(info->fix.smem_start, in atyfb_set_par()
1466 (((par->crtc.h_tot_disp >> 16) & 0xff) + 1) * 8, in atyfb_set_par()
1467 ((par->crtc.v_tot_disp >> 16) & 0x7ff) + 1, in atyfb_set_par()
1468 var->bits_per_pixel, in atyfb_set_par()
1469 par->crtc.vxres * var->bits_per_pixel / 8); in atyfb_set_par()
1478 printk("debug atyfb: Mach64 non-shadow register values:"); in atyfb_set_par()
1505 if (par->lcd_table != 0) { in atyfb_set_par()
1535 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_check_var()
1541 memcpy(&pll, &par->pll, sizeof(pll)); in atyfb_check_var()
1550 if (!(var->activate & FB_ACTIVATE_TEST)) in atyfb_check_var()
1552 return -EINVAL; in atyfb_check_var()
1554 err = par->pll_ops->var_to_pll(info, pixclock, in atyfb_check_var()
1555 var->bits_per_pixel, &pll); in atyfb_check_var()
1560 if (var->accel_flags & FB_ACCELF_TEXT) in atyfb_check_var()
1561 info->var.accel_flags = FB_ACCELF_TEXT; in atyfb_check_var()
1563 info->var.accel_flags = 0; in atyfb_check_var()
1566 var->pixclock = par->pll_ops->pll_to_var(info, &pll); in atyfb_check_var()
1572 u32 xoffset = info->var.xoffset; in set_off_pitch()
1573 u32 yoffset = info->var.yoffset; in set_off_pitch()
1574 u32 line_length = info->fix.line_length; in set_off_pitch()
1575 u32 bpp = info->var.bits_per_pixel; in set_off_pitch()
1577 par->crtc.off_pitch = in set_off_pitch()
1589 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_open()
1592 par->open++; in atyfb_open()
1594 par->mmaped = 0; in atyfb_open()
1606 spin_lock(&par->int_lock); in aty_irq()
1614 par->vblank.count++; in aty_irq()
1615 if (par->vblank.pan_display) { in aty_irq()
1616 par->vblank.pan_display = 0; in aty_irq()
1617 aty_st_le32(CRTC_OFF_PITCH, par->crtc.off_pitch, par); in aty_irq()
1619 wake_up_interruptible(&par->vblank.wait); in aty_irq()
1623 spin_unlock(&par->int_lock); in aty_irq()
1632 if (!test_and_set_bit(0, &par->irq_flags)) { in aty_enable_irq()
1633 if (request_irq(par->irq, aty_irq, IRQF_SHARED, "atyfb", par)) { in aty_enable_irq()
1634 clear_bit(0, &par->irq_flags); in aty_enable_irq()
1635 return -EINVAL; in aty_enable_irq()
1637 spin_lock_irq(&par->int_lock); in aty_enable_irq()
1643 spin_unlock_irq(&par->int_lock); in aty_enable_irq()
1645 spin_lock_irq(&par->int_lock); in aty_enable_irq()
1650 /* re-enable interrupt */ in aty_enable_irq()
1654 spin_unlock_irq(&par->int_lock); in aty_enable_irq()
1664 if (test_and_clear_bit(0, &par->irq_flags)) { in aty_disable_irq()
1665 if (par->vblank.pan_display) { in aty_disable_irq()
1666 par->vblank.pan_display = 0; in aty_disable_irq()
1667 aty_st_le32(CRTC_OFF_PITCH, par->crtc.off_pitch, par); in aty_disable_irq()
1669 spin_lock_irq(&par->int_lock); in aty_disable_irq()
1673 spin_unlock_irq(&par->int_lock); in aty_disable_irq()
1674 free_irq(par->irq, par); in aty_disable_irq()
1682 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_release()
1690 par->open--; in atyfb_release()
1694 if (par->open) in atyfb_release()
1698 was_mmaped = par->mmaped; in atyfb_release()
1700 par->mmaped = 0; in atyfb_release()
1717 u32 videoram = (info->fix.smem_len - (PAGE_SIZE << 2)); in atyfb_release()
1740 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_pan_display()
1743 xres = (((par->crtc.h_tot_disp >> 16) & 0xff) + 1) * 8; in atyfb_pan_display()
1744 yres = ((par->crtc.v_tot_disp >> 16) & 0x7ff) + 1; in atyfb_pan_display()
1745 if (par->crtc.gen_cntl & CRTC_DBL_SCAN_EN) in atyfb_pan_display()
1747 xoffset = (var->xoffset + 7) & ~7; in atyfb_pan_display()
1748 yoffset = var->yoffset; in atyfb_pan_display()
1749 if (xoffset + xres > par->crtc.vxres || in atyfb_pan_display()
1750 yoffset + yres > par->crtc.vyres) in atyfb_pan_display()
1751 return -EINVAL; in atyfb_pan_display()
1752 info->var.xoffset = xoffset; in atyfb_pan_display()
1753 info->var.yoffset = yoffset; in atyfb_pan_display()
1754 if (par->asleep) in atyfb_pan_display()
1758 if ((var->activate & FB_ACTIVATE_VBL) && !aty_enable_irq(par, 0)) { in atyfb_pan_display()
1759 par->vblank.pan_display = 1; in atyfb_pan_display()
1761 par->vblank.pan_display = 0; in atyfb_pan_display()
1762 aty_st_le32(CRTC_OFF_PITCH, par->crtc.off_pitch, par); in atyfb_pan_display()
1776 vbl = &par->vblank; in aty_waitforvblank()
1779 return -ENODEV; in aty_waitforvblank()
1786 count = vbl->count; in aty_waitforvblank()
1787 ret = wait_event_interruptible_timeout(vbl->wait, in aty_waitforvblank()
1788 count != vbl->count, HZ/10); in aty_waitforvblank()
1793 return -ETIMEDOUT; in aty_waitforvblank()
1813 u32 dsp_xclks_per_row; /* 0-16383 */
1814 u32 dsp_loop_latency; /* 0-15 */
1815 u32 dsp_precision; /* 0-7 */
1816 u32 dsp_on; /* 0-2047 */
1817 u32 dsp_off; /* 0-2047 */
1826 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_ioctl()
1835 fbtyp.fb_width = par->crtc.vxres; in atyfb_ioctl()
1836 fbtyp.fb_height = par->crtc.vyres; in atyfb_ioctl()
1837 fbtyp.fb_depth = info->var.bits_per_pixel; in atyfb_ioctl()
1838 fbtyp.fb_cmsize = info->cmap.len; in atyfb_ioctl()
1839 fbtyp.fb_size = info->fix.smem_len; in atyfb_ioctl()
1842 return -EFAULT; in atyfb_ioctl()
1851 return -EFAULT; in atyfb_ioctl()
1860 union aty_pll *pll = &par->pll; in atyfb_ioctl()
1861 u32 dsp_config = pll->ct.dsp_config; in atyfb_ioctl()
1862 u32 dsp_on_off = pll->ct.dsp_on_off; in atyfb_ioctl()
1863 clk.ref_clk_per = par->ref_clk_per; in atyfb_ioctl()
1864 clk.pll_ref_div = pll->ct.pll_ref_div; in atyfb_ioctl()
1865 clk.mclk_fb_div = pll->ct.mclk_fb_div; in atyfb_ioctl()
1866 clk.mclk_post_div = pll->ct.mclk_post_div_real; in atyfb_ioctl()
1867 clk.mclk_fb_mult = pll->ct.mclk_fb_mult; in atyfb_ioctl()
1868 clk.xclk_post_div = pll->ct.xclk_post_div_real; in atyfb_ioctl()
1869 clk.vclk_fb_div = pll->ct.vclk_fb_div; in atyfb_ioctl()
1870 clk.vclk_post_div = pll->ct.vclk_post_div_real; in atyfb_ioctl()
1878 return -EFAULT; in atyfb_ioctl()
1880 return -EINVAL; in atyfb_ioctl()
1885 union aty_pll *pll = &par->pll; in atyfb_ioctl()
1888 return -EFAULT; in atyfb_ioctl()
1889 par->ref_clk_per = clk.ref_clk_per; in atyfb_ioctl()
1890 pll->ct.pll_ref_div = clk.pll_ref_div; in atyfb_ioctl()
1891 pll->ct.mclk_fb_div = clk.mclk_fb_div; in atyfb_ioctl()
1892 pll->ct.mclk_post_div_real = clk.mclk_post_div; in atyfb_ioctl()
1893 pll->ct.mclk_fb_mult = clk.mclk_fb_mult; in atyfb_ioctl()
1894 pll->ct.xclk_post_div_real = clk.xclk_post_div; in atyfb_ioctl()
1895 pll->ct.vclk_fb_div = clk.vclk_fb_div; in atyfb_ioctl()
1896 pll->ct.vclk_post_div_real = clk.vclk_post_div; in atyfb_ioctl()
1897 pll->ct.dsp_config = (clk.dsp_xclks_per_row & 0x3fff) | in atyfb_ioctl()
1900 pll->ct.dsp_on_off = (clk.dsp_off & 0x7ff) | in atyfb_ioctl()
1902 /*aty_calc_pll_ct(info, &pll->ct);*/ in atyfb_ioctl()
1905 return -EINVAL; in atyfb_ioctl()
1908 if (get_user(par->features, (u32 __user *) arg)) in atyfb_ioctl()
1909 return -EFAULT; in atyfb_ioctl()
1912 if (put_user(par->features, (u32 __user *) arg)) in atyfb_ioctl()
1913 return -EFAULT; in atyfb_ioctl()
1917 return -EINVAL; in atyfb_ioctl()
1924 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_sync()
1926 if (par->blitter_may_be_busy) in atyfb_sync()
1934 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_mmap()
1940 if (!par->mmap_map) in atyfb_mmap()
1941 return -ENXIO; in atyfb_mmap()
1943 if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) in atyfb_mmap()
1944 return -EINVAL; in atyfb_mmap()
1946 off = vma->vm_pgoff << PAGE_SHIFT; in atyfb_mmap()
1947 size = vma->vm_end - vma->vm_start; in atyfb_mmap()
1951 if (((vma->vm_pgoff == 0) && (size == info->fix.smem_len)) || in atyfb_mmap()
1952 ((off == info->fix.smem_len) && (size == PAGE_SIZE))) in atyfb_mmap()
1955 vma->vm_pgoff = off >> PAGE_SHIFT; /* propagate off changes */ in atyfb_mmap()
1960 for (i = 0; par->mmap_map[i].size; i++) { in atyfb_mmap()
1961 unsigned long start = par->mmap_map[i].voff; in atyfb_mmap()
1962 unsigned long end = start + par->mmap_map[i].size; in atyfb_mmap()
1970 map_size = par->mmap_map[i].size - (offset - start); in atyfb_mmap()
1971 map_offset = par->mmap_map[i].poff + (offset - start); in atyfb_mmap()
1979 map_size = size - page; in atyfb_mmap()
1981 pgprot_val(vma->vm_page_prot) &= ~(par->mmap_map[i].prot_mask); in atyfb_mmap()
1982 pgprot_val(vma->vm_page_prot) |= par->mmap_map[i].prot_flag; in atyfb_mmap()
1984 if (remap_pfn_range(vma, vma->vm_start + page, in atyfb_mmap()
1985 map_offset >> PAGE_SHIFT, map_size, vma->vm_page_prot)) in atyfb_mmap()
1986 return -EAGAIN; in atyfb_mmap()
1992 return -EINVAL; in atyfb_mmap()
1994 if (!par->mmaped) in atyfb_mmap()
1995 par->mmaped = 1; in atyfb_mmap()
2034 if ((--timeout) == 0) in aty_power_mgmt()
2053 if ((--timeout) == 0) in aty_power_mgmt()
2059 return timeout ? 0 : -EIO; in aty_power_mgmt()
2067 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_pci_suspend_late()
2069 if (state.event == pdev->dev.power.power_state.event) in atyfb_pci_suspend_late()
2083 par->asleep = 1; in atyfb_pci_suspend_late()
2084 par->lock_blank = 1; in atyfb_pci_suspend_late()
2095 par->asleep = 0; in atyfb_pci_suspend_late()
2096 par->lock_blank = 0; in atyfb_pci_suspend_late()
2100 return -EIO; in atyfb_pci_suspend_late()
2106 pdev->dev.power.power_state = state; in atyfb_pci_suspend_late()
2128 struct atyfb_par *par = info->par; in aty_resume_chip()
2130 aty_st_le32(MEM_CNTL, par->mem_cntl, par); in aty_resume_chip()
2132 if (par->pll_ops->resume_pll) in aty_resume_chip()
2133 par->pll_ops->resume_pll(info, &par->pll); in aty_resume_chip()
2135 if (par->aux_start) in aty_resume_chip()
2144 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_pci_resume()
2146 if (pdev->dev.power.power_state.event == PM_EVENT_ON) in atyfb_pci_resume()
2159 pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) in atyfb_pci_resume()
2165 par->asleep = 0; in atyfb_pci_resume()
2174 par->lock_blank = 0; in atyfb_pci_resume()
2179 pdev->dev.power.power_state = PMSG_ON; in atyfb_pci_resume()
2203 struct fb_info *info = pci_get_drvdata(par->pdev); in aty_bl_get_level_brightness()
2208 atylevel = info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_LEVEL; in aty_bl_get_level_brightness()
2244 struct fb_info *info = pci_get_drvdata(par->pdev); in aty_bl_init()
2249 if (!pmac_has_backlight_type("ati")) in aty_bl_init()
2253 snprintf(name, sizeof(name), "atybl%d", info->node); in aty_bl_init()
2257 props.max_brightness = FB_BACKLIGHT_LEVELS - 1; in aty_bl_init()
2258 bd = backlight_device_register(name, info->device, par, &aty_bl_data, in aty_bl_init()
2261 info->bl_dev = NULL; in aty_bl_init()
2266 info->bl_dev = bd; in aty_bl_init()
2271 bd->props.brightness = bd->props.max_brightness; in aty_bl_init()
2272 bd->props.power = FB_BLANK_UNBLANK; in aty_bl_init()
2317 par->mem_refresh_rate = i; in aty_calc_mem_refresh()
2330 int ret = -EINVAL; in atyfb_get_timings_from_lcd()
2332 if (par->lcd_table != 0 && (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) { in atyfb_get_timings_from_lcd()
2334 var->xres = var->xres_virtual = par->lcd_hdisp; in atyfb_get_timings_from_lcd()
2335 var->right_margin = par->lcd_right_margin; in atyfb_get_timings_from_lcd()
2336 var->left_margin = par->lcd_hblank_len - in atyfb_get_timings_from_lcd()
2337 (par->lcd_right_margin + par->lcd_hsync_dly + in atyfb_get_timings_from_lcd()
2338 par->lcd_hsync_len); in atyfb_get_timings_from_lcd()
2339 var->hsync_len = par->lcd_hsync_len + par->lcd_hsync_dly; in atyfb_get_timings_from_lcd()
2340 var->yres = var->yres_virtual = par->lcd_vdisp; in atyfb_get_timings_from_lcd()
2341 var->lower_margin = par->lcd_lower_margin; in atyfb_get_timings_from_lcd()
2342 var->upper_margin = par->lcd_vblank_len - in atyfb_get_timings_from_lcd()
2343 (par->lcd_lower_margin + par->lcd_vsync_len); in atyfb_get_timings_from_lcd()
2344 var->vsync_len = par->lcd_vsync_len; in atyfb_get_timings_from_lcd()
2345 var->pixclock = par->lcd_pixclock; in atyfb_get_timings_from_lcd()
2355 struct atyfb_par *par = (struct atyfb_par *) info->par; in aty_init()
2364 init_waitqueue_head(&par->vblank.wait); in aty_init()
2365 spin_lock_init(&par->int_lock); in aty_init()
2372 par->bus_type = (stat0 >> 0) & 0x07; in aty_init()
2373 par->ram_type = (stat0 >> 3) & 0x07; in aty_init()
2374 ramname = aty_gx_ram[par->ram_type]; in aty_init()
2389 par->dac_ops = &aty_dac_ibm514; in aty_init()
2394 par->dac_ops = &aty_dac_ati68860b; in aty_init()
2398 par->dac_ops = &aty_dac_att21c498; in aty_init()
2403 par->dac_ops = &aty_dac_unsupported; in aty_init()
2409 par->pll_ops = &aty_pll_ati18818_1; in aty_init()
2413 par->pll_ops = &aty_pll_ibm514; in aty_init()
2418 par->pll_ops = &aty_pll_unsupported; in aty_init()
2425 par->dac_ops = &aty_dac_ct; in aty_init()
2426 par->pll_ops = &aty_pll_ct; in aty_init()
2427 par->bus_type = PCI; in aty_init()
2428 par->ram_type = (aty_ld_le32(CNFG_STAT0, par) & 0x07); in aty_init()
2430 ramname = aty_xl_ram[par->ram_type]; in aty_init()
2432 ramname = aty_ct_ram[par->ram_type]; in aty_init()
2434 if (par->pll_limits.mclk == 67 && par->ram_type < SDRAM) in aty_init()
2435 par->pll_limits.mclk = 63; in aty_init()
2437 if (M64_HAS(MOBIL_BUS) && par->ram_type == SDRAM32) in aty_init()
2438 par->pll_limits.xclk = (par->pll_limits.xclk + 1) >> 1; in aty_init()
2443 * The Apple iBook1 uses non-standard memory frequencies. in aty_init()
2447 par->pll_limits.mclk = 70; in aty_init()
2448 par->pll_limits.xclk = 53; in aty_init()
2454 par->pll_limits.pll_max = pll; in aty_init()
2456 par->pll_limits.mclk = mclk; in aty_init()
2458 par->pll_limits.xclk = xclk; in aty_init()
2460 aty_calc_mem_refresh(par, par->pll_limits.xclk); in aty_init()
2461 par->pll_per = 1000000/par->pll_limits.pll_max; in aty_init()
2462 par->mclk_per = 1000000/par->pll_limits.mclk; in aty_init()
2463 par->xclk_per = 1000000/par->pll_limits.xclk; in aty_init()
2465 par->ref_clk_per = 1000000000000ULL / 14318180; in aty_init()
2474 diff1 = 510 * 14 / pll_ref_div - par->pll_limits.pll_max; in aty_init()
2475 diff2 = 510 * 29 / pll_ref_div - par->pll_limits.pll_max; in aty_init()
2477 diff1 = -diff1; in aty_init()
2479 diff2 = -diff2; in aty_init()
2481 par->ref_clk_per = 1000000000000ULL / 29498928; in aty_init()
2489 aty_get_crtc(par, &par->saved_crtc); in aty_init()
2490 if (par->pll_ops->get_pll) in aty_init()
2491 par->pll_ops->get_pll(info, &par->saved_pll); in aty_init()
2493 par->mem_cntl = aty_ld_le32(MEM_CNTL, par); in aty_init()
2497 switch (par->mem_cntl & 0xF) { in aty_init()
2499 info->fix.smem_len = 0x80000; in aty_init()
2502 info->fix.smem_len = 0x100000; in aty_init()
2505 info->fix.smem_len = 0x200000; in aty_init()
2508 info->fix.smem_len = 0x400000; in aty_init()
2511 info->fix.smem_len = 0x600000; in aty_init()
2514 info->fix.smem_len = 0x800000; in aty_init()
2517 info->fix.smem_len = 0x80000; in aty_init()
2519 switch (par->mem_cntl & MEM_SIZE_ALIAS) { in aty_init()
2521 info->fix.smem_len = 0x80000; in aty_init()
2524 info->fix.smem_len = 0x100000; in aty_init()
2527 info->fix.smem_len = 0x200000; in aty_init()
2530 info->fix.smem_len = 0x400000; in aty_init()
2533 info->fix.smem_len = 0x600000; in aty_init()
2536 info->fix.smem_len = 0x800000; in aty_init()
2539 info->fix.smem_len = 0x80000; in aty_init()
2544 info->fix.smem_len += 0x400000; in aty_init()
2548 info->fix.smem_len = vram * 1024; in aty_init()
2549 par->mem_cntl &= ~(gtb_memsize ? 0xF : MEM_SIZE_ALIAS); in aty_init()
2550 if (info->fix.smem_len <= 0x80000) in aty_init()
2551 par->mem_cntl |= MEM_SIZE_512K; in aty_init()
2552 else if (info->fix.smem_len <= 0x100000) in aty_init()
2553 par->mem_cntl |= MEM_SIZE_1M; in aty_init()
2554 else if (info->fix.smem_len <= 0x200000) in aty_init()
2555 par->mem_cntl |= gtb_memsize ? MEM_SIZE_2M_GTB : MEM_SIZE_2M; in aty_init()
2556 else if (info->fix.smem_len <= 0x400000) in aty_init()
2557 par->mem_cntl |= gtb_memsize ? MEM_SIZE_4M_GTB : MEM_SIZE_4M; in aty_init()
2558 else if (info->fix.smem_len <= 0x600000) in aty_init()
2559 par->mem_cntl |= gtb_memsize ? MEM_SIZE_6M_GTB : MEM_SIZE_6M; in aty_init()
2561 par->mem_cntl |= gtb_memsize ? MEM_SIZE_8M_GTB : MEM_SIZE_8M; in aty_init()
2562 aty_st_le32(MEM_CNTL, par->mem_cntl, par); in aty_init()
2566 * Reg Block 0 (CT-compatible block) is at mmio_start in aty_init()
2567 * Reg Block 1 (multimedia extensions) is at mmio_start - 0x400 in aty_init()
2570 info->fix.mmio_len = 0x400; in aty_init()
2571 info->fix.accel = FB_ACCEL_ATI_MACH64GX; in aty_init()
2573 info->fix.mmio_len = 0x400; in aty_init()
2574 info->fix.accel = FB_ACCEL_ATI_MACH64CT; in aty_init()
2576 info->fix.mmio_start -= 0x400; in aty_init()
2577 info->fix.mmio_len = 0x800; in aty_init()
2578 info->fix.accel = FB_ACCEL_ATI_MACH64VT; in aty_init()
2580 info->fix.mmio_start -= 0x400; in aty_init()
2581 info->fix.mmio_len = 0x800; in aty_init()
2582 info->fix.accel = FB_ACCEL_ATI_MACH64GT; in aty_init()
2586 info->fix.smem_len == 0x80000 ? 512 : (info->fix.smem_len>>20), in aty_init()
2587 info->fix.smem_len == 0x80000 ? 'K' : 'M', ramname, xtal, in aty_init()
2588 par->pll_limits.pll_max, par->pll_limits.mclk, in aty_init()
2589 par->pll_limits.xclk); in aty_init()
2614 if (par->pll_ops->init_pll) in aty_init()
2615 par->pll_ops->init_pll(info, &par->pll); in aty_init()
2616 if (par->pll_ops->resume_pll) in aty_init()
2617 par->pll_ops->resume_pll(info, &par->pll); in aty_init()
2626 if (par->aux_start) in aty_init()
2635 par->wc_cookie = arch_phys_wc_add(par->res_start, in aty_init()
2636 par->res_size); in aty_init()
2638 info->fbops = &atyfb_ops; in aty_init()
2639 info->pseudo_palette = par->pseudo_palette; in aty_init()
2640 info->flags = FBINFO_HWACCEL_IMAGEBLIT | in aty_init()
2650 * wake up from sleep -- paulus in aty_init()
2661 * FIXME: The NVRAM stuff should be put in a Mac-specific file, in aty_init()
2712 if (comp_sync != -1) { in aty_init()
2720 u32 videoram = (info->fix.smem_len - (PAGE_SIZE << 2)); in aty_init()
2736 info->var = var; in aty_init()
2738 ret = fb_alloc_cmap(&info->cmap, 256, 0); in aty_init()
2744 fb_dealloc_cmap(&info->cmap); in aty_init()
2757 info->node, info->fix.id, par->bus_type == ISA ? "ISA" : "PCI"); in aty_init()
2762 aty_set_crtc(par, &par->saved_crtc); in aty_init()
2763 par->pll_ops->set_pll(info, &par->saved_pll); in aty_init()
2764 arch_phys_wc_del(par->wc_cookie); in aty_init()
2796 return -1; in store_video_par()
2806 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_blank()
2809 if (par->lock_blank || par->asleep) in atyfb_blank()
2813 if (par->lcd_table && blank > FB_BLANK_NORMAL && in atyfb_blank()
2842 if (par->lcd_table && blank <= FB_BLANK_NORMAL && in atyfb_blank()
2872 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_setcolreg()
2874 u32 *pal = info->pseudo_palette; in atyfb_setcolreg()
2876 depth = info->var.bits_per_pixel; in atyfb_setcolreg()
2878 depth = (info->var.green.length == 5) ? 15 : 16; in atyfb_setcolreg()
2880 if (par->asleep) in atyfb_setcolreg()
2892 par->palette[regno].red = red; in atyfb_setcolreg()
2893 par->palette[regno].green = green; in atyfb_setcolreg()
2894 par->palette[regno].blue = blue; in atyfb_setcolreg()
2924 par->palette[regno << 1].green, in atyfb_setcolreg()
2926 red = par->palette[regno >> 1].red; in atyfb_setcolreg()
2927 blue = par->palette[regno >> 1].blue; in atyfb_setcolreg()
2947 struct atyfb_par *par = info->par; in atyfb_setup_sparc()
2953 * Map memory-mapped registers. in atyfb_setup_sparc()
2955 par->ati_regbase = (void *)addr + 0x7ffc00UL; in atyfb_setup_sparc()
2956 info->fix.mmio_start = addr + 0x7ffc00UL; in atyfb_setup_sparc()
2959 * Map in big-endian aperture. in atyfb_setup_sparc()
2961 info->screen_base = (char *) (addr + 0x800000UL); in atyfb_setup_sparc()
2962 info->fix.smem_start = addr + 0x800000UL; in atyfb_setup_sparc()
2966 * Split Framebuffer in big- and little-endian halfs. in atyfb_setup_sparc()
2968 for (i = 0; i < 6 && pdev->resource[i].start; i++) in atyfb_setup_sparc()
2972 par->mmap_map = kcalloc(j, sizeof(*par->mmap_map), GFP_ATOMIC); in atyfb_setup_sparc()
2973 if (!par->mmap_map) { in atyfb_setup_sparc()
2975 return -ENOMEM; in atyfb_setup_sparc()
2978 for (i = 0, j = 2; i < 6 && pdev->resource[i].start; i++) { in atyfb_setup_sparc()
2979 struct resource *rp = &pdev->resource[i]; in atyfb_setup_sparc()
2984 base = rp->start; in atyfb_setup_sparc()
2986 io = (rp->flags & IORESOURCE_IO); in atyfb_setup_sparc()
2988 size = rp->end - base + 1; in atyfb_setup_sparc()
3002 par->mmap_map[j].voff = (pbase + 0x10000000) & PAGE_MASK; in atyfb_setup_sparc()
3003 par->mmap_map[j].poff = base & PAGE_MASK; in atyfb_setup_sparc()
3004 par->mmap_map[j].size = (size + ~PAGE_MASK) & PAGE_MASK; in atyfb_setup_sparc()
3005 par->mmap_map[j].prot_mask = _PAGE_CACHE; in atyfb_setup_sparc()
3006 par->mmap_map[j].prot_flag = _PAGE_E; in atyfb_setup_sparc()
3015 par->mmap_map[j].voff = (pbase + 0x800000) & PAGE_MASK; in atyfb_setup_sparc()
3016 par->mmap_map[j].poff = (base + 0x800000) & PAGE_MASK; in atyfb_setup_sparc()
3017 par->mmap_map[j].size = 0x800000; in atyfb_setup_sparc()
3018 par->mmap_map[j].prot_mask = _PAGE_CACHE; in atyfb_setup_sparc()
3019 par->mmap_map[j].prot_flag = _PAGE_E | _PAGE_IE; in atyfb_setup_sparc()
3020 size -= 0x800000; in atyfb_setup_sparc()
3024 par->mmap_map[j].voff = pbase & PAGE_MASK; in atyfb_setup_sparc()
3025 par->mmap_map[j].poff = base & PAGE_MASK; in atyfb_setup_sparc()
3026 par->mmap_map[j].size = (size + ~PAGE_MASK) & PAGE_MASK; in atyfb_setup_sparc()
3027 par->mmap_map[j].prot_mask = _PAGE_CACHE; in atyfb_setup_sparc()
3028 par->mmap_map[j].prot_flag = _PAGE_E; in atyfb_setup_sparc()
3036 if (IS_XL(pdev->device)) { in atyfb_setup_sparc()
3076 var->bits_per_pixel = of_getintprop_default(dp, "depth", 8); in atyfb_setup_sparc()
3077 var->xoffset = var->yoffset = 0; in atyfb_setup_sparc()
3115 * Target Frequency: in atyfb_setup_sparc()
3118 * Q = ------- in atyfb_setup_sparc()
3123 if (IS_XL(pdev->device)) in atyfb_setup_sparc()
3149 * - Check the startup video mode and calculate the panel in aty_init_lcd()
3151 * - Read it from the driver information table in the video BIOS. in aty_init_lcd()
3164 par->lcd_table = 0; in aty_init_lcd()
3166 par->lcd_table = bios_base + lcd_ofs; in aty_init_lcd()
3169 if (par->lcd_table != 0) { in aty_init_lcd()
3188 id = *(u8 *)par->lcd_table; in aty_init_lcd()
3189 strscpy(model, (char *)par->lcd_table+1, sizeof(model)); in aty_init_lcd()
3191 width = par->lcd_width = *(u16 *)(par->lcd_table+25); in aty_init_lcd()
3192 height = par->lcd_height = *(u16 *)(par->lcd_table+27); in aty_init_lcd()
3193 panel_type = *(u16 *)(par->lcd_table+29); in aty_init_lcd()
3222 format = *(u32 *)(par->lcd_table+57); in aty_init_lcd()
3255 txtformat = "262144 colours (FDPI-2 mode)"; in aty_init_lcd()
3266 refresh_rates = *(u16 *)(par->lcd_table+62); in aty_init_lcd()
3283 default_refresh_rate = (*(u8 *)(par->lcd_table+61) & 0xf0) >> 4; in aty_init_lcd()
3286 par->lcd_refreshrate = lcd_refresh_rates[default_refresh_rate]; in aty_init_lcd()
3299 lcdmodeptr = (u16 *)(par->lcd_table + 64); in aty_init_lcd()
3309 par->lcd_pixclock = 100000000 / *((u16 *)(modeptr+9)); in aty_init_lcd()
3310 par->lcd_htotal = *((u16 *)(modeptr+17)) & 511; in aty_init_lcd()
3311 par->lcd_hdisp = *((u16 *)(modeptr+19)) & 511; in aty_init_lcd()
3313 par->lcd_hsync_dly = (*((u16 *)(modeptr+21)) >> 9) & 7; in aty_init_lcd()
3314 par->lcd_hsync_len = *((u8 *)(modeptr+23)) & 63; in aty_init_lcd()
3316 par->lcd_vtotal = *((u16 *)(modeptr+24)) & 2047; in aty_init_lcd()
3317 par->lcd_vdisp = *((u16 *)(modeptr+26)) & 2047; in aty_init_lcd()
3319 par->lcd_vsync_len = (*((u16 *)(modeptr+28)) >> 11) & 31; in aty_init_lcd()
3321 par->lcd_htotal = (par->lcd_htotal + 1) * 8; in aty_init_lcd()
3322 par->lcd_hdisp = (par->lcd_hdisp + 1) * 8; in aty_init_lcd()
3324 par->lcd_hsync_len = par->lcd_hsync_len * 8; in aty_init_lcd()
3326 par->lcd_vtotal++; in aty_init_lcd()
3327 par->lcd_vdisp++; in aty_init_lcd()
3330 par->lcd_right_margin = lcd_hsync_start - par->lcd_hdisp; in aty_init_lcd()
3331 par->lcd_lower_margin = lcd_vsync_start - par->lcd_vdisp; in aty_init_lcd()
3332 par->lcd_hblank_len = par->lcd_htotal - par->lcd_hdisp; in aty_init_lcd()
3333 par->lcd_vblank_len = par->lcd_vtotal - par->lcd_vdisp; in aty_init_lcd()
3344 1000000 / par->lcd_pixclock, 1000000 % par->lcd_pixclock, in aty_init_lcd()
3345 par->lcd_hdisp, in aty_init_lcd()
3346 par->lcd_hdisp + par->lcd_right_margin, in aty_init_lcd()
3347 par->lcd_hdisp + par->lcd_right_margin in aty_init_lcd()
3348 + par->lcd_hsync_dly + par->lcd_hsync_len, in aty_init_lcd()
3349 par->lcd_htotal, in aty_init_lcd()
3350 par->lcd_vdisp, in aty_init_lcd()
3351 par->lcd_vdisp + par->lcd_lower_margin, in aty_init_lcd()
3352 par->lcd_vdisp + par->lcd_lower_margin + par->lcd_vsync_len, in aty_init_lcd()
3353 par->lcd_vtotal); in aty_init_lcd()
3355 par->lcd_pixclock, in aty_init_lcd()
3356 par->lcd_hblank_len - (par->lcd_right_margin + in aty_init_lcd()
3357 par->lcd_hsync_dly + par->lcd_hsync_len), in aty_init_lcd()
3358 par->lcd_hdisp, in aty_init_lcd()
3359 par->lcd_right_margin, in aty_init_lcd()
3360 par->lcd_hsync_len, in aty_init_lcd()
3361 par->lcd_vblank_len - (par->lcd_lower_margin + par->lcd_vsync_len), in aty_init_lcd()
3362 par->lcd_vdisp, in aty_init_lcd()
3363 par->lcd_lower_margin, in aty_init_lcd()
3364 par->lcd_vsync_len); in aty_init_lcd()
3401 par->pll_limits.pll_min = pll_block.PCLK_min_freq/100; in init_from_bios()
3402 par->pll_limits.pll_max = pll_block.PCLK_max_freq/100; in init_from_bios()
3403 par->pll_limits.ref_clk = pll_block.ref_freq/100; in init_from_bios()
3404 par->pll_limits.ref_div = pll_block.ref_divider; in init_from_bios()
3405 par->pll_limits.sclk = pll_block.SCLK_freq/100; in init_from_bios()
3406 par->pll_limits.mclk = pll_block.MCLK_max_freq/100; in init_from_bios()
3407 par->pll_limits.mclk_pm = pll_block.MCLK_pwd/100; in init_from_bios()
3408 par->pll_limits.xclk = pll_block.XCLK_max_freq/100; in init_from_bios()
3415 ret = -ENXIO; in init_from_bios()
3426 struct atyfb_par *par = info->par; in atyfb_setup_generic()
3433 rrp = &pdev->resource[2]; in atyfb_setup_generic()
3434 if ((rrp->flags & IORESOURCE_MEM) && in atyfb_setup_generic()
3435 request_mem_region(rrp->start, resource_size(rrp), "atyfb")) { in atyfb_setup_generic()
3436 par->aux_start = rrp->start; in atyfb_setup_generic()
3437 par->aux_size = resource_size(rrp); in atyfb_setup_generic()
3438 raddr = rrp->start; in atyfb_setup_generic()
3442 info->fix.mmio_start = raddr; in atyfb_setup_generic()
3446 * effect on the MMIO region on both non-PAT and PAT systems. in atyfb_setup_generic()
3448 par->ati_regbase = ioremap_uc(info->fix.mmio_start, 0x1000); in atyfb_setup_generic()
3450 par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000); in atyfb_setup_generic()
3452 if (par->ati_regbase == NULL) in atyfb_setup_generic()
3453 return -ENOMEM; in atyfb_setup_generic()
3455 info->fix.mmio_start += par->aux_start ? 0x400 : 0xc00; in atyfb_setup_generic()
3456 par->ati_regbase += par->aux_start ? 0x400 : 0xc00; in atyfb_setup_generic()
3459 * Enable memory-space accesses using config-space in atyfb_setup_generic()
3468 /* Use the big-endian aperture */ in atyfb_setup_generic()
3473 info->fix.smem_start = addr; in atyfb_setup_generic()
3486 info->fix.smem_len = 0x800000; in atyfb_setup_generic()
3490 info->screen_base = ioremap_wc(info->fix.smem_start, in atyfb_setup_generic()
3491 info->fix.smem_len); in atyfb_setup_generic()
3492 if (info->screen_base == NULL) { in atyfb_setup_generic()
3493 ret = -ENOMEM; in atyfb_setup_generic()
3505 /* according to ATI, we should use clock 3 for acelerated mode */ in atyfb_setup_generic()
3506 par->clk_wr_offset = 3; in atyfb_setup_generic()
3511 iounmap(par->ati_regbase); in atyfb_setup_generic()
3512 par->ati_regbase = NULL; in atyfb_setup_generic()
3513 if (info->screen_base) { in atyfb_setup_generic()
3514 iounmap(info->screen_base); in atyfb_setup_generic()
3515 info->screen_base = NULL; in atyfb_setup_generic()
3538 return -ENXIO; in atyfb_pci_probe()
3542 rp = &pdev->resource[0]; in atyfb_pci_probe()
3543 if (rp->flags & IORESOURCE_IO) in atyfb_pci_probe()
3544 rp = &pdev->resource[1]; in atyfb_pci_probe()
3545 addr = rp->start; in atyfb_pci_probe()
3547 return -ENXIO; in atyfb_pci_probe()
3550 res_start = rp->start; in atyfb_pci_probe()
3553 return -EBUSY; in atyfb_pci_probe()
3556 info = framebuffer_alloc(sizeof(struct atyfb_par), &pdev->dev); in atyfb_pci_probe()
3558 return -ENOMEM; in atyfb_pci_probe()
3560 par = info->par; in atyfb_pci_probe()
3561 par->bus_type = PCI; in atyfb_pci_probe()
3562 info->fix = atyfb_fix; in atyfb_pci_probe()
3563 info->device = &pdev->dev; in atyfb_pci_probe()
3564 par->pci_id = pdev->device; in atyfb_pci_probe()
3565 par->res_start = res_start; in atyfb_pci_probe()
3566 par->res_size = res_size; in atyfb_pci_probe()
3567 par->irq = pdev->irq; in atyfb_pci_probe()
3568 par->pdev = pdev; in atyfb_pci_probe()
3590 par->mmap_map[0].voff = 0x8000000000000000UL; in atyfb_pci_probe()
3591 par->mmap_map[0].poff = (unsigned long) info->screen_base & PAGE_MASK; in atyfb_pci_probe()
3592 par->mmap_map[0].size = info->fix.smem_len; in atyfb_pci_probe()
3593 par->mmap_map[0].prot_mask = _PAGE_CACHE; in atyfb_pci_probe()
3594 par->mmap_map[0].prot_flag = _PAGE_E; in atyfb_pci_probe()
3595 par->mmap_map[1].voff = par->mmap_map[0].voff + info->fix.smem_len; in atyfb_pci_probe()
3596 par->mmap_map[1].poff = (long)par->ati_regbase & PAGE_MASK; in atyfb_pci_probe()
3597 par->mmap_map[1].size = PAGE_SIZE; in atyfb_pci_probe()
3598 par->mmap_map[1].prot_mask = _PAGE_CACHE; in atyfb_pci_probe()
3599 par->mmap_map[1].prot_flag = _PAGE_E; in atyfb_pci_probe()
3611 kfree(par->mmap_map); in atyfb_pci_probe()
3613 if (par->ati_regbase) in atyfb_pci_probe()
3614 iounmap(par->ati_regbase); in atyfb_pci_probe()
3615 if (info->screen_base) in atyfb_pci_probe()
3616 iounmap(info->screen_base); in atyfb_pci_probe()
3619 if (par->aux_start) in atyfb_pci_probe()
3620 release_mem_region(par->aux_start, par->aux_size); in atyfb_pci_probe()
3622 release_mem_region(par->res_start, par->res_size); in atyfb_pci_probe()
3650 return -ENOMEM; in atyfb_atari_probe()
3652 par = info->par; in atyfb_atari_probe()
3654 info->fix = atyfb_fix; in atyfb_atari_probe()
3656 par->irq = (unsigned int) -1; /* something invalid */ in atyfb_atari_probe()
3662 info->screen_base = ioremap_wc(phys_vmembase[m64_num], in atyfb_atari_probe()
3664 info->fix.smem_start = (unsigned long)info->screen_base; /* Fake! */ in atyfb_atari_probe()
3665 par->ati_regbase = ioremap(phys_guiregbase[m64_num], 0x10000) + in atyfb_atari_probe()
3667 info->fix.mmio_start = (unsigned long)par->ati_regbase; /* Fake! */ in atyfb_atari_probe()
3674 par->clk_wr_offset = 3; /* */ in atyfb_atari_probe()
3677 par->clk_wr_offset = 2; /* Medusa ST-IO ISA Adapter etc. */ in atyfb_atari_probe()
3680 par->clk_wr_offset = 1; /* */ in atyfb_atari_probe()
3683 par->clk_wr_offset = 0; /* Panther 1 ISA Adapter (Gerald) */ in atyfb_atari_probe()
3690 par->pci_id = PCI_CHIP_MACH64GX; in atyfb_atari_probe()
3693 par->pci_id = PCI_CHIP_MACH64CX; in atyfb_atari_probe()
3700 iounmap(info->screen_base); in atyfb_atari_probe()
3701 iounmap(par->ati_regbase); in atyfb_atari_probe()
3708 return num_found ? 0 : -ENXIO; in atyfb_atari_probe()
3717 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_remove()
3720 aty_set_crtc(par, &par->saved_crtc); in atyfb_remove()
3721 par->pll_ops->set_pll(info, &par->saved_pll); in atyfb_remove()
3725 aty_bl_exit(info->bl_dev); in atyfb_remove()
3730 arch_phys_wc_del(par->wc_cookie); in atyfb_remove()
3733 if (par->ati_regbase) in atyfb_remove()
3734 iounmap(par->ati_regbase); in atyfb_remove()
3735 if (info->screen_base) in atyfb_remove()
3736 iounmap(info->screen_base); in atyfb_remove()
3738 if (info->sprite.addr) in atyfb_remove()
3739 iounmap(info->sprite.addr); in atyfb_remove()
3743 kfree(par->mmap_map); in atyfb_remove()
3745 if (par->aux_start) in atyfb_remove()
3746 release_mem_region(par->aux_start, par->aux_size); in atyfb_remove()
3748 if (par->res_start) in atyfb_remove()
3749 release_mem_region(par->res_start, par->res_size); in atyfb_remove()
3921 par = reboot_info->par; in atyfb_reboot_notify()
3928 aty_set_crtc(par, &par->saved_crtc); in atyfb_reboot_notify()
3929 par->pll_ops->set_pll(reboot_info, &par->saved_pll); in atyfb_reboot_notify()
3946 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
3964 return -ENODEV; in atyfb_init()
3968 return -ENODEV; in atyfb_init()
3980 return -ENODEV; in atyfb_init()
4003 MODULE_DESCRIPTION("FBDev driver for ATI Mach64 cards");
4018 MODULE_PARM_DESC(mode, "Specify resolution as \"<xres>x<yres>[-<bpp>][@<refresh>]\" ");