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; \
182 * ATIReduceRatio --
277 /* 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) */
280 0, 0, -1, -1, 0, 39722, 48, 16, 33, 10, 96, 2,
318 static int comp_sync = -1;
339 /* top -> down is an evolution of mach64 chipset, any corrections? */
418 { PCI_CHIP_MACH64GO, "3D RAGE XL (Mach64 GO, PCI-66)", 230, 83, 63, 135, ATI_CHIP_264XL },
419 { PCI_CHIP_MACH64GL, "3D RAGE XC (Mach64 GL, PCI-66)", 230, 83, 63, 135, ATI_CHIP_264XL },
420 …{ PCI_CHIP_MACH64GR, "3D RAGE XL (Mach64 GR, PCI-33)", 230, 83, 63, 135, ATI_CHIP_264XL | M64F_SDR…
421 { PCI_CHIP_MACH64GS, "3D RAGE XC (Mach64 GS, PCI-33)", 230, 83, 63, 135, ATI_CHIP_264XL },
436 struct atyfb_par *par = (struct atyfb_par *) info->par; in aty_fudge_framebuffer_len()
438 if (!par->aux_start && in aty_fudge_framebuffer_len()
439 (info->fix.smem_len == 0x800000 || in aty_fudge_framebuffer_len()
440 (par->bus_type == ISA && info->fix.smem_len == 0x400000))) in aty_fudge_framebuffer_len()
441 info->fix.smem_len -= GUI_RESERVE; in aty_fudge_framebuffer_len()
452 for (i = (int)ARRAY_SIZE(aty_chips) - 1; i >= 0; i--) in correct_chipset()
453 if (par->pci_id == aty_chips[i].pci_id) in correct_chipset()
457 return -ENODEV; in correct_chipset()
460 par->pll_limits.pll_max = aty_chips[i].pll; in correct_chipset()
461 par->pll_limits.mclk = aty_chips[i].mclk; in correct_chipset()
462 par->pll_limits.xclk = aty_chips[i].xclk; in correct_chipset()
463 par->pll_limits.ecp_max = aty_chips[i].ecp_max; in correct_chipset()
464 par->features = aty_chips[i].features; in correct_chipset()
470 switch (par->pci_id) { in correct_chipset()
474 return -ENODEV; in correct_chipset()
478 return -ENODEV; in correct_chipset()
488 par->pll_limits.pll_max = 170; in correct_chipset()
489 par->pll_limits.mclk = 67; in correct_chipset()
490 par->pll_limits.xclk = 67; in correct_chipset()
491 par->pll_limits.ecp_max = 80; in correct_chipset()
492 par->features = ATI_CHIP_264VT; in correct_chipset()
496 par->pll_limits.pll_max = 200; in correct_chipset()
497 par->pll_limits.mclk = 67; in correct_chipset()
498 par->pll_limits.xclk = 67; in correct_chipset()
499 par->pll_limits.ecp_max = 80; in correct_chipset()
500 par->features = ATI_CHIP_264VT | M64F_MAGIC_POSTDIV; 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_264VTB; in correct_chipset()
514 par->pll_limits.pll_max = 200; in correct_chipset()
515 par->pll_limits.mclk = 67; in correct_chipset()
516 par->pll_limits.xclk = 67; in correct_chipset()
517 par->pll_limits.ecp_max = 80; in correct_chipset()
518 par->features = ATI_CHIP_264VT3; in correct_chipset()
526 par->pll_limits.pll_max = 170; in correct_chipset()
527 par->pll_limits.mclk = 67; in correct_chipset()
528 par->pll_limits.xclk = 67; in correct_chipset()
529 par->pll_limits.ecp_max = 80; in correct_chipset()
530 par->features = ATI_CHIP_264GTB; in correct_chipset()
534 par->pll_limits.pll_max = 200; in correct_chipset()
535 par->pll_limits.mclk = 67; in correct_chipset()
536 par->pll_limits.xclk = 67; in correct_chipset()
537 par->pll_limits.ecp_max = 100; in correct_chipset()
538 par->features = ATI_CHIP_264GTB; in correct_chipset()
558 static char ram_sdram32[] = "SDRAM (2:1) (32-bit)";
585 u32 pixclock = var->pixclock; in atyfb_get_pixclock()
588 par->pll.ct.xres = 0; in atyfb_get_pixclock()
589 if (par->lcd_table != 0) { in atyfb_get_pixclock()
592 par->pll.ct.xres = var->xres; in atyfb_get_pixclock()
593 pixclock = par->lcd_pixclock; in atyfb_get_pixclock()
641 /* ------------------------------------------------------------------------- */
650 if (par->lcd_table != 0) { in aty_get_crtc()
652 crtc->lcd_index = aty_ld_le32(LCD_INDEX, par); in aty_get_crtc()
653 aty_st_le32(LCD_INDEX, crtc->lcd_index, par); in aty_get_crtc()
655 crtc->lcd_config_panel = aty_ld_lcd(CNFG_PANEL, par); in aty_get_crtc()
656 crtc->lcd_gen_cntl = aty_ld_lcd(LCD_GEN_CNTL, par); in aty_get_crtc()
660 aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl & in aty_get_crtc()
664 crtc->horz_stretching = aty_ld_lcd(HORZ_STRETCHING, par); in aty_get_crtc()
665 crtc->vert_stretching = aty_ld_lcd(VERT_STRETCHING, par); in aty_get_crtc()
667 crtc->ext_vert_stretch = aty_ld_lcd(EXT_VERT_STRETCH, par); in aty_get_crtc()
670 crtc->h_tot_disp = aty_ld_le32(CRTC_H_TOTAL_DISP, par); in aty_get_crtc()
671 crtc->h_sync_strt_wid = aty_ld_le32(CRTC_H_SYNC_STRT_WID, par); in aty_get_crtc()
672 crtc->v_tot_disp = aty_ld_le32(CRTC_V_TOTAL_DISP, par); in aty_get_crtc()
673 crtc->v_sync_strt_wid = aty_ld_le32(CRTC_V_SYNC_STRT_WID, par); in aty_get_crtc()
674 crtc->vline_crnt_vline = aty_ld_le32(CRTC_VLINE_CRNT_VLINE, par); in aty_get_crtc()
675 crtc->off_pitch = aty_ld_le32(CRTC_OFF_PITCH, par); in aty_get_crtc()
676 crtc->gen_cntl = aty_ld_le32(CRTC_GEN_CNTL, par); in aty_get_crtc()
679 if (par->lcd_table != 0) { in aty_get_crtc()
681 aty_st_lcd(LCD_GEN_CNTL, (crtc->lcd_gen_cntl & ~CRTC_RW_SELECT) | in aty_get_crtc()
684 crtc->shadow_h_tot_disp = aty_ld_le32(CRTC_H_TOTAL_DISP, par); in aty_get_crtc()
685 crtc->shadow_h_sync_strt_wid = aty_ld_le32(CRTC_H_SYNC_STRT_WID, par); in aty_get_crtc()
686 crtc->shadow_v_tot_disp = aty_ld_le32(CRTC_V_TOTAL_DISP, par); in aty_get_crtc()
687 crtc->shadow_v_sync_strt_wid = aty_ld_le32(CRTC_V_SYNC_STRT_WID, par); in aty_get_crtc()
689 aty_st_le32(LCD_GEN_CNTL, crtc->lcd_gen_cntl, par); in aty_get_crtc()
697 if (par->lcd_table != 0) { in aty_set_crtc()
699 aty_st_le32(CRTC_GEN_CNTL, crtc->gen_cntl & in aty_set_crtc()
702 /* update non-shadow registers first */ in aty_set_crtc()
703 aty_st_lcd(CNFG_PANEL, crtc->lcd_config_panel, par); in aty_set_crtc()
704 aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl & in aty_set_crtc()
708 aty_st_lcd(HORZ_STRETCHING, crtc->horz_stretching & in aty_set_crtc()
710 aty_st_lcd(VERT_STRETCHING, crtc->vert_stretching & in aty_set_crtc()
716 aty_st_le32(CRTC_GEN_CNTL, crtc->gen_cntl & ~CRTC_EN, par); in aty_set_crtc()
720 ((((crtc->h_tot_disp >> 16) & 0xff) + 1) << 3), in aty_set_crtc()
721 (((crtc->v_tot_disp >> 16) & 0x7ff) + 1), in aty_set_crtc()
722 (crtc->h_sync_strt_wid & 0x200000) ? 'N' : 'P', in aty_set_crtc()
723 (crtc->v_sync_strt_wid & 0x200000) ? 'N' : 'P', in aty_set_crtc()
724 (crtc->gen_cntl & CRTC_CSYNC_EN) ? 'P' : 'N'); in aty_set_crtc()
726 DPRINTK("CRTC_H_TOTAL_DISP: %x\n", crtc->h_tot_disp); in aty_set_crtc()
727 DPRINTK("CRTC_H_SYNC_STRT_WID: %x\n", crtc->h_sync_strt_wid); in aty_set_crtc()
728 DPRINTK("CRTC_V_TOTAL_DISP: %x\n", crtc->v_tot_disp); in aty_set_crtc()
729 DPRINTK("CRTC_V_SYNC_STRT_WID: %x\n", crtc->v_sync_strt_wid); in aty_set_crtc()
730 DPRINTK("CRTC_OFF_PITCH: %x\n", crtc->off_pitch); in aty_set_crtc()
731 DPRINTK("CRTC_VLINE_CRNT_VLINE: %x\n", crtc->vline_crnt_vline); in aty_set_crtc()
732 DPRINTK("CRTC_GEN_CNTL: %x\n", crtc->gen_cntl); in aty_set_crtc()
734 aty_st_le32(CRTC_H_TOTAL_DISP, crtc->h_tot_disp, par); in aty_set_crtc()
735 aty_st_le32(CRTC_H_SYNC_STRT_WID, crtc->h_sync_strt_wid, par); in aty_set_crtc()
736 aty_st_le32(CRTC_V_TOTAL_DISP, crtc->v_tot_disp, par); in aty_set_crtc()
737 aty_st_le32(CRTC_V_SYNC_STRT_WID, crtc->v_sync_strt_wid, par); in aty_set_crtc()
738 aty_st_le32(CRTC_OFF_PITCH, crtc->off_pitch, par); in aty_set_crtc()
739 aty_st_le32(CRTC_VLINE_CRNT_VLINE, crtc->vline_crnt_vline, par); in aty_set_crtc()
741 aty_st_le32(CRTC_GEN_CNTL, crtc->gen_cntl, par); in aty_set_crtc()
744 if (par->accel_flags & FB_ACCELF_TEXT) in aty_set_crtc()
749 if (par->lcd_table != 0) { in aty_set_crtc()
751 aty_st_lcd(LCD_GEN_CNTL, (crtc->lcd_gen_cntl & ~CRTC_RW_SELECT) | in aty_set_crtc()
755 ((((crtc->shadow_h_tot_disp >> 16) & 0xff) + 1) << 3), in aty_set_crtc()
756 (((crtc->shadow_v_tot_disp >> 16) & 0x7ff) + 1), in aty_set_crtc()
757 (crtc->shadow_h_sync_strt_wid & 0x200000) ? 'N' : 'P', in aty_set_crtc()
758 (crtc->shadow_v_sync_strt_wid & 0x200000) ? 'N' : 'P'); in aty_set_crtc()
761 crtc->shadow_h_tot_disp); in aty_set_crtc()
763 crtc->shadow_h_sync_strt_wid); in aty_set_crtc()
765 crtc->shadow_v_tot_disp); in aty_set_crtc()
767 crtc->shadow_v_sync_strt_wid); in aty_set_crtc()
769 aty_st_le32(CRTC_H_TOTAL_DISP, crtc->shadow_h_tot_disp, par); in aty_set_crtc()
770 aty_st_le32(CRTC_H_SYNC_STRT_WID, crtc->shadow_h_sync_strt_wid, par); in aty_set_crtc()
771 aty_st_le32(CRTC_V_TOTAL_DISP, crtc->shadow_v_tot_disp, par); in aty_set_crtc()
772 aty_st_le32(CRTC_V_SYNC_STRT_WID, crtc->shadow_v_sync_strt_wid, par); in aty_set_crtc()
775 DPRINTK("LCD_GEN_CNTL: %x\n", crtc->lcd_gen_cntl); in aty_set_crtc()
776 DPRINTK("HORZ_STRETCHING: %x\n", crtc->horz_stretching); in aty_set_crtc()
777 DPRINTK("VERT_STRETCHING: %x\n", crtc->vert_stretching); in aty_set_crtc()
779 DPRINTK("EXT_VERT_STRETCH: %x\n", crtc->ext_vert_stretch); in aty_set_crtc()
781 aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl, par); in aty_set_crtc()
782 aty_st_lcd(HORZ_STRETCHING, crtc->horz_stretching, par); in aty_set_crtc()
783 aty_st_lcd(VERT_STRETCHING, crtc->vert_stretching, par); in aty_set_crtc()
785 aty_st_lcd(EXT_VERT_STRETCH, crtc->ext_vert_stretch, par); in aty_set_crtc()
787 aty_st_le32(LCD_INDEX, crtc->lcd_index, par); in aty_set_crtc()
797 if (par->ram_type == SGRAM || in calc_line_length()
798 (!M64_HAS(XL_MEM) && par->ram_type == WRAM)) in calc_line_length()
808 struct atyfb_par *par = (struct atyfb_par *) info->par; in aty_var_to_crtc()
817 xres = (var->xres + 7) & ~7; in aty_var_to_crtc()
818 yres = var->yres; in aty_var_to_crtc()
819 vxres = (var->xres_virtual + 7) & ~7; in aty_var_to_crtc()
820 vyres = var->yres_virtual; in aty_var_to_crtc()
821 xoffset = (var->xoffset + 7) & ~7; in aty_var_to_crtc()
822 yoffset = var->yoffset; in aty_var_to_crtc()
823 bpp = var->bits_per_pixel; in aty_var_to_crtc()
825 bpp = (var->green.length == 5) ? 15 : 16; in aty_var_to_crtc()
826 sync = var->sync; in aty_var_to_crtc()
827 vmode = var->vmode; in aty_var_to_crtc()
873 if (vyres * line_length > info->fix.smem_len) in aty_var_to_crtc()
883 h_sync_strt = h_disp + var->right_margin; in aty_var_to_crtc()
884 h_sync_end = h_sync_strt + var->hsync_len; in aty_var_to_crtc()
885 h_sync_dly = var->right_margin & 7; in aty_var_to_crtc()
886 h_total = h_sync_end + h_sync_dly + var->left_margin; in aty_var_to_crtc()
888 v_sync_strt = v_disp + var->lower_margin; in aty_var_to_crtc()
889 v_sync_end = v_sync_strt + var->vsync_len; in aty_var_to_crtc()
890 v_total = v_sync_end + var->upper_margin; in aty_var_to_crtc()
893 if (par->lcd_table != 0) { in aty_var_to_crtc()
896 crtc->lcd_index = lcd_index & in aty_var_to_crtc()
903 crtc->lcd_index |= CRTC2_DISPLAY_DIS; in aty_var_to_crtc()
905 crtc->lcd_config_panel = aty_ld_lcd(CNFG_PANEL, par) | 0x4000; in aty_var_to_crtc()
906 crtc->lcd_gen_cntl = aty_ld_lcd(LCD_GEN_CNTL, par) & ~CRTC_RW_SELECT; in aty_var_to_crtc()
908 crtc->lcd_gen_cntl &= in aty_var_to_crtc()
912 crtc->lcd_gen_cntl |= DONT_SHADOW_VPAR | LOCK_8DOT; in aty_var_to_crtc()
914 if ((crtc->lcd_gen_cntl & LCD_ON) && in aty_var_to_crtc()
915 ((xres > par->lcd_width) || (yres > par->lcd_height))) { in aty_var_to_crtc()
923 if (crtc->lcd_gen_cntl & CRT_ON) { in aty_var_to_crtc()
924 if (!(var->activate & FB_ACTIVATE_TEST)) in aty_var_to_crtc()
926 crtc->lcd_gen_cntl &= ~LCD_ON; in aty_var_to_crtc()
927 /*aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl, par);*/ in aty_var_to_crtc()
929 if (!(var->activate & FB_ACTIVATE_TEST)) in aty_var_to_crtc()
931 return -EINVAL; in aty_var_to_crtc()
936 if ((par->lcd_table != 0) && (crtc->lcd_gen_cntl & LCD_ON)) { in aty_var_to_crtc()
938 /* bpp -> bytespp, 1,4 -> 0; 8 -> 2; 15,16 -> 1; 24 -> 6; 32 -> 5 in aty_var_to_crtc()
953 if (yres < par->lcd_height) { in aty_var_to_crtc()
954 VScan = par->lcd_height / yres; in aty_var_to_crtc()
961 h_sync_strt = h_disp + par->lcd_right_margin; in aty_var_to_crtc()
962 h_sync_end = h_sync_strt + par->lcd_hsync_len; in aty_var_to_crtc()
963 h_sync_dly = /*DFP_h_sync_dly[ ( bpp + 1 ) / 3 ]; */par->lcd_hsync_dly; in aty_var_to_crtc()
964 h_total = h_disp + par->lcd_hblank_len; in aty_var_to_crtc()
966 v_sync_strt = v_disp + par->lcd_lower_margin / VScan; in aty_var_to_crtc()
967 v_sync_end = v_sync_strt + par->lcd_vsync_len / VScan; in aty_var_to_crtc()
968 v_total = v_disp + par->lcd_vblank_len / VScan; in aty_var_to_crtc()
972 h_disp = (h_disp >> 3) - 1; in aty_var_to_crtc()
973 h_sync_strt = (h_sync_strt >> 3) - 1; in aty_var_to_crtc()
974 h_sync_end = (h_sync_end >> 3) - 1; in aty_var_to_crtc()
975 h_total = (h_total >> 3) - 1; in aty_var_to_crtc()
976 h_sync_wid = h_sync_end - h_sync_strt; in aty_var_to_crtc()
992 v_disp--; in aty_var_to_crtc()
993 v_sync_strt--; in aty_var_to_crtc()
994 v_sync_end--; in aty_var_to_crtc()
995 v_total--; in aty_var_to_crtc()
996 v_sync_wid = v_sync_end - v_sync_strt; in aty_var_to_crtc()
1008 crtc->vxres = vxres; in aty_var_to_crtc()
1009 crtc->vyres = vyres; in aty_var_to_crtc()
1010 crtc->xoffset = xoffset; in aty_var_to_crtc()
1011 crtc->yoffset = yoffset; in aty_var_to_crtc()
1012 crtc->bpp = bpp; in aty_var_to_crtc()
1013 crtc->off_pitch = in aty_var_to_crtc()
1016 crtc->vline_crnt_vline = 0; in aty_var_to_crtc()
1018 crtc->h_tot_disp = h_total | (h_disp << 16); in aty_var_to_crtc()
1019 crtc->h_sync_strt_wid = (h_sync_strt & 0xff) | (h_sync_dly << 8) | in aty_var_to_crtc()
1022 crtc->v_tot_disp = v_total | (v_disp << 16); in aty_var_to_crtc()
1023 crtc->v_sync_strt_wid = v_sync_strt | (v_sync_wid << 16) | in aty_var_to_crtc()
1026 /* crtc->gen_cntl = aty_ld_le32(CRTC_GEN_CNTL, par) & CRTC_PRESERVED_MASK; */ in aty_var_to_crtc()
1027 crtc->gen_cntl = CRTC_EXT_DISP_EN | CRTC_EN | pix_width | c_sync; in aty_var_to_crtc()
1028 crtc->gen_cntl |= CRTC_VGA_LINEAR; in aty_var_to_crtc()
1032 crtc->gen_cntl |= CRTC_DBL_SCAN_EN; in aty_var_to_crtc()
1035 crtc->gen_cntl |= CRTC_INTERLACE_EN; in aty_var_to_crtc()
1037 if (par->lcd_table != 0) { in aty_var_to_crtc()
1041 crtc->gen_cntl &= ~(CRTC2_EN | CRTC2_PIX_WIDTH); in aty_var_to_crtc()
1042 crtc->lcd_gen_cntl &= ~(HORZ_DIVBY2_EN | DIS_HOR_CRT_DIVBY2 | in aty_var_to_crtc()
1047 crtc->lcd_gen_cntl |= DONT_SHADOW_VPAR/* | LOCK_8DOT*/; in aty_var_to_crtc()
1050 crtc->horz_stretching = aty_ld_lcd(HORZ_STRETCHING, par); in aty_var_to_crtc()
1052 crtc->ext_vert_stretch = aty_ld_lcd(EXT_VERT_STRETCH, par) & in aty_var_to_crtc()
1055 crtc->horz_stretching &= ~(HORZ_STRETCH_RATIO | in aty_var_to_crtc()
1058 if (xres < par->lcd_width && crtc->lcd_gen_cntl & LCD_ON) { in aty_var_to_crtc()
1063 * (440 for a 1024-wide panel). It doesn't in aty_var_to_crtc()
1068 * option allows the pixel-replicated mode to in aty_var_to_crtc()
1072 * pixel-replicated, rather than blended. in aty_var_to_crtc()
1075 int nStretch = par->lcd_width / HDisplay; in aty_var_to_crtc()
1076 int Remainder = par->lcd_width % HDisplay; in aty_var_to_crtc()
1079 (((HDisplay * 16) / par->lcd_width) < 7)) { in aty_var_to_crtc()
1081 int horz_stretch_loop = -1, BestRemainder; in aty_var_to_crtc()
1082 int Numerator = HDisplay, Denominator = par->lcd_width; in aty_var_to_crtc()
1087 while (--Index >= 0) { in aty_var_to_crtc()
1088 Remainder = ((Denominator - Numerator) * StretchLoops[Index]) % in aty_var_to_crtc()
1103 while (--Index >= 0) { in aty_var_to_crtc()
1108 Accumulator -= Numerator; in aty_var_to_crtc()
1112 crtc->horz_stretching |= (HORZ_STRETCH_EN | in aty_var_to_crtc()
1119 crtc->horz_stretching |= (HORZ_STRETCH_MODE | HORZ_STRETCH_EN | in aty_var_to_crtc()
1120 (((HDisplay * (HORZ_STRETCH_BLEND + 1)) / par->lcd_width) & HORZ_STRETCH_BLEND)); in aty_var_to_crtc()
1124 if (vdisplay < par->lcd_height && crtc->lcd_gen_cntl & LCD_ON) { in aty_var_to_crtc()
1125 crtc->vert_stretching = (VERT_STRETCH_USE0 | VERT_STRETCH_EN | in aty_var_to_crtc()
1126 (((vdisplay * (VERT_STRETCH_RATIO0 + 1)) / par->lcd_height) & VERT_STRETCH_RATIO0)); in aty_var_to_crtc()
1130 crtc->ext_vert_stretch |= VERT_STRETCH_MODE; in aty_var_to_crtc()
1136 crtc->vert_stretching = 0; in aty_var_to_crtc()
1139 crtc->shadow_h_tot_disp = crtc->h_tot_disp; in aty_var_to_crtc()
1140 crtc->shadow_h_sync_strt_wid = crtc->h_sync_strt_wid; in aty_var_to_crtc()
1141 crtc->shadow_v_tot_disp = crtc->v_tot_disp; in aty_var_to_crtc()
1142 crtc->shadow_v_sync_strt_wid = crtc->v_sync_strt_wid; in aty_var_to_crtc()
1148 crtc->gen_cntl |= (aty_ld_le32(CRTC_GEN_CNTL, par) & CRTC_FIFO_LWM); in aty_var_to_crtc()
1150 crtc->dp_pix_width = dp_pix_width; in aty_var_to_crtc()
1151 crtc->dp_chain_mask = dp_chain_mask; in aty_var_to_crtc()
1166 h_total = crtc->h_tot_disp & 0x1ff; in aty_crtc_to_var()
1167 h_disp = (crtc->h_tot_disp >> 16) & 0xff; in aty_crtc_to_var()
1168 h_sync_strt = (crtc->h_sync_strt_wid & 0xff) | ((crtc->h_sync_strt_wid >> 4) & 0x100); in aty_crtc_to_var()
1169 h_sync_dly = (crtc->h_sync_strt_wid >> 8) & 0x7; in aty_crtc_to_var()
1170 h_sync_wid = (crtc->h_sync_strt_wid >> 16) & 0x1f; in aty_crtc_to_var()
1171 h_sync_pol = (crtc->h_sync_strt_wid >> 21) & 0x1; in aty_crtc_to_var()
1172 v_total = crtc->v_tot_disp & 0x7ff; in aty_crtc_to_var()
1173 v_disp = (crtc->v_tot_disp >> 16) & 0x7ff; in aty_crtc_to_var()
1174 v_sync_strt = crtc->v_sync_strt_wid & 0x7ff; in aty_crtc_to_var()
1175 v_sync_wid = (crtc->v_sync_strt_wid >> 16) & 0x1f; in aty_crtc_to_var()
1176 v_sync_pol = (crtc->v_sync_strt_wid >> 21) & 0x1; in aty_crtc_to_var()
1177 c_sync = crtc->gen_cntl & CRTC_CSYNC_EN ? 1 : 0; in aty_crtc_to_var()
1178 pix_width = crtc->gen_cntl & CRTC_PIX_WIDTH_MASK; in aty_crtc_to_var()
1179 double_scan = crtc->gen_cntl & CRTC_DBL_SCAN_EN; in aty_crtc_to_var()
1180 interlace = crtc->gen_cntl & CRTC_INTERLACE_EN; in aty_crtc_to_var()
1185 left = (h_total - h_sync_strt - h_sync_wid) * 8 - h_sync_dly; in aty_crtc_to_var()
1186 right = (h_sync_strt - h_disp) * 8 + h_sync_dly; in aty_crtc_to_var()
1188 upper = v_total - v_sync_strt - v_sync_wid; in aty_crtc_to_var()
1189 lower = v_sync_strt - v_disp; in aty_crtc_to_var()
1198 var->red.offset = 0; in aty_crtc_to_var()
1199 var->red.length = 8; in aty_crtc_to_var()
1200 var->green.offset = 0; in aty_crtc_to_var()
1201 var->green.length = 8; in aty_crtc_to_var()
1202 var->blue.offset = 0; in aty_crtc_to_var()
1203 var->blue.length = 8; in aty_crtc_to_var()
1204 var->transp.offset = 0; in aty_crtc_to_var()
1205 var->transp.length = 0; in aty_crtc_to_var()
1209 var->red.offset = 10; in aty_crtc_to_var()
1210 var->red.length = 5; in aty_crtc_to_var()
1211 var->green.offset = 5; in aty_crtc_to_var()
1212 var->green.length = 5; in aty_crtc_to_var()
1213 var->blue.offset = 0; in aty_crtc_to_var()
1214 var->blue.length = 5; in aty_crtc_to_var()
1215 var->transp.offset = 0; in aty_crtc_to_var()
1216 var->transp.length = 0; in aty_crtc_to_var()
1220 var->red.offset = 11; in aty_crtc_to_var()
1221 var->red.length = 5; in aty_crtc_to_var()
1222 var->green.offset = 5; in aty_crtc_to_var()
1223 var->green.length = 6; in aty_crtc_to_var()
1224 var->blue.offset = 0; in aty_crtc_to_var()
1225 var->blue.length = 5; in aty_crtc_to_var()
1226 var->transp.offset = 0; in aty_crtc_to_var()
1227 var->transp.length = 0; in aty_crtc_to_var()
1231 var->red.offset = 16; in aty_crtc_to_var()
1232 var->red.length = 8; in aty_crtc_to_var()
1233 var->green.offset = 8; in aty_crtc_to_var()
1234 var->green.length = 8; in aty_crtc_to_var()
1235 var->blue.offset = 0; in aty_crtc_to_var()
1236 var->blue.length = 8; in aty_crtc_to_var()
1237 var->transp.offset = 0; in aty_crtc_to_var()
1238 var->transp.length = 0; in aty_crtc_to_var()
1242 var->red.offset = 16; in aty_crtc_to_var()
1243 var->red.length = 8; in aty_crtc_to_var()
1244 var->green.offset = 8; in aty_crtc_to_var()
1245 var->green.length = 8; in aty_crtc_to_var()
1246 var->blue.offset = 0; in aty_crtc_to_var()
1247 var->blue.length = 8; in aty_crtc_to_var()
1248 var->transp.offset = 24; in aty_crtc_to_var()
1249 var->transp.length = 8; in aty_crtc_to_var()
1253 return -EINVAL; in aty_crtc_to_var()
1257 var->xres = xres; in aty_crtc_to_var()
1258 var->yres = yres; in aty_crtc_to_var()
1259 var->xres_virtual = crtc->vxres; in aty_crtc_to_var()
1260 var->yres_virtual = crtc->vyres; in aty_crtc_to_var()
1261 var->bits_per_pixel = bpp; in aty_crtc_to_var()
1262 var->left_margin = left; in aty_crtc_to_var()
1263 var->right_margin = right; in aty_crtc_to_var()
1264 var->upper_margin = upper; in aty_crtc_to_var()
1265 var->lower_margin = lower; in aty_crtc_to_var()
1266 var->hsync_len = hslen; in aty_crtc_to_var()
1267 var->vsync_len = vslen; in aty_crtc_to_var()
1268 var->sync = sync; in aty_crtc_to_var()
1269 var->vmode = FB_VMODE_NONINTERLACED; in aty_crtc_to_var()
1277 var->vmode = FB_VMODE_INTERLACED; in aty_crtc_to_var()
1280 var->vmode = FB_VMODE_DOUBLE; in aty_crtc_to_var()
1281 var->yres >>= 1; in aty_crtc_to_var()
1282 var->upper_margin >>= 1; in aty_crtc_to_var()
1283 var->lower_margin >>= 1; in aty_crtc_to_var()
1284 var->vsync_len >>= 1; in aty_crtc_to_var()
1290 /* ------------------------------------------------------------------------- */
1294 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_set_par()
1295 struct fb_var_screeninfo *var = &info->var; in atyfb_set_par()
1302 if (par->asleep) in atyfb_set_par()
1305 err = aty_var_to_crtc(info, var, &par->crtc); in atyfb_set_par()
1313 return -EINVAL; in atyfb_set_par()
1315 err = par->pll_ops->var_to_pll(info, pixclock, in atyfb_set_par()
1316 var->bits_per_pixel, &par->pll); in atyfb_set_par()
1321 par->accel_flags = var->accel_flags; /* hack */ in atyfb_set_par()
1323 if (var->accel_flags) { in atyfb_set_par()
1325 info->flags &= ~FBINFO_HWACCEL_DISABLED; in atyfb_set_par()
1328 info->flags |= FBINFO_HWACCEL_DISABLED; in atyfb_set_par()
1331 if (par->blitter_may_be_busy) in atyfb_set_par()
1334 aty_set_crtc(par, &par->crtc); in atyfb_set_par()
1335 par->dac_ops->set_dac(info, &par->pll, in atyfb_set_par()
1336 var->bits_per_pixel, par->accel_flags); in atyfb_set_par()
1337 par->pll_ops->set_pll(info, &par->pll); in atyfb_set_par()
1340 if (par->pll_ops && par->pll_ops->pll_to_var) in atyfb_set_par()
1341 pixclock_in_ps = par->pll_ops->pll_to_var(info, &par->pll); in atyfb_set_par()
1346 PRINTKE("ALERT ops->pll_to_var get 0\n"); in atyfb_set_par()
1351 if (!aty_crtc_to_var(&par->crtc, &debug)) { in atyfb_set_par()
1367 if (par->crtc.gen_cntl & CRTC_INTERLACE_EN) in atyfb_set_par()
1369 if (par->crtc.gen_cntl & CRTC_DBL_SCAN_EN) in atyfb_set_par()
1373 DPRINTK(" Set Visible Mode to %ix%i-%i\n", in atyfb_set_par()
1374 var->xres, var->yres, var->bits_per_pixel); in atyfb_set_par()
1377 var->xres_virtual, var->yres_virtual, in atyfb_set_par()
1397 switch (var->bits_per_pixel) { in atyfb_set_par()
1412 tmp |= par->mem_refresh_rate << 20; in atyfb_set_par()
1413 switch (var->bits_per_pixel) { in atyfb_set_par()
1433 aty_st_le32(BUS_CNTL, 0x7b33a040 | (par->aux_start ? BUS_APER_REG_DIS : 0), par); in atyfb_set_par()
1437 aty_st_le32(BUS_CNTL, 0x7b23a040 | (par->aux_start ? BUS_APER_REG_DIS : 0), par); in atyfb_set_par()
1444 info->fix.line_length = calc_line_length(par, var->xres_virtual, in atyfb_set_par()
1445 var->bits_per_pixel); in atyfb_set_par()
1447 info->fix.visual = var->bits_per_pixel <= 8 ? in atyfb_set_par()
1451 if (par->accel_flags & FB_ACCELF_TEXT) in atyfb_set_par()
1455 btext_update_display(info->fix.smem_start, in atyfb_set_par()
1456 (((par->crtc.h_tot_disp >> 16) & 0xff) + 1) * 8, in atyfb_set_par()
1457 ((par->crtc.v_tot_disp >> 16) & 0x7ff) + 1, in atyfb_set_par()
1458 var->bits_per_pixel, in atyfb_set_par()
1459 par->crtc.vxres * var->bits_per_pixel / 8); in atyfb_set_par()
1468 printk("debug atyfb: Mach64 non-shadow register values:"); in atyfb_set_par()
1495 if (par->lcd_table != 0) { in atyfb_set_par()
1525 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_check_var()
1531 memcpy(&pll, &par->pll, sizeof(pll)); in atyfb_check_var()
1540 if (!(var->activate & FB_ACTIVATE_TEST)) in atyfb_check_var()
1542 return -EINVAL; in atyfb_check_var()
1544 err = par->pll_ops->var_to_pll(info, pixclock, in atyfb_check_var()
1545 var->bits_per_pixel, &pll); in atyfb_check_var()
1550 if (var->accel_flags & FB_ACCELF_TEXT) in atyfb_check_var()
1551 info->var.accel_flags = FB_ACCELF_TEXT; in atyfb_check_var()
1553 info->var.accel_flags = 0; in atyfb_check_var()
1556 var->pixclock = par->pll_ops->pll_to_var(info, &pll); in atyfb_check_var()
1562 u32 xoffset = info->var.xoffset; in set_off_pitch()
1563 u32 yoffset = info->var.yoffset; in set_off_pitch()
1564 u32 line_length = info->fix.line_length; in set_off_pitch()
1565 u32 bpp = info->var.bits_per_pixel; in set_off_pitch()
1567 par->crtc.off_pitch = in set_off_pitch()
1579 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_open()
1582 par->open++; in atyfb_open()
1584 par->mmaped = 0; in atyfb_open()
1596 spin_lock(&par->int_lock); in aty_irq()
1604 par->vblank.count++; in aty_irq()
1605 if (par->vblank.pan_display) { in aty_irq()
1606 par->vblank.pan_display = 0; in aty_irq()
1607 aty_st_le32(CRTC_OFF_PITCH, par->crtc.off_pitch, par); in aty_irq()
1609 wake_up_interruptible(&par->vblank.wait); in aty_irq()
1613 spin_unlock(&par->int_lock); in aty_irq()
1622 if (!test_and_set_bit(0, &par->irq_flags)) { in aty_enable_irq()
1623 if (request_irq(par->irq, aty_irq, IRQF_SHARED, "atyfb", par)) { in aty_enable_irq()
1624 clear_bit(0, &par->irq_flags); in aty_enable_irq()
1625 return -EINVAL; in aty_enable_irq()
1627 spin_lock_irq(&par->int_lock); in aty_enable_irq()
1633 spin_unlock_irq(&par->int_lock); in aty_enable_irq()
1635 spin_lock_irq(&par->int_lock); in aty_enable_irq()
1640 /* re-enable interrupt */ in aty_enable_irq()
1644 spin_unlock_irq(&par->int_lock); in aty_enable_irq()
1654 if (test_and_clear_bit(0, &par->irq_flags)) { in aty_disable_irq()
1655 if (par->vblank.pan_display) { in aty_disable_irq()
1656 par->vblank.pan_display = 0; in aty_disable_irq()
1657 aty_st_le32(CRTC_OFF_PITCH, par->crtc.off_pitch, par); in aty_disable_irq()
1659 spin_lock_irq(&par->int_lock); in aty_disable_irq()
1663 spin_unlock_irq(&par->int_lock); in aty_disable_irq()
1664 free_irq(par->irq, par); in aty_disable_irq()
1672 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_release()
1680 par->open--; in atyfb_release()
1684 if (par->open) in atyfb_release()
1688 was_mmaped = par->mmaped; in atyfb_release()
1690 par->mmaped = 0; in atyfb_release()
1707 u32 videoram = (info->fix.smem_len - (PAGE_SIZE << 2)); in atyfb_release()
1730 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_pan_display()
1733 xres = (((par->crtc.h_tot_disp >> 16) & 0xff) + 1) * 8; in atyfb_pan_display()
1734 yres = ((par->crtc.v_tot_disp >> 16) & 0x7ff) + 1; in atyfb_pan_display()
1735 if (par->crtc.gen_cntl & CRTC_DBL_SCAN_EN) in atyfb_pan_display()
1737 xoffset = (var->xoffset + 7) & ~7; in atyfb_pan_display()
1738 yoffset = var->yoffset; in atyfb_pan_display()
1739 if (xoffset + xres > par->crtc.vxres || in atyfb_pan_display()
1740 yoffset + yres > par->crtc.vyres) in atyfb_pan_display()
1741 return -EINVAL; in atyfb_pan_display()
1742 info->var.xoffset = xoffset; in atyfb_pan_display()
1743 info->var.yoffset = yoffset; in atyfb_pan_display()
1744 if (par->asleep) in atyfb_pan_display()
1748 if ((var->activate & FB_ACTIVATE_VBL) && !aty_enable_irq(par, 0)) { in atyfb_pan_display()
1749 par->vblank.pan_display = 1; in atyfb_pan_display()
1751 par->vblank.pan_display = 0; in atyfb_pan_display()
1752 aty_st_le32(CRTC_OFF_PITCH, par->crtc.off_pitch, par); in atyfb_pan_display()
1766 vbl = &par->vblank; in aty_waitforvblank()
1769 return -ENODEV; in aty_waitforvblank()
1776 count = vbl->count; in aty_waitforvblank()
1777 ret = wait_event_interruptible_timeout(vbl->wait, in aty_waitforvblank()
1778 count != vbl->count, HZ/10); in aty_waitforvblank()
1783 return -ETIMEDOUT; in aty_waitforvblank()
1803 u32 dsp_xclks_per_row; /* 0-16383 */
1804 u32 dsp_loop_latency; /* 0-15 */
1805 u32 dsp_precision; /* 0-7 */
1806 u32 dsp_on; /* 0-2047 */
1807 u32 dsp_off; /* 0-2047 */
1816 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_ioctl()
1825 fbtyp.fb_width = par->crtc.vxres; in atyfb_ioctl()
1826 fbtyp.fb_height = par->crtc.vyres; in atyfb_ioctl()
1827 fbtyp.fb_depth = info->var.bits_per_pixel; in atyfb_ioctl()
1828 fbtyp.fb_cmsize = info->cmap.len; in atyfb_ioctl()
1829 fbtyp.fb_size = info->fix.smem_len; in atyfb_ioctl()
1832 return -EFAULT; in atyfb_ioctl()
1841 return -EFAULT; in atyfb_ioctl()
1850 union aty_pll *pll = &par->pll; in atyfb_ioctl()
1851 u32 dsp_config = pll->ct.dsp_config; in atyfb_ioctl()
1852 u32 dsp_on_off = pll->ct.dsp_on_off; in atyfb_ioctl()
1853 clk.ref_clk_per = par->ref_clk_per; in atyfb_ioctl()
1854 clk.pll_ref_div = pll->ct.pll_ref_div; in atyfb_ioctl()
1855 clk.mclk_fb_div = pll->ct.mclk_fb_div; in atyfb_ioctl()
1856 clk.mclk_post_div = pll->ct.mclk_post_div_real; in atyfb_ioctl()
1857 clk.mclk_fb_mult = pll->ct.mclk_fb_mult; in atyfb_ioctl()
1858 clk.xclk_post_div = pll->ct.xclk_post_div_real; in atyfb_ioctl()
1859 clk.vclk_fb_div = pll->ct.vclk_fb_div; in atyfb_ioctl()
1860 clk.vclk_post_div = pll->ct.vclk_post_div_real; in atyfb_ioctl()
1868 return -EFAULT; in atyfb_ioctl()
1870 return -EINVAL; in atyfb_ioctl()
1875 union aty_pll *pll = &par->pll; in atyfb_ioctl()
1878 return -EFAULT; in atyfb_ioctl()
1879 par->ref_clk_per = clk.ref_clk_per; in atyfb_ioctl()
1880 pll->ct.pll_ref_div = clk.pll_ref_div; in atyfb_ioctl()
1881 pll->ct.mclk_fb_div = clk.mclk_fb_div; in atyfb_ioctl()
1882 pll->ct.mclk_post_div_real = clk.mclk_post_div; in atyfb_ioctl()
1883 pll->ct.mclk_fb_mult = clk.mclk_fb_mult; in atyfb_ioctl()
1884 pll->ct.xclk_post_div_real = clk.xclk_post_div; in atyfb_ioctl()
1885 pll->ct.vclk_fb_div = clk.vclk_fb_div; in atyfb_ioctl()
1886 pll->ct.vclk_post_div_real = clk.vclk_post_div; in atyfb_ioctl()
1887 pll->ct.dsp_config = (clk.dsp_xclks_per_row & 0x3fff) | in atyfb_ioctl()
1890 pll->ct.dsp_on_off = (clk.dsp_off & 0x7ff) | in atyfb_ioctl()
1892 /*aty_calc_pll_ct(info, &pll->ct);*/ in atyfb_ioctl()
1895 return -EINVAL; in atyfb_ioctl()
1898 if (get_user(par->features, (u32 __user *) arg)) in atyfb_ioctl()
1899 return -EFAULT; in atyfb_ioctl()
1902 if (put_user(par->features, (u32 __user *) arg)) in atyfb_ioctl()
1903 return -EFAULT; in atyfb_ioctl()
1907 return -EINVAL; in atyfb_ioctl()
1914 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_sync()
1916 if (par->blitter_may_be_busy) in atyfb_sync()
1924 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_mmap()
1930 if (!par->mmap_map) in atyfb_mmap()
1931 return -ENXIO; in atyfb_mmap()
1933 if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) in atyfb_mmap()
1934 return -EINVAL; in atyfb_mmap()
1936 off = vma->vm_pgoff << PAGE_SHIFT; in atyfb_mmap()
1937 size = vma->vm_end - vma->vm_start; in atyfb_mmap()
1941 if (((vma->vm_pgoff == 0) && (size == info->fix.smem_len)) || in atyfb_mmap()
1942 ((off == info->fix.smem_len) && (size == PAGE_SIZE))) in atyfb_mmap()
1945 vma->vm_pgoff = off >> PAGE_SHIFT; /* propagate off changes */ in atyfb_mmap()
1950 for (i = 0; par->mmap_map[i].size; i++) { in atyfb_mmap()
1951 unsigned long start = par->mmap_map[i].voff; in atyfb_mmap()
1952 unsigned long end = start + par->mmap_map[i].size; in atyfb_mmap()
1960 map_size = par->mmap_map[i].size - (offset - start); in atyfb_mmap()
1961 map_offset = par->mmap_map[i].poff + (offset - start); in atyfb_mmap()
1969 map_size = size - page; in atyfb_mmap()
1971 pgprot_val(vma->vm_page_prot) &= ~(par->mmap_map[i].prot_mask); in atyfb_mmap()
1972 pgprot_val(vma->vm_page_prot) |= par->mmap_map[i].prot_flag; in atyfb_mmap()
1974 if (remap_pfn_range(vma, vma->vm_start + page, in atyfb_mmap()
1975 map_offset >> PAGE_SHIFT, map_size, vma->vm_page_prot)) in atyfb_mmap()
1976 return -EAGAIN; in atyfb_mmap()
1982 return -EINVAL; in atyfb_mmap()
1984 if (!par->mmaped) in atyfb_mmap()
1985 par->mmaped = 1; in atyfb_mmap()
2024 if ((--timeout) == 0) in aty_power_mgmt()
2043 if ((--timeout) == 0) in aty_power_mgmt()
2049 return timeout ? 0 : -EIO; in aty_power_mgmt()
2057 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_pci_suspend_late()
2059 if (state.event == pdev->dev.power.power_state.event) in atyfb_pci_suspend_late()
2073 par->asleep = 1; in atyfb_pci_suspend_late()
2074 par->lock_blank = 1; in atyfb_pci_suspend_late()
2085 par->asleep = 0; in atyfb_pci_suspend_late()
2086 par->lock_blank = 0; in atyfb_pci_suspend_late()
2090 return -EIO; in atyfb_pci_suspend_late()
2096 pdev->dev.power.power_state = state; in atyfb_pci_suspend_late()
2118 struct atyfb_par *par = info->par; in aty_resume_chip()
2120 aty_st_le32(MEM_CNTL, par->mem_cntl, par); in aty_resume_chip()
2122 if (par->pll_ops->resume_pll) in aty_resume_chip()
2123 par->pll_ops->resume_pll(info, &par->pll); in aty_resume_chip()
2125 if (par->aux_start) in aty_resume_chip()
2134 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_pci_resume()
2136 if (pdev->dev.power.power_state.event == PM_EVENT_ON) in atyfb_pci_resume()
2149 pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) in atyfb_pci_resume()
2155 par->asleep = 0; in atyfb_pci_resume()
2164 par->lock_blank = 0; in atyfb_pci_resume()
2169 pdev->dev.power.power_state = PMSG_ON; in atyfb_pci_resume()
2193 struct fb_info *info = pci_get_drvdata(par->pdev); in aty_bl_get_level_brightness()
2198 atylevel = info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_LEVEL; in aty_bl_get_level_brightness()
2214 if (bd->props.power != FB_BLANK_UNBLANK || in aty_bl_update_status()
2215 bd->props.fb_blank != FB_BLANK_UNBLANK) in aty_bl_update_status()
2218 level = bd->props.brightness; in aty_bl_update_status()
2240 struct fb_info *info = pci_get_drvdata(par->pdev); in aty_bl_init()
2245 if (!pmac_has_backlight_type("ati")) in aty_bl_init()
2249 snprintf(name, sizeof(name), "atybl%d", info->node); in aty_bl_init()
2253 props.max_brightness = FB_BACKLIGHT_LEVELS - 1; in aty_bl_init()
2254 bd = backlight_device_register(name, info->dev, par, &aty_bl_data, in aty_bl_init()
2257 info->bl_dev = NULL; in aty_bl_init()
2262 info->bl_dev = bd; in aty_bl_init()
2267 bd->props.brightness = bd->props.max_brightness; in aty_bl_init()
2268 bd->props.power = FB_BLANK_UNBLANK; in aty_bl_init()
2313 par->mem_refresh_rate = i; in aty_calc_mem_refresh()
2326 int ret = -EINVAL; in atyfb_get_timings_from_lcd()
2328 if (par->lcd_table != 0 && (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) { in atyfb_get_timings_from_lcd()
2330 var->xres = var->xres_virtual = par->lcd_hdisp; in atyfb_get_timings_from_lcd()
2331 var->right_margin = par->lcd_right_margin; in atyfb_get_timings_from_lcd()
2332 var->left_margin = par->lcd_hblank_len - in atyfb_get_timings_from_lcd()
2333 (par->lcd_right_margin + par->lcd_hsync_dly + in atyfb_get_timings_from_lcd()
2334 par->lcd_hsync_len); in atyfb_get_timings_from_lcd()
2335 var->hsync_len = par->lcd_hsync_len + par->lcd_hsync_dly; in atyfb_get_timings_from_lcd()
2336 var->yres = var->yres_virtual = par->lcd_vdisp; in atyfb_get_timings_from_lcd()
2337 var->lower_margin = par->lcd_lower_margin; in atyfb_get_timings_from_lcd()
2338 var->upper_margin = par->lcd_vblank_len - in atyfb_get_timings_from_lcd()
2339 (par->lcd_lower_margin + par->lcd_vsync_len); in atyfb_get_timings_from_lcd()
2340 var->vsync_len = par->lcd_vsync_len; in atyfb_get_timings_from_lcd()
2341 var->pixclock = par->lcd_pixclock; in atyfb_get_timings_from_lcd()
2351 struct atyfb_par *par = (struct atyfb_par *) info->par; in aty_init()
2357 init_waitqueue_head(&par->vblank.wait); in aty_init()
2358 spin_lock_init(&par->int_lock); in aty_init()
2365 par->bus_type = (stat0 >> 0) & 0x07; in aty_init()
2366 par->ram_type = (stat0 >> 3) & 0x07; in aty_init()
2367 ramname = aty_gx_ram[par->ram_type]; in aty_init()
2384 par->dac_ops = &aty_dac_ibm514; in aty_init()
2389 par->dac_ops = &aty_dac_ati68860b; in aty_init()
2393 par->dac_ops = &aty_dac_att21c498; in aty_init()
2398 par->dac_ops = &aty_dac_unsupported; in aty_init()
2404 par->pll_ops = &aty_pll_ati18818_1; in aty_init()
2408 par->pll_ops = &aty_pll_ibm514; in aty_init()
2413 par->pll_ops = &aty_pll_unsupported; in aty_init()
2420 par->dac_ops = &aty_dac_ct; in aty_init()
2421 par->pll_ops = &aty_pll_ct; in aty_init()
2422 par->bus_type = PCI; in aty_init()
2423 par->ram_type = (aty_ld_le32(CNFG_STAT0, par) & 0x07); in aty_init()
2425 ramname = aty_xl_ram[par->ram_type]; in aty_init()
2427 ramname = aty_ct_ram[par->ram_type]; in aty_init()
2429 if (par->pll_limits.mclk == 67 && par->ram_type < SDRAM) in aty_init()
2430 par->pll_limits.mclk = 63; in aty_init()
2432 if (M64_HAS(MOBIL_BUS) && par->ram_type == SDRAM32) in aty_init()
2433 par->pll_limits.xclk = (par->pll_limits.xclk + 1) >> 1; in aty_init()
2438 * The Apple iBook1 uses non-standard memory frequencies. in aty_init()
2442 par->pll_limits.mclk = 70; in aty_init()
2443 par->pll_limits.xclk = 53; in aty_init()
2449 par->pll_limits.pll_max = pll; in aty_init()
2451 par->pll_limits.mclk = mclk; in aty_init()
2453 par->pll_limits.xclk = xclk; in aty_init()
2455 aty_calc_mem_refresh(par, par->pll_limits.xclk); in aty_init()
2456 par->pll_per = 1000000/par->pll_limits.pll_max; in aty_init()
2457 par->mclk_per = 1000000/par->pll_limits.mclk; in aty_init()
2458 par->xclk_per = 1000000/par->pll_limits.xclk; in aty_init()
2460 par->ref_clk_per = 1000000000000ULL / 14318180; in aty_init()
2469 diff1 = 510 * 14 / pll_ref_div - par->pll_limits.pll_max; in aty_init()
2470 diff2 = 510 * 29 / pll_ref_div - par->pll_limits.pll_max; in aty_init()
2472 diff1 = -diff1; in aty_init()
2474 diff2 = -diff2; in aty_init()
2476 par->ref_clk_per = 1000000000000ULL / 29498928; in aty_init()
2484 aty_get_crtc(par, &par->saved_crtc); in aty_init()
2485 if (par->pll_ops->get_pll) in aty_init()
2486 par->pll_ops->get_pll(info, &par->saved_pll); in aty_init()
2488 par->mem_cntl = aty_ld_le32(MEM_CNTL, par); in aty_init()
2492 switch (par->mem_cntl & 0xF) { in aty_init()
2494 info->fix.smem_len = 0x80000; in aty_init()
2497 info->fix.smem_len = 0x100000; in aty_init()
2500 info->fix.smem_len = 0x200000; in aty_init()
2503 info->fix.smem_len = 0x400000; in aty_init()
2506 info->fix.smem_len = 0x600000; in aty_init()
2509 info->fix.smem_len = 0x800000; in aty_init()
2512 info->fix.smem_len = 0x80000; in aty_init()
2514 switch (par->mem_cntl & MEM_SIZE_ALIAS) { in aty_init()
2516 info->fix.smem_len = 0x80000; in aty_init()
2519 info->fix.smem_len = 0x100000; in aty_init()
2522 info->fix.smem_len = 0x200000; in aty_init()
2525 info->fix.smem_len = 0x400000; in aty_init()
2528 info->fix.smem_len = 0x600000; in aty_init()
2531 info->fix.smem_len = 0x800000; in aty_init()
2534 info->fix.smem_len = 0x80000; in aty_init()
2539 info->fix.smem_len += 0x400000; in aty_init()
2543 info->fix.smem_len = vram * 1024; in aty_init()
2544 par->mem_cntl &= ~(gtb_memsize ? 0xF : MEM_SIZE_ALIAS); in aty_init()
2545 if (info->fix.smem_len <= 0x80000) in aty_init()
2546 par->mem_cntl |= MEM_SIZE_512K; in aty_init()
2547 else if (info->fix.smem_len <= 0x100000) in aty_init()
2548 par->mem_cntl |= MEM_SIZE_1M; in aty_init()
2549 else if (info->fix.smem_len <= 0x200000) in aty_init()
2550 par->mem_cntl |= gtb_memsize ? MEM_SIZE_2M_GTB : MEM_SIZE_2M; in aty_init()
2551 else if (info->fix.smem_len <= 0x400000) in aty_init()
2552 par->mem_cntl |= gtb_memsize ? MEM_SIZE_4M_GTB : MEM_SIZE_4M; in aty_init()
2553 else if (info->fix.smem_len <= 0x600000) in aty_init()
2554 par->mem_cntl |= gtb_memsize ? MEM_SIZE_6M_GTB : MEM_SIZE_6M; in aty_init()
2556 par->mem_cntl |= gtb_memsize ? MEM_SIZE_8M_GTB : MEM_SIZE_8M; in aty_init()
2557 aty_st_le32(MEM_CNTL, par->mem_cntl, par); in aty_init()
2561 * Reg Block 0 (CT-compatible block) is at mmio_start in aty_init()
2562 * Reg Block 1 (multimedia extensions) is at mmio_start - 0x400 in aty_init()
2565 info->fix.mmio_len = 0x400; in aty_init()
2566 info->fix.accel = FB_ACCEL_ATI_MACH64GX; in aty_init()
2568 info->fix.mmio_len = 0x400; in aty_init()
2569 info->fix.accel = FB_ACCEL_ATI_MACH64CT; in aty_init()
2571 info->fix.mmio_start -= 0x400; in aty_init()
2572 info->fix.mmio_len = 0x800; in aty_init()
2573 info->fix.accel = FB_ACCEL_ATI_MACH64VT; in aty_init()
2575 info->fix.mmio_start -= 0x400; in aty_init()
2576 info->fix.mmio_len = 0x800; in aty_init()
2577 info->fix.accel = FB_ACCEL_ATI_MACH64GT; in aty_init()
2581 info->fix.smem_len == 0x80000 ? 512 : (info->fix.smem_len>>20), in aty_init()
2582 info->fix.smem_len == 0x80000 ? 'K' : 'M', ramname, xtal, in aty_init()
2583 par->pll_limits.pll_max, par->pll_limits.mclk, in aty_init()
2584 par->pll_limits.xclk); in aty_init()
2609 if (par->pll_ops->init_pll) in aty_init()
2610 par->pll_ops->init_pll(info, &par->pll); in aty_init()
2611 if (par->pll_ops->resume_pll) in aty_init()
2612 par->pll_ops->resume_pll(info, &par->pll); in aty_init()
2621 if (par->aux_start) in aty_init()
2630 par->wc_cookie = arch_phys_wc_add(par->res_start, in aty_init()
2631 par->res_size); in aty_init()
2633 info->fbops = &atyfb_ops; in aty_init()
2634 info->pseudo_palette = par->pseudo_palette; in aty_init()
2635 info->flags = FBINFO_DEFAULT | in aty_init()
2646 * wake up from sleep -- paulus in aty_init()
2662 * FIXME: The NVRAM stuff should be put in a Mac-specific file, in aty_init()
2713 if (comp_sync != -1) { in aty_init()
2721 u32 videoram = (info->fix.smem_len - (PAGE_SIZE << 2)); in aty_init()
2737 info->var = var; in aty_init()
2739 ret = fb_alloc_cmap(&info->cmap, 256, 0); in aty_init()
2745 fb_dealloc_cmap(&info->cmap); in aty_init()
2752 info->node, info->fix.id, par->bus_type == ISA ? "ISA" : "PCI"); in aty_init()
2757 aty_set_crtc(par, &par->saved_crtc); in aty_init()
2758 par->pll_ops->set_pll(info, &par->saved_pll); in aty_init()
2759 arch_phys_wc_del(par->wc_cookie); in aty_init()
2791 return -1; in store_video_par()
2801 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_blank()
2804 if (par->lock_blank || par->asleep) in atyfb_blank()
2808 if (par->lcd_table && blank > FB_BLANK_NORMAL && in atyfb_blank()
2837 if (par->lcd_table && blank <= FB_BLANK_NORMAL && in atyfb_blank()
2867 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_setcolreg()
2869 u32 *pal = info->pseudo_palette; in atyfb_setcolreg()
2871 depth = info->var.bits_per_pixel; in atyfb_setcolreg()
2873 depth = (info->var.green.length == 5) ? 15 : 16; in atyfb_setcolreg()
2875 if (par->asleep) in atyfb_setcolreg()
2887 par->palette[regno].red = red; in atyfb_setcolreg()
2888 par->palette[regno].green = green; in atyfb_setcolreg()
2889 par->palette[regno].blue = blue; in atyfb_setcolreg()
2919 par->palette[regno << 1].green, in atyfb_setcolreg()
2921 red = par->palette[regno >> 1].red; in atyfb_setcolreg()
2922 blue = par->palette[regno >> 1].blue; in atyfb_setcolreg()
2942 struct atyfb_par *par = info->par; in atyfb_setup_sparc()
2948 * Map memory-mapped registers. in atyfb_setup_sparc()
2950 par->ati_regbase = (void *)addr + 0x7ffc00UL; in atyfb_setup_sparc()
2951 info->fix.mmio_start = addr + 0x7ffc00UL; in atyfb_setup_sparc()
2954 * Map in big-endian aperture. in atyfb_setup_sparc()
2956 info->screen_base = (char *) (addr + 0x800000UL); in atyfb_setup_sparc()
2957 info->fix.smem_start = addr + 0x800000UL; in atyfb_setup_sparc()
2961 * Split Framebuffer in big- and little-endian halfs. in atyfb_setup_sparc()
2963 for (i = 0; i < 6 && pdev->resource[i].start; i++) in atyfb_setup_sparc()
2967 par->mmap_map = kcalloc(j, sizeof(*par->mmap_map), GFP_ATOMIC); in atyfb_setup_sparc()
2968 if (!par->mmap_map) { in atyfb_setup_sparc()
2970 return -ENOMEM; in atyfb_setup_sparc()
2973 for (i = 0, j = 2; i < 6 && pdev->resource[i].start; i++) { in atyfb_setup_sparc()
2974 struct resource *rp = &pdev->resource[i]; in atyfb_setup_sparc()
2979 base = rp->start; in atyfb_setup_sparc()
2981 io = (rp->flags & IORESOURCE_IO); in atyfb_setup_sparc()
2983 size = rp->end - base + 1; in atyfb_setup_sparc()
2997 par->mmap_map[j].voff = (pbase + 0x10000000) & PAGE_MASK; in atyfb_setup_sparc()
2998 par->mmap_map[j].poff = base & PAGE_MASK; in atyfb_setup_sparc()
2999 par->mmap_map[j].size = (size + ~PAGE_MASK) & PAGE_MASK; in atyfb_setup_sparc()
3000 par->mmap_map[j].prot_mask = _PAGE_CACHE; in atyfb_setup_sparc()
3001 par->mmap_map[j].prot_flag = _PAGE_E; in atyfb_setup_sparc()
3010 par->mmap_map[j].voff = (pbase + 0x800000) & PAGE_MASK; in atyfb_setup_sparc()
3011 par->mmap_map[j].poff = (base + 0x800000) & PAGE_MASK; in atyfb_setup_sparc()
3012 par->mmap_map[j].size = 0x800000; in atyfb_setup_sparc()
3013 par->mmap_map[j].prot_mask = _PAGE_CACHE; in atyfb_setup_sparc()
3014 par->mmap_map[j].prot_flag = _PAGE_E | _PAGE_IE; in atyfb_setup_sparc()
3015 size -= 0x800000; in atyfb_setup_sparc()
3019 par->mmap_map[j].voff = pbase & PAGE_MASK; in atyfb_setup_sparc()
3020 par->mmap_map[j].poff = base & PAGE_MASK; in atyfb_setup_sparc()
3021 par->mmap_map[j].size = (size + ~PAGE_MASK) & PAGE_MASK; in atyfb_setup_sparc()
3022 par->mmap_map[j].prot_mask = _PAGE_CACHE; in atyfb_setup_sparc()
3023 par->mmap_map[j].prot_flag = _PAGE_E; in atyfb_setup_sparc()
3031 if (IS_XL(pdev->device)) { in atyfb_setup_sparc()
3072 var->bits_per_pixel = of_getintprop_default(dp, "depth", 8); in atyfb_setup_sparc()
3073 var->xoffset = var->yoffset = 0; in atyfb_setup_sparc()
3081 h_total = var->xres + var->right_margin + var->hsync_len + var->left_margin; in atyfb_setup_sparc()
3082 v_total = var->yres + var->lower_margin + var->vsync_len + var->upper_margin; in atyfb_setup_sparc()
3114 * Target Frequency: in atyfb_setup_sparc()
3117 * Q = ------- in atyfb_setup_sparc()
3122 if (IS_XL(pdev->device)) in atyfb_setup_sparc()
3148 * - Check the startup video mode and calculate the panel in aty_init_lcd()
3150 * - Read it from the driver information table in the video BIOS. in aty_init_lcd()
3163 par->lcd_table = 0; in aty_init_lcd()
3165 par->lcd_table = bios_base + lcd_ofs; in aty_init_lcd()
3168 if (par->lcd_table != 0) { in aty_init_lcd()
3187 id = *(u8 *)par->lcd_table; in aty_init_lcd()
3188 strncpy(model, (char *)par->lcd_table+1, 24); 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()
3445 * effect on the MMIO region on both non-PAT and PAT systems. in atyfb_setup_generic()
3447 par->ati_regbase = ioremap_uc(info->fix.mmio_start, 0x1000); in atyfb_setup_generic()
3448 if (par->ati_regbase == NULL) in atyfb_setup_generic()
3449 return -ENOMEM; in atyfb_setup_generic()
3451 info->fix.mmio_start += par->aux_start ? 0x400 : 0xc00; in atyfb_setup_generic()
3452 par->ati_regbase += par->aux_start ? 0x400 : 0xc00; in atyfb_setup_generic()
3455 * Enable memory-space accesses using config-space in atyfb_setup_generic()
3464 /* Use the big-endian aperture */ in atyfb_setup_generic()
3469 info->fix.smem_start = addr; in atyfb_setup_generic()
3482 info->fix.smem_len = 0x800000; in atyfb_setup_generic()
3486 info->screen_base = ioremap_wc(info->fix.smem_start, in atyfb_setup_generic()
3487 info->fix.smem_len); in atyfb_setup_generic()
3488 if (info->screen_base == NULL) { in atyfb_setup_generic()
3489 ret = -ENOMEM; in atyfb_setup_generic()
3502 par->clk_wr_offset = (inb(R_GENMO) & 0x0CU) >> 2; in atyfb_setup_generic()
3504 par->clk_wr_offset = aty_ld_8(CLOCK_CNTL, par) & 0x03U; in atyfb_setup_generic()
3506 /* according to ATI, we should use clock 3 for acelerated mode */ in atyfb_setup_generic()
3507 par->clk_wr_offset = 3; in atyfb_setup_generic()
3512 iounmap(par->ati_regbase); in atyfb_setup_generic()
3513 par->ati_regbase = NULL; in atyfb_setup_generic()
3514 if (info->screen_base) { in atyfb_setup_generic()
3515 iounmap(info->screen_base); in atyfb_setup_generic()
3516 info->screen_base = NULL; in atyfb_setup_generic()
3530 int rc = -ENOMEM; in atyfb_pci_probe()
3535 return -ENXIO; in atyfb_pci_probe()
3539 rp = &pdev->resource[0]; in atyfb_pci_probe()
3540 if (rp->flags & IORESOURCE_IO) in atyfb_pci_probe()
3541 rp = &pdev->resource[1]; in atyfb_pci_probe()
3542 addr = rp->start; in atyfb_pci_probe()
3544 return -ENXIO; in atyfb_pci_probe()
3547 res_start = rp->start; in atyfb_pci_probe()
3550 return -EBUSY; in atyfb_pci_probe()
3553 info = framebuffer_alloc(sizeof(struct atyfb_par), &pdev->dev); in atyfb_pci_probe()
3555 return -ENOMEM; in atyfb_pci_probe()
3557 par = info->par; in atyfb_pci_probe()
3558 par->bus_type = PCI; in atyfb_pci_probe()
3559 info->fix = atyfb_fix; in atyfb_pci_probe()
3560 info->device = &pdev->dev; in atyfb_pci_probe()
3561 par->pci_id = pdev->device; in atyfb_pci_probe()
3562 par->res_start = res_start; in atyfb_pci_probe()
3563 par->res_size = res_size; in atyfb_pci_probe()
3564 par->irq = pdev->irq; in atyfb_pci_probe()
3565 par->pdev = pdev; in atyfb_pci_probe()
3587 par->mmap_map[0].voff = 0x8000000000000000UL; in atyfb_pci_probe()
3588 par->mmap_map[0].poff = (unsigned long) info->screen_base & PAGE_MASK; in atyfb_pci_probe()
3589 par->mmap_map[0].size = info->fix.smem_len; in atyfb_pci_probe()
3590 par->mmap_map[0].prot_mask = _PAGE_CACHE; in atyfb_pci_probe()
3591 par->mmap_map[0].prot_flag = _PAGE_E; in atyfb_pci_probe()
3592 par->mmap_map[1].voff = par->mmap_map[0].voff + info->fix.smem_len; in atyfb_pci_probe()
3593 par->mmap_map[1].poff = (long)par->ati_regbase & PAGE_MASK; in atyfb_pci_probe()
3594 par->mmap_map[1].size = PAGE_SIZE; in atyfb_pci_probe()
3595 par->mmap_map[1].prot_mask = _PAGE_CACHE; in atyfb_pci_probe()
3596 par->mmap_map[1].prot_flag = _PAGE_E; in atyfb_pci_probe()
3608 kfree(par->mmap_map); in atyfb_pci_probe()
3610 if (par->ati_regbase) in atyfb_pci_probe()
3611 iounmap(par->ati_regbase); in atyfb_pci_probe()
3612 if (info->screen_base) in atyfb_pci_probe()
3613 iounmap(info->screen_base); in atyfb_pci_probe()
3616 if (par->aux_start) in atyfb_pci_probe()
3617 release_mem_region(par->aux_start, par->aux_size); in atyfb_pci_probe()
3619 release_mem_region(par->res_start, par->res_size); in atyfb_pci_probe()
3647 return -ENOMEM; in atyfb_atari_probe()
3649 par = info->par; in atyfb_atari_probe()
3651 info->fix = atyfb_fix; in atyfb_atari_probe()
3653 par->irq = (unsigned int) -1; /* something invalid */ in atyfb_atari_probe()
3659 info->screen_base = ioremap_wc(phys_vmembase[m64_num], in atyfb_atari_probe()
3661 info->fix.smem_start = (unsigned long)info->screen_base; /* Fake! */ in atyfb_atari_probe()
3662 par->ati_regbase = ioremap(phys_guiregbase[m64_num], 0x10000) + in atyfb_atari_probe()
3664 info->fix.mmio_start = (unsigned long)par->ati_regbase; /* Fake! */ in atyfb_atari_probe()
3671 par->clk_wr_offset = 3; /* */ in atyfb_atari_probe()
3674 par->clk_wr_offset = 2; /* Medusa ST-IO ISA Adapter etc. */ in atyfb_atari_probe()
3677 par->clk_wr_offset = 1; /* */ in atyfb_atari_probe()
3680 par->clk_wr_offset = 0; /* Panther 1 ISA Adapter (Gerald) */ in atyfb_atari_probe()
3687 par->pci_id = PCI_CHIP_MACH64GX; in atyfb_atari_probe()
3690 par->pci_id = PCI_CHIP_MACH64CX; in atyfb_atari_probe()
3697 iounmap(info->screen_base); in atyfb_atari_probe()
3698 iounmap(par->ati_regbase); in atyfb_atari_probe()
3705 return num_found ? 0 : -ENXIO; in atyfb_atari_probe()
3714 struct atyfb_par *par = (struct atyfb_par *) info->par; in atyfb_remove()
3717 aty_set_crtc(par, &par->saved_crtc); in atyfb_remove()
3718 par->pll_ops->set_pll(info, &par->saved_pll); in atyfb_remove()
3724 aty_bl_exit(info->bl_dev); in atyfb_remove()
3726 arch_phys_wc_del(par->wc_cookie); in atyfb_remove()
3729 if (par->ati_regbase) in atyfb_remove()
3730 iounmap(par->ati_regbase); in atyfb_remove()
3731 if (info->screen_base) in atyfb_remove()
3732 iounmap(info->screen_base); in atyfb_remove()
3734 if (info->sprite.addr) in atyfb_remove()
3735 iounmap(info->sprite.addr); in atyfb_remove()
3739 kfree(par->mmap_map); in atyfb_remove()
3741 if (par->aux_start) in atyfb_remove()
3742 release_mem_region(par->aux_start, par->aux_size); in atyfb_remove()
3744 if (par->res_start) in atyfb_remove()
3745 release_mem_region(par->res_start, par->res_size); in atyfb_remove()
3917 par = reboot_info->par; in atyfb_reboot_notify()
3924 aty_set_crtc(par, &par->saved_crtc); in atyfb_reboot_notify()
3925 par->pll_ops->set_pll(reboot_info, &par->saved_pll); in atyfb_reboot_notify()
3942 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
3959 return -ENODEV; in atyfb_init()
3971 return -ENODEV; in atyfb_init()
3994 MODULE_DESCRIPTION("FBDev driver for ATI Mach64 cards");
4009 MODULE_PARM_DESC(mode, "Specify resolution as \"<xres>x<yres>[-<bpp>][@<refresh>]\" ");