aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-06-30 18:36:19 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-30 18:36:19 -0400
commit1cfef5ed631dedc55ca3c57a5fcfd01c77db3b59 (patch)
treea2e9e10518c677071ed6c5c5b4df478d548901dd
parent3e8d6ad9bf1f02fdb9fd119c3c266d4b73b7175d (diff)
parent00819f87d883bb4aff97aecc7cc722ba27bd183a (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 (4290): Add support for the TCL M2523_3DB_E tuner. V4L/DVB (4289): Missing statement in drivers/media/dvb/frontends/cx22700.c V4L/DVB (4288): Clean out a zillion sparse warnings in pvrusb2 V4L/DVB (4287): Pvrusb2/: possible cleanups V4L/DVB (4285): Cx88: add support for Geniatech Digistar / Digiwave 103g V4L/DVB (4284): Cx24123: fix set_voltage function according to the specs V4L/DVB (4282): Fix: use swzigzag for swalgo V4L/DVB (4281): TDA9887_SET_CONFIG should only be handled by the tda9887. V4L/DVB (4277): Fix CI interface on PRO KNC1 cards V4L/DVB (4276): Fix CI on old KNC1 DVBC cards V4L/DVB (4275): The FE_SET_FRONTEND_TUNE_MODE ioctl always returns EOPNOTSUPP V4L/DVB (4274): Eliminate use of tda9887 from pvrusb2 driver V4L/DVB (4273): Always log pvrusb2 device register / unregister events V4L/DVB (4272): Fix tveeprom supported standards V4L/DVB (4270): Add tda9887-specific tuner configuration V4L/DVB (4269): Subject: videocodec: make 1-bit fields unsigned V4L/DVB (4267): Remove all instances of request_module("tda9887") V4L/DVB (4264): Cx88-blackbird: implement VIDIOC_QUERYCTRL and VIDIOC_QUERYMENU
-rw-r--r--Documentation/video4linux/CARDLIST.cx881
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c4
-rw-r--r--drivers/media/dvb/frontends/cx22700.c1
-rw-r--r--drivers/media/dvb/frontends/cx24123.c4
-rw-r--r--drivers/media/dvb/ttpci/budget-av.c15
-rw-r--r--drivers/media/video/bt8xx/bttv-cards.c5
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c43
-rw-r--r--drivers/media/video/cx88/cx88-cards.c19
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c28
-rw-r--r--drivers/media/video/cx88/cx88-video.c61
-rw-r--r--drivers/media/video/cx88/cx88.h3
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c2
-rw-r--r--drivers/media/video/msp3400-driver.h4
-rw-r--r--drivers/media/video/pvrusb2/Makefile2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-audio.c4
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-context.c14
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-ctrl.c6
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c6
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-debugifc.c6
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-demod.c126
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-demod.h38
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-eeprom.c4
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-encoder.c4
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h17
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c172
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.h32
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c6
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c4
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-i2c-core.c34
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-i2c-core.h3
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-io.c57
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-io.h13
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-ioread.c34
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-ioread.h1
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-main.c10
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-std.c6
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-sysfs.c14
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-tuner.c2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-v4l2.c42
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-video-v4l.c4
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-wm8775.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c2
-rw-r--r--drivers/media/video/tda9887.c4
-rw-r--r--drivers/media/video/tuner-core.c12
-rw-r--r--drivers/media/video/tuner-simple.c74
-rw-r--r--drivers/media/video/tuner-types.c38
-rw-r--r--drivers/media/video/tveeprom.c18
-rw-r--r--drivers/media/video/videocodec.h16
-rw-r--r--include/media/tuner-types.h55
49 files changed, 524 insertions, 548 deletions
diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88
index 6cb63ddf6163..00d9a1f2a54c 100644
--- a/Documentation/video4linux/CARDLIST.cx88
+++ b/Documentation/video4linux/CARDLIST.cx88
@@ -50,3 +50,4 @@
50 49 -> PixelView PlayTV P7000 [1554:4813] 50 49 -> PixelView PlayTV P7000 [1554:4813]
51 50 -> NPG Tech Real TV FM Top 10 [14f1:0842] 51 50 -> NPG Tech Real TV FM Top 10 [14f1:0842]
52 51 -> WinFast DTV2000 H [107d:665e] 52 51 -> WinFast DTV2000 H [107d:665e]
53 52 -> Geniatech DVB-S [14f1:0084]
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 5e8bb41a088b..59ac35ddd51e 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -570,7 +570,8 @@ static int dvb_frontend_thread(void *data)
570 dvb_frontend_add_event(fe, s); 570 dvb_frontend_add_event(fe, s);
571 fepriv->status = s; 571 fepriv->status = s;
572 } 572 }
573 } 573 } else
574 dvb_frontend_swzigzag(fe);
574 } else 575 } else
575 dvb_frontend_swzigzag(fe); 576 dvb_frontend_swzigzag(fe);
576 } 577 }
@@ -975,6 +976,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
975 976
976 case FE_SET_FRONTEND_TUNE_MODE: 977 case FE_SET_FRONTEND_TUNE_MODE:
977 fepriv->tune_mode_flags = (unsigned long) parg; 978 fepriv->tune_mode_flags = (unsigned long) parg;
979 err = 0;
978 break; 980 break;
979 }; 981 };
980 982
diff --git a/drivers/media/dvb/frontends/cx22700.c b/drivers/media/dvb/frontends/cx22700.c
index 3c7c09a362b2..13ad1bfae663 100644
--- a/drivers/media/dvb/frontends/cx22700.c
+++ b/drivers/media/dvb/frontends/cx22700.c
@@ -134,6 +134,7 @@ static int cx22700_set_tps (struct cx22700_state *state, struct dvb_ofdm_paramet
134 return -EINVAL; 134 return -EINVAL;
135 135
136 if (p->code_rate_LP < FEC_1_2 || p->code_rate_LP > FEC_7_8) 136 if (p->code_rate_LP < FEC_1_2 || p->code_rate_LP > FEC_7_8)
137 return -EINVAL;
137 138
138 if (p->code_rate_HP == FEC_4_5 || p->code_rate_LP == FEC_4_5) 139 if (p->code_rate_HP == FEC_4_5 || p->code_rate_LP == FEC_4_5)
139 return -EINVAL; 140 return -EINVAL;
diff --git a/drivers/media/dvb/frontends/cx24123.c b/drivers/media/dvb/frontends/cx24123.c
index f2f795cba56a..274a87b7a5d5 100644
--- a/drivers/media/dvb/frontends/cx24123.c
+++ b/drivers/media/dvb/frontends/cx24123.c
@@ -670,10 +670,10 @@ static int cx24123_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage
670 switch (voltage) { 670 switch (voltage) {
671 case SEC_VOLTAGE_13: 671 case SEC_VOLTAGE_13:
672 dprintk("%s: setting voltage 13V\n", __FUNCTION__); 672 dprintk("%s: setting voltage 13V\n", __FUNCTION__);
673 return cx24123_writereg(state, 0x29, val | 0x80); 673 return cx24123_writereg(state, 0x29, val & 0x7f);
674 case SEC_VOLTAGE_18: 674 case SEC_VOLTAGE_18:
675 dprintk("%s: setting voltage 18V\n", __FUNCTION__); 675 dprintk("%s: setting voltage 18V\n", __FUNCTION__);
676 return cx24123_writereg(state, 0x29, val & 0x7f); 676 return cx24123_writereg(state, 0x29, val | 0x80);
677 default: 677 default:
678 return -EINVAL; 678 return -EINVAL;
679 }; 679 };
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c
index 6163cb03b8f4..5f111d407730 100644
--- a/drivers/media/dvb/ttpci/budget-av.c
+++ b/drivers/media/dvb/ttpci/budget-av.c
@@ -1141,6 +1141,15 @@ static void frontend_init(struct budget_av *budget_av)
1141 break; 1141 break;
1142 1142
1143 case SUBID_DVBC_KNC1: 1143 case SUBID_DVBC_KNC1:
1144 budget_av->reinitialise_demod = 1;
1145 fe = tda10021_attach(&philips_cu1216_config,
1146 &budget_av->budget.i2c_adap,
1147 read_pwm(budget_av));
1148 if (fe) {
1149 fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set_params;
1150 }
1151 break;
1152
1144 case SUBID_DVBC_KNC1_PLUS: 1153 case SUBID_DVBC_KNC1_PLUS:
1145 case SUBID_DVBC_CINERGY1200: 1154 case SUBID_DVBC_CINERGY1200:
1146 budget_av->reinitialise_demod = 1; 1155 budget_av->reinitialise_demod = 1;
@@ -1293,11 +1302,7 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio
1293 1302
1294 budget_av->budget.dvb_adapter.priv = budget_av; 1303 budget_av->budget.dvb_adapter.priv = budget_av;
1295 frontend_init(budget_av); 1304 frontend_init(budget_av);
1296 1305 ciintf_init(budget_av);
1297 if (!budget_av->has_saa7113) {
1298 ciintf_init(budget_av);
1299 }
1300
1301 return 0; 1306 return 0;
1302} 1307}
1303 1308
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
index e68a6d2fff24..5b4d45654d8e 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -3548,11 +3548,6 @@ void __devinit bttv_init_card2(struct bttv *btv)
3548 /* Hybrid DVB card, DOES have a tda9887 */ 3548 /* Hybrid DVB card, DOES have a tda9887 */
3549 if (btv->c.type == BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE) 3549 if (btv->c.type == BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE)
3550 tda9887 = 1; 3550 tda9887 = 1;
3551 if((btv->tuner_type == TUNER_PHILIPS_FM1216ME_MK3) ||
3552 (btv->tuner_type == TUNER_PHILIPS_FM1236_MK3) ||
3553 (btv->tuner_type == TUNER_PHILIPS_FM1256_IH3) ||
3554 tda9887)
3555 request_module("tda9887");
3556 if (btv->tuner_type != UNSET) 3551 if (btv->tuner_type != UNSET)
3557 request_module("tuner"); 3552 request_module("tuner");
3558} 3553}
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index 4ff81582ec56..349632b48e93 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -686,6 +686,39 @@ static struct videobuf_queue_ops blackbird_qops = {
686 686
687/* ------------------------------------------------------------------ */ 687/* ------------------------------------------------------------------ */
688 688
689static const u32 *ctrl_classes[] = {
690 cx88_user_ctrls,
691 cx2341x_mpeg_ctrls,
692 NULL
693};
694
695static int blackbird_queryctrl(struct cx8802_dev *dev, struct v4l2_queryctrl *qctrl)
696{
697 qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id);
698 if (qctrl->id == 0)
699 return -EINVAL;
700
701 /* Standard V4L2 controls */
702 if (cx8800_ctrl_query(qctrl) == 0)
703 return 0;
704
705 /* MPEG V4L2 controls */
706 if (cx2341x_ctrl_query(&dev->params, qctrl))
707 qctrl->flags |= V4L2_CTRL_FLAG_DISABLED;
708 return 0;
709}
710
711static int blackbird_querymenu(struct cx8802_dev *dev, struct v4l2_querymenu *qmenu)
712{
713 struct v4l2_queryctrl qctrl;
714
715 qctrl.id = qmenu->id;
716 blackbird_queryctrl(dev, &qctrl);
717 return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id));
718}
719
720/* ------------------------------------------------------------------ */
721
689static int mpeg_do_ioctl(struct inode *inode, struct file *file, 722static int mpeg_do_ioctl(struct inode *inode, struct file *file,
690 unsigned int cmd, void *arg) 723 unsigned int cmd, void *arg)
691{ 724{
@@ -866,6 +899,16 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file,
866 core->name); 899 core->name);
867 return 0; 900 return 0;
868 } 901 }
902 case VIDIOC_QUERYMENU:
903 return blackbird_querymenu(dev, arg);
904 case VIDIOC_QUERYCTRL:
905 {
906 struct v4l2_queryctrl *c = arg;
907
908 if (blackbird_queryctrl(dev, c) == 0)
909 return 0;
910 return cx88_do_ioctl(inode, file, 0, dev->core, cmd, arg, mpeg_do_ioctl);
911 }
869 912
870 default: 913 default:
871 return cx88_do_ioctl(inode, file, 0, dev->core, cmd, arg, mpeg_do_ioctl); 914 return cx88_do_ioctl(inode, file, 0, dev->core, cmd, arg, mpeg_do_ioctl);
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index f9d68f20dc88..14bd4863d157 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1194,6 +1194,21 @@ struct cx88_board cx88_boards[] = {
1194 }}, 1194 }},
1195 .dvb = 1, 1195 .dvb = 1,
1196 }, 1196 },
1197 [CX88_BOARD_GENIATECH_DVBS] = {
1198 .name = "Geniatech DVB-S",
1199 .tuner_type = TUNER_ABSENT,
1200 .radio_type = UNSET,
1201 .tuner_addr = ADDR_UNSET,
1202 .radio_addr = ADDR_UNSET,
1203 .input = {{
1204 .type = CX88_VMUX_DVB,
1205 .vmux = 0,
1206 },{
1207 .type = CX88_VMUX_COMPOSITE1,
1208 .vmux = 1,
1209 }},
1210 .dvb = 1,
1211 },
1197}; 1212};
1198const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); 1213const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards);
1199 1214
@@ -1439,6 +1454,10 @@ struct cx88_subid cx88_subids[] = {
1439 .subvendor = 0x18ac, 1454 .subvendor = 0x18ac,
1440 .subdevice = 0xd800, /* FusionHDTV 3 Gold (original revision) */ 1455 .subdevice = 0xd800, /* FusionHDTV 3 Gold (original revision) */
1441 .card = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q, 1456 .card = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q,
1457 },{
1458 .subvendor = 0x14f1,
1459 .subdevice = 0x0084,
1460 .card = CX88_BOARD_GENIATECH_DVBS,
1442 }, 1461 },
1443}; 1462};
1444const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); 1463const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index dce1feddd55d..afde3789d702 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -496,6 +496,26 @@ static int kworld_dvbs_100_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t
496 return 0; 496 return 0;
497} 497}
498 498
499static int geniatech_dvbs_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
500{
501 struct cx8802_dev *dev= fe->dvb->priv;
502 struct cx88_core *core = dev->core;
503
504 if (voltage == SEC_VOLTAGE_OFF) {
505 dprintk(1,"LNB Voltage OFF\n");
506 cx_write(MO_GP0_IO, 0x0000efff);
507 }
508
509 if (core->prev_set_voltage)
510 return core->prev_set_voltage(fe, voltage);
511 return 0;
512}
513
514static struct cx24123_config geniatech_dvbs_config = {
515 .demod_address = 0x55,
516 .set_ts_params = cx24123_set_ts_param,
517};
518
499static struct cx24123_config hauppauge_novas_config = { 519static struct cx24123_config hauppauge_novas_config = {
500 .demod_address = 0x55, 520 .demod_address = 0x55,
501 .set_ts_params = cx24123_set_ts_param, 521 .set_ts_params = cx24123_set_ts_param,
@@ -760,6 +780,14 @@ static int dvb_register(struct cx8802_dev *dev)
760 dev->dvb.frontend->ops.set_voltage = kworld_dvbs_100_set_voltage; 780 dev->dvb.frontend->ops.set_voltage = kworld_dvbs_100_set_voltage;
761 } 781 }
762 break; 782 break;
783 case CX88_BOARD_GENIATECH_DVBS:
784 dev->dvb.frontend = cx24123_attach(&geniatech_dvbs_config,
785 &dev->core->i2c_adap);
786 if (dev->dvb.frontend) {
787 dev->core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage;
788 dev->dvb.frontend->ops.set_voltage = geniatech_dvbs_set_voltage;
789 }
790 break;
763#endif 791#endif
764 default: 792 default:
765 printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n", 793 printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n",
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 8d5cf474b68e..c538d99ec9f6 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -327,6 +327,51 @@ static struct cx88_ctrl cx8800_ctls[] = {
327}; 327};
328static const int CX8800_CTLS = ARRAY_SIZE(cx8800_ctls); 328static const int CX8800_CTLS = ARRAY_SIZE(cx8800_ctls);
329 329
330const u32 cx88_user_ctrls[] = {
331 V4L2_CID_USER_CLASS,
332 V4L2_CID_BRIGHTNESS,
333 V4L2_CID_CONTRAST,
334 V4L2_CID_SATURATION,
335 V4L2_CID_HUE,
336 V4L2_CID_AUDIO_VOLUME,
337 V4L2_CID_AUDIO_BALANCE,
338 V4L2_CID_AUDIO_MUTE,
339 0
340};
341EXPORT_SYMBOL(cx88_user_ctrls);
342
343static const u32 *ctrl_classes[] = {
344 cx88_user_ctrls,
345 NULL
346};
347
348int cx8800_ctrl_query(struct v4l2_queryctrl *qctrl)
349{
350 int i;
351
352 if (qctrl->id < V4L2_CID_BASE ||
353 qctrl->id >= V4L2_CID_LASTP1)
354 return -EINVAL;
355 for (i = 0; i < CX8800_CTLS; i++)
356 if (cx8800_ctls[i].v.id == qctrl->id)
357 break;
358 if (i == CX8800_CTLS) {
359 *qctrl = no_ctl;
360 return 0;
361 }
362 *qctrl = cx8800_ctls[i].v;
363 return 0;
364}
365EXPORT_SYMBOL(cx8800_ctrl_query);
366
367static int cx88_queryctrl(struct v4l2_queryctrl *qctrl)
368{
369 qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id);
370 if (qctrl->id == 0)
371 return -EINVAL;
372 return cx8800_ctrl_query(qctrl);
373}
374
330/* ------------------------------------------------------------------- */ 375/* ------------------------------------------------------------------- */
331/* resource management */ 376/* resource management */
332 377
@@ -1362,20 +1407,8 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio,
1362 case VIDIOC_QUERYCTRL: 1407 case VIDIOC_QUERYCTRL:
1363 { 1408 {
1364 struct v4l2_queryctrl *c = arg; 1409 struct v4l2_queryctrl *c = arg;
1365 int i;
1366 1410
1367 if (c->id < V4L2_CID_BASE || 1411 return cx88_queryctrl(c);
1368 c->id >= V4L2_CID_LASTP1)
1369 return -EINVAL;
1370 for (i = 0; i < CX8800_CTLS; i++)
1371 if (cx8800_ctls[i].v.id == c->id)
1372 break;
1373 if (i == CX8800_CTLS) {
1374 *c = no_ctl;
1375 return 0;
1376 }
1377 *c = cx8800_ctls[i].v;
1378 return 0;
1379 } 1412 }
1380 case VIDIOC_G_CTRL: 1413 case VIDIOC_G_CTRL:
1381 return get_control(core,arg); 1414 return get_control(core,arg);
@@ -1893,8 +1926,6 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
1893 /* load and configure helper modules */ 1926 /* load and configure helper modules */
1894 if (TUNER_ABSENT != core->tuner_type) 1927 if (TUNER_ABSENT != core->tuner_type)
1895 request_module("tuner"); 1928 request_module("tuner");
1896 if (core->tda9887_conf)
1897 request_module("tda9887");
1898 1929
1899 /* register v4l devices */ 1930 /* register v4l devices */
1900 dev->video_dev = cx88_vdev_init(core,dev->pci, 1931 dev->video_dev = cx88_vdev_init(core,dev->pci,
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 9a9a0fc7a41a..e7810955dd4f 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -196,6 +196,7 @@ extern struct sram_channel cx88_sram_channels[];
196#define CX88_BOARD_PIXELVIEW_PLAYTV_P7000 49 196#define CX88_BOARD_PIXELVIEW_PLAYTV_P7000 49
197#define CX88_BOARD_NPGTECH_REALTV_TOP10FM 50 197#define CX88_BOARD_NPGTECH_REALTV_TOP10FM 50
198#define CX88_BOARD_WINFAST_DTV2000H 51 198#define CX88_BOARD_WINFAST_DTV2000H 51
199#define CX88_BOARD_GENIATECH_DVBS 52
199 200
200enum cx88_itype { 201enum cx88_itype {
201 CX88_VMUX_COMPOSITE1 = 1, 202 CX88_VMUX_COMPOSITE1 = 1,
@@ -590,6 +591,8 @@ int cx8802_resume_common(struct pci_dev *pci_dev);
590extern int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, 591extern int cx88_do_ioctl(struct inode *inode, struct file *file, int radio,
591 struct cx88_core *core, unsigned int cmd, 592 struct cx88_core *core, unsigned int cmd,
592 void *arg, v4l2_kioctl driver_ioctl); 593 void *arg, v4l2_kioctl driver_ioctl);
594extern const u32 cx88_user_ctrls[];
595extern int cx8800_ctrl_query(struct v4l2_queryctrl *qctrl);
593 596
594/* 597/*
595 * Local variables: 598 * Local variables:
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 9286090817cd..2a461dde480c 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1574,8 +1574,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
1574 request_module("tvp5150"); 1574 request_module("tvp5150");
1575 if (dev->has_tuner) 1575 if (dev->has_tuner)
1576 request_module("tuner"); 1576 request_module("tuner");
1577 if (dev->tda9887_conf)
1578 request_module("tda9887");
1579#endif 1577#endif
1580 errCode = em28xx_config(dev); 1578 errCode = em28xx_config(dev);
1581 if (errCode) { 1579 if (errCode) {
diff --git a/drivers/media/video/msp3400-driver.h b/drivers/media/video/msp3400-driver.h
index 4e451049013d..545e4ac094f2 100644
--- a/drivers/media/video/msp3400-driver.h
+++ b/drivers/media/video/msp3400-driver.h
@@ -90,8 +90,8 @@ struct msp_state {
90 /* thread */ 90 /* thread */
91 struct task_struct *kthread; 91 struct task_struct *kthread;
92 wait_queue_head_t wq; 92 wait_queue_head_t wq;
93 int restart:1; 93 unsigned int restart:1;
94 int watch_stereo:1; 94 unsigned int watch_stereo:1;
95}; 95};
96 96
97/* msp3400-driver.c */ 97/* msp3400-driver.c */
diff --git a/drivers/media/video/pvrusb2/Makefile b/drivers/media/video/pvrusb2/Makefile
index fed603ad0a67..02e414210dac 100644
--- a/drivers/media/video/pvrusb2/Makefile
+++ b/drivers/media/video/pvrusb2/Makefile
@@ -8,7 +8,7 @@ obj-pvrusb2-24xxx-$(CONFIG_VIDEO_PVRUSB2_24XXX) := \
8pvrusb2-objs := pvrusb2-i2c-core.o pvrusb2-i2c-cmd-v4l2.o \ 8pvrusb2-objs := pvrusb2-i2c-core.o pvrusb2-i2c-cmd-v4l2.o \
9 pvrusb2-audio.o pvrusb2-i2c-chips-v4l2.o \ 9 pvrusb2-audio.o pvrusb2-i2c-chips-v4l2.o \
10 pvrusb2-encoder.o pvrusb2-video-v4l.o \ 10 pvrusb2-encoder.o pvrusb2-video-v4l.o \
11 pvrusb2-eeprom.o pvrusb2-tuner.o pvrusb2-demod.o \ 11 pvrusb2-eeprom.o pvrusb2-tuner.o \
12 pvrusb2-main.o pvrusb2-hdw.o pvrusb2-v4l2.o \ 12 pvrusb2-main.o pvrusb2-hdw.o pvrusb2-v4l2.o \
13 pvrusb2-ctrl.o pvrusb2-std.o \ 13 pvrusb2-ctrl.o pvrusb2-std.o \
14 pvrusb2-context.o pvrusb2-io.o pvrusb2-ioread.o \ 14 pvrusb2-context.o pvrusb2-io.o pvrusb2-ioread.o \
diff --git a/drivers/media/video/pvrusb2/pvrusb2-audio.c b/drivers/media/video/pvrusb2/pvrusb2-audio.c
index 313d2dcf9e4b..9846c464ec80 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-audio.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-audio.c
@@ -145,8 +145,8 @@ static int get_audio_status(struct pvr2_msp3400_handler *ctxt)
145 145
146static void pvr2_msp3400_detach(struct pvr2_msp3400_handler *ctxt) 146static void pvr2_msp3400_detach(struct pvr2_msp3400_handler *ctxt)
147{ 147{
148 ctxt->client->handler = 0; 148 ctxt->client->handler = NULL;
149 ctxt->hdw->audio_stat = 0; 149 ctxt->hdw->audio_stat = NULL;
150 kfree(ctxt); 150 kfree(ctxt);
151} 151}
152 152
diff --git a/drivers/media/video/pvrusb2/pvrusb2-context.c b/drivers/media/video/pvrusb2/pvrusb2-context.c
index 40dc59871a45..f129f316d20e 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-context.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-context.c
@@ -77,7 +77,7 @@ struct pvr2_context *pvr2_context_create(
77 const struct usb_device_id *devid, 77 const struct usb_device_id *devid,
78 void (*setup_func)(struct pvr2_context *)) 78 void (*setup_func)(struct pvr2_context *))
79{ 79{
80 struct pvr2_context *mp = 0; 80 struct pvr2_context *mp = NULL;
81 mp = kmalloc(sizeof(*mp),GFP_KERNEL); 81 mp = kmalloc(sizeof(*mp),GFP_KERNEL);
82 if (!mp) goto done; 82 if (!mp) goto done;
83 memset(mp,0,sizeof(*mp)); 83 memset(mp,0,sizeof(*mp));
@@ -87,7 +87,7 @@ struct pvr2_context *pvr2_context_create(
87 mp->hdw = pvr2_hdw_create(intf,devid); 87 mp->hdw = pvr2_hdw_create(intf,devid);
88 if (!mp->hdw) { 88 if (!mp->hdw) {
89 pvr2_context_destroy(mp); 89 pvr2_context_destroy(mp);
90 mp = 0; 90 mp = NULL;
91 goto done; 91 goto done;
92 } 92 }
93 93
@@ -145,7 +145,7 @@ void pvr2_channel_init(struct pvr2_channel *cp,struct pvr2_context *mp)
145{ 145{
146 cp->hdw = mp->hdw; 146 cp->hdw = mp->hdw;
147 cp->mc_head = mp; 147 cp->mc_head = mp;
148 cp->mc_next = 0; 148 cp->mc_next = NULL;
149 cp->mc_prev = mp->mc_last; 149 cp->mc_prev = mp->mc_last;
150 if (mp->mc_last) { 150 if (mp->mc_last) {
151 mp->mc_last->mc_next = cp; 151 mp->mc_last->mc_next = cp;
@@ -160,8 +160,8 @@ static void pvr2_channel_disclaim_stream(struct pvr2_channel *cp)
160{ 160{
161 if (!cp->stream) return; 161 if (!cp->stream) return;
162 pvr2_stream_kill(cp->stream->stream); 162 pvr2_stream_kill(cp->stream->stream);
163 cp->stream->user = 0; 163 cp->stream->user = NULL;
164 cp->stream = 0; 164 cp->stream = NULL;
165} 165}
166 166
167 167
@@ -179,7 +179,7 @@ void pvr2_channel_done(struct pvr2_channel *cp)
179 } else { 179 } else {
180 mp->mc_first = cp->mc_next; 180 mp->mc_first = cp->mc_next;
181 } 181 }
182 cp->hdw = 0; 182 cp->hdw = NULL;
183} 183}
184 184
185 185
@@ -212,7 +212,7 @@ struct pvr2_ioread *pvr2_channel_create_mpeg_stream(
212{ 212{
213 struct pvr2_ioread *cp; 213 struct pvr2_ioread *cp;
214 cp = pvr2_ioread_create(); 214 cp = pvr2_ioread_create();
215 if (!cp) return 0; 215 if (!cp) return NULL;
216 pvr2_ioread_setup(cp,sp->stream); 216 pvr2_ioread_setup(cp,sp->stream);
217 pvr2_ioread_set_sync_key(cp,stream_sync_key,sizeof(stream_sync_key)); 217 pvr2_ioread_set_sync_key(cp,stream_sync_key,sizeof(stream_sync_key));
218 return cp; 218 return cp;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
index d5df9fbeba2f..fb6198f1df98 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
@@ -158,7 +158,7 @@ int pvr2_ctrl_get_mask(struct pvr2_ctrl *cptr)
158/* Retrieve the control's name */ 158/* Retrieve the control's name */
159const char *pvr2_ctrl_get_name(struct pvr2_ctrl *cptr) 159const char *pvr2_ctrl_get_name(struct pvr2_ctrl *cptr)
160{ 160{
161 if (!cptr) return 0; 161 if (!cptr) return NULL;
162 return cptr->info->name; 162 return cptr->info->name;
163} 163}
164 164
@@ -166,7 +166,7 @@ const char *pvr2_ctrl_get_name(struct pvr2_ctrl *cptr)
166/* Retrieve the control's desc */ 166/* Retrieve the control's desc */
167const char *pvr2_ctrl_get_desc(struct pvr2_ctrl *cptr) 167const char *pvr2_ctrl_get_desc(struct pvr2_ctrl *cptr)
168{ 168{
169 if (!cptr) return 0; 169 if (!cptr) return NULL;
170 return cptr->info->desc; 170 return cptr->info->desc;
171} 171}
172 172
@@ -488,7 +488,7 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr,
488 488
489 LOCK_TAKE(cptr->hdw->big_lock); do { 489 LOCK_TAKE(cptr->hdw->big_lock); do {
490 if (cptr->info->type == pvr2_ctl_int) { 490 if (cptr->info->type == pvr2_ctl_int) {
491 ret = parse_token(ptr,len,valptr,0,0); 491 ret = parse_token(ptr,len,valptr,NULL,0);
492 if ((ret >= 0) && 492 if ((ret >= 0) &&
493 ((*valptr < cptr->info->def.type_int.min_value) || 493 ((*valptr < cptr->info->def.type_int.min_value) ||
494 (*valptr > cptr->info->def.type_int.max_value))) { 494 (*valptr > cptr->info->def.type_int.max_value))) {
diff --git a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
index 27eadaff75a0..c80c26be6e4d 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
@@ -139,8 +139,8 @@ static const struct pvr2_v4l_cx2584x_ops decoder_ops[] = {
139 139
140static void decoder_detach(struct pvr2_v4l_cx2584x *ctxt) 140static void decoder_detach(struct pvr2_v4l_cx2584x *ctxt)
141{ 141{
142 ctxt->client->handler = 0; 142 ctxt->client->handler = NULL;
143 ctxt->hdw->decoder_ctrl = 0; 143 ctxt->hdw->decoder_ctrl = NULL;
144 kfree(ctxt); 144 kfree(ctxt);
145} 145}
146 146
@@ -221,7 +221,7 @@ static unsigned int decoder_describe(struct pvr2_v4l_cx2584x *ctxt,
221static void decoder_reset(struct pvr2_v4l_cx2584x *ctxt) 221static void decoder_reset(struct pvr2_v4l_cx2584x *ctxt)
222{ 222{
223 int ret; 223 int ret;
224 ret = pvr2_i2c_client_cmd(ctxt->client,VIDIOC_INT_RESET,0); 224 ret = pvr2_i2c_client_cmd(ctxt->client,VIDIOC_INT_RESET,NULL);
225 pvr2_trace(PVR2_TRACE_CHIPS,"i2c cx25840 decoder_reset (ret=%d)",ret); 225 pvr2_trace(PVR2_TRACE_CHIPS,"i2c cx25840 decoder_reset (ret=%d)",ret);
226} 226}
227 227
diff --git a/drivers/media/video/pvrusb2/pvrusb2-debugifc.c b/drivers/media/video/pvrusb2/pvrusb2-debugifc.c
index 586900e365ff..f985f00d885a 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-debugifc.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-debugifc.c
@@ -82,7 +82,7 @@ static unsigned int debugifc_isolate_word(const char *buf,unsigned int count,
82 unsigned int wlen; 82 unsigned int wlen;
83 unsigned int scnt; 83 unsigned int scnt;
84 84
85 wptr = 0; 85 wptr = NULL;
86 wlen = 0; 86 wlen = 0;
87 scnt = debugifc_count_whitespace(buf,count); 87 scnt = debugifc_count_whitespace(buf,count);
88 consume_cnt += scnt; count -= scnt; buf += scnt; 88 consume_cnt += scnt; count -= scnt; buf += scnt;
@@ -337,8 +337,8 @@ int pvr2_debugifc_print_status(struct pvr2_hdw *hdw,
337} 337}
338 338
339 339
340int pvr2_debugifc_do1cmd(struct pvr2_hdw *hdw,const char *buf, 340static int pvr2_debugifc_do1cmd(struct pvr2_hdw *hdw,const char *buf,
341 unsigned int count) 341 unsigned int count)
342{ 342{
343 const char *wptr; 343 const char *wptr;
344 unsigned int wlen; 344 unsigned int wlen;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-demod.c b/drivers/media/video/pvrusb2/pvrusb2-demod.c
deleted file mode 100644
index 9686569a11f6..000000000000
--- a/drivers/media/video/pvrusb2/pvrusb2-demod.c
+++ /dev/null
@@ -1,126 +0,0 @@
1/*
2 *
3 * $Id$
4 *
5 * Copyright (C) 2005 Mike Isely <isely@pobox.com>
6 * Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#include "pvrusb2.h"
24#include "pvrusb2-util.h"
25#include "pvrusb2-demod.h"
26#include "pvrusb2-hdw-internal.h"
27#include "pvrusb2-debug.h"
28#include <linux/videodev2.h>
29#include <media/tuner.h>
30#include <media/v4l2-common.h>
31
32
33struct pvr2_demod_handler {
34 struct pvr2_hdw *hdw;
35 struct pvr2_i2c_client *client;
36 struct pvr2_i2c_handler i2c_handler;
37 int type_update_fl;
38};
39
40
41static void set_config(struct pvr2_demod_handler *ctxt)
42{
43 struct pvr2_hdw *hdw = ctxt->hdw;
44 int cfg = 0;
45
46 switch (hdw->tuner_type) {
47 case TUNER_PHILIPS_FM1216ME_MK3:
48 case TUNER_PHILIPS_FM1236_MK3:
49 cfg = TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE;
50 break;
51 default:
52 break;
53 }
54 pvr2_trace(PVR2_TRACE_CHIPS,"i2c demod set_config(0x%x)",cfg);
55 pvr2_i2c_client_cmd(ctxt->client,TDA9887_SET_CONFIG,&cfg);
56 ctxt->type_update_fl = 0;
57}
58
59
60static int demod_check(struct pvr2_demod_handler *ctxt)
61{
62 struct pvr2_hdw *hdw = ctxt->hdw;
63 if (hdw->tuner_updated) ctxt->type_update_fl = !0;
64 return ctxt->type_update_fl != 0;
65}
66
67
68static void demod_update(struct pvr2_demod_handler *ctxt)
69{
70 if (ctxt->type_update_fl) set_config(ctxt);
71}
72
73
74static void demod_detach(struct pvr2_demod_handler *ctxt)
75{
76 ctxt->client->handler = 0;
77 kfree(ctxt);
78}
79
80
81static unsigned int demod_describe(struct pvr2_demod_handler *ctxt,char *buf,unsigned int cnt)
82{
83 return scnprintf(buf,cnt,"handler: pvrusb2-demod");
84}
85
86
87const static struct pvr2_i2c_handler_functions tuner_funcs = {
88 .detach = (void (*)(void *))demod_detach,
89 .check = (int (*)(void *))demod_check,
90 .update = (void (*)(void *))demod_update,
91 .describe = (unsigned int (*)(void *,char *,unsigned int))demod_describe,
92};
93
94
95int pvr2_i2c_demod_setup(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp)
96{
97 struct pvr2_demod_handler *ctxt;
98 if (cp->handler) return 0;
99
100 ctxt = kmalloc(sizeof(*ctxt),GFP_KERNEL);
101 if (!ctxt) return 0;
102 memset(ctxt,0,sizeof(*ctxt));
103
104 ctxt->i2c_handler.func_data = ctxt;
105 ctxt->i2c_handler.func_table = &tuner_funcs;
106 ctxt->type_update_fl = !0;
107 ctxt->client = cp;
108 ctxt->hdw = hdw;
109 cp->handler = &ctxt->i2c_handler;
110 pvr2_trace(PVR2_TRACE_CHIPS,"i2c 0x%x tda9887 V4L2 handler set up",
111 cp->client->addr);
112 return !0;
113}
114
115
116
117
118/*
119 Stuff for Emacs to see, in order to encourage consistent editing style:
120 *** Local Variables: ***
121 *** mode: c ***
122 *** fill-column: 70 ***
123 *** tab-width: 8 ***
124 *** c-basic-offset: 8 ***
125 *** End: ***
126 */
diff --git a/drivers/media/video/pvrusb2/pvrusb2-demod.h b/drivers/media/video/pvrusb2/pvrusb2-demod.h
deleted file mode 100644
index 4c4e40ffbf03..000000000000
--- a/drivers/media/video/pvrusb2/pvrusb2-demod.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 *
3 * $Id$
4 *
5 * Copyright (C) 2005 Mike Isely <isely@pobox.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21#ifndef __PVRUSB2_DEMOD_H
22#define __PVRUSB2_DEMOD_H
23
24#include "pvrusb2-i2c-core.h"
25
26int pvr2_i2c_demod_setup(struct pvr2_hdw *,struct pvr2_i2c_client *);
27
28#endif /* __PVRUSB2_DEMOD_H */
29
30/*
31 Stuff for Emacs to see, in order to encourage consistent editing style:
32 *** Local Variables: ***
33 *** mode: c ***
34 *** fill-column: 70 ***
35 *** tab-width: 8 ***
36 *** c-basic-offset: 8 ***
37 *** End: ***
38 */
diff --git a/drivers/media/video/pvrusb2/pvrusb2-eeprom.c b/drivers/media/video/pvrusb2/pvrusb2-eeprom.c
index 94d383ff9889..6cff8e75f426 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-eeprom.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-eeprom.c
@@ -58,7 +58,7 @@ static u8 *pvr2_eeprom_fetch(struct pvr2_hdw *hdw)
58 pvr2_trace(PVR2_TRACE_ERROR_LEGS, 58 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
59 "Failed to allocate memory" 59 "Failed to allocate memory"
60 " required to read eeprom"); 60 " required to read eeprom");
61 return 0; 61 return NULL;
62 } 62 }
63 63
64 trace_eeprom("Value for eeprom addr from controller was 0x%x", 64 trace_eeprom("Value for eeprom addr from controller was 0x%x",
@@ -108,7 +108,7 @@ static u8 *pvr2_eeprom_fetch(struct pvr2_hdw *hdw)
108 pvr2_trace(PVR2_TRACE_ERROR_LEGS, 108 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
109 "eeprom fetch set offs err=%d",ret); 109 "eeprom fetch set offs err=%d",ret);
110 kfree(eeprom); 110 kfree(eeprom);
111 return 0; 111 return NULL;
112 } 112 }
113 } 113 }
114 return eeprom; 114 return eeprom;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-encoder.c b/drivers/media/video/pvrusb2/pvrusb2-encoder.c
index 2cc31695b435..18a7073501c6 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-encoder.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-encoder.c
@@ -65,7 +65,7 @@ static int pvr2_encoder_write_words(struct pvr2_hdw *hdw,
65 } 65 }
66 ret = pvr2_send_request(hdw, 66 ret = pvr2_send_request(hdw,
67 hdw->cmd_buffer,1+(chunkCnt*7), 67 hdw->cmd_buffer,1+(chunkCnt*7),
68 0,0); 68 NULL,0);
69 if (ret) return ret; 69 if (ret) return ret;
70 data += chunkCnt; 70 data += chunkCnt;
71 dlen -= chunkCnt; 71 dlen -= chunkCnt;
@@ -322,7 +322,7 @@ int pvr2_encoder_configure(struct pvr2_hdw *hdw)
322 } 322 }
323 323
324 ret = cx2341x_update(hdw,pvr2_encoder_cmd, 324 ret = cx2341x_update(hdw,pvr2_encoder_cmd,
325 (hdw->enc_cur_valid ? &hdw->enc_cur_state : 0), 325 (hdw->enc_cur_valid ? &hdw->enc_cur_state : NULL),
326 &hdw->enc_ctl_state); 326 &hdw->enc_ctl_state);
327 if (ret) { 327 if (ret) {
328 pvr2_trace(PVR2_TRACE_ERROR_LEGS, 328 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
index ba2afbfe32c5..0d6dc33ca320 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
@@ -354,23 +354,6 @@ struct pvr2_hdw {
354 unsigned int control_cnt; 354 unsigned int control_cnt;
355}; 355};
356 356
357int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw);
358
359unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *);
360
361void pvr2_hdw_subsys_bit_chg_no_lock(struct pvr2_hdw *hdw,
362 unsigned long msk,unsigned long val);
363void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw,
364 unsigned long msk,
365 unsigned long val);
366
367void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw);
368void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw);
369
370int pvr2_i2c_basic_op(struct pvr2_hdw *,u8 i2c_addr,
371 u8 *wdata,u16 wlen,
372 u8 *rdata,u16 rlen);
373
374#endif /* __PVRUSB2_HDW_INTERNAL_H */ 357#endif /* __PVRUSB2_HDW_INTERNAL_H */
375 358
376/* 359/*
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 643c471375da..9b48abcf6089 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -63,7 +63,6 @@ struct pvr2_string_table {
63static const char *pvr2_client_24xxx[] = { 63static const char *pvr2_client_24xxx[] = {
64 "cx25840", 64 "cx25840",
65 "tuner", 65 "tuner",
66 "tda9887",
67 "wm8775", 66 "wm8775",
68}; 67};
69#endif 68#endif
@@ -73,7 +72,6 @@ static const char *pvr2_client_29xxx[] = {
73 "msp3400", 72 "msp3400",
74 "saa7115", 73 "saa7115",
75 "tuner", 74 "tuner",
76 "tda9887",
77}; 75};
78 76
79static struct pvr2_string_table pvr2_client_lists[] = { 77static struct pvr2_string_table pvr2_client_lists[] = {
@@ -89,8 +87,8 @@ static struct pvr2_string_table pvr2_client_lists[] = {
89#endif 87#endif
90}; 88};
91 89
92static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = 0}; 90static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL};
93DECLARE_MUTEX(pvr2_unit_sem); 91static DECLARE_MUTEX(pvr2_unit_sem);
94 92
95static int ctlchg = 0; 93static int ctlchg = 0;
96static int initusbreset = 1; 94static int initusbreset = 1;
@@ -263,6 +261,25 @@ static const char *control_values_subsystem[] = {
263 [PVR2_SUBSYS_B_ENC_RUN] = "enc_run", 261 [PVR2_SUBSYS_B_ENC_RUN] = "enc_run",
264}; 262};
265 263
264static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl);
265static int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw);
266static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw);
267static unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *hdw);
268static void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw);
269static void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw);
270static void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *hdw);
271static void pvr2_hdw_subsys_bit_chg_no_lock(struct pvr2_hdw *hdw,
272 unsigned long msk,
273 unsigned long val);
274static void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw,
275 unsigned long msk,
276 unsigned long val);
277static int pvr2_send_request_ex(struct pvr2_hdw *hdw,
278 unsigned int timeout,int probe_fl,
279 void *write_data,unsigned int write_len,
280 void *read_data,unsigned int read_len);
281static int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res);
282static int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res);
266 283
267static int ctrl_channelfreq_get(struct pvr2_ctrl *cptr,int *vp) 284static int ctrl_channelfreq_get(struct pvr2_ctrl *cptr,int *vp)
268{ 285{
@@ -405,7 +422,7 @@ static unsigned int ctrl_cx2341x_getv4lflags(struct pvr2_ctrl *cptr)
405 info = (struct pvr2_ctl_info *)(cptr->info); 422 info = (struct pvr2_ctl_info *)(cptr->info);
406 if (qctrl.flags & V4L2_CTRL_FLAG_READ_ONLY) { 423 if (qctrl.flags & V4L2_CTRL_FLAG_READ_ONLY) {
407 if (info->set_value) { 424 if (info->set_value) {
408 info->set_value = 0; 425 info->set_value = NULL;
409 } 426 }
410 } else { 427 } else {
411 if (!(info->set_value)) { 428 if (!(info->set_value)) {
@@ -836,14 +853,6 @@ unsigned long pvr2_hdw_get_sn(struct pvr2_hdw *hdw)
836} 853}
837 854
838 855
839struct pvr2_hdw *pvr2_hdw_find(int unit_number)
840{
841 if (unit_number < 0) return 0;
842 if (unit_number >= PVR_NUM) return 0;
843 return unit_pointers[unit_number];
844}
845
846
847int pvr2_hdw_get_unit_number(struct pvr2_hdw *hdw) 856int pvr2_hdw_get_unit_number(struct pvr2_hdw *hdw)
848{ 857{
849 return hdw->unit_number; 858 return hdw->unit_number;
@@ -917,9 +926,9 @@ static int pvr2_locate_firmware(struct pvr2_hdw *hdw,
917 * is not suitable for an usb transaction. 926 * is not suitable for an usb transaction.
918 * 927 *
919 */ 928 */
920int pvr2_upload_firmware1(struct pvr2_hdw *hdw) 929static int pvr2_upload_firmware1(struct pvr2_hdw *hdw)
921{ 930{
922 const struct firmware *fw_entry = 0; 931 const struct firmware *fw_entry = NULL;
923 void *fw_ptr; 932 void *fw_ptr;
924 unsigned int pipe; 933 unsigned int pipe;
925 int ret; 934 int ret;
@@ -1015,7 +1024,7 @@ int pvr2_upload_firmware1(struct pvr2_hdw *hdw)
1015 1024
1016int pvr2_upload_firmware2(struct pvr2_hdw *hdw) 1025int pvr2_upload_firmware2(struct pvr2_hdw *hdw)
1017{ 1026{
1018 const struct firmware *fw_entry = 0; 1027 const struct firmware *fw_entry = NULL;
1019 void *fw_ptr; 1028 void *fw_ptr;
1020 unsigned int pipe, fw_len, fw_done; 1029 unsigned int pipe, fw_len, fw_done;
1021 int actual_length; 1030 int actual_length;
@@ -1166,8 +1175,9 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw)
1166 reconfigure and start over. 1175 reconfigure and start over.
1167 1176
1168*/ 1177*/
1169void pvr2_hdw_subsys_bit_chg_no_lock(struct pvr2_hdw *hdw, 1178static void pvr2_hdw_subsys_bit_chg_no_lock(struct pvr2_hdw *hdw,
1170 unsigned long msk,unsigned long val) 1179 unsigned long msk,
1180 unsigned long val)
1171{ 1181{
1172 unsigned long nmsk; 1182 unsigned long nmsk;
1173 unsigned long vmsk; 1183 unsigned long vmsk;
@@ -1318,18 +1328,6 @@ void pvr2_hdw_subsys_bit_chg(struct pvr2_hdw *hdw,
1318} 1328}
1319 1329
1320 1330
1321void pvr2_hdw_subsys_bit_set(struct pvr2_hdw *hdw,unsigned long msk)
1322{
1323 pvr2_hdw_subsys_bit_chg(hdw,msk,msk);
1324}
1325
1326
1327void pvr2_hdw_subsys_bit_clr(struct pvr2_hdw *hdw,unsigned long msk)
1328{
1329 pvr2_hdw_subsys_bit_chg(hdw,msk,0);
1330}
1331
1332
1333unsigned long pvr2_hdw_subsys_get(struct pvr2_hdw *hdw) 1331unsigned long pvr2_hdw_subsys_get(struct pvr2_hdw *hdw)
1334{ 1332{
1335 return hdw->subsys_enabled_mask; 1333 return hdw->subsys_enabled_mask;
@@ -1342,9 +1340,9 @@ unsigned long pvr2_hdw_subsys_stream_get(struct pvr2_hdw *hdw)
1342} 1340}
1343 1341
1344 1342
1345void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw, 1343static void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw,
1346 unsigned long msk, 1344 unsigned long msk,
1347 unsigned long val) 1345 unsigned long val)
1348{ 1346{
1349 unsigned long val2; 1347 unsigned long val2;
1350 msk &= PVR2_SUBSYS_ALL; 1348 msk &= PVR2_SUBSYS_ALL;
@@ -1366,7 +1364,7 @@ void pvr2_hdw_subsys_stream_bit_chg(struct pvr2_hdw *hdw,
1366} 1364}
1367 1365
1368 1366
1369int pvr2_hdw_set_streaming_no_lock(struct pvr2_hdw *hdw,int enableFl) 1367static int pvr2_hdw_set_streaming_no_lock(struct pvr2_hdw *hdw,int enableFl)
1370{ 1368{
1371 if ((!enableFl) == !(hdw->flag_streaming_enabled)) return 0; 1369 if ((!enableFl) == !(hdw->flag_streaming_enabled)) return 0;
1372 if (enableFl) { 1370 if (enableFl) {
@@ -1400,8 +1398,8 @@ int pvr2_hdw_set_streaming(struct pvr2_hdw *hdw,int enable_flag)
1400} 1398}
1401 1399
1402 1400
1403int pvr2_hdw_set_stream_type_no_lock(struct pvr2_hdw *hdw, 1401static int pvr2_hdw_set_stream_type_no_lock(struct pvr2_hdw *hdw,
1404 enum pvr2_config config) 1402 enum pvr2_config config)
1405{ 1403{
1406 unsigned long sm = hdw->subsys_enabled_mask; 1404 unsigned long sm = hdw->subsys_enabled_mask;
1407 if (!hdw->flag_ok) return -EIO; 1405 if (!hdw->flag_ok) return -EIO;
@@ -1741,7 +1739,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
1741 sizeof(pvr2_device_names)/sizeof(pvr2_device_names[0])) { 1739 sizeof(pvr2_device_names)/sizeof(pvr2_device_names[0])) {
1742 pvr2_trace(PVR2_TRACE_ERROR_LEGS, 1740 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
1743 "Bogus device type of %u reported",hdw_type); 1741 "Bogus device type of %u reported",hdw_type);
1744 return 0; 1742 return NULL;
1745 } 1743 }
1746 1744
1747 hdw = kmalloc(sizeof(*hdw),GFP_KERNEL); 1745 hdw = kmalloc(sizeof(*hdw),GFP_KERNEL);
@@ -1922,38 +1920,38 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
1922 if (hdw->mpeg_ctrl_info) kfree(hdw->mpeg_ctrl_info); 1920 if (hdw->mpeg_ctrl_info) kfree(hdw->mpeg_ctrl_info);
1923 kfree(hdw); 1921 kfree(hdw);
1924 } 1922 }
1925 return 0; 1923 return NULL;
1926} 1924}
1927 1925
1928 1926
1929/* Remove _all_ associations between this driver and the underlying USB 1927/* Remove _all_ associations between this driver and the underlying USB
1930 layer. */ 1928 layer. */
1931void pvr2_hdw_remove_usb_stuff(struct pvr2_hdw *hdw) 1929static void pvr2_hdw_remove_usb_stuff(struct pvr2_hdw *hdw)
1932{ 1930{
1933 if (hdw->flag_disconnected) return; 1931 if (hdw->flag_disconnected) return;
1934 pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_remove_usb_stuff: hdw=%p",hdw); 1932 pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_remove_usb_stuff: hdw=%p",hdw);
1935 if (hdw->ctl_read_urb) { 1933 if (hdw->ctl_read_urb) {
1936 usb_kill_urb(hdw->ctl_read_urb); 1934 usb_kill_urb(hdw->ctl_read_urb);
1937 usb_free_urb(hdw->ctl_read_urb); 1935 usb_free_urb(hdw->ctl_read_urb);
1938 hdw->ctl_read_urb = 0; 1936 hdw->ctl_read_urb = NULL;
1939 } 1937 }
1940 if (hdw->ctl_write_urb) { 1938 if (hdw->ctl_write_urb) {
1941 usb_kill_urb(hdw->ctl_write_urb); 1939 usb_kill_urb(hdw->ctl_write_urb);
1942 usb_free_urb(hdw->ctl_write_urb); 1940 usb_free_urb(hdw->ctl_write_urb);
1943 hdw->ctl_write_urb = 0; 1941 hdw->ctl_write_urb = NULL;
1944 } 1942 }
1945 if (hdw->ctl_read_buffer) { 1943 if (hdw->ctl_read_buffer) {
1946 kfree(hdw->ctl_read_buffer); 1944 kfree(hdw->ctl_read_buffer);
1947 hdw->ctl_read_buffer = 0; 1945 hdw->ctl_read_buffer = NULL;
1948 } 1946 }
1949 if (hdw->ctl_write_buffer) { 1947 if (hdw->ctl_write_buffer) {
1950 kfree(hdw->ctl_write_buffer); 1948 kfree(hdw->ctl_write_buffer);
1951 hdw->ctl_write_buffer = 0; 1949 hdw->ctl_write_buffer = NULL;
1952 } 1950 }
1953 pvr2_hdw_render_useless_unlocked(hdw); 1951 pvr2_hdw_render_useless_unlocked(hdw);
1954 hdw->flag_disconnected = !0; 1952 hdw->flag_disconnected = !0;
1955 hdw->usb_dev = 0; 1953 hdw->usb_dev = NULL;
1956 hdw->usb_intf = 0; 1954 hdw->usb_intf = NULL;
1957} 1955}
1958 1956
1959 1957
@@ -1963,11 +1961,11 @@ void pvr2_hdw_destroy(struct pvr2_hdw *hdw)
1963 pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_destroy: hdw=%p",hdw); 1961 pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_destroy: hdw=%p",hdw);
1964 if (hdw->fw_buffer) { 1962 if (hdw->fw_buffer) {
1965 kfree(hdw->fw_buffer); 1963 kfree(hdw->fw_buffer);
1966 hdw->fw_buffer = 0; 1964 hdw->fw_buffer = NULL;
1967 } 1965 }
1968 if (hdw->vid_stream) { 1966 if (hdw->vid_stream) {
1969 pvr2_stream_destroy(hdw->vid_stream); 1967 pvr2_stream_destroy(hdw->vid_stream);
1970 hdw->vid_stream = 0; 1968 hdw->vid_stream = NULL;
1971 } 1969 }
1972 if (hdw->audio_stat) { 1970 if (hdw->audio_stat) {
1973 hdw->audio_stat->detach(hdw->audio_stat->ctxt); 1971 hdw->audio_stat->detach(hdw->audio_stat->ctxt);
@@ -1981,7 +1979,7 @@ void pvr2_hdw_destroy(struct pvr2_hdw *hdw)
1981 if ((hdw->unit_number >= 0) && 1979 if ((hdw->unit_number >= 0) &&
1982 (hdw->unit_number < PVR_NUM) && 1980 (hdw->unit_number < PVR_NUM) &&
1983 (unit_pointers[hdw->unit_number] == hdw)) { 1981 (unit_pointers[hdw->unit_number] == hdw)) {
1984 unit_pointers[hdw->unit_number] = 0; 1982 unit_pointers[hdw->unit_number] = NULL;
1985 } 1983 }
1986 } while (0); up(&pvr2_unit_sem); 1984 } while (0); up(&pvr2_unit_sem);
1987 if (hdw->controls) kfree(hdw->controls); 1985 if (hdw->controls) kfree(hdw->controls);
@@ -2018,7 +2016,7 @@ void pvr2_hdw_disconnect(struct pvr2_hdw *hdw)
2018 2016
2019// Attempt to autoselect an appropriate value for std_enum_cur given 2017// Attempt to autoselect an appropriate value for std_enum_cur given
2020// whatever is currently in std_mask_cur 2018// whatever is currently in std_mask_cur
2021void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw) 2019static void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw)
2022{ 2020{
2023 unsigned int idx; 2021 unsigned int idx;
2024 for (idx = 1; idx < hdw->std_enum_cnt; idx++) { 2022 for (idx = 1; idx < hdw->std_enum_cnt; idx++) {
@@ -2033,7 +2031,7 @@ void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw)
2033 2031
2034// Calculate correct set of enumerated standards based on currently known 2032// Calculate correct set of enumerated standards based on currently known
2035// set of available standards bits. 2033// set of available standards bits.
2036void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw) 2034static void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw)
2037{ 2035{
2038 struct v4l2_standard *newstd; 2036 struct v4l2_standard *newstd;
2039 unsigned int std_cnt; 2037 unsigned int std_cnt;
@@ -2043,12 +2041,12 @@ void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw)
2043 2041
2044 if (hdw->std_defs) { 2042 if (hdw->std_defs) {
2045 kfree(hdw->std_defs); 2043 kfree(hdw->std_defs);
2046 hdw->std_defs = 0; 2044 hdw->std_defs = NULL;
2047 } 2045 }
2048 hdw->std_enum_cnt = 0; 2046 hdw->std_enum_cnt = 0;
2049 if (hdw->std_enum_names) { 2047 if (hdw->std_enum_names) {
2050 kfree(hdw->std_enum_names); 2048 kfree(hdw->std_enum_names);
2051 hdw->std_enum_names = 0; 2049 hdw->std_enum_names = NULL;
2052 } 2050 }
2053 2051
2054 if (!std_cnt) { 2052 if (!std_cnt) {
@@ -2099,7 +2097,7 @@ unsigned int pvr2_hdw_get_ctrl_count(struct pvr2_hdw *hdw)
2099struct pvr2_ctrl *pvr2_hdw_get_ctrl_by_index(struct pvr2_hdw *hdw, 2097struct pvr2_ctrl *pvr2_hdw_get_ctrl_by_index(struct pvr2_hdw *hdw,
2100 unsigned int idx) 2098 unsigned int idx)
2101{ 2099{
2102 if (idx >= hdw->control_cnt) return 0; 2100 if (idx >= hdw->control_cnt) return NULL;
2103 return hdw->controls + idx; 2101 return hdw->controls + idx;
2104} 2102}
2105 2103
@@ -2118,7 +2116,7 @@ struct pvr2_ctrl *pvr2_hdw_get_ctrl_by_id(struct pvr2_hdw *hdw,
2118 i = cptr->info->internal_id; 2116 i = cptr->info->internal_id;
2119 if (i && (i == ctl_id)) return cptr; 2117 if (i && (i == ctl_id)) return cptr;
2120 } 2118 }
2121 return 0; 2119 return NULL;
2122} 2120}
2123 2121
2124 2122
@@ -2135,7 +2133,7 @@ struct pvr2_ctrl *pvr2_hdw_get_ctrl_v4l(struct pvr2_hdw *hdw,unsigned int ctl_id
2135 i = cptr->info->v4l_id; 2133 i = cptr->info->v4l_id;
2136 if (i && (i == ctl_id)) return cptr; 2134 if (i && (i == ctl_id)) return cptr;
2137 } 2135 }
2138 return 0; 2136 return NULL;
2139} 2137}
2140 2138
2141 2139
@@ -2149,7 +2147,7 @@ struct pvr2_ctrl *pvr2_hdw_get_ctrl_nextv4l(struct pvr2_hdw *hdw,
2149 int i; 2147 int i;
2150 2148
2151 /* This could be made a lot more efficient, but for now... */ 2149 /* This could be made a lot more efficient, but for now... */
2152 cp2 = 0; 2150 cp2 = NULL;
2153 for (idx = 0; idx < hdw->control_cnt; idx++) { 2151 for (idx = 0; idx < hdw->control_cnt; idx++) {
2154 cptr = hdw->controls + idx; 2152 cptr = hdw->controls + idx;
2155 i = cptr->info->v4l_id; 2153 i = cptr->info->v4l_id;
@@ -2159,7 +2157,7 @@ struct pvr2_ctrl *pvr2_hdw_get_ctrl_nextv4l(struct pvr2_hdw *hdw,
2159 cp2 = cptr; 2157 cp2 = cptr;
2160 } 2158 }
2161 return cp2; 2159 return cp2;
2162 return 0; 2160 return NULL;
2163} 2161}
2164 2162
2165 2163
@@ -2182,7 +2180,7 @@ static const char *get_ctrl_typename(enum pvr2_ctl_type tp)
2182 state(s) back to their previous value before this function was called. 2180 state(s) back to their previous value before this function was called.
2183 Thus we can automatically reconfigure affected pieces of the driver as 2181 Thus we can automatically reconfigure affected pieces of the driver as
2184 controls are changed. */ 2182 controls are changed. */
2185int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw) 2183static int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw)
2186{ 2184{
2187 unsigned long saved_subsys_mask = hdw->subsys_enabled_mask; 2185 unsigned long saved_subsys_mask = hdw->subsys_enabled_mask;
2188 unsigned long stale_subsys_mask = 0; 2186 unsigned long stale_subsys_mask = 0;
@@ -2321,14 +2319,6 @@ void pvr2_hdw_poll_trigger_unlocked(struct pvr2_hdw *hdw)
2321} 2319}
2322 2320
2323 2321
2324void pvr2_hdw_poll_trigger(struct pvr2_hdw *hdw)
2325{
2326 LOCK_TAKE(hdw->big_lock); do {
2327 pvr2_hdw_poll_trigger_unlocked(hdw);
2328 } while (0); LOCK_GIVE(hdw->big_lock);
2329}
2330
2331
2332/* Return name for this driver instance */ 2322/* Return name for this driver instance */
2333const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw) 2323const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw)
2334{ 2324{
@@ -2337,7 +2327,7 @@ const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw)
2337 2327
2338 2328
2339/* Return bit mask indicating signal status */ 2329/* Return bit mask indicating signal status */
2340unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *hdw) 2330static unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *hdw)
2341{ 2331{
2342 unsigned int msk = 0; 2332 unsigned int msk = 0;
2343 switch (hdw->input_val) { 2333 switch (hdw->input_val) {
@@ -2424,7 +2414,7 @@ void pvr2_hdw_cpufw_set_enabled(struct pvr2_hdw *hdw, int enable_flag)
2424 pvr2_trace(PVR2_TRACE_FIRMWARE, 2414 pvr2_trace(PVR2_TRACE_FIRMWARE,
2425 "Cleaning up after CPU firmware fetch"); 2415 "Cleaning up after CPU firmware fetch");
2426 kfree(hdw->fw_buffer); 2416 kfree(hdw->fw_buffer);
2427 hdw->fw_buffer = 0; 2417 hdw->fw_buffer = NULL;
2428 hdw->fw_size = 0; 2418 hdw->fw_size = 0;
2429 /* Now release the CPU. It will disconnect and 2419 /* Now release the CPU. It will disconnect and
2430 reconnect later. */ 2420 reconnect later. */
@@ -2519,22 +2509,6 @@ void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *hdw,int v)
2519} 2509}
2520 2510
2521 2511
2522void pvr2_reset_ctl_endpoints(struct pvr2_hdw *hdw)
2523{
2524 if (!hdw->usb_dev) return;
2525 usb_settoggle(hdw->usb_dev, PVR2_CTL_WRITE_ENDPOINT & 0xf,
2526 !(PVR2_CTL_WRITE_ENDPOINT & USB_DIR_IN), 0);
2527 usb_settoggle(hdw->usb_dev, PVR2_CTL_READ_ENDPOINT & 0xf,
2528 !(PVR2_CTL_READ_ENDPOINT & USB_DIR_IN), 0);
2529 usb_clear_halt(hdw->usb_dev,
2530 usb_rcvbulkpipe(hdw->usb_dev,
2531 PVR2_CTL_READ_ENDPOINT & 0x7f));
2532 usb_clear_halt(hdw->usb_dev,
2533 usb_sndbulkpipe(hdw->usb_dev,
2534 PVR2_CTL_WRITE_ENDPOINT & 0x7f));
2535}
2536
2537
2538static void pvr2_ctl_write_complete(struct urb *urb, struct pt_regs *regs) 2512static void pvr2_ctl_write_complete(struct urb *urb, struct pt_regs *regs)
2539{ 2513{
2540 struct pvr2_hdw *hdw = urb->context; 2514 struct pvr2_hdw *hdw = urb->context;
@@ -2568,10 +2542,10 @@ static void pvr2_ctl_timeout(unsigned long data)
2568} 2542}
2569 2543
2570 2544
2571int pvr2_send_request_ex(struct pvr2_hdw *hdw, 2545static int pvr2_send_request_ex(struct pvr2_hdw *hdw,
2572 unsigned int timeout,int probe_fl, 2546 unsigned int timeout,int probe_fl,
2573 void *write_data,unsigned int write_len, 2547 void *write_data,unsigned int write_len,
2574 void *read_data,unsigned int read_len) 2548 void *read_data,unsigned int read_len)
2575{ 2549{
2576 unsigned int idx; 2550 unsigned int idx;
2577 int status = 0; 2551 int status = 0;
@@ -2826,7 +2800,7 @@ int pvr2_write_register(struct pvr2_hdw *hdw, u16 reg, u32 data)
2826} 2800}
2827 2801
2828 2802
2829int pvr2_read_register(struct pvr2_hdw *hdw, u16 reg, u32 *data) 2803static int pvr2_read_register(struct pvr2_hdw *hdw, u16 reg, u32 *data)
2830{ 2804{
2831 int ret = 0; 2805 int ret = 0;
2832 2806
@@ -2850,7 +2824,7 @@ int pvr2_read_register(struct pvr2_hdw *hdw, u16 reg, u32 *data)
2850} 2824}
2851 2825
2852 2826
2853int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res) 2827static int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res)
2854{ 2828{
2855 int ret; 2829 int ret;
2856 2830
@@ -2867,7 +2841,7 @@ int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res)
2867} 2841}
2868 2842
2869 2843
2870int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res) 2844static int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res)
2871{ 2845{
2872 int ret; 2846 int ret;
2873 2847
@@ -2883,13 +2857,13 @@ int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res)
2883} 2857}
2884 2858
2885 2859
2886void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *hdw) 2860static void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *hdw)
2887{ 2861{
2888 if (!hdw->flag_ok) return; 2862 if (!hdw->flag_ok) return;
2889 pvr2_trace(PVR2_TRACE_INIT,"render_useless"); 2863 pvr2_trace(PVR2_TRACE_INIT,"render_useless");
2890 hdw->flag_ok = 0; 2864 hdw->flag_ok = 0;
2891 if (hdw->vid_stream) { 2865 if (hdw->vid_stream) {
2892 pvr2_stream_setup(hdw->vid_stream,0,0,0); 2866 pvr2_stream_setup(hdw->vid_stream,NULL,0,0);
2893 } 2867 }
2894 hdw->flag_streaming_enabled = 0; 2868 hdw->flag_streaming_enabled = 0;
2895 hdw->subsys_enabled_mask = 0; 2869 hdw->subsys_enabled_mask = 0;
@@ -2908,7 +2882,7 @@ void pvr2_hdw_device_reset(struct pvr2_hdw *hdw)
2908{ 2882{
2909 int ret; 2883 int ret;
2910 pvr2_trace(PVR2_TRACE_INIT,"Performing a device reset..."); 2884 pvr2_trace(PVR2_TRACE_INIT,"Performing a device reset...");
2911 ret = usb_lock_device_for_reset(hdw->usb_dev,0); 2885 ret = usb_lock_device_for_reset(hdw->usb_dev,NULL);
2912 if (ret == 1) { 2886 if (ret == 1) {
2913 ret = usb_reset_device(hdw->usb_dev); 2887 ret = usb_reset_device(hdw->usb_dev);
2914 usb_unlock_device(hdw->usb_dev); 2888 usb_unlock_device(hdw->usb_dev);
@@ -2957,7 +2931,7 @@ int pvr2_hdw_cmd_deep_reset(struct pvr2_hdw *hdw)
2957 pvr2_trace(PVR2_TRACE_INIT,"Requesting uproc hard reset"); 2931 pvr2_trace(PVR2_TRACE_INIT,"Requesting uproc hard reset");
2958 hdw->flag_ok = !0; 2932 hdw->flag_ok = !0;
2959 hdw->cmd_buffer[0] = 0xdd; 2933 hdw->cmd_buffer[0] = 0xdd;
2960 status = pvr2_send_request(hdw,hdw->cmd_buffer,1,0,0); 2934 status = pvr2_send_request(hdw,hdw->cmd_buffer,1,NULL,0);
2961 } while (0); LOCK_GIVE(hdw->ctl_lock); 2935 } while (0); LOCK_GIVE(hdw->ctl_lock);
2962 return status; 2936 return status;
2963} 2937}
@@ -2969,7 +2943,7 @@ int pvr2_hdw_cmd_powerup(struct pvr2_hdw *hdw)
2969 LOCK_TAKE(hdw->ctl_lock); do { 2943 LOCK_TAKE(hdw->ctl_lock); do {
2970 pvr2_trace(PVR2_TRACE_INIT,"Requesting powerup"); 2944 pvr2_trace(PVR2_TRACE_INIT,"Requesting powerup");
2971 hdw->cmd_buffer[0] = 0xde; 2945 hdw->cmd_buffer[0] = 0xde;
2972 status = pvr2_send_request(hdw,hdw->cmd_buffer,1,0,0); 2946 status = pvr2_send_request(hdw,hdw->cmd_buffer,1,NULL,0);
2973 } while (0); LOCK_GIVE(hdw->ctl_lock); 2947 } while (0); LOCK_GIVE(hdw->ctl_lock);
2974 return status; 2948 return status;
2975} 2949}
@@ -2996,12 +2970,12 @@ int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *hdw)
2996} 2970}
2997 2971
2998 2972
2999int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl) 2973static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl)
3000{ 2974{
3001 int status; 2975 int status;
3002 LOCK_TAKE(hdw->ctl_lock); do { 2976 LOCK_TAKE(hdw->ctl_lock); do {
3003 hdw->cmd_buffer[0] = (runFl ? 0x36 : 0x37); 2977 hdw->cmd_buffer[0] = (runFl ? 0x36 : 0x37);
3004 status = pvr2_send_request(hdw,hdw->cmd_buffer,1,0,0); 2978 status = pvr2_send_request(hdw,hdw->cmd_buffer,1,NULL,0);
3005 } while (0); LOCK_GIVE(hdw->ctl_lock); 2979 } while (0); LOCK_GIVE(hdw->ctl_lock);
3006 if (!status) { 2980 if (!status) {
3007 hdw->subsys_enabled_mask = 2981 hdw->subsys_enabled_mask =
@@ -3094,7 +3068,7 @@ int pvr2_hdw_gpio_chg_out(struct pvr2_hdw *hdw,u32 msk,u32 val)
3094} 3068}
3095 3069
3096 3070
3097int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw) 3071static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw)
3098{ 3072{
3099 int result; 3073 int result;
3100 LOCK_TAKE(hdw->ctl_lock); do { 3074 LOCK_TAKE(hdw->ctl_lock); do {
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/drivers/media/video/pvrusb2/pvrusb2-hdw.h
index 63f529154431..fd931b5da490 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.h
@@ -91,7 +91,6 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
91void pvr2_hdw_poll(struct pvr2_hdw *); 91void pvr2_hdw_poll(struct pvr2_hdw *);
92 92
93/* Trigger a poll to take place later at a convenient time */ 93/* Trigger a poll to take place later at a convenient time */
94void pvr2_hdw_poll_trigger(struct pvr2_hdw *);
95void pvr2_hdw_poll_trigger_unlocked(struct pvr2_hdw *); 94void pvr2_hdw_poll_trigger_unlocked(struct pvr2_hdw *);
96 95
97/* Register a callback used to trigger a future poll */ 96/* Register a callback used to trigger a future poll */
@@ -99,9 +98,6 @@ void pvr2_hdw_setup_poll_trigger(struct pvr2_hdw *,
99 void (*func)(void *), 98 void (*func)(void *),
100 void *data); 99 void *data);
101 100
102/* Get pointer to structure given unit number */
103struct pvr2_hdw *pvr2_hdw_find(int unit_number);
104
105/* Destroy hardware interaction structure */ 101/* Destroy hardware interaction structure */
106void pvr2_hdw_destroy(struct pvr2_hdw *); 102void pvr2_hdw_destroy(struct pvr2_hdw *);
107 103
@@ -180,12 +176,6 @@ int pvr2_hdw_get_stdenum_value(struct pvr2_hdw *hdw,struct v4l2_standard *std,
180void pvr2_hdw_subsys_bit_chg(struct pvr2_hdw *hdw, 176void pvr2_hdw_subsys_bit_chg(struct pvr2_hdw *hdw,
181 unsigned long msk,unsigned long val); 177 unsigned long msk,unsigned long val);
182 178
183/* Shortcut for pvr2_hdw_subsys_bit_chg(hdw,msk,msk) */
184void pvr2_hdw_subsys_bit_set(struct pvr2_hdw *hdw,unsigned long msk);
185
186/* Shortcut for pvr2_hdw_subsys_bit_chg(hdw,msk,0) */
187void pvr2_hdw_subsys_bit_clr(struct pvr2_hdw *hdw,unsigned long msk);
188
189/* Retrieve mask indicating which pieces of hardware are currently enabled 179/* Retrieve mask indicating which pieces of hardware are currently enabled
190 / configured. */ 180 / configured. */
191unsigned long pvr2_hdw_subsys_get(struct pvr2_hdw *); 181unsigned long pvr2_hdw_subsys_get(struct pvr2_hdw *);
@@ -225,34 +215,18 @@ void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,int);
225/* The following entry points are all lower level things you normally don't 215/* The following entry points are all lower level things you normally don't
226 want to worry about. */ 216 want to worry about. */
227 217
228/* Attempt to recover from a USB foul-up (in practice I find that if you
229 have to do this, then it's already too late). */
230void pvr2_reset_ctl_endpoints(struct pvr2_hdw *hdw);
231
232/* Issue a command and get a response from the device. LOTS of higher 218/* Issue a command and get a response from the device. LOTS of higher
233 level stuff is built on this. */ 219 level stuff is built on this. */
234int pvr2_send_request(struct pvr2_hdw *, 220int pvr2_send_request(struct pvr2_hdw *,
235 void *write_ptr,unsigned int write_len, 221 void *write_ptr,unsigned int write_len,
236 void *read_ptr,unsigned int read_len); 222 void *read_ptr,unsigned int read_len);
237 223
238/* Issue a command and get a response from the device. This extended
239 version includes a probe flag (which if set means that device errors
240 should not be logged or treated as fatal) and a timeout in jiffies.
241 This can be used to non-lethally probe the health of endpoint 1. */
242int pvr2_send_request_ex(struct pvr2_hdw *,unsigned int timeout,int probe_fl,
243 void *write_ptr,unsigned int write_len,
244 void *read_ptr,unsigned int read_len);
245
246/* Slightly higher level device communication functions. */ 224/* Slightly higher level device communication functions. */
247int pvr2_write_register(struct pvr2_hdw *, u16, u32); 225int pvr2_write_register(struct pvr2_hdw *, u16, u32);
248int pvr2_read_register(struct pvr2_hdw *, u16, u32 *);
249int pvr2_write_u16(struct pvr2_hdw *, u16, int);
250int pvr2_write_u8(struct pvr2_hdw *, u8, int);
251 226
252/* Call if for any reason we can't talk to the hardware anymore - this will 227/* Call if for any reason we can't talk to the hardware anymore - this will
253 cause the driver to stop flailing on the device. */ 228 cause the driver to stop flailing on the device. */
254void pvr2_hdw_render_useless(struct pvr2_hdw *); 229void pvr2_hdw_render_useless(struct pvr2_hdw *);
255void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *);
256 230
257/* Set / clear 8051's reset bit */ 231/* Set / clear 8051's reset bit */
258void pvr2_hdw_cpureset_assert(struct pvr2_hdw *,int); 232void pvr2_hdw_cpureset_assert(struct pvr2_hdw *,int);
@@ -271,12 +245,6 @@ int pvr2_hdw_cmd_powerup(struct pvr2_hdw *);
271/* Order decoder to reset */ 245/* Order decoder to reset */
272int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *); 246int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *);
273 247
274/* Stop / start video stream transport */
275int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl);
276
277/* Find I2C address of eeprom */
278int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *);
279
280/* Direct manipulation of GPIO bits */ 248/* Direct manipulation of GPIO bits */
281int pvr2_hdw_gpio_get_dir(struct pvr2_hdw *hdw,u32 *); 249int pvr2_hdw_gpio_get_dir(struct pvr2_hdw *hdw,u32 *);
282int pvr2_hdw_gpio_get_out(struct pvr2_hdw *hdw,u32 *); 250int pvr2_hdw_gpio_get_out(struct pvr2_hdw *hdw,u32 *);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c
index 1dd4f6249b99..fbe6039aeb6a 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c
@@ -25,7 +25,6 @@
25#include "pvrusb2-i2c-cmd-v4l2.h" 25#include "pvrusb2-i2c-cmd-v4l2.h"
26#include "pvrusb2-audio.h" 26#include "pvrusb2-audio.h"
27#include "pvrusb2-tuner.h" 27#include "pvrusb2-tuner.h"
28#include "pvrusb2-demod.h"
29#include "pvrusb2-video-v4l.h" 28#include "pvrusb2-video-v4l.h"
30#ifdef CONFIG_VIDEO_PVRUSB2_24XXX 29#ifdef CONFIG_VIDEO_PVRUSB2_24XXX
31#include "pvrusb2-cx2584x-v4l.h" 30#include "pvrusb2-cx2584x-v4l.h"
@@ -89,11 +88,6 @@ void pvr2_i2c_probe(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp)
89 return; 88 return;
90 } 89 }
91 } 90 }
92 if (id == I2C_DRIVERID_TDA9887) {
93 if (pvr2_i2c_demod_setup(hdw,cp)) {
94 return;
95 }
96 }
97} 91}
98 92
99 93
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c
index 9f81aff2b38a..8a9933dec912 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c
@@ -196,7 +196,7 @@ const struct pvr2_i2c_op pvr2_i2c_op_v4l2_size = {
196static void do_log(struct pvr2_hdw *hdw) 196static void do_log(struct pvr2_hdw *hdw)
197{ 197{
198 pvr2_trace(PVR2_TRACE_CHIPS,"i2c v4l2 do_log()"); 198 pvr2_trace(PVR2_TRACE_CHIPS,"i2c v4l2 do_log()");
199 pvr2_i2c_core_cmd(hdw,VIDIOC_LOG_STATUS,0); 199 pvr2_i2c_core_cmd(hdw,VIDIOC_LOG_STATUS,NULL);
200 200
201} 201}
202 202
@@ -217,7 +217,7 @@ const struct pvr2_i2c_op pvr2_i2c_op_v4l2_log = {
217void pvr2_v4l2_cmd_stream(struct pvr2_i2c_client *cp,int fl) 217void pvr2_v4l2_cmd_stream(struct pvr2_i2c_client *cp,int fl)
218{ 218{
219 pvr2_i2c_client_cmd(cp, 219 pvr2_i2c_client_cmd(cp,
220 (fl ? VIDIOC_STREAMON : VIDIOC_STREAMOFF),0); 220 (fl ? VIDIOC_STREAMON : VIDIOC_STREAMOFF),NULL);
221} 221}
222 222
223 223
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
index c8d0bdee3ff1..7fca47982277 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
@@ -37,6 +37,10 @@ static unsigned int i2c_scan = 0;
37module_param(i2c_scan, int, S_IRUGO|S_IWUSR); 37module_param(i2c_scan, int, S_IRUGO|S_IWUSR);
38MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); 38MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time");
39 39
40static unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *cp,
41 unsigned int detail,
42 char *buf,unsigned int maxlen);
43
40static int pvr2_i2c_write(struct pvr2_hdw *hdw, /* Context */ 44static int pvr2_i2c_write(struct pvr2_hdw *hdw, /* Context */
41 u8 i2c_addr, /* I2C address we're talking to */ 45 u8 i2c_addr, /* I2C address we're talking to */
42 u8 *data, /* Data to write */ 46 u8 *data, /* Data to write */
@@ -165,12 +169,12 @@ static int pvr2_i2c_read(struct pvr2_hdw *hdw, /* Context */
165 169
166/* This is the common low level entry point for doing I2C operations to the 170/* This is the common low level entry point for doing I2C operations to the
167 hardware. */ 171 hardware. */
168int pvr2_i2c_basic_op(struct pvr2_hdw *hdw, 172static int pvr2_i2c_basic_op(struct pvr2_hdw *hdw,
169 u8 i2c_addr, 173 u8 i2c_addr,
170 u8 *wdata, 174 u8 *wdata,
171 u16 wlen, 175 u16 wlen,
172 u8 *rdata, 176 u8 *rdata,
173 u16 rlen) 177 u16 rlen)
174{ 178{
175 if (!rdata) rlen = 0; 179 if (!rdata) rlen = 0;
176 if (!wdata) wlen = 0; 180 if (!wdata) wlen = 0;
@@ -267,7 +271,7 @@ static int i2c_hack_cx25840(struct pvr2_hdw *hdw,
267 "WARNING: Disabling further access to the device" 271 "WARNING: Disabling further access to the device"
268 " to prevent other foul-ups."); 272 " to prevent other foul-ups.");
269 // This blocks all further communication with the part. 273 // This blocks all further communication with the part.
270 hdw->i2c_func[0x44] = 0; 274 hdw->i2c_func[0x44] = NULL;
271 pvr2_hdw_render_useless(hdw); 275 pvr2_hdw_render_useless(hdw);
272 goto fail; 276 goto fail;
273 } 277 }
@@ -294,7 +298,7 @@ static int pvr2_i2c_xfer(struct i2c_adapter *i2c_adap,
294 int num) 298 int num)
295{ 299{
296 int ret = -ENOTSUPP; 300 int ret = -ENOTSUPP;
297 pvr2_i2c_func funcp = 0; 301 pvr2_i2c_func funcp = NULL;
298 struct pvr2_hdw *hdw = (struct pvr2_hdw *)(i2c_adap->algo_data); 302 struct pvr2_hdw *hdw = (struct pvr2_hdw *)(i2c_adap->algo_data);
299 303
300 if (!num) { 304 if (!num) {
@@ -319,7 +323,7 @@ static int pvr2_i2c_xfer(struct i2c_adapter *i2c_adap,
319 u16 tcnt,bcnt,offs; 323 u16 tcnt,bcnt,offs;
320 if (!msgs[0].len) { 324 if (!msgs[0].len) {
321 /* Length == 0 read. This is a probe. */ 325 /* Length == 0 read. This is a probe. */
322 if (funcp(hdw,msgs[0].addr,0,0,0,0)) { 326 if (funcp(hdw,msgs[0].addr,NULL,0,NULL,0)) {
323 ret = -EIO; 327 ret = -EIO;
324 goto done; 328 goto done;
325 } 329 }
@@ -336,7 +340,7 @@ static int pvr2_i2c_xfer(struct i2c_adapter *i2c_adap,
336 if (bcnt > sizeof(hdw->cmd_buffer)-1) { 340 if (bcnt > sizeof(hdw->cmd_buffer)-1) {
337 bcnt = sizeof(hdw->cmd_buffer)-1; 341 bcnt = sizeof(hdw->cmd_buffer)-1;
338 } 342 }
339 if (funcp(hdw,msgs[0].addr,0,0, 343 if (funcp(hdw,msgs[0].addr,NULL,0,
340 msgs[0].buf+offs,bcnt)) { 344 msgs[0].buf+offs,bcnt)) {
341 ret = -EIO; 345 ret = -EIO;
342 goto done; 346 goto done;
@@ -350,7 +354,7 @@ static int pvr2_i2c_xfer(struct i2c_adapter *i2c_adap,
350 /* Simple write */ 354 /* Simple write */
351 ret = 1; 355 ret = 1;
352 if (funcp(hdw,msgs[0].addr, 356 if (funcp(hdw,msgs[0].addr,
353 msgs[0].buf,msgs[0].len,0,0)) { 357 msgs[0].buf,msgs[0].len,NULL,0)) {
354 ret = -EIO; 358 ret = -EIO;
355 } 359 }
356 goto done; 360 goto done;
@@ -705,9 +709,9 @@ int pvr2_i2c_core_check_stale(struct pvr2_hdw *hdw)
705 return (hdw->i2c_pend_types & PVR2_I2C_PEND_ALL) != 0; 709 return (hdw->i2c_pend_types & PVR2_I2C_PEND_ALL) != 0;
706} 710}
707 711
708unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *cp, 712static unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *cp,
709 unsigned int detail, 713 unsigned int detail,
710 char *buf,unsigned int maxlen) 714 char *buf,unsigned int maxlen)
711{ 715{
712 unsigned int ccnt,bcnt; 716 unsigned int ccnt,bcnt;
713 int spcfl = 0; 717 int spcfl = 0;
@@ -871,7 +875,7 @@ static void do_i2c_scan(struct pvr2_hdw *hdw)
871 msg[0].addr = 0; 875 msg[0].addr = 0;
872 msg[0].flags = I2C_M_RD; 876 msg[0].flags = I2C_M_RD;
873 msg[0].len = 0; 877 msg[0].len = 0;
874 msg[0].buf = 0; 878 msg[0].buf = NULL;
875 printk("%s: i2c scan beginning\n",hdw->name); 879 printk("%s: i2c scan beginning\n",hdw->name);
876 for (i = 0; i < 128; i++) { 880 for (i = 0; i < 128; i++) {
877 msg[0].addr = i; 881 msg[0].addr = i;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.h b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.h
index e8af5b0ed3ce..6d7e25247576 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.h
@@ -75,9 +75,6 @@ unsigned int pvr2_i2c_report(struct pvr2_hdw *,char *buf,unsigned int maxlen);
75 PVR2_I2C_DETAIL_DEBUG |\ 75 PVR2_I2C_DETAIL_DEBUG |\
76 PVR2_I2C_DETAIL_HANDLER |\ 76 PVR2_I2C_DETAIL_HANDLER |\
77 PVR2_I2C_DETAIL_CTLMASK) 77 PVR2_I2C_DETAIL_CTLMASK)
78unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *,
79 unsigned int detail_mask,
80 char *buf,unsigned int maxlen);
81 78
82void pvr2_i2c_probe(struct pvr2_hdw *,struct pvr2_i2c_client *); 79void pvr2_i2c_probe(struct pvr2_hdw *,struct pvr2_i2c_client *);
83const struct pvr2_i2c_op *pvr2_i2c_get_op(unsigned int idx); 80const struct pvr2_i2c_op *pvr2_i2c_get_op(unsigned int idx);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-io.c b/drivers/media/video/pvrusb2/pvrusb2-io.c
index a984c91f571c..681f79c8064e 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-io.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-io.c
@@ -93,7 +93,7 @@ struct pvr2_buffer {
93 struct urb *purb; 93 struct urb *purb;
94}; 94};
95 95
96const char *pvr2_buffer_state_decode(enum pvr2_buffer_state st) 96static const char *pvr2_buffer_state_decode(enum pvr2_buffer_state st)
97{ 97{
98 switch (st) { 98 switch (st) {
99 case pvr2_buffer_state_none: return "none"; 99 case pvr2_buffer_state_none: return "none";
@@ -104,7 +104,8 @@ const char *pvr2_buffer_state_decode(enum pvr2_buffer_state st)
104 return "unknown"; 104 return "unknown";
105} 105}
106 106
107void pvr2_buffer_describe(struct pvr2_buffer *bp,const char *msg) 107#ifdef SANITY_CHECK_BUFFERS
108static void pvr2_buffer_describe(struct pvr2_buffer *bp,const char *msg)
108{ 109{
109 pvr2_trace(PVR2_TRACE_INFO, 110 pvr2_trace(PVR2_TRACE_INFO,
110 "buffer%s%s %p state=%s id=%d status=%d" 111 "buffer%s%s %p state=%s id=%d status=%d"
@@ -115,10 +116,11 @@ void pvr2_buffer_describe(struct pvr2_buffer *bp,const char *msg)
115 (bp ? pvr2_buffer_state_decode(bp->state) : "(invalid)"), 116 (bp ? pvr2_buffer_state_decode(bp->state) : "(invalid)"),
116 (bp ? bp->id : 0), 117 (bp ? bp->id : 0),
117 (bp ? bp->status : 0), 118 (bp ? bp->status : 0),
118 (bp ? bp->stream : 0), 119 (bp ? bp->stream : NULL),
119 (bp ? bp->purb : 0), 120 (bp ? bp->purb : NULL),
120 (bp ? bp->signature : 0)); 121 (bp ? bp->signature : 0));
121} 122}
123#endif /* SANITY_CHECK_BUFFERS */
122 124
123static void pvr2_buffer_remove(struct pvr2_buffer *bp) 125static void pvr2_buffer_remove(struct pvr2_buffer *bp)
124{ 126{
@@ -284,7 +286,7 @@ static void pvr2_buffer_done(struct pvr2_buffer *bp)
284 pvr2_buffer_wipe(bp); 286 pvr2_buffer_wipe(bp);
285 pvr2_buffer_set_none(bp); 287 pvr2_buffer_set_none(bp);
286 bp->signature = 0; 288 bp->signature = 0;
287 bp->stream = 0; 289 bp->stream = NULL;
288 if (bp->purb) usb_free_urb(bp->purb); 290 if (bp->purb) usb_free_urb(bp->purb);
289 pvr2_trace(PVR2_TRACE_BUF_POOL,"/*---TRACE_FLOW---*/" 291 pvr2_trace(PVR2_TRACE_BUF_POOL,"/*---TRACE_FLOW---*/"
290 " bufferDone %p",bp); 292 " bufferDone %p",bp);
@@ -339,13 +341,13 @@ static int pvr2_stream_buffer_count(struct pvr2_stream *sp,unsigned int cnt)
339 struct pvr2_buffer *bp; 341 struct pvr2_buffer *bp;
340 bp = sp->buffers[sp->buffer_total_count - 1]; 342 bp = sp->buffers[sp->buffer_total_count - 1];
341 /* Paranoia */ 343 /* Paranoia */
342 sp->buffers[sp->buffer_total_count - 1] = 0; 344 sp->buffers[sp->buffer_total_count - 1] = NULL;
343 (sp->buffer_total_count)--; 345 (sp->buffer_total_count)--;
344 pvr2_buffer_done(bp); 346 pvr2_buffer_done(bp);
345 kfree(bp); 347 kfree(bp);
346 } 348 }
347 if (scnt < sp->buffer_slot_count) { 349 if (scnt < sp->buffer_slot_count) {
348 struct pvr2_buffer **nb = 0; 350 struct pvr2_buffer **nb = NULL;
349 if (scnt) { 351 if (scnt) {
350 nb = kmalloc(scnt * sizeof(*nb),GFP_KERNEL); 352 nb = kmalloc(scnt * sizeof(*nb),GFP_KERNEL);
351 if (!nb) return -ENOMEM; 353 if (!nb) return -ENOMEM;
@@ -513,10 +515,6 @@ void pvr2_stream_set_callback(struct pvr2_stream *sp,
513} 515}
514 516
515/* Query / set the nominal buffer count */ 517/* Query / set the nominal buffer count */
516int pvr2_stream_get_buffer_count(struct pvr2_stream *sp)
517{
518 return sp->buffer_target_count;
519}
520 518
521int pvr2_stream_set_buffer_count(struct pvr2_stream *sp,unsigned int cnt) 519int pvr2_stream_set_buffer_count(struct pvr2_stream *sp,unsigned int cnt)
522{ 520{
@@ -532,21 +530,21 @@ int pvr2_stream_set_buffer_count(struct pvr2_stream *sp,unsigned int cnt)
532struct pvr2_buffer *pvr2_stream_get_idle_buffer(struct pvr2_stream *sp) 530struct pvr2_buffer *pvr2_stream_get_idle_buffer(struct pvr2_stream *sp)
533{ 531{
534 struct list_head *lp = sp->idle_list.next; 532 struct list_head *lp = sp->idle_list.next;
535 if (lp == &sp->idle_list) return 0; 533 if (lp == &sp->idle_list) return NULL;
536 return list_entry(lp,struct pvr2_buffer,list_overhead); 534 return list_entry(lp,struct pvr2_buffer,list_overhead);
537} 535}
538 536
539struct pvr2_buffer *pvr2_stream_get_ready_buffer(struct pvr2_stream *sp) 537struct pvr2_buffer *pvr2_stream_get_ready_buffer(struct pvr2_stream *sp)
540{ 538{
541 struct list_head *lp = sp->ready_list.next; 539 struct list_head *lp = sp->ready_list.next;
542 if (lp == &sp->ready_list) return 0; 540 if (lp == &sp->ready_list) return NULL;
543 return list_entry(lp,struct pvr2_buffer,list_overhead); 541 return list_entry(lp,struct pvr2_buffer,list_overhead);
544} 542}
545 543
546struct pvr2_buffer *pvr2_stream_get_buffer(struct pvr2_stream *sp,int id) 544struct pvr2_buffer *pvr2_stream_get_buffer(struct pvr2_stream *sp,int id)
547{ 545{
548 if (id < 0) return 0; 546 if (id < 0) return NULL;
549 if (id >= sp->buffer_total_count) return 0; 547 if (id >= sp->buffer_total_count) return NULL;
550 return sp->buffers[id]; 548 return sp->buffers[id];
551} 549}
552 550
@@ -555,17 +553,6 @@ int pvr2_stream_get_ready_count(struct pvr2_stream *sp)
555 return sp->r_count; 553 return sp->r_count;
556} 554}
557 555
558int pvr2_stream_get_idle_count(struct pvr2_stream *sp)
559{
560 return sp->i_count;
561}
562
563void pvr2_stream_flush(struct pvr2_stream *sp)
564{
565 mutex_lock(&sp->mutex); do {
566 pvr2_stream_internal_flush(sp);
567 } while(0); mutex_unlock(&sp->mutex);
568}
569 556
570void pvr2_stream_kill(struct pvr2_stream *sp) 557void pvr2_stream_kill(struct pvr2_stream *sp)
571{ 558{
@@ -620,20 +607,6 @@ int pvr2_buffer_queue(struct pvr2_buffer *bp)
620 return ret; 607 return ret;
621} 608}
622 609
623int pvr2_buffer_idle(struct pvr2_buffer *bp)
624{
625 struct pvr2_stream *sp;
626 if (!bp) return -EINVAL;
627 sp = bp->stream;
628 mutex_lock(&sp->mutex); do {
629 pvr2_buffer_wipe(bp);
630 pvr2_buffer_set_idle(bp);
631 if (sp->buffer_total_count != sp->buffer_target_count) {
632 pvr2_stream_achieve_buffer_count(sp);
633 }
634 } while(0); mutex_unlock(&sp->mutex);
635 return 0;
636}
637 610
638int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt) 611int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt)
639{ 612{
@@ -673,10 +646,6 @@ int pvr2_buffer_get_status(struct pvr2_buffer *bp)
673 return bp->status; 646 return bp->status;
674} 647}
675 648
676enum pvr2_buffer_state pvr2_buffer_get_state(struct pvr2_buffer *bp)
677{
678 return bp->state;
679}
680 649
681int pvr2_buffer_get_id(struct pvr2_buffer *bp) 650int pvr2_buffer_get_id(struct pvr2_buffer *bp)
682{ 651{
diff --git a/drivers/media/video/pvrusb2/pvrusb2-io.h b/drivers/media/video/pvrusb2/pvrusb2-io.h
index 65e11385b2b3..96285ad234a6 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-io.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-io.h
@@ -36,8 +36,6 @@ enum pvr2_buffer_state {
36struct pvr2_stream; 36struct pvr2_stream;
37struct pvr2_buffer; 37struct pvr2_buffer;
38 38
39const char *pvr2_buffer_state_decode(enum pvr2_buffer_state);
40
41/* Initialize / tear down stream structure */ 39/* Initialize / tear down stream structure */
42struct pvr2_stream *pvr2_stream_create(void); 40struct pvr2_stream *pvr2_stream_create(void);
43void pvr2_stream_destroy(struct pvr2_stream *); 41void pvr2_stream_destroy(struct pvr2_stream *);
@@ -49,7 +47,6 @@ void pvr2_stream_set_callback(struct pvr2_stream *,
49 void *data); 47 void *data);
50 48
51/* Query / set the nominal buffer count */ 49/* Query / set the nominal buffer count */
52int pvr2_stream_get_buffer_count(struct pvr2_stream *);
53int pvr2_stream_set_buffer_count(struct pvr2_stream *,unsigned int); 50int pvr2_stream_set_buffer_count(struct pvr2_stream *,unsigned int);
54 51
55/* Get a pointer to a buffer that is either idle, ready, or is specified 52/* Get a pointer to a buffer that is either idle, ready, or is specified
@@ -59,12 +56,8 @@ struct pvr2_buffer *pvr2_stream_get_ready_buffer(struct pvr2_stream *);
59struct pvr2_buffer *pvr2_stream_get_buffer(struct pvr2_stream *sp,int id); 56struct pvr2_buffer *pvr2_stream_get_buffer(struct pvr2_stream *sp,int id);
60 57
61/* Find out how many buffers are idle or ready */ 58/* Find out how many buffers are idle or ready */
62int pvr2_stream_get_idle_count(struct pvr2_stream *);
63int pvr2_stream_get_ready_count(struct pvr2_stream *); 59int pvr2_stream_get_ready_count(struct pvr2_stream *);
64 60
65/* Kill all pending operations */
66void pvr2_stream_flush(struct pvr2_stream *);
67
68/* Kill all pending buffers and throw away any ready buffers as well */ 61/* Kill all pending buffers and throw away any ready buffers as well */
69void pvr2_stream_kill(struct pvr2_stream *); 62void pvr2_stream_kill(struct pvr2_stream *);
70 63
@@ -77,18 +70,12 @@ unsigned int pvr2_buffer_get_count(struct pvr2_buffer *);
77/* Retrieve completion code for given ready buffer */ 70/* Retrieve completion code for given ready buffer */
78int pvr2_buffer_get_status(struct pvr2_buffer *); 71int pvr2_buffer_get_status(struct pvr2_buffer *);
79 72
80/* Retrieve state of given buffer */
81enum pvr2_buffer_state pvr2_buffer_get_state(struct pvr2_buffer *);
82
83/* Retrieve ID of given buffer */ 73/* Retrieve ID of given buffer */
84int pvr2_buffer_get_id(struct pvr2_buffer *); 74int pvr2_buffer_get_id(struct pvr2_buffer *);
85 75
86/* Start reading into given buffer (kill it if needed) */ 76/* Start reading into given buffer (kill it if needed) */
87int pvr2_buffer_queue(struct pvr2_buffer *); 77int pvr2_buffer_queue(struct pvr2_buffer *);
88 78
89/* Move buffer back to idle pool (kill it if needed) */
90int pvr2_buffer_idle(struct pvr2_buffer *);
91
92#endif /* __PVRUSB2_IO_H */ 79#endif /* __PVRUSB2_IO_H */
93 80
94/* 81/*
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ioread.c b/drivers/media/video/pvrusb2/pvrusb2-ioread.c
index 49da062e3271..f7a2e225a002 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-ioread.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-ioread.c
@@ -54,7 +54,7 @@ static int pvr2_ioread_init(struct pvr2_ioread *cp)
54{ 54{
55 unsigned int idx; 55 unsigned int idx;
56 56
57 cp->stream = 0; 57 cp->stream = NULL;
58 mutex_init(&cp->mutex); 58 mutex_init(&cp->mutex);
59 59
60 for (idx = 0; idx < BUFFER_COUNT; idx++) { 60 for (idx = 0; idx < BUFFER_COUNT; idx++) {
@@ -77,7 +77,7 @@ static void pvr2_ioread_done(struct pvr2_ioread *cp)
77{ 77{
78 unsigned int idx; 78 unsigned int idx;
79 79
80 pvr2_ioread_setup(cp,0); 80 pvr2_ioread_setup(cp,NULL);
81 for (idx = 0; idx < BUFFER_COUNT; idx++) { 81 for (idx = 0; idx < BUFFER_COUNT; idx++) {
82 if (!(cp->buffer_storage[idx])) continue; 82 if (!(cp->buffer_storage[idx])) continue;
83 kfree(cp->buffer_storage[idx]); 83 kfree(cp->buffer_storage[idx]);
@@ -88,12 +88,12 @@ struct pvr2_ioread *pvr2_ioread_create(void)
88{ 88{
89 struct pvr2_ioread *cp; 89 struct pvr2_ioread *cp;
90 cp = kmalloc(sizeof(*cp),GFP_KERNEL); 90 cp = kmalloc(sizeof(*cp),GFP_KERNEL);
91 if (!cp) return 0; 91 if (!cp) return NULL;
92 pvr2_trace(PVR2_TRACE_STRUCT,"pvr2_ioread_create id=%p",cp); 92 pvr2_trace(PVR2_TRACE_STRUCT,"pvr2_ioread_create id=%p",cp);
93 memset(cp,0,sizeof(*cp)); 93 memset(cp,0,sizeof(*cp));
94 if (pvr2_ioread_init(cp) < 0) { 94 if (pvr2_ioread_init(cp) < 0) {
95 kfree(cp); 95 kfree(cp);
96 return 0; 96 return NULL;
97 } 97 }
98 return cp; 98 return cp;
99} 99}
@@ -105,7 +105,7 @@ void pvr2_ioread_destroy(struct pvr2_ioread *cp)
105 pvr2_trace(PVR2_TRACE_STRUCT,"pvr2_ioread_destroy id=%p",cp); 105 pvr2_trace(PVR2_TRACE_STRUCT,"pvr2_ioread_destroy id=%p",cp);
106 if (cp->sync_key_ptr) { 106 if (cp->sync_key_ptr) {
107 kfree(cp->sync_key_ptr); 107 kfree(cp->sync_key_ptr);
108 cp->sync_key_ptr = 0; 108 cp->sync_key_ptr = NULL;
109 } 109 }
110 kfree(cp); 110 kfree(cp);
111} 111}
@@ -124,7 +124,7 @@ void pvr2_ioread_set_sync_key(struct pvr2_ioread *cp,
124 if (sync_key_len != cp->sync_key_len) { 124 if (sync_key_len != cp->sync_key_len) {
125 if (cp->sync_key_ptr) { 125 if (cp->sync_key_ptr) {
126 kfree(cp->sync_key_ptr); 126 kfree(cp->sync_key_ptr);
127 cp->sync_key_ptr = 0; 127 cp->sync_key_ptr = NULL;
128 } 128 }
129 cp->sync_key_len = 0; 129 cp->sync_key_len = 0;
130 if (sync_key_len) { 130 if (sync_key_len) {
@@ -144,8 +144,8 @@ static void pvr2_ioread_stop(struct pvr2_ioread *cp)
144 pvr2_trace(PVR2_TRACE_START_STOP, 144 pvr2_trace(PVR2_TRACE_START_STOP,
145 "/*---TRACE_READ---*/ pvr2_ioread_stop id=%p",cp); 145 "/*---TRACE_READ---*/ pvr2_ioread_stop id=%p",cp);
146 pvr2_stream_kill(cp->stream); 146 pvr2_stream_kill(cp->stream);
147 cp->c_buf = 0; 147 cp->c_buf = NULL;
148 cp->c_data_ptr = 0; 148 cp->c_data_ptr = NULL;
149 cp->c_data_len = 0; 149 cp->c_data_len = 0;
150 cp->c_data_offs = 0; 150 cp->c_data_offs = 0;
151 cp->enabled = 0; 151 cp->enabled = 0;
@@ -179,8 +179,8 @@ static int pvr2_ioread_start(struct pvr2_ioread *cp)
179 } 179 }
180 } 180 }
181 cp->enabled = !0; 181 cp->enabled = !0;
182 cp->c_buf = 0; 182 cp->c_buf = NULL;
183 cp->c_data_ptr = 0; 183 cp->c_data_ptr = NULL;
184 cp->c_data_len = 0; 184 cp->c_data_len = 0;
185 cp->c_data_offs = 0; 185 cp->c_data_offs = 0;
186 cp->stream_running = 0; 186 cp->stream_running = 0;
@@ -214,7 +214,7 @@ int pvr2_ioread_setup(struct pvr2_ioread *cp,struct pvr2_stream *sp)
214 pvr2_ioread_stop(cp); 214 pvr2_ioread_stop(cp);
215 pvr2_stream_kill(cp->stream); 215 pvr2_stream_kill(cp->stream);
216 pvr2_stream_set_buffer_count(cp->stream,0); 216 pvr2_stream_set_buffer_count(cp->stream,0);
217 cp->stream = 0; 217 cp->stream = NULL;
218 } 218 }
219 if (sp) { 219 if (sp) {
220 pvr2_trace(PVR2_TRACE_START_STOP, 220 pvr2_trace(PVR2_TRACE_START_STOP,
@@ -251,12 +251,8 @@ int pvr2_ioread_set_enabled(struct pvr2_ioread *cp,int fl)
251 return ret; 251 return ret;
252} 252}
253 253
254int pvr2_ioread_get_enabled(struct pvr2_ioread *cp)
255{
256 return cp->enabled != 0;
257}
258 254
259int pvr2_ioread_get_buffer(struct pvr2_ioread *cp) 255static int pvr2_ioread_get_buffer(struct pvr2_ioread *cp)
260{ 256{
261 int stat; 257 int stat;
262 258
@@ -274,8 +270,8 @@ int pvr2_ioread_get_buffer(struct pvr2_ioread *cp)
274 pvr2_ioread_stop(cp); 270 pvr2_ioread_stop(cp);
275 return 0; 271 return 0;
276 } 272 }
277 cp->c_buf = 0; 273 cp->c_buf = NULL;
278 cp->c_data_ptr = 0; 274 cp->c_data_ptr = NULL;
279 cp->c_data_len = 0; 275 cp->c_data_len = 0;
280 cp->c_data_offs = 0; 276 cp->c_data_offs = 0;
281 } 277 }
@@ -307,7 +303,7 @@ int pvr2_ioread_get_buffer(struct pvr2_ioread *cp)
307 return !0; 303 return !0;
308} 304}
309 305
310void pvr2_ioread_filter(struct pvr2_ioread *cp) 306static void pvr2_ioread_filter(struct pvr2_ioread *cp)
311{ 307{
312 unsigned int idx; 308 unsigned int idx;
313 if (!cp->enabled) return; 309 if (!cp->enabled) return;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ioread.h b/drivers/media/video/pvrusb2/pvrusb2-ioread.h
index 6b002597f5de..1d362f833588 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-ioread.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-ioread.h
@@ -33,7 +33,6 @@ void pvr2_ioread_set_sync_key(struct pvr2_ioread *,
33 const char *sync_key_ptr, 33 const char *sync_key_ptr,
34 unsigned int sync_key_len); 34 unsigned int sync_key_len);
35int pvr2_ioread_set_enabled(struct pvr2_ioread *,int fl); 35int pvr2_ioread_set_enabled(struct pvr2_ioread *,int fl);
36int pvr2_ioread_get_enabled(struct pvr2_ioread *);
37int pvr2_ioread_read(struct pvr2_ioread *,void __user *buf,unsigned int cnt); 36int pvr2_ioread_read(struct pvr2_ioread *,void __user *buf,unsigned int cnt);
38int pvr2_ioread_avail(struct pvr2_ioread *); 37int pvr2_ioread_avail(struct pvr2_ioread *);
39 38
diff --git a/drivers/media/video/pvrusb2/pvrusb2-main.c b/drivers/media/video/pvrusb2/pvrusb2-main.c
index b95248274ed0..8f1a5afdd34e 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-main.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-main.c
@@ -54,7 +54,7 @@ module_param_named(debug,pvrusb2_debug,int,S_IRUGO|S_IWUSR);
54MODULE_PARM_DESC(debug, "Debug trace mask"); 54MODULE_PARM_DESC(debug, "Debug trace mask");
55 55
56#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS 56#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS
57static struct pvr2_sysfs_class *class_ptr = 0; 57static struct pvr2_sysfs_class *class_ptr = NULL;
58#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */ 58#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */
59 59
60static void pvr_setup_attach(struct pvr2_context *pvr) 60static void pvr_setup_attach(struct pvr2_context *pvr)
@@ -104,10 +104,10 @@ static void pvr_disconnect(struct usb_interface *intf)
104} 104}
105 105
106static struct usb_driver pvr_driver = { 106static struct usb_driver pvr_driver = {
107 name: "pvrusb2", 107 .name = "pvrusb2",
108 id_table: pvr2_device_table, 108 .id_table = pvr2_device_table,
109 probe: pvr_probe, 109 .probe = pvr_probe,
110 disconnect: pvr_disconnect 110 .disconnect = pvr_disconnect
111}; 111};
112 112
113/* 113/*
diff --git a/drivers/media/video/pvrusb2/pvrusb2-std.c b/drivers/media/video/pvrusb2/pvrusb2-std.c
index 134063693643..f95c598ff627 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-std.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-std.c
@@ -121,7 +121,7 @@ static const struct std_name *find_std_name(const struct std_name *arrPtr,
121 if (strlen(p->name) != bufSize) continue; 121 if (strlen(p->name) != bufSize) continue;
122 if (!memcmp(bufPtr,p->name,bufSize)) return p; 122 if (!memcmp(bufPtr,p->name,bufSize)) return p;
123 } 123 }
124 return 0; 124 return NULL;
125} 125}
126 126
127 127
@@ -289,7 +289,7 @@ static struct v4l2_standard *match_std(v4l2_std_id id)
289 return generic_standards + idx; 289 return generic_standards + idx;
290 } 290 }
291 } 291 }
292 return 0; 292 return NULL;
293} 293}
294 294
295static int pvr2_std_fill(struct v4l2_standard *std,v4l2_std_id id) 295static int pvr2_std_fill(struct v4l2_standard *std,v4l2_std_id id)
@@ -364,7 +364,7 @@ struct v4l2_standard *pvr2_std_create_enum(unsigned int *countptr,
364 364
365 pvr2_trace(PVR2_TRACE_INIT,"Setting up %u unique standard(s)", 365 pvr2_trace(PVR2_TRACE_INIT,"Setting up %u unique standard(s)",
366 std_cnt); 366 std_cnt);
367 if (!std_cnt) return 0; // paranoia 367 if (!std_cnt) return NULL; // paranoia
368 368
369 stddefs = kmalloc(sizeof(struct v4l2_standard) * std_cnt, 369 stddefs = kmalloc(sizeof(struct v4l2_standard) * std_cnt,
370 GFP_KERNEL); 370 GFP_KERNEL);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
index c6e6523d74b4..6af55a8b6f05 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
@@ -504,7 +504,7 @@ static void pvr2_sysfs_add_control(struct pvr2_sysfs *sfp,int ctl_id)
504 cip->cptr = cptr; 504 cip->cptr = cptr;
505 505
506 cip->chptr = sfp; 506 cip->chptr = sfp;
507 cip->item_next = 0; 507 cip->item_next = NULL;
508 if (sfp->item_last) { 508 if (sfp->item_last) {
509 sfp->item_last->item_next = cip; 509 sfp->item_last->item_next = cip;
510 } else { 510 } else {
@@ -625,7 +625,7 @@ static void pvr2_sysfs_tear_down_debugifc(struct pvr2_sysfs *sfp)
625 &sfp->debugifc->attr_debuginfo); 625 &sfp->debugifc->attr_debuginfo);
626 class_device_remove_file(sfp->class_dev,&sfp->debugifc->attr_debugcmd); 626 class_device_remove_file(sfp->class_dev,&sfp->debugifc->attr_debugcmd);
627 kfree(sfp->debugifc); 627 kfree(sfp->debugifc);
628 sfp->debugifc = 0; 628 sfp->debugifc = NULL;
629} 629}
630#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ 630#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */
631 631
@@ -678,9 +678,9 @@ static void class_dev_destroy(struct pvr2_sysfs *sfp)
678 class_device_remove_file(sfp->class_dev,&sfp->attr_v4l_minor_number); 678 class_device_remove_file(sfp->class_dev,&sfp->attr_v4l_minor_number);
679 class_device_remove_file(sfp->class_dev,&sfp->attr_unit_number); 679 class_device_remove_file(sfp->class_dev,&sfp->attr_unit_number);
680 pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev); 680 pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev);
681 sfp->class_dev->class_data = 0; 681 sfp->class_dev->class_data = NULL;
682 class_device_unregister(sfp->class_dev); 682 class_device_unregister(sfp->class_dev);
683 sfp->class_dev = 0; 683 sfp->class_dev = NULL;
684} 684}
685 685
686 686
@@ -739,13 +739,13 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
739 sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number"; 739 sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number";
740 sfp->attr_v4l_minor_number.attr.mode = S_IRUGO; 740 sfp->attr_v4l_minor_number.attr.mode = S_IRUGO;
741 sfp->attr_v4l_minor_number.show = v4l_minor_number_show; 741 sfp->attr_v4l_minor_number.show = v4l_minor_number_show;
742 sfp->attr_v4l_minor_number.store = 0; 742 sfp->attr_v4l_minor_number.store = NULL;
743 class_device_create_file(sfp->class_dev,&sfp->attr_v4l_minor_number); 743 class_device_create_file(sfp->class_dev,&sfp->attr_v4l_minor_number);
744 sfp->attr_unit_number.attr.owner = THIS_MODULE; 744 sfp->attr_unit_number.attr.owner = THIS_MODULE;
745 sfp->attr_unit_number.attr.name = "unit_number"; 745 sfp->attr_unit_number.attr.name = "unit_number";
746 sfp->attr_unit_number.attr.mode = S_IRUGO; 746 sfp->attr_unit_number.attr.mode = S_IRUGO;
747 sfp->attr_unit_number.show = unit_number_show; 747 sfp->attr_unit_number.show = unit_number_show;
748 sfp->attr_unit_number.store = 0; 748 sfp->attr_unit_number.store = NULL;
749 class_device_create_file(sfp->class_dev,&sfp->attr_unit_number); 749 class_device_create_file(sfp->class_dev,&sfp->attr_unit_number);
750 750
751 pvr2_sysfs_add_controls(sfp); 751 pvr2_sysfs_add_controls(sfp);
@@ -806,7 +806,7 @@ struct pvr2_sysfs_class *pvr2_sysfs_class_create(void)
806 pvr2_sysfs_trace( 806 pvr2_sysfs_trace(
807 "Registration failed for pvr2_sysfs_class id=%p",clp); 807 "Registration failed for pvr2_sysfs_class id=%p",clp);
808 kfree(clp); 808 kfree(clp);
809 clp = 0; 809 clp = NULL;
810 } 810 }
811 return clp; 811 return clp;
812} 812}
diff --git a/drivers/media/video/pvrusb2/pvrusb2-tuner.c b/drivers/media/video/pvrusb2/pvrusb2-tuner.c
index f4aba8144ce0..af9f246f8d3f 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-tuner.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-tuner.c
@@ -69,7 +69,7 @@ static void tuner_update(struct pvr2_tuner_handler *ctxt)
69 69
70static void pvr2_tuner_detach(struct pvr2_tuner_handler *ctxt) 70static void pvr2_tuner_detach(struct pvr2_tuner_handler *ctxt)
71{ 71{
72 ctxt->client->handler = 0; 72 ctxt->client->handler = NULL;
73 kfree(ctxt); 73 kfree(ctxt);
74} 74}
75 75
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index 961951010c27..0caf70b8c0de 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -81,7 +81,7 @@ static int video_nr[PVR_NUM] = {[0 ... PVR_NUM-1] = -1};
81module_param_array(video_nr, int, NULL, 0444); 81module_param_array(video_nr, int, NULL, 0444);
82MODULE_PARM_DESC(video_nr, "Offset for device's minor"); 82MODULE_PARM_DESC(video_nr, "Offset for device's minor");
83 83
84struct v4l2_capability pvr_capability ={ 84static struct v4l2_capability pvr_capability ={
85 .driver = "pvrusb2", 85 .driver = "pvrusb2",
86 .card = "Hauppauge WinTV pvr-usb2", 86 .card = "Hauppauge WinTV pvr-usb2",
87 .bus_info = "usb", 87 .bus_info = "usb",
@@ -111,7 +111,7 @@ static struct v4l2_tuner pvr_v4l2_tuners[]= {
111 } 111 }
112}; 112};
113 113
114struct v4l2_fmtdesc pvr_fmtdesc [] = { 114static struct v4l2_fmtdesc pvr_fmtdesc [] = {
115 { 115 {
116 .index = 0, 116 .index = 0,
117 .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, 117 .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
@@ -127,7 +127,7 @@ struct v4l2_fmtdesc pvr_fmtdesc [] = {
127#define PVR_FORMAT_PIX 0 127#define PVR_FORMAT_PIX 0
128#define PVR_FORMAT_VBI 1 128#define PVR_FORMAT_VBI 1
129 129
130struct v4l2_format pvr_format [] = { 130static struct v4l2_format pvr_format [] = {
131 [PVR_FORMAT_PIX] = { 131 [PVR_FORMAT_PIX] = {
132 .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, 132 .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
133 .fmt = { 133 .fmt = {
@@ -701,9 +701,8 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
701 701
702static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip) 702static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip)
703{ 703{
704 pvr2_trace(PVR2_TRACE_INIT, 704 printk(KERN_INFO "pvrusb2: unregistering device video%d [%s]\n",
705 "unregistering device video%d [%s]", 705 dip->vdev->minor,pvr2_config_get_name(dip->config));
706 dip->vdev->minor,pvr2_config_get_name(dip->config));
707 if (dip->ctxt_idx >= 0) { 706 if (dip->ctxt_idx >= 0) {
708 mutex_lock(&device_lock); 707 mutex_lock(&device_lock);
709 devices[dip->ctxt_idx] = NULL; 708 devices[dip->ctxt_idx] = NULL;
@@ -725,7 +724,7 @@ static void pvr2_v4l2_destroy_no_lock(struct pvr2_v4l2 *vp)
725} 724}
726 725
727 726
728void pvr2_v4l2_internal_check(struct pvr2_channel *chp) 727static void pvr2_v4l2_internal_check(struct pvr2_channel *chp)
729{ 728{
730 struct pvr2_v4l2 *vp; 729 struct pvr2_v4l2 *vp;
731 vp = container_of(chp,struct pvr2_v4l2,channel); 730 vp = container_of(chp,struct pvr2_v4l2,channel);
@@ -735,8 +734,8 @@ void pvr2_v4l2_internal_check(struct pvr2_channel *chp)
735} 734}
736 735
737 736
738int pvr2_v4l2_ioctl(struct inode *inode, struct file *file, 737static int pvr2_v4l2_ioctl(struct inode *inode, struct file *file,
739 unsigned int cmd, unsigned long arg) 738 unsigned int cmd, unsigned long arg)
740{ 739{
741 740
742/* Temporary hack : use ivtv api until a v4l2 one is available. */ 741/* Temporary hack : use ivtv api until a v4l2 one is available. */
@@ -747,7 +746,7 @@ int pvr2_v4l2_ioctl(struct inode *inode, struct file *file,
747} 746}
748 747
749 748
750int pvr2_v4l2_release(struct inode *inode, struct file *file) 749static int pvr2_v4l2_release(struct inode *inode, struct file *file)
751{ 750{
752 struct pvr2_v4l2_fh *fhp = file->private_data; 751 struct pvr2_v4l2_fh *fhp = file->private_data;
753 struct pvr2_v4l2 *vp = fhp->vhead; 752 struct pvr2_v4l2 *vp = fhp->vhead;
@@ -761,9 +760,9 @@ int pvr2_v4l2_release(struct inode *inode, struct file *file)
761 hdw = fhp->channel.mc_head->hdw; 760 hdw = fhp->channel.mc_head->hdw;
762 pvr2_hdw_set_streaming(hdw,0); 761 pvr2_hdw_set_streaming(hdw,0);
763 sp = pvr2_ioread_get_stream(fhp->rhp); 762 sp = pvr2_ioread_get_stream(fhp->rhp);
764 if (sp) pvr2_stream_set_callback(sp,0,0); 763 if (sp) pvr2_stream_set_callback(sp,NULL,NULL);
765 pvr2_ioread_destroy(fhp->rhp); 764 pvr2_ioread_destroy(fhp->rhp);
766 fhp->rhp = 0; 765 fhp->rhp = NULL;
767 } 766 }
768 v4l2_prio_close(&vp->prio, &fhp->prio); 767 v4l2_prio_close(&vp->prio, &fhp->prio);
769 file->private_data = NULL; 768 file->private_data = NULL;
@@ -779,9 +778,9 @@ int pvr2_v4l2_release(struct inode *inode, struct file *file)
779 } else { 778 } else {
780 vp->vfirst = fhp->vnext; 779 vp->vfirst = fhp->vnext;
781 } 780 }
782 fhp->vnext = 0; 781 fhp->vnext = NULL;
783 fhp->vprev = 0; 782 fhp->vprev = NULL;
784 fhp->vhead = 0; 783 fhp->vhead = NULL;
785 pvr2_channel_done(&fhp->channel); 784 pvr2_channel_done(&fhp->channel);
786 pvr2_trace(PVR2_TRACE_STRUCT, 785 pvr2_trace(PVR2_TRACE_STRUCT,
787 "Destroying pvr_v4l2_fh id=%p",fhp); 786 "Destroying pvr_v4l2_fh id=%p",fhp);
@@ -794,9 +793,9 @@ int pvr2_v4l2_release(struct inode *inode, struct file *file)
794} 793}
795 794
796 795
797int pvr2_v4l2_open(struct inode *inode, struct file *file) 796static int pvr2_v4l2_open(struct inode *inode, struct file *file)
798{ 797{
799 struct pvr2_v4l2_dev *dip = 0; /* Our own context pointer */ 798 struct pvr2_v4l2_dev *dip = NULL; /* Our own context pointer */
800 struct pvr2_v4l2_fh *fhp; 799 struct pvr2_v4l2_fh *fhp;
801 struct pvr2_v4l2 *vp; 800 struct pvr2_v4l2 *vp;
802 struct pvr2_hdw *hdw; 801 struct pvr2_hdw *hdw;
@@ -854,7 +853,7 @@ int pvr2_v4l2_open(struct inode *inode, struct file *file)
854 pvr2_context_enter(vp->channel.mc_head); do { 853 pvr2_context_enter(vp->channel.mc_head); do {
855 pvr2_trace(PVR2_TRACE_STRUCT,"Creating pvr_v4l2_fh id=%p",fhp); 854 pvr2_trace(PVR2_TRACE_STRUCT,"Creating pvr_v4l2_fh id=%p",fhp);
856 pvr2_channel_init(&fhp->channel,vp->channel.mc_head); 855 pvr2_channel_init(&fhp->channel,vp->channel.mc_head);
857 fhp->vnext = 0; 856 fhp->vnext = NULL;
858 fhp->vprev = vp->vlast; 857 fhp->vprev = vp->vlast;
859 if (vp->vlast) { 858 if (vp->vlast) {
860 vp->vlast->vnext = fhp; 859 vp->vlast->vnext = fhp;
@@ -897,7 +896,7 @@ static int pvr2_v4l2_iosetup(struct pvr2_v4l2_fh *fh)
897 896
898 fh->rhp = pvr2_channel_create_mpeg_stream(fh->dev_info->stream); 897 fh->rhp = pvr2_channel_create_mpeg_stream(fh->dev_info->stream);
899 if (!fh->rhp) { 898 if (!fh->rhp) {
900 pvr2_channel_claim_stream(&fh->channel,0); 899 pvr2_channel_claim_stream(&fh->channel,NULL);
901 return -ENOMEM; 900 return -ENOMEM;
902 } 901 }
903 902
@@ -1078,9 +1077,8 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip,
1078 (video_register_device(dip->vdev, v4l_type, -1) < 0)) { 1077 (video_register_device(dip->vdev, v4l_type, -1) < 0)) {
1079 err("Failed to register pvrusb2 v4l video device"); 1078 err("Failed to register pvrusb2 v4l video device");
1080 } else { 1079 } else {
1081 pvr2_trace(PVR2_TRACE_INIT, 1080 printk(KERN_INFO "pvrusb2: registered device video%d [%s]\n",
1082 "registered device video%d [%s]", 1081 dip->vdev->minor,pvr2_config_get_name(dip->config));
1083 dip->vdev->minor,pvr2_config_get_name(dip->config));
1084 } 1082 }
1085 1083
1086 if ((dip->vdev->minor < sizeof(devices)/sizeof(devices[0])) && 1084 if ((dip->vdev->minor < sizeof(devices)/sizeof(devices[0])) &&
diff --git a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
index e4ec7f25194c..05f2cddeb47b 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
@@ -126,8 +126,8 @@ static const struct pvr2_v4l_decoder_ops decoder_ops[] = {
126 126
127static void decoder_detach(struct pvr2_v4l_decoder *ctxt) 127static void decoder_detach(struct pvr2_v4l_decoder *ctxt)
128{ 128{
129 ctxt->client->handler = 0; 129 ctxt->client->handler = NULL;
130 ctxt->hdw->decoder_ctrl = 0; 130 ctxt->hdw->decoder_ctrl = NULL;
131 kfree(ctxt); 131 kfree(ctxt);
132} 132}
133 133
diff --git a/drivers/media/video/pvrusb2/pvrusb2-wm8775.c b/drivers/media/video/pvrusb2/pvrusb2-wm8775.c
index fcad346e3955..2413e5198e16 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-wm8775.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-wm8775.c
@@ -89,7 +89,7 @@ static unsigned int wm8775_describe(struct pvr2_v4l_wm8775 *ctxt,
89 89
90static void wm8775_detach(struct pvr2_v4l_wm8775 *ctxt) 90static void wm8775_detach(struct pvr2_v4l_wm8775 *ctxt)
91{ 91{
92 ctxt->client->handler = 0; 92 ctxt->client->handler = NULL;
93 kfree(ctxt); 93 kfree(ctxt);
94} 94}
95 95
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index da3007d2f411..2cd73c980533 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -942,8 +942,6 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
942 /* load i2c helpers */ 942 /* load i2c helpers */
943 if (TUNER_ABSENT != dev->tuner_type) 943 if (TUNER_ABSENT != dev->tuner_type)
944 request_module("tuner"); 944 request_module("tuner");
945 if (dev->tda9887_conf)
946 request_module("tda9887");
947 if (card_is_empress(dev)) { 945 if (card_is_empress(dev)) {
948 request_module("saa6752hs"); 946 request_module("saa6752hs");
949 request_module_depend("saa7134-empress",&need_empress); 947 request_module_depend("saa7134-empress",&need_empress);
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index 2fadabf99688..8dab481d384a 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -590,8 +590,8 @@ int tda9887_tuner_init(struct i2c_client *c)
590 t->set_tv_freq = tda9887_set_freq; 590 t->set_tv_freq = tda9887_set_freq;
591 t->set_radio_freq = tda9887_set_freq; 591 t->set_radio_freq = tda9887_set_freq;
592 t->standby = tda9887_standby; 592 t->standby = tda9887_standby;
593 t->tuner_status=tda9887_tuner_status; 593 t->tuner_status = tda9887_tuner_status;
594 t->get_afc=tda9887_get_afc; 594 t->get_afc = tda9887_get_afc;
595 595
596 return 0; 596 return 0;
597} 597}
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 011413cf34a8..f7eb402d5f2b 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -416,7 +416,7 @@ static void tuner_status(struct i2c_client *client)
416 416
417/* ---------------------------------------------------------------------- */ 417/* ---------------------------------------------------------------------- */
418 418
419/* static var Used only in tuner_attach and tuner_probe */ 419/* static vars: used only in tuner_attach and tuner_probe */
420static unsigned default_mode_mask; 420static unsigned default_mode_mask;
421 421
422/* During client attach, set_type is called by adapter's attach_inform callback. 422/* During client attach, set_type is called by adapter's attach_inform callback.
@@ -608,13 +608,13 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
608 tuner_dbg("VIDIOCSAUDIO not implemented.\n"); 608 tuner_dbg("VIDIOCSAUDIO not implemented.\n");
609 break; 609 break;
610 case TDA9887_SET_CONFIG: 610 case TDA9887_SET_CONFIG:
611 { 611 if (t->type == TUNER_TDA9887) {
612 int *i = arg; 612 int *i = arg;
613 613
614 t->tda9887_config = *i; 614 t->tda9887_config = *i;
615 set_freq(client, t->tv_freq); 615 set_freq(client, t->tv_freq);
616 }
616 break; 617 break;
617 }
618 /* --- v4l ioctls --- */ 618 /* --- v4l ioctls --- */
619 /* take care: bttv does userspace copying, we'll get a 619 /* take care: bttv does userspace copying, we'll get a
620 kernel pointer here... */ 620 kernel pointer here... */
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index 6da6f82b8c88..d071c5cbf013 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -7,6 +7,7 @@
7#include <linux/i2c.h> 7#include <linux/i2c.h>
8#include <linux/videodev.h> 8#include <linux/videodev.h>
9#include <media/tuner.h> 9#include <media/tuner.h>
10#include <media/v4l2-common.h>
10 11
11static int offset = 0; 12static int offset = 0;
12module_param(offset, int, 0666); 13module_param(offset, int, 0666);
@@ -128,6 +129,7 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
128 u8 buffer[4]; 129 u8 buffer[4];
129 int rc, IFPCoff, i, j; 130 int rc, IFPCoff, i, j;
130 enum param_type desired_type; 131 enum param_type desired_type;
132 struct tuner_params *params;
131 133
132 tun = &tuners[t->type]; 134 tun = &tuners[t->type];
133 135
@@ -169,19 +171,20 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
169 IFPCoff,t->type); 171 IFPCoff,t->type);
170 j = 0; 172 j = 0;
171 } 173 }
174 params = &tun->params[j];
172 175
173 for (i = 0; i < tun->params[j].count; i++) { 176 for (i = 0; i < params->count; i++) {
174 if (freq > tun->params[j].ranges[i].limit) 177 if (freq > params->ranges[i].limit)
175 continue; 178 continue;
176 break; 179 break;
177 } 180 }
178 if (i == tun->params[j].count) { 181 if (i == params->count) {
179 tuner_dbg("TV frequency out of range (%d > %d)", 182 tuner_dbg("TV frequency out of range (%d > %d)",
180 freq, tun->params[j].ranges[i - 1].limit); 183 freq, params->ranges[i - 1].limit);
181 freq = tun->params[j].ranges[--i].limit; 184 freq = params->ranges[--i].limit;
182 } 185 }
183 config = tun->params[j].ranges[i].config; 186 config = params->ranges[i].config;
184 cb = tun->params[j].ranges[i].cb; 187 cb = params->ranges[i].cb;
185 /* i == 0 -> VHF_LO 188 /* i == 0 -> VHF_LO
186 * i == 1 -> VHF_HI 189 * i == 1 -> VHF_HI
187 * i == 2 -> UHF */ 190 * i == 2 -> UHF */
@@ -281,7 +284,7 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
281 break; 284 break;
282 } 285 }
283 286
284 if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) { 287 if (params->cb_first_if_lower_freq && div < t->last_div) {
285 buffer[0] = config; 288 buffer[0] = config;
286 buffer[1] = cb; 289 buffer[1] = cb;
287 buffer[2] = (div>>8) & 0x7f; 290 buffer[2] = (div>>8) & 0x7f;
@@ -293,6 +296,43 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
293 buffer[3] = cb; 296 buffer[3] = cb;
294 } 297 }
295 t->last_div = div; 298 t->last_div = div;
299 if (params->has_tda9887) {
300 int config = 0;
301 int is_secam_l = (t->std & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC)) &&
302 !(t->std & ~(V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC));
303
304 if (t->std == V4L2_STD_SECAM_LC) {
305 if (params->port1_active ^ params->port1_invert_for_secam_lc)
306 config |= TDA9887_PORT1_ACTIVE;
307 if (params->port2_active ^ params->port2_invert_for_secam_lc)
308 config |= TDA9887_PORT2_ACTIVE;
309 }
310 else {
311 if (params->port1_active)
312 config |= TDA9887_PORT1_ACTIVE;
313 if (params->port2_active)
314 config |= TDA9887_PORT2_ACTIVE;
315 }
316 if (params->intercarrier_mode)
317 config |= TDA9887_INTERCARRIER;
318 if (is_secam_l) {
319 if (i == 0 && params->default_top_secam_low)
320 config |= TDA9887_TOP(params->default_top_secam_low);
321 else if (i == 1 && params->default_top_secam_mid)
322 config |= TDA9887_TOP(params->default_top_secam_mid);
323 else if (params->default_top_secam_high)
324 config |= TDA9887_TOP(params->default_top_secam_high);
325 }
326 else {
327 if (i == 0 && params->default_top_low)
328 config |= TDA9887_TOP(params->default_top_low);
329 else if (i == 1 && params->default_top_mid)
330 config |= TDA9887_TOP(params->default_top_mid);
331 else if (params->default_top_high)
332 config |= TDA9887_TOP(params->default_top_high);
333 }
334 i2c_clients_command(c->adapter, TDA9887_SET_CONFIG, &config);
335 }
296 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", 336 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n",
297 buffer[0],buffer[1],buffer[2],buffer[3]); 337 buffer[0],buffer[1],buffer[2],buffer[3]);
298 338
@@ -339,6 +379,7 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
339 u16 div; 379 u16 div;
340 int rc, j; 380 int rc, j;
341 enum param_type desired_type = TUNER_PARAM_TYPE_RADIO; 381 enum param_type desired_type = TUNER_PARAM_TYPE_RADIO;
382 struct tuner_params *params;
342 383
343 tun = &tuners[t->type]; 384 tun = &tuners[t->type];
344 385
@@ -352,7 +393,8 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
352 j = 0; 393 j = 0;
353 394
354 div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */ 395 div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */
355 buffer[2] = (tun->params[j].ranges[0].config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */ 396 params = &tun->params[j];
397 buffer[2] = (params->ranges[0].config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */
356 398
357 switch (t->type) { 399 switch (t->type) {
358 case TUNER_TENA_9533_DI: 400 case TUNER_TENA_9533_DI:
@@ -384,7 +426,7 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
384 } 426 }
385 buffer[0] = (div>>8) & 0x7f; 427 buffer[0] = (div>>8) & 0x7f;
386 buffer[1] = div & 0xff; 428 buffer[1] = div & 0xff;
387 if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) { 429 if (params->cb_first_if_lower_freq && div < t->last_div) {
388 buffer[0] = buffer[2]; 430 buffer[0] = buffer[2];
389 buffer[1] = buffer[3]; 431 buffer[1] = buffer[3];
390 buffer[2] = (div>>8) & 0x7f; 432 buffer[2] = (div>>8) & 0x7f;
@@ -398,6 +440,18 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
398 buffer[0],buffer[1],buffer[2],buffer[3]); 440 buffer[0],buffer[1],buffer[2],buffer[3]);
399 t->last_div = div; 441 t->last_div = div;
400 442
443 if (params->has_tda9887) {
444 int config = 0;
445 if (params->port1_active && !params->port1_fm_high_sensitivity)
446 config |= TDA9887_PORT1_ACTIVE;
447 if (params->port2_active && !params->port2_fm_high_sensitivity)
448 config |= TDA9887_PORT2_ACTIVE;
449 if (params->intercarrier_mode)
450 config |= TDA9887_INTERCARRIER;
451/* if (params->port1_set_for_fm_mono)
452 config &= ~TDA9887_PORT1_ACTIVE;*/
453 i2c_clients_command(c->adapter, TDA9887_SET_CONFIG, &config);
454 }
401 if (4 != (rc = i2c_master_send(c,buffer,4))) 455 if (4 != (rc = i2c_master_send(c,buffer,4)))
402 tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); 456 tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc);
403} 457}
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c
index 9d9226cb6393..a167e17c6dcd 100644
--- a/drivers/media/video/tuner-types.c
+++ b/drivers/media/video/tuner-types.c
@@ -380,6 +380,10 @@ static struct tuner_params tuner_philips_fq1216me_params[] = {
380 .type = TUNER_PARAM_TYPE_PAL, 380 .type = TUNER_PARAM_TYPE_PAL,
381 .ranges = tuner_lg_pal_ranges, 381 .ranges = tuner_lg_pal_ranges,
382 .count = ARRAY_SIZE(tuner_lg_pal_ranges), 382 .count = ARRAY_SIZE(tuner_lg_pal_ranges),
383 .has_tda9887 = 1,
384 .port1_active = 1,
385 .port2_active = 1,
386 .port2_invert_for_secam_lc = 1,
383 }, 387 },
384}; 388};
385 389
@@ -542,6 +546,14 @@ static struct tuner_params tuner_fm1216me_mk3_params[] = {
542 .ranges = tuner_fm1216me_mk3_pal_ranges, 546 .ranges = tuner_fm1216me_mk3_pal_ranges,
543 .count = ARRAY_SIZE(tuner_fm1216me_mk3_pal_ranges), 547 .count = ARRAY_SIZE(tuner_fm1216me_mk3_pal_ranges),
544 .cb_first_if_lower_freq = 1, 548 .cb_first_if_lower_freq = 1,
549 .has_tda9887 = 1,
550 .port1_active = 1,
551 .port2_active = 1,
552 .port2_invert_for_secam_lc = 1,
553 .port1_fm_high_sensitivity = 1,
554 .default_top_mid = -2,
555 .default_top_secam_mid = -2,
556 .default_top_secam_high = -2,
545 }, 557 },
546}; 558};
547 559
@@ -612,6 +624,10 @@ static struct tuner_params tuner_fm1236_mk3_params[] = {
612 .ranges = tuner_fm1236_mk3_ntsc_ranges, 624 .ranges = tuner_fm1236_mk3_ntsc_ranges,
613 .count = ARRAY_SIZE(tuner_fm1236_mk3_ntsc_ranges), 625 .count = ARRAY_SIZE(tuner_fm1236_mk3_ntsc_ranges),
614 .cb_first_if_lower_freq = 1, 626 .cb_first_if_lower_freq = 1,
627 .has_tda9887 = 1,
628 .port1_active = 1,
629 .port2_active = 1,
630 .port1_fm_high_sensitivity = 1,
615 }, 631 },
616}; 632};
617 633
@@ -632,6 +648,8 @@ static struct tuner_params tuner_microtune_4049_fm5_params[] = {
632 .type = TUNER_PARAM_TYPE_PAL, 648 .type = TUNER_PARAM_TYPE_PAL,
633 .ranges = tuner_temic_4009f_5_pal_ranges, 649 .ranges = tuner_temic_4009f_5_pal_ranges,
634 .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges), 650 .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges),
651 .has_tda9887 = 1,
652 .port1_invert_for_secam_lc = 1,
635 }, 653 },
636}; 654};
637 655
@@ -648,6 +666,8 @@ static struct tuner_params tuner_panasonic_vp27_params[] = {
648 .type = TUNER_PARAM_TYPE_NTSC, 666 .type = TUNER_PARAM_TYPE_NTSC,
649 .ranges = tuner_panasonic_vp27_ntsc_ranges, 667 .ranges = tuner_panasonic_vp27_ntsc_ranges,
650 .count = ARRAY_SIZE(tuner_panasonic_vp27_ntsc_ranges), 668 .count = ARRAY_SIZE(tuner_panasonic_vp27_ntsc_ranges),
669 .has_tda9887 = 1,
670 .intercarrier_mode = 1,
651 }, 671 },
652}; 672};
653 673
@@ -782,6 +802,13 @@ static struct tuner_params tuner_philips_fq1216ame_mk4_params[] = {
782 .type = TUNER_PARAM_TYPE_PAL, 802 .type = TUNER_PARAM_TYPE_PAL,
783 .ranges = tuner_philips_fq12_6a___mk4_pal_ranges, 803 .ranges = tuner_philips_fq12_6a___mk4_pal_ranges,
784 .count = ARRAY_SIZE(tuner_philips_fq12_6a___mk4_pal_ranges), 804 .count = ARRAY_SIZE(tuner_philips_fq12_6a___mk4_pal_ranges),
805 .has_tda9887 = 1,
806 .port1_active = 1,
807 .port2_invert_for_secam_lc = 1,
808 .default_top_mid = -2,
809 .default_top_secam_low = -2,
810 .default_top_secam_mid = -2,
811 .default_top_secam_high = -2,
785 }, 812 },
786}; 813};
787 814
@@ -870,6 +897,12 @@ static struct tuner_params tuner_philips_fmd1216me_mk3_params[] = {
870 .type = TUNER_PARAM_TYPE_PAL, 897 .type = TUNER_PARAM_TYPE_PAL,
871 .ranges = tuner_philips_fmd1216me_mk3_pal_ranges, 898 .ranges = tuner_philips_fmd1216me_mk3_pal_ranges,
872 .count = ARRAY_SIZE(tuner_philips_fmd1216me_mk3_pal_ranges), 899 .count = ARRAY_SIZE(tuner_philips_fmd1216me_mk3_pal_ranges),
900 .has_tda9887 = 1,
901 .port1_active = 1,
902 .port2_active = 1,
903 .port2_fm_high_sensitivity = 1,
904 .port2_invert_for_secam_lc = 1,
905 .port1_set_for_fm_mono = 1,
873 }, 906 },
874}; 907};
875 908
@@ -1005,6 +1038,7 @@ static struct tuner_params tuner_samsung_tcpn_2121p30a_params[] = {
1005 .type = TUNER_PARAM_TYPE_NTSC, 1038 .type = TUNER_PARAM_TYPE_NTSC,
1006 .ranges = tuner_samsung_tcpn_2121p30a_ntsc_ranges, 1039 .ranges = tuner_samsung_tcpn_2121p30a_ntsc_ranges,
1007 .count = ARRAY_SIZE(tuner_samsung_tcpn_2121p30a_ntsc_ranges), 1040 .count = ARRAY_SIZE(tuner_samsung_tcpn_2121p30a_ntsc_ranges),
1041 .has_tda9887 = 1,
1008 }, 1042 },
1009}; 1043};
1010 1044
@@ -1037,6 +1071,10 @@ static struct tuner_params tuner_samsung_tcpg_6121p30a_params[] = {
1037 .type = TUNER_PARAM_TYPE_PAL, 1071 .type = TUNER_PARAM_TYPE_PAL,
1038 .ranges = tuner_samsung_tcpg_6121p30a_pal_ranges, 1072 .ranges = tuner_samsung_tcpg_6121p30a_pal_ranges,
1039 .count = ARRAY_SIZE(tuner_samsung_tcpg_6121p30a_pal_ranges), 1073 .count = ARRAY_SIZE(tuner_samsung_tcpg_6121p30a_pal_ranges),
1074 .has_tda9887 = 1,
1075 .port1_active = 1,
1076 .port2_active = 1,
1077 .port2_invert_for_secam_lc = 1,
1040 }, 1078 },
1041}; 1079};
1042 1080
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index 30f8d80ddcaa..d95529e8e513 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -73,14 +73,14 @@ static struct HAUPPAUGE_TUNER_FMT
73} 73}
74hauppauge_tuner_fmt[] = 74hauppauge_tuner_fmt[] =
75{ 75{
76 { V4L2_STD_UNKNOWN," UNKNOWN" }, 76 { V4L2_STD_UNKNOWN, " UNKNOWN" },
77 { V4L2_STD_UNKNOWN," FM" }, 77 { V4L2_STD_UNKNOWN, " FM" },
78 { V4L2_STD_PAL_BG, " PAL(B/G)" }, 78 { V4L2_STD_B|V4L2_STD_GH, " PAL(B/G)" },
79 { V4L2_STD_NTSC_M, " NTSC(M)" }, 79 { V4L2_STD_MN, " NTSC(M)" },
80 { V4L2_STD_PAL_I, " PAL(I)" }, 80 { V4L2_STD_PAL_I, " PAL(I)" },
81 { V4L2_STD_SECAM_L," SECAM(L/L')" }, 81 { V4L2_STD_SECAM_L|V4L2_STD_SECAM_LC, " SECAM(L/L')" },
82 { V4L2_STD_PAL_DK, " PAL(D/D1/K)" }, 82 { V4L2_STD_DK, " PAL(D/D1/K)" },
83 { V4L2_STD_ATSC, " ATSC/DVB Digital" }, 83 { V4L2_STD_ATSC, " ATSC/DVB Digital" },
84}; 84};
85 85
86/* This is the full list of possible tuners. Many thanks to Hauppauge for 86/* This is the full list of possible tuners. Many thanks to Hauppauge for
@@ -219,7 +219,7 @@ hauppauge_tuner[] =
219 { TUNER_ABSENT, "Thompson DTT75105"}, 219 { TUNER_ABSENT, "Thompson DTT75105"},
220 { TUNER_ABSENT, "Conexant_CX24109"}, 220 { TUNER_ABSENT, "Conexant_CX24109"},
221 { TUNER_TCL_2002N, "TCL M2523_5N_E"}, 221 { TUNER_TCL_2002N, "TCL M2523_5N_E"},
222 { TUNER_ABSENT, "TCL M2523_3DB_E"}, 222 { TUNER_TCL_2002MB, "TCL M2523_3DB_E"},
223 { TUNER_ABSENT, "Philips 8275A"}, 223 { TUNER_ABSENT, "Philips 8275A"},
224 { TUNER_ABSENT, "Microtune MT2060"}, 224 { TUNER_ABSENT, "Microtune MT2060"},
225 { TUNER_ABSENT, "Philips FM1236 MK5"}, 225 { TUNER_ABSENT, "Philips FM1236 MK5"},
diff --git a/drivers/media/video/videocodec.h b/drivers/media/video/videocodec.h
index 8c233720b6a5..97a3bbeda505 100644
--- a/drivers/media/video/videocodec.h
+++ b/drivers/media/video/videocodec.h
@@ -222,14 +222,14 @@ M zr36055[1] 0001 0000c001 00000000 (zr36050[1])
222/* ========================= */ 222/* ========================= */
223 223
224struct vfe_polarity { 224struct vfe_polarity {
225 int vsync_pol:1; 225 unsigned int vsync_pol:1;
226 int hsync_pol:1; 226 unsigned int hsync_pol:1;
227 int field_pol:1; 227 unsigned int field_pol:1;
228 int blank_pol:1; 228 unsigned int blank_pol:1;
229 int subimg_pol:1; 229 unsigned int subimg_pol:1;
230 int poe_pol:1; 230 unsigned int poe_pol:1;
231 int pvalid_pol:1; 231 unsigned int pvalid_pol:1;
232 int vclk_pol:1; 232 unsigned int vclk_pol:1;
233}; 233};
234 234
235struct vfe_settings { 235struct vfe_settings {
diff --git a/include/media/tuner-types.h b/include/media/tuner-types.h
index ad9c171bfa07..3c43b95f4c0d 100644
--- a/include/media/tuner-types.h
+++ b/include/media/tuner-types.h
@@ -20,6 +20,7 @@ struct tuner_range {
20 20
21struct tuner_params { 21struct tuner_params {
22 enum param_type type; 22 enum param_type type;
23
23 /* Many Philips based tuners have a comment like this in their 24 /* Many Philips based tuners have a comment like this in their
24 * datasheet: 25 * datasheet:
25 * 26 *
@@ -39,6 +40,60 @@ struct tuner_params {
39 * static unless the control byte was sent first. 40 * static unless the control byte was sent first.
40 */ 41 */
41 unsigned int cb_first_if_lower_freq:1; 42 unsigned int cb_first_if_lower_freq:1;
43 /* Set to 1 if this tuner uses a tda9887 */
44 unsigned int has_tda9887:1;
45 /* Many Philips tuners use tda9887 PORT1 to select the FM radio
46 sensitivity. If this setting is 1, then set PORT1 to 1 to
47 get proper FM reception. */
48 unsigned int port1_fm_high_sensitivity:1;
49 /* Some Philips tuners use tda9887 PORT2 to select the FM radio
50 sensitivity. If this setting is 1, then set PORT2 to 1 to
51 get proper FM reception. */
52 unsigned int port2_fm_high_sensitivity:1;
53 /* Most tuners with a tda9887 use QSS mode. Some (cheaper) tuners
54 use Intercarrier mode. If this setting is 1, then the tuner
55 needs to be set to intercarrier mode. */
56 unsigned int intercarrier_mode:1;
57 /* This setting sets the default value for PORT1.
58 0 means inactive, 1 means active. Note: the actual bit
59 value written to the tda9887 is inverted. So a 0 here
60 means a 1 in the B6 bit. */
61 unsigned int port1_active:1;
62 /* This setting sets the default value for PORT2.
63 0 means inactive, 1 means active. Note: the actual bit
64 value written to the tda9887 is inverted. So a 0 here
65 means a 1 in the B7 bit. */
66 unsigned int port2_active:1;
67 /* Sometimes PORT1 is inverted when the SECAM-L' standard is selected.
68 Set this bit to 1 if this is needed. */
69 unsigned int port1_invert_for_secam_lc:1;
70 /* Sometimes PORT2 is inverted when the SECAM-L' standard is selected.
71 Set this bit to 1 if this is needed. */
72 unsigned int port2_invert_for_secam_lc:1;
73 /* Some cards require PORT1 to be 1 for mono Radio FM and 0 for stereo. */
74 unsigned int port1_set_for_fm_mono:1;
75 /* Default tda9887 TOP value in dB for the low band. Default is 0.
76 Range: -16:+15 */
77 signed int default_top_low:5;
78 /* Default tda9887 TOP value in dB for the mid band. Default is 0.
79 Range: -16:+15 */
80 signed int default_top_mid:5;
81 /* Default tda9887 TOP value in dB for the high band. Default is 0.
82 Range: -16:+15 */
83 signed int default_top_high:5;
84 /* Default tda9887 TOP value in dB for SECAM-L/L' for the low band.
85 Default is 0. Several tuners require a different TOP value for
86 the SECAM-L/L' standards. Range: -16:+15 */
87 signed int default_top_secam_low:5;
88 /* Default tda9887 TOP value in dB for SECAM-L/L' for the mid band.
89 Default is 0. Several tuners require a different TOP value for
90 the SECAM-L/L' standards. Range: -16:+15 */
91 signed int default_top_secam_mid:5;
92 /* Default tda9887 TOP value in dB for SECAM-L/L' for the high band.
93 Default is 0. Several tuners require a different TOP value for
94 the SECAM-L/L' standards. Range: -16:+15 */
95 signed int default_top_secam_high:5;
96
42 97
43 unsigned int count; 98 unsigned int count;
44 struct tuner_range *ranges; 99 struct tuner_range *ranges;