1 /* Copyright (c) 2014, The Linux Foundation. All rights reserved.
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 and
5  * only version 2 as published by the Free Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  */
12 #ifndef __UAPI_MSM_FD__
13 #define __UAPI_MSM_FD__
14 
15 #include <linux/videodev2.h>
16 
17 /*
18  * struct msm_fd_event - Structure contain event info.
19  * @buf_index: Buffer index.
20  * @frame_id: Frame id.
21  * @face_cnt: Detected faces.
22  */
23 struct msm_fd_event {
24 	__u32 buf_index;
25 	__u32 frame_id;
26 	__u32 face_cnt;
27 };
28 
29 /*
30  * enum msm_fd_pose - Face pose.
31  */
32 enum msm_fd_pose {
33 	MSM_FD_POSE_FRONT,
34 	MSM_FD_POSE_RIGHT_DIAGONAL,
35 	MSM_FD_POSE_RIGHT,
36 	MSM_FD_POSE_LEFT_DIAGONAL,
37 	MSM_FD_POSE_LEFT,
38 };
39 
40 /*
41  * struct msm_fd_face_data - Structure contain detected face data.
42  * @pose: refer to enum msm_fd_pose.
43  * @angle: Face angle
44  * @confidence: Face confidence level.
45  * @reserved: Reserved data for future use.
46  * @face: Face rectangle.
47  */
48 struct msm_fd_face_data {
49 	__u32 pose;
50 	__u32 angle;
51 	__u32 confidence;
52 	__u32 reserved;
53 	struct v4l2_rect face;
54 };
55 
56 /*
57  * struct msm_fd_result - Structure contain detected faces result.
58  * @frame_id: Frame id of requested result.
59  * @face_cnt: Number of result faces, driver can modify this value (to smaller)
60  * @face_data: Pointer to array of face data structures.
61  *  Array size should not be smaller then face_cnt.
62  */
63 struct msm_fd_result {
64 	__u32 frame_id;
65 	__u32 face_cnt;
66 	struct msm_fd_face_data __user *face_data;
67 };
68 
69 #ifdef CONFIG_COMPAT
70 /*
71  * struct msm_fd_result32 - Compat structure contain detected faces result.
72  * @frame_id: Frame id of requested result.
73  * @face_cnt: Number of result faces, driver can modify this value (to smaller)
74  * @face_data: Pointer to array of face data structures.
75  *  Array size should not be smaller then face_cnt.
76  */
77 struct msm_fd_result32 {
78 	__u32 frame_id;
79 	__u32 face_cnt;
80 	compat_uptr_t face_data;
81 };
82 
83 /* MSM FD compat private ioctl ID */
84 #define VIDIOC_MSM_FD_GET_RESULT32 \
85 	_IOWR('V', BASE_VIDIOC_PRIVATE, struct msm_fd_result32)
86 #endif
87 
88 /* MSM FD private ioctl ID */
89 #define VIDIOC_MSM_FD_GET_RESULT \
90 	_IOWR('V', BASE_VIDIOC_PRIVATE, struct msm_fd_result)
91 
92 /* MSM FD event ID */
93 #define MSM_EVENT_FD (V4L2_EVENT_PRIVATE_START)
94 
95 /* MSM FD control ID's */
96 #define V4L2_CID_FD_SPEED                (V4L2_CID_PRIVATE_BASE)
97 #define V4L2_CID_FD_FACE_ANGLE           (V4L2_CID_PRIVATE_BASE + 1)
98 #define V4L2_CID_FD_MIN_FACE_SIZE        (V4L2_CID_PRIVATE_BASE + 2)
99 #define V4L2_CID_FD_FACE_DIRECTION       (V4L2_CID_PRIVATE_BASE + 3)
100 #define V4L2_CID_FD_DETECTION_THRESHOLD  (V4L2_CID_PRIVATE_BASE + 4)
101 #define V4L2_CID_FD_WORK_MEMORY_SIZE     (V4L2_CID_PRIVATE_BASE + 5)
102 #define V4L2_CID_FD_WORK_MEMORY_FD       (V4L2_CID_PRIVATE_BASE + 6)
103 
104 #endif /* __UAPI_MSM_FD__ */
105