aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-06-26 13:54:02 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-26 13:54:02 -0400
commit5f2f444136abdb13dbd2094555aa65fc252aef6c (patch)
treeeb7ff532050c76319ba9d0c190a19f10a101e844
parent81a07d7588d376c530d006e24d7981304ce96e16 (diff)
parent33f40b3b023b9f00b40ecfb3a39286de13516b33 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb: V4L/DVB (4227): Update this driver for recent header file movement. V4L/DVB (4223): Add V4L2_CID_MPEG_STREAM_VBI_FMT control V4L/DVB (4222): Always switch tuner mode when calling VIDIOC_S_FREQUENCY. V4L/DVB (4221): Add HM12 YUV format define. V4L/DVB (4219): Av7110: analog sound output of DVB-C rev 2.3 V4L/DVB (4217): Fix a misplaced closing bracket/else, which caused swzigzag not to be called V4L/DVB (4215): Make VIDEO_CX88_BLACKBIRD a separate build option V4L/DVB (4214): Make VIDEO_CX2341X a selectable build option V4L/DVB (4213): Cx88: cleanups V4L/DVB (4211): Fix an Oops for all fe that have get_frontend_algo == NULL
-rw-r--r--drivers/media/Kconfig3
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c27
-rw-r--r--drivers/media/dvb/ttpci/av7110.c8
-rw-r--r--drivers/media/dvb/ttpci/av7110_av.c25
-rw-r--r--drivers/media/dvb/ttpci/av7110_v4l.c50
-rw-r--r--drivers/media/video/Kconfig12
-rw-r--r--drivers/media/video/cx2341x.c17
-rw-r--r--drivers/media/video/cx88/Kconfig15
-rw-r--r--drivers/media/video/cx88/Makefile5
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c17
-rw-r--r--drivers/media/video/cx88/cx88-cards.c5
-rw-r--r--drivers/media/video/cx88/cx88-core.c2
-rw-r--r--drivers/media/video/cx88/cx88-i2c.c1
-rw-r--r--drivers/media/video/cx88/cx88-tvaudio.c2
-rw-r--r--drivers/media/video/cx88/cx88.h7
-rw-r--r--drivers/media/video/tuner-core.c10
-rw-r--r--drivers/media/video/v4l2-common.c14
-rw-r--r--include/linux/videodev2.h6
-rw-r--r--include/media/cx2341x.h6
19 files changed, 157 insertions, 75 deletions
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index 583d151b7486..ef52e6da01ed 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -82,9 +82,6 @@ config VIDEO_IR
82config VIDEO_TVEEPROM 82config VIDEO_TVEEPROM
83 tristate 83 tristate
84 84
85config VIDEO_CX2341X
86 tristate
87
88config USB_DABUSB 85config USB_DABUSB
89 tristate "DABUSB driver" 86 tristate "DABUSB driver"
90 depends on USB 87 depends on USB
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 3152a54a2539..5e8bb41a088b 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -556,22 +556,23 @@ static int dvb_frontend_thread(void *data)
556 } 556 }
557 557
558 /* do an iteration of the tuning loop */ 558 /* do an iteration of the tuning loop */
559 if (fe->ops.get_frontend_algo(fe) == FE_ALGO_HW) { 559 if (fe->ops.get_frontend_algo) {
560 /* have we been asked to retune? */ 560 if (fe->ops.get_frontend_algo(fe) == FE_ALGO_HW) {
561 params = NULL; 561 /* have we been asked to retune? */
562 if (fepriv->state & FESTATE_RETUNE) { 562 params = NULL;
563 params = &fepriv->parameters; 563 if (fepriv->state & FESTATE_RETUNE) {
564 fepriv->state = FESTATE_TUNED; 564 params = &fepriv->parameters;
565 } 565 fepriv->state = FESTATE_TUNED;
566 }
566 567
567 fe->ops.tune(fe, params, fepriv->tune_mode_flags, &fepriv->delay, &s); 568 fe->ops.tune(fe, params, fepriv->tune_mode_flags, &fepriv->delay, &s);
568 if (s != fepriv->status) { 569 if (s != fepriv->status) {
569 dvb_frontend_add_event(fe, s); 570 dvb_frontend_add_event(fe, s);
570 fepriv->status = s; 571 fepriv->status = s;
572 }
571 } 573 }
572 } else { 574 } else
573 dvb_frontend_swzigzag(fe); 575 dvb_frontend_swzigzag(fe);
574 }
575 } 576 }
576 577
577 if (dvb_shutdown_timeout) { 578 if (dvb_shutdown_timeout) {
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 8832f80c05f7..7a5c99c200e8 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -152,13 +152,9 @@ static void init_av7110_av(struct av7110 *av7110)
152 /* remaining inits according to card and frontend type */ 152 /* remaining inits according to card and frontend type */
153 av7110->analog_tuner_flags = 0; 153 av7110->analog_tuner_flags = 0;
154 av7110->current_input = 0; 154 av7110->current_input = 0;
155 if (dev->pci->subsystem_vendor == 0x13c2 && dev->pci->subsystem_device == 0x000a) { 155 if (dev->pci->subsystem_vendor == 0x13c2 && dev->pci->subsystem_device == 0x000a)
156 printk("dvb-ttpci: MSP3415 audio DAC @ card %d\n",
157 av7110->dvb_adapter.num);
158 av7110->adac_type = DVB_ADAC_MSP34x5;
159 av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, ADSwitch, 1, 0); // SPDIF on 156 av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, ADSwitch, 1, 0); // SPDIF on
160 } 157 if (i2c_writereg(av7110, 0x20, 0x00, 0x00) == 1) {
161 else if (i2c_writereg(av7110, 0x20, 0x00, 0x00) == 1) {
162 printk ("dvb-ttpci: Crystal audio DAC @ card %d detected\n", 158 printk ("dvb-ttpci: Crystal audio DAC @ card %d detected\n",
163 av7110->dvb_adapter.num); 159 av7110->dvb_adapter.num);
164 av7110->adac_type = DVB_ADAC_CRYSTAL; 160 av7110->adac_type = DVB_ADAC_CRYSTAL;
diff --git a/drivers/media/dvb/ttpci/av7110_av.c b/drivers/media/dvb/ttpci/av7110_av.c
index 2eff09f638d3..0f3a044aeb17 100644
--- a/drivers/media/dvb/ttpci/av7110_av.c
+++ b/drivers/media/dvb/ttpci/av7110_av.c
@@ -318,7 +318,17 @@ int av7110_set_volume(struct av7110 *av7110, int volleft, int volright)
318 msp_writereg(av7110, MSP_WR_DSP, 0x0000, val); /* loudspeaker */ 318 msp_writereg(av7110, MSP_WR_DSP, 0x0000, val); /* loudspeaker */
319 msp_writereg(av7110, MSP_WR_DSP, 0x0006, val); /* headphonesr */ 319 msp_writereg(av7110, MSP_WR_DSP, 0x0006, val); /* headphonesr */
320 return 0; 320 return 0;
321
322 case DVB_ADAC_MSP34x5:
323 vol = (volleft > volright) ? volleft : volright;
324 val = (vol * 0x73 / 255) << 8;
325 if (vol > 0)
326 balance = ((volright - volleft) * 127) / vol;
327 msp_writereg(av7110, MSP_WR_DSP, 0x0001, balance << 8);
328 msp_writereg(av7110, MSP_WR_DSP, 0x0000, val); /* loudspeaker */
329 return 0;
321 } 330 }
331
322 return 0; 332 return 0;
323} 333}
324 334
@@ -1267,23 +1277,32 @@ static int dvb_audio_ioctl(struct inode *inode, struct file *file,
1267 switch(av7110->audiostate.channel_select) { 1277 switch(av7110->audiostate.channel_select) {
1268 case AUDIO_STEREO: 1278 case AUDIO_STEREO:
1269 ret = audcom(av7110, AUDIO_CMD_STEREO); 1279 ret = audcom(av7110, AUDIO_CMD_STEREO);
1270 if (!ret) 1280 if (!ret) {
1271 if (av7110->adac_type == DVB_ADAC_CRYSTAL) 1281 if (av7110->adac_type == DVB_ADAC_CRYSTAL)
1272 i2c_writereg(av7110, 0x20, 0x02, 0x49); 1282 i2c_writereg(av7110, 0x20, 0x02, 0x49);
1283 else if (av7110->adac_type == DVB_ADAC_MSP34x5)
1284 msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0220);
1285 }
1273 break; 1286 break;
1274 1287
1275 case AUDIO_MONO_LEFT: 1288 case AUDIO_MONO_LEFT:
1276 ret = audcom(av7110, AUDIO_CMD_MONO_L); 1289 ret = audcom(av7110, AUDIO_CMD_MONO_L);
1277 if (!ret) 1290 if (!ret) {
1278 if (av7110->adac_type == DVB_ADAC_CRYSTAL) 1291 if (av7110->adac_type == DVB_ADAC_CRYSTAL)
1279 i2c_writereg(av7110, 0x20, 0x02, 0x4a); 1292 i2c_writereg(av7110, 0x20, 0x02, 0x4a);
1293 else if (av7110->adac_type == DVB_ADAC_MSP34x5)
1294 msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0200);
1295 }
1280 break; 1296 break;
1281 1297
1282 case AUDIO_MONO_RIGHT: 1298 case AUDIO_MONO_RIGHT:
1283 ret = audcom(av7110, AUDIO_CMD_MONO_R); 1299 ret = audcom(av7110, AUDIO_CMD_MONO_R);
1284 if (!ret) 1300 if (!ret) {
1285 if (av7110->adac_type == DVB_ADAC_CRYSTAL) 1301 if (av7110->adac_type == DVB_ADAC_CRYSTAL)
1286 i2c_writereg(av7110, 0x20, 0x02, 0x45); 1302 i2c_writereg(av7110, 0x20, 0x02, 0x45);
1303 else if (av7110->adac_type == DVB_ADAC_MSP34x5)
1304 msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0210);
1305 }
1287 break; 1306 break;
1288 1307
1289 default: 1308 default:
diff --git a/drivers/media/dvb/ttpci/av7110_v4l.c b/drivers/media/dvb/ttpci/av7110_v4l.c
index 603a22e4bfe2..64055461559d 100644
--- a/drivers/media/dvb/ttpci/av7110_v4l.c
+++ b/drivers/media/dvb/ttpci/av7110_v4l.c
@@ -42,7 +42,18 @@
42int msp_writereg(struct av7110 *av7110, u8 dev, u16 reg, u16 val) 42int msp_writereg(struct av7110 *av7110, u8 dev, u16 reg, u16 val)
43{ 43{
44 u8 msg[5] = { dev, reg >> 8, reg & 0xff, val >> 8 , val & 0xff }; 44 u8 msg[5] = { dev, reg >> 8, reg & 0xff, val >> 8 , val & 0xff };
45 struct i2c_msg msgs = { .flags = 0, .addr = 0x40, .len = 5, .buf = msg }; 45 struct i2c_msg msgs = { .flags = 0, .len = 5, .buf = msg };
46
47 switch (av7110->adac_type) {
48 case DVB_ADAC_MSP34x0:
49 msgs.addr = 0x40;
50 break;
51 case DVB_ADAC_MSP34x5:
52 msgs.addr = 0x42;
53 break;
54 default:
55 return 0;
56 }
46 57
47 if (i2c_transfer(&av7110->i2c_adap, &msgs, 1) != 1) { 58 if (i2c_transfer(&av7110->i2c_adap, &msgs, 1) != 1) {
48 dprintk(1, "dvb-ttpci: failed @ card %d, %u = %u\n", 59 dprintk(1, "dvb-ttpci: failed @ card %d, %u = %u\n",
@@ -57,10 +68,23 @@ static int msp_readreg(struct av7110 *av7110, u8 dev, u16 reg, u16 *val)
57 u8 msg1[3] = { dev, reg >> 8, reg & 0xff }; 68 u8 msg1[3] = { dev, reg >> 8, reg & 0xff };
58 u8 msg2[2]; 69 u8 msg2[2];
59 struct i2c_msg msgs[2] = { 70 struct i2c_msg msgs[2] = {
60 { .flags = 0, .addr = 0x40, .len = 3, .buf = msg1 }, 71 { .flags = 0 , .len = 3, .buf = msg1 },
61 { .flags = I2C_M_RD, .addr = 0x40, .len = 2, .buf = msg2 } 72 { .flags = I2C_M_RD, .len = 2, .buf = msg2 }
62 }; 73 };
63 74
75 switch (av7110->adac_type) {
76 case DVB_ADAC_MSP34x0:
77 msgs[0].addr = 0x40;
78 msgs[1].addr = 0x40;
79 break;
80 case DVB_ADAC_MSP34x5:
81 msgs[0].addr = 0x42;
82 msgs[1].addr = 0x42;
83 break;
84 default:
85 return 0;
86 }
87
64 if (i2c_transfer(&av7110->i2c_adap, &msgs[0], 2) != 2) { 88 if (i2c_transfer(&av7110->i2c_adap, &msgs[0], 2) != 2) {
65 dprintk(1, "dvb-ttpci: failed @ card %d, %u\n", 89 dprintk(1, "dvb-ttpci: failed @ card %d, %u\n",
66 av7110->dvb_adapter.num, reg); 90 av7110->dvb_adapter.num, reg);
@@ -678,17 +702,23 @@ int av7110_init_analog_module(struct av7110 *av7110)
678{ 702{
679 u16 version1, version2; 703 u16 version1, version2;
680 704
681 if (i2c_writereg(av7110, 0x80, 0x0, 0x80) != 1 705 if (i2c_writereg(av7110, 0x80, 0x0, 0x80) == 1 &&
682 || i2c_writereg(av7110, 0x80, 0x0, 0) != 1) 706 i2c_writereg(av7110, 0x80, 0x0, 0) == 1) {
707 printk("dvb-ttpci: DVB-C analog module @ card %d detected, initializing MSP3400\n",
708 av7110->dvb_adapter.num);
709 av7110->adac_type = DVB_ADAC_MSP34x0;
710 } else if (i2c_writereg(av7110, 0x84, 0x0, 0x80) == 1 &&
711 i2c_writereg(av7110, 0x84, 0x0, 0) == 1) {
712 printk("dvb-ttpci: DVB-C analog module @ card %d detected, initializing MSP3415\n",
713 av7110->dvb_adapter.num);
714 av7110->adac_type = DVB_ADAC_MSP34x5;
715 } else
683 return -ENODEV; 716 return -ENODEV;
684 717
685 printk("dvb-ttpci: DVB-C analog module @ card %d detected, initializing MSP3400\n",
686 av7110->dvb_adapter.num);
687 av7110->adac_type = DVB_ADAC_MSP34x0;
688 msleep(100); // the probing above resets the msp... 718 msleep(100); // the probing above resets the msp...
689 msp_readreg(av7110, MSP_RD_DSP, 0x001e, &version1); 719 msp_readreg(av7110, MSP_RD_DSP, 0x001e, &version1);
690 msp_readreg(av7110, MSP_RD_DSP, 0x001f, &version2); 720 msp_readreg(av7110, MSP_RD_DSP, 0x001f, &version2);
691 dprintk(1, "dvb-ttpci: @ card %d MSP3400 version 0x%04x 0x%04x\n", 721 dprintk(1, "dvb-ttpci: @ card %d MSP34xx version 0x%04x 0x%04x\n",
692 av7110->dvb_adapter.num, version1, version2); 722 av7110->dvb_adapter.num, version1, version2);
693 msp_writereg(av7110, MSP_WR_DSP, 0x0013, 0x0c00); 723 msp_writereg(av7110, MSP_WR_DSP, 0x0013, 0x0c00);
694 msp_writereg(av7110, MSP_WR_DSP, 0x0000, 0x7f00); // loudspeaker + headphone 724 msp_writereg(av7110, MSP_WR_DSP, 0x0000, 0x7f00); // loudspeaker + headphone
@@ -697,7 +727,7 @@ int av7110_init_analog_module(struct av7110 *av7110)
697 msp_writereg(av7110, MSP_WR_DSP, 0x0004, 0x7f00); // loudspeaker volume 727 msp_writereg(av7110, MSP_WR_DSP, 0x0004, 0x7f00); // loudspeaker volume
698 msp_writereg(av7110, MSP_WR_DSP, 0x000a, 0x0220); // SCART 1 source 728 msp_writereg(av7110, MSP_WR_DSP, 0x000a, 0x0220); // SCART 1 source
699 msp_writereg(av7110, MSP_WR_DSP, 0x0007, 0x7f00); // SCART 1 volume 729 msp_writereg(av7110, MSP_WR_DSP, 0x0007, 0x7f00); // SCART 1 volume
700 msp_writereg(av7110, MSP_WR_DSP, 0x000d, 0x4800); // prescale SCART 730 msp_writereg(av7110, MSP_WR_DSP, 0x000d, 0x1900); // prescale SCART
701 731
702 if (i2c_writereg(av7110, 0x48, 0x01, 0x00)!=1) { 732 if (i2c_writereg(av7110, 0x48, 0x01, 0x00)!=1) {
703 INFO(("saa7113 not accessible.\n")); 733 INFO(("saa7113 not accessible.\n"));
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 824a63c92629..e4290491fa9e 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -381,6 +381,18 @@ config VIDEO_WM8739
381 To compile this driver as a module, choose M here: the 381 To compile this driver as a module, choose M here: the
382 module will be called wm8739. 382 module will be called wm8739.
383 383
384config VIDEO_CX2341X
385 tristate "Conexant CX2341x MPEG encoders"
386 depends on VIDEO_V4L2 && EXPERIMENTAL
387 ---help---
388 Support for the Conexant CX23416 MPEG encoders
389 and CX23415 MPEG encoder/decoders.
390
391 This module currently supports the encoding functions only.
392
393 To compile this driver as a module, choose M here: the
394 module will be called cx2341x.
395
384source "drivers/media/video/cx25840/Kconfig" 396source "drivers/media/video/cx25840/Kconfig"
385 397
386config VIDEO_SAA711X 398config VIDEO_SAA711X
diff --git a/drivers/media/video/cx2341x.c b/drivers/media/video/cx2341x.c
index 554813e6f65d..01b22eab5725 100644
--- a/drivers/media/video/cx2341x.c
+++ b/drivers/media/video/cx2341x.c
@@ -43,6 +43,7 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)");
43const u32 cx2341x_mpeg_ctrls[] = { 43const u32 cx2341x_mpeg_ctrls[] = {
44 V4L2_CID_MPEG_CLASS, 44 V4L2_CID_MPEG_CLASS,
45 V4L2_CID_MPEG_STREAM_TYPE, 45 V4L2_CID_MPEG_STREAM_TYPE,
46 V4L2_CID_MPEG_STREAM_VBI_FMT,
46 V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ, 47 V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ,
47 V4L2_CID_MPEG_AUDIO_ENCODING, 48 V4L2_CID_MPEG_AUDIO_ENCODING,
48 V4L2_CID_MPEG_AUDIO_L2_BITRATE, 49 V4L2_CID_MPEG_AUDIO_L2_BITRATE,
@@ -135,6 +136,9 @@ static int cx2341x_get_ctrl(struct cx2341x_mpeg_params *params,
135 case V4L2_CID_MPEG_STREAM_TYPE: 136 case V4L2_CID_MPEG_STREAM_TYPE:
136 ctrl->value = params->stream_type; 137 ctrl->value = params->stream_type;
137 break; 138 break;
139 case V4L2_CID_MPEG_STREAM_VBI_FMT:
140 ctrl->value = params->stream_vbi_fmt;
141 break;
138 case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE: 142 case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE:
139 ctrl->value = params->video_spatial_filter_mode; 143 ctrl->value = params->video_spatial_filter_mode;
140 break; 144 break;
@@ -257,6 +261,9 @@ static int cx2341x_set_ctrl(struct cx2341x_mpeg_params *params,
257 params->video_bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_CBR; 261 params->video_bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_CBR;
258 } 262 }
259 break; 263 break;
264 case V4L2_CID_MPEG_STREAM_VBI_FMT:
265 params->stream_vbi_fmt = ctrl->value;
266 break;
260 case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE: 267 case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE:
261 params->video_spatial_filter_mode = ctrl->value; 268 params->video_spatial_filter_mode = ctrl->value;
262 break; 269 break;
@@ -418,6 +425,14 @@ int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, struct v4l2_queryctrl
418 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; 425 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
419 return err; 426 return err;
420 427
428 case V4L2_CID_MPEG_STREAM_VBI_FMT:
429 if (params->capabilities & CX2341X_CAP_HAS_SLICED_VBI)
430 return v4l2_ctrl_query_fill_std(qctrl);
431 return cx2341x_ctrl_query_fill(qctrl,
432 V4L2_MPEG_STREAM_VBI_FMT_NONE,
433 V4L2_MPEG_STREAM_VBI_FMT_NONE, 1,
434 V4L2_MPEG_STREAM_VBI_FMT_NONE);
435
421 /* CX23415/6 specific */ 436 /* CX23415/6 specific */
422 case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE: 437 case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE:
423 return cx2341x_ctrl_query_fill(qctrl, 438 return cx2341x_ctrl_query_fill(qctrl,
@@ -639,6 +654,7 @@ void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p)
639{ 654{
640 static struct cx2341x_mpeg_params default_params = { 655 static struct cx2341x_mpeg_params default_params = {
641 /* misc */ 656 /* misc */
657 .capabilities = 0,
642 .port = CX2341X_PORT_MEMORY, 658 .port = CX2341X_PORT_MEMORY,
643 .width = 720, 659 .width = 720,
644 .height = 480, 660 .height = 480,
@@ -646,6 +662,7 @@ void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p)
646 662
647 /* stream */ 663 /* stream */
648 .stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS, 664 .stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS,
665 .stream_vbi_fmt = V4L2_MPEG_STREAM_VBI_FMT_NONE,
649 666
650 /* audio */ 667 /* audio */
651 .audio_sampling_freq = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, 668 .audio_sampling_freq = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000,
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig
index 91e1c481a164..80e23ee9801c 100644
--- a/drivers/media/video/cx88/Kconfig
+++ b/drivers/media/video/cx88/Kconfig
@@ -11,7 +11,6 @@ config VIDEO_CX88
11 select VIDEO_BUF 11 select VIDEO_BUF
12 select VIDEO_TUNER 12 select VIDEO_TUNER
13 select VIDEO_TVEEPROM 13 select VIDEO_TVEEPROM
14 select VIDEO_CX2341X
15 select VIDEO_IR 14 select VIDEO_IR
16 ---help--- 15 ---help---
17 This is a video4linux driver for Conexant 2388x based 16 This is a video4linux driver for Conexant 2388x based
@@ -36,13 +35,25 @@ config VIDEO_CX88_ALSA
36 To compile this driver as a module, choose M here: the 35 To compile this driver as a module, choose M here: the
37 module will be called cx88-alsa. 36 module will be called cx88-alsa.
38 37
38config VIDEO_CX88_BLACKBIRD
39 tristate "Blackbird MPEG encoder support (cx2388x + cx23416)"
40 depends on VIDEO_CX88
41 select VIDEO_CX2341X
42 ---help---
43 This adds support for MPEG encoder cards based on the
44 Blackbird reference design, using the Conexant 2388x
45 and 23416 chips.
46
47 To compile this driver as a module, choose M here: the
48 module will be called cx88-blackbird.
49
39config VIDEO_CX88_DVB 50config VIDEO_CX88_DVB
40 tristate "DVB/ATSC Support for cx2388x based TV cards" 51 tristate "DVB/ATSC Support for cx2388x based TV cards"
41 depends on VIDEO_CX88 && DVB_CORE 52 depends on VIDEO_CX88 && DVB_CORE
42 select VIDEO_BUF_DVB 53 select VIDEO_BUF_DVB
43 ---help--- 54 ---help---
44 This adds support for DVB/ATSC cards based on the 55 This adds support for DVB/ATSC cards based on the
45 Connexant 2388x chip. 56 Conexant 2388x chip.
46 57
47 To compile this driver as a module, choose M here: the 58 To compile this driver as a module, choose M here: the
48 module will be called cx88-dvb. 59 module will be called cx88-dvb.
diff --git a/drivers/media/video/cx88/Makefile b/drivers/media/video/cx88/Makefile
index 0dcd09b9b727..352b919f30c4 100644
--- a/drivers/media/video/cx88/Makefile
+++ b/drivers/media/video/cx88/Makefile
@@ -3,9 +3,10 @@ cx88xx-objs := cx88-cards.o cx88-core.o cx88-i2c.o cx88-tvaudio.o \
3cx8800-objs := cx88-video.o cx88-vbi.o 3cx8800-objs := cx88-video.o cx88-vbi.o
4cx8802-objs := cx88-mpeg.o 4cx8802-objs := cx88-mpeg.o
5 5
6obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o cx8802.o cx88-blackbird.o 6obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o cx8802.o
7obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o
8obj-$(CONFIG_VIDEO_CX88_ALSA) += cx88-alsa.o 7obj-$(CONFIG_VIDEO_CX88_ALSA) += cx88-alsa.o
8obj-$(CONFIG_VIDEO_CX88_BLACKBIRD) += cx88-blackbird.o
9obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o
9obj-$(CONFIG_VIDEO_CX88_VP3054) += cx88-vp3054-i2c.o 10obj-$(CONFIG_VIDEO_CX88_VP3054) += cx88-vp3054-i2c.o
10 11
11EXTRA_CFLAGS += -Idrivers/media/video 12EXTRA_CFLAGS += -Idrivers/media/video
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index 67fd3302e8f2..78df66671ea2 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -846,7 +846,7 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file,
846 BLACKBIRD_MPEG_CAPTURE, 846 BLACKBIRD_MPEG_CAPTURE,
847 BLACKBIRD_RAW_BITS_NONE); 847 BLACKBIRD_RAW_BITS_NONE);
848 848
849 cx88_do_ioctl( inode, file, 0, dev->core, cmd, arg, cx88_ioctl_hook ); 849 cx88_do_ioctl(inode, file, 0, dev->core, cmd, arg, mpeg_do_ioctl);
850 850
851 blackbird_initialize_codec(dev); 851 blackbird_initialize_codec(dev);
852 cx88_set_scale(dev->core, dev->width, dev->height, 852 cx88_set_scale(dev->core, dev->width, dev->height,
@@ -855,15 +855,11 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file,
855 } 855 }
856 856
857 default: 857 default:
858 return cx88_do_ioctl( inode, file, 0, dev->core, cmd, arg, cx88_ioctl_hook ); 858 return cx88_do_ioctl(inode, file, 0, dev->core, cmd, arg, mpeg_do_ioctl);
859 } 859 }
860 return 0; 860 return 0;
861} 861}
862 862
863int (*cx88_ioctl_hook)(struct inode *inode, struct file *file,
864 unsigned int cmd, void *arg);
865unsigned int (*cx88_ioctl_translator)(unsigned int cmd);
866
867static unsigned int mpeg_translate_ioctl(unsigned int cmd) 863static unsigned int mpeg_translate_ioctl(unsigned int cmd)
868{ 864{
869 return cmd; 865 return cmd;
@@ -872,8 +868,8 @@ static unsigned int mpeg_translate_ioctl(unsigned int cmd)
872static int mpeg_ioctl(struct inode *inode, struct file *file, 868static int mpeg_ioctl(struct inode *inode, struct file *file,
873 unsigned int cmd, unsigned long arg) 869 unsigned int cmd, unsigned long arg)
874{ 870{
875 cmd = cx88_ioctl_translator( cmd ); 871 cmd = mpeg_translate_ioctl( cmd );
876 return video_usercopy(inode, file, cmd, arg, cx88_ioctl_hook); 872 return video_usercopy(inode, file, cmd, arg, mpeg_do_ioctl);
877} 873}
878 874
879static int mpeg_open(struct inode *inode, struct file *file) 875static int mpeg_open(struct inode *inode, struct file *file)
@@ -1119,8 +1115,6 @@ static int blackbird_init(void)
1119 printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n", 1115 printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n",
1120 SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); 1116 SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100);
1121#endif 1117#endif
1122 cx88_ioctl_hook = mpeg_do_ioctl;
1123 cx88_ioctl_translator = mpeg_translate_ioctl;
1124 return pci_register_driver(&blackbird_pci_driver); 1118 return pci_register_driver(&blackbird_pci_driver);
1125} 1119}
1126 1120
@@ -1132,9 +1126,6 @@ static void blackbird_fini(void)
1132module_init(blackbird_init); 1126module_init(blackbird_init);
1133module_exit(blackbird_fini); 1127module_exit(blackbird_fini);
1134 1128
1135EXPORT_SYMBOL(cx88_ioctl_hook);
1136EXPORT_SYMBOL(cx88_ioctl_translator);
1137
1138/* ----------------------------------------------------------- */ 1129/* ----------------------------------------------------------- */
1139/* 1130/*
1140 * Local variables: 1131 * Local variables:
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 67cdd8270863..f9d68f20dc88 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1700,11 +1700,6 @@ void cx88_card_setup(struct cx88_core *core)
1700/* ------------------------------------------------------------------ */ 1700/* ------------------------------------------------------------------ */
1701 1701
1702EXPORT_SYMBOL(cx88_boards); 1702EXPORT_SYMBOL(cx88_boards);
1703EXPORT_SYMBOL(cx88_bcount);
1704EXPORT_SYMBOL(cx88_subids);
1705EXPORT_SYMBOL(cx88_idcount);
1706EXPORT_SYMBOL(cx88_card_list);
1707EXPORT_SYMBOL(cx88_card_setup);
1708 1703
1709/* 1704/*
1710 * Local variables: 1705 * Local variables:
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index c56292d8d93b..26f4c0fb8c36 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -1181,8 +1181,6 @@ EXPORT_SYMBOL(cx88_set_scale);
1181EXPORT_SYMBOL(cx88_vdev_init); 1181EXPORT_SYMBOL(cx88_vdev_init);
1182EXPORT_SYMBOL(cx88_core_get); 1182EXPORT_SYMBOL(cx88_core_get);
1183EXPORT_SYMBOL(cx88_core_put); 1183EXPORT_SYMBOL(cx88_core_put);
1184EXPORT_SYMBOL(cx88_start_audio_dma);
1185EXPORT_SYMBOL(cx88_stop_audio_dma);
1186 1184
1187/* 1185/*
1188 * Local variables: 1186 * Local variables:
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c
index 7efa6def0bde..70663805cc30 100644
--- a/drivers/media/video/cx88/cx88-i2c.c
+++ b/drivers/media/video/cx88/cx88-i2c.c
@@ -234,7 +234,6 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci)
234/* ----------------------------------------------------------------------- */ 234/* ----------------------------------------------------------------------- */
235 235
236EXPORT_SYMBOL(cx88_call_i2c_clients); 236EXPORT_SYMBOL(cx88_call_i2c_clients);
237EXPORT_SYMBOL(cx88_i2c_init);
238 237
239/* 238/*
240 * Local variables: 239 * Local variables:
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c
index 1e4278b588d8..5785c3481579 100644
--- a/drivers/media/video/cx88/cx88-tvaudio.c
+++ b/drivers/media/video/cx88/cx88-tvaudio.c
@@ -726,7 +726,7 @@ static void set_audio_standard_FM(struct cx88_core *core,
726 726
727/* ----------------------------------------------------------- */ 727/* ----------------------------------------------------------- */
728 728
729int cx88_detect_nicam(struct cx88_core *core) 729static int cx88_detect_nicam(struct cx88_core *core)
730{ 730{
731 int i, j = 0; 731 int i, j = 0;
732 732
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index dc7bc35f18f4..9a9a0fc7a41a 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -563,7 +563,6 @@ void cx88_newstation(struct cx88_core *core);
563void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t); 563void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t);
564void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual); 564void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual);
565int cx88_audio_thread(void *data); 565int cx88_audio_thread(void *data);
566int cx88_detect_nicam(struct cx88_core *core);
567 566
568/* ----------------------------------------------------------- */ 567/* ----------------------------------------------------------- */
569/* cx88-input.c */ 568/* cx88-input.c */
@@ -592,12 +591,6 @@ extern int cx88_do_ioctl(struct inode *inode, struct file *file, int radio,
592 struct cx88_core *core, unsigned int cmd, 591 struct cx88_core *core, unsigned int cmd,
593 void *arg, v4l2_kioctl driver_ioctl); 592 void *arg, v4l2_kioctl driver_ioctl);
594 593
595/* ----------------------------------------------------------- */
596/* cx88-blackbird.c */
597extern int (*cx88_ioctl_hook)(struct inode *inode, struct file *file,
598 unsigned int cmd, void *arg);
599extern unsigned int (*cx88_ioctl_translator)(unsigned int cmd);
600
601/* 594/*
602 * Local variables: 595 * Local variables:
603 * c-basic-offset: 8 596 * c-basic-offset: 8
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index e95792fd70f8..a26ded7d6fae 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -730,14 +730,10 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
730 { 730 {
731 struct v4l2_frequency *f = arg; 731 struct v4l2_frequency *f = arg;
732 732
733 if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY")
734 == EINVAL)
735 return 0;
733 switch_v4l2(); 736 switch_v4l2();
734 if ((V4L2_TUNER_RADIO == f->type && V4L2_TUNER_RADIO != t->mode)
735 || (V4L2_TUNER_DIGITAL_TV == f->type
736 && V4L2_TUNER_DIGITAL_TV != t->mode)) {
737 if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY")
738 == EINVAL)
739 return 0;
740 }
741 set_freq(client,f->frequency); 737 set_freq(client,f->frequency);
742 738
743 break; 739 break;
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index 14e523471354..f4b3d64ebf73 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -1101,6 +1101,11 @@ const char **v4l2_ctrl_get_menu(u32 id)
1101 "MPEG-2 SVCD-compatible Stream", 1101 "MPEG-2 SVCD-compatible Stream",
1102 NULL 1102 NULL
1103 }; 1103 };
1104 static const char *mpeg_stream_vbi_fmt[] = {
1105 "No VBI",
1106 "VBI in private packets, IVTV format",
1107 NULL
1108 };
1104 1109
1105 switch (id) { 1110 switch (id) {
1106 case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ: 1111 case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -1129,6 +1134,8 @@ const char **v4l2_ctrl_get_menu(u32 id)
1129 return mpeg_video_bitrate_mode; 1134 return mpeg_video_bitrate_mode;
1130 case V4L2_CID_MPEG_STREAM_TYPE: 1135 case V4L2_CID_MPEG_STREAM_TYPE:
1131 return mpeg_stream_type; 1136 return mpeg_stream_type;
1137 case V4L2_CID_MPEG_STREAM_VBI_FMT:
1138 return mpeg_stream_vbi_fmt;
1132 default: 1139 default:
1133 return NULL; 1140 return NULL;
1134 } 1141 }
@@ -1182,6 +1189,7 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste
1182 case V4L2_CID_MPEG_STREAM_PID_PCR: name = "Stream PCR Program ID"; break; 1189 case V4L2_CID_MPEG_STREAM_PID_PCR: name = "Stream PCR Program ID"; break;
1183 case V4L2_CID_MPEG_STREAM_PES_ID_AUDIO: name = "Stream PES Audio ID"; break; 1190 case V4L2_CID_MPEG_STREAM_PES_ID_AUDIO: name = "Stream PES Audio ID"; break;
1184 case V4L2_CID_MPEG_STREAM_PES_ID_VIDEO: name = "Stream PES Video ID"; break; 1191 case V4L2_CID_MPEG_STREAM_PES_ID_VIDEO: name = "Stream PES Video ID"; break;
1192 case V4L2_CID_MPEG_STREAM_VBI_FMT: name = "Stream VBI Format"; break;
1185 1193
1186 default: 1194 default:
1187 return -EINVAL; 1195 return -EINVAL;
@@ -1208,6 +1216,7 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste
1208 case V4L2_CID_MPEG_VIDEO_ASPECT: 1216 case V4L2_CID_MPEG_VIDEO_ASPECT:
1209 case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: 1217 case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
1210 case V4L2_CID_MPEG_STREAM_TYPE: 1218 case V4L2_CID_MPEG_STREAM_TYPE:
1219 case V4L2_CID_MPEG_STREAM_VBI_FMT:
1211 qctrl->type = V4L2_CTRL_TYPE_MENU; 1220 qctrl->type = V4L2_CTRL_TYPE_MENU;
1212 step = 1; 1221 step = 1;
1213 break; 1222 break;
@@ -1367,6 +1376,11 @@ int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl)
1367 return v4l2_ctrl_query_fill(qctrl, 0, 255, 1, 0); 1376 return v4l2_ctrl_query_fill(qctrl, 0, 255, 1, 0);
1368 case V4L2_CID_MPEG_STREAM_PES_ID_VIDEO: 1377 case V4L2_CID_MPEG_STREAM_PES_ID_VIDEO:
1369 return v4l2_ctrl_query_fill(qctrl, 0, 255, 1, 0); 1378 return v4l2_ctrl_query_fill(qctrl, 0, 255, 1, 0);
1379 case V4L2_CID_MPEG_STREAM_VBI_FMT:
1380 return v4l2_ctrl_query_fill(qctrl,
1381 V4L2_MPEG_STREAM_VBI_FMT_NONE,
1382 V4L2_MPEG_STREAM_VBI_FMT_IVTV, 1,
1383 V4L2_MPEG_STREAM_VBI_FMT_NONE);
1370 default: 1384 default:
1371 return -EINVAL; 1385 return -EINVAL;
1372 } 1386 }
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 4f428547ec09..a62673dad76e 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -245,6 +245,7 @@ struct v4l2_pix_format
245#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */ 245#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */
246#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */ 246#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */
247#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */ 247#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */
248#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H','M','1','2') /* 8 YUV 4:1:1 16x16 macroblocks */
248 249
249/* see http://www.siliconimaging.com/RGB%20Bayer.htm */ 250/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
250#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */ 251#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */
@@ -821,6 +822,11 @@ enum v4l2_mpeg_stream_type {
821#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4) 822#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4)
822#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5) 823#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5)
823#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6) 824#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6)
825#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7)
826enum v4l2_mpeg_stream_vbi_fmt {
827 V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */
828 V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */
829};
824 830
825/* MPEG audio */ 831/* MPEG audio */
826#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100) 832#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100)
diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h
index 51fb06b4c394..074c4008ad52 100644
--- a/include/media/cx2341x.h
+++ b/include/media/cx2341x.h
@@ -25,8 +25,13 @@ enum cx2341x_port {
25 CX2341X_PORT_SERIAL = 2 25 CX2341X_PORT_SERIAL = 2
26}; 26};
27 27
28enum cx2341x_cap {
29 CX2341X_CAP_HAS_SLICED_VBI = 1 << 0,
30};
31
28struct cx2341x_mpeg_params { 32struct cx2341x_mpeg_params {
29 /* misc */ 33 /* misc */
34 u32 capabilities;
30 enum cx2341x_port port; 35 enum cx2341x_port port;
31 u16 width; 36 u16 width;
32 u16 height; 37 u16 height;
@@ -34,6 +39,7 @@ struct cx2341x_mpeg_params {
34 39
35 /* stream */ 40 /* stream */
36 enum v4l2_mpeg_stream_type stream_type; 41 enum v4l2_mpeg_stream_type stream_type;
42 enum v4l2_mpeg_stream_vbi_fmt stream_vbi_fmt;
37 43
38 /* audio */ 44 /* audio */
39 enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq; 45 enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq;