Commit | Line | Data |
---|---|---|
81dee67e SM |
1 | #ifndef LYNXDRV_H_ |
2 | #define LYNXDRV_H_ | |
3 | ||
81dee67e | 4 | #define FB_ACCEL_SMI 0xab |
81dee67e | 5 | |
81dee67e | 6 | #define MHZ(x) ((x) * 1000000) |
81dee67e | 7 | |
05407e15 MR |
8 | #define DEFAULT_SM750_CHIP_CLOCK 290 |
9 | #define DEFAULT_SM750LE_CHIP_CLOCK 333 | |
10 | #ifndef SM750LE_REVISION_ID | |
11 | #define SM750LE_REVISION_ID ((unsigned char)0xfe) | |
12 | #endif | |
13 | ||
14 | enum sm750_pnltype { | |
15 | sm750_24TFT = 0, /* 24bit tft */ | |
16 | sm750_dualTFT = 2, /* dual 18 bit tft */ | |
17 | sm750_doubleTFT = 1, /* 36 bit double pixel tft */ | |
18 | }; | |
19 | ||
20 | /* vga channel is not concerned */ | |
21 | enum sm750_dataflow { | |
22 | sm750_simul_pri, /* primary => all head */ | |
23 | sm750_simul_sec, /* secondary => all head */ | |
24 | sm750_dual_normal, /* primary => panel head and secondary => crt */ | |
25 | sm750_dual_swap, /* primary => crt head and secondary => panel */ | |
26 | }; | |
27 | ||
28 | enum sm750_channel { | |
29 | sm750_primary = 0, | |
30 | /* enum value equal to the register filed data */ | |
31 | sm750_secondary = 1, | |
32 | }; | |
33 | ||
34 | enum sm750_path { | |
35 | sm750_panel = 1, | |
36 | sm750_crt = 2, | |
37 | sm750_pnc = 3, /* panel and crt */ | |
38 | }; | |
39 | ||
40 | struct init_status { | |
41 | ushort powerMode; | |
42 | /* below three clocks are in unit of MHZ*/ | |
43 | ushort chip_clk; | |
44 | ushort mem_clk; | |
45 | ushort master_clk; | |
46 | ushort setAllEngOff; | |
47 | ushort resetMemory; | |
48 | }; | |
49 | ||
5d14c13a | 50 | struct lynx_accel { |
81dee67e | 51 | /* base virtual address of DPR registers */ |
cc6c16df | 52 | volatile unsigned char __iomem *dprBase; |
81dee67e | 53 | /* base virtual address of de data port */ |
cc6c16df | 54 | volatile unsigned char __iomem *dpPortBase; |
81dee67e | 55 | |
fbb8c963 | 56 | /* function pointers */ |
bf2fbc2a | 57 | void (*de_init)(struct lynx_accel *); |
81dee67e SM |
58 | |
59 | int (*de_wait)(void);/* see if hardware ready to work */ | |
60 | ||
e8b976da IA |
61 | int (*de_fillrect)(struct lynx_accel *, u32, u32, u32, u32, |
62 | u32, u32, u32, u32, u32); | |
81dee67e | 63 | |
e8b976da IA |
64 | int (*de_copyarea)(struct lynx_accel *, u32, u32, u32, u32, |
65 | u32, u32, u32, u32, | |
66 | u32, u32, u32, u32); | |
81dee67e | 67 | |
e8b976da IA |
68 | int (*de_imageblit)(struct lynx_accel *, const char *, u32, u32, u32, u32, |
69 | u32, u32, u32, u32, | |
70 | u32, u32, u32, u32); | |
81dee67e SM |
71 | |
72 | }; | |
73 | ||
e359b6a8 | 74 | struct sm750_dev { |
81dee67e SM |
75 | /* common members */ |
76 | u16 devid; | |
77 | u8 revid; | |
eb0f4271 GD |
78 | struct pci_dev *pdev; |
79 | struct fb_info *fbinfo[2]; | |
81dee67e SM |
80 | struct lynx_accel accel; |
81 | int accel_off; | |
a3f92cc9 | 82 | int fb_count; |
e359b6a8 MR |
83 | int mtrr_off; |
84 | struct{ | |
85 | int vram; | |
86 | } mtrr; | |
81dee67e | 87 | /* all smi graphic adaptor got below attributes */ |
e936351a SM |
88 | unsigned long vidmem_start; |
89 | unsigned long vidreg_start; | |
90 | __u32 vidmem_size; | |
91 | __u32 vidreg_size; | |
eb0f4271 GD |
92 | void __iomem *pvReg; |
93 | unsigned char __iomem *pvMem; | |
81dee67e SM |
94 | /* locks*/ |
95 | spinlock_t slock; | |
1757d106 MR |
96 | |
97 | struct init_status initParm; | |
98 | enum sm750_pnltype pnltype; | |
99 | enum sm750_dataflow dataflow; | |
100 | int nocrt; | |
05407e15 MR |
101 | |
102 | /* | |
103 | * 0: no hardware cursor | |
104 | * 1: primary crtc hw cursor enabled, | |
105 | * 2: secondary crtc hw cursor enabled | |
106 | * 3: both ctrc hw cursor enabled | |
107 | */ | |
108 | int hwCursor; | |
109 | }; | |
110 | ||
5d14c13a | 111 | struct lynx_cursor { |
81dee67e SM |
112 | /* cursor width ,height and size */ |
113 | int w; | |
114 | int h; | |
115 | int size; | |
116 | /* hardware limitation */ | |
117 | int maxW; | |
118 | int maxH; | |
119 | /* base virtual address and offset of cursor image */ | |
eb0f4271 | 120 | char __iomem *vstart; |
81dee67e SM |
121 | int offset; |
122 | /* mmio addr of hw cursor */ | |
cc6c16df | 123 | volatile char __iomem *mmio; |
81dee67e SM |
124 | }; |
125 | ||
5d14c13a | 126 | struct lynxfb_crtc { |
eb0f4271 GD |
127 | unsigned char __iomem *vCursor; /* virtual address of cursor */ |
128 | unsigned char __iomem *vScreen; /* virtual address of on_screen */ | |
5ee35ea7 JL |
129 | int oCursor; /* cursor address offset in vidmem */ |
130 | int oScreen; /* onscreen address offset in vidmem */ | |
81dee67e SM |
131 | int channel;/* which channel this crtc stands for*/ |
132 | resource_size_t vidmem_size;/* this view's video memory max size */ | |
133 | ||
134 | /* below attributes belong to info->fix, their value depends on specific adaptor*/ | |
135 | u16 line_pad;/* padding information:0,1,2,4,8,16,... */ | |
136 | u16 xpanstep; | |
137 | u16 ypanstep; | |
138 | u16 ywrapstep; | |
139 | ||
eb0f4271 | 140 | void *priv; |
81dee67e | 141 | |
81dee67e SM |
142 | /* cursor information */ |
143 | struct lynx_cursor cursor; | |
144 | }; | |
145 | ||
5d14c13a | 146 | struct lynxfb_output { |
81dee67e SM |
147 | int dpms; |
148 | int paths; | |
f5016082 ES |
149 | /* |
150 | * which paths(s) this output stands for,for sm750: | |
35e4d8ca EF |
151 | * paths=1:means output for panel paths |
152 | * paths=2:means output for crt paths | |
153 | * paths=3:means output for both panel and crt paths | |
154 | */ | |
81dee67e | 155 | |
eb0f4271 | 156 | int *channel; |
f5016082 ES |
157 | /* |
158 | * which channel these outputs linked with,for sm750: | |
35e4d8ca EF |
159 | * *channel=0 means primary channel |
160 | * *channel=1 means secondary channel | |
161 | * output->channel ==> &crtc->channel | |
162 | */ | |
eb0f4271 | 163 | void *priv; |
81dee67e | 164 | |
f7d8b69a | 165 | int (*proc_setBLANK)(struct lynxfb_output*, int); |
81dee67e SM |
166 | }; |
167 | ||
5d14c13a | 168 | struct lynxfb_par { |
81dee67e SM |
169 | /* either 0 or 1 for dual head adaptor,0 is the older one registered */ |
170 | int index; | |
171 | unsigned int pseudo_palette[256]; | |
172 | struct lynxfb_crtc crtc; | |
173 | struct lynxfb_output output; | |
eb0f4271 | 174 | struct fb_info *info; |
f11fa2a9 | 175 | struct sm750_dev *dev; |
81dee67e SM |
176 | }; |
177 | ||
81dee67e SM |
178 | static inline unsigned long ps_to_hz(unsigned int psvalue) |
179 | { | |
dca633d4 | 180 | unsigned long long numerator = 1000 * 1000 * 1000 * 1000ULL; |
81dee67e SM |
181 | /* 10^12 / picosecond period gives frequency in Hz */ |
182 | do_div(numerator, psvalue); | |
183 | return (unsigned long)numerator; | |
184 | } | |
185 | ||
700591a9 | 186 | int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev); |
d228cf87 AS |
187 | int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct pci_dev *pdev); |
188 | void hw_sm750_initAccel(struct sm750_dev *sm750_dev); | |
05407e15 MR |
189 | int hw_sm750_deWait(void); |
190 | int hw_sm750le_deWait(void); | |
191 | ||
3fa4b5e5 DR |
192 | int hw_sm750_output_setMode(struct lynxfb_output *output, |
193 | struct fb_var_screeninfo *var, | |
194 | struct fb_fix_screeninfo *fix); | |
195 | ||
196 | int hw_sm750_crtc_checkMode(struct lynxfb_crtc *crtc, | |
197 | struct fb_var_screeninfo *var); | |
198 | ||
199 | int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc, | |
200 | struct fb_var_screeninfo *var, | |
201 | struct fb_fix_screeninfo *fix); | |
202 | ||
203 | int hw_sm750_setColReg(struct lynxfb_crtc *crtc, ushort index, | |
204 | ushort red, ushort green, ushort blue); | |
205 | ||
206 | int hw_sm750_setBLANK(struct lynxfb_output *output, int blank); | |
207 | int hw_sm750le_setBLANK(struct lynxfb_output *output, int blank); | |
05407e15 MR |
208 | int hw_sm750_pan_display(struct lynxfb_crtc *crtc, |
209 | const struct fb_var_screeninfo *var, | |
210 | const struct fb_info *info); | |
81dee67e SM |
211 | |
212 | #endif |