xref: /linux/drivers/video/fbdev/i810/i810_main.h (revision 3932b9ca55b0be314a36d3e84faff3e823c081f5)
1 /*-*- linux-c -*-
2  *  linux/drivers/video/i810fb_main.h -- Intel 810 frame buffer device
3  *                                       main header file
4  *
5  *      Copyright (C) 2001 Antonino Daplas<adaplas@pol.net>
6  *      All Rights Reserved
7  *
8  *
9  *  This file is subject to the terms and conditions of the GNU General Public
10  *  License. See the file COPYING in the main directory of this archive for
11  *  more details.
12  */
13 
14 #ifndef __I810_MAIN_H__
15 #define __I810_MAIN_H__
16 
17 /* Video Timings */
18 extern void round_off_xres         (u32 *xres);
19 extern void round_off_yres         (u32 *xres, u32 *yres);
20 extern u32 i810_get_watermark      (const struct fb_var_screeninfo *var,
21 			            struct i810fb_par *par);
22 extern void i810fb_encode_registers(const struct fb_var_screeninfo *var,
23 				    struct i810fb_par *par, u32 xres, u32 yres);
24 extern void i810fb_fill_var_timings(struct fb_var_screeninfo *var);
25 
26 /* Accelerated Functions */
27 extern void i810fb_fillrect (struct fb_info *p,
28 			     const struct fb_fillrect *rect);
29 extern void i810fb_copyarea (struct fb_info *p,
30 			     const struct fb_copyarea *region);
31 extern void i810fb_imageblit(struct fb_info *p, const struct fb_image *image);
32 extern int  i810fb_sync     (struct fb_info *p);
33 
34 extern void i810fb_init_ringbuffer(struct fb_info *info);
35 extern void i810fb_load_front     (u32 offset, struct fb_info *info);
36 
37 #ifdef CONFIG_FB_I810_I2C
38 /* I2C */
39 extern int i810_probe_i2c_connector(struct fb_info *info, u8 **out_edid,
40 				    int conn);
41 extern void i810_create_i2c_busses(struct i810fb_par *par);
42 extern void i810_delete_i2c_busses(struct i810fb_par *par);
43 #else
44 static inline int i810_probe_i2c_connector(struct fb_info *info, u8 **out_edid,
45 				    int conn)
46 {
47 	return 1;
48 }
49 static inline void i810_create_i2c_busses(struct i810fb_par *par) { }
50 static inline void i810_delete_i2c_busses(struct i810fb_par *par) { }
51 #endif
52 
53 /* Conditionals */
54 #ifdef CONFIG_X86
55 static inline void flush_cache(void)
56 {
57 	asm volatile ("wbinvd":::"memory");
58 }
59 #else
60 #define flush_cache() do { } while(0)
61 #endif
62 
63 #ifdef CONFIG_MTRR
64 
65 #include <asm/mtrr.h>
66 
67 static inline void set_mtrr(struct i810fb_par *par)
68 {
69 	par->mtrr_reg = mtrr_add((u32) par->aperture.physical,
70 		 par->aperture.size, MTRR_TYPE_WRCOMB, 1);
71 	if (par->mtrr_reg < 0) {
72 		printk(KERN_ERR "set_mtrr: unable to set MTRR\n");
73 		return;
74 	}
75 	par->dev_flags |= HAS_MTRR;
76 }
77 static inline void unset_mtrr(struct i810fb_par *par)
78 {
79   	if (par->dev_flags & HAS_MTRR)
80   		mtrr_del(par->mtrr_reg, (u32) par->aperture.physical,
81 			 par->aperture.size);
82 }
83 #else
84 #define set_mtrr(x) printk("set_mtrr: MTRR is disabled in the kernel\n")
85 
86 #define unset_mtrr(x) do { } while (0)
87 #endif /* CONFIG_MTRR */
88 
89 #ifdef CONFIG_FB_I810_GTF
90 #define IS_DVT (0)
91 #else
92 #define IS_DVT (1)
93 #endif
94 
95 #endif /* __I810_MAIN_H__ */
96