aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2006-05-22 09:31:54 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 00:59:59 -0400
commit855dbada9b551d12a63754b92f67e34c113adf34 (patch)
tree075878261e7e3b171952e62a899ced3e1226304c
parentd762052e1eafd95f3b4622e1990f40dfd0d45b0f (diff)
V4L/DVB (3970): Cx88-blackbird: use firmware api commands defined in cx2341x.h
This patch removes all of the BLACKBIRD_API #define's, instead using the equivalent CX2341X_ENC #define's in cx2341x.h Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c121
1 files changed, 41 insertions, 80 deletions
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index 10556d3d0838..7a50ad4d737d 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -30,9 +30,10 @@
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/device.h> 31#include <linux/device.h>
32#include <linux/firmware.h> 32#include <linux/firmware.h>
33#include <media/v4l2-common.h>
34#include <media/cx2341x.h>
33 35
34#include "cx88.h" 36#include "cx88.h"
35#include <media/v4l2-common.h>
36 37
37MODULE_DESCRIPTION("driver for cx2388x/cx23416 based mpeg encoder cards"); 38MODULE_DESCRIPTION("driver for cx2388x/cx23416 based mpeg encoder cards");
38MODULE_AUTHOR("Jelle Foks <jelle@foks.8m.com>, Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 39MODULE_AUTHOR("Jelle Foks <jelle@foks.8m.com>, Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
@@ -63,8 +64,6 @@ static LIST_HEAD(cx8802_devlist);
63/* Firmware API commands */ 64/* Firmware API commands */
64#define IVTV_API_STD_TIMEOUT 500 65#define IVTV_API_STD_TIMEOUT 500
65 66
66#define BLACKBIRD_API_PING 0x80
67#define BLACKBIRD_API_BEGIN_CAPTURE 0x81
68enum blackbird_capture_type { 67enum blackbird_capture_type {
69 BLACKBIRD_MPEG_CAPTURE, 68 BLACKBIRD_MPEG_CAPTURE,
70 BLACKBIRD_RAW_CAPTURE, 69 BLACKBIRD_RAW_CAPTURE,
@@ -78,21 +77,14 @@ enum blackbird_capture_bits {
78 BLACKBIRD_RAW_BITS_PASSTHRU_CAPTURE = 0x08, 77 BLACKBIRD_RAW_BITS_PASSTHRU_CAPTURE = 0x08,
79 BLACKBIRD_RAW_BITS_TO_HOST_CAPTURE = 0x10 78 BLACKBIRD_RAW_BITS_TO_HOST_CAPTURE = 0x10
80}; 79};
81#define BLACKBIRD_API_END_CAPTURE 0x82
82enum blackbird_capture_end { 80enum blackbird_capture_end {
83 BLACKBIRD_END_AT_GOP, /* stop at the end of gop, generate irq */ 81 BLACKBIRD_END_AT_GOP, /* stop at the end of gop, generate irq */
84 BLACKBIRD_END_NOW, /* stop immediately, no irq */ 82 BLACKBIRD_END_NOW, /* stop immediately, no irq */
85}; 83};
86#define BLACKBIRD_API_SET_AUDIO_ID 0x89
87#define BLACKBIRD_API_SET_VIDEO_ID 0x8B
88#define BLACKBIRD_API_SET_PCR_ID 0x8D
89#define BLACKBIRD_API_SET_FRAMERATE 0x8F
90enum blackbird_framerate { 84enum blackbird_framerate {
91 BLACKBIRD_FRAMERATE_NTSC_30, /* NTSC: 30fps */ 85 BLACKBIRD_FRAMERATE_NTSC_30, /* NTSC: 30fps */
92 BLACKBIRD_FRAMERATE_PAL_25 /* PAL: 25fps */ 86 BLACKBIRD_FRAMERATE_PAL_25 /* PAL: 25fps */
93}; 87};
94#define BLACKBIRD_API_SET_RESOLUTION 0x91
95#define BLACKBIRD_API_SET_VIDEO_BITRATE 0x95
96enum blackbird_video_bitrate_type { 88enum blackbird_video_bitrate_type {
97 BLACKBIRD_VIDEO_VBR, 89 BLACKBIRD_VIDEO_VBR,
98 BLACKBIRD_VIDEO_CBR 90 BLACKBIRD_VIDEO_CBR
@@ -103,8 +95,6 @@ enum blackbird_mux_rate {
103 /* dvd mux rate: multiply by 400 to get the actual rate */ 95 /* dvd mux rate: multiply by 400 to get the actual rate */
104 BLACKBIRD_MUX_RATE_DVD = 25200 96 BLACKBIRD_MUX_RATE_DVD = 25200
105}; 97};
106#define BLACKBIRD_API_SET_GOP_STRUCTURE 0x97
107#define BLACKBIRD_API_SET_ASPECT_RATIO 0x99
108enum blackbird_aspect_ratio { 98enum blackbird_aspect_ratio {
109 BLACKBIRD_ASPECT_RATIO_FORBIDDEN, 99 BLACKBIRD_ASPECT_RATIO_FORBIDDEN,
110 BLACKBIRD_ASPECT_RATIO_1_1_SQUARE, 100 BLACKBIRD_ASPECT_RATIO_1_1_SQUARE,
@@ -113,7 +103,6 @@ enum blackbird_aspect_ratio {
113 BLACKBIRD_ASPECT_RATIO_221_100, 103 BLACKBIRD_ASPECT_RATIO_221_100,
114 BLACKBIRD_ASPECT_RATIO_RESERVED 104 BLACKBIRD_ASPECT_RATIO_RESERVED
115}; 105};
116#define BLACKBIRD_API_SET_DNR_MODE 0x9B
117enum blackbird_dnr_bits { 106enum blackbird_dnr_bits {
118 BLACKBIRD_DNR_BITS_MANUAL, 107 BLACKBIRD_DNR_BITS_MANUAL,
119 BLACKBIRD_DNR_BITS_AUTO_SPATIAL, 108 BLACKBIRD_DNR_BITS_AUTO_SPATIAL,
@@ -127,9 +116,6 @@ enum blackbird_median_filter {
127 BLACKBIRD_MEDIAN_FILTER_HV, 116 BLACKBIRD_MEDIAN_FILTER_HV,
128 BLACKBIRD_MEDIAN_FILTER_DIAGONAL 117 BLACKBIRD_MEDIAN_FILTER_DIAGONAL
129}; 118};
130#define BLACKBIRD_API_SET_MANUAL_DNR 0x9D
131#define BLACKBIRD_API_SET_DNR_MEDIAN 0x9F
132#define BLACKBIRD_API_SET_SPATIAL_FILTER 0xA1
133enum blackbird_spatial_filter_luma { 119enum blackbird_spatial_filter_luma {
134 BLACKBIRD_SPATIAL_FILTER_LUMA_DISABLED, 120 BLACKBIRD_SPATIAL_FILTER_LUMA_DISABLED,
135 BLACKBIRD_SPATIAL_FILTER_LUMA_1D_HORIZ, 121 BLACKBIRD_SPATIAL_FILTER_LUMA_1D_HORIZ,
@@ -141,12 +127,10 @@ enum blackbird_spatial_filter_chroma {
141 BLACKBIRD_SPATIAL_FILTER_CHROMA_DISABLED, 127 BLACKBIRD_SPATIAL_FILTER_CHROMA_DISABLED,
142 BLACKBIRD_SPATIAL_FILTER_CHROMA_1D_HORIZ /* default */ 128 BLACKBIRD_SPATIAL_FILTER_CHROMA_1D_HORIZ /* default */
143}; 129};
144#define BLACKBIRD_API_SET_3_2_PULLDOWN 0xB1
145enum blackbird_pulldown { 130enum blackbird_pulldown {
146 BLACKBIRD_3_2_PULLDOWN_DISABLED, 131 BLACKBIRD_3_2_PULLDOWN_DISABLED,
147 BLACKBIRD_3_2_PULLDOWN_ENABLED 132 BLACKBIRD_3_2_PULLDOWN_ENABLED
148}; 133};
149#define BLACKBIRD_API_SET_VBI_LINE_NO 0xB7
150enum blackbird_vbi_line_bits { 134enum blackbird_vbi_line_bits {
151 BLACKBIRD_VBI_LINE_BITS_TOP_FIELD, 135 BLACKBIRD_VBI_LINE_BITS_TOP_FIELD,
152 BLACKBIRD_VBI_LINE_BITS_BOT_FIELD = (1 << 31), 136 BLACKBIRD_VBI_LINE_BITS_BOT_FIELD = (1 << 31),
@@ -160,7 +144,6 @@ enum blackbird_vbi_slicing {
160 BLACKBIRD_VBI_SLICING_NONE, 144 BLACKBIRD_VBI_SLICING_NONE,
161 BLACKBIRD_VBI_SLICING_CLOSED_CAPTION 145 BLACKBIRD_VBI_SLICING_CLOSED_CAPTION
162}; 146};
163#define BLACKBIRD_API_SET_STREAM_TYPE 0xB9
164enum blackbird_stream_type { 147enum blackbird_stream_type {
165 BLACKBIRD_STREAM_PROGRAM, 148 BLACKBIRD_STREAM_PROGRAM,
166 BLACKBIRD_STREAM_TRANSPORT, 149 BLACKBIRD_STREAM_TRANSPORT,
@@ -176,13 +159,11 @@ enum blackbird_stream_type {
176 BLACKBIRD_STREAM_VCD, 159 BLACKBIRD_STREAM_VCD,
177 BLACKBIRD_STREAM_UNKNOWN12 /* svcd/xvcd ? */ 160 BLACKBIRD_STREAM_UNKNOWN12 /* svcd/xvcd ? */
178}; 161};
179#define BLACKBIRD_API_SET_OUTPUT_PORT 0xBB
180enum blackbird_stream_port { 162enum blackbird_stream_port {
181 BLACKBIRD_OUTPUT_PORT_MEMORY, 163 BLACKBIRD_OUTPUT_PORT_MEMORY,
182 BLACKBIRD_OUTPUT_PORT_STREAMING, 164 BLACKBIRD_OUTPUT_PORT_STREAMING,
183 BLACKBIRD_OUTPUT_PORT_SERIAL 165 BLACKBIRD_OUTPUT_PORT_SERIAL
184}; 166};
185#define BLACKBIRD_API_SET_AUDIO_PARAMS 0xBD
186enum blackbird_audio_bits_sample_rate { 167enum blackbird_audio_bits_sample_rate {
187 BLACKBIRD_AUDIO_BITS_44100HZ, 168 BLACKBIRD_AUDIO_BITS_44100HZ,
188 BLACKBIRD_AUDIO_BITS_48000HZ, 169 BLACKBIRD_AUDIO_BITS_48000HZ,
@@ -257,26 +238,20 @@ enum blackbird_audio_bits_original {
257 BLACKBIRD_AUDIO_BITS_COPY, 238 BLACKBIRD_AUDIO_BITS_COPY,
258 BLACKBIRD_AUDIO_BITS_ORIGINAL = 0x1 << 16, 239 BLACKBIRD_AUDIO_BITS_ORIGINAL = 0x1 << 16,
259}; 240};
260#define BLACKBIRD_API_HALT 0xC3
261#define BLACKBIRD_API_GET_VERSION 0xC4
262#define BLACKBIRD_API_SET_GOP_CLOSURE 0xC5
263enum blackbird_gop_closure { 241enum blackbird_gop_closure {
264 BLACKBIRD_GOP_CLOSURE_OFF, 242 BLACKBIRD_GOP_CLOSURE_OFF,
265 BLACKBIRD_GOP_CLOSURE_ON, 243 BLACKBIRD_GOP_CLOSURE_ON,
266}; 244};
267#define BLACKBIRD_API_DATA_XFER_STATUS 0xC6
268enum blackbird_data_xfer_status { 245enum blackbird_data_xfer_status {
269 BLACKBIRD_MORE_BUFFERS_FOLLOW, 246 BLACKBIRD_MORE_BUFFERS_FOLLOW,
270 BLACKBIRD_LAST_BUFFER, 247 BLACKBIRD_LAST_BUFFER,
271}; 248};
272#define BLACKBIRD_API_PROGRAM_INDEX_INFO 0xC7
273enum blackbird_picture_mask { 249enum blackbird_picture_mask {
274 BLACKBIRD_PICTURE_MASK_NONE, 250 BLACKBIRD_PICTURE_MASK_NONE,
275 BLACKBIRD_PICTURE_MASK_I_FRAMES, 251 BLACKBIRD_PICTURE_MASK_I_FRAMES,
276 BLACKBIRD_PICTURE_MASK_I_P_FRAMES = 0x3, 252 BLACKBIRD_PICTURE_MASK_I_P_FRAMES = 0x3,
277 BLACKBIRD_PICTURE_MASK_ALL_FRAMES = 0x7, 253 BLACKBIRD_PICTURE_MASK_ALL_FRAMES = 0x7,
278}; 254};
279#define BLACKBIRD_API_SET_VBI_PARAMS 0xC8
280enum blackbird_vbi_mode_bits { 255enum blackbird_vbi_mode_bits {
281 BLACKBIRD_VBI_BITS_SLICED, 256 BLACKBIRD_VBI_BITS_SLICED,
282 BLACKBIRD_VBI_BITS_RAW, 257 BLACKBIRD_VBI_BITS_RAW,
@@ -288,33 +263,23 @@ enum blackbird_vbi_insertion_bits {
288 BLACKBIRD_VBI_BITS_SEPARATE_STREAM_USR_DATA = 0x4 << 1, 263 BLACKBIRD_VBI_BITS_SEPARATE_STREAM_USR_DATA = 0x4 << 1,
289 BLACKBIRD_VBI_BITS_SEPARATE_STREAM_PRV_DATA = 0x5 << 1, 264 BLACKBIRD_VBI_BITS_SEPARATE_STREAM_PRV_DATA = 0x5 << 1,
290}; 265};
291#define BLACKBIRD_API_SET_DMA_BLOCK_SIZE 0xC9
292enum blackbird_dma_unit { 266enum blackbird_dma_unit {
293 BLACKBIRD_DMA_BYTES, 267 BLACKBIRD_DMA_BYTES,
294 BLACKBIRD_DMA_FRAMES, 268 BLACKBIRD_DMA_FRAMES,
295}; 269};
296#define BLACKBIRD_API_DMA_TRANSFER_INFO 0xCA
297#define BLACKBIRD_API_DMA_TRANSFER_STAT 0xCB
298enum blackbird_dma_transfer_status_bits { 270enum blackbird_dma_transfer_status_bits {
299 BLACKBIRD_DMA_TRANSFER_BITS_DONE = 0x01, 271 BLACKBIRD_DMA_TRANSFER_BITS_DONE = 0x01,
300 BLACKBIRD_DMA_TRANSFER_BITS_ERROR = 0x04, 272 BLACKBIRD_DMA_TRANSFER_BITS_ERROR = 0x04,
301 BLACKBIRD_DMA_TRANSFER_BITS_LL_ERROR = 0x10, 273 BLACKBIRD_DMA_TRANSFER_BITS_LL_ERROR = 0x10,
302}; 274};
303#define BLACKBIRD_API_SET_DMA2HOST_ADDR 0xCC
304#define BLACKBIRD_API_INIT_VIDEO_INPUT 0xCD
305#define BLACKBIRD_API_SET_FRAMESKIP 0xD0
306#define BLACKBIRD_API_PAUSE 0xD2
307enum blackbird_pause { 275enum blackbird_pause {
308 BLACKBIRD_PAUSE_ENCODING, 276 BLACKBIRD_PAUSE_ENCODING,
309 BLACKBIRD_RESUME_ENCODING, 277 BLACKBIRD_RESUME_ENCODING,
310}; 278};
311#define BLACKBIRD_API_REFRESH_INPUT 0xD3
312#define BLACKBIRD_API_SET_COPYRIGHT 0xD4
313enum blackbird_copyright { 279enum blackbird_copyright {
314 BLACKBIRD_COPYRIGHT_OFF, 280 BLACKBIRD_COPYRIGHT_OFF,
315 BLACKBIRD_COPYRIGHT_ON, 281 BLACKBIRD_COPYRIGHT_ON,
316}; 282};
317#define BLACKBIRD_API_SET_NOTIFICATION 0xD5
318enum blackbird_notification_type { 283enum blackbird_notification_type {
319 BLACKBIRD_NOTIFICATION_REFRESH, 284 BLACKBIRD_NOTIFICATION_REFRESH,
320}; 285};
@@ -325,7 +290,6 @@ enum blackbird_notification_status {
325enum blackbird_notification_mailbox { 290enum blackbird_notification_mailbox {
326 BLACKBIRD_NOTIFICATION_NO_MAILBOX = -1, 291 BLACKBIRD_NOTIFICATION_NO_MAILBOX = -1,
327}; 292};
328#define BLACKBIRD_API_SET_CAPTURE_LINES 0xD6
329enum blackbird_field1_lines { 293enum blackbird_field1_lines {
330 BLACKBIRD_FIELD1_SAA7114 = 0x00EF, /* 239 */ 294 BLACKBIRD_FIELD1_SAA7114 = 0x00EF, /* 239 */
331 BLACKBIRD_FIELD1_SAA7115 = 0x00F0, /* 240 */ 295 BLACKBIRD_FIELD1_SAA7115 = 0x00F0, /* 240 */
@@ -336,12 +300,10 @@ enum blackbird_field2_lines {
336 BLACKBIRD_FIELD2_SAA7115 = 0x00F0, /* 240 */ 300 BLACKBIRD_FIELD2_SAA7115 = 0x00F0, /* 240 */
337 BLACKBIRD_FIELD2_MICRONAS = 0x0106, /* 262 */ 301 BLACKBIRD_FIELD2_MICRONAS = 0x0106, /* 262 */
338}; 302};
339#define BLACKBIRD_API_SET_CUSTOM_DATA 0xD7
340enum blackbird_custom_data_type { 303enum blackbird_custom_data_type {
341 BLACKBIRD_CUSTOM_EXTENSION_USR_DATA, 304 BLACKBIRD_CUSTOM_EXTENSION_USR_DATA,
342 BLACKBIRD_CUSTOM_PRIVATE_PACKET, 305 BLACKBIRD_CUSTOM_PRIVATE_PACKET,
343}; 306};
344#define BLACKBIRD_API_MUTE_VIDEO 0xD9
345enum blackbird_mute { 307enum blackbird_mute {
346 BLACKBIRD_UNMUTE, 308 BLACKBIRD_UNMUTE,
347 BLACKBIRD_MUTE, 309 BLACKBIRD_MUTE,
@@ -356,7 +318,6 @@ enum blackbird_mute_video_shift {
356 BLACKBIRD_MUTE_VIDEO_U_SHIFT = 16, 318 BLACKBIRD_MUTE_VIDEO_U_SHIFT = 16,
357 BLACKBIRD_MUTE_VIDEO_Y_SHIFT = 24, 319 BLACKBIRD_MUTE_VIDEO_Y_SHIFT = 24,
358}; 320};
359#define BLACKBIRD_API_MUTE_AUDIO 0xDA
360 321
361/* Registers */ 322/* Registers */
362#define IVTV_REG_ENC_SDRAM_REFRESH (0x07F8 /*| IVTV_REG_OFFSET*/) 323#define IVTV_REG_ENC_SDRAM_REFRESH (0x07F8 /*| IVTV_REG_OFFSET*/)
@@ -792,33 +753,33 @@ static void blackbird_set_default_params(struct cx8802_dev *dev)
792 params->vi_type = V4L2_MPEG_VI_1; 753 params->vi_type = V4L2_MPEG_VI_1;
793 else 754 else
794 params->vi_type = V4L2_MPEG_VI_2; 755 params->vi_type = V4L2_MPEG_VI_2;
795 blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, mpeg_stream_types[params->st_type]); 756 blackbird_api_cmd(dev, CX2341X_ENC_SET_STREAM_TYPE, 1, 0, mpeg_stream_types[params->st_type]);
796 757
797 /* assign framerate */ 758 /* assign framerate */
798 if( params->vi_frame_rate <= 25 ) 759 if( params->vi_frame_rate <= 25 )
799 { 760 {
800 params->vi_frame_rate = 25; 761 params->vi_frame_rate = 25;
801 blackbird_api_cmd(dev, BLACKBIRD_API_SET_FRAMERATE, 1, 0, BLACKBIRD_FRAMERATE_PAL_25); 762 blackbird_api_cmd(dev, CX2341X_ENC_SET_FRAME_RATE, 1, 0, BLACKBIRD_FRAMERATE_PAL_25);
802 } 763 }
803 else 764 else
804 { 765 {
805 params->vi_frame_rate = 30; 766 params->vi_frame_rate = 30;
806 blackbird_api_cmd(dev, BLACKBIRD_API_SET_FRAMERATE, 1, 0, BLACKBIRD_FRAMERATE_NTSC_30); 767 blackbird_api_cmd(dev, CX2341X_ENC_SET_FRAME_RATE, 1, 0, BLACKBIRD_FRAMERATE_NTSC_30);
807 } 768 }
808 769
809 /* assign aspect ratio */ 770 /* assign aspect ratio */
810 if( params->vi_aspect_ratio >= ARRAY_SIZE(mpeg_stream_ratios) ) 771 if( params->vi_aspect_ratio >= ARRAY_SIZE(mpeg_stream_ratios) )
811 params->vi_aspect_ratio = V4L2_MPEG_ASPECT_4_3; 772 params->vi_aspect_ratio = V4L2_MPEG_ASPECT_4_3;
812 blackbird_api_cmd(dev, BLACKBIRD_API_SET_ASPECT_RATIO, 1, 0, mpeg_stream_ratios[params->vi_aspect_ratio]); 773 blackbird_api_cmd(dev, CX2341X_ENC_SET_ASPECT_RATIO, 1, 0, mpeg_stream_ratios[params->vi_aspect_ratio]);
813 774
814 /* assign gop properties */ 775 /* assign gop properties */
815 blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_STRUCTURE, 2, 0, params->vi_frames_per_gop, params->vi_bframes_count+1); 776 blackbird_api_cmd(dev, CX2341X_ENC_SET_GOP_PROPERTIES, 2, 0, params->vi_frames_per_gop, params->vi_bframes_count+1);
816 777
817 /* assign gop closure */ 778 /* assign gop closure */
818 blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_CLOSURE, 1, 0, params->closed_gops); 779 blackbird_api_cmd(dev, CX2341X_ENC_SET_GOP_CLOSURE, 1, 0, params->closed_gops);
819 780
820 /* assign 3 2 pulldown */ 781 /* assign 3 2 pulldown */
821 blackbird_api_cmd(dev, BLACKBIRD_API_SET_3_2_PULLDOWN, 1, 0, params->pulldown); 782 blackbird_api_cmd(dev, CX2341X_ENC_SET_3_2_PULLDOWN, 1, 0, params->pulldown);
822 783
823 /* make sure the params are within bounds */ 784 /* make sure the params are within bounds */
824 if( params->st_bitrate.mode >= ARRAY_SIZE(mpeg_video_bitrates) ) 785 if( params->st_bitrate.mode >= ARRAY_SIZE(mpeg_video_bitrates) )
@@ -908,7 +869,7 @@ static void blackbird_set_default_params(struct cx8802_dev *dev)
908 params->au_bitrate.target = params->au_bitrate.max = 0; 869 params->au_bitrate.target = params->au_bitrate.max = 0;
909 au_params |= 0; 870 au_params |= 0;
910 } 871 }
911 blackbird_api_cmd(dev, BLACKBIRD_API_SET_AUDIO_PARAMS, 1, 0, au_params ); 872 blackbird_api_cmd(dev, CX2341X_ENC_SET_AUDIO_PROPERTIES, 1, 0, au_params );
912 873
913 /* assign bitrates */ 874 /* assign bitrates */
914 if( params->vi_bitrate.mode ) 875 if( params->vi_bitrate.mode )
@@ -935,7 +896,7 @@ static void blackbird_set_default_params(struct cx8802_dev *dev)
935 params->vi_bitrate.max = params->st_bitrate.max - params->au_bitrate.max; 896 params->vi_bitrate.max = params->st_bitrate.max - params->au_bitrate.max;
936 params->vi_bitrate.target = params->st_bitrate.target - params->au_bitrate.target; 897 params->vi_bitrate.target = params->st_bitrate.target - params->au_bitrate.target;
937 } 898 }
938 blackbird_api_cmd(dev, BLACKBIRD_API_SET_VIDEO_BITRATE, 4, 0, 899 blackbird_api_cmd(dev, CX2341X_ENC_SET_BIT_RATE, 4, 0,
939 mpeg_video_bitrates[params->vi_bitrate.mode], 900 mpeg_video_bitrates[params->vi_bitrate.mode],
940 params->vi_bitrate.target * 1000, /* kbps -> bps */ 901 params->vi_bitrate.target * 1000, /* kbps -> bps */
941 params->vi_bitrate.max * 1000 / BLACKBIRD_PEAK_RATE_DIVISOR, /* peak/400 */ 902 params->vi_bitrate.max * 1000 / BLACKBIRD_PEAK_RATE_DIVISOR, /* peak/400 */
@@ -964,7 +925,7 @@ void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression *
964 { 925 {
965 UPDATE_PARAM( st_type ); 926 UPDATE_PARAM( st_type );
966 UPDATE_PARAM( vi_type ); 927 UPDATE_PARAM( vi_type );
967 blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, mpeg_stream_types[params->st_type]); 928 blackbird_api_cmd(dev, CX2341X_ENC_SET_STREAM_TYPE, 1, 0, mpeg_stream_types[params->st_type]);
968 } 929 }
969 930
970 /* assign framerate */ 931 /* assign framerate */
@@ -976,9 +937,9 @@ void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression *
976 { 937 {
977 UPDATE_PARAM( vi_frame_rate ); 938 UPDATE_PARAM( vi_frame_rate );
978 if( params->vi_frame_rate == 25 ) 939 if( params->vi_frame_rate == 25 )
979 blackbird_api_cmd(dev, BLACKBIRD_API_SET_FRAMERATE, 1, 0, BLACKBIRD_FRAMERATE_PAL_25); 940 blackbird_api_cmd(dev, CX2341X_ENC_SET_FRAME_RATE, 1, 0, BLACKBIRD_FRAMERATE_PAL_25);
980 else 941 else
981 blackbird_api_cmd(dev, BLACKBIRD_API_SET_FRAMERATE, 1, 0, BLACKBIRD_FRAMERATE_NTSC_30); 942 blackbird_api_cmd(dev, CX2341X_ENC_SET_FRAME_RATE, 1, 0, BLACKBIRD_FRAMERATE_NTSC_30);
982 } 943 }
983 944
984 /* assign aspect ratio */ 945 /* assign aspect ratio */
@@ -987,7 +948,7 @@ void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression *
987 IF_PARAM( vi_aspect_ratio ) 948 IF_PARAM( vi_aspect_ratio )
988 { 949 {
989 UPDATE_PARAM( vi_aspect_ratio ); 950 UPDATE_PARAM( vi_aspect_ratio );
990 blackbird_api_cmd(dev, BLACKBIRD_API_SET_ASPECT_RATIO, 1, 0, mpeg_stream_ratios[params->vi_aspect_ratio]); 951 blackbird_api_cmd(dev, CX2341X_ENC_SET_ASPECT_RATIO, 1, 0, mpeg_stream_ratios[params->vi_aspect_ratio]);
991 } 952 }
992 953
993 /* assign gop properties */ 954 /* assign gop properties */
@@ -995,21 +956,21 @@ void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression *
995 { 956 {
996 UPDATE_PARAM( vi_frames_per_gop ); 957 UPDATE_PARAM( vi_frames_per_gop );
997 UPDATE_PARAM( vi_bframes_count ); 958 UPDATE_PARAM( vi_bframes_count );
998 blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_STRUCTURE, 2, 0, params->vi_frames_per_gop, params->vi_bframes_count+1); 959 blackbird_api_cmd(dev, CX2341X_ENC_SET_GOP_PROPERTIES, 2, 0, params->vi_frames_per_gop, params->vi_bframes_count+1);
999 } 960 }
1000 961
1001 /* assign gop closure */ 962 /* assign gop closure */
1002 IF_PARAM( closed_gops ) 963 IF_PARAM( closed_gops )
1003 { 964 {
1004 UPDATE_PARAM( closed_gops ); 965 UPDATE_PARAM( closed_gops );
1005 blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_CLOSURE, 1, 0, params->closed_gops); 966 blackbird_api_cmd(dev, CX2341X_ENC_SET_GOP_CLOSURE, 1, 0, params->closed_gops);
1006 } 967 }
1007 968
1008 /* assign 3 2 pulldown */ 969 /* assign 3 2 pulldown */
1009 IF_PARAM( pulldown ) 970 IF_PARAM( pulldown )
1010 { 971 {
1011 UPDATE_PARAM( pulldown ); 972 UPDATE_PARAM( pulldown );
1012 blackbird_api_cmd(dev, BLACKBIRD_API_SET_3_2_PULLDOWN, 1, 0, params->pulldown); 973 blackbird_api_cmd(dev, CX2341X_ENC_SET_3_2_PULLDOWN, 1, 0, params->pulldown);
1013 } 974 }
1014 975
1015 /* make sure the params are within bounds */ 976 /* make sure the params are within bounds */
@@ -1108,7 +1069,7 @@ void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression *
1108 UPDATE_PARAM( au_type ); 1069 UPDATE_PARAM( au_type );
1109 UPDATE_PARAM( au_sample_rate ); 1070 UPDATE_PARAM( au_sample_rate );
1110 UPDATE_PARAM( au_bitrate ); 1071 UPDATE_PARAM( au_bitrate );
1111 blackbird_api_cmd(dev, BLACKBIRD_API_SET_AUDIO_PARAMS, 1, 0, au_params ); 1072 blackbird_api_cmd(dev, CX2341X_ENC_SET_AUDIO_PROPERTIES, 1, 0, au_params );
1112 } 1073 }
1113 1074
1114 /* assign bitrates */ 1075 /* assign bitrates */
@@ -1142,7 +1103,7 @@ void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression *
1142 ) 1103 )
1143 { 1104 {
1144 UPDATE_PARAM( vi_bitrate ); 1105 UPDATE_PARAM( vi_bitrate );
1145 blackbird_api_cmd(dev, BLACKBIRD_API_SET_VIDEO_BITRATE, 4, 0, 1106 blackbird_api_cmd(dev, CX2341X_ENC_SET_BIT_RATE, 4, 0,
1146 mpeg_video_bitrates[params->vi_bitrate.mode], 1107 mpeg_video_bitrates[params->vi_bitrate.mode],
1147 params->vi_bitrate.target * 1000, /* kbps -> bps */ 1108 params->vi_bitrate.target * 1000, /* kbps -> bps */
1148 params->vi_bitrate.max * 1000 / BLACKBIRD_PEAK_RATE_DIVISOR, /* peak/400 */ 1109 params->vi_bitrate.max * 1000 / BLACKBIRD_PEAK_RATE_DIVISOR, /* peak/400 */
@@ -1169,7 +1130,7 @@ static void blackbird_set_default_dnr_params(struct cx8802_dev *dev)
1169 dev->dnr_params.mode = BLACKBIRD_DNR_BITS_MANUAL; 1130 dev->dnr_params.mode = BLACKBIRD_DNR_BITS_MANUAL;
1170 if( dev->dnr_params.type > BLACKBIRD_MEDIAN_FILTER_DIAGONAL ) 1131 if( dev->dnr_params.type > BLACKBIRD_MEDIAN_FILTER_DIAGONAL )
1171 dev->dnr_params.type = BLACKBIRD_MEDIAN_FILTER_DISABLED; 1132 dev->dnr_params.type = BLACKBIRD_MEDIAN_FILTER_DISABLED;
1172 blackbird_api_cmd(dev, BLACKBIRD_API_SET_DNR_MODE, 2, 0, 1133 blackbird_api_cmd(dev, CX2341X_ENC_SET_DNR_FILTER_MODE, 2, 0,
1173 dev->dnr_params.mode, 1134 dev->dnr_params.mode,
1174 dev->dnr_params.type 1135 dev->dnr_params.type
1175 ); 1136 );
@@ -1179,7 +1140,7 @@ static void blackbird_set_default_dnr_params(struct cx8802_dev *dev)
1179 dev->dnr_params.spatial = 15; 1140 dev->dnr_params.spatial = 15;
1180 if( dev->dnr_params.temporal > 31 ) 1141 if( dev->dnr_params.temporal > 31 )
1181 dev->dnr_params.temporal = 31; 1142 dev->dnr_params.temporal = 31;
1182 blackbird_api_cmd(dev, BLACKBIRD_API_SET_MANUAL_DNR, 2, 0, 1143 blackbird_api_cmd(dev, CX2341X_ENC_SET_DNR_FILTER_PROPS, 2, 0,
1183 dev->dnr_params.spatial, 1144 dev->dnr_params.spatial,
1184 dev->dnr_params.temporal 1145 dev->dnr_params.temporal
1185 ); 1146 );
@@ -1199,7 +1160,7 @@ void blackbird_set_dnr_params(struct cx8802_dev *dev, struct blackbird_dnr* dnr_
1199 { 1160 {
1200 UPDATE_DNR_PARAM( mode ); 1161 UPDATE_DNR_PARAM( mode );
1201 UPDATE_DNR_PARAM( type ); 1162 UPDATE_DNR_PARAM( type );
1202 blackbird_api_cmd(dev, BLACKBIRD_API_SET_DNR_MODE, 2, 0, dnr_params->mode, dnr_params->type); 1163 blackbird_api_cmd(dev, CX2341X_ENC_SET_DNR_FILTER_MODE, 2, 0, dnr_params->mode, dnr_params->type);
1203 } 1164 }
1204 1165
1205 /* assign dnr filter props*/ 1166 /* assign dnr filter props*/
@@ -1211,7 +1172,7 @@ void blackbird_set_dnr_params(struct cx8802_dev *dev, struct blackbird_dnr* dnr_
1211 { 1172 {
1212 UPDATE_DNR_PARAM( spatial ); 1173 UPDATE_DNR_PARAM( spatial );
1213 UPDATE_DNR_PARAM( temporal ); 1174 UPDATE_DNR_PARAM( temporal );
1214 blackbird_api_cmd(dev, BLACKBIRD_API_SET_MANUAL_DNR, 2, 0, dnr_params->spatial, dnr_params->temporal); 1175 blackbird_api_cmd(dev, CX2341X_ENC_SET_DNR_FILTER_PROPS, 2, 0, dnr_params->spatial, dnr_params->temporal);
1215 } 1176 }
1216} 1177}
1217 1178
@@ -1219,17 +1180,17 @@ static void blackbird_codec_settings(struct cx8802_dev *dev)
1219{ 1180{
1220 1181
1221 /* assign output port */ 1182 /* assign output port */
1222 blackbird_api_cmd(dev, BLACKBIRD_API_SET_OUTPUT_PORT, 1, 0, BLACKBIRD_OUTPUT_PORT_STREAMING); /* Host */ 1183 blackbird_api_cmd(dev, CX2341X_ENC_SET_OUTPUT_PORT, 1, 0, BLACKBIRD_OUTPUT_PORT_STREAMING); /* Host */
1223 1184
1224 /* assign frame size */ 1185 /* assign frame size */
1225 blackbird_api_cmd(dev, BLACKBIRD_API_SET_RESOLUTION, 2, 0, 1186 blackbird_api_cmd(dev, CX2341X_ENC_SET_FRAME_SIZE, 2, 0,
1226 dev->height, dev->width); 1187 dev->height, dev->width);
1227 1188
1228 /* assign coring levels (luma_h, luma_l, chroma_h, chroma_l) */ 1189 /* assign coring levels (luma_h, luma_l, chroma_h, chroma_l) */
1229 blackbird_api_cmd(dev, BLACKBIRD_API_SET_DNR_MEDIAN, 4, 0, 0, 255, 0, 255); 1190 blackbird_api_cmd(dev, CX2341X_ENC_SET_CORING_LEVELS, 4, 0, 0, 255, 0, 255);
1230 1191
1231 /* assign spatial filter type: luma_t: horiz_only, chroma_t: horiz_only */ 1192 /* assign spatial filter type: luma_t: horiz_only, chroma_t: horiz_only */
1232 blackbird_api_cmd(dev, BLACKBIRD_API_SET_SPATIAL_FILTER, 2, 0, 1193 blackbird_api_cmd(dev, CX2341X_ENC_SET_SPATIAL_FILTER_TYPE, 2, 0,
1233 BLACKBIRD_SPATIAL_FILTER_LUMA_1D_HORIZ, 1194 BLACKBIRD_SPATIAL_FILTER_LUMA_1D_HORIZ,
1234 BLACKBIRD_SPATIAL_FILTER_CHROMA_1D_HORIZ 1195 BLACKBIRD_SPATIAL_FILTER_CHROMA_1D_HORIZ
1235 ); 1196 );
@@ -1248,7 +1209,7 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev)
1248 int retval; 1209 int retval;
1249 1210
1250 dprintk(1,"Initialize codec\n"); 1211 dprintk(1,"Initialize codec\n");
1251 retval = blackbird_api_cmd(dev, BLACKBIRD_API_PING, 0, 0); /* ping */ 1212 retval = blackbird_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0); /* ping */
1252 if (retval < 0) { 1213 if (retval < 0) {
1253 /* ping was not successful, reset and upload firmware */ 1214 /* ping was not successful, reset and upload firmware */
1254 cx_write(MO_SRST_IO, 0); /* SYS_RSTO=0 */ 1215 cx_write(MO_SRST_IO, 0); /* SYS_RSTO=0 */
@@ -1263,13 +1224,13 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev)
1263 if (dev->mailbox < 0) 1224 if (dev->mailbox < 0)
1264 return -1; 1225 return -1;
1265 1226
1266 retval = blackbird_api_cmd(dev, BLACKBIRD_API_PING, 0, 0); /* ping */ 1227 retval = blackbird_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0); /* ping */
1267 if (retval < 0) { 1228 if (retval < 0) {
1268 dprintk(0, "ERROR: Firmware ping failed!\n"); 1229 dprintk(0, "ERROR: Firmware ping failed!\n");
1269 return -1; 1230 return -1;
1270 } 1231 }
1271 1232
1272 retval = blackbird_api_cmd(dev, BLACKBIRD_API_GET_VERSION, 0, 1, &version); 1233 retval = blackbird_api_cmd(dev, CX2341X_ENC_GET_VERSION, 0, 1, &version);
1273 if (retval < 0) { 1234 if (retval < 0) {
1274 dprintk(0, "ERROR: Firmware get encoder version failed!\n"); 1235 dprintk(0, "ERROR: Firmware get encoder version failed!\n");
1275 return -1; 1236 return -1;
@@ -1289,35 +1250,35 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev)
1289 /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xef, 0xef); 1250 /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xef, 0xef);
1290 blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xf0, 0xf0); 1251 blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xf0, 0xf0);
1291 blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0x180, 0x180); */ 1252 blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0x180, 0x180); */
1292 blackbird_api_cmd(dev, BLACKBIRD_API_SET_CAPTURE_LINES, 2, 0, 1253 blackbird_api_cmd(dev, CX2341X_ENC_SET_NUM_VSYNC_LINES, 2, 0,
1293 BLACKBIRD_FIELD1_SAA7115, 1254 BLACKBIRD_FIELD1_SAA7115,
1294 BLACKBIRD_FIELD2_SAA7115 1255 BLACKBIRD_FIELD2_SAA7115
1295 ); 1256 );
1296 1257
1297 /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_PLACEHOLDER, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); */ 1258 /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_PLACEHOLDER, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); */
1298 blackbird_api_cmd(dev, BLACKBIRD_API_SET_CUSTOM_DATA, 12, 0, 1259 blackbird_api_cmd(dev, CX2341X_ENC_SET_PLACEHOLDER, 12, 0,
1299 BLACKBIRD_CUSTOM_EXTENSION_USR_DATA, 1260 BLACKBIRD_CUSTOM_EXTENSION_USR_DATA,
1300 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); 1261 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1301 1262
1302 /* initialize the video input */ 1263 /* initialize the video input */
1303 blackbird_api_cmd(dev, BLACKBIRD_API_INIT_VIDEO_INPUT, 0, 0); 1264 blackbird_api_cmd(dev, CX2341X_ENC_INITIALIZE_INPUT, 0, 0);
1304 1265
1305 msleep(1); 1266 msleep(1);
1306 1267
1307 blackbird_api_cmd(dev, BLACKBIRD_API_MUTE_VIDEO, 1, 0, BLACKBIRD_UNMUTE); 1268 blackbird_api_cmd(dev, CX2341X_ENC_MUTE_VIDEO, 1, 0, BLACKBIRD_UNMUTE);
1308 msleep(1); 1269 msleep(1);
1309 blackbird_api_cmd(dev, BLACKBIRD_API_MUTE_AUDIO, 1, 0, BLACKBIRD_UNMUTE); 1270 blackbird_api_cmd(dev, CX2341X_ENC_MUTE_AUDIO, 1, 0, BLACKBIRD_UNMUTE);
1310 msleep(1); 1271 msleep(1);
1311 1272
1312 /* start capturing to the host interface */ 1273 /* start capturing to the host interface */
1313 /* blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, 0, 0x13); */ 1274 /* blackbird_api_cmd(dev, CX2341X_ENC_START_CAPTURE, 2, 0, 0, 0x13); */
1314 blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, 1275 blackbird_api_cmd(dev, CX2341X_ENC_START_CAPTURE, 2, 0,
1315 BLACKBIRD_MPEG_CAPTURE, 1276 BLACKBIRD_MPEG_CAPTURE,
1316 BLACKBIRD_RAW_BITS_NONE 1277 BLACKBIRD_RAW_BITS_NONE
1317 ); 1278 );
1318 msleep(10); 1279 msleep(10);
1319 1280
1320 blackbird_api_cmd(dev, BLACKBIRD_API_REFRESH_INPUT, 0,0); 1281 blackbird_api_cmd(dev, CX2341X_ENC_REFRESH_INPUT, 0,0);
1321 return 0; 1282 return 0;
1322} 1283}
1323 1284
@@ -1562,8 +1523,8 @@ static int mpeg_release(struct inode *inode, struct file *file)
1562{ 1523{
1563 struct cx8802_fh *fh = file->private_data; 1524 struct cx8802_fh *fh = file->private_data;
1564 1525
1565 /* blackbird_api_cmd(fh->dev, BLACKBIRD_API_END_CAPTURE, 3, 0, BLACKBIRD_END_NOW, 0, 0x13); */ 1526 /* blackbird_api_cmd(fh->dev, CX2341X_ENC_STOP_CAPTURE, 3, 0, BLACKBIRD_END_NOW, 0, 0x13); */
1566 blackbird_api_cmd(fh->dev, BLACKBIRD_API_END_CAPTURE, 3, 0, 1527 blackbird_api_cmd(fh->dev, CX2341X_ENC_STOP_CAPTURE, 3, 0,
1567 BLACKBIRD_END_NOW, 1528 BLACKBIRD_END_NOW,
1568 BLACKBIRD_MPEG_CAPTURE, 1529 BLACKBIRD_MPEG_CAPTURE,
1569 BLACKBIRD_RAW_BITS_NONE 1530 BLACKBIRD_RAW_BITS_NONE