msmb_camera.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. #ifndef __LINUX_MSMB_CAMERA_H
  2. #define __LINUX_MSMB_CAMERA_H
  3. #include <linux/videodev2.h>
  4. #include <linux/types.h>
  5. #include <linux/ioctl.h>
  6. #define MSM_CAM_V4L2_IOCTL_NOTIFY \
  7. _IOW('V', BASE_VIDIOC_PRIVATE + 30, struct v4l2_event)
  8. #define MSM_CAM_V4L2_IOCTL_NOTIFY_ERROR \
  9. _IOW('V', BASE_VIDIOC_PRIVATE + 31, struct v4l2_event)
  10. #define MSM_CAM_V4L2_IOCTL_CMD_ACK \
  11. _IOW('V', BASE_VIDIOC_PRIVATE + 32, struct v4l2_event)
  12. #define MSM_CAM_V4L2_IOCTL_NOTIFY_MODULE_STATUS \
  13. _IOW('V', BASE_VIDIOC_PRIVATE + 33, struct v4l2_event)
  14. #define QCAMERA_DEVICE_GROUP_ID 1
  15. #define QCAMERA_VNODE_GROUP_ID 2
  16. #define MSM_CAMERA_NAME "msm_camera"
  17. #define MSM_CONFIGURATION_NAME "msm_config"
  18. #define MSM_CAMERA_DUMMY_NAME "msm_cam_dummy"
  19. #define MSM_CAMERA_SUBDEV_CSIPHY 0
  20. #define MSM_CAMERA_SUBDEV_CSID 1
  21. #define MSM_CAMERA_SUBDEV_ISPIF 2
  22. #define MSM_CAMERA_SUBDEV_VFE 3
  23. #define MSM_CAMERA_SUBDEV_AXI 4
  24. #define MSM_CAMERA_SUBDEV_VPE 5
  25. #define MSM_CAMERA_SUBDEV_SENSOR 6
  26. #define MSM_CAMERA_SUBDEV_ACTUATOR 7
  27. #define MSM_CAMERA_SUBDEV_EEPROM 8
  28. #define MSM_CAMERA_SUBDEV_CPP 9
  29. #define MSM_CAMERA_SUBDEV_CCI 10
  30. #define MSM_CAMERA_SUBDEV_LED_FLASH 11
  31. #define MSM_CAMERA_SUBDEV_STROBE_FLASH 12
  32. #define MSM_CAMERA_SUBDEV_BUF_MNGR 13
  33. #define MSM_CAMERA_SUBDEV_SENSOR_INIT 14
  34. #define MSM_CAMERA_SUBDEV_COMPANION 15
  35. #define MSM_MAX_CAMERA_SENSORS 5
  36. /* The below macro is defined to put an upper limit on maximum
  37. * number of buffer requested per stream. In case of extremely
  38. * large value for number of buffer due to data structure corruption
  39. * we return error to avoid integer overflow. This value may be
  40. * configured in future*/
  41. #define MSM_CAMERA_MAX_STREAM_BUF 40
  42. /* featur base */
  43. #define MSM_CAMERA_FEATURE_BASE 0x00010000
  44. #define MSM_CAMERA_FEATURE_SHUTDOWN (MSM_CAMERA_FEATURE_BASE + 1)
  45. #define MSM_CAMERA_STATUS_BASE 0x00020000
  46. #define MSM_CAMERA_STATUS_FAIL (MSM_CAMERA_STATUS_BASE + 1)
  47. #define MSM_CAMERA_STATUS_SUCCESS (MSM_CAMERA_STATUS_BASE + 2)
  48. /* event type */
  49. #define MSM_CAMERA_V4L2_EVENT_TYPE (V4L2_EVENT_PRIVATE_START + 0x00002000)
  50. /* event id */
  51. #define MSM_CAMERA_EVENT_MIN 0
  52. #define MSM_CAMERA_NEW_SESSION (MSM_CAMERA_EVENT_MIN + 1)
  53. #define MSM_CAMERA_DEL_SESSION (MSM_CAMERA_EVENT_MIN + 2)
  54. #define MSM_CAMERA_SET_PARM (MSM_CAMERA_EVENT_MIN + 3)
  55. #define MSM_CAMERA_GET_PARM (MSM_CAMERA_EVENT_MIN + 4)
  56. #define MSM_CAMERA_MAPPING_CFG (MSM_CAMERA_EVENT_MIN + 5)
  57. #define MSM_CAMERA_MAPPING_SES (MSM_CAMERA_EVENT_MIN + 6)
  58. #define MSM_CAMERA_MSM_NOTIFY (MSM_CAMERA_EVENT_MIN + 7)
  59. #define MSM_CAMERA_EVENT_MAX (MSM_CAMERA_EVENT_MIN + 8)
  60. /* data.command */
  61. #define MSM_CAMERA_PRIV_S_CROP (V4L2_CID_PRIVATE_BASE + 1)
  62. #define MSM_CAMERA_PRIV_G_CROP (V4L2_CID_PRIVATE_BASE + 2)
  63. #define MSM_CAMERA_PRIV_G_FMT (V4L2_CID_PRIVATE_BASE + 3)
  64. #define MSM_CAMERA_PRIV_S_FMT (V4L2_CID_PRIVATE_BASE + 4)
  65. #define MSM_CAMERA_PRIV_TRY_FMT (V4L2_CID_PRIVATE_BASE + 5)
  66. #define MSM_CAMERA_PRIV_METADATA (V4L2_CID_PRIVATE_BASE + 6)
  67. #define MSM_CAMERA_PRIV_QUERY_CAP (V4L2_CID_PRIVATE_BASE + 7)
  68. #define MSM_CAMERA_PRIV_STREAM_ON (V4L2_CID_PRIVATE_BASE + 8)
  69. #define MSM_CAMERA_PRIV_STREAM_OFF (V4L2_CID_PRIVATE_BASE + 9)
  70. #define MSM_CAMERA_PRIV_NEW_STREAM (V4L2_CID_PRIVATE_BASE + 10)
  71. #define MSM_CAMERA_PRIV_DEL_STREAM (V4L2_CID_PRIVATE_BASE + 11)
  72. #define MSM_CAMERA_PRIV_SHUTDOWN (V4L2_CID_PRIVATE_BASE + 12)
  73. #define MSM_CAMERA_PRIV_STREAM_INFO_SYNC \
  74. (V4L2_CID_PRIVATE_BASE + 13)
  75. /* data.status - success */
  76. #define MSM_CAMERA_CMD_SUCESS 0x00000001
  77. #define MSM_CAMERA_BUF_MAP_SUCESS 0x00000002
  78. /* data.status - error */
  79. #define MSM_CAMERA_ERR_EVT_BASE 0x00010000
  80. #define MSM_CAMERA_ERR_CMD_FAIL (MSM_CAMERA_ERR_EVT_BASE + 1)
  81. #define MSM_CAMERA_ERR_MAPPING (MSM_CAMERA_ERR_EVT_BASE + 2)
  82. /* The msm_v4l2_event_data structure should match the
  83. * v4l2_event.u.data field.
  84. * should not exceed 16 elements */
  85. struct msm_v4l2_event_data {
  86. /*word 0*/
  87. unsigned int command;
  88. /*word 1*/
  89. unsigned int status;
  90. /*word 2*/
  91. unsigned int session_id;
  92. /*word 3*/
  93. unsigned int stream_id;
  94. /*word 4*/
  95. unsigned int map_op;
  96. /*word 5*/
  97. unsigned int map_buf_idx;
  98. /*word 6*/
  99. unsigned int notify;
  100. /*word 7*/
  101. unsigned int arg_value;
  102. /*word 8*/
  103. unsigned int ret_value;
  104. /*word 9*/
  105. unsigned int nop3;
  106. /*word 10*/
  107. unsigned int nop4;
  108. /*word 11*/
  109. unsigned int nop5;
  110. /*word 12*/
  111. unsigned int nop6;
  112. /*word 13*/
  113. unsigned int nop7;
  114. /*word 14*/
  115. unsigned int nop8;
  116. /*word 15*/
  117. unsigned int nop9;
  118. };
  119. /* map to v4l2_format.fmt.raw_data */
  120. struct msm_v4l2_format_data {
  121. enum v4l2_buf_type type;
  122. unsigned int width;
  123. unsigned int height;
  124. unsigned int pixelformat; /* FOURCC */
  125. unsigned char num_planes;
  126. unsigned int plane_sizes[VIDEO_MAX_PLANES];
  127. };
  128. /* MSM Four-character-code (FOURCC) */
  129. #define msm_v4l2_fourcc(a, b, c, d)\
  130. ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) |\
  131. ((__u32)(d) << 24))
  132. /* Composite stats */
  133. #define MSM_V4L2_PIX_FMT_STATS_COMB v4l2_fourcc('S', 'T', 'C', 'M')
  134. /* AEC stats */
  135. #define MSM_V4L2_PIX_FMT_STATS_AE v4l2_fourcc('S', 'T', 'A', 'E')
  136. /* AF stats */
  137. #define MSM_V4L2_PIX_FMT_STATS_AF v4l2_fourcc('S', 'T', 'A', 'F')
  138. /* AWB stats */
  139. #define MSM_V4L2_PIX_FMT_STATS_AWB v4l2_fourcc('S', 'T', 'W', 'B')
  140. /* IHIST stats */
  141. #define MSM_V4L2_PIX_FMT_STATS_IHST v4l2_fourcc('I', 'H', 'S', 'T')
  142. /* Column count stats */
  143. #define MSM_V4L2_PIX_FMT_STATS_CS v4l2_fourcc('S', 'T', 'C', 'S')
  144. /* Row count stats */
  145. #define MSM_V4L2_PIX_FMT_STATS_RS v4l2_fourcc('S', 'T', 'R', 'S')
  146. /* Bayer Grid stats */
  147. #define MSM_V4L2_PIX_FMT_STATS_BG v4l2_fourcc('S', 'T', 'B', 'G')
  148. /* Bayer focus stats */
  149. #define MSM_V4L2_PIX_FMT_STATS_BF v4l2_fourcc('S', 'T', 'B', 'F')
  150. /* Bayer hist stats */
  151. #define MSM_V4L2_PIX_FMT_STATS_BHST v4l2_fourcc('B', 'H', 'S', 'T')
  152. #endif /* __LINUX_MSMB_CAMERA_H */