cam_jpeg.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. /*JPEG Command Buffer Metadata types*/
  31. #define CAM_JPEG_ENC_PACKET_CONFIG_DATA 0x00
  32. #define CAM_JPEG_DMA_PACKET_PLANE0_CONFIG_DATA 0x01
  33. #define CAM_JPEG_DMA_PACKET_PLANE1_CONFIG_DATA 0x02
  34. #define CAM_JPEG_PACKET_INOUT_PARAM 0x03
  35. #define CAM_JPEG_PACKET_GENERIC_BLOB 0x04
  36. /*JPEG Generic Blob Command buffer type*/
  37. #define CAM_JPEG_THUMBNAIL_SIZE_BLOB 0x01
  38. /**
  39. * struct cam_jpeg_thumbnail_size_blob - Blob containing information about maximum size of the
  40. * thumbnail image
  41. *
  42. * This blob contains information about the maximum size of the encoded thumbnail image that is
  43. * considered valid.
  44. *
  45. * @threshold_size : Size threshold for the encoded Thumbnail image
  46. * @reserved : Reserved field
  47. */
  48. struct cam_jpeg_thumbnail_size_blob {
  49. __u32 threshold_size;
  50. __u32 reserved[3];
  51. };
  52. /**
  53. * struct cam_jpeg_dev_ver - Device information for particular hw type
  54. *
  55. * This is used to get device version info of JPEG ENC, JPEG DMA
  56. * from hardware and use this info in CAM_QUERY_CAP IOCTL
  57. *
  58. * @size : Size of struct passed
  59. * @dev_type : Hardware type for the cap info(jpeg enc, jpeg dma)
  60. * @hw_ver : Major, minor and incr values of a device version
  61. */
  62. struct cam_jpeg_dev_ver {
  63. __u32 size;
  64. __u32 dev_type;
  65. struct cam_hw_version hw_ver;
  66. };
  67. /**
  68. * struct cam_jpeg_query_cap_cmd - JPEG query device capability payload
  69. *
  70. * @dev_iommu_handle : Jpeg iommu handles for secure/non secure
  71. * modes
  72. * @cdm_iommu_handle : Iommu handles for secure/non secure modes
  73. * @num_enc : Number of encoder
  74. * @num_dma : Number of dma
  75. * @dev_ver : Returned device capability array
  76. */
  77. struct cam_jpeg_query_cap_cmd {
  78. struct cam_iommu_handle dev_iommu_handle;
  79. struct cam_iommu_handle cdm_iommu_handle;
  80. __u32 num_enc;
  81. __u32 num_dma;
  82. struct cam_jpeg_dev_ver dev_ver[CAM_JPEG_DEV_TYPE_MAX];
  83. };
  84. /**
  85. * struct cam_jpeg_res_info - JPEG output resource info
  86. *
  87. * @format : Format of the resource
  88. * @width : Width in pixels
  89. * @height : Height in lines
  90. * @fps : Fps
  91. */
  92. struct cam_jpeg_res_info {
  93. __u32 format;
  94. __u32 width;
  95. __u32 height;
  96. __u32 fps;
  97. };
  98. /**
  99. * struct cam_jpeg_acquire_dev_info - An JPEG device info
  100. *
  101. * @dev_type : Device type (ENC/DMA)
  102. * @reserved : Reserved Bytes
  103. * @in_res : In resource info
  104. * @in_res : Iut resource info
  105. */
  106. struct cam_jpeg_acquire_dev_info {
  107. __u32 dev_type;
  108. __u32 reserved;
  109. struct cam_jpeg_res_info in_res;
  110. struct cam_jpeg_res_info out_res;
  111. };
  112. /**
  113. * struct cam_jpeg_config_inout_param_info - JPEG Config time
  114. * input output params
  115. *
  116. * @clk_index : Input Param- clock selection index.(-1 default)
  117. * @output_size: Output Param - jpeg encode/dma output size in
  118. * bytes
  119. */
  120. struct cam_jpeg_config_inout_param_info {
  121. __s32 clk_index;
  122. __s32 output_size;
  123. };
  124. #endif /* __UAPI_CAM_JPEG_H__ */