1 /* Public domain. */
2
3 #ifndef _LINUX_FB_H
4 #define _LINUX_FB_H
5
6 #include <sys/types.h>
7 #include <linux/slab.h>
8 #include <linux/notifier.h>
9 #include <linux/backlight.h>
10 #include <linux/kgdb.h>
11 #include <linux/fs.h>
12 #include <linux/i2c.h> /* via uapi/linux/fb.h */
13
14 struct fb_cmap;
15 struct fb_fillrect;
16 struct fb_copyarea;
17 struct fb_image;
18 struct fb_info;
19
20 struct apertures_struct;
21
22 struct fb_var_screeninfo {
23 int pixclock;
24 uint32_t xres;
25 uint32_t yres;
26 uint32_t width;
27 uint32_t height;
28 };
29
30 struct fb_ops {
31 int (*fb_set_par)(struct fb_info *);
32 };
33
34 struct fb_fix_screeninfo {
35 paddr_t smem_start;
36 psize_t smem_len;
37 };
38
39 struct fb_info {
40 struct fb_var_screeninfo var;
41 struct fb_fix_screeninfo fix;
42 const struct fb_ops *fbops;
43 char *screen_buffer;
44 char *screen_base;
45 bus_size_t screen_size;
46 void *par;
47 int fbcon_rotate_hint;
48 bool skip_vt_switch;
49 bool skip_panic;
50 int flags;
51 };
52
53 #define KHZ2PICOS(a) (1000000000UL/(a))
54
55 #define FB_BLANK_UNBLANK 0
56 #define FB_BLANK_NORMAL 1
57 #define FB_BLANK_HSYNC_SUSPEND 2
58 #define FB_BLANK_VSYNC_SUSPEND 3
59 #define FB_BLANK_POWERDOWN 4
60
61 #define FBINFO_STATE_RUNNING 0
62 #define FBINFO_STATE_SUSPENDED 1
63
64 #define FBINFO_VIRTFB 0x0001
65 #define FBINFO_READS_FAST 0x0002
66 #define FBINFO_HIDE_SMEM_START 0x0004
67
68 #define FB_ROTATE_UR 0
69 #define FB_ROTATE_CW 1
70 #define FB_ROTATE_UD 2
71 #define FB_ROTATE_CCW 3
72
73 #define FB_GEN_DEFAULT_DEFERRED_IOMEM_OPS(a, b, c)
74 #define FB_GEN_DEFAULT_DEFERRED_DMAMEM_OPS(a, b, c)
75 #define FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(a, b, c)
76
77 static inline struct fb_info *
framebuffer_alloc(size_t size,void * dev)78 framebuffer_alloc(size_t size, void *dev)
79 {
80 return kzalloc(sizeof(struct fb_info) + size, GFP_KERNEL);
81 }
82
83 static inline void
fb_set_suspend(struct fb_info * fbi,int s)84 fb_set_suspend(struct fb_info *fbi, int s)
85 {
86 }
87
88 static inline void
framebuffer_release(struct fb_info * fbi)89 framebuffer_release(struct fb_info *fbi)
90 {
91 kfree(fbi);
92 }
93
94 static inline int
fb_get_options(const char * name,char ** opt)95 fb_get_options(const char *name, char **opt)
96 {
97 return 0;
98 }
99
100 static inline int
register_framebuffer(struct fb_info * fbi)101 register_framebuffer(struct fb_info *fbi)
102 {
103 if (fbi->fbops && fbi->fbops->fb_set_par)
104 fbi->fbops->fb_set_par(fbi);
105 return 0;
106 }
107
108 static inline void
unregister_framebuffer(struct fb_info * fbi)109 unregister_framebuffer(struct fb_info *fbi)
110 {
111 }
112
113 static inline void
fb_deferred_io_cleanup(struct fb_info * fbi)114 fb_deferred_io_cleanup(struct fb_info *fbi)
115 {
116 }
117
118 #endif
119