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_MODE_REALTIME_ENCODE 0 59 #define MSM_JPEG_MODE_OFFLINE_ENCODE 1 60 #define MSM_JPEG_MODE_REALTIME_ROTATION 2 61 #define MSM_JPEG_MODE_OFFLINE_ROTATION 3 62 63 struct msm_jpeg_ctrl_cmd { 64 uint32_t type; 65 uint32_t len; 66 void *value; 67 }; 68 69 #define MSM_JPEG_EVT_RESET 0 70 #define MSM_JPEG_EVT_SESSION_DONE 1 71 #define MSM_JPEG_EVT_ERR 2 72 73 struct msm_jpeg_buf { 74 uint32_t type; 75 int fd; 76 77 void *vaddr; 78 79 uint32_t y_off; 80 uint32_t y_len; 81 uint32_t framedone_len; 82 83 uint32_t cbcr_off; 84 uint32_t cbcr_len; 85 86 uint32_t num_of_mcu_rows; 87 uint32_t offset; 88 uint32_t pln2_off; 89 uint32_t pln2_len; 90 }; 91 92 #define MSM_JPEG_HW_CMD_TYPE_READ 0 93 #define MSM_JPEG_HW_CMD_TYPE_WRITE 1 94 #define MSM_JPEG_HW_CMD_TYPE_WRITE_OR 2 95 #define MSM_JPEG_HW_CMD_TYPE_UWAIT 3 96 #define MSM_JPEG_HW_CMD_TYPE_MWAIT 4 97 #define MSM_JPEG_HW_CMD_TYPE_MDELAY 5 98 #define MSM_JPEG_HW_CMD_TYPE_UDELAY 6 99 struct msm_jpeg_hw_cmd { 100 101 uint32_t type:4; 102 103 /* n microseconds of timeout for WAIT */ 104 /* n microseconds of time for DELAY */ 105 /* repeat n times for READ/WRITE */ 106 /* max is 0xFFF, 4095 */ 107 uint32_t n:12; 108 uint32_t offset:16; 109 uint32_t mask; 110 union { 111 uint32_t data; /* for single READ/WRITE/WAIT, n = 1 */ 112 uint32_t *pdata; /* for multiple READ/WRITE/WAIT, n > 1 */ 113 }; 114 }; 115 116 struct msm_jpeg_hw_cmds { 117 uint32_t m; /* number of elements in the hw_cmd array */ 118 struct msm_jpeg_hw_cmd hw_cmd[1]; 119 }; 120 121 #endif /* __LINUX_MSM_JPEG_H */ 122