cam_custom.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
  2. /*
  3. * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __UAPI_CAM_CUSTOM_H__
  6. #define __UAPI_CAM_CUSTOM_H__
  7. #include <media/cam_defs.h>
  8. /* Custom driver name */
  9. #define CAM_CUSTOM_DEV_NAME "cam-custom"
  10. #define CAM_CUSTOM_NUM_SUB_DEVICES 2
  11. /* HW type */
  12. #define CAM_CUSTOM_HW1 0
  13. #define CAM_CUSTOM_HW2 1
  14. /* output path resource id's */
  15. #define CAM_CUSTOM_OUT_RES_UDI_0 1
  16. #define CAM_CUSTOM_OUT_RES_UDI_1 2
  17. #define CAM_CUSTOM_OUT_RES_UDI_2 3
  18. /* input resource for custom hw */
  19. #define CAM_CUSTOM_IN_RES_UDI_0 1
  20. /* Resource ID */
  21. #define CAM_CUSTOM_RES_ID_PORT 0
  22. /* Packet opcode for Custom */
  23. #define CAM_CUSTOM_PACKET_OP_BASE 0
  24. #define CAM_CUSTOM_PACKET_INIT_DEV 1
  25. #define CAM_CUSTOM_PACKET_UPDATE_DEV 2
  26. #define CAM_CUSTOM_PACKET_OP_MAX 3
  27. /* max number of vc-dt cfg for a given input */
  28. #define CAM_CUSTOM_VC_DT_CFG_MAX 4
  29. /* phy input resource types */
  30. #define CAM_CUSTOM_IN_RES_BASE 0x5000
  31. #define CAM_CUSTOM_IN_RES_PHY_0 (CAM_CUSTOM_IN_RES_BASE + 1)
  32. #define CAM_CUSTOM_IN_RES_PHY_1 (CAM_CUSTOM_IN_RES_BASE + 2)
  33. #define CAM_CUSTOM_IN_RES_PHY_2 (CAM_CUSTOM_IN_RES_BASE + 3)
  34. #define CAM_CUSTOM_IN_RES_PHY_3 (CAM_CUSTOM_IN_RES_BASE + 4)
  35. /* Query devices */
  36. /**
  37. * struct cam_custom_dev_cap_info - A cap info for particular hw type
  38. *
  39. * @hw_type: Custom HW type
  40. * @hw_version: Hardware version
  41. *
  42. */
  43. struct cam_custom_dev_cap_info {
  44. __u32 hw_type;
  45. __u32 hw_version;
  46. };
  47. /**
  48. * struct cam_custom_query_cap_cmd - Custom HW query device capability payload
  49. *
  50. * @device_iommu: returned iommu handles for device
  51. * @cdm_iommu: returned iommu handles for cdm
  52. * @num_dev: returned number of device capabilities
  53. * @reserved: reserved field for alignment
  54. * @dev_caps: returned device capability array
  55. *
  56. */
  57. struct cam_custom_query_cap_cmd {
  58. struct cam_iommu_handle device_iommu;
  59. struct cam_iommu_handle cdm_iommu;
  60. __s32 num_dev;
  61. __u32 reserved;
  62. struct cam_custom_dev_cap_info dev_caps[CAM_CUSTOM_NUM_SUB_DEVICES];
  63. };
  64. /* Acquire Device */
  65. /**
  66. * struct cam_custom_out_port_info - An output port resource info
  67. *
  68. * @res_type: output resource type
  69. * @format: output format of the resource
  70. * @custom_info 1-3: custom params
  71. * @reserved: reserved field for alignment
  72. *
  73. */
  74. struct cam_custom_out_port_info {
  75. __u32 res_type;
  76. __u32 format;
  77. __u32 custom_info1;
  78. __u32 custom_info2;
  79. __u32 custom_info3;
  80. __u32 reserved;
  81. };
  82. /**
  83. * struct cam_custom_in_port_info - An input port resource info
  84. *
  85. * @res_type: input resource type
  86. * @lane_type: lane type: c-phy or d-phy.
  87. * @lane_num: active lane number
  88. * @lane_cfg: lane configurations: 4 bits per lane
  89. * @vc: input virtual channel number
  90. * @dt: input data type number
  91. * @num_valid_vc_dt: number of valid vc-dt
  92. * @format: input format
  93. * @test_pattern: test pattern for the testgen
  94. * @usage_type: whether dual vfe is required
  95. * @left_start: left input start offset in pixels
  96. * @left_stop: left input stop offset in pixels
  97. * @left_width: left input width in pixels
  98. * @right_start: right input start offset in pixels.
  99. * @right_stop: right input stop offset in pixels.
  100. * @right_width: right input width in pixels.
  101. * @line_start: top of the line number
  102. * @line_stop: bottome of the line number
  103. * @height: input height in lines
  104. * @pixel_clk; sensor output clock
  105. * @num_out_byte: number of valid output bytes per cycle
  106. * @custom_info1: custom_info1
  107. * @custom_info2: custom info 2
  108. * @num_out_res: number of the output resource associated
  109. * @data: payload that contains the output resources
  110. *
  111. */
  112. struct cam_custom_in_port_info {
  113. __u32 res_type;
  114. __u32 lane_type;
  115. __u32 lane_num;
  116. __u32 lane_cfg;
  117. __u32 vc[CAM_CUSTOM_VC_DT_CFG_MAX];
  118. __u32 dt[CAM_CUSTOM_VC_DT_CFG_MAX];
  119. __u32 num_valid_vc_dt;
  120. __u32 format;
  121. __u32 test_pattern;
  122. __u32 usage_type;
  123. __u32 left_start;
  124. __u32 left_stop;
  125. __u32 left_width;
  126. __u32 right_start;
  127. __u32 right_stop;
  128. __u32 right_width;
  129. __u32 line_start;
  130. __u32 line_stop;
  131. __u32 height;
  132. __u32 pixel_clk;
  133. __u32 num_bytes_out;
  134. __u32 custom_info1;
  135. __u32 custom_info2;
  136. __u32 num_out_res;
  137. struct cam_custom_out_port_info data[1];
  138. };
  139. /**
  140. * struct cam_custom_resource - A resource bundle
  141. *
  142. * @resoruce_id: resource id for the resource bundle
  143. * @length: length of the while resource blob
  144. * @handle_type: type of the resource handle
  145. * @reserved: reserved field for alignment
  146. * @res_hdl: resource handle that points to the
  147. * resource array;
  148. */
  149. struct cam_custom_resource {
  150. __u32 resource_id;
  151. __u32 length;
  152. __u32 handle_type;
  153. __u32 reserved;
  154. __u64 res_hdl;
  155. };
  156. /**
  157. * struct cam_custom_acquire_hw_info - Custom acquire HW params
  158. *
  159. * @num_inputs : Number of inputs
  160. * @input_info_size : Size of input info struct used
  161. * @input_info_offset : Offset of input info from start of data
  162. * @reserved : reserved
  163. * @data : Start of data region
  164. */
  165. struct cam_custom_acquire_hw_info {
  166. __u32 num_inputs;
  167. __u32 input_info_size;
  168. __u32 input_info_offset;
  169. __u32 reserved;
  170. __u64 data;
  171. };
  172. /**
  173. * struct cam_custom_cmd_buf_type_1 - cmd buf type 1
  174. *
  175. * @custom_info: custom info
  176. * @reserved: reserved
  177. */
  178. struct cam_custom_cmd_buf_type_1 {
  179. __u32 custom_info;
  180. __u32 reserved;
  181. };
  182. /**
  183. * struct cam_custom_cmd_buf_type_2 - cmd buf type 2
  184. *
  185. * @custom_info1: Custom info 1
  186. * @custom_info2: Custom info 2
  187. * @custom_info3: Custom info 3
  188. * @reserved: reserved
  189. */
  190. struct cam_custom_cmd_buf_type_2 {
  191. __u32 custom_info1;
  192. __u32 custom_info2;
  193. __u32 custom_info3;
  194. __u32 reserved;
  195. };
  196. #endif /* __UAPI_CAM_CUSTOM_H__ */