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