diff options
author | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2005-06-24 01:05:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-24 03:06:39 -0400 |
commit | b45009b0288a96a3458f4f8e93cb776678d41875 (patch) | |
tree | c912e8d3dcc625fe92cdd1bac97bab7539fce4d7 /drivers/media/video/cx88/cx88-blackbird.c | |
parent | 2d03e289ea4b13d78ce55f1ea0b0d45b8f1b34c3 (diff) |
[PATCH] v4l: CX88 cards update
This patch adds support for various CX88 cards and allows specifying
card addresses.
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Michael Krufky <mkrufky@m1k.net>
Signed-off-by: cybercide@f2s.com <cybercide@f2s.com>
Signed-off-by: Catalin Climov <catalin@climov.com>
Signed-off-by: Nickolay V Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/video/cx88/cx88-blackbird.c')
-rw-r--r-- | drivers/media/video/cx88/cx88-blackbird.c | 488 |
1 files changed, 402 insertions, 86 deletions
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 46d6778b863b..91f8afeded88 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-blackbird.c,v 1.26 2005/03/07 15:58:05 kraxel Exp $ | 2 | * $Id: cx88-blackbird.c,v 1.27 2005/06/03 13:31:50 mchehab Exp $ |
3 | * | 3 | * |
4 | * Support for a cx23416 mpeg encoder via cx2388x host port. | 4 | * Support for a cx23416 mpeg encoder via cx2388x host port. |
5 | * "blackbird" reference design. | 5 | * "blackbird" reference design. |
@@ -61,37 +61,304 @@ static LIST_HEAD(cx8802_devlist); | |||
61 | 61 | ||
62 | #define IVTV_CMD_HW_BLOCKS_RST 0xFFFFFFFF | 62 | #define IVTV_CMD_HW_BLOCKS_RST 0xFFFFFFFF |
63 | 63 | ||
64 | /*Firmware API commands*/ | 64 | /* Firmware API commands */ |
65 | #define IVTV_API_ENC_PING_FW 0x00000080 | 65 | /* #define IVTV_API_STD_TIMEOUT 0x00010000 // 65536, units?? */ |
66 | #define IVTV_API_ENC_GETVER 0x000000C4 | 66 | #define IVTV_API_STD_TIMEOUT 500 |
67 | #define IVTV_API_ENC_HALT_FW 0x000000C3 | 67 | |
68 | #define IVTV_API_STD_TIMEOUT 0x00010000 /*units??*/ | 68 | #define BLACKBIRD_API_PING 0x80 |
69 | //#define IVTV_API_ASSIGN_PGM_INDEX_INFO 0x000000c7 | 69 | #define BLACKBIRD_API_BEGIN_CAPTURE 0x81 |
70 | #define IVTV_API_ASSIGN_STREAM_TYPE 0x000000b9 | 70 | enum blackbird_capture_type { |
71 | #define IVTV_API_ASSIGN_OUTPUT_PORT 0x000000bb | 71 | BLACKBIRD_MPEG_CAPTURE, |
72 | #define IVTV_API_ASSIGN_FRAMERATE 0x0000008f | 72 | BLACKBIRD_RAW_CAPTURE, |
73 | #define IVTV_API_ASSIGN_FRAME_SIZE 0x00000091 | 73 | BLACKBIRD_RAW_PASSTHRU_CAPTURE |
74 | #define IVTV_API_ASSIGN_ASPECT_RATIO 0x00000099 | 74 | }; |
75 | #define IVTV_API_ASSIGN_BITRATES 0x00000095 | 75 | enum blackbird_capture_bits { |
76 | #define IVTV_API_ASSIGN_GOP_PROPERTIES 0x00000097 | 76 | BLACKBIRD_RAW_BITS_NONE = 0x00, |
77 | #define IVTV_API_ASSIGN_3_2_PULLDOWN 0x000000b1 | 77 | BLACKBIRD_RAW_BITS_YUV_CAPTURE = 0x01, |
78 | #define IVTV_API_ASSIGN_GOP_CLOSURE 0x000000c5 | 78 | BLACKBIRD_RAW_BITS_PCM_CAPTURE = 0x02, |
79 | #define IVTV_API_ASSIGN_AUDIO_PROPERTIES 0x000000bd | 79 | BLACKBIRD_RAW_BITS_VBI_CAPTURE = 0x04, |
80 | #define IVTV_API_ASSIGN_DNR_FILTER_MODE 0x0000009b | 80 | BLACKBIRD_RAW_BITS_PASSTHRU_CAPTURE = 0x08, |
81 | #define IVTV_API_ASSIGN_DNR_FILTER_PROPS 0x0000009d | 81 | BLACKBIRD_RAW_BITS_TO_HOST_CAPTURE = 0x10 |
82 | #define IVTV_API_ASSIGN_CORING_LEVELS 0x0000009f | 82 | }; |
83 | #define IVTV_API_ASSIGN_SPATIAL_FILTER_TYPE 0x000000a1 | 83 | #define BLACKBIRD_API_END_CAPTURE 0x82 |
84 | #define IVTV_API_ASSIGN_FRAME_DROP_RATE 0x000000d0 | 84 | enum blackbird_capture_end { |
85 | #define IVTV_API_ASSIGN_PLACEHOLDER 0x000000d8 | 85 | BLACKBIRD_END_AT_GOP, /* stop at the end of gop, generate irq */ |
86 | #define IVTV_API_MUTE_VIDEO 0x000000d9 | 86 | BLACKBIRD_END_NOW, /* stop immediately, no irq */ |
87 | #define IVTV_API_MUTE_AUDIO 0x000000da | 87 | }; |
88 | #define IVTV_API_INITIALIZE_INPUT 0x000000cd | 88 | #define BLACKBIRD_API_SET_AUDIO_ID 0x89 |
89 | #define IVTV_API_REFRESH_INPUT 0x000000d3 | 89 | #define BLACKBIRD_API_SET_VIDEO_ID 0x8B |
90 | #define IVTV_API_ASSIGN_NUM_VSYNC_LINES 0x000000d6 | 90 | #define BLACKBIRD_API_SET_PCR_ID 0x8D |
91 | #define IVTV_API_BEGIN_CAPTURE 0x00000081 | 91 | #define BLACKBIRD_API_SET_FRAMERATE 0x8F |
92 | //#define IVTV_API_PAUSE_ENCODER 0x000000d2 | 92 | enum blackbird_framerate { |
93 | //#define IVTV_API_EVENT_NOTIFICATION 0x000000d5 | 93 | BLACKBIRD_FRAMERATE_NTSC_30, /* NTSC: 30fps */ |
94 | #define IVTV_API_END_CAPTURE 0x00000082 | 94 | BLACKBIRD_FRAMERATE_PAL_25 /* PAL: 25fps */ |
95 | }; | ||
96 | #define BLACKBIRD_API_SET_RESOLUTION 0x91 | ||
97 | #define BLACKBIRD_API_SET_VIDEO_BITRATE 0x95 | ||
98 | enum blackbird_video_bitrate_type { | ||
99 | BLACKBIRD_VIDEO_VBR, | ||
100 | BLACKBIRD_VIDEO_CBR | ||
101 | }; | ||
102 | #define BLACKBIRD_PEAK_RATE_DIVISOR 400 | ||
103 | enum blackbird_mux_rate { | ||
104 | BLACKBIRD_MUX_RATE_DEFAULT, | ||
105 | /* dvd mux rate: multiply by 400 to get the actual rate */ | ||
106 | BLACKBIRD_MUX_RATE_DVD = 25200 | ||
107 | }; | ||
108 | #define BLACKBIRD_API_SET_GOP_STRUCTURE 0x97 | ||
109 | #define BLACKBIRD_API_SET_ASPECT_RATIO 0x99 | ||
110 | enum blackbird_aspect_ratio { | ||
111 | BLACKBIRD_ASPECT_RATIO_FORBIDDEN, | ||
112 | BLACKBIRD_ASPECT_RATIO_1_1_SQUARE, | ||
113 | BLACKBIRD_ASPECT_RATIO_4_3, | ||
114 | BLACKBIRD_ASPECT_RATIO_16_9, | ||
115 | BLACKBIRD_ASPECT_RATIO_221_100, | ||
116 | BLACKBIRD_ASPECT_RATIO_RESERVED | ||
117 | }; | ||
118 | #define BLACKBIRD_API_SET_DNR_MODE 0x9B | ||
119 | enum blackbird_dnr_bits { | ||
120 | BLACKBIRD_DNR_BITS_MANUAL, | ||
121 | BLACKBIRD_DNR_BITS_AUTO_SPATIAL, | ||
122 | BLACKBIRD_DNR_BITS_AUTO_TEMPORAL, | ||
123 | BLACKBIRD_DNR_BITS_AUTO | ||
124 | }; | ||
125 | enum blackbird_median_filter { | ||
126 | BLACKBIRD_MEDIAN_FILTER_DISABLED, | ||
127 | BLACKBIRD_MEDIAN_FILTER_HORIZONTAL, | ||
128 | BLACKBIRD_MEDIAN_FILTER_VERTICAL, | ||
129 | BLACKBIRD_MEDIAN_FILTER_HV, | ||
130 | BLACKBIRD_MEDIAN_FILTER_DIAGONAL | ||
131 | }; | ||
132 | #define BLACKBIRD_API_SET_MANUAL_DNR 0x9D | ||
133 | #define BLACKBIRD_API_SET_DNR_MEDIAN 0x9F | ||
134 | #define BLACKBIRD_API_SET_SPATIAL_FILTER 0xA1 | ||
135 | enum blackbird_spatial_filter_luma { | ||
136 | BLACKBIRD_SPATIAL_FILTER_LUMA_DISABLED, | ||
137 | BLACKBIRD_SPATIAL_FILTER_LUMA_1D_HORIZ, | ||
138 | BLACKBIRD_SPATIAL_FILTER_LUMA_1D_VERT, | ||
139 | BLACKBIRD_SPATIAL_FILTER_LUMA_2D_HV, /* separable, default */ | ||
140 | BLACKBIRD_SPATIAL_FILTER_LUMA_2D_SYMM /* symmetric non-separable */ | ||
141 | }; | ||
142 | enum blackbird_spatial_filter_chroma { | ||
143 | BLACKBIRD_SPATIAL_FILTER_CHROMA_DISABLED, | ||
144 | BLACKBIRD_SPATIAL_FILTER_CHROMA_1D_HORIZ /* default */ | ||
145 | }; | ||
146 | #define BLACKBIRD_API_SET_3_2_PULLDOWN 0xB1 | ||
147 | enum blackbird_pulldown { | ||
148 | BLACKBIRD_3_2_PULLDOWN_DISABLED, | ||
149 | BLACKBIRD_3_2_PULLDOWN_ENABLED | ||
150 | }; | ||
151 | #define BLACKBIRD_API_SET_VBI_LINE_NO 0xB7 | ||
152 | enum blackbird_vbi_line_bits { | ||
153 | BLACKBIRD_VBI_LINE_BITS_TOP_FIELD, | ||
154 | BLACKBIRD_VBI_LINE_BITS_BOT_FIELD = (1 << 31), | ||
155 | BLACKBIRD_VBI_LINE_BITS_ALL_LINES = 0xFFFFFFFF | ||
156 | }; | ||
157 | enum blackbird_vbi_line { | ||
158 | BLACKBIRD_VBI_LINE_DISABLED, | ||
159 | BLACKBIRD_VBI_LINE_ENABLED | ||
160 | }; | ||
161 | enum blackbird_vbi_slicing { | ||
162 | BLACKBIRD_VBI_SLICING_NONE, | ||
163 | BLACKBIRD_VBI_SLICING_CLOSED_CAPTION | ||
164 | }; | ||
165 | #define BLACKBIRD_API_SET_STREAM_TYPE 0xB9 | ||
166 | enum blackbird_stream_type { | ||
167 | BLACKBIRD_STREAM_PROGRAM, | ||
168 | BLACKBIRD_STREAM_TRANSPORT, | ||
169 | BLACKBIRD_STREAM_MPEG1, | ||
170 | BLACKBIRD_STREAM_PES_AV, | ||
171 | BLACKBIRD_STREAM_UNKNOWN4, | ||
172 | BLACKBIRD_STREAM_PES_VIDEO, | ||
173 | BLACKBIRD_STREAM_UNKNOWN6, | ||
174 | BLACKBIRD_STREAM_PES_AUDIO, | ||
175 | BLACKBIRD_STREAM_UNKNOWN8, | ||
176 | BLACKBIRD_STREAM_UNKNOWN9, /* audio/pcm ? */ | ||
177 | BLACKBIRD_STREAM_DVD, | ||
178 | BLACKBIRD_STREAM_VCD, | ||
179 | BLACKBIRD_STREAM_UNKNOWN12 /* svcd/xvcd ? */ | ||
180 | }; | ||
181 | #define BLACKBIRD_API_SET_OUTPUT_PORT 0xBB | ||
182 | enum blackbird_stream_port { | ||
183 | BLACKBIRD_OUTPUT_PORT_MEMORY, | ||
184 | BLACKBIRD_OUTPUT_PORT_STREAMING, | ||
185 | BLACKBIRD_OUTPUT_PORT_SERIAL | ||
186 | }; | ||
187 | #define BLACKBIRD_API_SET_AUDIO_PARAMS 0xBD | ||
188 | enum blackbird_audio_bits_sample_rate { | ||
189 | BLACKBIRD_AUDIO_BITS_44100HZ, | ||
190 | BLACKBIRD_AUDIO_BITS_48000HZ, | ||
191 | BLACKBIRD_AUDIO_BITS_32000HZ, | ||
192 | BLACKBIRD_AUDIO_BITS_RESERVED_HZ, | ||
193 | }; | ||
194 | enum blackbird_audio_bits_encoding { | ||
195 | BLACKBIRD_AUDIO_BITS_LAYER_1 = 0x1 << 2, | ||
196 | BLACKBIRD_AUDIO_BITS_LAYER_2 = 0x2 << 2, | ||
197 | }; | ||
198 | enum blackbird_audio_bits_bitrate_layer_1 { | ||
199 | BLACKBIRD_AUDIO_BITS_LAYER_1_FREE_FORMAT, | ||
200 | BLACKBIRD_AUDIO_BITS_LAYER_1_32 = 0x01 << 4, | ||
201 | BLACKBIRD_AUDIO_BITS_LAYER_1_64 = 0x02 << 4, | ||
202 | BLACKBIRD_AUDIO_BITS_LAYER_1_96 = 0x03 << 4, | ||
203 | BLACKBIRD_AUDIO_BITS_LAYER_1_128 = 0x04 << 4, | ||
204 | BLACKBIRD_AUDIO_BITS_LAYER_1_160 = 0x05 << 4, | ||
205 | BLACKBIRD_AUDIO_BITS_LAYER_1_192 = 0x06 << 4, | ||
206 | BLACKBIRD_AUDIO_BITS_LAYER_1_224 = 0x07 << 4, | ||
207 | BLACKBIRD_AUDIO_BITS_LAYER_1_256 = 0x08 << 4, | ||
208 | BLACKBIRD_AUDIO_BITS_LAYER_1_288 = 0x09 << 4, | ||
209 | BLACKBIRD_AUDIO_BITS_LAYER_1_320 = 0x0A << 4, | ||
210 | BLACKBIRD_AUDIO_BITS_LAYER_1_352 = 0x0B << 4, | ||
211 | BLACKBIRD_AUDIO_BITS_LAYER_1_384 = 0x0C << 4, | ||
212 | BLACKBIRD_AUDIO_BITS_LAYER_1_416 = 0x0D << 4, | ||
213 | BLACKBIRD_AUDIO_BITS_LAYER_1_448 = 0x0E << 4, | ||
214 | }; | ||
215 | enum blackbird_audio_bits_bitrate_layer_2 { | ||
216 | BLACKBIRD_AUDIO_BITS_LAYER_2_FREE_FORMAT, | ||
217 | BLACKBIRD_AUDIO_BITS_LAYER_2_32 = 0x01 << 4, | ||
218 | BLACKBIRD_AUDIO_BITS_LAYER_2_48 = 0x02 << 4, | ||
219 | BLACKBIRD_AUDIO_BITS_LAYER_2_56 = 0x03 << 4, | ||
220 | BLACKBIRD_AUDIO_BITS_LAYER_2_64 = 0x04 << 4, | ||
221 | BLACKBIRD_AUDIO_BITS_LAYER_2_80 = 0x05 << 4, | ||
222 | BLACKBIRD_AUDIO_BITS_LAYER_2_96 = 0x06 << 4, | ||
223 | BLACKBIRD_AUDIO_BITS_LAYER_2_112 = 0x07 << 4, | ||
224 | BLACKBIRD_AUDIO_BITS_LAYER_2_128 = 0x08 << 4, | ||
225 | BLACKBIRD_AUDIO_BITS_LAYER_2_160 = 0x09 << 4, | ||
226 | BLACKBIRD_AUDIO_BITS_LAYER_2_192 = 0x0A << 4, | ||
227 | BLACKBIRD_AUDIO_BITS_LAYER_2_224 = 0x0B << 4, | ||
228 | BLACKBIRD_AUDIO_BITS_LAYER_2_256 = 0x0C << 4, | ||
229 | BLACKBIRD_AUDIO_BITS_LAYER_2_320 = 0x0D << 4, | ||
230 | BLACKBIRD_AUDIO_BITS_LAYER_2_384 = 0x0E << 4, | ||
231 | }; | ||
232 | enum blackbird_audio_bits_mode { | ||
233 | BLACKBIRD_AUDIO_BITS_STEREO, | ||
234 | BLACKBIRD_AUDIO_BITS_JOINT_STEREO = 0x1 << 8, | ||
235 | BLACKBIRD_AUDIO_BITS_DUAL = 0x2 << 8, | ||
236 | BLACKBIRD_AUDIO_BITS_MONO = 0x3 << 8, | ||
237 | }; | ||
238 | enum blackbird_audio_bits_mode_extension { | ||
239 | BLACKBIRD_AUDIO_BITS_BOUND_4, | ||
240 | BLACKBIRD_AUDIO_BITS_BOUND_8 = 0x1 << 10, | ||
241 | BLACKBIRD_AUDIO_BITS_BOUND_12 = 0x2 << 10, | ||
242 | BLACKBIRD_AUDIO_BITS_BOUND_16 = 0x3 << 10, | ||
243 | }; | ||
244 | enum blackbird_audio_bits_emphasis { | ||
245 | BLACKBIRD_AUDIO_BITS_EMPHASIS_NONE, | ||
246 | BLACKBIRD_AUDIO_BITS_EMPHASIS_50_15 = 0x1 << 12, | ||
247 | BLACKBIRD_AUDIO_BITS_EMPHASIS_RESERVED = 0x2 << 12, | ||
248 | BLACKBIRD_AUDIO_BITS_EMPHASIS_CCITT_J17 = 0x3 << 12, | ||
249 | }; | ||
250 | enum blackbird_audio_bits_crc { | ||
251 | BLACKBIRD_AUDIO_BITS_CRC_OFF, | ||
252 | BLACKBIRD_AUDIO_BITS_CRC_ON = 0x1 << 14, | ||
253 | }; | ||
254 | enum blackbird_audio_bits_copyright { | ||
255 | BLACKBIRD_AUDIO_BITS_COPYRIGHT_OFF, | ||
256 | BLACKBIRD_AUDIO_BITS_COPYRIGHT_ON = 0x1 << 15, | ||
257 | }; | ||
258 | enum blackbird_audio_bits_original { | ||
259 | BLACKBIRD_AUDIO_BITS_COPY, | ||
260 | BLACKBIRD_AUDIO_BITS_ORIGINAL = 0x1 << 16, | ||
261 | }; | ||
262 | #define BLACKBIRD_API_HALT 0xC3 | ||
263 | #define BLACKBIRD_API_GET_VERSION 0xC4 | ||
264 | #define BLACKBIRD_API_SET_GOP_CLOSURE 0xC5 | ||
265 | enum blackbird_gop_closure { | ||
266 | BLACKBIRD_GOP_CLOSURE_OFF, | ||
267 | BLACKBIRD_GOP_CLOSURE_ON, | ||
268 | }; | ||
269 | #define BLACKBIRD_API_DATA_XFER_STATUS 0xC6 | ||
270 | enum blackbird_data_xfer_status { | ||
271 | BLACKBIRD_MORE_BUFFERS_FOLLOW, | ||
272 | BLACKBIRD_LAST_BUFFER, | ||
273 | }; | ||
274 | #define BLACKBIRD_API_PROGRAM_INDEX_INFO 0xC7 | ||
275 | enum blackbird_picture_mask { | ||
276 | BLACKBIRD_PICTURE_MASK_NONE, | ||
277 | BLACKBIRD_PICTURE_MASK_I_FRAMES, | ||
278 | BLACKBIRD_PICTURE_MASK_I_P_FRAMES = 0x3, | ||
279 | BLACKBIRD_PICTURE_MASK_ALL_FRAMES = 0x7, | ||
280 | }; | ||
281 | #define BLACKBIRD_API_SET_VBI_PARAMS 0xC8 | ||
282 | enum blackbird_vbi_mode_bits { | ||
283 | BLACKBIRD_VBI_BITS_SLICED, | ||
284 | BLACKBIRD_VBI_BITS_RAW, | ||
285 | }; | ||
286 | enum blackbird_vbi_insertion_bits { | ||
287 | BLACKBIRD_VBI_BITS_INSERT_IN_XTENSION_USR_DATA, | ||
288 | BLACKBIRD_VBI_BITS_INSERT_IN_PRIVATE_PACKETS = 0x1 << 1, | ||
289 | BLACKBIRD_VBI_BITS_SEPARATE_STREAM = 0x2 << 1, | ||
290 | BLACKBIRD_VBI_BITS_SEPARATE_STREAM_USR_DATA = 0x4 << 1, | ||
291 | BLACKBIRD_VBI_BITS_SEPARATE_STREAM_PRV_DATA = 0x5 << 1, | ||
292 | }; | ||
293 | #define BLACKBIRD_API_SET_DMA_BLOCK_SIZE 0xC9 | ||
294 | enum blackbird_dma_unit { | ||
295 | BLACKBIRD_DMA_BYTES, | ||
296 | BLACKBIRD_DMA_FRAMES, | ||
297 | }; | ||
298 | #define BLACKBIRD_API_DMA_TRANSFER_INFO 0xCA | ||
299 | #define BLACKBIRD_API_DMA_TRANSFER_STAT 0xCB | ||
300 | enum blackbird_dma_transfer_status_bits { | ||
301 | BLACKBIRD_DMA_TRANSFER_BITS_DONE = 0x01, | ||
302 | BLACKBIRD_DMA_TRANSFER_BITS_ERROR = 0x04, | ||
303 | BLACKBIRD_DMA_TRANSFER_BITS_LL_ERROR = 0x10, | ||
304 | }; | ||
305 | #define BLACKBIRD_API_SET_DMA2HOST_ADDR 0xCC | ||
306 | #define BLACKBIRD_API_INIT_VIDEO_INPUT 0xCD | ||
307 | #define BLACKBIRD_API_SET_FRAMESKIP 0xD0 | ||
308 | #define BLACKBIRD_API_PAUSE 0xD2 | ||
309 | enum blackbird_pause { | ||
310 | BLACKBIRD_PAUSE_ENCODING, | ||
311 | BLACKBIRD_RESUME_ENCODING, | ||
312 | }; | ||
313 | #define BLACKBIRD_API_REFRESH_INPUT 0xD3 | ||
314 | #define BLACKBIRD_API_SET_COPYRIGHT 0xD4 | ||
315 | enum blackbird_copyright { | ||
316 | BLACKBIRD_COPYRIGHT_OFF, | ||
317 | BLACKBIRD_COPYRIGHT_ON, | ||
318 | }; | ||
319 | #define BLACKBIRD_API_SET_NOTIFICATION 0xD5 | ||
320 | enum blackbird_notification_type { | ||
321 | BLACKBIRD_NOTIFICATION_REFRESH, | ||
322 | }; | ||
323 | enum blackbird_notification_status { | ||
324 | BLACKBIRD_NOTIFICATION_OFF, | ||
325 | BLACKBIRD_NOTIFICATION_ON, | ||
326 | }; | ||
327 | enum blackbird_notification_mailbox { | ||
328 | BLACKBIRD_NOTIFICATION_NO_MAILBOX = -1, | ||
329 | }; | ||
330 | #define BLACKBIRD_API_SET_CAPTURE_LINES 0xD6 | ||
331 | enum blackbird_field1_lines { | ||
332 | BLACKBIRD_FIELD1_SAA7114 = 0x00EF, /* 239 */ | ||
333 | BLACKBIRD_FIELD1_SAA7115 = 0x00F0, /* 240 */ | ||
334 | BLACKBIRD_FIELD1_MICRONAS = 0x0105, /* 261 */ | ||
335 | }; | ||
336 | enum blackbird_field2_lines { | ||
337 | BLACKBIRD_FIELD2_SAA7114 = 0x00EF, /* 239 */ | ||
338 | BLACKBIRD_FIELD2_SAA7115 = 0x00F0, /* 240 */ | ||
339 | BLACKBIRD_FIELD2_MICRONAS = 0x0106, /* 262 */ | ||
340 | }; | ||
341 | #define BLACKBIRD_API_SET_CUSTOM_DATA 0xD7 | ||
342 | enum blackbird_custom_data_type { | ||
343 | BLACKBIRD_CUSTOM_EXTENSION_USR_DATA, | ||
344 | BLACKBIRD_CUSTOM_PRIVATE_PACKET, | ||
345 | }; | ||
346 | #define BLACKBIRD_API_MUTE_VIDEO 0xD9 | ||
347 | enum blackbird_mute { | ||
348 | BLACKBIRD_UNMUTE, | ||
349 | BLACKBIRD_MUTE, | ||
350 | }; | ||
351 | enum blackbird_mute_video_mask { | ||
352 | BLACKBIRD_MUTE_VIDEO_V_MASK = 0x0000FF00, | ||
353 | BLACKBIRD_MUTE_VIDEO_U_MASK = 0x00FF0000, | ||
354 | BLACKBIRD_MUTE_VIDEO_Y_MASK = 0xFF000000, | ||
355 | }; | ||
356 | enum blackbird_mute_video_shift { | ||
357 | BLACKBIRD_MUTE_VIDEO_V_SHIFT = 8, | ||
358 | BLACKBIRD_MUTE_VIDEO_U_SHIFT = 16, | ||
359 | BLACKBIRD_MUTE_VIDEO_Y_SHIFT = 24, | ||
360 | }; | ||
361 | #define BLACKBIRD_API_MUTE_AUDIO 0xDA | ||
95 | 362 | ||
96 | /* Registers */ | 363 | /* Registers */ |
97 | #define IVTV_REG_ENC_SDRAM_REFRESH (0x07F8 /*| IVTV_REG_OFFSET*/) | 364 | #define IVTV_REG_ENC_SDRAM_REFRESH (0x07F8 /*| IVTV_REG_OFFSET*/) |
@@ -405,68 +672,100 @@ static int blackbird_load_firmware(struct cx8802_dev *dev) | |||
405 | return 0; | 672 | return 0; |
406 | } | 673 | } |
407 | 674 | ||
675 | /** | ||
676 | Settings used by the windows tv app for PVR2000: | ||
677 | ================================================================================================================= | ||
678 | Profile | Codec | Resolution | CBR/VBR | Video Qlty | V. Bitrate | Frmrate | Audio Codec | A. Bitrate | A. Mode | ||
679 | ----------------------------------------------------------------------------------------------------------------- | ||
680 | MPEG-1 | MPEG1 | 352x288PAL | (CBR) | 1000:Optimal | 2000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo | ||
681 | MPEG-2 | MPEG2 | 720x576PAL | VBR | 600 :Good | 4000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo | ||
682 | VCD | MPEG1 | 352x288PAL | (CBR) | 1000:Optimal | 1150 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo | ||
683 | DVD | MPEG2 | 720x576PAL | VBR | 600 :Good | 6000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo | ||
684 | DB* DVD | MPEG2 | 720x576PAL | CBR | 600 :Good | 6000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo | ||
685 | ================================================================================================================= | ||
686 | *DB: "DirectBurn" | ||
687 | */ | ||
408 | static void blackbird_codec_settings(struct cx8802_dev *dev) | 688 | static void blackbird_codec_settings(struct cx8802_dev *dev) |
409 | { | 689 | { |
410 | int bitrate_mode = 1; | 690 | int bitrate_mode = 1; |
411 | int bitrate = 7500000; | 691 | int bitrate = 7500000; |
412 | int bitrate_peak = 7500000; | 692 | int bitrate_peak = 7500000; |
693 | #if 1 | ||
694 | bitrate_mode = BLACKBIRD_VIDEO_CBR; | ||
695 | bitrate = 4000*1024; | ||
696 | bitrate_peak = 4000*1024; | ||
697 | #endif | ||
413 | 698 | ||
414 | /* assign stream type */ | 699 | /* assign stream type */ |
415 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_STREAM_TYPE, 1, 0, 0); /* program stream */ | 700 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_PROGRAM); |
416 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_STREAM_TYPE, 1, 0, 2); /* MPEG1 stream */ | 701 | /* blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_TRANSPORT); */ |
417 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_STREAM_TYPE, 1, 0, 3); /* PES A/V */ | ||
418 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_STREAM_TYPE, 1, 0, 10); /* DVD stream */ | ||
419 | 702 | ||
420 | /* assign output port */ | 703 | /* assign output port */ |
421 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_OUTPUT_PORT, 1, 0, 1); /* 1 = Host */ | 704 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_OUTPUT_PORT, 1, 0, BLACKBIRD_OUTPUT_PORT_STREAMING); /* Host */ |
422 | 705 | ||
423 | /* assign framerate */ | 706 | /* assign framerate */ |
424 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAMERATE, 1, 0, 0); | 707 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_FRAMERATE, 1, 0, BLACKBIRD_FRAMERATE_PAL_25); |
425 | 708 | ||
426 | /* assign frame size */ | 709 | /* assign frame size */ |
427 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAME_SIZE, 2, 0, | 710 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_RESOLUTION, 2, 0, |
428 | dev->height, dev->width); | 711 | dev->height, dev->width); |
429 | 712 | ||
430 | /* assign aspect ratio */ | 713 | /* assign aspect ratio */ |
431 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_ASPECT_RATIO, 1, 0, 2); | 714 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_ASPECT_RATIO, 1, 0, BLACKBIRD_ASPECT_RATIO_4_3); |
432 | 715 | ||
433 | /* assign bitrates */ | 716 | /* assign bitrates */ |
434 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_BITRATES, 5, 0, | 717 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_VIDEO_BITRATE, 5, 0, |
435 | bitrate_mode, /* mode */ | 718 | bitrate_mode, /* mode */ |
436 | bitrate, /* bps */ | 719 | bitrate, /* bps */ |
437 | bitrate_peak / 400, /* peak/400 */ | 720 | bitrate_peak / BLACKBIRD_PEAK_RATE_DIVISOR, /* peak/400 */ |
438 | 0, 0x70); /* encoding buffer, ckennedy */ | 721 | BLACKBIRD_MUX_RATE_DEFAULT /*, 0x70*/); /* encoding buffer, ckennedy */ |
439 | 722 | ||
440 | /* assign gop properties */ | 723 | /* assign gop properties */ |
441 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_GOP_PROPERTIES, 2, 0, 15, 3); | 724 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_STRUCTURE, 2, 0, 15, 3); |
442 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_GOP_PROPERTIES, 2, 0, 2, 1); | 725 | |
443 | 726 | /* assign 3 2 pulldown */ | |
444 | /* assign 3 2 pulldown */ | 727 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_3_2_PULLDOWN, 1, 0, BLACKBIRD_3_2_PULLDOWN_DISABLED); |
445 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_3_2_PULLDOWN, 1, 0, 0); | 728 | |
446 | 729 | /* assign audio properties */ | |
447 | /* note: it's not necessary to set the samplerate, the mpeg encoder seems to autodetect/adjust */ | 730 | /* note: it's not necessary to set the samplerate, the mpeg encoder seems to autodetect/adjust */ |
448 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, (2<<2) | (8<<4)); | 731 | /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, (2<<2) | (8<<4)); |
732 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, 0 | (2 << 2) | (14 << 4)); */ | ||
733 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_AUDIO_PARAMS, 1, 0, | ||
734 | BLACKBIRD_AUDIO_BITS_44100HZ | | ||
735 | BLACKBIRD_AUDIO_BITS_LAYER_2 | | ||
736 | BLACKBIRD_AUDIO_BITS_LAYER_2_224 | | ||
737 | BLACKBIRD_AUDIO_BITS_STEREO | | ||
738 | /* BLACKBIRD_AUDIO_BITS_BOUND_4 | */ | ||
739 | BLACKBIRD_AUDIO_BITS_EMPHASIS_NONE | | ||
740 | BLACKBIRD_AUDIO_BITS_CRC_OFF | | ||
741 | BLACKBIRD_AUDIO_BITS_COPYRIGHT_OFF | | ||
742 | BLACKBIRD_AUDIO_BITS_COPY | ||
743 | ); | ||
449 | 744 | ||
450 | /* assign gop closure */ | 745 | /* assign gop closure */ |
451 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_GOP_CLOSURE, 1, 0, 0); | 746 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_CLOSURE, 1, 0, BLACKBIRD_GOP_CLOSURE_OFF); |
452 | 747 | ||
453 | /* assign audio properties */ | ||
454 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, 0 | (2 << 2) | (14 << 4)); | ||
455 | 748 | ||
456 | /* assign dnr filter mode */ | 749 | /* assign dnr filter mode */ |
457 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_DNR_FILTER_MODE, 2, 0, 0, 0); | 750 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_DNR_MODE, 2, 0, |
751 | BLACKBIRD_DNR_BITS_MANUAL, | ||
752 | BLACKBIRD_MEDIAN_FILTER_DISABLED | ||
753 | ); | ||
458 | 754 | ||
459 | /* assign dnr filter props*/ | 755 | /* assign dnr filter props*/ |
460 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_DNR_FILTER_PROPS, 2, 0, 0, 0); | 756 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_MANUAL_DNR, 2, 0, 0, 0); |
461 | 757 | ||
462 | /* assign coring levels (luma_h, luma_l, chroma_h, chroma_l) */ | 758 | /* assign coring levels (luma_h, luma_l, chroma_h, chroma_l) */ |
463 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_CORING_LEVELS, 4, 0, 0, 255, 0, 255); | 759 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_DNR_MEDIAN, 4, 0, 0, 255, 0, 255); |
464 | 760 | ||
465 | /* assign spatial filter type: luma_t: 1 = horiz_only, chroma_t: 1 = horiz_only */ | 761 | /* assign spatial filter type: luma_t: horiz_only, chroma_t: horiz_only */ |
466 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_SPATIAL_FILTER_TYPE, 2, 0, 1, 1); | 762 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_SPATIAL_FILTER, 2, 0, |
763 | BLACKBIRD_SPATIAL_FILTER_LUMA_1D_HORIZ, | ||
764 | BLACKBIRD_SPATIAL_FILTER_CHROMA_1D_HORIZ | ||
765 | ); | ||
467 | 766 | ||
468 | /* assign frame drop rate */ | 767 | /* assign frame drop rate */ |
469 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAME_DROP_RATE, 1, 0, 0); | 768 | /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAME_DROP_RATE, 1, 0, 0); */ |
470 | } | 769 | } |
471 | 770 | ||
472 | static int blackbird_initialize_codec(struct cx8802_dev *dev) | 771 | static int blackbird_initialize_codec(struct cx8802_dev *dev) |
@@ -476,7 +775,7 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) | |||
476 | int retval; | 775 | int retval; |
477 | 776 | ||
478 | dprintk(1,"Initialize codec\n"); | 777 | dprintk(1,"Initialize codec\n"); |
479 | retval = blackbird_api_cmd(dev, IVTV_API_ENC_PING_FW, 0, 0); /* ping */ | 778 | retval = blackbird_api_cmd(dev, BLACKBIRD_API_PING, 0, 0); /* ping */ |
480 | if (retval < 0) { | 779 | if (retval < 0) { |
481 | /* ping was not successful, reset and upload firmware */ | 780 | /* ping was not successful, reset and upload firmware */ |
482 | cx_write(MO_SRST_IO, 0); /* SYS_RSTO=0 */ | 781 | cx_write(MO_SRST_IO, 0); /* SYS_RSTO=0 */ |
@@ -491,13 +790,13 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) | |||
491 | if (dev->mailbox < 0) | 790 | if (dev->mailbox < 0) |
492 | return -1; | 791 | return -1; |
493 | 792 | ||
494 | retval = blackbird_api_cmd(dev, IVTV_API_ENC_PING_FW, 0, 0); /* ping */ | 793 | retval = blackbird_api_cmd(dev, BLACKBIRD_API_PING, 0, 0); /* ping */ |
495 | if (retval < 0) { | 794 | if (retval < 0) { |
496 | dprintk(0, "ERROR: Firmware ping failed!\n"); | 795 | dprintk(0, "ERROR: Firmware ping failed!\n"); |
497 | return -1; | 796 | return -1; |
498 | } | 797 | } |
499 | 798 | ||
500 | retval = blackbird_api_cmd(dev, IVTV_API_ENC_GETVER, 0, 1, &version); | 799 | retval = blackbird_api_cmd(dev, BLACKBIRD_API_GET_VERSION, 0, 1, &version); |
501 | if (retval < 0) { | 800 | if (retval < 0) { |
502 | dprintk(0, "ERROR: Firmware get encoder version failed!\n"); | 801 | dprintk(0, "ERROR: Firmware get encoder version failed!\n"); |
503 | return -1; | 802 | return -1; |
@@ -517,25 +816,36 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) | |||
517 | blackbird_codec_settings(dev); | 816 | blackbird_codec_settings(dev); |
518 | msleep(1); | 817 | msleep(1); |
519 | 818 | ||
520 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xef, 0xef); | 819 | /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xef, 0xef); |
521 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xf0, 0xf0); | 820 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xf0, 0xf0); |
522 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0x180, 0x180); | 821 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0x180, 0x180); */ |
523 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_PLACEHOLDER, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); | 822 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_CAPTURE_LINES, 2, 0, |
823 | BLACKBIRD_FIELD1_SAA7115, | ||
824 | BLACKBIRD_FIELD1_SAA7115 | ||
825 | ); | ||
826 | |||
827 | /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_PLACEHOLDER, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); */ | ||
828 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_CUSTOM_DATA, 12, 0, | ||
829 | BLACKBIRD_CUSTOM_EXTENSION_USR_DATA, | ||
830 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); | ||
524 | 831 | ||
525 | blackbird_api_cmd(dev, IVTV_API_INITIALIZE_INPUT, 0, 0); /* initialize the video input */ | 832 | blackbird_api_cmd(dev, BLACKBIRD_API_INIT_VIDEO_INPUT, 0, 0); /* initialize the video input */ |
526 | 833 | ||
527 | msleep(1); | 834 | msleep(1); |
528 | 835 | ||
529 | blackbird_api_cmd(dev, IVTV_API_MUTE_VIDEO, 1, 0, 0); | 836 | blackbird_api_cmd(dev, BLACKBIRD_API_MUTE_VIDEO, 1, 0, BLACKBIRD_UNMUTE); |
530 | msleep(1); | 837 | msleep(1); |
531 | blackbird_api_cmd(dev, IVTV_API_MUTE_AUDIO, 1, 0, 0); | 838 | blackbird_api_cmd(dev, BLACKBIRD_API_MUTE_AUDIO, 1, 0, BLACKBIRD_UNMUTE); |
532 | msleep(1); | 839 | msleep(1); |
533 | 840 | ||
534 | blackbird_api_cmd(dev, IVTV_API_BEGIN_CAPTURE, 2, 0, 0, 0x13); /* start capturing to the host interface */ | 841 | /* blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, 0, 0x13); // start capturing to the host interface */ |
535 | //blackbird_api_cmd(dev, IVTV_API_BEGIN_CAPTURE, 2, 0, 0, 0); /* start capturing to the host interface */ | 842 | blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, |
536 | msleep(1); | 843 | BLACKBIRD_MPEG_CAPTURE, |
844 | BLACKBIRD_RAW_BITS_NONE | ||
845 | ); /* start capturing to the host interface */ | ||
846 | msleep(10); | ||
537 | 847 | ||
538 | blackbird_api_cmd(dev, IVTV_API_REFRESH_INPUT, 0,0); | 848 | blackbird_api_cmd(dev, BLACKBIRD_API_REFRESH_INPUT, 0,0); |
539 | return 0; | 849 | return 0; |
540 | } | 850 | } |
541 | 851 | ||
@@ -709,7 +1019,12 @@ static int mpeg_release(struct inode *inode, struct file *file) | |||
709 | { | 1019 | { |
710 | struct cx8802_fh *fh = file->private_data; | 1020 | struct cx8802_fh *fh = file->private_data; |
711 | 1021 | ||
712 | blackbird_api_cmd(fh->dev, IVTV_API_END_CAPTURE, 3, 0, 1, 0, 0x13); | 1022 | /* blackbird_api_cmd(fh->dev, BLACKBIRD_API_END_CAPTURE, 3, 0, BLACKBIRD_END_NOW, 0, 0x13); */ |
1023 | blackbird_api_cmd(fh->dev, BLACKBIRD_API_END_CAPTURE, 3, 0, | ||
1024 | BLACKBIRD_END_NOW, | ||
1025 | BLACKBIRD_MPEG_CAPTURE, | ||
1026 | BLACKBIRD_RAW_BITS_NONE | ||
1027 | ); | ||
713 | 1028 | ||
714 | /* stop mpeg capture */ | 1029 | /* stop mpeg capture */ |
715 | if (fh->mpegq.streaming) | 1030 | if (fh->mpegq.streaming) |
@@ -908,4 +1223,5 @@ module_exit(blackbird_fini); | |||
908 | * Local variables: | 1223 | * Local variables: |
909 | * c-basic-offset: 8 | 1224 | * c-basic-offset: 8 |
910 | * End: | 1225 | * End: |
1226 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
911 | */ | 1227 | */ |