blob: 84d9b4285b874460337ea2d0de95e672b88370a2 [file] [log] [blame]
Terence Hampsona6914ca2012-04-09 14:06:50 -04001/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#ifndef VCAP_FMT_H
15#define VCAP_FMT_H
Terence Hampsond75869e2012-09-21 11:13:04 -040016#include <linux/videodev2.h>
Terence Hampsona6914ca2012-04-09 14:06:50 -040017
Terence Hampson7d5bfbc2012-05-08 13:33:48 -040018#define V4L2_BUF_TYPE_INTERLACED_IN_DECODER (V4L2_BUF_TYPE_PRIVATE)
Terence Hampson98d11802012-06-06 18:18:43 -040019
20#define VCAP_GENERIC_NOTIFY_EVENT 0
21#define VCAP_VC_PIX_ERR_EVENT 1
22#define VCAP_VC_LINE_ERR_EVENT 2
23#define VCAP_VC_VSYNC_ERR_EVENT 3
24#define VCAP_VC_NPL_OFLOW_ERR_EVENT 4
25#define VCAP_VC_LBUF_OFLOW_ERR_EVENT 5
26#define VCAP_VC_BUF_OVERWRITE_EVENT 6
Terence Hampsonaa64d3a2012-10-29 13:05:37 -040027#define VCAP_VC_VSYNC_SEQ_ERR 7
28#define VCAP_VP_REG_R_ERR_EVENT 8
29#define VCAP_VP_REG_W_ERR_EVENT 9
30#define VCAP_VP_IN_HEIGHT_ERR_EVENT 10
31#define VCAP_VP_IN_WIDTH_ERR_EVENT 11
32#define VCAP_VC_UNEXPECT_BUF_DONE 12
33#define VCAP_MAX_NOTIFY_EVENT 13
Terence Hampsona6914ca2012-04-09 14:06:50 -040034
35enum hal_vcap_mode {
36 HAL_VCAP_MODE_PRO = 0,
37 HAL_VCAP_MODE_INT,
38};
39
40enum hal_vcap_polar {
41 HAL_VCAP_POLAR_NEG = 0,
42 HAL_VCAP_POLAR_POS,
43};
44
45enum hal_vcap_color {
46 HAL_VCAP_YUV = 0,
47 HAL_VCAP_RGB,
48};
49
Terence Hampson3dff4ef2012-06-13 15:20:59 -040050enum nr_mode {
51 NR_DISABLE = 0,
52 NR_AUTO,
53 NR_MANUAL,
54};
55
56enum nr_decay_ratio {
57 NR_Decay_Ratio_26 = 0,
58 NR_Decay_Ratio_25,
59 NR_Decay_Ratio_24,
60 NR_Decay_Ratio_23,
61 NR_Decay_Ratio_22,
62 NR_Decay_Ratio_21,
63 NR_Decay_Ratio_20,
64 NR_Decay_Ratio_19,
65};
66
67struct nr_config {
68 uint8_t max_blend_ratio;
69 uint8_t scale_diff_ratio;
70 uint8_t diff_limit_ratio;
71 uint8_t scale_motion_ratio;
72 uint8_t blend_limit_ratio;
73};
74
75struct nr_param {
76 enum nr_mode mode;
77 enum nr_decay_ratio decay_ratio;
78 uint8_t window;
79 struct nr_config luma;
80 struct nr_config chroma;
81};
82
83#define VCAPIOC_NR_S_PARAMS _IOWR('V', (BASE_VIDIOC_PRIVATE+0), struct nr_param)
84
85#define VCAPIOC_NR_G_PARAMS _IOWR('V', (BASE_VIDIOC_PRIVATE+1), struct nr_param)
Terence Hampson2cba63f2012-08-21 10:54:38 -040086#define VCAPIOC_S_NUM_VC_BUF _IOWR('V', (BASE_VIDIOC_PRIVATE+2), int)
Terence Hampson3dff4ef2012-06-13 15:20:59 -040087
Terence Hampsona6914ca2012-04-09 14:06:50 -040088struct v4l2_format_vc_ext {
Terence Hampsona6914ca2012-04-09 14:06:50 -040089 enum hal_vcap_mode mode;
90 enum hal_vcap_polar h_polar;
91 enum hal_vcap_polar v_polar;
92 enum hal_vcap_polar d_polar;
93 enum hal_vcap_color color_space;
94
Terence Hampson779dc762012-06-07 15:59:27 -040095 uint32_t clk_freq;
96 uint32_t frame_rate;
Terence Hampsona6914ca2012-04-09 14:06:50 -040097 uint32_t vtotal;
98 uint32_t htotal;
99 uint32_t hactive_start;
100 uint32_t hactive_end;
101 uint32_t vactive_start;
102 uint32_t vactive_end;
103 uint32_t vsync_start;
104 uint32_t vsync_end;
105 uint32_t hsync_start;
106 uint32_t hsync_end;
107 uint32_t f2_vactive_start;
108 uint32_t f2_vactive_end;
109 uint32_t f2_vsync_h_start;
110 uint32_t f2_vsync_h_end;
111 uint32_t f2_vsync_v_start;
112 uint32_t f2_vsync_v_end;
Terence Hampson7d5bfbc2012-05-08 13:33:48 -0400113 uint32_t sizeimage;
114 uint32_t bytesperline;
115};
116
117enum vcap_type {
118 VC_TYPE,
119 VP_IN_TYPE,
120 VP_OUT_TYPE,
121};
122
Terence Hampsondf1d4de2012-11-05 17:06:02 -0500123enum vcap_stride {
124 VC_STRIDE_16,
125 VC_STRIDE_32,
126};
127
Terence Hampson7d5bfbc2012-05-08 13:33:48 -0400128struct vcap_priv_fmt {
129 enum vcap_type type;
Terence Hampsondf1d4de2012-11-05 17:06:02 -0500130 enum vcap_stride stride;
Terence Hampson7d5bfbc2012-05-08 13:33:48 -0400131 union {
132 struct v4l2_format_vc_ext timing;
Terence Hampsonaeb793e2012-05-11 11:41:16 -0400133 struct v4l2_pix_format pix;
Terence Hampson7d5bfbc2012-05-08 13:33:48 -0400134 /* Once VP is created there will be another type in here */
135 } u;
Terence Hampsona6914ca2012-04-09 14:06:50 -0400136};
137#endif