Lines Matching refs:cfb

109 #define cyber2000fb_writel(val, reg, cfb)	writel(val, (cfb)->regs + (reg))  argument
110 #define cyber2000fb_writew(val, reg, cfb) writew(val, (cfb)->regs + (reg)) argument
111 #define cyber2000fb_writeb(val, reg, cfb) writeb(val, (cfb)->regs + (reg)) argument
113 #define cyber2000fb_readb(reg, cfb) readb((cfb)->regs + (reg)) argument
116 cyber2000_crtcw(unsigned int reg, unsigned int val, struct cfb_info *cfb) in cyber2000_crtcw() argument
118 cyber2000fb_writew((reg & 255) | val << 8, 0x3d4, cfb); in cyber2000_crtcw()
122 cyber2000_grphw(unsigned int reg, unsigned int val, struct cfb_info *cfb) in cyber2000_grphw() argument
124 cyber2000fb_writew((reg & 255) | val << 8, 0x3ce, cfb); in cyber2000_grphw()
128 cyber2000_grphr(unsigned int reg, struct cfb_info *cfb) in cyber2000_grphr() argument
130 cyber2000fb_writeb(reg, 0x3ce, cfb); in cyber2000_grphr()
131 return cyber2000fb_readb(0x3cf, cfb); in cyber2000_grphr()
135 cyber2000_attrw(unsigned int reg, unsigned int val, struct cfb_info *cfb) in cyber2000_attrw() argument
137 cyber2000fb_readb(0x3da, cfb); in cyber2000_attrw()
138 cyber2000fb_writeb(reg, 0x3c0, cfb); in cyber2000_attrw()
139 cyber2000fb_readb(0x3c1, cfb); in cyber2000_attrw()
140 cyber2000fb_writeb(val, 0x3c0, cfb); in cyber2000_attrw()
144 cyber2000_seqw(unsigned int reg, unsigned int val, struct cfb_info *cfb) in cyber2000_seqw() argument
146 cyber2000fb_writew((reg & 255) | val << 8, 0x3c4, cfb); in cyber2000_seqw()
157 struct cfb_info *cfb = container_of(info, struct cfb_info, fb); in cyber2000fb_fillrect() local
160 if (!(cfb->fb.var.accel_flags & FB_ACCELF_TEXT)) { in cyber2000fb_fillrect()
165 cyber2000fb_writeb(0, CO_REG_CONTROL, cfb); in cyber2000fb_fillrect()
166 cyber2000fb_writew(rect->width - 1, CO_REG_PIXWIDTH, cfb); in cyber2000fb_fillrect()
167 cyber2000fb_writew(rect->height - 1, CO_REG_PIXHEIGHT, cfb); in cyber2000fb_fillrect()
170 if (cfb->fb.var.bits_per_pixel > 8) in cyber2000fb_fillrect()
171 col = ((u32 *)cfb->fb.pseudo_palette)[col]; in cyber2000fb_fillrect()
172 cyber2000fb_writel(col, CO_REG_FGCOLOUR, cfb); in cyber2000fb_fillrect()
174 dst = rect->dx + rect->dy * cfb->fb.var.xres_virtual; in cyber2000fb_fillrect()
175 if (cfb->fb.var.bits_per_pixel == 24) { in cyber2000fb_fillrect()
176 cyber2000fb_writeb(dst, CO_REG_X_PHASE, cfb); in cyber2000fb_fillrect()
180 cyber2000fb_writel(dst, CO_REG_DEST_PTR, cfb); in cyber2000fb_fillrect()
181 cyber2000fb_writeb(CO_FG_MIX_SRC, CO_REG_FGMIX, cfb); in cyber2000fb_fillrect()
182 cyber2000fb_writew(CO_CMD_L_PATTERN_FGCOL, CO_REG_CMD_L, cfb); in cyber2000fb_fillrect()
183 cyber2000fb_writew(CO_CMD_H_BLITTER, CO_REG_CMD_H, cfb); in cyber2000fb_fillrect()
189 struct cfb_info *cfb = container_of(info, struct cfb_info, fb); in cyber2000fb_copyarea() local
193 if (!(cfb->fb.var.accel_flags & FB_ACCELF_TEXT)) { in cyber2000fb_copyarea()
198 cyber2000fb_writeb(0, CO_REG_CONTROL, cfb); in cyber2000fb_copyarea()
199 cyber2000fb_writew(region->width - 1, CO_REG_PIXWIDTH, cfb); in cyber2000fb_copyarea()
200 cyber2000fb_writew(region->height - 1, CO_REG_PIXHEIGHT, cfb); in cyber2000fb_copyarea()
202 src = region->sx + region->sy * cfb->fb.var.xres_virtual; in cyber2000fb_copyarea()
203 dst = region->dx + region->dy * cfb->fb.var.xres_virtual; in cyber2000fb_copyarea()
212 src += (region->height - 1) * cfb->fb.var.xres_virtual; in cyber2000fb_copyarea()
213 dst += (region->height - 1) * cfb->fb.var.xres_virtual; in cyber2000fb_copyarea()
217 if (cfb->fb.var.bits_per_pixel == 24) { in cyber2000fb_copyarea()
218 cyber2000fb_writeb(dst, CO_REG_X_PHASE, cfb); in cyber2000fb_copyarea()
222 cyber2000fb_writel(src, CO_REG_SRC1_PTR, cfb); in cyber2000fb_copyarea()
223 cyber2000fb_writel(dst, CO_REG_DEST_PTR, cfb); in cyber2000fb_copyarea()
224 cyber2000fb_writew(CO_FG_MIX_SRC, CO_REG_FGMIX, cfb); in cyber2000fb_copyarea()
225 cyber2000fb_writew(cmd, CO_REG_CMD_L, cfb); in cyber2000fb_copyarea()
227 CO_REG_CMD_H, cfb); in cyber2000fb_copyarea()
239 struct cfb_info *cfb = container_of(info, struct cfb_info, fb); in cyber2000fb_sync() local
242 if (!(cfb->fb.var.accel_flags & FB_ACCELF_TEXT)) in cyber2000fb_sync()
245 while (cyber2000fb_readb(CO_REG_CONTROL, cfb) & CO_CTRL_BUSY) { in cyber2000fb_sync()
248 cyber2000fb_writeb(0, CO_REG_CONTROL, cfb); in cyber2000fb_sync()
274 struct cfb_info *cfb = container_of(info, struct cfb_info, fb); in cyber2000fb_setcolreg() local
275 struct fb_var_screeninfo *var = &cfb->fb.var; in cyber2000fb_setcolreg()
279 switch (cfb->fb.fix.visual) { in cyber2000fb_setcolreg()
300 cfb->palette[regno].red = red; in cyber2000fb_setcolreg()
301 cfb->palette[regno].green = green; in cyber2000fb_setcolreg()
302 cfb->palette[regno].blue = blue; in cyber2000fb_setcolreg()
304 cyber2000fb_writeb(regno, 0x3c8, cfb); in cyber2000fb_setcolreg()
305 cyber2000fb_writeb(red, 0x3c9, cfb); in cyber2000fb_setcolreg()
306 cyber2000fb_writeb(green, 0x3c9, cfb); in cyber2000fb_setcolreg()
307 cyber2000fb_writeb(blue, 0x3c9, cfb); in cyber2000fb_setcolreg()
326 cfb->palette[regno << 2].green = green; in cyber2000fb_setcolreg()
332 cyber2000fb_writeb(regno << 2, 0x3c8, cfb); in cyber2000fb_setcolreg()
333 cyber2000fb_writeb(cfb->palette[regno >> 1].red, in cyber2000fb_setcolreg()
334 0x3c9, cfb); in cyber2000fb_setcolreg()
335 cyber2000fb_writeb(green, 0x3c9, cfb); in cyber2000fb_setcolreg()
336 cyber2000fb_writeb(cfb->palette[regno >> 1].blue, in cyber2000fb_setcolreg()
337 0x3c9, cfb); in cyber2000fb_setcolreg()
339 green = cfb->palette[regno << 3].green; in cyber2000fb_setcolreg()
345 cfb->palette[regno << 3].red = red; in cyber2000fb_setcolreg()
346 cfb->palette[regno << 3].green = green; in cyber2000fb_setcolreg()
347 cfb->palette[regno << 3].blue = blue; in cyber2000fb_setcolreg()
353 cyber2000fb_writeb(regno << 3, 0x3c8, cfb); in cyber2000fb_setcolreg()
354 cyber2000fb_writeb(red, 0x3c9, cfb); in cyber2000fb_setcolreg()
355 cyber2000fb_writeb(green, 0x3c9, cfb); in cyber2000fb_setcolreg()
356 cyber2000fb_writeb(blue, 0x3c9, cfb); in cyber2000fb_setcolreg()
361 cfb->palette[regno << 4].red = red; in cyber2000fb_setcolreg()
362 cfb->palette[regno << 4].green = green; in cyber2000fb_setcolreg()
363 cfb->palette[regno << 4].blue = blue; in cyber2000fb_setcolreg()
369 cyber2000fb_writeb(regno << 4, 0x3c8, cfb); in cyber2000fb_setcolreg()
370 cyber2000fb_writeb(red, 0x3c9, cfb); in cyber2000fb_setcolreg()
371 cyber2000fb_writeb(green, 0x3c9, cfb); in cyber2000fb_setcolreg()
372 cyber2000fb_writeb(blue, 0x3c9, cfb); in cyber2000fb_setcolreg()
408 ((u32 *)cfb->fb.pseudo_palette)[regno] = pseudo_val; in cyber2000fb_setcolreg()
439 static void cyber2000fb_write_ramdac_ctrl(struct cfb_info *cfb) in cyber2000fb_write_ramdac_ctrl() argument
442 unsigned int val = cfb->ramdac_ctrl | cfb->ramdac_powerdown; in cyber2000fb_write_ramdac_ctrl()
444 cyber2000fb_writeb(0x56, 0x3ce, cfb); in cyber2000fb_write_ramdac_ctrl()
445 i = cyber2000fb_readb(0x3cf, cfb); in cyber2000fb_write_ramdac_ctrl()
446 cyber2000fb_writeb(i | 4, 0x3cf, cfb); in cyber2000fb_write_ramdac_ctrl()
447 cyber2000fb_writeb(val, 0x3c6, cfb); in cyber2000fb_write_ramdac_ctrl()
448 cyber2000fb_writeb(i, 0x3cf, cfb); in cyber2000fb_write_ramdac_ctrl()
450 cyber2000fb_readb(0x3cf, cfb); in cyber2000fb_write_ramdac_ctrl()
453 static void cyber2000fb_set_timing(struct cfb_info *cfb, struct par_info *hw) in cyber2000fb_set_timing() argument
461 cyber2000fb_writeb(i, 0x3c8, cfb); in cyber2000fb_set_timing()
462 cyber2000fb_writeb(0, 0x3c9, cfb); in cyber2000fb_set_timing()
463 cyber2000fb_writeb(0, 0x3c9, cfb); in cyber2000fb_set_timing()
464 cyber2000fb_writeb(0, 0x3c9, cfb); in cyber2000fb_set_timing()
467 cyber2000fb_writeb(0xef, 0x3c2, cfb); in cyber2000fb_set_timing()
468 cyber2000_crtcw(0x11, 0x0b, cfb); in cyber2000fb_set_timing()
469 cyber2000_attrw(0x11, 0x00, cfb); in cyber2000fb_set_timing()
471 cyber2000_seqw(0x00, 0x01, cfb); in cyber2000fb_set_timing()
472 cyber2000_seqw(0x01, 0x01, cfb); in cyber2000fb_set_timing()
473 cyber2000_seqw(0x02, 0x0f, cfb); in cyber2000fb_set_timing()
474 cyber2000_seqw(0x03, 0x00, cfb); in cyber2000fb_set_timing()
475 cyber2000_seqw(0x04, 0x0e, cfb); in cyber2000fb_set_timing()
476 cyber2000_seqw(0x00, 0x03, cfb); in cyber2000fb_set_timing()
479 cyber2000_crtcw(crtc_idx[i], hw->crtc[i], cfb); in cyber2000fb_set_timing()
482 cyber2000_crtcw(i, 0, cfb); in cyber2000fb_set_timing()
484 cyber2000_grphw(EXT_CRT_VRTOFL, hw->crtc_ofl, cfb); in cyber2000fb_set_timing()
485 cyber2000_grphw(0x00, 0x00, cfb); in cyber2000fb_set_timing()
486 cyber2000_grphw(0x01, 0x00, cfb); in cyber2000fb_set_timing()
487 cyber2000_grphw(0x02, 0x00, cfb); in cyber2000fb_set_timing()
488 cyber2000_grphw(0x03, 0x00, cfb); in cyber2000fb_set_timing()
489 cyber2000_grphw(0x04, 0x00, cfb); in cyber2000fb_set_timing()
490 cyber2000_grphw(0x05, 0x60, cfb); in cyber2000fb_set_timing()
491 cyber2000_grphw(0x06, 0x05, cfb); in cyber2000fb_set_timing()
492 cyber2000_grphw(0x07, 0x0f, cfb); in cyber2000fb_set_timing()
493 cyber2000_grphw(0x08, 0xff, cfb); in cyber2000fb_set_timing()
497 cyber2000_attrw(i, i, cfb); in cyber2000fb_set_timing()
499 cyber2000_attrw(0x10, 0x01, cfb); in cyber2000fb_set_timing()
500 cyber2000_attrw(0x11, 0x00, cfb); in cyber2000fb_set_timing()
501 cyber2000_attrw(0x12, 0x0f, cfb); in cyber2000fb_set_timing()
502 cyber2000_attrw(0x13, 0x00, cfb); in cyber2000fb_set_timing()
503 cyber2000_attrw(0x14, 0x00, cfb); in cyber2000fb_set_timing()
506 spin_lock(&cfb->reg_b0_lock); in cyber2000fb_set_timing()
507 cyber2000_grphw(EXT_DCLK_MULT, hw->clock_mult, cfb); in cyber2000fb_set_timing()
508 cyber2000_grphw(EXT_DCLK_DIV, hw->clock_div, cfb); in cyber2000fb_set_timing()
509 cyber2000_grphw(EXT_MCLK_MULT, cfb->mclk_mult, cfb); in cyber2000fb_set_timing()
510 cyber2000_grphw(EXT_MCLK_DIV, cfb->mclk_div, cfb); in cyber2000fb_set_timing()
511 cyber2000_grphw(0x90, 0x01, cfb); in cyber2000fb_set_timing()
512 cyber2000_grphw(0xb9, 0x80, cfb); in cyber2000fb_set_timing()
513 cyber2000_grphw(0xb9, 0x00, cfb); in cyber2000fb_set_timing()
514 spin_unlock(&cfb->reg_b0_lock); in cyber2000fb_set_timing()
516 cfb->ramdac_ctrl = hw->ramdac; in cyber2000fb_set_timing()
517 cyber2000fb_write_ramdac_ctrl(cfb); in cyber2000fb_set_timing()
519 cyber2000fb_writeb(0x20, 0x3c0, cfb); in cyber2000fb_set_timing()
520 cyber2000fb_writeb(0xff, 0x3c6, cfb); in cyber2000fb_set_timing()
522 cyber2000_grphw(0x14, hw->fetch, cfb); in cyber2000fb_set_timing()
524 ((hw->pitch >> 4) & 0x30), cfb); in cyber2000fb_set_timing()
525 cyber2000_grphw(EXT_SEQ_MISC, hw->extseqmisc, cfb); in cyber2000fb_set_timing()
530 cyber2000fb_writew(hw->width, CO_REG_SRC_WIDTH, cfb); in cyber2000fb_set_timing()
531 cyber2000fb_writew(hw->width, CO_REG_DEST_WIDTH, cfb); in cyber2000fb_set_timing()
532 cyber2000fb_writeb(hw->co_pixfmt, CO_REG_PIXFMT, cfb); in cyber2000fb_set_timing()
536 cyber2000fb_update_start(struct cfb_info *cfb, struct fb_var_screeninfo *var) in cyber2000fb_update_start() argument
551 cyber2000_grphw(0x10, base >> 16 | 0x10, cfb); in cyber2000fb_update_start()
552 cyber2000_crtcw(0x0c, base >> 8, cfb); in cyber2000fb_update_start()
553 cyber2000_crtcw(0x0d, base, cfb); in cyber2000fb_update_start()
559 cyber2000fb_decode_crtc(struct par_info *hw, struct cfb_info *cfb, in cyber2000fb_decode_crtc() argument
660 cyber2000fb_decode_clock(struct par_info *hw, struct cfb_info *cfb, in cyber2000fb_decode_clock() argument
664 const u_long ref_ps = cfb->ref_ps; in cyber2000fb_decode_clock()
677 new_pll = pll_ps / cfb->divisors[div2]; in cyber2000fb_decode_clock()
756 struct cfb_info *cfb = container_of(info, struct cfb_info, fb); in cyber2000fb_check_var() local
837 if (mem > cfb->fb.fix.smem_len) in cyber2000fb_check_var()
838 var->yres_virtual = cfb->fb.fix.smem_len * 8 / in cyber2000fb_check_var()
846 err = cyber2000fb_decode_clock(&hw, cfb, var); in cyber2000fb_check_var()
850 err = cyber2000fb_decode_crtc(&hw, cfb, var); in cyber2000fb_check_var()
859 struct cfb_info *cfb = container_of(info, struct cfb_info, fb); in cyber2000fb_set_par() local
860 struct fb_var_screeninfo *var = &cfb->fb.var; in cyber2000fb_set_par()
923 BUG_ON(cyber2000fb_decode_clock(&hw, cfb, var) != 0); in cyber2000fb_set_par()
924 BUG_ON(cyber2000fb_decode_crtc(&hw, cfb, var) != 0); in cyber2000fb_set_par()
928 if (!(cfb->mem_ctl2 & MEM_CTL2_64BIT)) in cyber2000fb_set_par()
932 cfb->fb.fix.line_length = var->xres_virtual * var->bits_per_pixel / 8; in cyber2000fb_set_par()
941 mem = cfb->fb.fix.line_length * var->yres_virtual; in cyber2000fb_set_par()
942 BUG_ON(mem > cfb->fb.fix.smem_len); in cyber2000fb_set_par()
951 cfb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; in cyber2000fb_set_par()
953 cfb->fb.fix.visual = FB_VISUAL_TRUECOLOR; in cyber2000fb_set_par()
955 cfb->fb.fix.visual = FB_VISUAL_DIRECTCOLOR; in cyber2000fb_set_par()
957 cyber2000fb_set_timing(cfb, &hw); in cyber2000fb_set_par()
958 cyber2000fb_update_start(cfb, var); in cyber2000fb_set_par()
969 struct cfb_info *cfb = container_of(info, struct cfb_info, fb); in cyber2000fb_pan_display() local
971 if (cyber2000fb_update_start(cfb, var)) in cyber2000fb_pan_display()
974 cfb->fb.var.xoffset = var->xoffset; in cyber2000fb_pan_display()
975 cfb->fb.var.yoffset = var->yoffset; in cyber2000fb_pan_display()
978 cfb->fb.var.vmode |= FB_VMODE_YWRAP; in cyber2000fb_pan_display()
980 cfb->fb.var.vmode &= ~FB_VMODE_YWRAP; in cyber2000fb_pan_display()
1005 struct cfb_info *cfb = container_of(info, struct cfb_info, fb); in cyber2000fb_blank() local
1024 cyber2000_grphw(EXT_SYNC_CTL, sync, cfb); in cyber2000fb_blank()
1028 cfb->ramdac_powerdown &= ~(RAMDAC_DACPWRDN | RAMDAC_BYPASS | in cyber2000fb_blank()
1030 cyber2000fb_write_ramdac_ctrl(cfb); in cyber2000fb_blank()
1038 cyber2000fb_writeb(i, 0x3c8, cfb); in cyber2000fb_blank()
1039 cyber2000fb_writeb(0, 0x3c9, cfb); in cyber2000fb_blank()
1040 cyber2000fb_writeb(0, 0x3c9, cfb); in cyber2000fb_blank()
1041 cyber2000fb_writeb(0, 0x3c9, cfb); in cyber2000fb_blank()
1045 cyber2000fb_writeb(i, 0x3c8, cfb); in cyber2000fb_blank()
1046 cyber2000fb_writeb(cfb->palette[i].red, 0x3c9, cfb); in cyber2000fb_blank()
1047 cyber2000fb_writeb(cfb->palette[i].green, 0x3c9, cfb); in cyber2000fb_blank()
1048 cyber2000fb_writeb(cfb->palette[i].blue, 0x3c9, cfb); in cyber2000fb_blank()
1054 cfb->ramdac_powerdown |= RAMDAC_DACPWRDN | RAMDAC_BYPASS | in cyber2000fb_blank()
1056 cyber2000fb_write_ramdac_ctrl(cfb); in cyber2000fb_blank()
1085 void cyber2000fb_enable_extregs(struct cfb_info *cfb) in cyber2000fb_enable_extregs() argument
1087 cfb->func_use_count += 1; in cyber2000fb_enable_extregs()
1089 if (cfb->func_use_count == 1) { in cyber2000fb_enable_extregs()
1092 old = cyber2000_grphr(EXT_FUNC_CTL, cfb); in cyber2000fb_enable_extregs()
1094 cyber2000_grphw(EXT_FUNC_CTL, old, cfb); in cyber2000fb_enable_extregs()
1102 void cyber2000fb_disable_extregs(struct cfb_info *cfb) in cyber2000fb_disable_extregs() argument
1104 if (cfb->func_use_count == 1) { in cyber2000fb_disable_extregs()
1107 old = cyber2000_grphr(EXT_FUNC_CTL, cfb); in cyber2000fb_disable_extregs()
1109 cyber2000_grphw(EXT_FUNC_CTL, old, cfb); in cyber2000fb_disable_extregs()
1112 if (cfb->func_use_count == 0) in cyber2000fb_disable_extregs()
1115 cfb->func_use_count -= 1; in cyber2000fb_disable_extregs()
1161 static void cyber2000fb_enable_ddc(struct cfb_info *cfb) in cyber2000fb_enable_ddc() argument
1162 __acquires(&cfb->reg_b0_lock) in cyber2000fb_enable_ddc()
1164 spin_lock(&cfb->reg_b0_lock); in cyber2000fb_enable_ddc()
1165 cyber2000fb_writew(0x1bf, 0x3ce, cfb); in cyber2000fb_enable_ddc()
1168 static void cyber2000fb_disable_ddc(struct cfb_info *cfb) in cyber2000fb_disable_ddc() argument
1169 __releases(&cfb->reg_b0_lock) in cyber2000fb_disable_ddc()
1171 cyber2000fb_writew(0x0bf, 0x3ce, cfb); in cyber2000fb_disable_ddc()
1172 spin_unlock(&cfb->reg_b0_lock); in cyber2000fb_disable_ddc()
1178 struct cfb_info *cfb = data; in cyber2000fb_ddc_setscl() local
1181 cyber2000fb_enable_ddc(cfb); in cyber2000fb_ddc_setscl()
1182 reg = cyber2000_grphr(DDC_REG, cfb); in cyber2000fb_ddc_setscl()
1187 cyber2000_grphw(DDC_REG, reg, cfb); in cyber2000fb_ddc_setscl()
1188 cyber2000fb_disable_ddc(cfb); in cyber2000fb_ddc_setscl()
1193 struct cfb_info *cfb = data; in cyber2000fb_ddc_setsda() local
1196 cyber2000fb_enable_ddc(cfb); in cyber2000fb_ddc_setsda()
1197 reg = cyber2000_grphr(DDC_REG, cfb); in cyber2000fb_ddc_setsda()
1202 cyber2000_grphw(DDC_REG, reg, cfb); in cyber2000fb_ddc_setsda()
1203 cyber2000fb_disable_ddc(cfb); in cyber2000fb_ddc_setsda()
1208 struct cfb_info *cfb = data; in cyber2000fb_ddc_getscl() local
1211 cyber2000fb_enable_ddc(cfb); in cyber2000fb_ddc_getscl()
1212 retval = !!(cyber2000_grphr(DDC_REG, cfb) & DDC_SCL_IN); in cyber2000fb_ddc_getscl()
1213 cyber2000fb_disable_ddc(cfb); in cyber2000fb_ddc_getscl()
1220 struct cfb_info *cfb = data; in cyber2000fb_ddc_getsda() local
1223 cyber2000fb_enable_ddc(cfb); in cyber2000fb_ddc_getsda()
1224 retval = !!(cyber2000_grphr(DDC_REG, cfb) & DDC_SDA_IN); in cyber2000fb_ddc_getsda()
1225 cyber2000fb_disable_ddc(cfb); in cyber2000fb_ddc_getsda()
1230 static int cyber2000fb_setup_ddc_bus(struct cfb_info *cfb) in cyber2000fb_setup_ddc_bus() argument
1232 strscpy(cfb->ddc_adapter.name, cfb->fb.fix.id, in cyber2000fb_setup_ddc_bus()
1233 sizeof(cfb->ddc_adapter.name)); in cyber2000fb_setup_ddc_bus()
1234 cfb->ddc_adapter.owner = THIS_MODULE; in cyber2000fb_setup_ddc_bus()
1235 cfb->ddc_adapter.class = I2C_CLASS_DDC; in cyber2000fb_setup_ddc_bus()
1236 cfb->ddc_adapter.algo_data = &cfb->ddc_algo; in cyber2000fb_setup_ddc_bus()
1237 cfb->ddc_adapter.dev.parent = cfb->fb.device; in cyber2000fb_setup_ddc_bus()
1238 cfb->ddc_algo.setsda = cyber2000fb_ddc_setsda; in cyber2000fb_setup_ddc_bus()
1239 cfb->ddc_algo.setscl = cyber2000fb_ddc_setscl; in cyber2000fb_setup_ddc_bus()
1240 cfb->ddc_algo.getsda = cyber2000fb_ddc_getsda; in cyber2000fb_setup_ddc_bus()
1241 cfb->ddc_algo.getscl = cyber2000fb_ddc_getscl; in cyber2000fb_setup_ddc_bus()
1242 cfb->ddc_algo.udelay = 10; in cyber2000fb_setup_ddc_bus()
1243 cfb->ddc_algo.timeout = 20; in cyber2000fb_setup_ddc_bus()
1244 cfb->ddc_algo.data = cfb; in cyber2000fb_setup_ddc_bus()
1246 i2c_set_adapdata(&cfb->ddc_adapter, cfb); in cyber2000fb_setup_ddc_bus()
1248 return i2c_bit_add_bus(&cfb->ddc_adapter); in cyber2000fb_setup_ddc_bus()
1255 struct cfb_info *cfb = data; in cyber2000fb_i2c_setsda() local
1258 spin_lock(&cfb->reg_b0_lock); in cyber2000fb_i2c_setsda()
1259 latch2 = cyber2000_grphr(EXT_LATCH2, cfb); in cyber2000fb_i2c_setsda()
1263 cyber2000_grphw(EXT_LATCH2, latch2, cfb); in cyber2000fb_i2c_setsda()
1264 spin_unlock(&cfb->reg_b0_lock); in cyber2000fb_i2c_setsda()
1269 struct cfb_info *cfb = data; in cyber2000fb_i2c_setscl() local
1272 spin_lock(&cfb->reg_b0_lock); in cyber2000fb_i2c_setscl()
1273 latch2 = cyber2000_grphr(EXT_LATCH2, cfb); in cyber2000fb_i2c_setscl()
1277 cyber2000_grphw(EXT_LATCH2, latch2, cfb); in cyber2000fb_i2c_setscl()
1278 spin_unlock(&cfb->reg_b0_lock); in cyber2000fb_i2c_setscl()
1283 struct cfb_info *cfb = data; in cyber2000fb_i2c_getsda() local
1286 spin_lock(&cfb->reg_b0_lock); in cyber2000fb_i2c_getsda()
1287 ret = !!(cyber2000_grphr(EXT_LATCH2, cfb) & EXT_LATCH2_I2C_DAT); in cyber2000fb_i2c_getsda()
1288 spin_unlock(&cfb->reg_b0_lock); in cyber2000fb_i2c_getsda()
1295 struct cfb_info *cfb = data; in cyber2000fb_i2c_getscl() local
1298 spin_lock(&cfb->reg_b0_lock); in cyber2000fb_i2c_getscl()
1299 ret = !!(cyber2000_grphr(EXT_LATCH2, cfb) & EXT_LATCH2_I2C_CLK); in cyber2000fb_i2c_getscl()
1300 spin_unlock(&cfb->reg_b0_lock); in cyber2000fb_i2c_getscl()
1305 static int cyber2000fb_i2c_register(struct cfb_info *cfb) in cyber2000fb_i2c_register() argument
1307 strscpy(cfb->i2c_adapter.name, cfb->fb.fix.id, in cyber2000fb_i2c_register()
1308 sizeof(cfb->i2c_adapter.name)); in cyber2000fb_i2c_register()
1309 cfb->i2c_adapter.owner = THIS_MODULE; in cyber2000fb_i2c_register()
1310 cfb->i2c_adapter.algo_data = &cfb->i2c_algo; in cyber2000fb_i2c_register()
1311 cfb->i2c_adapter.dev.parent = cfb->fb.device; in cyber2000fb_i2c_register()
1312 cfb->i2c_algo.setsda = cyber2000fb_i2c_setsda; in cyber2000fb_i2c_register()
1313 cfb->i2c_algo.setscl = cyber2000fb_i2c_setscl; in cyber2000fb_i2c_register()
1314 cfb->i2c_algo.getsda = cyber2000fb_i2c_getsda; in cyber2000fb_i2c_register()
1315 cfb->i2c_algo.getscl = cyber2000fb_i2c_getscl; in cyber2000fb_i2c_register()
1316 cfb->i2c_algo.udelay = 5; in cyber2000fb_i2c_register()
1317 cfb->i2c_algo.timeout = msecs_to_jiffies(100); in cyber2000fb_i2c_register()
1318 cfb->i2c_algo.data = cfb; in cyber2000fb_i2c_register()
1320 return i2c_bit_add_bus(&cfb->i2c_adapter); in cyber2000fb_i2c_register()
1323 static void cyber2000fb_i2c_unregister(struct cfb_info *cfb) in cyber2000fb_i2c_unregister() argument
1325 i2c_del_adapter(&cfb->i2c_adapter); in cyber2000fb_i2c_unregister()
1328 #define cyber2000fb_i2c_register(cfb) (0) argument
1329 #define cyber2000fb_i2c_unregister(cfb) do { } while (0) argument
1389 static void cyberpro_init_hw(struct cfb_info *cfb) in cyberpro_init_hw() argument
1394 cyber2000_grphw(igs_regs[i], igs_regs[i + 1], cfb); in cyberpro_init_hw()
1396 if (cfb->id == ID_CYBERPRO_5000) { in cyberpro_init_hw()
1398 cyber2000fb_writeb(0xba, 0x3ce, cfb); in cyberpro_init_hw()
1399 val = cyber2000fb_readb(0x3cf, cfb) & 0x80; in cyberpro_init_hw()
1400 cyber2000fb_writeb(val, 0x3cf, cfb); in cyberpro_init_hw()
1406 struct cfb_info *cfb; in cyberpro_alloc_fb_info() local
1408 cfb = kzalloc(sizeof(struct cfb_info), GFP_KERNEL); in cyberpro_alloc_fb_info()
1409 if (!cfb) in cyberpro_alloc_fb_info()
1413 cfb->id = id; in cyberpro_alloc_fb_info()
1416 cfb->ref_ps = 40690; /* 24.576 MHz */ in cyberpro_alloc_fb_info()
1418 cfb->ref_ps = 69842; /* 14.31818 MHz (69841?) */ in cyberpro_alloc_fb_info()
1420 cfb->divisors[0] = 1; in cyberpro_alloc_fb_info()
1421 cfb->divisors[1] = 2; in cyberpro_alloc_fb_info()
1422 cfb->divisors[2] = 4; in cyberpro_alloc_fb_info()
1425 cfb->divisors[3] = 8; in cyberpro_alloc_fb_info()
1427 cfb->divisors[3] = 6; in cyberpro_alloc_fb_info()
1429 strcpy(cfb->fb.fix.id, name); in cyberpro_alloc_fb_info()
1431 cfb->fb.fix.type = FB_TYPE_PACKED_PIXELS; in cyberpro_alloc_fb_info()
1432 cfb->fb.fix.type_aux = 0; in cyberpro_alloc_fb_info()
1433 cfb->fb.fix.xpanstep = 0; in cyberpro_alloc_fb_info()
1434 cfb->fb.fix.ypanstep = 1; in cyberpro_alloc_fb_info()
1435 cfb->fb.fix.ywrapstep = 0; in cyberpro_alloc_fb_info()
1439 cfb->fb.fix.accel = 0; in cyberpro_alloc_fb_info()
1443 cfb->fb.fix.accel = FB_ACCEL_IGS_CYBER2000; in cyberpro_alloc_fb_info()
1447 cfb->fb.fix.accel = FB_ACCEL_IGS_CYBER2010; in cyberpro_alloc_fb_info()
1451 cfb->fb.fix.accel = FB_ACCEL_IGS_CYBER5000; in cyberpro_alloc_fb_info()
1455 cfb->fb.var.nonstd = 0; in cyberpro_alloc_fb_info()
1456 cfb->fb.var.activate = FB_ACTIVATE_NOW; in cyberpro_alloc_fb_info()
1457 cfb->fb.var.height = -1; in cyberpro_alloc_fb_info()
1458 cfb->fb.var.width = -1; in cyberpro_alloc_fb_info()
1459 cfb->fb.var.accel_flags = FB_ACCELF_TEXT; in cyberpro_alloc_fb_info()
1461 cfb->fb.fbops = &cyber2000fb_ops; in cyberpro_alloc_fb_info()
1462 cfb->fb.flags = FBINFO_HWACCEL_YPAN; in cyberpro_alloc_fb_info()
1463 cfb->fb.pseudo_palette = cfb->pseudo_palette; in cyberpro_alloc_fb_info()
1465 spin_lock_init(&cfb->reg_b0_lock); in cyberpro_alloc_fb_info()
1467 fb_alloc_cmap(&cfb->fb.cmap, NR_PALETTE, 0); in cyberpro_alloc_fb_info()
1469 return cfb; in cyberpro_alloc_fb_info()
1472 static void cyberpro_free_fb_info(struct cfb_info *cfb) in cyberpro_free_fb_info() argument
1474 if (cfb) { in cyberpro_free_fb_info()
1478 fb_alloc_cmap(&cfb->fb.cmap, 0, 0); in cyberpro_free_fb_info()
1480 kfree(cfb); in cyberpro_free_fb_info()
1523 static int cyberpro_common_probe(struct cfb_info *cfb) in cyberpro_common_probe() argument
1529 cyberpro_init_hw(cfb); in cyberpro_common_probe()
1536 cfb->mem_ctl1 = cyber2000_grphr(EXT_MEM_CTL1, cfb); in cyberpro_common_probe()
1537 cfb->mem_ctl2 = cyber2000_grphr(EXT_MEM_CTL2, cfb); in cyberpro_common_probe()
1542 switch (cfb->mem_ctl2 & MEM_CTL2_SIZE_MASK) { in cyberpro_common_probe()
1557 cfb->fb.fix.smem_len = smem_size; in cyberpro_common_probe()
1558 cfb->fb.fix.mmio_len = MMIO_SIZE; in cyberpro_common_probe()
1559 cfb->fb.screen_base = cfb->region; in cyberpro_common_probe()
1562 if (cyber2000fb_setup_ddc_bus(cfb) == 0) in cyberpro_common_probe()
1563 cfb->ddc_registered = true; in cyberpro_common_probe()
1567 if (!fb_find_mode(&cfb->fb.var, &cfb->fb, NULL, NULL, 0, in cyberpro_common_probe()
1569 printk(KERN_ERR "%s: no valid mode found\n", cfb->fb.fix.id); in cyberpro_common_probe()
1573 cfb->fb.var.yres_virtual = cfb->fb.fix.smem_len * 8 / in cyberpro_common_probe()
1574 (cfb->fb.var.bits_per_pixel * cfb->fb.var.xres_virtual); in cyberpro_common_probe()
1576 if (cfb->fb.var.yres_virtual < cfb->fb.var.yres) in cyberpro_common_probe()
1577 cfb->fb.var.yres_virtual = cfb->fb.var.yres; in cyberpro_common_probe()
1587 h_sync = 1953125000 / cfb->fb.var.pixclock; in cyberpro_common_probe()
1588 h_sync = h_sync * 512 / (cfb->fb.var.xres + cfb->fb.var.left_margin + in cyberpro_common_probe()
1589 cfb->fb.var.right_margin + cfb->fb.var.hsync_len); in cyberpro_common_probe()
1590 v_sync = h_sync / (cfb->fb.var.yres + cfb->fb.var.upper_margin + in cyberpro_common_probe()
1591 cfb->fb.var.lower_margin + cfb->fb.var.vsync_len); in cyberpro_common_probe()
1594 cfb->fb.fix.id, cfb->fb.fix.smem_len >> 10, in cyberpro_common_probe()
1595 cfb->fb.var.xres, cfb->fb.var.yres, in cyberpro_common_probe()
1598 err = cyber2000fb_i2c_register(cfb); in cyberpro_common_probe()
1602 err = register_framebuffer(&cfb->fb); in cyberpro_common_probe()
1604 cyber2000fb_i2c_unregister(cfb); in cyberpro_common_probe()
1608 if (err && cfb->ddc_registered) in cyberpro_common_probe()
1609 i2c_del_adapter(&cfb->ddc_adapter); in cyberpro_common_probe()
1614 static void cyberpro_common_remove(struct cfb_info *cfb) in cyberpro_common_remove() argument
1616 unregister_framebuffer(&cfb->fb); in cyberpro_common_remove()
1618 if (cfb->ddc_registered) in cyberpro_common_remove()
1619 i2c_del_adapter(&cfb->ddc_adapter); in cyberpro_common_remove()
1621 cyber2000fb_i2c_unregister(cfb); in cyberpro_common_remove()
1624 static void cyberpro_common_resume(struct cfb_info *cfb) in cyberpro_common_resume() argument
1626 cyberpro_init_hw(cfb); in cyberpro_common_resume()
1631 cyber2000_grphw(EXT_MEM_CTL1, cfb->mem_ctl1, cfb); in cyberpro_common_resume()
1632 cyber2000_grphw(EXT_MEM_CTL2, cfb->mem_ctl2, cfb); in cyberpro_common_resume()
1638 cyber2000fb_set_par(&cfb->fb); in cyberpro_common_resume()
1651 static int cyberpro_pci_enable_mmio(struct cfb_info *cfb) in cyberpro_pci_enable_mmio() argument
1693 if (cfb->id == ID_CYBERPRO_2010) { in cyberpro_pci_enable_mmio()
1695 cfb->fb.fix.id); in cyberpro_pci_enable_mmio()
1697 val = cyber2000_grphr(EXT_BUS_CTL, cfb); in cyberpro_pci_enable_mmio()
1700 cfb->fb.fix.id); in cyberpro_pci_enable_mmio()
1704 if (cfb->id == ID_CYBERPRO_5000) in cyberpro_pci_enable_mmio()
1707 cyber2000_grphw(EXT_BUS_CTL, val, cfb); in cyberpro_pci_enable_mmio()
1717 struct cfb_info *cfb; in cyberpro_pci_probe() local
1732 cfb = cyberpro_alloc_fb_info(id->driver_data, name); in cyberpro_pci_probe()
1733 if (!cfb) in cyberpro_pci_probe()
1736 err = pci_request_regions(dev, cfb->fb.fix.id); in cyberpro_pci_probe()
1740 cfb->irq = dev->irq; in cyberpro_pci_probe()
1741 cfb->region = pci_ioremap_bar(dev, 0); in cyberpro_pci_probe()
1742 if (!cfb->region) { in cyberpro_pci_probe()
1747 cfb->regs = cfb->region + MMIO_OFFSET; in cyberpro_pci_probe()
1748 cfb->fb.device = &dev->dev; in cyberpro_pci_probe()
1749 cfb->fb.fix.mmio_start = pci_resource_start(dev, 0) + MMIO_OFFSET; in cyberpro_pci_probe()
1750 cfb->fb.fix.smem_start = pci_resource_start(dev, 0); in cyberpro_pci_probe()
1758 err = cyberpro_pci_enable_mmio(cfb); in cyberpro_pci_probe()
1765 cfb->mclk_mult = cyber2000_grphr(EXT_MCLK_MULT, cfb); in cyberpro_pci_probe()
1766 cfb->mclk_div = cyber2000_grphr(EXT_MCLK_DIV, cfb); in cyberpro_pci_probe()
1773 cfb->mclk_mult = 0xdb; in cyberpro_pci_probe()
1774 cfb->mclk_div = 0x54; in cyberpro_pci_probe()
1778 err = cyberpro_common_probe(cfb); in cyberpro_pci_probe()
1785 pci_set_drvdata(dev, cfb); in cyberpro_pci_probe()
1787 int_cfb_info = cfb; in cyberpro_pci_probe()
1792 iounmap(cfb->region); in cyberpro_pci_probe()
1796 cyberpro_free_fb_info(cfb); in cyberpro_pci_probe()
1804 struct cfb_info *cfb = pci_get_drvdata(dev); in cyberpro_pci_remove() local
1806 if (cfb) { in cyberpro_pci_remove()
1807 cyberpro_common_remove(cfb); in cyberpro_pci_remove()
1808 iounmap(cfb->region); in cyberpro_pci_remove()
1809 cyberpro_free_fb_info(cfb); in cyberpro_pci_remove()
1811 if (cfb == int_cfb_info) in cyberpro_pci_remove()
1829 struct cfb_info *cfb = dev_get_drvdata(dev); in cyberpro_pci_resume() local
1831 if (cfb) { in cyberpro_pci_resume()
1832 cyberpro_pci_enable_mmio(cfb); in cyberpro_pci_resume()
1833 cyberpro_common_resume(cfb); in cyberpro_pci_resume()