1 #ifndef _MDSS_ROTATOR_H_
2 #define _MDSS_ROTATOR_H_
3 
4 #include <linux/msm_mdp_ext.h>
5 
6 #define MDSS_ROTATOR_IOCTL_MAGIC 'w'
7 
8 /* open a rotation session */
9 #define MDSS_ROTATION_OPEN \
10 	_IOWR(MDSS_ROTATOR_IOCTL_MAGIC, 1, struct mdp_rotation_config *)
11 
12 /* change the rotation session configuration */
13 #define MDSS_ROTATION_CONFIG \
14 	_IOWR(MDSS_ROTATOR_IOCTL_MAGIC, 2, struct mdp_rotation_config *)
15 
16 /* queue the rotation request */
17 #define MDSS_ROTATION_REQUEST \
18 	_IOWR(MDSS_ROTATOR_IOCTL_MAGIC, 3, struct mdp_rotation_request *)
19 
20 /* close a rotation session with the specified rotation session ID */
21 #define MDSS_ROTATION_CLOSE	_IOW(MDSS_ROTATOR_IOCTL_MAGIC, 4, unsigned int)
22 
23 /*
24  * Rotation request flag
25  */
26 /* no rotation flag, i.e. color space conversion */
27 #define MDP_ROTATION_NOP	0x01
28 
29 /* left/right flip */
30 #define MDP_ROTATION_FLIP_LR	0x02
31 
32 /* up/down flip */
33 #define MDP_ROTATION_FLIP_UD	0x04
34 
35 /* rotate 90 degree */
36 #define MDP_ROTATION_90		0x08
37 
38 /* rotate 180 degre */
39 #define MDP_ROTATION_180	(MDP_ROTATION_FLIP_LR | MDP_ROTATION_FLIP_UD)
40 
41 /* rotate 270 degree */
42 #define MDP_ROTATION_270	(MDP_ROTATION_90 | MDP_ROTATION_180)
43 
44 /* format is interlaced */
45 #define MDP_ROTATION_DEINTERLACE 0x10
46 
47 /* enable bwc */
48 #define MDP_ROTATION_BWC_EN	0x40
49 
50 /* secure data */
51 #define MDP_ROTATION_SECURE	0x80
52 
53 /*
54  * Rotation commit flag
55  */
56 /* Flag indicates to validate the rotation request */
57 #define MDSS_ROTATION_REQUEST_VALIDATE	0x01
58 
59 #define MDP_ROTATION_REQUEST_VERSION_1_0	0x00010000
60 
61 /*
62  * Client can let driver to allocate the hardware resources with
63  * this particular hw resource id.
64  */
65 #define MDSS_ROTATION_HW_ANY	0xFFFFFFFF
66 
67 /*
68  * Configuration Structures
69  */
70 struct mdp_rotation_buf_info {
71 	uint32_t width;
72 	uint32_t height;
73 	uint32_t format;
74 	struct mult_factor comp_ratio;
75 };
76 
77 struct mdp_rotation_config {
78 	uint32_t	version;
79 	uint32_t	session_id;
80 	struct mdp_rotation_buf_info	input;
81 	struct mdp_rotation_buf_info	output;
82 	uint32_t	frame_rate;
83 	uint32_t	flags;
84 	uint32_t	reserved[6];
85 };
86 
87 struct mdp_rotation_item {
88 	/* rotation request flag */
89 	uint32_t	flags;
90 
91 	/* Source crop rectangle */
92 	struct mdp_rect	src_rect;
93 
94 	/* Destination rectangle */
95 	struct mdp_rect	dst_rect;
96 
97 	/* Input buffer for the request */
98 	struct mdp_layer_buffer	input;
99 
100 	/* The output buffer for the request */
101 	struct mdp_layer_buffer	output;
102 
103 	/*
104 	 * DMA pipe selection for this request by client:
105 	 * 0: DMA pipe 0
106 	 * 1: DMA pipe 1
107 	 * or MDSS_ROTATION_HW_ANY if client wants
108 	 * driver to allocate any that is available
109 	 */
110 	uint32_t	pipe_idx;
111 
112 	/*
113 	 * Write-back block selection for this request by client:
114 	 * 0: Write-back block 0
115 	 * 1: Write-back block 1
116 	 * or MDSS_ROTATION_HW_ANY if client wants
117 	 * driver to allocate any that is available
118 	 */
119 	uint32_t	wb_idx;
120 
121 	/* Which session ID is this request scheduled on */
122 	uint32_t	session_id;
123 
124 	/* 32bits reserved value for future usage */
125 	uint32_t	reserved[6];
126 };
127 
128 struct mdp_rotation_request {
129 	/* 32bit version indicates the request structure */
130 	uint32_t	version;
131 
132 	uint32_t	flags;
133 
134 	/* Number of rotation request items in the list */
135 	uint32_t	count;
136 
137 	/* Pointer to a list of rotation request items */
138 	struct mdp_rotation_item *list;
139 
140 	/* 32bits reserved value for future usage*/
141 	uint32_t	reserved[6];
142 };
143 
144 #endif /* _MDSS_ROTATOR_H_*/
145