From 19d2eff7919ee22a390dfd6958d1fb61fae6c564 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Fri, 14 Apr 2006 01:41:25 -0400 Subject: cx88-blackbird: use firmware api commands defined in cx2341x.h From: Michael Krufky 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 --- linux/drivers/media/video/cx88/cx88-blackbird.c | 123 ++++++++---------------- 1 file changed, 42 insertions(+), 81 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/video/cx88/cx88-blackbird.c b/linux/drivers/media/video/cx88/cx88-blackbird.c index e1e9580b2..27f03a4e0 100644 --- a/linux/drivers/media/video/cx88/cx88-blackbird.c +++ b/linux/drivers/media/video/cx88/cx88-blackbird.c @@ -33,9 +33,10 @@ #include #endif #include +#include +#include #include "cx88.h" -#include MODULE_DESCRIPTION("driver for cx2388x/cx23416 based mpeg encoder cards"); MODULE_AUTHOR("Jelle Foks , Gerd Knorr [SuSE Labs]"); @@ -69,8 +70,6 @@ static LIST_HEAD(cx8802_devlist); #endif #define IVTV_API_STD_TIMEOUT 500 -#define BLACKBIRD_API_PING 0x80 -#define BLACKBIRD_API_BEGIN_CAPTURE 0x81 enum blackbird_capture_type { BLACKBIRD_MPEG_CAPTURE, BLACKBIRD_RAW_CAPTURE, @@ -84,21 +83,14 @@ enum blackbird_capture_bits { BLACKBIRD_RAW_BITS_PASSTHRU_CAPTURE = 0x08, BLACKBIRD_RAW_BITS_TO_HOST_CAPTURE = 0x10 }; -#define BLACKBIRD_API_END_CAPTURE 0x82 enum blackbird_capture_end { BLACKBIRD_END_AT_GOP, /* stop at the end of gop, generate irq */ BLACKBIRD_END_NOW, /* stop immediately, no irq */ }; -#define BLACKBIRD_API_SET_AUDIO_ID 0x89 -#define BLACKBIRD_API_SET_VIDEO_ID 0x8B -#define BLACKBIRD_API_SET_PCR_ID 0x8D -#define BLACKBIRD_API_SET_FRAMERATE 0x8F enum blackbird_framerate { BLACKBIRD_FRAMERATE_NTSC_30, /* NTSC: 30fps */ BLACKBIRD_FRAMERATE_PAL_25 /* PAL: 25fps */ }; -#define BLACKBIRD_API_SET_RESOLUTION 0x91 -#define BLACKBIRD_API_SET_VIDEO_BITRATE 0x95 enum blackbird_video_bitrate_type { BLACKBIRD_VIDEO_VBR, BLACKBIRD_VIDEO_CBR @@ -109,8 +101,6 @@ enum blackbird_mux_rate { /* dvd mux rate: multiply by 400 to get the actual rate */ BLACKBIRD_MUX_RATE_DVD = 25200 }; -#define BLACKBIRD_API_SET_GOP_STRUCTURE 0x97 -#define BLACKBIRD_API_SET_ASPECT_RATIO 0x99 enum blackbird_aspect_ratio { BLACKBIRD_ASPECT_RATIO_FORBIDDEN, BLACKBIRD_ASPECT_RATIO_1_1_SQUARE, @@ -119,7 +109,6 @@ enum blackbird_aspect_ratio { BLACKBIRD_ASPECT_RATIO_221_100, BLACKBIRD_ASPECT_RATIO_RESERVED }; -#define BLACKBIRD_API_SET_DNR_MODE 0x9B enum blackbird_dnr_bits { BLACKBIRD_DNR_BITS_MANUAL, BLACKBIRD_DNR_BITS_AUTO_SPATIAL, @@ -133,9 +122,6 @@ enum blackbird_median_filter { BLACKBIRD_MEDIAN_FILTER_HV, BLACKBIRD_MEDIAN_FILTER_DIAGONAL }; -#define BLACKBIRD_API_SET_MANUAL_DNR 0x9D -#define BLACKBIRD_API_SET_DNR_MEDIAN 0x9F -#define BLACKBIRD_API_SET_SPATIAL_FILTER 0xA1 enum blackbird_spatial_filter_luma { BLACKBIRD_SPATIAL_FILTER_LUMA_DISABLED, BLACKBIRD_SPATIAL_FILTER_LUMA_1D_HORIZ, @@ -147,12 +133,10 @@ enum blackbird_spatial_filter_chroma { BLACKBIRD_SPATIAL_FILTER_CHROMA_DISABLED, BLACKBIRD_SPATIAL_FILTER_CHROMA_1D_HORIZ /* default */ }; -#define BLACKBIRD_API_SET_3_2_PULLDOWN 0xB1 enum blackbird_pulldown { BLACKBIRD_3_2_PULLDOWN_DISABLED, BLACKBIRD_3_2_PULLDOWN_ENABLED }; -#define BLACKBIRD_API_SET_VBI_LINE_NO 0xB7 enum blackbird_vbi_line_bits { BLACKBIRD_VBI_LINE_BITS_TOP_FIELD, BLACKBIRD_VBI_LINE_BITS_BOT_FIELD = (1 << 31), @@ -166,7 +150,6 @@ enum blackbird_vbi_slicing { BLACKBIRD_VBI_SLICING_NONE, BLACKBIRD_VBI_SLICING_CLOSED_CAPTION }; -#define BLACKBIRD_API_SET_STREAM_TYPE 0xB9 enum blackbird_stream_type { BLACKBIRD_STREAM_PROGRAM, BLACKBIRD_STREAM_TRANSPORT, @@ -182,13 +165,11 @@ enum blackbird_stream_type { BLACKBIRD_STREAM_VCD, BLACKBIRD_STREAM_UNKNOWN12 /* svcd/xvcd ? */ }; -#define BLACKBIRD_API_SET_OUTPUT_PORT 0xBB enum blackbird_stream_port { BLACKBIRD_OUTPUT_PORT_MEMORY, BLACKBIRD_OUTPUT_PORT_STREAMING, BLACKBIRD_OUTPUT_PORT_SERIAL }; -#define BLACKBIRD_API_SET_AUDIO_PARAMS 0xBD enum blackbird_audio_bits_sample_rate { BLACKBIRD_AUDIO_BITS_44100HZ, BLACKBIRD_AUDIO_BITS_48000HZ, @@ -263,26 +244,20 @@ enum blackbird_audio_bits_original { BLACKBIRD_AUDIO_BITS_COPY, BLACKBIRD_AUDIO_BITS_ORIGINAL = 0x1 << 16, }; -#define BLACKBIRD_API_HALT 0xC3 -#define BLACKBIRD_API_GET_VERSION 0xC4 -#define BLACKBIRD_API_SET_GOP_CLOSURE 0xC5 enum blackbird_gop_closure { BLACKBIRD_GOP_CLOSURE_OFF, BLACKBIRD_GOP_CLOSURE_ON, }; -#define BLACKBIRD_API_DATA_XFER_STATUS 0xC6 enum blackbird_data_xfer_status { BLACKBIRD_MORE_BUFFERS_FOLLOW, BLACKBIRD_LAST_BUFFER, }; -#define BLACKBIRD_API_PROGRAM_INDEX_INFO 0xC7 enum blackbird_picture_mask { BLACKBIRD_PICTURE_MASK_NONE, BLACKBIRD_PICTURE_MASK_I_FRAMES, BLACKBIRD_PICTURE_MASK_I_P_FRAMES = 0x3, BLACKBIRD_PICTURE_MASK_ALL_FRAMES = 0x7, }; -#define BLACKBIRD_API_SET_VBI_PARAMS 0xC8 enum blackbird_vbi_mode_bits { BLACKBIRD_VBI_BITS_SLICED, BLACKBIRD_VBI_BITS_RAW, @@ -294,33 +269,23 @@ enum blackbird_vbi_insertion_bits { BLACKBIRD_VBI_BITS_SEPARATE_STREAM_USR_DATA = 0x4 << 1, BLACKBIRD_VBI_BITS_SEPARATE_STREAM_PRV_DATA = 0x5 << 1, }; -#define BLACKBIRD_API_SET_DMA_BLOCK_SIZE 0xC9 enum blackbird_dma_unit { BLACKBIRD_DMA_BYTES, BLACKBIRD_DMA_FRAMES, }; -#define BLACKBIRD_API_DMA_TRANSFER_INFO 0xCA -#define BLACKBIRD_API_DMA_TRANSFER_STAT 0xCB enum blackbird_dma_transfer_status_bits { BLACKBIRD_DMA_TRANSFER_BITS_DONE = 0x01, BLACKBIRD_DMA_TRANSFER_BITS_ERROR = 0x04, BLACKBIRD_DMA_TRANSFER_BITS_LL_ERROR = 0x10, }; -#define BLACKBIRD_API_SET_DMA2HOST_ADDR 0xCC -#define BLACKBIRD_API_INIT_VIDEO_INPUT 0xCD -#define BLACKBIRD_API_SET_FRAMESKIP 0xD0 -#define BLACKBIRD_API_PAUSE 0xD2 enum blackbird_pause { BLACKBIRD_PAUSE_ENCODING, BLACKBIRD_RESUME_ENCODING, }; -#define BLACKBIRD_API_REFRESH_INPUT 0xD3 -#define BLACKBIRD_API_SET_COPYRIGHT 0xD4 enum blackbird_copyright { BLACKBIRD_COPYRIGHT_OFF, BLACKBIRD_COPYRIGHT_ON, }; -#define BLACKBIRD_API_SET_NOTIFICATION 0xD5 enum blackbird_notification_type { BLACKBIRD_NOTIFICATION_REFRESH, }; @@ -331,7 +296,6 @@ enum blackbird_notification_status { enum blackbird_notification_mailbox { BLACKBIRD_NOTIFICATION_NO_MAILBOX = -1, }; -#define BLACKBIRD_API_SET_CAPTURE_LINES 0xD6 enum blackbird_field1_lines { BLACKBIRD_FIELD1_SAA7114 = 0x00EF, /* 239 */ BLACKBIRD_FIELD1_SAA7115 = 0x00F0, /* 240 */ @@ -342,12 +306,10 @@ enum blackbird_field2_lines { BLACKBIRD_FIELD2_SAA7115 = 0x00F0, /* 240 */ BLACKBIRD_FIELD2_MICRONAS = 0x0106, /* 262 */ }; -#define BLACKBIRD_API_SET_CUSTOM_DATA 0xD7 enum blackbird_custom_data_type { BLACKBIRD_CUSTOM_EXTENSION_USR_DATA, BLACKBIRD_CUSTOM_PRIVATE_PACKET, }; -#define BLACKBIRD_API_MUTE_VIDEO 0xD9 enum blackbird_mute { BLACKBIRD_UNMUTE, BLACKBIRD_MUTE, @@ -362,7 +324,6 @@ enum blackbird_mute_video_shift { BLACKBIRD_MUTE_VIDEO_U_SHIFT = 16, BLACKBIRD_MUTE_VIDEO_Y_SHIFT = 24, }; -#define BLACKBIRD_API_MUTE_AUDIO 0xDA /* Registers */ #define IVTV_REG_ENC_SDRAM_REFRESH (0x07F8 /*| IVTV_REG_OFFSET*/) @@ -803,33 +764,33 @@ static void blackbird_set_default_params(struct cx8802_dev *dev) params->vi_type = V4L2_MPEG_VI_1; else params->vi_type = V4L2_MPEG_VI_2; - blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, mpeg_stream_types[params->st_type]); + blackbird_api_cmd(dev, CX2341X_ENC_SET_STREAM_TYPE, 1, 0, mpeg_stream_types[params->st_type]); /* assign framerate */ if( params->vi_frame_rate <= 25 ) { params->vi_frame_rate = 25; - blackbird_api_cmd(dev, BLACKBIRD_API_SET_FRAMERATE, 1, 0, BLACKBIRD_FRAMERATE_PAL_25); + blackbird_api_cmd(dev, CX2341X_ENC_SET_FRAME_RATE, 1, 0, BLACKBIRD_FRAMERATE_PAL_25); } else { params->vi_frame_rate = 30; - blackbird_api_cmd(dev, BLACKBIRD_API_SET_FRAMERATE, 1, 0, BLACKBIRD_FRAMERATE_NTSC_30); + blackbird_api_cmd(dev, CX2341X_ENC_SET_FRAME_RATE, 1, 0, BLACKBIRD_FRAMERATE_NTSC_30); } /* assign aspect ratio */ if( params->vi_aspect_ratio >= ARRAY_SIZE(mpeg_stream_ratios) ) params->vi_aspect_ratio = V4L2_MPEG_ASPECT_4_3; - blackbird_api_cmd(dev, BLACKBIRD_API_SET_ASPECT_RATIO, 1, 0, mpeg_stream_ratios[params->vi_aspect_ratio]); + blackbird_api_cmd(dev, CX2341X_ENC_SET_ASPECT_RATIO, 1, 0, mpeg_stream_ratios[params->vi_aspect_ratio]); /* assign gop properties */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_STRUCTURE, 2, 0, params->vi_frames_per_gop, params->vi_bframes_count+1); + blackbird_api_cmd(dev, CX2341X_ENC_SET_GOP_PROPERTIES, 2, 0, params->vi_frames_per_gop, params->vi_bframes_count+1); /* assign gop closure */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_CLOSURE, 1, 0, params->closed_gops); + blackbird_api_cmd(dev, CX2341X_ENC_SET_GOP_CLOSURE, 1, 0, params->closed_gops); /* assign 3 2 pulldown */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_3_2_PULLDOWN, 1, 0, params->pulldown); + blackbird_api_cmd(dev, CX2341X_ENC_SET_3_2_PULLDOWN, 1, 0, params->pulldown); /* make sure the params are within bounds */ if( params->st_bitrate.mode >= ARRAY_SIZE(mpeg_video_bitrates) ) @@ -919,7 +880,7 @@ static void blackbird_set_default_params(struct cx8802_dev *dev) params->au_bitrate.target = params->au_bitrate.max = 0; au_params |= 0; } - blackbird_api_cmd(dev, BLACKBIRD_API_SET_AUDIO_PARAMS, 1, 0, au_params ); + blackbird_api_cmd(dev, CX2341X_ENC_SET_AUDIO_PROPERTIES, 1, 0, au_params ); /* assign bitrates */ if( params->vi_bitrate.mode ) @@ -946,7 +907,7 @@ static void blackbird_set_default_params(struct cx8802_dev *dev) params->vi_bitrate.max = params->st_bitrate.max - params->au_bitrate.max; params->vi_bitrate.target = params->st_bitrate.target - params->au_bitrate.target; } - blackbird_api_cmd(dev, BLACKBIRD_API_SET_VIDEO_BITRATE, 4, 0, + blackbird_api_cmd(dev, CX2341X_ENC_SET_BIT_RATE, 4, 0, mpeg_video_bitrates[params->vi_bitrate.mode], params->vi_bitrate.target * 1000, /* kbps -> bps */ params->vi_bitrate.max * 1000 / BLACKBIRD_PEAK_RATE_DIVISOR, /* peak/400 */ @@ -975,7 +936,7 @@ void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression * { UPDATE_PARAM( st_type ); UPDATE_PARAM( vi_type ); - blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, mpeg_stream_types[params->st_type]); + blackbird_api_cmd(dev, CX2341X_ENC_SET_STREAM_TYPE, 1, 0, mpeg_stream_types[params->st_type]); } /* assign framerate */ @@ -987,9 +948,9 @@ void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression * { UPDATE_PARAM( vi_frame_rate ); if( params->vi_frame_rate == 25 ) - blackbird_api_cmd(dev, BLACKBIRD_API_SET_FRAMERATE, 1, 0, BLACKBIRD_FRAMERATE_PAL_25); + blackbird_api_cmd(dev, CX2341X_ENC_SET_FRAME_RATE, 1, 0, BLACKBIRD_FRAMERATE_PAL_25); else - blackbird_api_cmd(dev, BLACKBIRD_API_SET_FRAMERATE, 1, 0, BLACKBIRD_FRAMERATE_NTSC_30); + blackbird_api_cmd(dev, CX2341X_ENC_SET_FRAME_RATE, 1, 0, BLACKBIRD_FRAMERATE_NTSC_30); } /* assign aspect ratio */ @@ -998,7 +959,7 @@ void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression * IF_PARAM( vi_aspect_ratio ) { UPDATE_PARAM( vi_aspect_ratio ); - blackbird_api_cmd(dev, BLACKBIRD_API_SET_ASPECT_RATIO, 1, 0, mpeg_stream_ratios[params->vi_aspect_ratio]); + blackbird_api_cmd(dev, CX2341X_ENC_SET_ASPECT_RATIO, 1, 0, mpeg_stream_ratios[params->vi_aspect_ratio]); } /* assign gop properties */ @@ -1006,21 +967,21 @@ void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression * { UPDATE_PARAM( vi_frames_per_gop ); UPDATE_PARAM( vi_bframes_count ); - blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_STRUCTURE, 2, 0, params->vi_frames_per_gop, params->vi_bframes_count+1); + blackbird_api_cmd(dev, CX2341X_ENC_SET_GOP_PROPERTIES, 2, 0, params->vi_frames_per_gop, params->vi_bframes_count+1); } /* assign gop closure */ IF_PARAM( closed_gops ) { UPDATE_PARAM( closed_gops ); - blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_CLOSURE, 1, 0, params->closed_gops); + blackbird_api_cmd(dev, CX2341X_ENC_SET_GOP_CLOSURE, 1, 0, params->closed_gops); } /* assign 3 2 pulldown */ IF_PARAM( pulldown ) { UPDATE_PARAM( pulldown ); - blackbird_api_cmd(dev, BLACKBIRD_API_SET_3_2_PULLDOWN, 1, 0, params->pulldown); + blackbird_api_cmd(dev, CX2341X_ENC_SET_3_2_PULLDOWN, 1, 0, params->pulldown); } /* make sure the params are within bounds */ @@ -1119,7 +1080,7 @@ void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression * UPDATE_PARAM( au_type ); UPDATE_PARAM( au_sample_rate ); UPDATE_PARAM( au_bitrate ); - blackbird_api_cmd(dev, BLACKBIRD_API_SET_AUDIO_PARAMS, 1, 0, au_params ); + blackbird_api_cmd(dev, CX2341X_ENC_SET_AUDIO_PROPERTIES, 1, 0, au_params ); } /* assign bitrates */ @@ -1153,7 +1114,7 @@ void blackbird_set_params(struct cx8802_dev *dev, struct v4l2_mpeg_compression * ) { UPDATE_PARAM( vi_bitrate ); - blackbird_api_cmd(dev, BLACKBIRD_API_SET_VIDEO_BITRATE, 4, 0, + blackbird_api_cmd(dev, CX2341X_ENC_SET_BIT_RATE, 4, 0, mpeg_video_bitrates[params->vi_bitrate.mode], params->vi_bitrate.target * 1000, /* kbps -> bps */ params->vi_bitrate.max * 1000 / BLACKBIRD_PEAK_RATE_DIVISOR, /* peak/400 */ @@ -1180,7 +1141,7 @@ static void blackbird_set_default_dnr_params(struct cx8802_dev *dev) dev->dnr_params.mode = BLACKBIRD_DNR_BITS_MANUAL; if( dev->dnr_params.type > BLACKBIRD_MEDIAN_FILTER_DIAGONAL ) dev->dnr_params.type = BLACKBIRD_MEDIAN_FILTER_DISABLED; - blackbird_api_cmd(dev, BLACKBIRD_API_SET_DNR_MODE, 2, 0, + blackbird_api_cmd(dev, CX2341X_ENC_SET_DNR_FILTER_MODE, 2, 0, dev->dnr_params.mode, dev->dnr_params.type ); @@ -1190,7 +1151,7 @@ static void blackbird_set_default_dnr_params(struct cx8802_dev *dev) dev->dnr_params.spatial = 15; if( dev->dnr_params.temporal > 31 ) dev->dnr_params.temporal = 31; - blackbird_api_cmd(dev, BLACKBIRD_API_SET_MANUAL_DNR, 2, 0, + blackbird_api_cmd(dev, CX2341X_ENC_SET_DNR_FILTER_PROPS, 2, 0, dev->dnr_params.spatial, dev->dnr_params.temporal ); @@ -1210,7 +1171,7 @@ void blackbird_set_dnr_params(struct cx8802_dev *dev, struct blackbird_dnr* dnr_ { UPDATE_DNR_PARAM( mode ); UPDATE_DNR_PARAM( type ); - blackbird_api_cmd(dev, BLACKBIRD_API_SET_DNR_MODE, 2, 0, dnr_params->mode, dnr_params->type); + blackbird_api_cmd(dev, CX2341X_ENC_SET_DNR_FILTER_MODE, 2, 0, dnr_params->mode, dnr_params->type); } /* assign dnr filter props*/ @@ -1222,7 +1183,7 @@ void blackbird_set_dnr_params(struct cx8802_dev *dev, struct blackbird_dnr* dnr_ { UPDATE_DNR_PARAM( spatial ); UPDATE_DNR_PARAM( temporal ); - blackbird_api_cmd(dev, BLACKBIRD_API_SET_MANUAL_DNR, 2, 0, dnr_params->spatial, dnr_params->temporal); + blackbird_api_cmd(dev, CX2341X_ENC_SET_DNR_FILTER_PROPS, 2, 0, dnr_params->spatial, dnr_params->temporal); } } @@ -1230,17 +1191,17 @@ static void blackbird_codec_settings(struct cx8802_dev *dev) { /* assign output port */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_OUTPUT_PORT, 1, 0, BLACKBIRD_OUTPUT_PORT_STREAMING); /* Host */ + blackbird_api_cmd(dev, CX2341X_ENC_SET_OUTPUT_PORT, 1, 0, BLACKBIRD_OUTPUT_PORT_STREAMING); /* Host */ /* assign frame size */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_RESOLUTION, 2, 0, + blackbird_api_cmd(dev, CX2341X_ENC_SET_FRAME_SIZE, 2, 0, dev->height, dev->width); /* assign coring levels (luma_h, luma_l, chroma_h, chroma_l) */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_DNR_MEDIAN, 4, 0, 0, 255, 0, 255); + blackbird_api_cmd(dev, CX2341X_ENC_SET_CORING_LEVELS, 4, 0, 0, 255, 0, 255); /* assign spatial filter type: luma_t: horiz_only, chroma_t: horiz_only */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_SPATIAL_FILTER, 2, 0, + blackbird_api_cmd(dev, CX2341X_ENC_SET_SPATIAL_FILTER_TYPE, 2, 0, BLACKBIRD_SPATIAL_FILTER_LUMA_1D_HORIZ, BLACKBIRD_SPATIAL_FILTER_CHROMA_1D_HORIZ ); @@ -1259,7 +1220,7 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) int retval; dprintk(1,"Initialize codec\n"); - retval = blackbird_api_cmd(dev, BLACKBIRD_API_PING, 0, 0); /* ping */ + retval = blackbird_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0); /* ping */ if (retval < 0) { /* ping was not successful, reset and upload firmware */ cx_write(MO_SRST_IO, 0); /* SYS_RSTO=0 */ @@ -1274,13 +1235,13 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) if (dev->mailbox < 0) return -1; - retval = blackbird_api_cmd(dev, BLACKBIRD_API_PING, 0, 0); /* ping */ + retval = blackbird_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0); /* ping */ if (retval < 0) { dprintk(0, "ERROR: Firmware ping failed!\n"); return -1; } - retval = blackbird_api_cmd(dev, BLACKBIRD_API_GET_VERSION, 0, 1, &version); + retval = blackbird_api_cmd(dev, CX2341X_ENC_GET_VERSION, 0, 1, &version); if (retval < 0) { dprintk(0, "ERROR: Firmware get encoder version failed!\n"); return -1; @@ -1300,35 +1261,35 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xef, 0xef); blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xf0, 0xf0); blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0x180, 0x180); */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_CAPTURE_LINES, 2, 0, + blackbird_api_cmd(dev, CX2341X_ENC_SET_NUM_VSYNC_LINES, 2, 0, BLACKBIRD_FIELD1_SAA7115, BLACKBIRD_FIELD2_SAA7115 ); /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_PLACEHOLDER, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); */ - blackbird_api_cmd(dev, BLACKBIRD_API_SET_CUSTOM_DATA, 12, 0, + blackbird_api_cmd(dev, CX2341X_ENC_SET_PLACEHOLDER, 12, 0, BLACKBIRD_CUSTOM_EXTENSION_USR_DATA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); /* initialize the video input */ - blackbird_api_cmd(dev, BLACKBIRD_API_INIT_VIDEO_INPUT, 0, 0); + blackbird_api_cmd(dev, CX2341X_ENC_INITIALIZE_INPUT, 0, 0); msleep(1); - blackbird_api_cmd(dev, BLACKBIRD_API_MUTE_VIDEO, 1, 0, BLACKBIRD_UNMUTE); + blackbird_api_cmd(dev, CX2341X_ENC_MUTE_VIDEO, 1, 0, BLACKBIRD_UNMUTE); msleep(1); - blackbird_api_cmd(dev, BLACKBIRD_API_MUTE_AUDIO, 1, 0, BLACKBIRD_UNMUTE); + blackbird_api_cmd(dev, CX2341X_ENC_MUTE_AUDIO, 1, 0, BLACKBIRD_UNMUTE); msleep(1); /* start capturing to the host interface */ - /* blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, 0, 0x13); */ - blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, + /* blackbird_api_cmd(dev, CX2341X_ENC_START_CAPTURE, 2, 0, 0, 0x13); */ + blackbird_api_cmd(dev, CX2341X_ENC_START_CAPTURE, 2, 0, BLACKBIRD_MPEG_CAPTURE, BLACKBIRD_RAW_BITS_NONE ); msleep(10); - blackbird_api_cmd(dev, BLACKBIRD_API_REFRESH_INPUT, 0,0); + blackbird_api_cmd(dev, CX2341X_ENC_REFRESH_INPUT, 0,0); return 0; } @@ -1485,7 +1446,7 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file, #endif #if 0 cx88_set_scale(core, f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.field); - blackbird_api_cmd(dev, BLACKBIRD_API_SET_RESOLUTION, 2, 0, + blackbird_api_cmd(dev, CX2341X_ENC_SET_FRAME_SIZE, 2, 0, f->fmt.pix.height, f->fmt.pix.width); #endif dprintk(0,"VIDIOC_S_FMT: w: %d, h: %d, f: %d\n", @@ -1595,8 +1556,8 @@ static int mpeg_release(struct inode *inode, struct file *file) { struct cx8802_fh *fh = file->private_data; - /* blackbird_api_cmd(fh->dev, BLACKBIRD_API_END_CAPTURE, 3, 0, BLACKBIRD_END_NOW, 0, 0x13); */ - blackbird_api_cmd(fh->dev, BLACKBIRD_API_END_CAPTURE, 3, 0, + /* blackbird_api_cmd(fh->dev, CX2341X_ENC_STOP_CAPTURE, 3, 0, BLACKBIRD_END_NOW, 0, 0x13); */ + blackbird_api_cmd(fh->dev, CX2341X_ENC_STOP_CAPTURE, 3, 0, BLACKBIRD_END_NOW, BLACKBIRD_MPEG_CAPTURE, BLACKBIRD_RAW_BITS_NONE -- cgit v1.2.3 From 67d2f6581bdc504d2728d7dc27f09e79ca689988 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Fri, 14 Apr 2006 11:33:20 -0400 Subject: cx88-blackbird: use standard filename for cx23416 encoder firmware From: Michael Krufky cx88-blackbird uses the same encoder firmware for the cx23416 chip that is used by ivtv and pvrusb2. This patch alters the driver to expect the cx23416 encoder firmware to be located in the file, "v4l-cx2341x-enc.fw", instead of using "blackbird-fw-enc.bin" Signed-off-by: Michael Krufky --- linux/drivers/media/video/cx88/cx88-blackbird.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux') diff --git a/linux/drivers/media/video/cx88/cx88-blackbird.c b/linux/drivers/media/video/cx88/cx88-blackbird.c index 27f03a4e0..1808796b4 100644 --- a/linux/drivers/media/video/cx88/cx88-blackbird.c +++ b/linux/drivers/media/video/cx88/cx88-blackbird.c @@ -57,7 +57,7 @@ static LIST_HEAD(cx8802_devlist); /* ------------------------------------------------------------------ */ -#define BLACKBIRD_FIRM_ENC_FILENAME "blackbird-fw-enc.bin" +#define BLACKBIRD_FIRM_ENC_FILENAME "v4l-cx2341x-enc.fw" #define BLACKBIRD_FIRM_IMAGE_SIZE 256*1024 /* defines below are from ivtv-driver.h */ -- cgit v1.2.3 From 9f5fd95e9b91a458a32bd8687d3924d6d6e1ac0a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 28 Apr 2006 10:48:01 -0300 Subject: Em28xx/: possible cleanups From: Adrian Bunk This patch contains the following possible cleanups: - make the following needlessly global functions static: - em28xx-core.c: em28xx_accumulator_set() - em28xx-core.c: em28xx_capture_area_set() - em28xx-core.c: em28xx_scaler_set() - em28xx-core.c: em28xx_isocIrq() - remove the following unused EXPORT_SYMBOL's: - em28xx-cards.c: em28xx_boards - em28xx-cards.c: em28xx_bcount - em28xx-cards.c: em28xx_id_table Signed-off-by: Adrian Bunk Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/em28xx/em28xx-cards.c | 4 ---- linux/drivers/media/video/em28xx/em28xx-core.c | 10 +++++----- linux/drivers/media/video/em28xx/em28xx.h | 6 ------ 3 files changed, 5 insertions(+), 15 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/video/em28xx/em28xx-cards.c b/linux/drivers/media/video/em28xx/em28xx-cards.c index 84b764b7d..48240b3ec 100644 --- a/linux/drivers/media/video/em28xx/em28xx-cards.c +++ b/linux/drivers/media/video/em28xx/em28xx-cards.c @@ -402,8 +402,4 @@ void em28xx_card_setup(struct em28xx *dev) } } -EXPORT_SYMBOL(em28xx_boards); -EXPORT_SYMBOL(em28xx_bcount); -EXPORT_SYMBOL(em28xx_id_table); - MODULE_DEVICE_TABLE (usb, em28xx_id_table); diff --git a/linux/drivers/media/video/em28xx/em28xx-core.c b/linux/drivers/media/video/em28xx/em28xx-core.c index 91422b642..ff0cd9563 100644 --- a/linux/drivers/media/video/em28xx/em28xx-core.c +++ b/linux/drivers/media/video/em28xx/em28xx-core.c @@ -375,8 +375,8 @@ int em28xx_outfmt_set_yuv422(struct em28xx *dev) return em28xx_write_regs(dev, VINCTRL_REG, "\x11", 1); } -int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax, u8 ymin, - u8 ymax) +static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax, + u8 ymin, u8 ymax) { em28xx_coredbg("em28xx Scale: (%d,%d)-(%d,%d)\n", xmin, ymin, xmax, ymax); @@ -386,7 +386,7 @@ int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax, u8 ymin, return em28xx_write_regs(dev, YMAX_REG, &ymax, 1); } -int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart, +static int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart, u16 width, u16 height) { u8 cwidth = width; @@ -403,7 +403,7 @@ int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart, return em28xx_write_regs(dev, OFLOW_REG, &overflow, 1); } -int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v) +static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v) { u8 mode; /* the em2800 scaler only supports scaling down to 50% */ @@ -592,7 +592,7 @@ static inline void em28xx_isoc_video_copy(struct em28xx *dev, * em28xx_isoIrq() * handles the incoming isoc urbs and fills the frames from our inqueue */ -void em28xx_isocIrq(struct urb *urb, struct pt_regs *regs) +static void em28xx_isocIrq(struct urb *urb, struct pt_regs *regs) { struct em28xx *dev = urb->context; int i, status; diff --git a/linux/drivers/media/video/em28xx/em28xx.h b/linux/drivers/media/video/em28xx/em28xx.h index 97744214b..8b4c54f9f 100644 --- a/linux/drivers/media/video/em28xx/em28xx.h +++ b/linux/drivers/media/video/em28xx/em28xx.h @@ -326,13 +326,7 @@ int em28xx_audio_analog_set(struct em28xx *dev); int em28xx_colorlevels_set_default(struct em28xx *dev); int em28xx_capture_start(struct em28xx *dev, int start); int em28xx_outfmt_set_yuv422(struct em28xx *dev); -int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax, u8 ymin, - u8 ymax); -int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart, - u16 width, u16 height); -int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v); int em28xx_resolution_set(struct em28xx *dev); -void em28xx_isocIrq(struct urb *urb, struct pt_regs *regs); int em28xx_init_isoc(struct em28xx *dev); void em28xx_uninit_isoc(struct em28xx *dev); int em28xx_set_alternate(struct em28xx *dev); -- cgit v1.2.3 From 7445f5a6addde5bb3f20242677399e4790e5a4d9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 28 Apr 2006 10:48:41 -0300 Subject: Bt8xx/bttv-cards.c: fix off-by-one errors From: Adrian Bunk This patch fixes two off-by-one errors spotted by the Coverity checker. Signed-off-by: Adrian Bunk Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/bt8xx/bttv-cards.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/video/bt8xx/bttv-cards.c b/linux/drivers/media/video/bt8xx/bttv-cards.c index cd45a2429..909084515 100644 --- a/linux/drivers/media/video/bt8xx/bttv-cards.c +++ b/linux/drivers/media/video/bt8xx/bttv-cards.c @@ -3014,13 +3014,13 @@ void __devinit bttv_idcard(struct bttv *btv) if (UNSET != audiomux[0]) { gpiobits = 0; - for (i = 0; i < 5; i++) { + for (i = 0; i < 4; i++) { bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i]; gpiobits |= audiomux[i]; } } else { gpiobits = audioall; - for (i = 0; i < 5; i++) { + for (i = 0; i < 4; i++) { bttv_tvcards[btv->c.type].gpiomux[i] = audioall; } } -- cgit v1.2.3 From 02fcdd405f0481e03cf7f88ceaf7c6fd8b981b49 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 30 Apr 2006 23:08:00 -0400 Subject: cx88-blackbird: pause the encoder during frequency change From: Valentin Zagura Added code to cx88-blackbird.c to treat the VIDIOC_S_FREQUENCY ioctl to stop mpeg stream before changing the frequency and restart it after. It seems that the mpeg stream needs to be paused while changing the channel frequency, otherwise the mpeg encoder enters into a bad state, producing artifacts. Signed-off-by: Valentin Zagura Signed-off-by: Michael Krufky --- linux/drivers/media/video/cx88/cx88-blackbird.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'linux') diff --git a/linux/drivers/media/video/cx88/cx88-blackbird.c b/linux/drivers/media/video/cx88/cx88-blackbird.c index 353dff4b4..844115b35 100644 --- a/linux/drivers/media/video/cx88/cx88-blackbird.c +++ b/linux/drivers/media/video/cx88/cx88-blackbird.c @@ -1489,6 +1489,20 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file, blackbird_set_params(dev, f); return 0; } + case VIDIOC_S_FREQUENCY: + { + blackbird_api_cmd(fh->dev, CX2341X_ENC_STOP_CAPTURE, 3, 0, + BLACKBIRD_END_NOW, + BLACKBIRD_MPEG_CAPTURE, + BLACKBIRD_RAW_BITS_NONE); + + cx88_do_ioctl( inode, file, 0, dev->core, cmd, arg, cx88_ioctl_hook ); + + blackbird_initialize_codec(dev); + cx88_set_scale(dev->core, dev->width, dev->height, + fh->mpegq.field); + return 0; + } default: return cx88_do_ioctl( inode, file, 0, dev->core, cmd, arg, cx88_ioctl_hook ); -- cgit v1.2.3 From c9d707b6322f604c9a3a40ddc0a2b778a080806f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 2 May 2006 09:00:31 -0300 Subject: Fix CONFIG_VIDEO_VIVI=y build bug From: Ingo Molnar CONFIG_VIDEO_VIVI depends on CONFIG_VIDEO_BUF. Signed-off-by: Ingo Molnar Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'linux') diff --git a/linux/drivers/media/video/Kconfig b/linux/drivers/media/video/Kconfig index 4df2ede38..cf36fd123 100644 --- a/linux/drivers/media/video/Kconfig +++ b/linux/drivers/media/video/Kconfig @@ -19,6 +19,7 @@ config VIDEO_ADV_DEBUG config VIDEO_VIVI tristate "Virtual Video Driver" depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 + select VIDEO_BUF default n ---help--- Enables a virtual video driver. This device shows a color bar -- cgit v1.2.3 From 9a31a0d73f490c724252a18e59a5313561380c8c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 2 May 2006 09:01:13 -0300 Subject: Core: ULE fixes and RFC4326 additions From: Christian Praehauser Fix some problems regarding support for Unidirectional Lightweight Encapsulation (ULE) in dvbnet.c. The original ULE code was based on a draft. In the meantime, ULE has been published in RFC 4326 (ftp://ftp.rfc-editor.org/in-notes/rfc4326.txt). With these fixes, and some additions (which are included in the patch), the decaps code should now be complient to RFC4326. Signed-off-by: Christian Praehauser Signed-off-by: Andrew Morton Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/dvb/dvb-core/dvb_net.c | 230 +++++++++++++++++++---------- 1 file changed, 154 insertions(+), 76 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.c b/linux/drivers/media/dvb/dvb-core/dvb_net.c index 5f3c9b71f..a1989e336 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_net.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_net.c @@ -12,7 +12,7 @@ * Hilmar Linder * and Wolfram Stering * - * ULE Decaps according to draft-ietf-ipdvb-ule-03.txt. + * ULE Decaps according to RFC 4326. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -42,6 +42,9 @@ * Bugfixes and robustness improvements. * Filtering on dest MAC addresses, if present (D-Bit = 0) * ULE_DEBUG compile-time option. + * Apr 2006: cp v3: Bugfixes and compliency with RFC 4326 (ULE) by + * Christian Praehauser , + * Paris Lodron University of Salzburg. */ /* @@ -49,9 +52,6 @@ * * Unloading does not work for 2.6.9 kernels: a refcount doesn't go to zero. * - * TS_FEED callback is called once for every single TS cell although it is - * registered (in dvb_net_feed_start()) for 100 TS cells (used for dvb_net_ule()). - * */ #include @@ -92,6 +92,9 @@ static inline __u32 iov_crc32( __u32 c, struct kvec *iov, unsigned int cnt ) #ifdef ULE_DEBUG +#define MAC_ADDR_PRINTFMT "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x" +#define MAX_ADDR_PRINTFMT_ARGS(macap) (macap)[0],(macap)[1],(macap)[2],(macap)[3],(macap)[4],(macap)[5] + #define isprint(c) ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) static void hexdump( const unsigned char *buf, unsigned short len ) @@ -221,6 +224,8 @@ static unsigned short dvb_net_eth_type_trans(struct sk_buff *skb, #define ULE_TEST 0 #define ULE_BRIDGED 1 +#define ULE_OPTEXTHDR_PADDING 0 + static int ule_test_sndu( struct dvb_net_priv *p ) { return -1; @@ -228,14 +233,28 @@ static int ule_test_sndu( struct dvb_net_priv *p ) static int ule_bridged_sndu( struct dvb_net_priv *p ) { - /* BRIDGE SNDU handling sucks in draft-ietf-ipdvb-ule-03.txt. - * This has to be the last extension header, otherwise it won't work. - * Blame the authors! + struct ethhdr *hdr = (struct ethhdr*) p->ule_next_hdr; + if(ntohs(hdr->h_proto) < 1536) { + int framelen = p->ule_sndu_len - ((p->ule_next_hdr+sizeof(struct ethhdr)) - p->ule_skb->data); + /* A frame Type < 1536 for a bridged frame, introduces a LLC Length field. */ + if(framelen != ntohs(hdr->h_proto)) { + return -1; + } + } + /* Note: + * From RFC4326: + * "A bridged SNDU is a Mandatory Extension Header of Type 1. + * It must be the final (or only) extension header specified in the header chain of a SNDU." + * The 'ule_bridged' flag will cause the extension header processing loop to terminate. */ p->ule_bridged = 1; return 0; } +static int ule_exthdr_padding(struct dvb_net_priv *p) +{ + return 0; +} /** Handle ULE extension headers. * Function is called after a successful CRC32 verification of an ULE SNDU to complete its decoding. @@ -249,7 +268,8 @@ static int handle_one_ule_extension( struct dvb_net_priv *p ) { [0] = ule_test_sndu, [1] = ule_bridged_sndu, [2] = NULL, }; /* Table of optional extension header handlers. The header type is the index. */ - static int (*ule_optional_ext_handlers[255])( struct dvb_net_priv *p ) = { NULL, }; + static int (*ule_optional_ext_handlers[255])( struct dvb_net_priv *p ) = + { [0] = ule_exthdr_padding, [1] = NULL, }; int ext_len = 0; unsigned char hlen = (p->ule_sndu_type & 0x0700) >> 8; @@ -260,25 +280,31 @@ static int handle_one_ule_extension( struct dvb_net_priv *p ) /* Mandatory extension header */ if (ule_mandatory_ext_handlers[htype]) { ext_len = ule_mandatory_ext_handlers[htype]( p ); - p->ule_next_hdr += ext_len; - if (! p->ule_bridged) { - p->ule_sndu_type = ntohs( *(unsigned short *)p->ule_next_hdr ); - p->ule_next_hdr += 2; - } else { - p->ule_sndu_type = ntohs( *(unsigned short *)(p->ule_next_hdr + ((p->ule_dbit ? 2 : 3) * ETH_ALEN)) ); - /* This assures the extension handling loop will terminate. */ + if(ext_len >= 0) { + p->ule_next_hdr += ext_len; + if (!p->ule_bridged) { + p->ule_sndu_type = ntohs(*(unsigned short *)p->ule_next_hdr); + p->ule_next_hdr += 2; + } else { + p->ule_sndu_type = ntohs(*(unsigned short *)(p->ule_next_hdr + ((p->ule_dbit ? 2 : 3) * ETH_ALEN))); + /* This assures the extension handling loop will terminate. */ + } } + // else: extension handler failed or SNDU should be discarded } else ext_len = -1; /* SNDU has to be discarded. */ } else { /* Optional extension header. Calculate the length. */ - ext_len = hlen << 2; + ext_len = hlen << 1; /* Process the optional extension header according to its type. */ if (ule_optional_ext_handlers[htype]) (void)ule_optional_ext_handlers[htype]( p ); p->ule_next_hdr += ext_len; - p->ule_sndu_type = ntohs( *(unsigned short *)p->ule_next_hdr ); - p->ule_next_hdr += 2; + p->ule_sndu_type = ntohs( *(unsigned short *)(p->ule_next_hdr-2) ); + /* + * note: the length of the next header type is included in the + * length of THIS optional extension header + */ } return ext_len; @@ -291,8 +317,14 @@ static int handle_ule_extensions( struct dvb_net_priv *p ) p->ule_next_hdr = p->ule_skb->data; do { l = handle_one_ule_extension( p ); - if (l == -1) return -1; /* Stop extension header processing and discard SNDU. */ + if (l < 0) + return l; /* Stop extension header processing and discard SNDU. */ total_ext_len += l; +#ifdef ULE_DEBUG + dprintk("handle_ule_extensions: ule_next_hdr=%p, ule_sndu_type=%i, " + "l=%i, total_ext_len=%i\n", p->ule_next_hdr, + (int) p->ule_sndu_type, l, total_ext_len); +#endif } while (p->ule_sndu_type < 1536); @@ -362,8 +394,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) if (priv->ule_skb) { dev_kfree_skb( priv->ule_skb ); /* Prepare for next SNDU. */ - ((struct dvb_net_priv *) dev->priv)->stats.rx_errors++; - ((struct dvb_net_priv *) dev->priv)->stats.rx_frame_errors++; + priv->stats.rx_errors++; + priv->stats.rx_frame_errors++; } reset_ule(priv); priv->need_pusi = 1; @@ -403,27 +435,25 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) } } - /* Check continuity counter. */ if (new_ts) { + /* Check continuity counter. */ if ((ts[3] & 0x0F) == priv->tscc) priv->tscc = (priv->tscc + 1) & 0x0F; else { /* TS discontinuity handling: */ printk(KERN_WARNING "%lu: TS discontinuity: got %#x, " - "exptected %#x.\n", priv->ts_count, ts[3] & 0x0F, priv->tscc); + "expected %#x.\n", priv->ts_count, ts[3] & 0x0F, priv->tscc); /* Drop partly decoded SNDU, reset state, resync on PUSI. */ if (priv->ule_skb) { dev_kfree_skb( priv->ule_skb ); /* Prepare for next SNDU. */ // reset_ule(priv); moved to below. - ((struct dvb_net_priv *) dev->priv)->stats.rx_errors++; - ((struct dvb_net_priv *) dev->priv)->stats.rx_frame_errors++; + priv->stats.rx_errors++; + priv->stats.rx_frame_errors++; } reset_ule(priv); /* skip to next PUSI. */ priv->need_pusi = 1; - ts += TS_SZ; - priv->ts_count++; continue; } /* If we still have an incomplete payload, but PUSI is @@ -432,7 +462,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) * cells (continuity counter wrap). */ if (ts[1] & TS_PUSI) { if (! priv->need_pusi) { - if (*from_where > 181) { + if (!(*from_where < (ts_remain-1)) || *from_where != priv->ule_sndu_remain) { /* Pointer field is invalid. Drop this TS cell and any started ULE SNDU. */ printk(KERN_WARNING "%lu: Invalid pointer " "field: %u.\n", priv->ts_count, *from_where); @@ -445,8 +475,6 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) } reset_ule(priv); priv->need_pusi = 1; - ts += TS_SZ; - priv->ts_count++; continue; } /* Skip pointer field (we're processing a @@ -459,8 +487,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) if (priv->ule_sndu_remain > 183) { /* Current SNDU lacks more data than there could be available in the * current TS cell. */ - ((struct dvb_net_priv *) dev->priv)->stats.rx_errors++; - ((struct dvb_net_priv *) dev->priv)->stats.rx_length_errors++; + priv->stats.rx_errors++; + priv->stats.rx_length_errors++; printk(KERN_WARNING "%lu: Expected %d more SNDU bytes, but " "got PUSI (pf %d, ts_remain %d). Flushing incomplete payload.\n", priv->ts_count, priv->ule_sndu_remain, ts[4], ts_remain); @@ -499,9 +527,11 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) } else priv->ule_dbit = 0; - if (priv->ule_sndu_len > 32763) { + if (priv->ule_sndu_len < 5) { printk(KERN_WARNING "%lu: Invalid ULE SNDU length %u. " "Resyncing.\n", priv->ts_count, priv->ule_sndu_len); + priv->stats.rx_errors++; + priv->stats.rx_length_errors++; priv->ule_sndu_len = 0; priv->need_pusi = 1; new_ts = 1; @@ -615,58 +645,103 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) ule_dump = 1; #endif - ((struct dvb_net_priv *) dev->priv)->stats.rx_errors++; - ((struct dvb_net_priv *) dev->priv)->stats.rx_crc_errors++; + priv->stats.rx_errors++; + priv->stats.rx_crc_errors++; dev_kfree_skb(priv->ule_skb); } else { /* CRC32 verified OK. */ + u8 dest_addr[ETH_ALEN]; + static const u8 bc_addr[ETH_ALEN] = + { [ 0 ... ETH_ALEN-1] = 0xff }; + + /* CRC32 was OK. Remove it from skb. */ + priv->ule_skb->tail -= 4; + priv->ule_skb->len -= 4; + + if (!priv->ule_dbit) { + /* + * The destination MAC address is the + * next data in the skb. It comes + * before any extension headers. + * + * Check if the payload of this SNDU + * should be passed up the stack. + */ + register int drop = 0; + if (priv->rx_mode != RX_MODE_PROMISC) { + if (priv->ule_skb->data[0] & 0x01) { + /* multicast or broadcast */ + if (memcmp(priv->ule_skb->data, bc_addr, ETH_ALEN)) { + /* multicast */ + if (priv->rx_mode == RX_MODE_MULTI) { + int i; + for(i = 0; i < priv->multi_num && memcmp(priv->ule_skb->data, priv->multi_macs[i], ETH_ALEN); i++) + ; + if (i == priv->multi_num) + drop = 1; + } else if (priv->rx_mode != RX_MODE_ALL_MULTI) + drop = 1; /* no broadcast; */ + /* else: all multicast mode: accept all multicast packets */ + } + /* else: broadcast */ + } + else if (memcmp(priv->ule_skb->data, dev->dev_addr, ETH_ALEN)) + drop = 1; + /* else: destination address matches the MAC address of our receiver device */ + } + /* else: promiscious mode; pass everything up the stack */ + + if (drop) { +#ifdef ULE_DEBUG + dprintk("Dropping SNDU: MAC destination address does not match: dest addr: "MAC_ADDR_PRINTFMT", dev addr: "MAC_ADDR_PRINTFMT"\n", + MAX_ADDR_PRINTFMT_ARGS(priv->ule_skb->data), MAX_ADDR_PRINTFMT_ARGS(dev->dev_addr)); +#endif + dev_kfree_skb(priv->ule_skb); + goto sndu_done; + } + else + { + memcpy(dest_addr, priv->ule_skb->data, ETH_ALEN); + skb_pull(priv->ule_skb, ETH_ALEN); + } + } + /* Handle ULE Extension Headers. */ if (priv->ule_sndu_type < 1536) { /* There is an extension header. Handle it accordingly. */ - int l = handle_ule_extensions( priv ); + int l = handle_ule_extensions(priv); if (l < 0) { /* Mandatory extension header unknown or TEST SNDU. Drop it. */ // printk( KERN_WARNING "Dropping SNDU, extension headers.\n" ); - dev_kfree_skb( priv->ule_skb ); + dev_kfree_skb(priv->ule_skb); goto sndu_done; } - skb_pull( priv->ule_skb, l ); + skb_pull(priv->ule_skb, l); } - /* CRC32 was OK. Remove it from skb. */ - priv->ule_skb->tail -= 4; - priv->ule_skb->len -= 4; - - /* Filter on receiver's destination MAC address, if present. */ - if (!priv->ule_dbit) { - /* The destination MAC address is the next data in the skb. */ - if (memcmp( priv->ule_skb->data, dev->dev_addr, ETH_ALEN )) { - /* MAC addresses don't match. Drop SNDU. */ - // printk( KERN_WARNING "Dropping SNDU, MAC address.\n" ); - dev_kfree_skb( priv->ule_skb ); - goto sndu_done; - } - if (! priv->ule_bridged) { - skb_push( priv->ule_skb, ETH_ALEN + 2 ); - ethh = (struct ethhdr *)priv->ule_skb->data; - memcpy( ethh->h_dest, ethh->h_source, ETH_ALEN ); - memset( ethh->h_source, 0, ETH_ALEN ); - ethh->h_proto = htons( priv->ule_sndu_type ); - } else { - /* Skip the Receiver destination MAC address. */ - skb_pull( priv->ule_skb, ETH_ALEN ); - } - } else { - if (! priv->ule_bridged) { - skb_push( priv->ule_skb, ETH_HLEN ); - ethh = (struct ethhdr *)priv->ule_skb->data; - memcpy( ethh->h_dest, dev->dev_addr, ETH_ALEN ); - memset( ethh->h_source, 0, ETH_ALEN ); - ethh->h_proto = htons( priv->ule_sndu_type ); - } else { - /* skb is in correct state; nothing to do. */ + /* + * Construct/assure correct ethernet header. + * Note: in bridged mode (priv->ule_bridged != + * 0) we already have the (original) ethernet + * header at the start of the payload (after + * optional dest. address and any extension + * headers). + */ + + if (!priv->ule_bridged) { + skb_push(priv->ule_skb, ETH_HLEN); + ethh = (struct ethhdr *)priv->ule_skb->data; + if (!priv->ule_dbit) { + /* dest_addr buffer is only valid if priv->ule_dbit == 0 */ + memcpy(ethh->h_dest, dest_addr, ETH_ALEN); + memset(ethh->h_source, 0, ETH_ALEN); } + else /* zeroize source and dest */ + memset( ethh, 0, ETH_ALEN*2 ); + + ethh->h_proto = htons(priv->ule_sndu_type); } + /* else: skb is in correct state; nothing to do. */ priv->ule_bridged = 0; /* Stuff into kernel's protocol stack. */ @@ -675,8 +750,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) * receive the packet anyhow. */ /* if (priv->ule_dbit && skb->pkt_type == PACKET_OTHERHOST) priv->ule_skb->pkt_type = PACKET_HOST; */ - ((struct dvb_net_priv *) dev->priv)->stats.rx_packets++; - ((struct dvb_net_priv *) dev->priv)->stats.rx_bytes += priv->ule_skb->len; + priv->stats.rx_packets++; + priv->stats.rx_bytes += priv->ule_skb->len; netif_rx(priv->ule_skb); } sndu_done: @@ -951,7 +1026,7 @@ static int dvb_net_feed_start(struct net_device *dev) dprintk("%s: start filtering\n", __FUNCTION__); priv->secfeed->start_filtering(priv->secfeed); } else if (priv->feedtype == DVB_NET_FEEDTYPE_ULE) { - struct timespec timeout = { 0, 30000000 }; // 30 msec + struct timespec timeout = { 0, 10000000 }; // 10 msec /* we have payloads encapsulated in TS */ dprintk("%s: alloc tsfeed\n", __FUNCTION__); @@ -963,10 +1038,13 @@ static int dvb_net_feed_start(struct net_device *dev) /* Set netdevice pointer for ts decaps callback. */ priv->tsfeed->priv = (void *)dev; - ret = priv->tsfeed->set(priv->tsfeed, priv->pid, - TS_PACKET, DMX_TS_PES_OTHER, + ret = priv->tsfeed->set(priv->tsfeed, + priv->pid, /* pid */ + TS_PACKET, /* type */ + DMX_TS_PES_OTHER, /* pes type */ 32768, /* circular buffer size */ - timeout); + timeout /* timeout */ + ); if (ret < 0) { printk("%s: could not set ts feed\n", dev->name); -- cgit v1.2.3 From 750b7fc24921cc90350f9fcb3eab4edbaeeb5965 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 2 May 2006 09:02:15 -0300 Subject: Pwc-dec23 oops fix From: akpm@osdl.org drivers/media/video/pwc/pwc-dec23.c: In function `pwc_dec23_decompress': drivers/media/video/pwc/pwc-dec23.c:885: warning: null argument where non-null required (arg 2) Signed-off-by: Andrew Morton Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/pwc/pwc-dec23.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux') diff --git a/linux/drivers/media/video/pwc/pwc-dec23.c b/linux/drivers/media/video/pwc/pwc-dec23.c index f9096c72c..39eaf5839 100644 --- a/linux/drivers/media/video/pwc/pwc-dec23.c +++ b/linux/drivers/media/video/pwc/pwc-dec23.c @@ -882,7 +882,7 @@ void pwc_dec23_decompress(const struct pwc_device *pwc, } #else - memcpy(dst, 0, pwc->view.x * pwc->view.y); + memset(dst, 0, pwc->view.x * pwc->view.y); #endif } else { -- cgit v1.2.3 From 91a3da5165321c89bb4a35937d47f19ac53f8899 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 2 May 2006 09:29:34 -0300 Subject: Fix checking logic for a broken xawtv version From: Mauro Carvalho Chehab moved from if to ifndef. Also added such tests at gentree script. Gentree updated to its latest version. Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/pwc/pwc-v4l.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux') diff --git a/linux/drivers/media/video/pwc/pwc-v4l.c b/linux/drivers/media/video/pwc/pwc-v4l.c index 961ce2ddf..df4bbdb1e 100644 --- a/linux/drivers/media/video/pwc/pwc-v4l.c +++ b/linux/drivers/media/video/pwc/pwc-v4l.c @@ -127,7 +127,7 @@ static struct v4l2_queryctrl pwc_controls[] = { .step = 1, .default_value = 0, }, -#if XAWTV_HAS_BEEN_FIXED +#ifndef BROKEN_XAWTV { .id = V4L2_CID_PRIVATE_SAVE_USER, .type = V4L2_CTRL_TYPE_BUTTON, -- cgit v1.2.3 From 53fd6cc3b7515ecc4f2e59732063c4ed7d730fd5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 2 May 2006 11:18:17 -0300 Subject: Reverted from previous patch since it is not required From: Mauro Carvalho Chehab kernel-sync: Signed-off-by: Mauro Carvalho Chehab --- linux/include/linux/videodev2.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'linux') diff --git a/linux/include/linux/videodev2.h b/linux/include/linux/videodev2.h index 6e769cdb0..5d46a8d2a 100644 --- a/linux/include/linux/videodev2.h +++ b/linux/include/linux/videodev2.h @@ -1246,8 +1246,7 @@ extern char *v4l2_type_names[]; typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file, unsigned int cmd, void *arg); -#if defined(CONFIG_VIDEO_V4L1_COMPAT) || \ - defined(CONFIG_VIDEO_V4L1_COMPAT_MODULE) +#ifdef CONFIG_VIDEO_V4L1_COMPAT int v4l_compat_translate_ioctl(struct inode *inode, struct file *file, int cmd, void *arg, v4l2_kioctl driver_ioctl); #else -- cgit v1.2.3 From b67050b2cbc3429dcde05d2e90ef266743f4540e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 2 May 2006 11:43:05 -0300 Subject: [PATCH] Last DMA_xBIT_MASK cleanups These are the last conversions of pci_set_dma_mask(), pci_set_consistent_dma_mask() and pci_dma_supported() to use DMA_xBIT_MASK constants from linux/dma-mapping.h kernel-sync: Signed-off-by: Tobias Klauser Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- linux/drivers/media/video/saa7134/saa7134-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'linux') diff --git a/linux/drivers/media/video/saa7134/saa7134-core.c b/linux/drivers/media/video/saa7134/saa7134-core.c index e3433d894..bdaf6c10b 100644 --- a/linux/drivers/media/video/saa7134/saa7134-core.c +++ b/linux/drivers/media/video/saa7134/saa7134-core.c @@ -35,6 +35,7 @@ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) #include #endif +#include #include "saa7134-reg.h" #include "saa7134.h" @@ -944,7 +945,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, pci_name(pci_dev), dev->pci_rev, pci_dev->irq, dev->pci_lat,pci_resource_start(pci_dev,0)); pci_set_master(pci_dev); - if (!pci_dma_supported(pci_dev,0xffffffff)) { + if (!pci_dma_supported(pci_dev, DMA_32BIT_MASK)) { printk("%s: Oops: no 32bit PCI DMA ???\n",dev->name); err = -EIO; goto fail1; -- cgit v1.2.3 From e7db9b9952eddc8ac52a8a902ad1af7b048c8e17 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 2 May 2006 15:44:02 -0300 Subject: Removed obsoleted CVS files From: Mauro Carvalho Chehab Those files were used on cvs tree. they make no sense for hg. kenel-sync: Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/.cvsignore | 1 - linux/drivers/media/dvb/.cvsignore | 1 - linux/include/linux/.cvsignore | 1 - 3 files changed, 3 deletions(-) delete mode 100644 linux/drivers/media/.cvsignore delete mode 100644 linux/drivers/media/dvb/.cvsignore delete mode 100644 linux/include/linux/.cvsignore (limited to 'linux') diff --git a/linux/drivers/media/.cvsignore b/linux/drivers/media/.cvsignore deleted file mode 100644 index c095fc3ef..000000000 --- a/linux/drivers/media/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -dvb \ No newline at end of file diff --git a/linux/drivers/media/dvb/.cvsignore b/linux/drivers/media/dvb/.cvsignore deleted file mode 100644 index 72e8ffc0d..000000000 --- a/linux/drivers/media/dvb/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/linux/include/linux/.cvsignore b/linux/include/linux/.cvsignore deleted file mode 100644 index c095fc3ef..000000000 --- a/linux/include/linux/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -dvb \ No newline at end of file -- cgit v1.2.3 From fb92440f40e711054ab1c7cf588f5e1c4991a57d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 2 May 2006 16:00:44 -0300 Subject: i2c-compat.h were duplicated at linux/include. removing. From: Mauro Carvalho Chehab This file is meant only to make compatibility with kernel 2.4. Shouldn't stay at linux/*. Signed-off-by: Mauro Carvalho Chehab --- linux/include/media/i2c-compat.h | 57 ---------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 linux/include/media/i2c-compat.h (limited to 'linux') diff --git a/linux/include/media/i2c-compat.h b/linux/include/media/i2c-compat.h deleted file mode 100644 index 39fa183fa..000000000 --- a/linux/include/media/i2c-compat.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * $Id: i2c-compat.h,v 1.3 2005/10/16 12:13:58 mchehab Exp $ - * - * some i2c layer compatibility stuff -- to avoid cluttering up the - * i2c modules with tons of #ifdefs - */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,66) - -static inline void *i2c_get_adapdata(struct i2c_adapter *dev) -{ - return dev->data; -} - -static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data) -{ - dev->data = data; -} - -static inline void *i2c_get_clientdata(struct i2c_client *dev) -{ - return dev->data; -} - -static inline void i2c_set_clientdata(struct i2c_client *dev, void *data) -{ - dev->data = data; -} - -#define I2C_DEVNAME(str) .name = str - -static inline char *i2c_clientname(struct i2c_client *c) -{ - return c->name; -} - -static inline void i2c_clients_command(struct i2c_adapter *adap, - unsigned int cmd, void *arg) -{ - int i; - - for (i = 0; i < I2C_CLIENT_MAX; i++) { - if (NULL == adap->clients[i]) - continue; - if (NULL == adap->clients[i]->driver->command) - continue; - adap->clients[i]->driver->command(adap->clients[i],cmd,arg); - } -} - -#endif - -/* - * Local variables: - * c-basic-offset: 8 - * End: - */ -- cgit v1.2.3 From 113182f6138901821b513eaf424f403ae0d7aa23 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 3 May 2006 12:39:08 -0300 Subject: [ALSA] add __devinitdata to all pci_device_id From: Henrik Kretzschmar kernel-sync: Signed-off-by: Henrik Kretzschmar Signed-off-by: Takashi Iwai Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/cx88/cx88-alsa.c | 2 +- linux/sound/pci/bt87x.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/video/cx88/cx88-alsa.c b/linux/drivers/media/video/cx88/cx88-alsa.c index 69d3c3c8f..aff6f4dd3 100644 --- a/linux/drivers/media/video/cx88/cx88-alsa.c +++ b/linux/drivers/media/video/cx88/cx88-alsa.c @@ -710,7 +710,7 @@ static struct snd_kcontrol_new snd_cx88_capture_volume = { * Only boards with eeprom and byte 1 at eeprom=1 have it */ -static struct pci_device_id cx88_audio_pci_tbl[] = { +static struct pci_device_id cx88_audio_pci_tbl[] __devinitdata = { {0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, {0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, {0, } diff --git a/linux/sound/pci/bt87x.c b/linux/sound/pci/bt87x.c index 0f45028b3..91252e7cf 100644 --- a/linux/sound/pci/bt87x.c +++ b/linux/sound/pci/bt87x.c @@ -774,7 +774,7 @@ static int __devinit snd_bt87x_create(struct snd_card *card, .driver_data = rate } /* driver_data is the default digital_rate value for that device */ -static struct pci_device_id snd_bt87x_ids[] = { +static struct pci_device_id snd_bt87x_ids[] __devinitdata = { /* Hauppauge WinTV series */ BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x0070, 0x13eb, 32000), /* Hauppauge WinTV series */ @@ -921,7 +921,7 @@ static void __devexit snd_bt87x_remove(struct pci_dev *pci) /* default entries for all Bt87x cards - it's not exported */ /* driver_data is set to 0 to call detection */ -static struct pci_device_id snd_bt87x_default_ids[] = { +static struct pci_device_id snd_bt87x_default_ids[] __devinitdata = { BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, PCI_ANY_ID, PCI_ANY_ID, 0), BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_879, PCI_ANY_ID, PCI_ANY_ID, 0), { } -- cgit v1.2.3 From dee79512a9d26c008623ef7b193eb7440567e186 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Wed, 3 May 2006 14:17:31 -0400 Subject: fix build for older gcc's that dont support compiler macros in a function call From: Julian Scheel This patch fixes the build when using older gcc-versions which do not support compiler-macros in a function-call. Signed-off-by: Julian Scheel Signed-off-by: Michael Krufky --- linux/drivers/media/video/cx88/cx88-i2c.c | 3 ++- linux/drivers/media/video/tuner-core.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/video/cx88/cx88-i2c.c b/linux/drivers/media/video/cx88/cx88-i2c.c index 1e9bd01de..69a39ad68 100644 --- a/linux/drivers/media/video/cx88/cx88-i2c.c +++ b/linux/drivers/media/video/cx88/cx88-i2c.c @@ -98,10 +98,11 @@ static int attach_inform(struct i2c_client *client) struct tuner_setup tun_setup; struct cx88_core *core = i2c_get_adapdata(client->adapter); - dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n", #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) + dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n", client->driver->name, client->addr, client->name); #else + dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n", client->driver->driver.name, client->addr, client->name); #endif if (!client->driver->command) diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c index 00e073944..21bc09dda 100644 --- a/linux/drivers/media/video/tuner-core.c +++ b/linux/drivers/media/video/tuner-core.c @@ -257,13 +257,15 @@ static void set_type(struct i2c_client *c, unsigned int type, t->mode_mask = new_mode_mask; set_freq(c, (V4L2_TUNER_RADIO == t->mode) ? t->radio_freq : t->tv_freq); - tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n", #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) + tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n", c->adapter->name, c->driver->name, c->addr << 1, type, + t->mode_mask); #else + tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n", c->adapter->name, c->driver->driver.name, c->addr << 1, type, -#endif t->mode_mask); +#endif } /* -- cgit v1.2.3 From 41c8016db3ad2a330bd28bc5304f6ae4408d5cb8 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Thu, 4 May 2006 11:16:41 -0400 Subject: cx88-blackbird: use encoder firmware filename defined in cx2341x.h From: Michael Krufky Since the filename of the cx23416 encoder firmware image is defined in cx2341x.h, we don't need to explicitly define it in cx88-blackbird.c anymore. This changeset removes BLACKBIRD_FIRM_ENC_FILENAME, replacing all occurrances with CX2341X_FIRM_ENC_FILENAME. Signed-off-by: Michael Krufky --- linux/drivers/media/video/cx88/cx88-blackbird.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/video/cx88/cx88-blackbird.c b/linux/drivers/media/video/cx88/cx88-blackbird.c index 844115b35..05904b655 100644 --- a/linux/drivers/media/video/cx88/cx88-blackbird.c +++ b/linux/drivers/media/video/cx88/cx88-blackbird.c @@ -57,7 +57,6 @@ static LIST_HEAD(cx8802_devlist); /* ------------------------------------------------------------------ */ -#define BLACKBIRD_FIRM_ENC_FILENAME "v4l-cx2341x-enc.fw" #define BLACKBIRD_FIRM_IMAGE_SIZE 256*1024 /* defines below are from ivtv-driver.h */ @@ -582,17 +581,17 @@ static int blackbird_load_firmware(struct cx8802_dev *dev) dprintk(0, "Error with register_write\n"); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - retval = request_firmware(&firmware, BLACKBIRD_FIRM_ENC_FILENAME, + retval = request_firmware(&firmware, CX2341X_FIRM_ENC_FILENAME, &dev->pci->dev); #else - retval = request_firmware(&firmware, BLACKBIRD_FIRM_ENC_FILENAME, + retval = request_firmware(&firmware, CX2341X_FIRM_ENC_FILENAME, pci_name(dev->pci)); #endif if (retval != 0) { dprintk(0, "ERROR: Hotplug firmware request failed (%s).\n", - BLACKBIRD_FIRM_ENC_FILENAME); + CX2341X_FIRM_ENC_FILENAME); dprintk(0, "Please fix your hotplug setup, the board will " "not work without firmware loaded!\n"); return -1; -- cgit v1.2.3 From 304dfa39df9db3695e21bd87ac2c84819c889359 Mon Sep 17 00:00:00 2001 From: Andrew de Quincey Date: Thu, 4 May 2006 16:39:44 +0100 Subject: Fix CI interface on KNC1 DVBT and DVBC cards From: Andrew de Quincey These cards need special handling for CI - reinitialising the frontend device when the CI module is reset. Additionally the tda10021 needs to be set into a different transport stream mode when a CI module is present. Signed-off-by: Andrew de Quincey --- linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c | 25 ++- linux/drivers/media/dvb/frontends/tda10021.c | 8 + linux/drivers/media/dvb/frontends/tda10021.h | 2 + linux/drivers/media/dvb/ttpci/budget-av.c | 194 +++++++++++++--------- 4 files changed, 153 insertions(+), 76 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 00347a750..2a03bf53c 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c @@ -1060,8 +1060,18 @@ static int dvb_ca_en50221_thread(void *data) break; case DVB_CA_SLOTSTATE_VALIDATE: - if (dvb_ca_en50221_parse_attributes(ca, slot) - != 0) { + if (dvb_ca_en50221_parse_attributes(ca, slot) != 0) { + /* we need this extra check for annoying interfaces like the budget-av */ + if ((!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE)) && + (ca->pub->poll_slot_status)) { + int status = ca->pub->poll_slot_status(ca->pub, slot, 0); + if (!(status & DVB_CA_EN50221_POLL_CAM_PRESENT)) { + ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_NONE; + dvb_ca_en50221_thread_update_delay(ca); + break; + } + } + printk("dvb_ca adapter %d: Invalid PC card inserted :(\n", ca->dvbdev->adapter->num); ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID; @@ -1108,6 +1118,17 @@ static int dvb_ca_en50221_thread(void *data) case DVB_CA_SLOTSTATE_LINKINIT: if (dvb_ca_en50221_link_init(ca, slot) != 0) { + /* we need this extra check for annoying interfaces like the budget-av */ + if ((!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE)) && + (ca->pub->poll_slot_status)) { + int status = ca->pub->poll_slot_status(ca->pub, slot, 0); + if (!(status & DVB_CA_EN50221_POLL_CAM_PRESENT)) { + ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_NONE; + dvb_ca_en50221_thread_update_delay(ca); + break; + } + } + printk("dvb_ca adapter %d: DVB CAM link initialisation failed :(\n", ca->dvbdev->adapter->num); ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID; dvb_ca_en50221_thread_update_delay(ca); diff --git a/linux/drivers/media/dvb/frontends/tda10021.c b/linux/drivers/media/dvb/frontends/tda10021.c index e49cfa027..1950c72fd 100644 --- a/linux/drivers/media/dvb/frontends/tda10021.c +++ b/linux/drivers/media/dvb/frontends/tda10021.c @@ -90,6 +90,14 @@ static int tda10021_writereg (struct tda10021_state* state, u8 reg, u8 data) return (ret != 1) ? -EREMOTEIO : 0; } +int tda10021_write_byte(struct dvb_frontend* fe, int reg, int data) +{ + struct tda10021_state* state = fe->demodulator_priv; + + return tda10021_writereg(state, reg, data); +} +EXPORT_SYMBOL(tda10021_write_byte); + static u8 tda10021_readreg (struct tda10021_state* state, u8 reg) { u8 b0 [] = { reg }; diff --git a/linux/drivers/media/dvb/frontends/tda10021.h b/linux/drivers/media/dvb/frontends/tda10021.h index 3fc338e0e..b1df4259b 100644 --- a/linux/drivers/media/dvb/frontends/tda10021.h +++ b/linux/drivers/media/dvb/frontends/tda10021.h @@ -35,4 +35,6 @@ struct tda10021_config extern struct dvb_frontend* tda10021_attach(const struct tda10021_config* config, struct i2c_adapter* i2c, u8 pwm); +extern int tda10021_write_byte(struct dvb_frontend* fe, int reg, int data); + #endif // TDA10021_H diff --git a/linux/drivers/media/dvb/ttpci/budget-av.c b/linux/drivers/media/dvb/ttpci/budget-av.c index 680041878..3ff67523c 100644 --- a/linux/drivers/media/dvb/ttpci/budget-av.c +++ b/linux/drivers/media/dvb/ttpci/budget-av.c @@ -50,6 +50,12 @@ #define DEBICICAM 0x02420000 +#define SLOTSTATUS_NONE 1 +#define SLOTSTATUS_PRESENT 2 +#define SLOTSTATUS_RESET 4 +#define SLOTSTATUS_READY 8 +#define SLOTSTATUS_OCCUPIED (SLOTSTATUS_PRESENT|SLOTSTATUS_RESET|SLOTSTATUS_READY) + struct budget_av { struct budget budget; struct video_device *vd; @@ -58,8 +64,15 @@ struct budget_av { struct tasklet_struct ciintf_irq_tasklet; int slot_status; struct dvb_ca_en50221 ca; + u8 reinitialise_demod:1; + u8 tda10021_poclkp:1; + u8 tda10021_ts_enabled; + int (*tda10021_set_frontend)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p); }; +static int ciintf_slot_shutdown(struct dvb_ca_en50221 *ca, int slot); + + /* GPIO Connections: * 0 - Vcc/Reset (Reset is controlled by capacitor). Resets the frontend *AS WELL*! * 1 - CI memory select 0=>IO memory, 1=>Attribute Memory @@ -129,9 +142,10 @@ static int ciintf_read_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int ad udelay(1); result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, address & 0xfff, 1, 0, 1); - - if (result == -ETIMEDOUT) - budget_av->slot_status = 0; + if (result == -ETIMEDOUT) { + ciintf_slot_shutdown(ca, slot); + printk(KERN_INFO "budget-av: cam ejected 1\n"); + } return result; } @@ -147,9 +161,10 @@ static int ciintf_write_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int a udelay(1); result = ttpci_budget_debiwrite(&budget_av->budget, DEBICICAM, address & 0xfff, 1, value, 0, 1); - - if (result == -ETIMEDOUT) - budget_av->slot_status = 0; + if (result == -ETIMEDOUT) { + ciintf_slot_shutdown(ca, slot); + printk(KERN_INFO "budget-av: cam ejected 2\n"); + } return result; } @@ -165,9 +180,11 @@ static int ciintf_read_cam_control(struct dvb_ca_en50221 *ca, int slot, u8 addre udelay(1); result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, address & 3, 1, 0, 0); - - if (result == -ETIMEDOUT) - budget_av->slot_status = 0; + if ((result == -ETIMEDOUT) || ((result == 0xff) && ((address & 3) < 2))) { + ciintf_slot_shutdown(ca, slot); + printk(KERN_INFO "budget-av: cam ejected 3\n"); + return -ETIMEDOUT; + } return result; } @@ -183,9 +200,10 @@ static int ciintf_write_cam_control(struct dvb_ca_en50221 *ca, int slot, u8 addr udelay(1); result = ttpci_budget_debiwrite(&budget_av->budget, DEBICICAM, address & 3, 1, value, 0, 0); - - if (result == -ETIMEDOUT) - budget_av->slot_status = 0; + if (result == -ETIMEDOUT) { + ciintf_slot_shutdown(ca, slot); + printk(KERN_INFO "budget-av: cam ejected 5\n"); + } return result; } @@ -193,12 +211,12 @@ static int ciintf_slot_reset(struct dvb_ca_en50221 *ca, int slot) { struct budget_av *budget_av = (struct budget_av *) ca->data; struct saa7146_dev *saa = budget_av->budget.dev; - int timeout = 50; // 5 seconds (4.4.6 Ready) if (slot != 0) return -EINVAL; dprintk(1, "ciintf_slot_reset\n"); + budget_av->slot_status = SLOTSTATUS_RESET; saa7146_setgpio(saa, 2, SAA7146_GPIO_OUTHI); /* disable card */ @@ -208,20 +226,17 @@ static int ciintf_slot_reset(struct dvb_ca_en50221 *ca, int slot) msleep(20); /* 20 ms Vcc settling time */ saa7146_setgpio(saa, 2, SAA7146_GPIO_OUTLO); /* enable card */ + ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTB); + msleep(20); - /* This should have been based on pin 16 READY of the pcmcia port, - * but AFAICS it is not routed to the saa7146 */ - while (--timeout > 0 && ciintf_read_attribute_mem(ca, slot, 0) != 0x1d) - msleep(100); - - /* reinitialise the frontend */ - dvb_frontend_reinitialise(budget_av->budget.dvb_frontend); + /* reinitialise the frontend if necessary */ + if (budget_av->reinitialise_demod) + dvb_frontend_reinitialise(budget_av->budget.dvb_frontend); - if (timeout <= 0) - { - printk(KERN_ERR "budget-av: cam reset failed (timeout).\n"); - saa7146_setgpio(saa, 2, SAA7146_GPIO_OUTHI); /* disable card */ - return -ETIMEDOUT; + /* set tda10021 back to original clock configuration on reset */ + if (budget_av->tda10021_poclkp) { + tda10021_write_byte(budget_av->budget.dvb_frontend, 0x12, 0xa0); + budget_av->tda10021_ts_enabled = 0; } return 0; @@ -238,7 +253,13 @@ static int ciintf_slot_shutdown(struct dvb_ca_en50221 *ca, int slot) dprintk(1, "ciintf_slot_shutdown\n"); ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTB); - budget_av->slot_status = 0; + budget_av->slot_status = SLOTSTATUS_NONE; + + /* set tda10021 back to original clock configuration when cam removed */ + if (budget_av->tda10021_poclkp) { + tda10021_write_byte(budget_av->budget.dvb_frontend, 0x12, 0xa0); + budget_av->tda10021_ts_enabled = 0; + } return 0; } @@ -253,6 +274,13 @@ static int ciintf_slot_ts_enable(struct dvb_ca_en50221 *ca, int slot) dprintk(1, "ciintf_slot_ts_enable: %d\n", budget_av->slot_status); ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTA); + + /* tda10021 seems to need a different TS clock config when data is routed to the CAM */ + if (budget_av->tda10021_poclkp) { + tda10021_write_byte(budget_av->budget.dvb_frontend, 0x12, 0xa1); + budget_av->tda10021_ts_enabled = 1; + } + return 0; } @@ -260,50 +288,61 @@ static int ciintf_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open { struct budget_av *budget_av = (struct budget_av *) ca->data; struct saa7146_dev *saa = budget_av->budget.dev; - int cam_present = 0; + int result; if (slot != 0) return -EINVAL; - if (!budget_av->slot_status) - { - // first of all test the card detect line + /* test the card detect line - needs to be done carefully + * since it never goes high for some CAMs on this interface (e.g. topuptv) */ + if (budget_av->slot_status == SLOTSTATUS_NONE) { saa7146_setgpio(saa, 3, SAA7146_GPIO_INPUT); udelay(1); - if (saa7146_read(saa, PSR) & MASK_06) - { - cam_present = 1; + if (saa7146_read(saa, PSR) & MASK_06) { + if (budget_av->slot_status == SLOTSTATUS_NONE) { + budget_av->slot_status = SLOTSTATUS_PRESENT; + printk(KERN_INFO "budget-av: cam inserted A\n"); + } } saa7146_setgpio(saa, 3, SAA7146_GPIO_OUTLO); + } - // that is unreliable however, so try and read from IO memory - if (!cam_present) - { - saa7146_setgpio(budget_av->budget.dev, 1, SAA7146_GPIO_OUTLO); - if (ttpci_budget_debiread(&budget_av->budget, DEBICICAM, 0, 1, 0, 1) != -ETIMEDOUT) - { - cam_present = 1; + /* We also try and read from IO memory to work round the above detection bug. If + * there is no CAM, we will get a timeout. Only done if there is no cam + * present, since this test actually breaks some cams :( + * + * if the CI interface is not open, we also do the above test since we + * don't care if the cam has problems - we'll be resetting it on open() anyway */ + if ((budget_av->slot_status == SLOTSTATUS_NONE) || (!open)) { + saa7146_setgpio(budget_av->budget.dev, 1, SAA7146_GPIO_OUTLO); + result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, 0, 1, 0, 1); + if ((result >= 0) && (budget_av->slot_status == SLOTSTATUS_NONE)) { + budget_av->slot_status = SLOTSTATUS_PRESENT; + printk(KERN_INFO "budget-av: cam inserted B\n"); + } else if (result < 0) { + if (budget_av->slot_status != SLOTSTATUS_NONE) { + ciintf_slot_shutdown(ca, slot); + printk(KERN_INFO "budget-av: cam ejected 5\n"); + return 0; } } + } - // did we find something? - if (cam_present) { - printk(KERN_INFO "budget-av: cam inserted\n"); - budget_av->slot_status = 1; - } - } else if (!open) { - saa7146_setgpio(budget_av->budget.dev, 1, SAA7146_GPIO_OUTLO); - if (ttpci_budget_debiread(&budget_av->budget, DEBICICAM, 0, 1, 0, 1) == -ETIMEDOUT) - { - printk(KERN_INFO "budget-av: cam ejected\n"); - saa7146_setgpio(saa, 2, SAA7146_GPIO_OUTHI); /* disable card */ - budget_av->slot_status = 0; + /* read from attribute memory in reset/ready state to know when the CAM is ready */ + if (budget_av->slot_status == SLOTSTATUS_RESET) { + result = ciintf_read_attribute_mem(ca, slot, 0); + if (result == 0x1d) { + budget_av->slot_status = SLOTSTATUS_READY; } } - if (budget_av->slot_status == 1) - return DVB_CA_EN50221_POLL_CAM_PRESENT | DVB_CA_EN50221_POLL_CAM_READY; - + /* work out correct return code */ + if (budget_av->slot_status != SLOTSTATUS_NONE) { + if (budget_av->slot_status & SLOTSTATUS_READY) { + return DVB_CA_EN50221_POLL_CAM_PRESENT | DVB_CA_EN50221_POLL_CAM_READY; + } + return DVB_CA_EN50221_POLL_CAM_PRESENT; + } return 0; } @@ -333,6 +372,8 @@ static int ciintf_init(struct budget_av *budget_av) budget_av->ca.slot_ts_enable = ciintf_slot_ts_enable; budget_av->ca.poll_slot_status = ciintf_poll_slot_status; budget_av->ca.data = budget_av; + budget_av->budget.ci_present = 1; + budget_av->slot_status = SLOTSTATUS_NONE; if ((result = dvb_ca_en50221_init(&budget_av->budget.dvb_adapter, &budget_av->ca, 0, 1)) != 0) { @@ -341,7 +382,6 @@ static int ciintf_init(struct budget_av *budget_av) } printk(KERN_INFO "budget-av: ci interface initialised.\n"); - budget_av->budget.ci_present = 1; return 0; error: @@ -976,7 +1016,7 @@ static int philips_sd1878_ci_set_symbol_rate(struct dvb_frontend *fe, static struct stv0299_config philips_sd1878_config = { .demod_address = 0x68, - .inittab = philips_sd1878_inittab, + .inittab = philips_sd1878_inittab, .mclk = 88000000UL, .invert = 0, .skip_reinit = 0, @@ -1018,6 +1058,23 @@ static u8 read_pwm(struct budget_av *budget_av) #define SUBID_DVBT_KNC1 0x0030 #define SUBID_DVBT_CINERGY1200 0x1157 + +static int tda10021_set_frontend(struct dvb_frontend *fe, + struct dvb_frontend_parameters *p) +{ + struct budget_av* budget_av = fe->dvb->priv; + int result; + + result = budget_av->tda10021_set_frontend(fe, p); + if (budget_av->tda10021_ts_enabled) { + tda10021_write_byte(budget_av->budget.dvb_frontend, 0x12, 0xa1); + } else { + tda10021_write_byte(budget_av->budget.dvb_frontend, 0x12, 0xa0); + } + + return result; +} + static void frontend_init(struct budget_av *budget_av) { struct saa7146_dev * saa = budget_av->budget.dev; @@ -1083,34 +1140,23 @@ static void frontend_init(struct budget_av *budget_av) case SUBID_DVBC_KNC1: case SUBID_DVBC_KNC1_PLUS: + case SUBID_DVBC_CINERGY1200: + budget_av->reinitialise_demod = 1; fe = tda10021_attach(&philips_cu1216_config, &budget_av->budget.i2c_adap, read_pwm(budget_av)); if (fe) { + budget_av->tda10021_poclkp = 1; + budget_av->tda10021_set_frontend = fe->ops->set_frontend; + fe->ops->set_frontend = tda10021_set_frontend; fe->ops->tuner_ops.set_params = philips_cu1216_tuner_set_params; } break; case SUBID_DVBT_KNC1: case SUBID_DVBT_KNC1_PLUS: - fe = tda10046_attach(&philips_tu1216_config, - &budget_av->budget.i2c_adap); - if (fe) { - fe->ops->tuner_ops.init = philips_tu1216_tuner_init; - fe->ops->tuner_ops.set_params = philips_tu1216_tuner_set_params; - } - break; - - case SUBID_DVBC_CINERGY1200: - fe = tda10021_attach(&philips_cu1216_config, - &budget_av->budget.i2c_adap, - read_pwm(budget_av)); - if (fe) { - fe->ops->tuner_ops.set_params = philips_cu1216_tuner_set_params; - } - break; - case SUBID_DVBT_CINERGY1200: + budget_av->reinitialise_demod = 1; fe = tda10046_attach(&philips_tu1216_config, &budget_av->budget.i2c_adap); if (fe) { -- cgit v1.2.3 From 2c385b02114906a6056069225cc771449eaa7e5e Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Thu, 4 May 2006 12:49:41 -0400 Subject: pvrusb2: use encoder firmware filename defined in cx2341x.h From: Michael Krufky This patch removes the explicit definition of the cx23416 encoder firmware image filename, in favor of CX2341X_FIRM_ENC_FILENAME as defined in cx2341x.h Signed-off-by: Michael Krufky Acked-by: Mike Isely --- linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'linux') diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 890aa4a06..333419d6f 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "pvrusb2.h" #include "pvrusb2-std.h" #include "pvrusb2-util.h" @@ -943,7 +944,7 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw) int ret = 0; int fwidx; static const char *fw_files[] = { - "v4l-cx2341x-enc.fw", + CX2341X_FIRM_ENC_FILENAME, }; trace_firmware("pvr2_upload_firmware2"); -- cgit v1.2.3 From b4d9770fbc462b4f10ebbf8950e94654309352c2 Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Fri, 5 May 2006 22:24:46 +0400 Subject: Add frontend support for new Delivery systems and modulations -DVB-S2, 8PSK and higher order modulations, some advanced DVB-S2 features require additional support at the demux level -DVB-T, Add support for HP/LP stream selection -DVB-H, Add basic support to the frontend API -DSS, basic frontend API support only, will require additional support at the demux level Ack'd by: Marcel Siegert Acked-by: Andrew de Quincey Ack'd by: Patrick Boettcher Signed-off-by: Manu Abraham --- linux/drivers/media/dvb/dvb-core/dvb_frontend.c | 80 +++- linux/drivers/media/dvb/dvb-core/dvb_frontend.h | 9 +- linux/include/linux/dvb/frontend.h | 530 +++++++++++++++++++++++- 3 files changed, 615 insertions(+), 4 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c index bc752929f..5d980ee9d 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -94,6 +94,8 @@ struct dvb_frontend_private { /* thread/frontend values */ struct dvb_device *dvbdev; struct dvb_frontend_parameters parameters; + struct dvb_frontend_params params; + struct dvb_frontend_cap caps; struct dvb_fe_events events; struct semaphore sem; struct list_head list_head; @@ -124,6 +126,62 @@ struct dvb_frontend_private { unsigned int check_wrapped; }; +struct modcod_table { + __u32 modcod; + __u32 modulation; + __u32 fecrate; +}; + +struct modcod_table dvbs2_modcod_lookup[] = { + { FE_MODCOD_DUMMY_PLFRAME, FE_MOD_NONE, FE_FECRATE_NONE }, + { FE_MODCOD_QPSK_1_4, FE_MOD_QPSK, FE_FECRATE_1_4 }, + { FE_MODCOD_QPSK_1_3, FE_MOD_QPSK, FE_FECRATE_1_3 }, + { FE_MODCOD_QPSK_2_5, FE_MOD_QPSK, FE_FECRATE_2_5 }, + { FE_MODCOD_QPSK_1_2, FE_MOD_QPSK, FE_FECRATE_1_2 }, + { FE_MODCOD_QPSK_3_5, FE_MOD_QPSK, FE_FECRATE_3_5 }, + { FE_MODCOD_QPSK_2_3, FE_MOD_QPSK, FE_FECRATE_2_3 }, + { FE_MODCOD_QPSK_3_4, FE_MOD_QPSK, FE_FECRATE_3_4 }, + { FE_MODCOD_QPSK_4_5, FE_MOD_QPSK, FE_FECRATE_4_5 }, + { FE_MODCOD_QPSK_5_6, FE_MOD_QPSK, FE_FECRATE_5_6 }, + { FE_MODCOD_QPSK_8_9, FE_MOD_QPSK, FE_FECRATE_8_9 }, + { FE_MODCOD_QPSK_9_10, FE_MOD_QPSK, FE_FECRATE_9_10 }, + { FE_MODCOD_8PSK_3_5, FE_MOD_8PSK, FE_FECRATE_3_5 }, + { FE_MODCOD_8PSK_2_3, FE_MOD_8PSK, FE_FECRATE_2_3 }, + { FE_MODCOD_8PSK_3_4, FE_MOD_8PSK, FE_FECRATE_3_4 }, + { FE_MODCOD_8PSK_5_6, FE_MOD_8PSK, FE_FECRATE_5_6 }, + { FE_MODCOD_8PSK_8_9, FE_MOD_8PSK, FE_FECRATE_8_9 }, + { FE_MODCOD_8PSK_9_10, FE_MOD_8PSK, FE_FECRATE_9_10 }, + { FE_MODCOD_16APSK_2_3, FE_MOD_16APSK, FE_FECRATE_2_3 }, + { FE_MODCOD_16APSK_3_4, FE_MOD_16APSK, FE_FECRATE_3_4 }, + { FE_MODCOD_16APSK_4_5, FE_MOD_16APSK, FE_FECRATE_4_5 }, + { FE_MODCOD_16APSK_5_6, FE_MOD_16APSK, FE_FECRATE_5_6 }, + { FE_MODCOD_16APSK_8_9, FE_MOD_16APSK, FE_FECRATE_8_9 }, + { FE_MODCOD_16APSK_9_10, FE_MOD_16APSK, FE_FECRATE_9_10 }, + { FE_MODCOD_32APSK_3_4, FE_MOD_32APSK, FE_FECRATE_3_4 }, + { FE_MODCOD_32APSK_4_5, FE_MOD_32APSK, FE_FECRATE_4_5 }, + { FE_MODCOD_32APSK_5_6, FE_MOD_32APSK, FE_FECRATE_5_6 }, + { FE_MODCOD_32APSK_8_9, FE_MOD_32APSK, FE_FECRATE_8_9 }, + { FE_MODCOD_32APSK_9_10, FE_MOD_32APSK, FE_FECRATE_9_10 }, + { FE_MODCOD_RESERVED_1, FE_MOD_RSVD, FE_FECRATE_RSVD }, + { FE_MODCOD_BPSK_1_3, FE_MOD_BPSK, FE_FECRATE_1_3 }, + { FE_MODCOD_BPSK_1_4, FE_MOD_BPSK, FE_FECRATE_1_4 }, + { FE_MODCOD_RESERVED_2, FE_MOD_RSVD, FE_FECRATE_RSVD } +}; + +int decode_dvbs2_modcod(struct dvb_frontend *fe, enum fe_modcod modcod) +{ + struct modcod_table *table = dvbs2_modcod_lookup; + struct dvb_frontend_private *fepriv = fe->frontend_priv; + struct dvb_frontend_params *params = &fepriv->params; + + table += modcod; + params->delsys.dvbs2.modulation = table->modulation; + params->delsys.dvbs2.fecrate = table->fecrate; + + return 0; +} +EXPORT_SYMBOL(decode_dvbs2_modcod); + static void dvb_frontend_wakeup(struct dvb_frontend *fe); static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status) @@ -508,7 +566,7 @@ static int dvb_frontend_thread(void *data) unsigned long timeout; char name [15]; fe_status_t s; - struct dvb_frontend_parameters *params; + struct dvb_frontend_params *params; dprintk("%s\n", __FUNCTION__); @@ -564,7 +622,7 @@ static int dvb_frontend_thread(void *data) /* have we been asked to retune? */ params = NULL; if (fepriv->state & FESTATE_RETUNE) { - params = &fepriv->parameters; + params = &fepriv->params; fepriv->state = FESTATE_TUNED; } @@ -977,6 +1035,24 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, case FE_SET_FRONTEND_TUNE_MODE: fepriv->tune_mode_flags = (unsigned long) parg; break; + + case FE_GET_CAPS: + if (fe->ops->get_caps) { + memcpy(parg, &fepriv->caps, sizeof (struct dvb_frontend_cap)); + err = fe->ops->get_caps(fe, (struct dvb_frontend_cap*) parg); + } + break; + + case FE_SET_PARAMS: + if (fe->ops->set_params) + err = fe->ops->set_params(fe, (struct dvb_frontend_params*) parg); + break; + + case FE_GET_PARAMS: + if (fe->ops->get_params){ + memcpy(parg, &fepriv->params, sizeof (struct dvb_frontend_params)); + err = fe->ops->get_params(fe, (struct dvb_frontend_params*) parg); + } }; up (&fepriv->sem); diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h index 05ec9954b..4d1b45be0 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h @@ -98,7 +98,7 @@ struct dvb_frontend_ops { /* if this is set, it overrides the default swzigzag */ int (*tune)(struct dvb_frontend* fe, - struct dvb_frontend_parameters* params, + struct dvb_frontend_params* params, unsigned int mode_flags, int *delay, fe_status_t *status); @@ -125,6 +125,11 @@ struct dvb_frontend_ops { int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd); int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable); + /* New callbacks based on the new IOCTL's */ + int (*get_caps)(struct dvb_frontend* fe, struct dvb_frontend_cap* caps); + int (*set_params)(struct dvb_frontend* fe, struct dvb_frontend_params* params); + int (*get_params)(struct dvb_frontend* fe, struct dvb_frontend_params* params); + struct dvb_tuner_ops tuner_ops; }; @@ -158,4 +163,6 @@ extern void dvb_frontend_reinitialise(struct dvb_frontend *fe); extern void dvb_frontend_sleep_until(struct timeval *waketime, u32 add_usec); extern s32 timeval_usec_diff(struct timeval lasttime, struct timeval curtime); +extern int decode_dvbs2_modcod(struct dvb_frontend *fe, enum fe_modcod modcod); + #endif diff --git a/linux/include/linux/dvb/frontend.h b/linux/include/linux/dvb/frontend.h index c8cbd90ba..fe3b69605 100644 --- a/linux/include/linux/dvb/frontend.h +++ b/linux/include/linux/dvb/frontend.h @@ -7,6 +7,8 @@ * Andre Draszik * for convergence integrated media GmbH * + * Copyright (C) 2006 Manu Abraham + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 @@ -249,7 +251,9 @@ struct dvb_frontend_event { */ #define FE_TUNE_MODE_ONESHOT 0x01 - +/** + * FE_GET_INFO, is now a legacy IOCTL as well + */ #define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) #define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) @@ -267,6 +271,9 @@ struct dvb_frontend_event { #define FE_READ_SNR _IOR('o', 72, __u16) #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) +/** + * Legacy IOCTL's + */ #define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) #define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) #define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */ @@ -274,4 +281,525 @@ struct dvb_frontend_event { #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ +/** + * New operations for new and multiple delivery systems. + * + * References: + * DVB-S: ISO 13818-1/ITU H.222, EN 300 468 + * DVB-S2: EN 300 468, EN 301 210, TR 102 376 + * DVB-C: ISO 13818-1/ITU H.222, EN 300 468, EN 300 429 + * DVB-T: ISO 13818-1/ITU H.222, EN 300 468, EN 300 744 + * DVB-H: EN 300 468, EN 302 304 + */ + +/** + * Supported Delivery systems, some devices + * are capable of supporting multiple delivery systems. + * + * FE_DELSYS_IGNORE, causes the delivery system + * not to be queried. + * + * FE_DELSYS_AUTO, Some devices/drivers, might in + * future be capable of detectinng the delivery system. + */ +enum fe_delsys { + FE_DELSYS_IGNORE = (0 << 0), + FE_DELSYS_DVBS = (1 << 0), + FE_DELSYS_DVBS2 = (1 << 1), + FE_DELSYS_DSS = (1 << 2), + FE_DELSYS_DVBC = (1 << 3), + FE_DELSYS_DVBT = (1 << 4), + FE_DELSYS_DVBH = (1 << 5), + FE_DELSYS_ATSC = (1 << 6), + FE_DELSYS_AUTO = (1 << 31) +}; + +/** + * Supported Transport types, some delivery systems + * support multiple transports too. + * + * FE_MATYPE_IGNORE, causes the transport type not + * to be queried. + * + * FE_MATYPE_AUTO, Some devices/drivers, might + * support auto detecting the transport type, depending + * on some other settings and or hardware features. + * + * NOTE: This is specified by the DVB-S2 specifications + * This change of transport type might require an additional + * change at the PCI bridge level, for some implementations. + */ +enum fe_matype { + FE_MATYPE_IGNORE = (0 << 0), + FE_MATYPE_TRANSPORT = (1 << 0), + FE_MATYPE_GENERIC_PACKET = (1 << 1), + FE_MATYPE_GENERIC_CONTINUOUS = (1 << 2), + FE_MATYPE_RESERVED = (1 << 3), + FE_MATYPE_AUTO = (1 << 31) +}; + +/** + * Supported Stream Priorities + * + * Some delivery systems do have streams having + * different priorities. ie, High priority/Low priority. + * + * NOTE: The default should be the High priority stream. + */ +enum fe_stream { + FE_STREAM_HP = (1 << 0), + FE_STREAM_LP = (1 << 1) +}; + +/** + * Supported Modulations. + * Some devices support multiple modulation types + * + * FE_MOD_IGNORE, causes the modulation type not + * to be queried. + * + * FE_MOD_AUTO, Some devices/drivers, might support + * auto detecting the modulation type, depending on + * some other settings and or hardware features. + */ +enum fe_modulations { + FE_MOD_IGNORE = (0 << 0), + FE_MOD_NONE = (1 << 0), + FE_MOD_BPSK = (1 << 1), + FE_MOD_QPSK = (1 << 2), + FE_MOD_OQPSK = (1 << 3), + FE_MOD_8PSK = (1 << 4), + FE_MOD_16APSK = (1 << 5), + FE_MOD_32APSK = (1 << 6), + FE_MOD_QAM16 = (1 << 7), + FE_MOD_QAM32 = (1 << 8), + FE_MOD_QAM64 = (1 << 9), + FE_MOD_QAM128 = (1 << 10), + FE_MOD_QAM256 = (1 << 11), + FE_MOD_QAM512 = (1 << 12), + FE_MOD_QAM1024 = (1 << 13), + FE_MOD_QAMAUTO = (1 << 14), + FE_MOD_OFDM = (1 << 15), + FE_MOD_COFDM = (1 << 16), + FE_MOD_VSB8 = (1 << 17), + FE_MOD_VSB16 = (1 << 18), + FE_MOD_RSVD = (1 << 19), + FE_MOD_AUTO = (1 << 31) +}; + +/** + * Supported FEC (Forward Error Correction) Code rates + * + * FE_FECRATE_IGNORE, causes the FECRATE type not + * to be queried. + * + * FE_FECRATE_AUTO, Some devices/drivers, might + * support auto detecting the FEC code rate type, depending + * on some other hardware settings and or hardware features. + */ +enum fe_fecrates { + FE_FECRATE_IGNORE = (0 << 0), + FE_FECRATE_NONE = (1 << 0), + FE_FECRATE_1_4 = (1 << 1), + FE_FECRATE_1_3 = (1 << 2), + FE_FECRATE_2_5 = (1 << 3), + FE_FECRATE_1_2 = (1 << 4), + FE_FECRATE_3_5 = (1 << 5), + FE_FECRATE_2_3 = (1 << 6), + FE_FECRATE_3_4 = (1 << 7), + FE_FECRATE_4_5 = (1 << 8), + FE_FECRATE_5_6 = (1 << 9), + FE_FECRATE_6_7 = (1 << 10), + FE_FECRATE_7_8 = (1 << 11), + FE_FECRATE_8_9 = (1 << 12), + FE_FECRATE_9_10 = (1 << 13), + FE_FECRATE_RSVD = (1 << 14), + FE_FECRATE_AUTO = (1 << 31) +}; + +/** + * Supported MODCOD types + * + * The MODCOD types are specific to the DVB-S2 specification + * Some devices directly take the MODCOD values as an input + * or just output the same. + * + * In any case a single frontend will not be able to do + * multiple modulations/code rates at any given point of time. + */ +enum fe_modcod { + FE_MODCOD_DUMMY_PLFRAME = 0, + FE_MODCOD_QPSK_1_4, + FE_MODCOD_QPSK_1_3, + FE_MODCOD_QPSK_2_5, + FE_MODCOD_QPSK_1_2, + FE_MODCOD_QPSK_3_5, + FE_MODCOD_QPSK_2_3, + FE_MODCOD_QPSK_3_4, + FE_MODCOD_QPSK_4_5, + FE_MODCOD_QPSK_5_6, + FE_MODCOD_QPSK_8_9, + FE_MODCOD_QPSK_9_10, + FE_MODCOD_8PSK_3_5, + FE_MODCOD_8PSK_2_3, + FE_MODCOD_8PSK_3_4, + FE_MODCOD_8PSK_5_6, + FE_MODCOD_8PSK_8_9, + FE_MODCOD_8PSK_9_10, + FE_MODCOD_16APSK_2_3, + FE_MODCOD_16APSK_3_4, + FE_MODCOD_16APSK_4_5, + FE_MODCOD_16APSK_5_6, + FE_MODCOD_16APSK_8_9, + FE_MODCOD_16APSK_9_10, + FE_MODCOD_32APSK_3_4, + FE_MODCOD_32APSK_4_5, + FE_MODCOD_32APSK_5_6, + FE_MODCOD_32APSK_8_9, + FE_MODCOD_32APSK_9_10, + FE_MODCOD_RESERVED_1, + FE_MODCOD_BPSK_1_3, + FE_MODCOD_BPSK_1_4, + FE_MODCOD_RESERVED_2 +}; + +/** + * Supported Bandwidth modes + * + * FE_BANDWIDTH_IGNORE, causes the bandwidth not + * to be queried. + * + * FE_BANDWIDTH_AUTO, Some devices/drivers, might + * support auto detecting the Bandwidth, depending + * on some other hardware settings and or hardware features. + */ +enum fe_bandwidths { + FE_BANDWIDTH_IGNORE = (0 << 0), + FE_BANDWIDTH_8_MHZ = (1 << 1), + FE_BANDWIDTH_7_MHZ = (1 << 2), + FE_BANDWIDTH_6_MHZ = (1 << 3), + FE_BANDWIDTH_5_MHZ = (1 << 4), + FE_BANDWIDTH_RESERVED = (1 << 5), + FE_BANDWIDTH_AUTO = (1 << 31) +}; + +/** + * Supported Inversion modes + * + * FE_INVERSION_IGNORE, causes the inversion not + * to be queried. + * + * FE_INVERSION_AUTO, Some devices/drivers, might + * support auto detecting the Inversion, depending + * on some other hardware settings and or hardware features. + * + * NOTE: All current delivery systems need inversion in some + * way or the other, due to hardware implementation specifics. + * and/or others. + */ +enum fe_inversion { + FE_INVERSION_IGNORE = (0 << 0), + FE_INVERSION_OFF = (1 << 0), + FE_INVERSION_ON = (1 << 1), + FE_INVERSION_AUTO = (1 << 31) +}; + +/** + * Supported Transmission modes + * + * FE_TRANSMISSION_MODE_IGNORE, causes the transmission mode + * not to be queried. + * + * FE_TRANSMISSION_MODE_AUTO, Some devices/drivers, might + * support auto detecting the Transmission Mode, depending + * on some other hardware settings and or hardware features. + * + * NOTE: Currently applies to DVB-T and DVB-H only. + */ +enum fe_transmit_modes { + FE_TRANSMISSION_MODE_IGNORE = (0 << 0), + FE_TRANSMISSION_MODE_2K = (1 << 1), + FE_TRANSMISSION_MODE_4K = (1 << 2), + FE_TRANSMISSION_MODE_8K = (1 << 3), + FE_TRANSMISSION_MODE_RESERVED = (1 << 4), + FE_TRANSMISSION_MODE_AUTO = (1 << 31) +}; + +/** + * Supported Guard Intervals + * + * FE_GUARD_INTERVAL_IGNORE, causes the guard interval + * not to be queried. + * + * FE_GUARD_INTERVAL_AUTO, Some devices/drivers, might + * support auto detecting the Transmission Mode, depending + * on some other hardware settings and or hardware features. + * + * NOTE: Currently applies to DVB-T and DVB-H only. + */ +enum fe_guard_intervals { + FE_GUARD_INTERVAL_IGNORE = (0 << 0), + FE_GUARD_INTERVAL_1_32 = (1 << 1), + FE_GUARD_INTERVAL_1_16 = (1 << 2), + FE_GUARD_INTERVAL_1_8 = (1 << 3), + FE_GUARD_INTERVAL_1_4 = (1 << 4), + FE_GUARD_INTERVAL_AUTO = (1 << 31) +}; + +/** + * Supported Hierarchial Modulations + * + * FE_HIERARCHY_IGNORE, causes the hierarchy + * not to be queried. + * + * FE_HIERARCHY_AUTO, Some devices/drivers, might + * support auto detecting the hierarchial modulation, depending + * on some other hardware settings and or hardware features. + * + * NOTE: Currently applies to DVB-T and DVB-H only. + */ +enum fe_hierarchy_info { + FE_HIERARCHY_IGNORE = (0 << 0), + FE_HIERARCHY_OFF = (1 << 1), + FE_HIERARCHY_ON = (1 << 2), + FE_HIERARCHY_AUTO = (1 << 31) +}; + +/** + * Supported Rolloff Rates + * + * FE_ROLLOFF_IGNORE, causes the hierarchy + * not to be queried. + * + * FE_ROLLOFF_AUTO, Some devices/drivers, might + * support auto detecting the hierarchial modulation, depending + * on some other hardware settings and or hardware features. + * + * NOTE: Currently applies to DVB-T and DVB-H only, + * not applicable to DVB-S2, DVB-S2 uses fe_matype + */ +enum fe_rolloff { + FE_ROLLOFF_IGNORE = (0 << 0), + FE_ROLLOFF_1 = (1 << 1), + FE_ROLLOFF_2 = (1 << 2), + FE_ROLLOFF_4 = (1 << 3), + FE_ROLLOFF_AUTO = (1 << 31) +}; + +/** + * Supported Interleaver types + * + * FE_INTERLEAVER_IGNORE, causes the hierarchy + * not to be queried. + * + * FE_INTERLEAVER_AUTO, Some devices/drivers, might + * support auto detecting the hierarchial modulation, depending + * on some other hardware settings and or hardware features. + * + * NOTE: Currently applies only to DVB-H. + */ +enum fe_interleaver { + FE_INTERLEAVER_IGNORE = (0 << 0), + FE_INTERLEAVER_NATIVE = (1 << 1), + FE_INTERLEAVER_INDEPTH = (1 << 2), + FE_INTERLEAVER_AUTO = (1 << 31) +}; + + +/** + * Supported MPE-FEC modes + * + * FE_MPEFEC_IGNORE, causes the mpefec indicator + * not to be queried. + * + * NOTE: MPE-FEC is an indicator according to EN 300 468 + * Currently applies only to DVB-H. + */ +enum fe_mpefec { + FE_MPEFEC_IGNORE = (0 << 0), + FE_MPEFEC_ON = (1 << 1), + FE_MPEFEC_OFF = (1 << 2) +}; + +/** + * Supported Timeslicing mode + * + * FE_TIMESLICING_IGNORE, causes the timeslicing indicator + * not to be queried. + * + * NOTE: Timeslicing is an indicator according to EN 300 468 + * Currently applies only to DVB-H. + */ +enum fe_timeslicing { + FE_TIMESLICING_IGNORE = (0 << 0), + FE_TIMESLICING_ON = (1 << 1), + FE_TIMESLICING_OFF = (1 << 2) +}; + +/** + * DVB-S parameters + */ +struct dvbs_params { + __u32 symbol_rate; + + enum fe_modulations modulation; + enum fe_fecrates fecrate; +}; + +/** + * DVB-S2 parameters + */ +struct dvbs2_params { + __u32 symbol_rate; + + enum fe_modulations modulation; + enum fe_fecrates fecrate; + enum fe_stream streamtype; + enum fe_fecrates coderate_HP; + enum fe_fecrates coderate_LP; +}; + +/** + * DSS parameters + */ +struct dss_params { + __u32 symbol_rate; + + enum fe_modulations modulation; + enum fe_fecrates fecrate; +}; + +/** + * DVB-C parameters + */ +struct dvbc_params { + __u32 symbol_rate; + + enum fe_modulations modulation; + enum fe_fecrates fecrate; +}; + +/** + * DVB-T parameters + */ +struct dvbt_params { + enum fe_modulations constellation; + enum fe_bandwidths bandwidth; + enum fe_fecrates code_rate_HP; + enum fe_fecrates code_rate_LP; + enum fe_transmit_modes transmission_mode; + enum fe_guard_intervals guard_interval; + enum fe_hierarchy_info hierarchy; + enum fe_rolloff alpha; + enum fe_stream stream; +}; + +/** + * DVB-H parameters + */ +struct dvbh_params { + enum fe_modulations constellation; + enum fe_fecrates code_rate_HP; + enum fe_fecrates code_rate_LP; + enum fe_transmit_modes transmission_mode; + enum fe_guard_intervals guard_interval; + enum fe_hierarchy_info hierarchy; + enum fe_rolloff alpha; + enum fe_interleaver interleaver; + enum fe_mpefec mpefec; + enum fe_timeslicing timeslicing; + enum fe_stream stream; + __u32 bandwidth; +}; + +/** + * ATSC parameters + */ +struct atsc_params { + enum fe_modulations modulation; +}; + +/** + * Padding to handle future binary compatibility issues. + * + * NOTE: The padding is a dummy parameter ! + */ +struct pad_params { + __u8 pad[512]; +}; + +/** + * Frontend capability information + */ +struct dvb_frontend_cap { + char name[128]; + + __u32 frequency_min; + __u32 frequency_max; + __u32 frequency_stepsize; + __u32 frequency_tolerance; + __u32 symbol_rate_min; + __u32 symbol_rate_max; + __u32 symbol_rate_tolerance; + + enum fe_delsys delivery; + enum fe_inversion inversion; + + union { + struct dvbs_params dvbs; + struct dvbs2_params dvbs2; + struct dss_params dss; + struct dvbc_params dvbc; + struct dvbt_params dvbt; + struct dvbh_params dvbh; + struct atsc_params atsc; + struct pad_params pad; + } delsys; +}; + +/** + * We have the NEW IOCTL's defined now. This IOCTL + * is supposed to handle all the new delivery systems + * FE_GET_CAPS, gets all the capabilities in one go. + * + * For the GET IOCTL's ie FE_GET_PARAMS and FE_GET_CAPS + * some of the parameters maybe selectively queried by + * setting that relevant parameter to IGNORE. + */ +#define FE_GET_CAPS _IOR('o', 84, struct dvb_frontend_cap) + +/** + * Frontend parameters + */ +struct dvb_frontend_params { + __u32 frequency; + + enum fe_delsys delivery; + enum fe_inversion inversion; + + union { + struct dvbs_params dvbs; + struct dvbs2_params dvbs2; + struct dss_params dss; + struct dvbc_params dvbc; + struct dvbt_params dvbt; + struct dvbh_params dvbh; + struct atsc_params atsc; + struct pad_params pad; + } delsys; +}; + +/** + * We have the NEW IOCTL's defined now. These IOCTL's + * are supposed to handle all the new delivery systems. + * FE_SET_PARAMS, sets all the parameters in one go. + * FE_GET_PARAMS, gets all the parameters in one go. + * + * For the GET IOCTL's ie FE_GET_PARAMS and FE_GET_CAPS + * some of the parameters maybe selectively queried by + * setting that relevant parameter to IGNORE. + */ +#define FE_SET_PARAMS _IOW('o', 82, struct dvb_frontend_params) +#define FE_GET_PARAMS _IOR('o', 83, struct dvb_frontend_params) + #endif /*_DVBFRONTEND_H_*/ -- cgit v1.2.3 From 5fa5a296f99947e67379995c284facd6c4e78bcc Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 6 May 2006 11:22:23 -0400 Subject: cx88: add autodetection for another Twinhan VP-3054 board. From: Michael Krufky Added autodetection for PCI subsystem id 1822:0019 to use the card definition for CX88_BOARD_DNTV_LIVE_DVB_T_PRO Signed-off-by: Michael Krufky --- linux/Documentation/video4linux/CARDLIST.cx88 | 2 +- linux/drivers/media/video/cx88/cx88-cards.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'linux') diff --git a/linux/Documentation/video4linux/CARDLIST.cx88 b/linux/Documentation/video4linux/CARDLIST.cx88 index 3cc36e1f3..db091e817 100644 --- a/linux/Documentation/video4linux/CARDLIST.cx88 +++ b/linux/Documentation/video4linux/CARDLIST.cx88 @@ -40,7 +40,7 @@ 39 -> KWorld DVB-S 100 [17de:08b2] 40 -> Hauppauge WinTV-HVR1100 DVB-T/Hybrid [0070:9400,0070:9402] 41 -> Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile) [0070:9800,0070:9802] - 42 -> digitalnow DNTV Live! DVB-T Pro [1822:0025] + 42 -> digitalnow DNTV Live! DVB-T Pro [1822:0025,1822:0019] 43 -> KWorld/VStream XPert DVB-T with cx22702 [17de:08a1] 44 -> DViCO FusionHDTV DVB-T Dual Digital [18ac:db50,18ac:db54] 45 -> KWorld HardwareMpegTV XPert [17de:0840] diff --git a/linux/drivers/media/video/cx88/cx88-cards.c b/linux/drivers/media/video/cx88/cx88-cards.c index 05e2bc403..89347103a 100644 --- a/linux/drivers/media/video/cx88/cx88-cards.c +++ b/linux/drivers/media/video/cx88/cx88-cards.c @@ -1384,6 +1384,10 @@ struct cx88_subid cx88_subids[] = { .subvendor = 0x17de, .subdevice = 0x0841, .card = CX88_BOARD_KWORLD_MCE200_DELUXE, + },{ + .subvendor = 0x1822, + .subdevice = 0x0019, + .card = CX88_BOARD_DNTV_LIVE_DVB_T_PRO, }, }; const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); -- cgit v1.2.3 From b6e187a6550c6685b2e52b2d37053ab3dfe7c2cd Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 7 May 2006 14:29:46 -0400 Subject: bug-fix: pvrusb2 must #include for compile-time options From: Michael Krufky Added necessary header file in order for kconfig build options to be considered at compile time. Without this patch all options will always be disabled, regardless of whether they are selected or not. Signed-off-by: Michael Krufky Acked-by: Mike Isely --- linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h | 1 + linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c | 1 + 2 files changed, 2 insertions(+) (limited to 'linux') diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h index ff18fc548..0d527abb5 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h @@ -34,6 +34,7 @@ */ #include "compat.h" +#include #include #include #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c index 3bf8f166c..075882877 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c @@ -19,6 +19,7 @@ * */ +#include #include #include #include -- cgit v1.2.3 From 9a5a7b6c35191d8c0681eba05fa6b2d0e63c4583 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 7 May 2006 19:10:00 -0300 Subject: revert manu's multiproto patch by his ask. From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/dvb/dvb-core/dvb_frontend.c | 80 +--- linux/drivers/media/dvb/dvb-core/dvb_frontend.h | 9 +- linux/include/linux/dvb/frontend.h | 530 +----------------------- 3 files changed, 4 insertions(+), 615 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c index 5d980ee9d..bc752929f 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -94,8 +94,6 @@ struct dvb_frontend_private { /* thread/frontend values */ struct dvb_device *dvbdev; struct dvb_frontend_parameters parameters; - struct dvb_frontend_params params; - struct dvb_frontend_cap caps; struct dvb_fe_events events; struct semaphore sem; struct list_head list_head; @@ -126,62 +124,6 @@ struct dvb_frontend_private { unsigned int check_wrapped; }; -struct modcod_table { - __u32 modcod; - __u32 modulation; - __u32 fecrate; -}; - -struct modcod_table dvbs2_modcod_lookup[] = { - { FE_MODCOD_DUMMY_PLFRAME, FE_MOD_NONE, FE_FECRATE_NONE }, - { FE_MODCOD_QPSK_1_4, FE_MOD_QPSK, FE_FECRATE_1_4 }, - { FE_MODCOD_QPSK_1_3, FE_MOD_QPSK, FE_FECRATE_1_3 }, - { FE_MODCOD_QPSK_2_5, FE_MOD_QPSK, FE_FECRATE_2_5 }, - { FE_MODCOD_QPSK_1_2, FE_MOD_QPSK, FE_FECRATE_1_2 }, - { FE_MODCOD_QPSK_3_5, FE_MOD_QPSK, FE_FECRATE_3_5 }, - { FE_MODCOD_QPSK_2_3, FE_MOD_QPSK, FE_FECRATE_2_3 }, - { FE_MODCOD_QPSK_3_4, FE_MOD_QPSK, FE_FECRATE_3_4 }, - { FE_MODCOD_QPSK_4_5, FE_MOD_QPSK, FE_FECRATE_4_5 }, - { FE_MODCOD_QPSK_5_6, FE_MOD_QPSK, FE_FECRATE_5_6 }, - { FE_MODCOD_QPSK_8_9, FE_MOD_QPSK, FE_FECRATE_8_9 }, - { FE_MODCOD_QPSK_9_10, FE_MOD_QPSK, FE_FECRATE_9_10 }, - { FE_MODCOD_8PSK_3_5, FE_MOD_8PSK, FE_FECRATE_3_5 }, - { FE_MODCOD_8PSK_2_3, FE_MOD_8PSK, FE_FECRATE_2_3 }, - { FE_MODCOD_8PSK_3_4, FE_MOD_8PSK, FE_FECRATE_3_4 }, - { FE_MODCOD_8PSK_5_6, FE_MOD_8PSK, FE_FECRATE_5_6 }, - { FE_MODCOD_8PSK_8_9, FE_MOD_8PSK, FE_FECRATE_8_9 }, - { FE_MODCOD_8PSK_9_10, FE_MOD_8PSK, FE_FECRATE_9_10 }, - { FE_MODCOD_16APSK_2_3, FE_MOD_16APSK, FE_FECRATE_2_3 }, - { FE_MODCOD_16APSK_3_4, FE_MOD_16APSK, FE_FECRATE_3_4 }, - { FE_MODCOD_16APSK_4_5, FE_MOD_16APSK, FE_FECRATE_4_5 }, - { FE_MODCOD_16APSK_5_6, FE_MOD_16APSK, FE_FECRATE_5_6 }, - { FE_MODCOD_16APSK_8_9, FE_MOD_16APSK, FE_FECRATE_8_9 }, - { FE_MODCOD_16APSK_9_10, FE_MOD_16APSK, FE_FECRATE_9_10 }, - { FE_MODCOD_32APSK_3_4, FE_MOD_32APSK, FE_FECRATE_3_4 }, - { FE_MODCOD_32APSK_4_5, FE_MOD_32APSK, FE_FECRATE_4_5 }, - { FE_MODCOD_32APSK_5_6, FE_MOD_32APSK, FE_FECRATE_5_6 }, - { FE_MODCOD_32APSK_8_9, FE_MOD_32APSK, FE_FECRATE_8_9 }, - { FE_MODCOD_32APSK_9_10, FE_MOD_32APSK, FE_FECRATE_9_10 }, - { FE_MODCOD_RESERVED_1, FE_MOD_RSVD, FE_FECRATE_RSVD }, - { FE_MODCOD_BPSK_1_3, FE_MOD_BPSK, FE_FECRATE_1_3 }, - { FE_MODCOD_BPSK_1_4, FE_MOD_BPSK, FE_FECRATE_1_4 }, - { FE_MODCOD_RESERVED_2, FE_MOD_RSVD, FE_FECRATE_RSVD } -}; - -int decode_dvbs2_modcod(struct dvb_frontend *fe, enum fe_modcod modcod) -{ - struct modcod_table *table = dvbs2_modcod_lookup; - struct dvb_frontend_private *fepriv = fe->frontend_priv; - struct dvb_frontend_params *params = &fepriv->params; - - table += modcod; - params->delsys.dvbs2.modulation = table->modulation; - params->delsys.dvbs2.fecrate = table->fecrate; - - return 0; -} -EXPORT_SYMBOL(decode_dvbs2_modcod); - static void dvb_frontend_wakeup(struct dvb_frontend *fe); static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status) @@ -566,7 +508,7 @@ static int dvb_frontend_thread(void *data) unsigned long timeout; char name [15]; fe_status_t s; - struct dvb_frontend_params *params; + struct dvb_frontend_parameters *params; dprintk("%s\n", __FUNCTION__); @@ -622,7 +564,7 @@ static int dvb_frontend_thread(void *data) /* have we been asked to retune? */ params = NULL; if (fepriv->state & FESTATE_RETUNE) { - params = &fepriv->params; + params = &fepriv->parameters; fepriv->state = FESTATE_TUNED; } @@ -1035,24 +977,6 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, case FE_SET_FRONTEND_TUNE_MODE: fepriv->tune_mode_flags = (unsigned long) parg; break; - - case FE_GET_CAPS: - if (fe->ops->get_caps) { - memcpy(parg, &fepriv->caps, sizeof (struct dvb_frontend_cap)); - err = fe->ops->get_caps(fe, (struct dvb_frontend_cap*) parg); - } - break; - - case FE_SET_PARAMS: - if (fe->ops->set_params) - err = fe->ops->set_params(fe, (struct dvb_frontend_params*) parg); - break; - - case FE_GET_PARAMS: - if (fe->ops->get_params){ - memcpy(parg, &fepriv->params, sizeof (struct dvb_frontend_params)); - err = fe->ops->get_params(fe, (struct dvb_frontend_params*) parg); - } }; up (&fepriv->sem); diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h index 4d1b45be0..05ec9954b 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h @@ -98,7 +98,7 @@ struct dvb_frontend_ops { /* if this is set, it overrides the default swzigzag */ int (*tune)(struct dvb_frontend* fe, - struct dvb_frontend_params* params, + struct dvb_frontend_parameters* params, unsigned int mode_flags, int *delay, fe_status_t *status); @@ -125,11 +125,6 @@ struct dvb_frontend_ops { int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd); int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable); - /* New callbacks based on the new IOCTL's */ - int (*get_caps)(struct dvb_frontend* fe, struct dvb_frontend_cap* caps); - int (*set_params)(struct dvb_frontend* fe, struct dvb_frontend_params* params); - int (*get_params)(struct dvb_frontend* fe, struct dvb_frontend_params* params); - struct dvb_tuner_ops tuner_ops; }; @@ -163,6 +158,4 @@ extern void dvb_frontend_reinitialise(struct dvb_frontend *fe); extern void dvb_frontend_sleep_until(struct timeval *waketime, u32 add_usec); extern s32 timeval_usec_diff(struct timeval lasttime, struct timeval curtime); -extern int decode_dvbs2_modcod(struct dvb_frontend *fe, enum fe_modcod modcod); - #endif diff --git a/linux/include/linux/dvb/frontend.h b/linux/include/linux/dvb/frontend.h index fe3b69605..c8cbd90ba 100644 --- a/linux/include/linux/dvb/frontend.h +++ b/linux/include/linux/dvb/frontend.h @@ -7,8 +7,6 @@ * Andre Draszik * for convergence integrated media GmbH * - * Copyright (C) 2006 Manu Abraham - * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 @@ -251,9 +249,7 @@ struct dvb_frontend_event { */ #define FE_TUNE_MODE_ONESHOT 0x01 -/** - * FE_GET_INFO, is now a legacy IOCTL as well - */ + #define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) #define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) @@ -271,9 +267,6 @@ struct dvb_frontend_event { #define FE_READ_SNR _IOR('o', 72, __u16) #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) -/** - * Legacy IOCTL's - */ #define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) #define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) #define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */ @@ -281,525 +274,4 @@ struct dvb_frontend_event { #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ -/** - * New operations for new and multiple delivery systems. - * - * References: - * DVB-S: ISO 13818-1/ITU H.222, EN 300 468 - * DVB-S2: EN 300 468, EN 301 210, TR 102 376 - * DVB-C: ISO 13818-1/ITU H.222, EN 300 468, EN 300 429 - * DVB-T: ISO 13818-1/ITU H.222, EN 300 468, EN 300 744 - * DVB-H: EN 300 468, EN 302 304 - */ - -/** - * Supported Delivery systems, some devices - * are capable of supporting multiple delivery systems. - * - * FE_DELSYS_IGNORE, causes the delivery system - * not to be queried. - * - * FE_DELSYS_AUTO, Some devices/drivers, might in - * future be capable of detectinng the delivery system. - */ -enum fe_delsys { - FE_DELSYS_IGNORE = (0 << 0), - FE_DELSYS_DVBS = (1 << 0), - FE_DELSYS_DVBS2 = (1 << 1), - FE_DELSYS_DSS = (1 << 2), - FE_DELSYS_DVBC = (1 << 3), - FE_DELSYS_DVBT = (1 << 4), - FE_DELSYS_DVBH = (1 << 5), - FE_DELSYS_ATSC = (1 << 6), - FE_DELSYS_AUTO = (1 << 31) -}; - -/** - * Supported Transport types, some delivery systems - * support multiple transports too. - * - * FE_MATYPE_IGNORE, causes the transport type not - * to be queried. - * - * FE_MATYPE_AUTO, Some devices/drivers, might - * support auto detecting the transport type, depending - * on some other settings and or hardware features. - * - * NOTE: This is specified by the DVB-S2 specifications - * This change of transport type might require an additional - * change at the PCI bridge level, for some implementations. - */ -enum fe_matype { - FE_MATYPE_IGNORE = (0 << 0), - FE_MATYPE_TRANSPORT = (1 << 0), - FE_MATYPE_GENERIC_PACKET = (1 << 1), - FE_MATYPE_GENERIC_CONTINUOUS = (1 << 2), - FE_MATYPE_RESERVED = (1 << 3), - FE_MATYPE_AUTO = (1 << 31) -}; - -/** - * Supported Stream Priorities - * - * Some delivery systems do have streams having - * different priorities. ie, High priority/Low priority. - * - * NOTE: The default should be the High priority stream. - */ -enum fe_stream { - FE_STREAM_HP = (1 << 0), - FE_STREAM_LP = (1 << 1) -}; - -/** - * Supported Modulations. - * Some devices support multiple modulation types - * - * FE_MOD_IGNORE, causes the modulation type not - * to be queried. - * - * FE_MOD_AUTO, Some devices/drivers, might support - * auto detecting the modulation type, depending on - * some other settings and or hardware features. - */ -enum fe_modulations { - FE_MOD_IGNORE = (0 << 0), - FE_MOD_NONE = (1 << 0), - FE_MOD_BPSK = (1 << 1), - FE_MOD_QPSK = (1 << 2), - FE_MOD_OQPSK = (1 << 3), - FE_MOD_8PSK = (1 << 4), - FE_MOD_16APSK = (1 << 5), - FE_MOD_32APSK = (1 << 6), - FE_MOD_QAM16 = (1 << 7), - FE_MOD_QAM32 = (1 << 8), - FE_MOD_QAM64 = (1 << 9), - FE_MOD_QAM128 = (1 << 10), - FE_MOD_QAM256 = (1 << 11), - FE_MOD_QAM512 = (1 << 12), - FE_MOD_QAM1024 = (1 << 13), - FE_MOD_QAMAUTO = (1 << 14), - FE_MOD_OFDM = (1 << 15), - FE_MOD_COFDM = (1 << 16), - FE_MOD_VSB8 = (1 << 17), - FE_MOD_VSB16 = (1 << 18), - FE_MOD_RSVD = (1 << 19), - FE_MOD_AUTO = (1 << 31) -}; - -/** - * Supported FEC (Forward Error Correction) Code rates - * - * FE_FECRATE_IGNORE, causes the FECRATE type not - * to be queried. - * - * FE_FECRATE_AUTO, Some devices/drivers, might - * support auto detecting the FEC code rate type, depending - * on some other hardware settings and or hardware features. - */ -enum fe_fecrates { - FE_FECRATE_IGNORE = (0 << 0), - FE_FECRATE_NONE = (1 << 0), - FE_FECRATE_1_4 = (1 << 1), - FE_FECRATE_1_3 = (1 << 2), - FE_FECRATE_2_5 = (1 << 3), - FE_FECRATE_1_2 = (1 << 4), - FE_FECRATE_3_5 = (1 << 5), - FE_FECRATE_2_3 = (1 << 6), - FE_FECRATE_3_4 = (1 << 7), - FE_FECRATE_4_5 = (1 << 8), - FE_FECRATE_5_6 = (1 << 9), - FE_FECRATE_6_7 = (1 << 10), - FE_FECRATE_7_8 = (1 << 11), - FE_FECRATE_8_9 = (1 << 12), - FE_FECRATE_9_10 = (1 << 13), - FE_FECRATE_RSVD = (1 << 14), - FE_FECRATE_AUTO = (1 << 31) -}; - -/** - * Supported MODCOD types - * - * The MODCOD types are specific to the DVB-S2 specification - * Some devices directly take the MODCOD values as an input - * or just output the same. - * - * In any case a single frontend will not be able to do - * multiple modulations/code rates at any given point of time. - */ -enum fe_modcod { - FE_MODCOD_DUMMY_PLFRAME = 0, - FE_MODCOD_QPSK_1_4, - FE_MODCOD_QPSK_1_3, - FE_MODCOD_QPSK_2_5, - FE_MODCOD_QPSK_1_2, - FE_MODCOD_QPSK_3_5, - FE_MODCOD_QPSK_2_3, - FE_MODCOD_QPSK_3_4, - FE_MODCOD_QPSK_4_5, - FE_MODCOD_QPSK_5_6, - FE_MODCOD_QPSK_8_9, - FE_MODCOD_QPSK_9_10, - FE_MODCOD_8PSK_3_5, - FE_MODCOD_8PSK_2_3, - FE_MODCOD_8PSK_3_4, - FE_MODCOD_8PSK_5_6, - FE_MODCOD_8PSK_8_9, - FE_MODCOD_8PSK_9_10, - FE_MODCOD_16APSK_2_3, - FE_MODCOD_16APSK_3_4, - FE_MODCOD_16APSK_4_5, - FE_MODCOD_16APSK_5_6, - FE_MODCOD_16APSK_8_9, - FE_MODCOD_16APSK_9_10, - FE_MODCOD_32APSK_3_4, - FE_MODCOD_32APSK_4_5, - FE_MODCOD_32APSK_5_6, - FE_MODCOD_32APSK_8_9, - FE_MODCOD_32APSK_9_10, - FE_MODCOD_RESERVED_1, - FE_MODCOD_BPSK_1_3, - FE_MODCOD_BPSK_1_4, - FE_MODCOD_RESERVED_2 -}; - -/** - * Supported Bandwidth modes - * - * FE_BANDWIDTH_IGNORE, causes the bandwidth not - * to be queried. - * - * FE_BANDWIDTH_AUTO, Some devices/drivers, might - * support auto detecting the Bandwidth, depending - * on some other hardware settings and or hardware features. - */ -enum fe_bandwidths { - FE_BANDWIDTH_IGNORE = (0 << 0), - FE_BANDWIDTH_8_MHZ = (1 << 1), - FE_BANDWIDTH_7_MHZ = (1 << 2), - FE_BANDWIDTH_6_MHZ = (1 << 3), - FE_BANDWIDTH_5_MHZ = (1 << 4), - FE_BANDWIDTH_RESERVED = (1 << 5), - FE_BANDWIDTH_AUTO = (1 << 31) -}; - -/** - * Supported Inversion modes - * - * FE_INVERSION_IGNORE, causes the inversion not - * to be queried. - * - * FE_INVERSION_AUTO, Some devices/drivers, might - * support auto detecting the Inversion, depending - * on some other hardware settings and or hardware features. - * - * NOTE: All current delivery systems need inversion in some - * way or the other, due to hardware implementation specifics. - * and/or others. - */ -enum fe_inversion { - FE_INVERSION_IGNORE = (0 << 0), - FE_INVERSION_OFF = (1 << 0), - FE_INVERSION_ON = (1 << 1), - FE_INVERSION_AUTO = (1 << 31) -}; - -/** - * Supported Transmission modes - * - * FE_TRANSMISSION_MODE_IGNORE, causes the transmission mode - * not to be queried. - * - * FE_TRANSMISSION_MODE_AUTO, Some devices/drivers, might - * support auto detecting the Transmission Mode, depending - * on some other hardware settings and or hardware features. - * - * NOTE: Currently applies to DVB-T and DVB-H only. - */ -enum fe_transmit_modes { - FE_TRANSMISSION_MODE_IGNORE = (0 << 0), - FE_TRANSMISSION_MODE_2K = (1 << 1), - FE_TRANSMISSION_MODE_4K = (1 << 2), - FE_TRANSMISSION_MODE_8K = (1 << 3), - FE_TRANSMISSION_MODE_RESERVED = (1 << 4), - FE_TRANSMISSION_MODE_AUTO = (1 << 31) -}; - -/** - * Supported Guard Intervals - * - * FE_GUARD_INTERVAL_IGNORE, causes the guard interval - * not to be queried. - * - * FE_GUARD_INTERVAL_AUTO, Some devices/drivers, might - * support auto detecting the Transmission Mode, depending - * on some other hardware settings and or hardware features. - * - * NOTE: Currently applies to DVB-T and DVB-H only. - */ -enum fe_guard_intervals { - FE_GUARD_INTERVAL_IGNORE = (0 << 0), - FE_GUARD_INTERVAL_1_32 = (1 << 1), - FE_GUARD_INTERVAL_1_16 = (1 << 2), - FE_GUARD_INTERVAL_1_8 = (1 << 3), - FE_GUARD_INTERVAL_1_4 = (1 << 4), - FE_GUARD_INTERVAL_AUTO = (1 << 31) -}; - -/** - * Supported Hierarchial Modulations - * - * FE_HIERARCHY_IGNORE, causes the hierarchy - * not to be queried. - * - * FE_HIERARCHY_AUTO, Some devices/drivers, might - * support auto detecting the hierarchial modulation, depending - * on some other hardware settings and or hardware features. - * - * NOTE: Currently applies to DVB-T and DVB-H only. - */ -enum fe_hierarchy_info { - FE_HIERARCHY_IGNORE = (0 << 0), - FE_HIERARCHY_OFF = (1 << 1), - FE_HIERARCHY_ON = (1 << 2), - FE_HIERARCHY_AUTO = (1 << 31) -}; - -/** - * Supported Rolloff Rates - * - * FE_ROLLOFF_IGNORE, causes the hierarchy - * not to be queried. - * - * FE_ROLLOFF_AUTO, Some devices/drivers, might - * support auto detecting the hierarchial modulation, depending - * on some other hardware settings and or hardware features. - * - * NOTE: Currently applies to DVB-T and DVB-H only, - * not applicable to DVB-S2, DVB-S2 uses fe_matype - */ -enum fe_rolloff { - FE_ROLLOFF_IGNORE = (0 << 0), - FE_ROLLOFF_1 = (1 << 1), - FE_ROLLOFF_2 = (1 << 2), - FE_ROLLOFF_4 = (1 << 3), - FE_ROLLOFF_AUTO = (1 << 31) -}; - -/** - * Supported Interleaver types - * - * FE_INTERLEAVER_IGNORE, causes the hierarchy - * not to be queried. - * - * FE_INTERLEAVER_AUTO, Some devices/drivers, might - * support auto detecting the hierarchial modulation, depending - * on some other hardware settings and or hardware features. - * - * NOTE: Currently applies only to DVB-H. - */ -enum fe_interleaver { - FE_INTERLEAVER_IGNORE = (0 << 0), - FE_INTERLEAVER_NATIVE = (1 << 1), - FE_INTERLEAVER_INDEPTH = (1 << 2), - FE_INTERLEAVER_AUTO = (1 << 31) -}; - - -/** - * Supported MPE-FEC modes - * - * FE_MPEFEC_IGNORE, causes the mpefec indicator - * not to be queried. - * - * NOTE: MPE-FEC is an indicator according to EN 300 468 - * Currently applies only to DVB-H. - */ -enum fe_mpefec { - FE_MPEFEC_IGNORE = (0 << 0), - FE_MPEFEC_ON = (1 << 1), - FE_MPEFEC_OFF = (1 << 2) -}; - -/** - * Supported Timeslicing mode - * - * FE_TIMESLICING_IGNORE, causes the timeslicing indicator - * not to be queried. - * - * NOTE: Timeslicing is an indicator according to EN 300 468 - * Currently applies only to DVB-H. - */ -enum fe_timeslicing { - FE_TIMESLICING_IGNORE = (0 << 0), - FE_TIMESLICING_ON = (1 << 1), - FE_TIMESLICING_OFF = (1 << 2) -}; - -/** - * DVB-S parameters - */ -struct dvbs_params { - __u32 symbol_rate; - - enum fe_modulations modulation; - enum fe_fecrates fecrate; -}; - -/** - * DVB-S2 parameters - */ -struct dvbs2_params { - __u32 symbol_rate; - - enum fe_modulations modulation; - enum fe_fecrates fecrate; - enum fe_stream streamtype; - enum fe_fecrates coderate_HP; - enum fe_fecrates coderate_LP; -}; - -/** - * DSS parameters - */ -struct dss_params { - __u32 symbol_rate; - - enum fe_modulations modulation; - enum fe_fecrates fecrate; -}; - -/** - * DVB-C parameters - */ -struct dvbc_params { - __u32 symbol_rate; - - enum fe_modulations modulation; - enum fe_fecrates fecrate; -}; - -/** - * DVB-T parameters - */ -struct dvbt_params { - enum fe_modulations constellation; - enum fe_bandwidths bandwidth; - enum fe_fecrates code_rate_HP; - enum fe_fecrates code_rate_LP; - enum fe_transmit_modes transmission_mode; - enum fe_guard_intervals guard_interval; - enum fe_hierarchy_info hierarchy; - enum fe_rolloff alpha; - enum fe_stream stream; -}; - -/** - * DVB-H parameters - */ -struct dvbh_params { - enum fe_modulations constellation; - enum fe_fecrates code_rate_HP; - enum fe_fecrates code_rate_LP; - enum fe_transmit_modes transmission_mode; - enum fe_guard_intervals guard_interval; - enum fe_hierarchy_info hierarchy; - enum fe_rolloff alpha; - enum fe_interleaver interleaver; - enum fe_mpefec mpefec; - enum fe_timeslicing timeslicing; - enum fe_stream stream; - __u32 bandwidth; -}; - -/** - * ATSC parameters - */ -struct atsc_params { - enum fe_modulations modulation; -}; - -/** - * Padding to handle future binary compatibility issues. - * - * NOTE: The padding is a dummy parameter ! - */ -struct pad_params { - __u8 pad[512]; -}; - -/** - * Frontend capability information - */ -struct dvb_frontend_cap { - char name[128]; - - __u32 frequency_min; - __u32 frequency_max; - __u32 frequency_stepsize; - __u32 frequency_tolerance; - __u32 symbol_rate_min; - __u32 symbol_rate_max; - __u32 symbol_rate_tolerance; - - enum fe_delsys delivery; - enum fe_inversion inversion; - - union { - struct dvbs_params dvbs; - struct dvbs2_params dvbs2; - struct dss_params dss; - struct dvbc_params dvbc; - struct dvbt_params dvbt; - struct dvbh_params dvbh; - struct atsc_params atsc; - struct pad_params pad; - } delsys; -}; - -/** - * We have the NEW IOCTL's defined now. This IOCTL - * is supposed to handle all the new delivery systems - * FE_GET_CAPS, gets all the capabilities in one go. - * - * For the GET IOCTL's ie FE_GET_PARAMS and FE_GET_CAPS - * some of the parameters maybe selectively queried by - * setting that relevant parameter to IGNORE. - */ -#define FE_GET_CAPS _IOR('o', 84, struct dvb_frontend_cap) - -/** - * Frontend parameters - */ -struct dvb_frontend_params { - __u32 frequency; - - enum fe_delsys delivery; - enum fe_inversion inversion; - - union { - struct dvbs_params dvbs; - struct dvbs2_params dvbs2; - struct dss_params dss; - struct dvbc_params dvbc; - struct dvbt_params dvbt; - struct dvbh_params dvbh; - struct atsc_params atsc; - struct pad_params pad; - } delsys; -}; - -/** - * We have the NEW IOCTL's defined now. These IOCTL's - * are supposed to handle all the new delivery systems. - * FE_SET_PARAMS, sets all the parameters in one go. - * FE_GET_PARAMS, gets all the parameters in one go. - * - * For the GET IOCTL's ie FE_GET_PARAMS and FE_GET_CAPS - * some of the parameters maybe selectively queried by - * setting that relevant parameter to IGNORE. - */ -#define FE_SET_PARAMS _IOW('o', 82, struct dvb_frontend_params) -#define FE_GET_PARAMS _IOR('o', 83, struct dvb_frontend_params) - #endif /*_DVBFRONTEND_H_*/ -- cgit v1.2.3