aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ttpci
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/ttpci')
-rw-r--r--drivers/media/dvb/ttpci/av7110.c4
-rw-r--r--drivers/media/dvb/ttpci/av7110_v4l.c12
-rw-r--r--drivers/media/dvb/ttpci/budget-av.c3
-rw-r--r--drivers/media/dvb/ttpci/budget-ci.c2
-rw-r--r--drivers/media/dvb/ttpci/budget-core.c57
-rw-r--r--drivers/media/dvb/ttpci/budget-patch.c2
-rw-r--r--drivers/media/dvb/ttpci/budget.c5
-rw-r--r--drivers/media/dvb/ttpci/budget.h7
8 files changed, 65 insertions, 27 deletions
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 500f15c10aaf..4506165c5de2 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -2203,8 +2203,8 @@ static int frontend_init(struct av7110 *av7110)
2203 av7110->fe->ops.tuner_ops.set_params = nexusca_stv0297_tuner_set_params; 2203 av7110->fe->ops.tuner_ops.set_params = nexusca_stv0297_tuner_set_params;
2204 2204
2205 /* set TDA9819 into DVB mode */ 2205 /* set TDA9819 into DVB mode */
2206 saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD) 2206 saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD)
2207 saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9198 pin30(VIF) 2207 saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF)
2208 2208
2209 /* tuner on this needs a slower i2c bus speed */ 2209 /* tuner on this needs a slower i2c bus speed */
2210 av7110->dev->i2c_bitrate = SAA7146_I2C_BUS_BIT_RATE_240; 2210 av7110->dev->i2c_bitrate = SAA7146_I2C_BUS_BIT_RATE_240;
diff --git a/drivers/media/dvb/ttpci/av7110_v4l.c b/drivers/media/dvb/ttpci/av7110_v4l.c
index 64055461559d..6ffe53fdcf57 100644
--- a/drivers/media/dvb/ttpci/av7110_v4l.c
+++ b/drivers/media/dvb/ttpci/av7110_v4l.c
@@ -272,8 +272,8 @@ static int av7110_dvb_c_switch(struct saa7146_fh *fh)
272 if (ves1820_writereg(dev, 0x09, 0x0f, 0x60)) 272 if (ves1820_writereg(dev, 0x09, 0x0f, 0x60))
273 dprintk(1, "setting band in demodulator failed.\n"); 273 dprintk(1, "setting band in demodulator failed.\n");
274 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { 274 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) {
275 saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9198 pin9(STD) 275 saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9819 pin9(STD)
276 saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9198 pin30(VIF) 276 saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9819 pin30(VIF)
277 } 277 }
278 if (i2c_writereg(av7110, 0x48, 0x02, 0xd0) != 1) 278 if (i2c_writereg(av7110, 0x48, 0x02, 0xd0) != 1)
279 dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num); 279 dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num);
@@ -308,8 +308,8 @@ static int av7110_dvb_c_switch(struct saa7146_fh *fh)
308 if (ves1820_writereg(dev, 0x09, 0x0f, 0x20)) 308 if (ves1820_writereg(dev, 0x09, 0x0f, 0x20))
309 dprintk(1, "setting band in demodulator failed.\n"); 309 dprintk(1, "setting band in demodulator failed.\n");
310 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { 310 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) {
311 saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD) 311 saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD)
312 saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // TDA9198 pin30(VIF) 312 saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF)
313 } 313 }
314 } 314 }
315 315
@@ -750,8 +750,8 @@ int av7110_init_analog_module(struct av7110 *av7110)
750 if (ves1820_writereg(av7110->dev, 0x09, 0x0f, 0x20)) 750 if (ves1820_writereg(av7110->dev, 0x09, 0x0f, 0x20))
751 dprintk(1, "setting band in demodulator failed.\n"); 751 dprintk(1, "setting band in demodulator failed.\n");
752 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { 752 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) {
753 saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD) 753 saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD)
754 saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9198 pin30(VIF) 754 saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF)
755 } 755 }
756 756
757 /* init the saa7113 */ 757 /* init the saa7113 */
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c
index 5f111d407730..2d21fec23b4d 100644
--- a/drivers/media/dvb/ttpci/budget-av.c
+++ b/drivers/media/dvb/ttpci/budget-av.c
@@ -1303,6 +1303,9 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio
1303 budget_av->budget.dvb_adapter.priv = budget_av; 1303 budget_av->budget.dvb_adapter.priv = budget_av;
1304 frontend_init(budget_av); 1304 frontend_init(budget_av);
1305 ciintf_init(budget_av); 1305 ciintf_init(budget_av);
1306
1307 ttpci_budget_init_hooks(&budget_av->budget);
1308
1306 return 0; 1309 return 0;
1307} 1310}
1308 1311
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c
index 4b966eea3834..ffbbb3e34be4 100644
--- a/drivers/media/dvb/ttpci/budget-ci.c
+++ b/drivers/media/dvb/ttpci/budget-ci.c
@@ -1101,6 +1101,8 @@ static int budget_ci_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio
1101 budget_ci->budget.dvb_adapter.priv = budget_ci; 1101 budget_ci->budget.dvb_adapter.priv = budget_ci;
1102 frontend_init(budget_ci); 1102 frontend_init(budget_ci);
1103 1103
1104 ttpci_budget_init_hooks(&budget_ci->budget);
1105
1104 return 0; 1106 return 0;
1105} 1107}
1106 1108
diff --git a/drivers/media/dvb/ttpci/budget-core.c b/drivers/media/dvb/ttpci/budget-core.c
index e4cf7775e07f..e15562f81664 100644
--- a/drivers/media/dvb/ttpci/budget-core.c
+++ b/drivers/media/dvb/ttpci/budget-core.c
@@ -63,9 +63,6 @@ static int stop_ts_capture(struct budget *budget)
63{ 63{
64 dprintk(2, "budget: %p\n", budget); 64 dprintk(2, "budget: %p\n", budget);
65 65
66 if (--budget->feeding)
67 return budget->feeding;
68
69 saa7146_write(budget->dev, MC1, MASK_20); // DMA3 off 66 saa7146_write(budget->dev, MC1, MASK_20); // DMA3 off
70 SAA7146_IER_DISABLE(budget->dev, MASK_10); 67 SAA7146_IER_DISABLE(budget->dev, MASK_10);
71 return 0; 68 return 0;
@@ -77,8 +74,8 @@ static int start_ts_capture(struct budget *budget)
77 74
78 dprintk(2, "budget: %p\n", budget); 75 dprintk(2, "budget: %p\n", budget);
79 76
80 if (budget->feeding) 77 if (!budget->feeding || !budget->fe_synced)
81 return ++budget->feeding; 78 return 0;
82 79
83 saa7146_write(dev, MC1, MASK_20); // DMA3 off 80 saa7146_write(dev, MC1, MASK_20); // DMA3 off
84 81
@@ -139,7 +136,33 @@ static int start_ts_capture(struct budget *budget)
139 SAA7146_IER_ENABLE(budget->dev, MASK_10); /* VPE */ 136 SAA7146_IER_ENABLE(budget->dev, MASK_10); /* VPE */
140 saa7146_write(dev, MC1, (MASK_04 | MASK_20)); /* DMA3 on */ 137 saa7146_write(dev, MC1, (MASK_04 | MASK_20)); /* DMA3 on */
141 138
142 return ++budget->feeding; 139 return 0;
140}
141
142static int budget_read_fe_status(struct dvb_frontend *fe, fe_status_t *status)
143{
144 struct budget *budget = (struct budget *) fe->dvb->priv;
145 int synced;
146 int ret;
147
148 if (budget->read_fe_status)
149 ret = budget->read_fe_status(fe, status);
150 else
151 ret = -EINVAL;
152
153 if (!ret) {
154 synced = (*status & FE_HAS_LOCK);
155 if (synced != budget->fe_synced) {
156 budget->fe_synced = synced;
157 spin_lock(&budget->feedlock);
158 if (synced)
159 start_ts_capture(budget);
160 else
161 stop_ts_capture(budget);
162 spin_unlock(&budget->feedlock);
163 }
164 }
165 return ret;
143} 166}
144 167
145static void vpeirq(unsigned long data) 168static void vpeirq(unsigned long data)
@@ -267,7 +290,7 @@ static int budget_start_feed(struct dvb_demux_feed *feed)
267{ 290{
268 struct dvb_demux *demux = feed->demux; 291 struct dvb_demux *demux = feed->demux;
269 struct budget *budget = (struct budget *) demux->priv; 292 struct budget *budget = (struct budget *) demux->priv;
270 int status; 293 int status = 0;
271 294
272 dprintk(2, "budget: %p\n", budget); 295 dprintk(2, "budget: %p\n", budget);
273 296
@@ -276,7 +299,8 @@ static int budget_start_feed(struct dvb_demux_feed *feed)
276 299
277 spin_lock(&budget->feedlock); 300 spin_lock(&budget->feedlock);
278 feed->pusi_seen = 0; /* have a clean section start */ 301 feed->pusi_seen = 0; /* have a clean section start */
279 status = start_ts_capture(budget); 302 if (budget->feeding++ == 0)
303 status = start_ts_capture(budget);
280 spin_unlock(&budget->feedlock); 304 spin_unlock(&budget->feedlock);
281 return status; 305 return status;
282} 306}
@@ -285,12 +309,13 @@ static int budget_stop_feed(struct dvb_demux_feed *feed)
285{ 309{
286 struct dvb_demux *demux = feed->demux; 310 struct dvb_demux *demux = feed->demux;
287 struct budget *budget = (struct budget *) demux->priv; 311 struct budget *budget = (struct budget *) demux->priv;
288 int status; 312 int status = 0;
289 313
290 dprintk(2, "budget: %p\n", budget); 314 dprintk(2, "budget: %p\n", budget);
291 315
292 spin_lock(&budget->feedlock); 316 spin_lock(&budget->feedlock);
293 status = stop_ts_capture(budget); 317 if (--budget->feeding == 0)
318 status = stop_ts_capture(budget);
294 spin_unlock(&budget->feedlock); 319 spin_unlock(&budget->feedlock);
295 return status; 320 return status;
296} 321}
@@ -470,6 +495,14 @@ err:
470 return ret; 495 return ret;
471} 496}
472 497
498void ttpci_budget_init_hooks(struct budget *budget)
499{
500 if (budget->dvb_frontend && !budget->read_fe_status) {
501 budget->read_fe_status = budget->dvb_frontend->ops.read_status;
502 budget->dvb_frontend->ops.read_status = budget_read_fe_status;
503 }
504}
505
473int ttpci_budget_deinit(struct budget *budget) 506int ttpci_budget_deinit(struct budget *budget)
474{ 507{
475 struct saa7146_dev *dev = budget->dev; 508 struct saa7146_dev *dev = budget->dev;
@@ -508,11 +541,8 @@ void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port)
508 spin_lock(&budget->feedlock); 541 spin_lock(&budget->feedlock);
509 budget->video_port = video_port; 542 budget->video_port = video_port;
510 if (budget->feeding) { 543 if (budget->feeding) {
511 int oldfeeding = budget->feeding;
512 budget->feeding = 1;
513 stop_ts_capture(budget); 544 stop_ts_capture(budget);
514 start_ts_capture(budget); 545 start_ts_capture(budget);
515 budget->feeding = oldfeeding;
516 } 546 }
517 spin_unlock(&budget->feedlock); 547 spin_unlock(&budget->feedlock);
518} 548}
@@ -520,6 +550,7 @@ void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port)
520EXPORT_SYMBOL_GPL(ttpci_budget_debiread); 550EXPORT_SYMBOL_GPL(ttpci_budget_debiread);
521EXPORT_SYMBOL_GPL(ttpci_budget_debiwrite); 551EXPORT_SYMBOL_GPL(ttpci_budget_debiwrite);
522EXPORT_SYMBOL_GPL(ttpci_budget_init); 552EXPORT_SYMBOL_GPL(ttpci_budget_init);
553EXPORT_SYMBOL_GPL(ttpci_budget_init_hooks);
523EXPORT_SYMBOL_GPL(ttpci_budget_deinit); 554EXPORT_SYMBOL_GPL(ttpci_budget_deinit);
524EXPORT_SYMBOL_GPL(ttpci_budget_irq10_handler); 555EXPORT_SYMBOL_GPL(ttpci_budget_irq10_handler);
525EXPORT_SYMBOL_GPL(ttpci_budget_set_video_port); 556EXPORT_SYMBOL_GPL(ttpci_budget_set_video_port);
diff --git a/drivers/media/dvb/ttpci/budget-patch.c b/drivers/media/dvb/ttpci/budget-patch.c
index ee60ce90a400..57227441891e 100644
--- a/drivers/media/dvb/ttpci/budget-patch.c
+++ b/drivers/media/dvb/ttpci/budget-patch.c
@@ -617,6 +617,8 @@ static int budget_patch_attach (struct saa7146_dev* dev, struct saa7146_pci_exte
617 budget->dvb_adapter.priv = budget; 617 budget->dvb_adapter.priv = budget;
618 frontend_init(budget); 618 frontend_init(budget);
619 619
620 ttpci_budget_init_hooks(budget);
621
620 return 0; 622 return 0;
621} 623}
622 624
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
index 35761f13c12b..863dffb4ed8e 100644
--- a/drivers/media/dvb/ttpci/budget.c
+++ b/drivers/media/dvb/ttpci/budget.c
@@ -375,9 +375,6 @@ static void frontend_init(struct budget *budget)
375 if (budget->dvb_frontend) { 375 if (budget->dvb_frontend) {
376 budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; 376 budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params;
377 budget->dvb_frontend->tuner_priv = &budget->i2c_adap; 377 budget->dvb_frontend->tuner_priv = &budget->i2c_adap;
378 budget->dvb_frontend->ops.diseqc_send_master_cmd = budget_diseqc_send_master_cmd;
379 budget->dvb_frontend->ops.diseqc_send_burst = budget_diseqc_send_burst;
380 budget->dvb_frontend->ops.set_tone = budget_set_tone;
381 break; 378 break;
382 } 379 }
383 break; 380 break;
@@ -474,6 +471,8 @@ static int budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_
474 budget->dvb_adapter.priv = budget; 471 budget->dvb_adapter.priv = budget;
475 frontend_init(budget); 472 frontend_init(budget);
476 473
474 ttpci_budget_init_hooks(budget);
475
477 return 0; 476 return 0;
478} 477}
479 478
diff --git a/drivers/media/dvb/ttpci/budget.h b/drivers/media/dvb/ttpci/budget.h
index ecea3a13030e..e8a5c79178e1 100644
--- a/drivers/media/dvb/ttpci/budget.h
+++ b/drivers/media/dvb/ttpci/budget.h
@@ -52,9 +52,6 @@ struct budget {
52 struct dmx_frontend hw_frontend; 52 struct dmx_frontend hw_frontend;
53 struct dmx_frontend mem_frontend; 53 struct dmx_frontend mem_frontend;
54 54
55 int fe_synced;
56 struct mutex pid_mutex;
57
58 int ci_present; 55 int ci_present;
59 int video_port; 56 int video_port;
60 57
@@ -74,6 +71,9 @@ struct budget {
74 71
75 struct dvb_adapter dvb_adapter; 72 struct dvb_adapter dvb_adapter;
76 struct dvb_frontend *dvb_frontend; 73 struct dvb_frontend *dvb_frontend;
74 int (*read_fe_status)(struct dvb_frontend *fe, fe_status_t *status);
75 int fe_synced;
76
77 void *priv; 77 void *priv;
78}; 78};
79 79
@@ -106,6 +106,7 @@ static struct saa7146_pci_extension_data x_var = { \
106extern int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev, 106extern int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
107 struct saa7146_pci_extension_data *info, 107 struct saa7146_pci_extension_data *info,
108 struct module *owner); 108 struct module *owner);
109extern void ttpci_budget_init_hooks(struct budget *budget);
109extern int ttpci_budget_deinit(struct budget *budget); 110extern int ttpci_budget_deinit(struct budget *budget);
110extern void ttpci_budget_irq10_handler(struct saa7146_dev *dev, u32 * isr); 111extern void ttpci_budget_irq10_handler(struct saa7146_dev *dev, u32 * isr);
111extern void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port); 112extern void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port);