Lines Matching refs:par

177 static inline u8 vga_inb(struct tdfx_par *par, u32 reg)  in vga_inb()  argument
179 return inb(par->iobase + reg - 0x300); in vga_inb()
182 static inline void vga_outb(struct tdfx_par *par, u32 reg, u8 val) in vga_outb() argument
184 outb(val, par->iobase + reg - 0x300); in vga_outb()
187 static inline void gra_outb(struct tdfx_par *par, u32 idx, u8 val) in gra_outb() argument
189 vga_outb(par, GRA_I, idx); in gra_outb()
191 vga_outb(par, GRA_D, val); in gra_outb()
195 static inline void seq_outb(struct tdfx_par *par, u32 idx, u8 val) in seq_outb() argument
197 vga_outb(par, SEQ_I, idx); in seq_outb()
199 vga_outb(par, SEQ_D, val); in seq_outb()
203 static inline u8 seq_inb(struct tdfx_par *par, u32 idx) in seq_inb() argument
205 vga_outb(par, SEQ_I, idx); in seq_inb()
207 return vga_inb(par, SEQ_D); in seq_inb()
210 static inline void crt_outb(struct tdfx_par *par, u32 idx, u8 val) in crt_outb() argument
212 vga_outb(par, CRT_I, idx); in crt_outb()
214 vga_outb(par, CRT_D, val); in crt_outb()
218 static inline u8 crt_inb(struct tdfx_par *par, u32 idx) in crt_inb() argument
220 vga_outb(par, CRT_I, idx); in crt_inb()
222 return vga_inb(par, CRT_D); in crt_inb()
225 static inline void att_outb(struct tdfx_par *par, u32 idx, u8 val) in att_outb() argument
229 tmp = vga_inb(par, IS1_R); in att_outb()
230 vga_outb(par, ATT_IW, idx); in att_outb()
231 vga_outb(par, ATT_IW, val); in att_outb()
234 static inline void vga_disable_video(struct tdfx_par *par) in vga_disable_video() argument
238 s = seq_inb(par, 0x01) | 0x20; in vga_disable_video()
239 seq_outb(par, 0x00, 0x01); in vga_disable_video()
240 seq_outb(par, 0x01, s); in vga_disable_video()
241 seq_outb(par, 0x00, 0x03); in vga_disable_video()
244 static inline void vga_enable_video(struct tdfx_par *par) in vga_enable_video() argument
248 s = seq_inb(par, 0x01) & 0xdf; in vga_enable_video()
249 seq_outb(par, 0x00, 0x01); in vga_enable_video()
250 seq_outb(par, 0x01, s); in vga_enable_video()
251 seq_outb(par, 0x00, 0x03); in vga_enable_video()
254 static inline void vga_enable_palette(struct tdfx_par *par) in vga_enable_palette() argument
256 vga_inb(par, IS1_R); in vga_enable_palette()
258 vga_outb(par, ATT_IW, 0x20); in vga_enable_palette()
261 static inline u32 tdfx_inl(struct tdfx_par *par, unsigned int reg) in tdfx_inl() argument
263 return readl(par->regbase_virt + reg); in tdfx_inl()
266 static inline void tdfx_outl(struct tdfx_par *par, unsigned int reg, u32 val) in tdfx_outl() argument
268 writel(val, par->regbase_virt + reg); in tdfx_outl()
271 static inline void banshee_make_room(struct tdfx_par *par, int size) in banshee_make_room() argument
275 while ((tdfx_inl(par, STATUS) & 0x1f) < size - 1) in banshee_make_room()
281 struct tdfx_par *par = info->par; in banshee_wait_idle() local
284 banshee_make_room(par, 1); in banshee_wait_idle()
285 tdfx_outl(par, COMMAND_3D, COMMAND_3D_NOP); in banshee_wait_idle()
288 if ((tdfx_inl(par, STATUS) & STATUS_BUSY) == 0) in banshee_wait_idle()
298 static inline void do_setpalentry(struct tdfx_par *par, unsigned regno, u32 c) in do_setpalentry() argument
300 banshee_make_room(par, 2); in do_setpalentry()
301 tdfx_outl(par, DACADDR, regno); in do_setpalentry()
303 tdfx_inl(par, DACADDR); in do_setpalentry()
304 tdfx_outl(par, DACDATA, c); in do_setpalentry()
358 struct tdfx_par *par = info->par; in do_write_regs() local
363 tdfx_outl(par, MISCINIT1, tdfx_inl(par, MISCINIT1) | 0x01); in do_write_regs()
365 crt_outb(par, 0x11, crt_inb(par, 0x11) & 0x7f); /* CRT unprotect */ in do_write_regs()
367 banshee_make_room(par, 3); in do_write_regs()
368 tdfx_outl(par, VGAINIT1, reg->vgainit1 & 0x001FFFFF); in do_write_regs()
369 tdfx_outl(par, VIDPROCCFG, reg->vidcfg & ~0x00000001); in do_write_regs()
371 tdfx_outl(par, PLLCTRL1, reg->mempll); in do_write_regs()
372 tdfx_outl(par, PLLCTRL2, reg->gfxpll); in do_write_regs()
374 tdfx_outl(par, PLLCTRL0, reg->vidpll); in do_write_regs()
376 vga_outb(par, MISC_W, reg->misc[0x00] | 0x01); in do_write_regs()
379 seq_outb(par, i, reg->seq[i]); in do_write_regs()
382 crt_outb(par, i, reg->crt[i]); in do_write_regs()
385 gra_outb(par, i, reg->gra[i]); in do_write_regs()
388 att_outb(par, i, reg->att[i]); in do_write_regs()
390 crt_outb(par, 0x1a, reg->ext[0]); in do_write_regs()
391 crt_outb(par, 0x1b, reg->ext[1]); in do_write_regs()
393 vga_enable_palette(par); in do_write_regs()
394 vga_enable_video(par); in do_write_regs()
396 banshee_make_room(par, 9); in do_write_regs()
397 tdfx_outl(par, VGAINIT0, reg->vgainit0); in do_write_regs()
398 tdfx_outl(par, DACMODE, reg->dacmode); in do_write_regs()
399 tdfx_outl(par, VIDDESKSTRIDE, reg->stride); in do_write_regs()
400 tdfx_outl(par, HWCURPATADDR, reg->curspataddr); in do_write_regs()
402 tdfx_outl(par, VIDSCREENSIZE, reg->screensize); in do_write_regs()
403 tdfx_outl(par, VIDDESKSTART, reg->startaddr); in do_write_regs()
404 tdfx_outl(par, VIDPROCCFG, reg->vidcfg); in do_write_regs()
405 tdfx_outl(par, VGAINIT1, reg->vgainit1); in do_write_regs()
406 tdfx_outl(par, MISCINIT0, reg->miscinit0); in do_write_regs()
408 banshee_make_room(par, 8); in do_write_regs()
409 tdfx_outl(par, SRCBASE, reg->startaddr); in do_write_regs()
410 tdfx_outl(par, DSTBASE, reg->startaddr); in do_write_regs()
411 tdfx_outl(par, COMMANDEXTRA_2D, 0); in do_write_regs()
412 tdfx_outl(par, CLIP0MIN, 0); in do_write_regs()
413 tdfx_outl(par, CLIP0MAX, 0x0fff0fff); in do_write_regs()
414 tdfx_outl(par, CLIP1MIN, 0); in do_write_regs()
415 tdfx_outl(par, CLIP1MAX, 0x0fff0fff); in do_write_regs()
416 tdfx_outl(par, SRCXY, 0); in do_write_regs()
421 static unsigned long do_lfb_size(struct tdfx_par *par, unsigned short dev_id) in do_lfb_size() argument
423 u32 draminit0 = tdfx_inl(par, DRAMINIT0); in do_lfb_size()
424 u32 draminit1 = tdfx_inl(par, DRAMINIT1); in do_lfb_size()
443 miscinit1 = tdfx_inl(par, MISCINIT1); in do_lfb_size()
447 banshee_make_room(par, 1); in do_lfb_size()
448 tdfx_outl(par, MISCINIT1, miscinit1); in do_lfb_size()
456 struct tdfx_par *par = info->par; in tdfxfb_check_var() local
484 (par->max_pixclock < VOODOO3_MAX_PIXCLOCK)) { in tdfxfb_check_var()
518 if (PICOS2KHZ(var->pixclock) > par->max_pixclock) { in tdfxfb_check_var()
563 struct tdfx_par *par = info->par; in tdfxfb_set_par() local
587 if (freq > par->max_pixclock / 2) { in tdfxfb_set_par()
588 freq = freq > par->max_pixclock ? par->max_pixclock : freq; in tdfxfb_set_par()
701 reg.vgainit1 = tdfx_inl(par, VGAINIT1) & 0x1fffff; in tdfxfb_set_par()
723 reg.miscinit0 = tdfx_inl(par, MISCINIT0); in tdfxfb_set_par()
761 struct tdfx_par *par = info->par; in tdfxfb_setcolreg() local
780 do_setpalentry(par, regno, rgbcol); in tdfxfb_setcolreg()
793 par->palette[regno] = rgbcol; in tdfxfb_setcolreg()
808 struct tdfx_par *par = info->par; in tdfxfb_blank() local
810 u32 dacmode = tdfx_inl(par, DACMODE); in tdfxfb_blank()
831 banshee_make_room(par, 1); in tdfxfb_blank()
832 tdfx_outl(par, DACMODE, dacmode); in tdfxfb_blank()
834 vga_disable_video(par); in tdfxfb_blank()
836 vga_enable_video(par); in tdfxfb_blank()
846 struct tdfx_par *par = info->par; in tdfxfb_pan_display() local
852 banshee_make_room(par, 1); in tdfxfb_pan_display()
853 tdfx_outl(par, VIDDESKSTART, addr); in tdfxfb_pan_display()
865 struct tdfx_par *par = info->par; in tdfxfb_fillrect() local
889 banshee_make_room(par, 6); in tdfxfb_fillrect()
890 tdfx_outl(par, DSTFORMAT, fmt); in tdfxfb_fillrect()
892 tdfx_outl(par, COLORFORE, rect->color); in tdfxfb_fillrect()
894 tdfx_outl(par, COLORFORE, par->palette[rect->color]); in tdfxfb_fillrect()
896 tdfx_outl(par, COMMAND_2D, COMMAND_2D_FILLRECT | (tdfx_rop << 24)); in tdfxfb_fillrect()
897 tdfx_outl(par, DSTBASE, dstbase); in tdfxfb_fillrect()
898 tdfx_outl(par, DSTSIZE, rect->width | (rect->height << 16)); in tdfxfb_fillrect()
899 tdfx_outl(par, LAUNCH_2D, dx | (dy << 16)); in tdfxfb_fillrect()
908 struct tdfx_par *par = info->par; in tdfxfb_copyarea() local
951 banshee_make_room(par, 8); in tdfxfb_copyarea()
953 tdfx_outl(par, SRCFORMAT, fmt); in tdfxfb_copyarea()
954 tdfx_outl(par, DSTFORMAT, fmt); in tdfxfb_copyarea()
955 tdfx_outl(par, COMMAND_2D, blitcmd); in tdfxfb_copyarea()
956 tdfx_outl(par, DSTSIZE, area->width | (area->height << 16)); in tdfxfb_copyarea()
957 tdfx_outl(par, DSTXY, dx | (dy << 16)); in tdfxfb_copyarea()
958 tdfx_outl(par, SRCBASE, srcbase); in tdfxfb_copyarea()
959 tdfx_outl(par, DSTBASE, dstbase); in tdfxfb_copyarea()
960 tdfx_outl(par, LAUNCH_2D, sx | (sy << 16)); in tdfxfb_copyarea()
965 struct tdfx_par *par = info->par; in tdfxfb_imageblit() local
979 banshee_make_room(par, 6 + ((size + 3) >> 2)); in tdfxfb_imageblit()
987 banshee_make_room(par, 9); in tdfxfb_imageblit()
990 tdfx_outl(par, COLORFORE, image->fg_color); in tdfxfb_imageblit()
991 tdfx_outl(par, COLORBACK, image->bg_color); in tdfxfb_imageblit()
995 tdfx_outl(par, COLORFORE, in tdfxfb_imageblit()
996 par->palette[image->fg_color]); in tdfxfb_imageblit()
997 tdfx_outl(par, COLORBACK, in tdfxfb_imageblit()
998 par->palette[image->bg_color]); in tdfxfb_imageblit()
1016 tdfx_outl(par, DSTBASE, dstbase); in tdfxfb_imageblit()
1017 tdfx_outl(par, SRCXY, 0); in tdfxfb_imageblit()
1018 tdfx_outl(par, DSTXY, dx | (dy << 16)); in tdfxfb_imageblit()
1019 tdfx_outl(par, COMMAND_2D, in tdfxfb_imageblit()
1021 tdfx_outl(par, SRCFORMAT, srcfmt); in tdfxfb_imageblit()
1022 tdfx_outl(par, DSTFORMAT, dstfmt); in tdfxfb_imageblit()
1023 tdfx_outl(par, DSTSIZE, image->width | (image->height << 16)); in tdfxfb_imageblit()
1033 banshee_make_room(par, fifo_free); in tdfxfb_imageblit()
1035 tdfx_outl(par, LAUNCH_2D, *(u32 *)chardata); in tdfxfb_imageblit()
1040 banshee_make_room(par, 3); in tdfxfb_imageblit()
1045 tdfx_outl(par, LAUNCH_2D, *chardata); in tdfxfb_imageblit()
1048 tdfx_outl(par, LAUNCH_2D, *(u16 *)chardata); in tdfxfb_imageblit()
1051 tdfx_outl(par, LAUNCH_2D, in tdfxfb_imageblit()
1060 struct tdfx_par *par = info->par; in tdfxfb_cursor() local
1072 vidcfg = tdfx_inl(par, VIDPROCCFG); in tdfxfb_cursor()
1074 tdfx_outl(par, VIDPROCCFG, vidcfg | VIDCFG_HWCURSOR_ENABLE); in tdfxfb_cursor()
1076 tdfx_outl(par, VIDPROCCFG, vidcfg & ~VIDCFG_HWCURSOR_ENABLE); in tdfxfb_cursor()
1099 banshee_make_room(par, 2); in tdfxfb_cursor()
1100 tdfx_outl(par, HWCURC0, bg_color); in tdfxfb_cursor()
1101 tdfx_outl(par, HWCURC1, fg_color); in tdfxfb_cursor()
1110 banshee_make_room(par, 1); in tdfxfb_cursor()
1111 tdfx_outl(par, HWCURLOC, (y << 16) + x); in tdfxfb_cursor()
1188 struct tdfx_par *par = chan->par; in tdfxfb_i2c_setscl() local
1191 r = tdfx_inl(par, VIDSERPARPORT); in tdfxfb_i2c_setscl()
1196 tdfx_outl(par, VIDSERPARPORT, r); in tdfxfb_i2c_setscl()
1197 tdfx_inl(par, VIDSERPARPORT); /* flush posted write */ in tdfxfb_i2c_setscl()
1203 struct tdfx_par *par = chan->par; in tdfxfb_i2c_setsda() local
1206 r = tdfx_inl(par, VIDSERPARPORT); in tdfxfb_i2c_setsda()
1211 tdfx_outl(par, VIDSERPARPORT, r); in tdfxfb_i2c_setsda()
1212 tdfx_inl(par, VIDSERPARPORT); /* flush posted write */ in tdfxfb_i2c_setsda()
1222 struct tdfx_par *par = chan->par; in tdfxfb_i2c_getscl() local
1224 return (0 != (tdfx_inl(par, VIDSERPARPORT) & I2C_SCL_IN)); in tdfxfb_i2c_getscl()
1230 struct tdfx_par *par = chan->par; in tdfxfb_i2c_getsda() local
1232 return (0 != (tdfx_inl(par, VIDSERPARPORT) & I2C_SDA_IN)); in tdfxfb_i2c_getsda()
1238 struct tdfx_par *par = chan->par; in tdfxfb_ddc_setscl() local
1241 r = tdfx_inl(par, VIDSERPARPORT); in tdfxfb_ddc_setscl()
1246 tdfx_outl(par, VIDSERPARPORT, r); in tdfxfb_ddc_setscl()
1247 tdfx_inl(par, VIDSERPARPORT); /* flush posted write */ in tdfxfb_ddc_setscl()
1253 struct tdfx_par *par = chan->par; in tdfxfb_ddc_setsda() local
1256 r = tdfx_inl(par, VIDSERPARPORT); in tdfxfb_ddc_setsda()
1261 tdfx_outl(par, VIDSERPARPORT, r); in tdfxfb_ddc_setsda()
1262 tdfx_inl(par, VIDSERPARPORT); /* flush posted write */ in tdfxfb_ddc_setsda()
1268 struct tdfx_par *par = chan->par; in tdfxfb_ddc_getscl() local
1270 return (0 != (tdfx_inl(par, VIDSERPARPORT) & DDC_SCL_IN)); in tdfxfb_ddc_getscl()
1276 struct tdfx_par *par = chan->par; in tdfxfb_ddc_getsda() local
1278 return (0 != (tdfx_inl(par, VIDSERPARPORT) & DDC_SDA_IN)); in tdfxfb_ddc_getsda()
1305 chan->par = NULL; in tdfxfb_setup_ddc_bus()
1333 chan->par = NULL; in tdfxfb_setup_i2c_bus()
1340 struct tdfx_par *par = info->par; in tdfxfb_create_i2c_busses() local
1342 tdfx_outl(par, VIDINFORMAT, 0x8160); in tdfxfb_create_i2c_busses()
1343 tdfx_outl(par, VIDSERPARPORT, 0xcffc0020); in tdfxfb_create_i2c_busses()
1345 par->chan[0].par = par; in tdfxfb_create_i2c_busses()
1346 par->chan[1].par = par; in tdfxfb_create_i2c_busses()
1348 tdfxfb_setup_ddc_bus(&par->chan[0], "Voodoo3-DDC", info->dev); in tdfxfb_create_i2c_busses()
1349 tdfxfb_setup_i2c_bus(&par->chan[1], "Voodoo3-I2C", info->dev); in tdfxfb_create_i2c_busses()
1352 static void tdfxfb_delete_i2c_busses(struct tdfx_par *par) in tdfxfb_delete_i2c_busses() argument
1354 if (par->chan[0].par) in tdfxfb_delete_i2c_busses()
1355 i2c_del_adapter(&par->chan[0].adapter); in tdfxfb_delete_i2c_busses()
1356 par->chan[0].par = NULL; in tdfxfb_delete_i2c_busses()
1358 if (par->chan[1].par) in tdfxfb_delete_i2c_busses()
1359 i2c_del_adapter(&par->chan[1].adapter); in tdfxfb_delete_i2c_busses()
1360 par->chan[1].par = NULL; in tdfxfb_delete_i2c_busses()
1363 static int tdfxfb_probe_i2c_connector(struct tdfx_par *par, in tdfxfb_probe_i2c_connector() argument
1369 if (par->chan[0].par) in tdfxfb_probe_i2c_connector()
1370 edid = fb_ddc_read(&par->chan[0].adapter); in tdfxfb_probe_i2c_connector()
1409 default_par = info->par; in tdfxfb_probe()
1630 struct tdfx_par *par = info->par; in tdfxfb_remove() local
1634 tdfxfb_delete_i2c_busses(par); in tdfxfb_remove()
1636 if (par->mtrr_handle >= 0) in tdfxfb_remove()
1637 mtrr_del(par->mtrr_handle, info->fix.smem_start, in tdfxfb_remove()
1639 iounmap(par->regbase_virt); in tdfxfb_remove()