1 #ifndef __MSM_VIDC_PRIVATE_H__
2 #define __MSM_VIDC_PRIVATE_H__
3 
4 #include <linux/videodev2.h>
5 
6 /* VIDIOC private video command */
7 #define VIDIOC_VIDEO_CMD \
8 		_IOWR('V', BASE_VIDIOC_PRIVATE_VIDEO, struct msm_vidc_arg)
9 
10 /* Commands type */
11 #define MSM_VIDC_CMD_START			0x10000000
12 #define MSM_CVP_START				(MSM_VIDC_CMD_START + 0x1000)
13 
14 /*
15  * userspace clients pass one of the below arguments type
16  * in struct msm_vidc_arg (@type field).
17  */
18 
19 /*
20  * MSM_CVP_GET_SESSION_INFO - this argument type is used to
21  *          get the session information from driver. it passes
22  *          struct msm_cvp_session_info {}
23  */
24 #define MSM_CVP_GET_SESSION_INFO	(MSM_CVP_START + 1)
25 
26 /*
27  * MSM_CVP_REQUEST_POWER - this argument type is used to
28  *          set the power required to driver. it passes
29  *          struct msm_cvp_request_power {}
30  */
31 #define MSM_CVP_REQUEST_POWER		(MSM_CVP_START + 2)
32 
33 /*
34  * MSM_CVP_REGISTER_BUFFER - this argument type is used to
35  *          register the buffer to driver. it passes
36  *          struct msm_cvp_buffer {}
37  */
38 #define MSM_CVP_REGISTER_BUFFER		(MSM_CVP_START + 3)
39 
40 /*
41  * MSM_CVP_REGISTER_BUFFER - this argument type is used to
42  *          unregister the buffer to driver. it passes
43  *          struct msm_cvp_buffer {}
44  */
45 #define MSM_CVP_UNREGISTER_BUFFER	(MSM_CVP_START + 4)
46 
47 /* flags */
48 #define MSM_CVP_FLAG_UNSECURE			0x00000000
49 #define MSM_CVP_FLAG_SECURE			0x00000001
50 
51 /* buffer type */
52 #define MSM_CVP_BUFTYPE_INPUT			0x00000001
53 #define MSM_CVP_BUFTYPE_OUTPUT			0x00000002
54 #define MSM_CVP_BUFTYPE_INTERNAL_1		0x00000003
55 #define MSM_CVP_BUFTYPE_INTERNAL_2		0x00000004
56 
57 
58 /**
59  * struct msm_cvp_session_info - session information
60  * @session_id:    current session id
61  */
62 struct msm_cvp_session_info {
63 	unsigned int session_id;
64 	unsigned int reserved[10];
65 };
66 
67 /**
68  * struct msm_cvp_request_power - power / clock data information
69  * @clock_cycles_a:  clock cycles per second required for hardware_a
70  * @clock_cycles_b:  clock cycles per second required for hardware_b
71  * @ddr_bw:        bandwidth required for ddr in bps
72  * @sys_cache_bw:  bandwidth required for system cache in bps
73  */
74 struct msm_cvp_request_power {
75 	unsigned int clock_cycles_a;
76 	unsigned int clock_cycles_b;
77 	unsigned int ddr_bw;
78 	unsigned int sys_cache_bw;
79 	unsigned int reserved[8];
80 };
81 
82 /**
83  * struct msm_cvp_buffer - buffer information to be registered
84  * @index:         index of buffer
85  * @type:          buffer type
86  * @fd:            file descriptor of buffer
87  * @size:          allocated size of buffer
88  * @offset:        offset in fd from where usable data starts
89  * @pixelformat:   fourcc format
90  * @flags:         buffer flags
91  */
92 struct msm_cvp_buffer {
93 	unsigned int index;
94 	unsigned int type;
95 	unsigned int fd;
96 	unsigned int size;
97 	unsigned int offset;
98 	unsigned int pixelformat;
99 	unsigned int flags;
100 	unsigned int reserved[5];
101 };
102 
103 /**
104  * struct msm_vidc_arg - argument passed with VIDIOC_VIDEO_CMD
105  * @type:          command type
106  * @session:       session information
107  * @req_power:     power information
108  * @regbuf:        buffer to be registered
109  * @unregbuf:      buffer to be unregistered
110  */
111 struct msm_vidc_arg {
112 	unsigned int type;
113 	union data_t {
114 		struct msm_cvp_session_info session;
115 		struct msm_cvp_request_power req_power;
116 		struct msm_cvp_buffer regbuf;
117 		struct msm_cvp_buffer unregbuf;
118 	} data;
119 	unsigned int reserved[12];
120 };
121 
122 #endif
123