diff options
Diffstat (limited to 'drivers/media/dvb/ttpci/budget.c')
-rw-r--r-- | drivers/media/dvb/ttpci/budget.c | 250 |
1 files changed, 3 insertions, 247 deletions
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index 238c77b52f89..c23c02d95641 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c | |||
@@ -41,6 +41,8 @@ | |||
41 | #include "l64781.h" | 41 | #include "l64781.h" |
42 | #include "tda8083.h" | 42 | #include "tda8083.h" |
43 | #include "s5h1420.h" | 43 | #include "s5h1420.h" |
44 | #include "lnbp21.h" | ||
45 | #include "bsru6.h" | ||
44 | 46 | ||
45 | static void Set22K (struct budget *budget, int state) | 47 | static void Set22K (struct budget *budget, int state) |
46 | { | 48 | { |
@@ -184,64 +186,6 @@ static int budget_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t m | |||
184 | return 0; | 186 | return 0; |
185 | } | 187 | } |
186 | 188 | ||
187 | static int lnbp21_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) | ||
188 | { | ||
189 | struct budget* budget = (struct budget*) fe->dvb->priv; | ||
190 | u8 buf; | ||
191 | struct i2c_msg msg = { .addr = 0x08, .flags = I2C_M_RD, .buf = &buf, .len = sizeof(buf) }; | ||
192 | |||
193 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | ||
194 | |||
195 | switch(voltage) { | ||
196 | case SEC_VOLTAGE_13: | ||
197 | buf = (buf & 0xf7) | 0x04; | ||
198 | break; | ||
199 | |||
200 | case SEC_VOLTAGE_18: | ||
201 | buf = (buf & 0xf7) | 0x0c; | ||
202 | break; | ||
203 | |||
204 | case SEC_VOLTAGE_OFF: | ||
205 | buf = buf & 0xf0; | ||
206 | break; | ||
207 | } | ||
208 | |||
209 | msg.flags = 0; | ||
210 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | ||
211 | |||
212 | return 0; | ||
213 | } | ||
214 | |||
215 | static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend* fe, long arg) | ||
216 | { | ||
217 | struct budget* budget = (struct budget*) fe->dvb->priv; | ||
218 | u8 buf; | ||
219 | struct i2c_msg msg = { .addr = 0x08, .flags = I2C_M_RD, .buf = &buf, .len = sizeof(buf) }; | ||
220 | |||
221 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | ||
222 | |||
223 | if (arg) { | ||
224 | buf = buf | 0x10; | ||
225 | } else { | ||
226 | buf = buf & 0xef; | ||
227 | } | ||
228 | |||
229 | msg.flags = 0; | ||
230 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | ||
231 | |||
232 | return 0; | ||
233 | } | ||
234 | |||
235 | static int lnbp21_init(struct budget* budget) | ||
236 | { | ||
237 | u8 buf = 0x00; | ||
238 | struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = &buf, .len = sizeof(buf) }; | ||
239 | |||
240 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) | ||
241 | return -EIO; | ||
242 | return 0; | ||
243 | } | ||
244 | |||
245 | static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 189 | static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
246 | { | 190 | { |
247 | struct budget* budget = (struct budget*) fe->dvb->priv; | 191 | struct budget* budget = (struct budget*) fe->dvb->priv; |
@@ -277,176 +221,6 @@ static struct ves1x93_config alps_bsrv2_config = | |||
277 | .pll_set = alps_bsrv2_pll_set, | 221 | .pll_set = alps_bsrv2_pll_set, |
278 | }; | 222 | }; |
279 | 223 | ||
280 | static u8 alps_bsru6_inittab[] = { | ||
281 | 0x01, 0x15, | ||
282 | 0x02, 0x00, | ||
283 | 0x03, 0x00, | ||
284 | 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */ | ||
285 | 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */ | ||
286 | 0x06, 0x40, /* DAC not used, set to high impendance mode */ | ||
287 | 0x07, 0x00, /* DAC LSB */ | ||
288 | 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */ | ||
289 | 0x09, 0x00, /* FIFO */ | ||
290 | 0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */ | ||
291 | 0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */ | ||
292 | 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ | ||
293 | 0x10, 0x3f, // AGC2 0x3d | ||
294 | 0x11, 0x84, | ||
295 | 0x12, 0xb9, | ||
296 | 0x15, 0xc9, // lock detector threshold | ||
297 | 0x16, 0x00, | ||
298 | 0x17, 0x00, | ||
299 | 0x18, 0x00, | ||
300 | 0x19, 0x00, | ||
301 | 0x1a, 0x00, | ||
302 | 0x1f, 0x50, | ||
303 | 0x20, 0x00, | ||
304 | 0x21, 0x00, | ||
305 | 0x22, 0x00, | ||
306 | 0x23, 0x00, | ||
307 | 0x28, 0x00, // out imp: normal out type: parallel FEC mode:0 | ||
308 | 0x29, 0x1e, // 1/2 threshold | ||
309 | 0x2a, 0x14, // 2/3 threshold | ||
310 | 0x2b, 0x0f, // 3/4 threshold | ||
311 | 0x2c, 0x09, // 5/6 threshold | ||
312 | 0x2d, 0x05, // 7/8 threshold | ||
313 | 0x2e, 0x01, | ||
314 | 0x31, 0x1f, // test all FECs | ||
315 | 0x32, 0x19, // viterbi and synchro search | ||
316 | 0x33, 0xfc, // rs control | ||
317 | 0x34, 0x93, // error control | ||
318 | 0x0f, 0x52, | ||
319 | 0xff, 0xff | ||
320 | }; | ||
321 | |||
322 | static int alps_bsru6_set_symbol_rate(struct dvb_frontend* fe, u32 srate, u32 ratio) | ||
323 | { | ||
324 | u8 aclk = 0; | ||
325 | u8 bclk = 0; | ||
326 | |||
327 | if (srate < 1500000) { aclk = 0xb7; bclk = 0x47; } | ||
328 | else if (srate < 3000000) { aclk = 0xb7; bclk = 0x4b; } | ||
329 | else if (srate < 7000000) { aclk = 0xb7; bclk = 0x4f; } | ||
330 | else if (srate < 14000000) { aclk = 0xb7; bclk = 0x53; } | ||
331 | else if (srate < 30000000) { aclk = 0xb6; bclk = 0x53; } | ||
332 | else if (srate < 45000000) { aclk = 0xb4; bclk = 0x51; } | ||
333 | |||
334 | stv0299_writereg (fe, 0x13, aclk); | ||
335 | stv0299_writereg (fe, 0x14, bclk); | ||
336 | stv0299_writereg (fe, 0x1f, (ratio >> 16) & 0xff); | ||
337 | stv0299_writereg (fe, 0x20, (ratio >> 8) & 0xff); | ||
338 | stv0299_writereg (fe, 0x21, (ratio ) & 0xf0); | ||
339 | |||
340 | return 0; | ||
341 | } | ||
342 | |||
343 | static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params) | ||
344 | { | ||
345 | u8 data[4]; | ||
346 | u32 div; | ||
347 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; | ||
348 | |||
349 | if ((params->frequency < 950000) || (params->frequency > 2150000)) return -EINVAL; | ||
350 | |||
351 | div = (params->frequency + (125 - 1)) / 125; // round correctly | ||
352 | data[0] = (div >> 8) & 0x7f; | ||
353 | data[1] = div & 0xff; | ||
354 | data[2] = 0x80 | ((div & 0x18000) >> 10) | 4; | ||
355 | data[3] = 0xC4; | ||
356 | |||
357 | if (params->frequency > 1530000) data[3] = 0xc0; | ||
358 | |||
359 | if (i2c_transfer(i2c, &msg, 1) != 1) return -EIO; | ||
360 | return 0; | ||
361 | } | ||
362 | |||
363 | static struct stv0299_config alps_bsru6_config = { | ||
364 | |||
365 | .demod_address = 0x68, | ||
366 | .inittab = alps_bsru6_inittab, | ||
367 | .mclk = 88000000UL, | ||
368 | .invert = 1, | ||
369 | .skip_reinit = 0, | ||
370 | .lock_output = STV0229_LOCKOUTPUT_1, | ||
371 | .volt13_op0_op1 = STV0299_VOLT13_OP1, | ||
372 | .min_delay_ms = 100, | ||
373 | .set_symbol_rate = alps_bsru6_set_symbol_rate, | ||
374 | .pll_set = alps_bsru6_pll_set, | ||
375 | }; | ||
376 | |||
377 | static u8 alps_bsbe1_inittab[] = { | ||
378 | 0x01, 0x15, | ||
379 | 0x02, 0x30, | ||
380 | 0x03, 0x00, | ||
381 | 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */ | ||
382 | 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */ | ||
383 | 0x06, 0x40, /* DAC not used, set to high impendance mode */ | ||
384 | 0x07, 0x00, /* DAC LSB */ | ||
385 | 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */ | ||
386 | 0x09, 0x00, /* FIFO */ | ||
387 | 0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */ | ||
388 | 0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */ | ||
389 | 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ | ||
390 | 0x10, 0x3f, // AGC2 0x3d | ||
391 | 0x11, 0x84, | ||
392 | 0x12, 0xb9, | ||
393 | 0x15, 0xc9, // lock detector threshold | ||
394 | 0x16, 0x00, | ||
395 | 0x17, 0x00, | ||
396 | 0x18, 0x00, | ||
397 | 0x19, 0x00, | ||
398 | 0x1a, 0x00, | ||
399 | 0x1f, 0x50, | ||
400 | 0x20, 0x00, | ||
401 | 0x21, 0x00, | ||
402 | 0x22, 0x00, | ||
403 | 0x23, 0x00, | ||
404 | 0x28, 0x00, // out imp: normal out type: parallel FEC mode:0 | ||
405 | 0x29, 0x1e, // 1/2 threshold | ||
406 | 0x2a, 0x14, // 2/3 threshold | ||
407 | 0x2b, 0x0f, // 3/4 threshold | ||
408 | 0x2c, 0x09, // 5/6 threshold | ||
409 | 0x2d, 0x05, // 7/8 threshold | ||
410 | 0x2e, 0x01, | ||
411 | 0x31, 0x1f, // test all FECs | ||
412 | 0x32, 0x19, // viterbi and synchro search | ||
413 | 0x33, 0xfc, // rs control | ||
414 | 0x34, 0x93, // error control | ||
415 | 0x0f, 0x92, // 0x80 = inverse AGC | ||
416 | 0xff, 0xff | ||
417 | }; | ||
418 | |||
419 | static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params) | ||
420 | { | ||
421 | int ret; | ||
422 | u8 data[4]; | ||
423 | u32 div; | ||
424 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; | ||
425 | |||
426 | if ((params->frequency < 950000) || (params->frequency > 2150000)) | ||
427 | return -EINVAL; | ||
428 | |||
429 | div = (params->frequency + (125 - 1)) / 125; // round correctly | ||
430 | data[0] = (div >> 8) & 0x7f; | ||
431 | data[1] = div & 0xff; | ||
432 | data[2] = 0x80 | ((div & 0x18000) >> 10) | 4; | ||
433 | data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4; | ||
434 | |||
435 | ret = i2c_transfer(i2c, &msg, 1); | ||
436 | return (ret != 1) ? -EIO : 0; | ||
437 | } | ||
438 | |||
439 | static struct stv0299_config alps_bsbe1_config = { | ||
440 | .demod_address = 0x68, | ||
441 | .inittab = alps_bsbe1_inittab, | ||
442 | .mclk = 88000000UL, | ||
443 | .invert = 1, | ||
444 | .skip_reinit = 0, | ||
445 | .min_delay_ms = 100, | ||
446 | .set_symbol_rate = alps_bsru6_set_symbol_rate, | ||
447 | .pll_set = alps_bsbe1_pll_set, | ||
448 | }; | ||
449 | |||
450 | static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 224 | static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
451 | { | 225 | { |
452 | struct budget* budget = (struct budget*) fe->dvb->priv; | 226 | struct budget* budget = (struct budget*) fe->dvb->priv; |
@@ -580,20 +354,6 @@ static u8 read_pwm(struct budget* budget) | |||
580 | static void frontend_init(struct budget *budget) | 354 | static void frontend_init(struct budget *budget) |
581 | { | 355 | { |
582 | switch(budget->dev->pci->subsystem_device) { | 356 | switch(budget->dev->pci->subsystem_device) { |
583 | case 0x1017: | ||
584 | // try the ALPS BSBE1 now | ||
585 | budget->dvb_frontend = stv0299_attach(&alps_bsbe1_config, &budget->i2c_adap); | ||
586 | if (budget->dvb_frontend) { | ||
587 | budget->dvb_frontend->ops->set_voltage = lnbp21_set_voltage; | ||
588 | budget->dvb_frontend->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; | ||
589 | budget->dvb_frontend->ops->dishnetwork_send_legacy_command = NULL; | ||
590 | if (lnbp21_init(budget)) { | ||
591 | printk("%s: No LNBP21 found!\n", __FUNCTION__); | ||
592 | goto error_out; | ||
593 | } | ||
594 | } | ||
595 | |||
596 | break; | ||
597 | case 0x1003: // Hauppauge/TT Nova budget (stv0299/ALPS BSRU6(tsa5059) OR ves1893/ALPS BSRV2(sp5659)) | 357 | case 0x1003: // Hauppauge/TT Nova budget (stv0299/ALPS BSRU6(tsa5059) OR ves1893/ALPS BSRV2(sp5659)) |
598 | case 0x1013: | 358 | case 0x1013: |
599 | // try the ALPS BSRV2 first of all | 359 | // try the ALPS BSRV2 first of all |
@@ -646,9 +406,7 @@ static void frontend_init(struct budget *budget) | |||
646 | case 0x1016: // Hauppauge/TT Nova-S SE (samsung s5h1420/????(tda8260)) | 406 | case 0x1016: // Hauppauge/TT Nova-S SE (samsung s5h1420/????(tda8260)) |
647 | budget->dvb_frontend = s5h1420_attach(&s5h1420_config, &budget->i2c_adap); | 407 | budget->dvb_frontend = s5h1420_attach(&s5h1420_config, &budget->i2c_adap); |
648 | if (budget->dvb_frontend) { | 408 | if (budget->dvb_frontend) { |
649 | budget->dvb_frontend->ops->set_voltage = lnbp21_set_voltage; | 409 | if (lnbp21_init(budget->dvb_frontend, &budget->i2c_adap, 0, 0)) { |
650 | budget->dvb_frontend->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; | ||
651 | if (lnbp21_init(budget)) { | ||
652 | printk("%s: No LNBP21 found!\n", __FUNCTION__); | 410 | printk("%s: No LNBP21 found!\n", __FUNCTION__); |
653 | goto error_out; | 411 | goto error_out; |
654 | } | 412 | } |
@@ -719,7 +477,6 @@ static int budget_detach (struct saa7146_dev* dev) | |||
719 | 477 | ||
720 | static struct saa7146_extension budget_extension; | 478 | static struct saa7146_extension budget_extension; |
721 | 479 | ||
722 | MAKE_BUDGET_INFO(ttbs2, "TT-Budget/WinTV-NOVA-S PCI (rev AL/alps bsbe1 lnbp21 frontend)", BUDGET_TT); | ||
723 | MAKE_BUDGET_INFO(ttbs, "TT-Budget/WinTV-NOVA-S PCI", BUDGET_TT); | 480 | MAKE_BUDGET_INFO(ttbs, "TT-Budget/WinTV-NOVA-S PCI", BUDGET_TT); |
724 | MAKE_BUDGET_INFO(ttbc, "TT-Budget/WinTV-NOVA-C PCI", BUDGET_TT); | 481 | MAKE_BUDGET_INFO(ttbc, "TT-Budget/WinTV-NOVA-C PCI", BUDGET_TT); |
725 | MAKE_BUDGET_INFO(ttbt, "TT-Budget/WinTV-NOVA-T PCI", BUDGET_TT); | 482 | MAKE_BUDGET_INFO(ttbt, "TT-Budget/WinTV-NOVA-T PCI", BUDGET_TT); |
@@ -732,7 +489,6 @@ static struct pci_device_id pci_tbl[] = { | |||
732 | MAKE_EXTENSION_PCI(ttbc, 0x13c2, 0x1004), | 489 | MAKE_EXTENSION_PCI(ttbc, 0x13c2, 0x1004), |
733 | MAKE_EXTENSION_PCI(ttbt, 0x13c2, 0x1005), | 490 | MAKE_EXTENSION_PCI(ttbt, 0x13c2, 0x1005), |
734 | MAKE_EXTENSION_PCI(satel, 0x13c2, 0x1013), | 491 | MAKE_EXTENSION_PCI(satel, 0x13c2, 0x1013), |
735 | MAKE_EXTENSION_PCI(ttbs2, 0x13c2, 0x1017), | ||
736 | MAKE_EXTENSION_PCI(ttbs, 0x13c2, 0x1016), | 492 | MAKE_EXTENSION_PCI(ttbs, 0x13c2, 0x1016), |
737 | MAKE_EXTENSION_PCI(fsacs1,0x1131, 0x4f60), | 493 | MAKE_EXTENSION_PCI(fsacs1,0x1131, 0x4f60), |
738 | MAKE_EXTENSION_PCI(fsacs0,0x1131, 0x4f61), | 494 | MAKE_EXTENSION_PCI(fsacs0,0x1131, 0x4f61), |