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