From b4b7ff4b08e691656c9d77c758fc355833128ac0 Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Wed, 20 Jan 2016 14:01:31 -0300 Subject: Linux-libre 4.4-gnu --- drivers/staging/sm750fb/sm750.h | 134 +++++++++++++++++++++++----------------- 1 file changed, 77 insertions(+), 57 deletions(-) (limited to 'drivers/staging/sm750fb/sm750.h') diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h index 5bc445571..b0a93cdc7 100644 --- a/drivers/staging/sm750fb/sm750.h +++ b/drivers/staging/sm750fb/sm750.h @@ -1,18 +1,51 @@ #ifndef LYNXDRV_H_ #define LYNXDRV_H_ - - #define FB_ACCEL_SMI 0xab -/* please use revision id to distinguish sm750le and sm750*/ -#define SPC_SM750 0 -#define MB(x) ((x)<<20) #define MHZ(x) ((x) * 1000000) -/* align should be 2,4,8,16 */ -#define PADDING(align, data) (((data)+(align)-1)&(~((align) - 1))) -extern int smi_indent; +#define DEFAULT_SM750_CHIP_CLOCK 290 +#define DEFAULT_SM750LE_CHIP_CLOCK 333 +#ifndef SM750LE_REVISION_ID +#define SM750LE_REVISION_ID ((unsigned char)0xfe) +#endif + +enum sm750_pnltype { + sm750_24TFT = 0, /* 24bit tft */ + sm750_dualTFT = 2, /* dual 18 bit tft */ + sm750_doubleTFT = 1, /* 36 bit double pixel tft */ +}; + +/* vga channel is not concerned */ +enum sm750_dataflow { + sm750_simul_pri, /* primary => all head */ + sm750_simul_sec, /* secondary => all head */ + sm750_dual_normal, /* primary => panel head and secondary => crt */ + sm750_dual_swap, /* primary => crt head and secondary => panel */ +}; + +enum sm750_channel { + sm750_primary = 0, + /* enum value equal to the register filed data */ + sm750_secondary = 1, +}; + +enum sm750_path { + sm750_panel = 1, + sm750_crt = 2, + sm750_pnc = 3, /* panel and crt */ +}; + +struct init_status { + ushort powerMode; + /* below three clocks are in unit of MHZ*/ + ushort chip_clk; + ushort mem_clk; + ushort master_clk; + ushort setAllEngOff; + ushort resetMemory; +}; struct lynx_accel { /* base virtual address of DPR registers */ @@ -38,10 +71,7 @@ struct lynx_accel { }; -/* lynx_share stands for a presentation of two frame buffer - that use one smi adaptor , it is similar to a basic class of C++ -*/ -struct lynx_share { +struct sm750_dev { /* common members */ u16 devid; u8 revid; @@ -50,10 +80,10 @@ struct lynx_share { struct lynx_accel accel; int accel_off; int dual; - int mtrr_off; - struct{ - int vram; - } mtrr; + int mtrr_off; + struct{ + int vram; + } mtrr; /* all smi graphic adaptor got below attributes */ unsigned long vidmem_start; unsigned long vidreg_start; @@ -63,9 +93,19 @@ struct lynx_share { unsigned char __iomem *pvMem; /* locks*/ spinlock_t slock; - /* function pointers */ - void (*suspend)(struct lynx_share *); - void (*resume)(struct lynx_share *); + + struct init_status initParm; + enum sm750_pnltype pnltype; + enum sm750_dataflow dataflow; + int nocrt; + + /* + * 0: no hardware cursor + * 1: primary crtc hw cursor enabled, + * 2: secondary crtc hw cursor enabled + * 3: both ctrc hw cursor enabled + */ + int hwCursor; }; struct lynx_cursor { @@ -81,15 +121,6 @@ struct lynx_cursor { int offset; /* mmio addr of hw cursor */ volatile char __iomem *mmio; - /* the lynx_share of this adaptor */ - struct lynx_share *share; - /* proc_routines */ - void (*enable)(struct lynx_cursor *); - void (*disable)(struct lynx_cursor *); - void (*setSize)(struct lynx_cursor *, int, int); - void (*setPos)(struct lynx_cursor *, int, int); - void (*setColor)(struct lynx_cursor *, u32, u32); - void (*setData)(struct lynx_cursor *, u16, const u8*, const u8*); }; struct lynxfb_crtc { @@ -108,17 +139,6 @@ struct lynxfb_crtc { void *priv; - int (*proc_setMode)(struct lynxfb_crtc*, - struct fb_var_screeninfo*, - struct fb_fix_screeninfo*); - - int (*proc_checkMode)(struct lynxfb_crtc*, struct fb_var_screeninfo*); - int (*proc_setColReg)(struct lynxfb_crtc*, ushort, ushort, ushort, ushort); - void (*clear)(struct lynxfb_crtc *); - /* pan display */ - int (*proc_panDisplay)(struct lynxfb_crtc *, - const struct fb_var_screeninfo *, - const struct fb_info *); /* cursor information */ struct lynx_cursor cursor; }; @@ -140,13 +160,7 @@ struct lynxfb_output { */ void *priv; - int (*proc_setMode)(struct lynxfb_output*, - struct fb_var_screeninfo*, - struct fb_fix_screeninfo*); - - int (*proc_checkMode)(struct lynxfb_output*, struct fb_var_screeninfo*); int (*proc_setBLANK)(struct lynxfb_output*, int); - void (*clear)(struct lynxfb_output *); }; struct lynxfb_par { @@ -156,20 +170,9 @@ struct lynxfb_par { struct lynxfb_crtc crtc; struct lynxfb_output output; struct fb_info *info; - struct lynx_share *share; + struct sm750_dev *dev; }; -#ifndef offsetof -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#endif - - -#define PS_TO_HZ(ps) \ - ({ \ - unsigned long long hz = 1000*1000*1000*1000ULL; \ - do_div(hz, ps); \ - (unsigned long)hz; }) - static inline unsigned long ps_to_hz(unsigned int psvalue) { unsigned long long numerator = 1000*1000*1000*1000ULL; @@ -178,5 +181,22 @@ static inline unsigned long ps_to_hz(unsigned int psvalue) return (unsigned long)numerator; } +int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev); +int hw_sm750_inithw(struct sm750_dev*, struct pci_dev *); +void hw_sm750_initAccel(struct sm750_dev *); +int hw_sm750_deWait(void); +int hw_sm750le_deWait(void); + +int hw_sm750_output_setMode(struct lynxfb_output*, struct fb_var_screeninfo*, + struct fb_fix_screeninfo*); +int hw_sm750_crtc_checkMode(struct lynxfb_crtc*, struct fb_var_screeninfo*); +int hw_sm750_crtc_setMode(struct lynxfb_crtc*, struct fb_var_screeninfo*, + struct fb_fix_screeninfo*); +int hw_sm750_setColReg(struct lynxfb_crtc*, ushort, ushort, ushort, ushort); +int hw_sm750_setBLANK(struct lynxfb_output*, int); +int hw_sm750le_setBLANK(struct lynxfb_output*, int); +int hw_sm750_pan_display(struct lynxfb_crtc *crtc, + const struct fb_var_screeninfo *var, + const struct fb_info *info); #endif -- cgit v1.2.3-54-g00ecf