1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __MBX_FB_H
3 #define __MBX_FB_H
4 
5 #include <asm/ioctl.h>
6 #include <asm/types.h>
7 
8 struct mbxfb_val {
9 	unsigned int	defval;
10 	unsigned int	min;
11 	unsigned int	max;
12 };
13 
14 struct fb_info;
15 
16 struct mbxfb_platform_data {
17 		/* Screen info */
18 		struct mbxfb_val xres;
19 		struct mbxfb_val yres;
20 		struct mbxfb_val bpp;
21 
22 		/* Memory info */
23 		unsigned long memsize; /* if 0 use ODFB? */
24 		unsigned long timings1;
25 		unsigned long timings2;
26 		unsigned long timings3;
27 
28 		int (*probe)(struct fb_info *fb);
29 		int (*remove)(struct fb_info *fb);
30 };
31 
32 /* planar */
33 #define MBXFB_FMT_YUV16		0
34 #define MBXFB_FMT_YUV12		1
35 
36 /* packed */
37 #define MBXFB_FMT_UY0VY1	2
38 #define MBXFB_FMT_VY0UY1	3
39 #define MBXFB_FMT_Y0UY1V	4
40 #define MBXFB_FMT_Y0VY1U	5
41 struct mbxfb_overlaySetup {
42 	__u32 enable;
43 	__u32 x, y;
44 	__u32 width, height;
45 	__u32 fmt;
46 	__u32 mem_offset;
47 	__u32 scaled_width;
48 	__u32 scaled_height;
49 
50 	/* Filled by the driver */
51 	__u32 U_offset;
52 	__u32 V_offset;
53 
54 	__u16 Y_stride;
55 	__u16 UV_stride;
56 };
57 
58 #define MBXFB_ALPHABLEND_NONE		0
59 #define MBXFB_ALPHABLEND_GLOBAL		1
60 #define MBXFB_ALPHABLEND_PIXEL		2
61 
62 #define MBXFB_COLORKEY_DISABLED		0
63 #define MBXFB_COLORKEY_PREVIOUS		1
64 #define MBXFB_COLORKEY_CURRENT		2
65 struct mbxfb_alphaCtl {
66 	__u8 overlay_blend_mode;
67 	__u8 overlay_colorkey_mode;
68 	__u8 overlay_global_alpha;
69 	__u32 overlay_colorkey;
70 	__u32 overlay_colorkey_mask;
71 
72 	__u8 graphics_blend_mode;
73 	__u8 graphics_colorkey_mode;
74 	__u8 graphics_global_alpha;
75 	__u32 graphics_colorkey;
76 	__u32 graphics_colorkey_mask;
77 };
78 
79 #define MBXFB_PLANE_GRAPHICS	0
80 #define MBXFB_PLANE_VIDEO	1
81 struct mbxfb_planeorder {
82 	__u8 bottom;
83 	__u8 top;
84 };
85 
86 struct mbxfb_reg {
87 	__u32 addr; 	/* offset from 0x03fe 0000 */
88 	__u32 val;		/* value */
89 	__u32 mask;		/* which bits to touch (for write) */
90 };
91 
92 #define MBXFB_IOCX_OVERLAY		_IOWR(0xF4, 0x00,struct mbxfb_overlaySetup)
93 #define MBXFB_IOCG_ALPHA		_IOR(0xF4, 0x01,struct mbxfb_alphaCtl)
94 #define MBXFB_IOCS_ALPHA		_IOW(0xF4, 0x02,struct mbxfb_alphaCtl)
95 #define MBXFB_IOCS_PLANEORDER	_IOR(0xF4, 0x03,struct mbxfb_planeorder)
96 #define MBXFB_IOCS_REG			_IOW(0xF4, 0x04,struct mbxfb_reg)
97 #define MBXFB_IOCX_REG			_IOWR(0xF4, 0x05,struct mbxfb_reg)
98 
99 #endif /* __MBX_FB_H */
100