cam_cre.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
  2. /*
  3. * Copyright (c) 2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __UAPI_CAM_CRE_H__
  6. #define __UAPI_CAM_CRE_H__
  7. #include <media/cam_defs.h>
  8. #include <media/cam_cpas.h>
  9. #define CAM_CRE_DEV_NAME_SIZE 128
  10. /* CRE HW TYPE */
  11. #define CAM_CRE_HW_TYPE_CRE 0x1
  12. #define CAM_CRE_HW_TYPE_MAX 0x1
  13. /* packet opcode types */
  14. #define CAM_CRE_OPCODE_CONFIG 0x1
  15. /* input port resource type */
  16. #define CAM_CRE_INPUT_IMAGE 0x1
  17. #define CAM_CRE_INPUT_IMAGES_MAX (CAM_CRE_INPUT_IMAGE + 1)
  18. /* output port resource type */
  19. #define CAM_CRE_OUTPUT_IMAGE 0x1
  20. #define CAM_CRE_OUTPUT_IMAGES_MAX (CAM_CRE_OUTPUT_IMAGE + 1)
  21. #define CAM_CRE_MAX_PLANES 0x2
  22. #define CRE_MAX_BATCH_SIZE 0x10
  23. /* definitions needed for cre aquire device */
  24. #define CAM_CRE_DEV_TYPE_NRT 0x1
  25. #define CAM_CRE_DEV_TYPE_RT 0x2
  26. #define CAM_CRE_DEV_TYPE_MAX 0x3
  27. #define CAM_CRE_CMD_META_GENERIC_BLOB 0x1
  28. /* Clock blob */
  29. #define CAM_CRE_CMD_GENERIC_BLOB_CLK_V2 0x1
  30. /**
  31. * struct cam_cre_hw_ver - Device information for particular hw type
  32. *
  33. * This is used to get device version info of CRE
  34. * from hardware and use this info in CAM_QUERY_CAP IOCTL
  35. *
  36. * @hw_ver: Major, minor and incr values of a device version
  37. */
  38. struct cam_cre_hw_ver {
  39. struct cam_hw_version hw_ver;
  40. };
  41. /**
  42. * struct cam_cre_query_cap_cmd - CRE query device capability payload
  43. *
  44. * @dev_iommu_handle: CRE iommu handles for secure/non secure modes
  45. * @num_dev: Number of cre
  46. * @reserved: Reserved field
  47. * @dev_ver: Returned device capability array
  48. */
  49. struct cam_cre_query_cap_cmd {
  50. struct cam_iommu_handle dev_iommu_handle;
  51. __u32 num_dev;
  52. __u32 reserved;
  53. struct cam_cre_hw_ver dev_ver[CAM_CRE_HW_TYPE_MAX];
  54. };
  55. /**
  56. * struct cam_cre_io_buf_info - CRE IO buffers meta
  57. *
  58. * @direction: Direction of a buffer of a port(Input/Output)
  59. * @res_id: Resource ID
  60. * @num_planes: Number of planes
  61. * @width: Height of a plane buffer
  62. * @height: Height of a plane buffer
  63. * @stride: Plane stride
  64. * @format: unpacker format for FE, packer format for WE
  65. * @alignment: Alignment
  66. * @reserved: Reserved field 0
  67. */
  68. struct cam_cre_io_buf_info {
  69. __u32 direction;
  70. __u32 res_id;
  71. __u32 num_planes;
  72. __u32 width;
  73. __u32 height;
  74. __u32 stride;
  75. __u32 fence;
  76. __u32 format;
  77. __u32 alignment;
  78. __u32 reserved;
  79. };
  80. /**
  81. * struct cam_cre_acquire_dev_info - An CRE device info
  82. *
  83. * @dev_type: NRT/RT Acquire
  84. * @dev_name: Device name (CRE)
  85. * @secure_mode: Tells if CRE will process the secure buff or not.
  86. * @batch_size: Batch size
  87. * @num_in_res: Number of In resources
  88. * @num_out_res: Number of Out resources
  89. * @reserved: Reserved field 0
  90. * @in_res: In resource info
  91. * @in_res: Out resource info
  92. */
  93. struct cam_cre_acquire_dev_info {
  94. char dev_name[CAM_CRE_DEV_NAME_SIZE];
  95. __u32 dev_type;
  96. __u32 secure_mode;
  97. __u32 batch_size;
  98. __u32 num_in_res;
  99. __u32 num_out_res;
  100. __u32 reserved;
  101. struct cam_cre_io_buf_info in_res[CAM_CRE_INPUT_IMAGES_MAX];
  102. struct cam_cre_io_buf_info out_res[CAM_CRE_OUTPUT_IMAGES_MAX];
  103. }__attribute__((__packed__));
  104. /**
  105. * struct cre_clk_bw_request_v2
  106. *
  107. * @budget_ns: Time required to process frame
  108. * @frame_cycles: Frame cycles needed to process the frame
  109. * @rt_flag: Flag to indicate real time stream
  110. * @reserved: Reserved field 0
  111. * @num_path: Number of AXI Paths
  112. */
  113. struct cre_clk_bw_request_v2 {
  114. __u64 budget_ns;
  115. __u32 frame_cycles;
  116. __u32 rt_flag;
  117. __u32 reserved;
  118. __u32 num_paths;
  119. struct cam_axi_per_path_bw_vote axi_path[1];
  120. };
  121. #endif /* __UAPI_CAM_CRE_H__ */