1 #ifndef __UAPI_MSM_MERCURY_H
2 #define __UAPI_MSM_MERCURY_H
3 
4 #include <linux/types.h>
5 #include <linux/ioctl.h>
6 
7 #define MSM_MERCURY_HW_VERSION_REG  0x0004/* this offset does not exist in HW*/
8 
9 #define OUTPUT_H2V1  0
10 #define OUTPUT_H2V2  1
11 #define OUTPUT_BYTE  6
12 
13 #define MSM_MERCURY_MODE_REALTIME_ENCODE 0
14 #define MSM_MERCURY_MODE_OFFLINE_ENCODE 1
15 #define MSM_MERCURY_MODE_REALTIME_ROTATION 2
16 #define MSM_MERCURY_MODE_OFFLINE_ROTATION 3
17 
18 #define MSM_MERCURY_EVT_RESET       1
19 #define MSM_MERCURY_EVT_FRAMEDONE	2
20 #define MSM_MERCURY_EVT_ERR         3
21 #define MSM_MERCURY_EVT_UNBLOCK     4
22 
23 #define MSM_MERCURY_HW_CMD_TYPE_READ      0
24 #define MSM_MERCURY_HW_CMD_TYPE_WRITE     1
25 #define MSM_MERCURY_HW_CMD_TYPE_WRITE_OR  2
26 #define MSM_MERCURY_HW_CMD_TYPE_UWAIT     3
27 #define MSM_MERCURY_HW_CMD_TYPE_MWAIT     4
28 #define MSM_MERCURY_HW_CMD_TYPE_MDELAY    5
29 #define MSM_MERCURY_HW_CMD_TYPE_UDELAY    6
30 
31 #define MSM_MCR_IOCTL_MAGIC 'g'
32 
33 #define MSM_MCR_IOCTL_GET_HW_VERSION \
34 	_IOW(MSM_MCR_IOCTL_MAGIC, 1, struct msm_mercury_hw_cmd *)
35 
36 #define MSM_MCR_IOCTL_RESET \
37 	_IOW(MSM_MCR_IOCTL_MAGIC, 2, struct msm_mercury_ctrl_cmd *)
38 
39 #define MSM_MCR_IOCTL_STOP \
40 	_IOW(MSM_MCR_IOCTL_MAGIC, 3, struct msm_mercury_hw_cmds *)
41 
42 #define MSM_MCR_IOCTL_START \
43 	_IOW(MSM_MCR_IOCTL_MAGIC, 4, struct msm_mercury_hw_cmds *)
44 
45 #define MSM_MCR_IOCTL_INPUT_BUF_CFG \
46 	_IOW(MSM_MCR_IOCTL_MAGIC, 5, struct msm_mercury_buf *)
47 
48 #define MSM_MCR_IOCTL_INPUT_GET \
49 	_IOW(MSM_MCR_IOCTL_MAGIC, 6, struct msm_mercury_buf *)
50 
51 #define MSM_MCR_IOCTL_INPUT_GET_UNBLOCK \
52 	_IOW(MSM_MCR_IOCTL_MAGIC, 7, int)
53 
54 #define MSM_MCR_IOCTL_OUTPUT_BUF_CFG \
55 	_IOW(MSM_MCR_IOCTL_MAGIC, 8, struct msm_mercury_buf *)
56 
57 #define MSM_MCR_IOCTL_OUTPUT_GET \
58 	_IOW(MSM_MCR_IOCTL_MAGIC, 9, struct msm_mercury_buf *)
59 
60 #define MSM_MCR_IOCTL_OUTPUT_GET_UNBLOCK \
61 	_IOW(MSM_MCR_IOCTL_MAGIC, 10, int)
62 
63 #define MSM_MCR_IOCTL_EVT_GET \
64 	_IOW(MSM_MCR_IOCTL_MAGIC, 11, struct msm_mercury_ctrl_cmd *)
65 
66 #define MSM_MCR_IOCTL_EVT_GET_UNBLOCK \
67 	_IOW(MSM_MCR_IOCTL_MAGIC, 12, int)
68 
69 #define MSM_MCR_IOCTL_HW_CMD \
70 	_IOW(MSM_MCR_IOCTL_MAGIC, 13, struct msm_mercury_hw_cmd *)
71 
72 #define MSM_MCR_IOCTL_HW_CMDS \
73 	_IOW(MSM_MCR_IOCTL_MAGIC, 14, struct msm_mercury_hw_cmds *)
74 
75 #define MSM_MCR_IOCTL_TEST_DUMP_REGION \
76 	_IOW(MSM_MCR_IOCTL_MAGIC, 15, unsigned long)
77 
78 struct msm_mercury_ctrl_cmd {
79 	uint32_t type;
80 	uint32_t len;
81 	void     *value;
82 };
83 
84 struct msm_mercury_buf {
85 	uint32_t type;
86 	int      fd;
87 	void     *vaddr;
88 	uint32_t y_off;
89 	uint32_t y_len;
90 	uint32_t framedone_len;
91 	uint32_t cbcr_off;
92 	uint32_t cbcr_len;
93 	uint32_t num_of_mcu_rows;
94 	uint32_t offset;
95 };
96 
97 struct msm_mercury_hw_cmd {
98 
99 	uint32_t type:4;
100 	/* n microseconds of timeout for WAIT */
101 	/* n microseconds of time for DELAY */
102 	/* repeat n times for READ/WRITE */
103 	/* max is 0xFFF, 4095 */
104 	uint32_t n:12;
105 	uint32_t offset:16;
106 	uint32_t mask;
107 	union {
108 		/* for single READ/WRITE/WAIT, n = 1 */
109 		uint32_t data;
110 		uint32_t *pdata;/* for multiple READ/WRITE/WAIT, n > 1 */
111 	};
112 };
113 
114 struct msm_mercury_hw_cmds {
115 	uint32_t m;	/* number of elements in the hw_cmd array */
116 	struct msm_mercury_hw_cmd hw_cmd[1];
117 };
118 
119 #endif /* __UAPI_MSM_MERCURY_H */
120