1 /* SPDX-License-Identifier: GPL-2.0 */
5 #define FB_ACCEL_SMI 0xab
7 #define MHZ(x) ((x) * 1000000)
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)
16 sm750_24TFT = 0, /* 24bit tft */
17 sm750_dualTFT = 2, /* dual 18 bit tft */
18 sm750_doubleTFT = 1, /* 36 bit double pixel tft */
21 /* vga channel is not concerned */
23 sm750_simul_pri, /* primary => all head */
24 sm750_simul_sec, /* secondary => all head */
25 sm750_dual_normal, /* primary => panel head and secondary => crt */
26 sm750_dual_swap, /* primary => crt head and secondary => panel */
31 /* enum value equal to the register filed data */
38 sm750_pnc = 3, /* panel and crt */
43 /* below three clocks are in unit of MHZ*/
52 /* base virtual address of DPR registers */
53 volatile unsigned char __iomem *dprBase;
54 /* base virtual address of de data port */
55 volatile unsigned char __iomem *dpPortBase;
57 /* function pointers */
58 void (*de_init)(struct lynx_accel *accel);
60 int (*de_wait)(void);/* see if hardware ready to work */
62 int (*de_fillrect)(struct lynx_accel *accel,
63 u32 base, u32 pitch, u32 bpp,
64 u32 x, u32 y, u32 width, u32 height,
67 int (*de_copyarea)(struct lynx_accel *accel,
68 u32 s_base, u32 s_pitch,
70 u32 d_base, u32 d_pitch,
71 u32 bpp, u32 dx, u32 dy,
72 u32 width, u32 height,
75 int (*de_imageblit)(struct lynx_accel *accel, const char *p_srcbuf,
76 u32 src_delta, u32 start_bit, u32 d_base, u32 d_pitch,
77 u32 byte_per_pixel, u32 dx, u32 dy, u32 width,
78 u32 height, u32 f_color, u32 b_color, u32 rop2);
87 struct fb_info *fbinfo[2];
88 struct lynx_accel accel;
95 /* all smi graphic adaptor got below attributes */
96 unsigned long vidmem_start;
97 unsigned long vidreg_start;
101 unsigned char __iomem *pvMem;
105 struct init_status initParm;
106 enum sm750_pnltype pnltype;
107 enum sm750_dataflow dataflow;
111 * 0: no hardware cursor
112 * 1: primary crtc hw cursor enabled,
113 * 2: secondary crtc hw cursor enabled
114 * 3: both ctrc hw cursor enabled
120 /* cursor width ,height and size */
124 /* hardware limitation */
127 /* base virtual address and offset of cursor image */
128 char __iomem *vstart;
130 /* mmio addr of hw cursor */
131 volatile char __iomem *mmio;
135 unsigned char __iomem *v_cursor; /* virtual address of cursor */
136 unsigned char __iomem *v_screen; /* virtual address of on_screen */
137 int o_cursor; /* cursor address offset in vidmem */
138 int o_screen; /* onscreen address offset in vidmem */
139 int channel;/* which channel this crtc stands for*/
140 resource_size_t vidmem_size;/* this view's video memory max size */
142 /* below attributes belong to info->fix, their value depends on specific adaptor*/
143 u16 line_pad;/* padding information:0,1,2,4,8,16,... */
150 /* cursor information */
151 struct lynx_cursor cursor;
154 struct lynxfb_output {
158 * which paths(s) this output stands for,for sm750:
159 * paths=1:means output for panel paths
160 * paths=2:means output for crt paths
161 * paths=3:means output for both panel and crt paths
166 * which channel these outputs linked with,for sm750:
167 * *channel=0 means primary channel
168 * *channel=1 means secondary channel
169 * output->channel ==> &crtc->channel
173 int (*proc_setBLANK)(struct lynxfb_output *output, int blank);
177 /* either 0 or 1 for dual head adaptor,0 is the older one registered */
179 unsigned int pseudo_palette[256];
180 struct lynxfb_crtc crtc;
181 struct lynxfb_output output;
182 struct fb_info *info;
183 struct sm750_dev *dev;
186 static inline unsigned long ps_to_hz(unsigned int psvalue)
188 unsigned long long numerator = 1000 * 1000 * 1000 * 1000ULL;
189 /* 10^12 / picosecond period gives frequency in Hz */
190 do_div(numerator, psvalue);
191 return (unsigned long)numerator;
194 int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev);
195 int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct pci_dev *pdev);
196 void hw_sm750_initAccel(struct sm750_dev *sm750_dev);
197 int hw_sm750_deWait(void);
198 int hw_sm750le_deWait(void);
200 int hw_sm750_output_setMode(struct lynxfb_output *output,
201 struct fb_var_screeninfo *var,
202 struct fb_fix_screeninfo *fix);
204 int hw_sm750_crtc_checkMode(struct lynxfb_crtc *crtc,
205 struct fb_var_screeninfo *var);
207 int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc,
208 struct fb_var_screeninfo *var,
209 struct fb_fix_screeninfo *fix);
211 int hw_sm750_setColReg(struct lynxfb_crtc *crtc, ushort index,
212 ushort red, ushort green, ushort blue);
214 int hw_sm750_setBLANK(struct lynxfb_output *output, int blank);
215 int hw_sm750le_setBLANK(struct lynxfb_output *output, int blank);
216 int hw_sm750_pan_display(struct lynxfb_crtc *crtc,
217 const struct fb_var_screeninfo *var,
218 const struct fb_info *info);