1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#ifndef _ADV7842_
22#define _ADV7842_
23
24
25enum adv7842_ain_sel {
26 ADV7842_AIN1_2_3_NC_SYNC_1_2 = 0,
27 ADV7842_AIN4_5_6_NC_SYNC_2_1 = 1,
28 ADV7842_AIN7_8_9_NC_SYNC_3_1 = 2,
29 ADV7842_AIN10_11_12_NC_SYNC_4_1 = 3,
30 ADV7842_AIN9_4_5_6_SYNC_2_1 = 4,
31};
32
33
34
35
36
37
38enum adv7842_bus_order {
39 ADV7842_BUS_ORDER_RGB,
40 ADV7842_BUS_ORDER_GRB,
41 ADV7842_BUS_ORDER_RBG,
42 ADV7842_BUS_ORDER_BGR,
43 ADV7842_BUS_ORDER_BRG,
44 ADV7842_BUS_ORDER_GBR,
45};
46
47
48enum adv7842_inp_color_space {
49 ADV7842_INP_COLOR_SPACE_LIM_RGB = 0,
50 ADV7842_INP_COLOR_SPACE_FULL_RGB = 1,
51 ADV7842_INP_COLOR_SPACE_LIM_YCbCr_601 = 2,
52 ADV7842_INP_COLOR_SPACE_LIM_YCbCr_709 = 3,
53 ADV7842_INP_COLOR_SPACE_XVYCC_601 = 4,
54 ADV7842_INP_COLOR_SPACE_XVYCC_709 = 5,
55 ADV7842_INP_COLOR_SPACE_FULL_YCbCr_601 = 6,
56 ADV7842_INP_COLOR_SPACE_FULL_YCbCr_709 = 7,
57 ADV7842_INP_COLOR_SPACE_AUTO = 0xf,
58};
59
60
61enum adv7842_op_format_mode_sel {
62 ADV7842_OP_FORMAT_MODE0 = 0x00,
63 ADV7842_OP_FORMAT_MODE1 = 0x04,
64 ADV7842_OP_FORMAT_MODE2 = 0x08,
65};
66
67
68enum adv7842_mode {
69 ADV7842_MODE_SDP,
70 ADV7842_MODE_COMP,
71 ADV7842_MODE_RGB,
72 ADV7842_MODE_HDMI
73};
74
75
76enum adv7842_vid_std_select {
77
78 ADV7842_SDP_VID_STD_CVBS_SD_4x1 = 0x01,
79 ADV7842_SDP_VID_STD_YC_SD4_x1 = 0x09,
80
81 ADV7842_RGB_VID_STD_AUTO_GRAPH_MODE = 0x07,
82
83 ADV7842_HDMI_GR_VID_STD_AUTO_GRAPH_MODE = 0x02,
84
85 ADV7842_HDMI_COMP_VID_STD_HD_1250P = 0x1e,
86};
87
88enum adv7842_select_input {
89 ADV7842_SELECT_HDMI_PORT_A,
90 ADV7842_SELECT_HDMI_PORT_B,
91 ADV7842_SELECT_VGA_RGB,
92 ADV7842_SELECT_VGA_COMP,
93 ADV7842_SELECT_SDP_CVBS,
94 ADV7842_SELECT_SDP_YC,
95};
96
97enum adv7842_drive_strength {
98 ADV7842_DR_STR_LOW = 0,
99 ADV7842_DR_STR_MEDIUM_LOW = 1,
100 ADV7842_DR_STR_MEDIUM_HIGH = 2,
101 ADV7842_DR_STR_HIGH = 3,
102};
103
104struct adv7842_sdp_csc_coeff {
105 bool manual;
106 u16 scaling;
107 u16 A1;
108 u16 A2;
109 u16 A3;
110 u16 A4;
111 u16 B1;
112 u16 B2;
113 u16 B3;
114 u16 B4;
115 u16 C1;
116 u16 C2;
117 u16 C3;
118 u16 C4;
119};
120
121struct adv7842_sdp_io_sync_adjustment {
122 bool adjust;
123 u16 hs_beg;
124 u16 hs_width;
125 u16 de_beg;
126 u16 de_end;
127 u8 vs_beg_o;
128 u8 vs_beg_e;
129 u8 vs_end_o;
130 u8 vs_end_e;
131 u8 de_v_beg_o;
132 u8 de_v_beg_e;
133 u8 de_v_end_o;
134 u8 de_v_end_e;
135};
136
137
138struct adv7842_platform_data {
139
140 unsigned chip_reset:1;
141
142
143 unsigned disable_pwrdnb:1;
144
145
146 unsigned disable_cable_det_rst:1;
147
148
149 enum adv7842_ain_sel ain_sel;
150
151
152 enum adv7842_bus_order bus_order;
153
154
155 enum adv7842_op_format_mode_sel op_format_mode_sel;
156
157
158 enum adv7842_mode mode;
159
160
161 unsigned input;
162
163
164 enum adv7842_vid_std_select vid_std_select;
165
166
167 unsigned alt_gamma:1;
168 unsigned op_656_range:1;
169 unsigned alt_data_sat:1;
170
171
172 unsigned blank_data:1;
173 unsigned insert_av_codes:1;
174 unsigned replicate_av_codes:1;
175
176
177 unsigned output_bus_lsb_to_msb:1;
178
179
180 enum adv7842_drive_strength dr_str_data;
181 enum adv7842_drive_strength dr_str_clk;
182 enum adv7842_drive_strength dr_str_sync;
183
184
185
186
187
188 unsigned llc_dll_phase:5;
189
190
191 unsigned sd_ram_size;
192 unsigned sd_ram_ddr:1;
193
194
195 unsigned hdmi_free_run_enable:1;
196
197
198
199 unsigned hdmi_free_run_mode:1;
200
201
202 unsigned sdp_free_run_auto:1;
203 unsigned sdp_free_run_man_col_en:1;
204 unsigned sdp_free_run_cbar_en:1;
205 unsigned sdp_free_run_force:1;
206
207
208 unsigned hpa_auto:1;
209
210 struct adv7842_sdp_csc_coeff sdp_csc_coeff;
211
212 struct adv7842_sdp_io_sync_adjustment sdp_io_sync_625;
213 struct adv7842_sdp_io_sync_adjustment sdp_io_sync_525;
214
215
216 u8 i2c_sdp_io;
217 u8 i2c_sdp;
218 u8 i2c_cp;
219 u8 i2c_vdp;
220 u8 i2c_afe;
221 u8 i2c_hdmi;
222 u8 i2c_repeater;
223 u8 i2c_edid;
224 u8 i2c_infoframe;
225 u8 i2c_cec;
226 u8 i2c_avlink;
227};
228
229#define V4L2_CID_ADV_RX_ANALOG_SAMPLING_PHASE (V4L2_CID_DV_CLASS_BASE + 0x1000)
230#define V4L2_CID_ADV_RX_FREE_RUN_COLOR_MANUAL (V4L2_CID_DV_CLASS_BASE + 0x1001)
231#define V4L2_CID_ADV_RX_FREE_RUN_COLOR (V4L2_CID_DV_CLASS_BASE + 0x1002)
232
233
234
235#define ADV7842_CMD_RAM_TEST _IO('V', BASE_VIDIOC_PRIVATE)
236
237#define ADV7842_EDID_PORT_A 0
238#define ADV7842_EDID_PORT_B 1
239#define ADV7842_EDID_PORT_VGA 2
240#define ADV7842_PAD_SOURCE 3
241
242#endif
243