]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/sm750fb/sm750.h
Staging: sm750fb: sm750_accel.c: Insert spaces after commas.
[karo-tx-linux.git] / drivers / staging / sm750fb / sm750.h
1 #ifndef LYNXDRV_H_
2 #define LYNXDRV_H_
3
4
5
6 #define FB_ACCEL_SMI 0xab
7 /* please use revision id to distinguish sm750le and sm750*/
8 #define SPC_SM750       0
9
10 //#define SPC_SM750LE 8
11
12 #define MB(x) ((x)<<20)
13 #define MHZ(x) ((x) * 1000000)
14 /* align should be 2,4,8,16 */
15 #define PADDING(align, data) (((data)+(align)-1)&(~((align) -1)))
16 extern int smi_indent;
17
18
19 struct lynx_accel{
20         /* base virtual address of DPR registers */
21         volatile unsigned char __iomem * dprBase;
22         /* base virtual address of de data port */
23         volatile unsigned char __iomem * dpPortBase;
24
25         /* function fointers */
26         void (*de_init)(struct lynx_accel *);
27
28         int (*de_wait)(void);/* see if hardware ready to work */
29
30         int (*de_fillrect)(struct lynx_accel *, u32, u32, u32, u32,
31                                                 u32, u32, u32, u32, u32);
32
33         int (*de_copyarea)(struct lynx_accel *, u32, u32, u32, u32,
34                                                 u32, u32, u32, u32,
35                                                 u32, u32, u32, u32);
36
37         int (*de_imageblit)(struct lynx_accel *, const char *, u32, u32, u32, u32,
38                                                                u32, u32, u32, u32,
39                                                                u32, u32, u32, u32);
40
41 };
42
43 /*      lynx_share stands for a presentation of two frame buffer
44         that use one smi adaptor , it is similar to a basic class of C++
45 */
46 struct lynx_share{
47         /* common members */
48         u16 devid;
49         u8 revid;
50         struct pci_dev * pdev;
51         struct fb_info * fbinfo[2];
52         struct lynx_accel accel;
53         int accel_off;
54         int dual;
55                 int mtrr_off;
56                 struct{
57                         int vram;
58                 }mtrr;
59         /* all smi graphic adaptor got below attributes */
60         unsigned long vidmem_start;
61         unsigned long vidreg_start;
62         __u32 vidmem_size;
63         __u32 vidreg_size;
64         void __iomem * pvReg;
65         unsigned char __iomem * pvMem;
66         /* locks*/
67         spinlock_t slock;
68         /* function pointers */
69         void (*suspend)(struct lynx_share*);
70         void (*resume)(struct lynx_share*);
71 };
72
73 struct lynx_cursor{
74         /* cursor width ,height and size */
75         int w;
76         int h;
77         int size;
78         /* hardware limitation */
79         int maxW;
80         int maxH;
81         /* base virtual address and offset  of cursor image */
82         char __iomem * vstart;
83         int offset;
84         /* mmio addr of hw cursor */
85         volatile char __iomem * mmio;
86         /* the lynx_share of this adaptor */
87         struct lynx_share * share;
88         /* proc_routines */
89         void (*enable)(struct lynx_cursor *);
90         void (*disable)(struct lynx_cursor *);
91         void (*setSize)(struct lynx_cursor *, int, int);
92         void (*setPos)(struct lynx_cursor *, int, int);
93         void (*setColor)(struct lynx_cursor *, u32, u32);
94         void (*setData)(struct lynx_cursor *, u16, const u8*, const u8*);
95 };
96
97 struct lynxfb_crtc{
98         unsigned char __iomem * vCursor;//virtual address of cursor
99         unsigned char __iomem * vScreen;//virtual address of on_screen
100         int oCursor;//cursor address offset in vidmem
101         int oScreen;//onscreen address offset in vidmem
102         int channel;/* which channel this crtc stands for*/
103         resource_size_t vidmem_size;/* this view's video memory max size */
104
105         /* below attributes belong to info->fix, their value depends on specific adaptor*/
106         u16 line_pad;/* padding information:0,1,2,4,8,16,... */
107         u16 xpanstep;
108         u16 ypanstep;
109         u16 ywrapstep;
110
111         void * priv;
112
113         int(*proc_setMode)(struct lynxfb_crtc*,
114                                                 struct fb_var_screeninfo*,
115                                                 struct fb_fix_screeninfo*);
116
117         int(*proc_checkMode)(struct lynxfb_crtc*, struct fb_var_screeninfo*);
118         int(*proc_setColReg)(struct lynxfb_crtc*, ushort, ushort, ushort, ushort);
119         void (*clear)(struct lynxfb_crtc*);
120         /* pan display */
121         int (*proc_panDisplay)(struct lynxfb_crtc *,
122                                const struct fb_var_screeninfo *,
123                                const struct fb_info *);
124         /* cursor information */
125         struct lynx_cursor cursor;
126 };
127
128 struct lynxfb_output{
129         int dpms;
130         int paths;
131         /*      which paths(s) this output stands for,for sm750:
132                 paths=1:means output for panel paths
133                 paths=2:means output for crt paths
134                 paths=3:means output for both panel and crt paths
135         */
136
137         int * channel;
138         /*      which channel these outputs linked with,for sm750:
139                 *channel=0 means primary channel
140                 *channel=1 means secondary channel
141                 output->channel ==> &crtc->channel
142         */
143         void * priv;
144
145         int(*proc_setMode)(struct lynxfb_output*,
146                                                 struct fb_var_screeninfo*,
147                                                 struct fb_fix_screeninfo*);
148
149         int(*proc_checkMode)(struct lynxfb_output*, struct fb_var_screeninfo*);
150         int(*proc_setBLANK)(struct lynxfb_output*, int);
151         void  (*clear)(struct lynxfb_output*);
152 };
153
154 struct lynxfb_par{
155         /* either 0 or 1 for dual head adaptor,0 is the older one registered */
156         int index;
157         unsigned int pseudo_palette[256];
158         struct lynxfb_crtc crtc;
159         struct lynxfb_output output;
160         struct fb_info * info;
161         struct lynx_share * share;
162 };
163
164 #ifndef offsetof
165 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
166 #endif
167
168
169 #define PS_TO_HZ(ps)    \
170                         ({      \
171                         unsigned long long hz = 1000*1000*1000*1000ULL; \
172                         do_div(hz, ps); \
173                         (unsigned long)hz;})
174
175 static inline unsigned long ps_to_hz(unsigned int psvalue)
176 {
177         unsigned long long numerator=1000*1000*1000*1000ULL;
178         /* 10^12 / picosecond period gives frequency in Hz */
179         do_div(numerator, psvalue);
180         return (unsigned long)numerator;
181 }
182
183
184 #endif