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