cam_jpeg.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
  2. /*
  3. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __UAPI_CAM_JPEG_H__
  6. #define __UAPI_CAM_JPEG_H__
  7. #include <media/cam_defs.h>
  8. /* enc, dma, cdm(enc/dma) are used in querycap */
  9. #define CAM_JPEG_DEV_TYPE_ENC 0
  10. #define CAM_JPEG_DEV_TYPE_DMA 1
  11. #define CAM_JPEG_DEV_TYPE_MAX 2
  12. #define CAM_JPEG_NUM_DEV_PER_RES_MAX 1
  13. /* definitions needed for jpeg aquire device */
  14. #define CAM_JPEG_RES_TYPE_ENC 0
  15. #define CAM_JPEG_RES_TYPE_DMA 1
  16. #define CAM_JPEG_RES_TYPE_MAX 2
  17. /* packet opcode types */
  18. #define CAM_JPEG_OPCODE_ENC_UPDATE 0
  19. #define CAM_JPEG_OPCODE_DMA_UPDATE 1
  20. /* ENC input port resource type */
  21. #define CAM_JPEG_ENC_INPUT_IMAGE 0x0
  22. /* ENC output port resource type */
  23. #define CAM_JPEG_ENC_OUTPUT_IMAGE 0x1
  24. #define CAM_JPEG_ENC_IO_IMAGES_MAX 0x2
  25. /* DMA input port resource type */
  26. #define CAM_JPEG_DMA_INPUT_IMAGE 0x0
  27. /* DMA output port resource type */
  28. #define CAM_JPEG_DMA_OUTPUT_IMAGE 0x1
  29. #define CAM_JPEG_DMA_IO_IMAGES_MAX 0x2
  30. #define CAM_JPEG_IMAGE_MAX 0x2
  31. /*JPEG Command Buffer Metadata types*/
  32. #define CAM_JPEG_ENC_PACKET_CONFIG_DATA 0x00
  33. #define CAM_JPEG_DMA_PACKET_PLANE0_CONFIG_DATA 0x01
  34. #define CAM_JPEG_DMA_PACKET_PLANE1_CONFIG_DATA 0x02
  35. #define CAM_JPEG_PACKET_INOUT_PARAM 0x03
  36. #define CAM_JPEG_PACKET_GENERIC_BLOB 0x04
  37. /*JPEG Generic Blob Command buffer type*/
  38. #define CAM_JPEG_THUMBNAIL_SIZE_BLOB 0x01
  39. /**
  40. * struct cam_jpeg_thumbnail_size_blob - Blob containing information about maximum size of the
  41. * thumbnail image
  42. *
  43. * This blob contains information about the maximum size of the encoded thumbnail image that is
  44. * considered valid.
  45. *
  46. * @threshold_size : Size threshold for the encoded Thumbnail image
  47. * @reserved : Reserved field
  48. */
  49. struct cam_jpeg_thumbnail_size_blob {
  50. __u32 threshold_size;
  51. __u32 reserved[3];
  52. };
  53. /**
  54. * struct cam_jpeg_dev_ver - Device information for particular hw type
  55. *
  56. * This is used to get device version info of JPEG ENC, JPEG DMA
  57. * from hardware and use this info in CAM_QUERY_CAP IOCTL
  58. *
  59. * @size : Size of struct passed
  60. * @dev_type : Hardware type for the cap info(jpeg enc, jpeg dma)
  61. * @hw_ver : Major, minor and incr values of a device version
  62. */
  63. struct cam_jpeg_dev_ver {
  64. __u32 size;
  65. __u32 dev_type;
  66. struct cam_hw_version hw_ver;
  67. };
  68. /**
  69. * struct cam_jpeg_query_cap_cmd - JPEG query device capability payload
  70. *
  71. * @dev_iommu_handle : Jpeg iommu handles for secure/non secure
  72. * modes
  73. * @cdm_iommu_handle : Iommu handles for secure/non secure modes
  74. * @num_enc : Number of encoder
  75. * @num_dma : Number of dma
  76. * @dev_ver : Returned device capability array
  77. */
  78. struct cam_jpeg_query_cap_cmd {
  79. struct cam_iommu_handle dev_iommu_handle;
  80. struct cam_iommu_handle cdm_iommu_handle;
  81. __u32 num_enc;
  82. __u32 num_dma;
  83. struct cam_jpeg_dev_ver dev_ver[CAM_JPEG_DEV_TYPE_MAX];
  84. };
  85. /**
  86. * struct cam_jpeg_res_info - JPEG output resource info
  87. *
  88. * @format : Format of the resource
  89. * @width : Width in pixels
  90. * @height : Height in lines
  91. * @fps : Fps
  92. */
  93. struct cam_jpeg_res_info {
  94. __u32 format;
  95. __u32 width;
  96. __u32 height;
  97. __u32 fps;
  98. };
  99. /**
  100. * struct cam_jpeg_acquire_dev_info - An JPEG device info
  101. *
  102. * @dev_type : Device type (ENC/DMA)
  103. * @reserved : Reserved Bytes
  104. * @in_res : In resource info
  105. * @in_res : Iut resource info
  106. */
  107. struct cam_jpeg_acquire_dev_info {
  108. __u32 dev_type;
  109. __u32 reserved;
  110. struct cam_jpeg_res_info in_res;
  111. struct cam_jpeg_res_info out_res;
  112. };
  113. /**
  114. * struct cam_jpeg_config_inout_param_info - JPEG Config time
  115. * input output params
  116. *
  117. * @clk_index : Input Param- clock selection index.(-1 default)
  118. * @output_size: Output Param - jpeg encode/dma output size in
  119. * bytes
  120. */
  121. struct cam_jpeg_config_inout_param_info {
  122. __s32 clk_index;
  123. __s32 output_size;
  124. };
  125. #endif /* __UAPI_CAM_JPEG_H__ */