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
*);
60 int (*de_wait
)(void);/* see if hardware ready to work */
62 int (*de_fillrect
)(struct lynx_accel
*, u32
, u32
, u32
, u32
,
63 u32
, u32
, u32
, u32
, u32
);
65 int (*de_copyarea
)(struct lynx_accel
*, u32
, u32
, u32
, u32
,
69 int (*de_imageblit
)(struct lynx_accel
*, const char *, u32
, u32
, u32
, u32
,
80 struct fb_info
*fbinfo
[2];
81 struct lynx_accel accel
;
88 /* all smi graphic adaptor got below attributes */
89 unsigned long vidmem_start
;
90 unsigned long vidreg_start
;
94 unsigned char __iomem
*pvMem
;
98 struct init_status initParm
;
99 enum sm750_pnltype pnltype
;
100 enum sm750_dataflow dataflow
;
104 * 0: no hardware cursor
105 * 1: primary crtc hw cursor enabled,
106 * 2: secondary crtc hw cursor enabled
107 * 3: both ctrc hw cursor enabled
113 /* cursor width ,height and size */
117 /* hardware limitation */
120 /* base virtual address and offset of cursor image */
121 char __iomem
*vstart
;
123 /* mmio addr of hw cursor */
124 volatile char __iomem
*mmio
;
128 unsigned char __iomem
*vCursor
; /* virtual address of cursor */
129 unsigned char __iomem
*vScreen
; /* virtual address of on_screen */
130 int oCursor
; /* cursor address offset in vidmem */
131 int oScreen
; /* onscreen address offset in vidmem */
132 int channel
;/* which channel this crtc stands for*/
133 resource_size_t vidmem_size
;/* this view's video memory max size */
135 /* below attributes belong to info->fix, their value depends on specific adaptor*/
136 u16 line_pad
;/* padding information:0,1,2,4,8,16,... */
143 /* cursor information */
144 struct lynx_cursor cursor
;
147 struct lynxfb_output
{
151 * which paths(s) this output stands for,for sm750:
152 * paths=1:means output for panel paths
153 * paths=2:means output for crt paths
154 * paths=3:means output for both panel and crt paths
159 * which channel these outputs linked with,for sm750:
160 * *channel=0 means primary channel
161 * *channel=1 means secondary channel
162 * output->channel ==> &crtc->channel
166 int (*proc_setBLANK
)(struct lynxfb_output
*, int);
170 /* either 0 or 1 for dual head adaptor,0 is the older one registered */
172 unsigned int pseudo_palette
[256];
173 struct lynxfb_crtc crtc
;
174 struct lynxfb_output output
;
175 struct fb_info
*info
;
176 struct sm750_dev
*dev
;
179 static inline unsigned long ps_to_hz(unsigned int psvalue
)
181 unsigned long long numerator
= 1000 * 1000 * 1000 * 1000ULL;
182 /* 10^12 / picosecond period gives frequency in Hz */
183 do_div(numerator
, psvalue
);
184 return (unsigned long)numerator
;
187 int hw_sm750_map(struct sm750_dev
*sm750_dev
, struct pci_dev
*pdev
);
188 int hw_sm750_inithw(struct sm750_dev
*sm750_dev
, struct pci_dev
*pdev
);
189 void hw_sm750_initAccel(struct sm750_dev
*sm750_dev
);
190 int hw_sm750_deWait(void);
191 int hw_sm750le_deWait(void);
193 int hw_sm750_output_setMode(struct lynxfb_output
*output
,
194 struct fb_var_screeninfo
*var
,
195 struct fb_fix_screeninfo
*fix
);
197 int hw_sm750_crtc_checkMode(struct lynxfb_crtc
*crtc
,
198 struct fb_var_screeninfo
*var
);
200 int hw_sm750_crtc_setMode(struct lynxfb_crtc
*crtc
,
201 struct fb_var_screeninfo
*var
,
202 struct fb_fix_screeninfo
*fix
);
204 int hw_sm750_setColReg(struct lynxfb_crtc
*crtc
, ushort index
,
205 ushort red
, ushort green
, ushort blue
);
207 int hw_sm750_setBLANK(struct lynxfb_output
*output
, int blank
);
208 int hw_sm750le_setBLANK(struct lynxfb_output
*output
, int blank
);
209 int hw_sm750_pan_display(struct lynxfb_crtc
*crtc
,
210 const struct fb_var_screeninfo
*var
,
211 const struct fb_info
*info
);