msm_jpeg.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #ifndef __LINUX_MSM_JPEG_H
  2. #define __LINUX_MSM_JPEG_H
  3. #include <linux/types.h>
  4. #include <linux/ioctl.h>
  5. #define OUTPUT_H2V1 0
  6. #define OUTPUT_H2V2 1
  7. #define OUTPUT_BYTE 6
  8. #define MSM_JPEG_IOCTL_MAGIC 'g'
  9. #define MSM_JPEG_IOCTL_GET_HW_VERSION \
  10. _IOW(MSM_JPEG_IOCTL_MAGIC, 1, struct msm_jpeg_hw_cmd *)
  11. #define MSM_JPEG_IOCTL_RESET \
  12. _IOW(MSM_JPEG_IOCTL_MAGIC, 2, struct msm_jpeg_ctrl_cmd *)
  13. #define MSM_JPEG_IOCTL_STOP \
  14. _IOW(MSM_JPEG_IOCTL_MAGIC, 3, struct msm_jpeg_hw_cmds *)
  15. #define MSM_JPEG_IOCTL_START \
  16. _IOW(MSM_JPEG_IOCTL_MAGIC, 4, struct msm_jpeg_hw_cmds *)
  17. #define MSM_JPEG_IOCTL_INPUT_BUF_ENQUEUE \
  18. _IOW(MSM_JPEG_IOCTL_MAGIC, 5, struct msm_jpeg_buf *)
  19. #define MSM_JPEG_IOCTL_INPUT_GET \
  20. _IOW(MSM_JPEG_IOCTL_MAGIC, 6, struct msm_jpeg_buf *)
  21. #define MSM_JPEG_IOCTL_INPUT_GET_UNBLOCK \
  22. _IOW(MSM_JPEG_IOCTL_MAGIC, 7, int)
  23. #define MSM_JPEG_IOCTL_OUTPUT_BUF_ENQUEUE \
  24. _IOW(MSM_JPEG_IOCTL_MAGIC, 8, struct msm_jpeg_buf *)
  25. #define MSM_JPEG_IOCTL_OUTPUT_GET \
  26. _IOW(MSM_JPEG_IOCTL_MAGIC, 9, struct msm_jpeg_buf *)
  27. #define MSM_JPEG_IOCTL_OUTPUT_GET_UNBLOCK \
  28. _IOW(MSM_JPEG_IOCTL_MAGIC, 10, int)
  29. #define MSM_JPEG_IOCTL_EVT_GET \
  30. _IOW(MSM_JPEG_IOCTL_MAGIC, 11, struct msm_jpeg_ctrl_cmd *)
  31. #define MSM_JPEG_IOCTL_EVT_GET_UNBLOCK \
  32. _IOW(MSM_JPEG_IOCTL_MAGIC, 12, int)
  33. #define MSM_JPEG_IOCTL_HW_CMD \
  34. _IOW(MSM_JPEG_IOCTL_MAGIC, 13, struct msm_jpeg_hw_cmd *)
  35. #define MSM_JPEG_IOCTL_HW_CMDS \
  36. _IOW(MSM_JPEG_IOCTL_MAGIC, 14, struct msm_jpeg_hw_cmds *)
  37. #define MSM_JPEG_IOCTL_TEST_DUMP_REGION \
  38. _IOW(MSM_JPEG_IOCTL_MAGIC, 15, unsigned long)
  39. #define MSM_JPEG_MODE_REALTIME_ENCODE 0
  40. #define MSM_JPEG_MODE_OFFLINE_ENCODE 1
  41. #define MSM_JPEG_MODE_REALTIME_ROTATION 2
  42. #define MSM_JPEG_MODE_OFFLINE_ROTATION 3
  43. struct msm_jpeg_ctrl_cmd {
  44. uint32_t type;
  45. uint32_t len;
  46. void *value;
  47. };
  48. #define MSM_JPEG_EVT_RESET 0
  49. #define MSM_JPEG_EVT_SESSION_DONE 1
  50. #define MSM_JPEG_EVT_ERR 2
  51. struct msm_jpeg_buf {
  52. uint32_t type;
  53. int fd;
  54. void *vaddr;
  55. uint32_t y_off;
  56. uint32_t y_len;
  57. uint32_t framedone_len;
  58. uint32_t cbcr_off;
  59. uint32_t cbcr_len;
  60. uint32_t num_of_mcu_rows;
  61. uint32_t offset;
  62. uint32_t pln2_off;
  63. uint32_t pln2_len;
  64. };
  65. #define MSM_JPEG_HW_CMD_TYPE_READ 0
  66. #define MSM_JPEG_HW_CMD_TYPE_WRITE 1
  67. #define MSM_JPEG_HW_CMD_TYPE_WRITE_OR 2
  68. #define MSM_JPEG_HW_CMD_TYPE_UWAIT 3
  69. #define MSM_JPEG_HW_CMD_TYPE_MWAIT 4
  70. #define MSM_JPEG_HW_CMD_TYPE_MDELAY 5
  71. #define MSM_JPEG_HW_CMD_TYPE_UDELAY 6
  72. struct msm_jpeg_hw_cmd {
  73. uint32_t type:4;
  74. /* n microseconds of timeout for WAIT */
  75. /* n microseconds of time for DELAY */
  76. /* repeat n times for READ/WRITE */
  77. /* max is 0xFFF, 4095 */
  78. uint32_t n:12;
  79. uint32_t offset:16;
  80. uint32_t mask;
  81. union {
  82. uint32_t data; /* for single READ/WRITE/WAIT, n = 1 */
  83. uint32_t *pdata; /* for multiple READ/WRITE/WAIT, n > 1 */
  84. };
  85. };
  86. struct msm_jpeg_hw_cmds {
  87. uint32_t m; /* number of elements in the hw_cmd array */
  88. struct msm_jpeg_hw_cmd hw_cmd[1];
  89. };
  90. #endif /* __LINUX_MSM_JPEG_H */