1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 
5 #ifndef COMP_FB_H
6 #define COMP_FB_H
7 
8 #include <stdint.h>
9 #include <stddef.h>
10 
11 #define FB_BACKLIGHT_LEVELS    128
12 #define FB_BACKLIGHT_MAX    0xFF
13 
14 #ifdef CONFIG_64BIT
15 #define BITS_PER_LONG 64
16 #else
17 #define BITS_PER_LONG 32
18 #endif /* CONFIG_64BIT */
19 
20 #define FB_SYNC    0x0001
21 #define FB_ASYNC   0x0010
22 
23 // show normally
24 #define FB_ROTATE_UR    0
25 // rotate 90 degrees clockwise
26 #define FB_ROTATE_CW    1
27 // upside down
28 #define FB_ROTATE_UD    2
29 // rotate 90 degrees counterclockwise
30 #define FB_ROTATE_CCW    3
31 
32 
33 #define BYTES_PER_LONG (BITS_PER_LONG / 8)
34 #define PADDING (BYTES_PER_LONG - (sizeof(fb_info_t) % BYTES_PER_LONG))
35 
36 #define FBIOGET_VSCREENINFO    0x4600
37 #define FBIOPUT_VSCREENINFO    0x4601
38 #define FBIOGET_FSCREENINFO    0x4602
39 #define FBIOGET_FRRAMEBUFFER   0x4603
40 
41 #define FBIOGETCMAP        0x4604
42 #define FBIOPUTCMAP        0x4605
43 #define FBIOPAN_DISPLAY        0x4606
44 #define FBIO_WAITFORVSYNC    0x4607
45 #define FBIOPUT_PREFB_ADDR    0x4608
46 
47 #define FBIOBLANK        0x4611
48 
49 /*brightness ioctl*/
50 #define FBIOPUT_BRIGHTNESS 0x4612
51 #define FBIOGET_BRIGHTNESS 0x4613
52 #define FBIOENABLE_BACKLIGHT 0x4614
53 #define FBIODISABLE_BACKLIGHT 0x4615
54 
55 typedef struct _fb_fix_screeninfo_t {
56     char id[16];         /* Identification string */
57     uint64_t smem_start;    /* Start of frame buffer mem */
58                     /* (physical address) */
59     uint32_t smem_len;            /* Length of frame buffer mem */
60     uint16_t xpanstep;   /* zero if no hardware panning  */
61     uint16_t ypanstep;   /* zero if no hardware panning  */
62     uint16_t ywrapstep;  /* zero if no hardware ywrap    */
63     uint32_t line_length;
64     uint64_t mmio_start;  /* Start of Memory Mapped I/O   */
65                                /* (physical address) */
66     size_t mmio_len;           /* Length of Memory Mapped I/O  */
67     uint16_t reserved[15];
68 } fb_fix_screeninfo_t;
69 
70 typedef struct _fb_bitfield_t {
71     uint32_t offset;
72     uint32_t length;
73     uint32_t msb_right;
74 } fb_bitfield_t;
75 
76 typedef struct _fb_var_screeninfo_t {
77     uint32_t xres;        /* visible resolution */
78     uint32_t yres;
79     uint32_t xres_virtual;    /* virtual resolution */
80     uint32_t yres_virtual;
81     uint32_t xoffset;        /* offset from virtual to visible */
82     uint32_t yoffset;
83     uint32_t bits_per_pixel;
84     fb_bitfield_t red;    /* bitfield in fb mem if true color */
85     fb_bitfield_t green;
86     fb_bitfield_t blue;
87     fb_bitfield_t transp;    /* transparency */
88 
89     uint32_t height;            /* height of picture in mm    */
90     uint32_t width;            /* width of picture in mm     */
91 
92     uint32_t rotate;            /* angle we rotate counter clockwise */
93     uint16_t reserved[10];
94 } fb_var_screeninfo_t;
95 
96 #endif /* COMP_FB_H */
97