1 #ifndef __UAPI_CAM_FD_H__
2 #define __UAPI_CAM_FD_H__
3 
4 #include "cam_defs.h"
5 
6 #define CAM_FD_MAX_FACES                       35
7 #define CAM_FD_RAW_RESULT_ENTRIES              512
8 
9 /* FD Op Codes */
10 #define CAM_PACKET_OPCODES_FD_FRAME_UPDATE     0x0
11 
12 /* FD Command Buffer identifiers */
13 #define CAM_FD_CMD_BUFFER_ID_GENERIC           0x0
14 #define CAM_FD_CMD_BUFFER_ID_CDM               0x1
15 #define CAM_FD_CMD_BUFFER_ID_MAX               0x2
16 
17 /* FD Blob types */
18 #define CAM_FD_BLOB_TYPE_SOC_CLOCK_BW_REQUEST  0x0
19 #define CAM_FD_BLOB_TYPE_RAW_RESULTS_REQUIRED  0x1
20 
21 /* FD Resource IDs */
22 #define CAM_FD_INPUT_PORT_ID_IMAGE             0x0
23 #define CAM_FD_INPUT_PORT_ID_MAX               0x1
24 
25 #define CAM_FD_OUTPUT_PORT_ID_RESULTS          0x0
26 #define CAM_FD_OUTPUT_PORT_ID_RAW_RESULTS      0x1
27 #define CAM_FD_OUTPUT_PORT_ID_WORK_BUFFER      0x2
28 #define CAM_FD_OUTPUT_PORT_ID_MAX              0x3
29 
30 /**
31  * struct cam_fd_soc_clock_bw_request - SOC clock, bandwidth request info
32  *
33  * @clock_rate : Clock rate required while processing frame
34  * @bandwidth  : Bandwidth required while processing frame
35  * @reserved   : Reserved for future use
36  */
37 struct cam_fd_soc_clock_bw_request {
38 	uint64_t    clock_rate;
39 	uint64_t    bandwidth;
40 	uint64_t    reserved[4];
41 };
42 
43 /**
44  * struct cam_fd_face - Face properties
45  *
46  * @prop1 : Property 1 of face
47  * @prop2 : Property 2 of face
48  * @prop3 : Property 3 of face
49  * @prop4 : Property 4 of face
50  *
51  * Do not change this layout, this is __inline__ with how HW writes
52  * these values directly when the buffer is programmed to HW
53  */
54 struct cam_fd_face {
55 	uint32_t    prop1;
56 	uint32_t    prop2;
57 	uint32_t    prop3;
58 	uint32_t    prop4;
59 };
60 
61 /**
62  * struct cam_fd_results - FD results layout
63  *
64  * @faces      : Array of faces with face properties
65  * @face_count : Number of faces detected
66  * @reserved   : Reserved for alignment
67  *
68  * Do not change this layout, this is __inline__ with how HW writes
69  * these values directly when the buffer is programmed to HW
70  */
71 struct cam_fd_results {
72 	struct cam_fd_face    faces[CAM_FD_MAX_FACES];
73 	uint32_t              face_count;
74 	uint32_t              reserved[3];
75 };
76 
77 /**
78  * struct cam_fd_hw_caps - Face properties
79  *
80  * @core_version          : FD core version
81  * @wrapper_version       : FD wrapper version
82  * @raw_results_available : Whether raw results are available on this HW
83  * @supported_modes       : Modes supported by this HW.
84  * @reserved              : Reserved for future use
85  */
86 struct cam_fd_hw_caps {
87 	struct cam_hw_version    core_version;
88 	struct cam_hw_version    wrapper_version;
89 	uint32_t                 raw_results_available;
90 	uint32_t                 supported_modes;
91 	uint64_t                 reserved;
92 };
93 
94 /**
95  * struct cam_fd_query_cap_cmd - FD Query capabilities information
96  *
97  * @device_iommu : FD IOMMU handles
98  * @cdm_iommu    : CDM iommu handles
99  * @hw_caps      : FD HW capabilities
100  * @reserved     : Reserved for alignment
101  */
102 struct cam_fd_query_cap_cmd {
103 	struct cam_iommu_handle    device_iommu;
104 	struct cam_iommu_handle    cdm_iommu;
105 	struct cam_fd_hw_caps      hw_caps;
106 	uint64_t                   reserved;
107 };
108 
109 /**
110  * struct cam_fd_acquire_dev_info - FD acquire device information
111  *
112  * @clk_bw_request  : SOC clock, bandwidth request
113  * @priority        : Priority for this acquire
114  * @mode            : Mode in which to run FD HW.
115  * @get_raw_results : Whether this acquire needs face raw results
116  *                    while frame processing
117  * @reserved        : Reserved field for 64 bit alignment
118  */
119 struct cam_fd_acquire_dev_info {
120 	struct cam_fd_soc_clock_bw_request clk_bw_request;
121 	uint32_t                           priority;
122 	uint32_t                           mode;
123 	uint32_t                           get_raw_results;
124 	uint32_t                           reserved[13];
125 };
126 
127 #endif /* __UAPI_CAM_FD_H__ */
128