1
2#ifndef LYNXDRV_H_
3#define LYNXDRV_H_
4
5#define FB_ACCEL_SMI 0xab
6
7#define MHZ(x) ((x) * 1000000)
8
9#define DEFAULT_SM750_CHIP_CLOCK 290
10#define DEFAULT_SM750LE_CHIP_CLOCK 333
11#ifndef SM750LE_REVISION_ID
12#define SM750LE_REVISION_ID ((unsigned char)0xfe)
13#endif
14
15enum sm750_pnltype {
16 sm750_24TFT = 0,
17 sm750_dualTFT = 2,
18 sm750_doubleTFT = 1,
19};
20
21
22enum sm750_dataflow {
23 sm750_simul_pri,
24 sm750_simul_sec,
25 sm750_dual_normal,
26 sm750_dual_swap,
27};
28
29enum sm750_channel {
30 sm750_primary = 0,
31
32 sm750_secondary = 1,
33};
34
35enum sm750_path {
36 sm750_panel = 1,
37 sm750_crt = 2,
38 sm750_pnc = 3,
39};
40
41struct init_status {
42 ushort powerMode;
43
44 ushort chip_clk;
45 ushort mem_clk;
46 ushort master_clk;
47 ushort setAllEngOff;
48 ushort resetMemory;
49};
50
51struct lynx_accel {
52
53 volatile unsigned char __iomem *dprBase;
54
55 volatile unsigned char __iomem *dpPortBase;
56
57
58 void (*de_init)(struct lynx_accel *);
59
60 int (*de_wait)(void);
61
62 int (*de_fillrect)(struct lynx_accel *,
63 u32, u32, u32, u32,
64 u32, u32, u32, u32, u32);
65
66 int (*de_copyarea)(struct lynx_accel *,
67 u32, u32, u32, u32,
68 u32, u32, u32, u32,
69 u32, u32, u32, u32);
70
71 int (*de_imageblit)(struct lynx_accel *, const char *,
72 u32, u32, u32, u32,
73 u32, u32, u32, u32,
74 u32, u32, u32, u32);
75
76};
77
78struct sm750_dev {
79
80 u16 devid;
81 u8 revid;
82 struct pci_dev *pdev;
83 struct fb_info *fbinfo[2];
84 struct lynx_accel accel;
85 int accel_off;
86 int fb_count;
87 int mtrr_off;
88 struct{
89 int vram;
90 } mtrr;
91
92 unsigned long vidmem_start;
93 unsigned long vidreg_start;
94 __u32 vidmem_size;
95 __u32 vidreg_size;
96 void __iomem *pvReg;
97 unsigned char __iomem *pvMem;
98
99 spinlock_t slock;
100
101 struct init_status initParm;
102 enum sm750_pnltype pnltype;
103 enum sm750_dataflow dataflow;
104 int nocrt;
105
106
107
108
109
110
111
112 int hwCursor;
113};
114
115struct lynx_cursor {
116
117 int w;
118 int h;
119 int size;
120
121 int maxW;
122 int maxH;
123
124 char __iomem *vstart;
125 int offset;
126
127 volatile char __iomem *mmio;
128};
129
130struct lynxfb_crtc {
131 unsigned char __iomem *vCursor;
132 unsigned char __iomem *vScreen;
133 int oCursor;
134 int oScreen;
135 int channel;
136 resource_size_t vidmem_size;
137
138
139 u16 line_pad;
140 u16 xpanstep;
141 u16 ypanstep;
142 u16 ywrapstep;
143
144 void *priv;
145
146
147 struct lynx_cursor cursor;
148};
149
150struct lynxfb_output {
151 int dpms;
152 int paths;
153
154
155
156
157
158
159
160 int *channel;
161
162
163
164
165
166
167 void *priv;
168
169 int (*proc_setBLANK)(struct lynxfb_output *output, int blank);
170};
171
172struct lynxfb_par {
173
174 int index;
175 unsigned int pseudo_palette[256];
176 struct lynxfb_crtc crtc;
177 struct lynxfb_output output;
178 struct fb_info *info;
179 struct sm750_dev *dev;
180};
181
182static inline unsigned long ps_to_hz(unsigned int psvalue)
183{
184 unsigned long long numerator = 1000 * 1000 * 1000 * 1000ULL;
185
186 do_div(numerator, psvalue);
187 return (unsigned long)numerator;
188}
189
190int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev);
191int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct pci_dev *pdev);
192void hw_sm750_initAccel(struct sm750_dev *sm750_dev);
193int hw_sm750_deWait(void);
194int hw_sm750le_deWait(void);
195
196int hw_sm750_output_setMode(struct lynxfb_output *output,
197 struct fb_var_screeninfo *var,
198 struct fb_fix_screeninfo *fix);
199
200int hw_sm750_crtc_checkMode(struct lynxfb_crtc *crtc,
201 struct fb_var_screeninfo *var);
202
203int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc,
204 struct fb_var_screeninfo *var,
205 struct fb_fix_screeninfo *fix);
206
207int hw_sm750_setColReg(struct lynxfb_crtc *crtc, ushort index,
208 ushort red, ushort green, ushort blue);
209
210int hw_sm750_setBLANK(struct lynxfb_output *output, int blank);
211int hw_sm750le_setBLANK(struct lynxfb_output *output, int blank);
212int hw_sm750_pan_display(struct lynxfb_crtc *crtc,
213 const struct fb_var_screeninfo *var,
214 const struct fb_info *info);
215
216#endif
217