📄 radeonfb.h
字号:
unsigned long video_ram; unsigned long mapped_vram; int vram_width; int vram_ddr; int pitch, bpp, depth; int has_CRTC2; int is_mobility; int is_IGP; int reversed_DAC; int reversed_TMDS; struct panel_info panel_info; int mon1_type; u8 *mon1_EDID; struct fb_videomode *mon1_modedb; int mon1_dbsize; int mon2_type; u8 *mon2_EDID; u32 dp_gui_master_cntl; struct pll_info pll; int mtrr_hdl; int pm_reg; u32 save_regs[100]; int asleep; int lock_blank; int dynclk; int no_schedule; enum radeon_pm_mode pm_mode; reinit_function_ptr reinit_func; /* Lock on register access */ spinlock_t reg_lock; /* Timer used for delayed LVDS operations */ struct timer_list lvds_timer; u32 pending_lvds_gen_cntl;#ifdef CONFIG_FB_RADEON_I2C struct radeon_i2c_chan i2c[4];#endif};#define PRIMARY_MONITOR(rinfo) (rinfo->mon1_type)/* * IO macros *//* Note about this function: we have some rare cases where we must not schedule, * this typically happen with our special "wake up early" hook which allows us to * wake up the graphic chip (and thus get the console back) before everything else * on some machines that support that mechanism. At this point, interrupts are off * and scheduling is not permitted */static inline void _radeon_msleep(struct radeonfb_info *rinfo, unsigned long ms){ if (rinfo->no_schedule || oops_in_progress) mdelay(ms); else msleep(ms);}#define INREG8(addr) readb((rinfo->mmio_base)+addr)#define OUTREG8(addr,val) writeb(val, (rinfo->mmio_base)+addr)#define INREG16(addr) readw((rinfo->mmio_base)+addr)#define OUTREG16(addr,val) writew(val, (rinfo->mmio_base)+addr)#define INREG(addr) readl((rinfo->mmio_base)+addr)#define OUTREG(addr,val) writel(val, (rinfo->mmio_base)+addr)static inline void _OUTREGP(struct radeonfb_info *rinfo, u32 addr, u32 val, u32 mask){ unsigned long flags; unsigned int tmp; spin_lock_irqsave(&rinfo->reg_lock, flags); tmp = INREG(addr); tmp &= (mask); tmp |= (val); OUTREG(addr, tmp); spin_unlock_irqrestore(&rinfo->reg_lock, flags);}#define OUTREGP(addr,val,mask) _OUTREGP(rinfo, addr, val,mask)/* * Note about PLL register accesses: * * I have removed the spinlock on them on purpose. The driver now * expects that it will only manipulate the PLL registers in normal * task environment, where radeon_msleep() will be called, protected * by a semaphore (currently the console semaphore) so that no conflict * will happen on the PLL register index. * * With the latest changes to the VT layer, this is guaranteed for all * calls except the actual drawing/blits which aren't supposed to use * the PLL registers anyway * * This is very important for the workarounds to work properly. The only * possible exception to this rule is the call to unblank(), which may * be done at irq time if an oops is in progress. */static inline void radeon_pll_errata_after_index(struct radeonfb_info *rinfo){ if (!(rinfo->errata & CHIP_ERRATA_PLL_DUMMYREADS)) return; (void)INREG(CLOCK_CNTL_DATA); (void)INREG(CRTC_GEN_CNTL);}static inline void radeon_pll_errata_after_data(struct radeonfb_info *rinfo){ if (rinfo->errata & CHIP_ERRATA_PLL_DELAY) { /* we can't deal with posted writes here ... */ _radeon_msleep(rinfo, 5); } if (rinfo->errata & CHIP_ERRATA_R300_CG) { u32 save, tmp; save = INREG(CLOCK_CNTL_INDEX); tmp = save & ~(0x3f | PLL_WR_EN); OUTREG(CLOCK_CNTL_INDEX, tmp); tmp = INREG(CLOCK_CNTL_DATA); OUTREG(CLOCK_CNTL_INDEX, save); }}static inline u32 __INPLL(struct radeonfb_info *rinfo, u32 addr){ u32 data; OUTREG8(CLOCK_CNTL_INDEX, addr & 0x0000003f); radeon_pll_errata_after_index(rinfo); data = INREG(CLOCK_CNTL_DATA); radeon_pll_errata_after_data(rinfo); return data;}static inline void __OUTPLL(struct radeonfb_info *rinfo, unsigned int index, u32 val){ OUTREG8(CLOCK_CNTL_INDEX, (index & 0x0000003f) | 0x00000080); radeon_pll_errata_after_index(rinfo); OUTREG(CLOCK_CNTL_DATA, val); radeon_pll_errata_after_data(rinfo);}static inline void __OUTPLLP(struct radeonfb_info *rinfo, unsigned int index, u32 val, u32 mask){ unsigned int tmp; tmp = __INPLL(rinfo, index); tmp &= (mask); tmp |= (val); __OUTPLL(rinfo, index, tmp);}#define INPLL(addr) __INPLL(rinfo, addr)#define OUTPLL(index, val) __OUTPLL(rinfo, index, val)#define OUTPLLP(index, val, mask) __OUTPLLP(rinfo, index, val, mask)#define BIOS_IN8(v) (readb(rinfo->bios_seg + (v)))#define BIOS_IN16(v) (readb(rinfo->bios_seg + (v)) | \ (readb(rinfo->bios_seg + (v) + 1) << 8))#define BIOS_IN32(v) (readb(rinfo->bios_seg + (v)) | \ (readb(rinfo->bios_seg + (v) + 1) << 8) | \ (readb(rinfo->bios_seg + (v) + 2) << 16) | \ (readb(rinfo->bios_seg + (v) + 3) << 24))/* * Inline utilities */static inline int round_div(int num, int den){ return (num + (den / 2)) / den;}static inline int var_to_depth(const struct fb_var_screeninfo *var){ if (var->bits_per_pixel != 16) return var->bits_per_pixel; return (var->green.length == 5) ? 15 : 16;}static inline u32 radeon_get_dstbpp(u16 depth){ switch (depth) { case 8: return DST_8BPP; case 15: return DST_15BPP; case 16: return DST_16BPP; case 32: return DST_32BPP; default: return 0; }}/* * 2D Engine helper routines */static inline void _radeon_fifo_wait(struct radeonfb_info *rinfo, int entries){ int i; for (i=0; i<2000000; i++) { if ((INREG(RBBM_STATUS) & 0x7f) >= entries) return; udelay(1); } printk(KERN_ERR "radeonfb: FIFO Timeout !\n");}static inline void radeon_engine_flush (struct radeonfb_info *rinfo){ int i; /* Initiate flush */ OUTREGP(DSTCACHE_CTLSTAT, RB2D_DC_FLUSH_ALL, ~RB2D_DC_FLUSH_ALL); /* Ensure FIFO is empty, ie, make sure the flush commands * has reached the cache */ _radeon_fifo_wait (rinfo, 64); /* Wait for the flush to complete */ for (i=0; i < 2000000; i++) { if (!(INREG(DSTCACHE_CTLSTAT) & RB2D_DC_BUSY)) return; udelay(1); } printk(KERN_ERR "radeonfb: Flush Timeout !\n");}static inline void _radeon_engine_idle(struct radeonfb_info *rinfo){ int i; /* ensure FIFO is empty before waiting for idle */ _radeon_fifo_wait (rinfo, 64); for (i=0; i<2000000; i++) { if (((INREG(RBBM_STATUS) & GUI_ACTIVE)) == 0) { radeon_engine_flush (rinfo); return; } udelay(1); } printk(KERN_ERR "radeonfb: Idle Timeout !\n");}#define radeon_engine_idle() _radeon_engine_idle(rinfo)#define radeon_fifo_wait(entries) _radeon_fifo_wait(rinfo,entries)#define radeon_msleep(ms) _radeon_msleep(rinfo,ms)/* I2C Functions */extern void radeon_create_i2c_busses(struct radeonfb_info *rinfo);extern void radeon_delete_i2c_busses(struct radeonfb_info *rinfo);extern int radeon_probe_i2c_connector(struct radeonfb_info *rinfo, int conn, u8 **out_edid);/* PM Functions */extern int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t state);extern int radeonfb_pci_resume(struct pci_dev *pdev);extern void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk, int ignore_devlist, int force_sleep);extern void radeonfb_pm_exit(struct radeonfb_info *rinfo);/* Monitor probe functions */extern void radeon_probe_screens(struct radeonfb_info *rinfo, const char *monitor_layout, int ignore_edid);extern void radeon_check_modes(struct radeonfb_info *rinfo, const char *mode_option);extern int radeon_match_mode(struct radeonfb_info *rinfo, struct fb_var_screeninfo *dest, const struct fb_var_screeninfo *src);/* Accel functions */extern void radeonfb_fillrect(struct fb_info *info, const struct fb_fillrect *region);extern void radeonfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);extern void radeonfb_imageblit(struct fb_info *p, const struct fb_image *image);extern int radeonfb_sync(struct fb_info *info);extern void radeonfb_engine_init (struct radeonfb_info *rinfo);extern void radeonfb_engine_reset(struct radeonfb_info *rinfo);/* Other functions */extern int radeon_screen_blank(struct radeonfb_info *rinfo, int blank, int mode_switch);extern void radeon_write_mode (struct radeonfb_info *rinfo, struct radeon_regs *mode, int reg_only);/* Backlight functions */#ifdef CONFIG_FB_RADEON_BACKLIGHTextern void radeonfb_bl_init(struct radeonfb_info *rinfo);extern void radeonfb_bl_exit(struct radeonfb_info *rinfo);#elsestatic inline void radeonfb_bl_init(struct radeonfb_info *rinfo) {}static inline void radeonfb_bl_exit(struct radeonfb_info *rinfo) {}#endif#endif /* __RADEONFB_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -