diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb/dvb-usb/Kconfig | 1 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/af9035.c | 65 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 1 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/af9033.c | 41 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/af9033.h | 1 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/af9033_priv.h | 35 |
6 files changed, 133 insertions, 11 deletions
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index cf57c0659d5b..f53fb3c8530e 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig | |||
@@ -429,6 +429,7 @@ config DVB_USB_AF9035 | |||
429 | select DVB_AF9033 | 429 | select DVB_AF9033 |
430 | select MEDIA_TUNER_TUA9001 if !MEDIA_TUNER_CUSTOMISE | 430 | select MEDIA_TUNER_TUA9001 if !MEDIA_TUNER_CUSTOMISE |
431 | select MEDIA_TUNER_FC0011 if !MEDIA_TUNER_CUSTOMISE | 431 | select MEDIA_TUNER_FC0011 if !MEDIA_TUNER_CUSTOMISE |
432 | select MEDIA_TUNER_MXL5007T if !MEDIA_TUNER_CUSTOMISE | ||
432 | help | 433 | help |
433 | Say Y here to support the Afatech AF9035 based DVB USB receiver. | 434 | Say Y here to support the Afatech AF9035 based DVB USB receiver. |
434 | 435 | ||
diff --git a/drivers/media/dvb/dvb-usb/af9035.c b/drivers/media/dvb/dvb-usb/af9035.c index a7e05a18c35f..3f2891abcba7 100644 --- a/drivers/media/dvb/dvb-usb/af9035.c +++ b/drivers/media/dvb/dvb-usb/af9035.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "af9033.h" | 23 | #include "af9033.h" |
24 | #include "tua9001.h" | 24 | #include "tua9001.h" |
25 | #include "fc0011.h" | 25 | #include "fc0011.h" |
26 | #include "mxl5007t.h" | ||
26 | 27 | ||
27 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 28 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
28 | static DEFINE_MUTEX(af9035_usb_mutex); | 29 | static DEFINE_MUTEX(af9035_usb_mutex); |
@@ -500,6 +501,7 @@ static int af9035_read_mac_address(struct dvb_usb_device *d, u8 mac[6]) | |||
500 | switch (tmp) { | 501 | switch (tmp) { |
501 | case AF9033_TUNER_TUA9001: | 502 | case AF9033_TUNER_TUA9001: |
502 | case AF9033_TUNER_FC0011: | 503 | case AF9033_TUNER_FC0011: |
504 | case AF9033_TUNER_MXL5007T: | ||
503 | af9035_af9033_config[i].spec_inv = 1; | 505 | af9035_af9033_config[i].spec_inv = 1; |
504 | break; | 506 | break; |
505 | default: | 507 | default: |
@@ -667,6 +669,15 @@ static const struct fc0011_config af9035_fc0011_config = { | |||
667 | .i2c_address = 0x60, | 669 | .i2c_address = 0x60, |
668 | }; | 670 | }; |
669 | 671 | ||
672 | static struct mxl5007t_config af9035_mxl5007t_config = { | ||
673 | .xtal_freq_hz = MxL_XTAL_24_MHZ, | ||
674 | .if_freq_hz = MxL_IF_4_57_MHZ, | ||
675 | .invert_if = 0, | ||
676 | .loop_thru_enable = 0, | ||
677 | .clk_out_enable = 0, | ||
678 | .clk_out_amp = MxL_CLKOUT_AMP_0_94V, | ||
679 | }; | ||
680 | |||
670 | static int af9035_tuner_attach(struct dvb_usb_adapter *adap) | 681 | static int af9035_tuner_attach(struct dvb_usb_adapter *adap) |
671 | { | 682 | { |
672 | int ret; | 683 | int ret; |
@@ -719,6 +730,48 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap) | |||
719 | fe = dvb_attach(fc0011_attach, adap->fe_adap[0].fe, | 730 | fe = dvb_attach(fc0011_attach, adap->fe_adap[0].fe, |
720 | &adap->dev->i2c_adap, &af9035_fc0011_config); | 731 | &adap->dev->i2c_adap, &af9035_fc0011_config); |
721 | break; | 732 | break; |
733 | case AF9033_TUNER_MXL5007T: | ||
734 | ret = af9035_wr_reg(adap->dev, 0x00d8e0, 1); | ||
735 | if (ret < 0) | ||
736 | goto err; | ||
737 | ret = af9035_wr_reg(adap->dev, 0x00d8e1, 1); | ||
738 | if (ret < 0) | ||
739 | goto err; | ||
740 | ret = af9035_wr_reg(adap->dev, 0x00d8df, 0); | ||
741 | if (ret < 0) | ||
742 | goto err; | ||
743 | |||
744 | msleep(30); | ||
745 | |||
746 | ret = af9035_wr_reg(adap->dev, 0x00d8df, 1); | ||
747 | if (ret < 0) | ||
748 | goto err; | ||
749 | |||
750 | msleep(300); | ||
751 | |||
752 | ret = af9035_wr_reg(adap->dev, 0x00d8c0, 1); | ||
753 | if (ret < 0) | ||
754 | goto err; | ||
755 | ret = af9035_wr_reg(adap->dev, 0x00d8c1, 1); | ||
756 | if (ret < 0) | ||
757 | goto err; | ||
758 | ret = af9035_wr_reg(adap->dev, 0x00d8bf, 0); | ||
759 | if (ret < 0) | ||
760 | goto err; | ||
761 | ret = af9035_wr_reg(adap->dev, 0x00d8b4, 1); | ||
762 | if (ret < 0) | ||
763 | goto err; | ||
764 | ret = af9035_wr_reg(adap->dev, 0x00d8b5, 1); | ||
765 | if (ret < 0) | ||
766 | goto err; | ||
767 | ret = af9035_wr_reg(adap->dev, 0x00d8b3, 1); | ||
768 | if (ret < 0) | ||
769 | goto err; | ||
770 | |||
771 | /* attach tuner */ | ||
772 | fe = dvb_attach(mxl5007t_attach, adap->fe_adap[0].fe, | ||
773 | &adap->dev->i2c_adap, 0x60, &af9035_mxl5007t_config); | ||
774 | break; | ||
722 | default: | 775 | default: |
723 | fe = NULL; | 776 | fe = NULL; |
724 | } | 777 | } |
@@ -740,6 +793,7 @@ enum af9035_id_entry { | |||
740 | AF9035_0CCD_0093, | 793 | AF9035_0CCD_0093, |
741 | AF9035_15A4_9035, | 794 | AF9035_15A4_9035, |
742 | AF9035_15A4_1001, | 795 | AF9035_15A4_1001, |
796 | AF9035_07CA_1867, | ||
743 | }; | 797 | }; |
744 | 798 | ||
745 | static struct usb_device_id af9035_id[] = { | 799 | static struct usb_device_id af9035_id[] = { |
@@ -749,6 +803,8 @@ static struct usb_device_id af9035_id[] = { | |||
749 | USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9035)}, | 803 | USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9035)}, |
750 | [AF9035_15A4_1001] = { | 804 | [AF9035_15A4_1001] = { |
751 | USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9035_2)}, | 805 | USB_DEVICE(USB_VID_AFATECH, USB_PID_AFATECH_AF9035_2)}, |
806 | [AF9035_07CA_1867] = { | ||
807 | USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_1867)}, | ||
752 | {}, | 808 | {}, |
753 | }; | 809 | }; |
754 | 810 | ||
@@ -791,7 +847,7 @@ static struct dvb_usb_device_properties af9035_properties[] = { | |||
791 | 847 | ||
792 | .i2c_algo = &af9035_i2c_algo, | 848 | .i2c_algo = &af9035_i2c_algo, |
793 | 849 | ||
794 | .num_device_descs = 2, | 850 | .num_device_descs = 3, |
795 | .devices = { | 851 | .devices = { |
796 | { | 852 | { |
797 | .name = "TerraTec Cinergy T Stick", | 853 | .name = "TerraTec Cinergy T Stick", |
@@ -804,7 +860,12 @@ static struct dvb_usb_device_properties af9035_properties[] = { | |||
804 | &af9035_id[AF9035_15A4_9035], | 860 | &af9035_id[AF9035_15A4_9035], |
805 | &af9035_id[AF9035_15A4_1001], | 861 | &af9035_id[AF9035_15A4_1001], |
806 | }, | 862 | }, |
807 | } | 863 | }, { |
864 | .name = "AVerMedia HD Volar", | ||
865 | .cold_ids = { | ||
866 | &af9035_id[AF9035_07CA_1867], | ||
867 | }, | ||
868 | }, | ||
808 | } | 869 | } |
809 | }, | 870 | }, |
810 | }; | 871 | }; |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index c817a98017d4..8f77a6c608f4 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h | |||
@@ -224,6 +224,7 @@ | |||
224 | #define USB_PID_AVERMEDIA_A850T 0x850b | 224 | #define USB_PID_AVERMEDIA_A850T 0x850b |
225 | #define USB_PID_AVERMEDIA_A805 0xa805 | 225 | #define USB_PID_AVERMEDIA_A805 0xa805 |
226 | #define USB_PID_AVERMEDIA_A815M 0x815a | 226 | #define USB_PID_AVERMEDIA_A815M 0x815a |
227 | #define USB_PID_AVERMEDIA_1867 0x1867 | ||
227 | #define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006 | 228 | #define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006 |
228 | #define USB_PID_TECHNOTREND_CONNECT_CT3650 0x300d | 229 | #define USB_PID_TECHNOTREND_CONNECT_CT3650 0x300d |
229 | #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a | 230 | #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a |
diff --git a/drivers/media/dvb/frontends/af9033.c b/drivers/media/dvb/frontends/af9033.c index 9eedf93c6384..8c0f4a3ef0f0 100644 --- a/drivers/media/dvb/frontends/af9033.c +++ b/drivers/media/dvb/frontends/af9033.c | |||
@@ -301,6 +301,10 @@ static int af9033_init(struct dvb_frontend *fe) | |||
301 | len = ARRAY_SIZE(tuner_init_fc0011); | 301 | len = ARRAY_SIZE(tuner_init_fc0011); |
302 | init = tuner_init_fc0011; | 302 | init = tuner_init_fc0011; |
303 | break; | 303 | break; |
304 | case AF9033_TUNER_MXL5007T: | ||
305 | len = ARRAY_SIZE(tuner_init_mxl5007t); | ||
306 | init = tuner_init_mxl5007t; | ||
307 | break; | ||
304 | default: | 308 | default: |
305 | pr_debug("%s: unsupported tuner ID=%d\n", __func__, | 309 | pr_debug("%s: unsupported tuner ID=%d\n", __func__, |
306 | state->cfg.tuner); | 310 | state->cfg.tuner); |
@@ -391,9 +395,9 @@ static int af9033_set_frontend(struct dvb_frontend *fe) | |||
391 | { | 395 | { |
392 | struct af9033_state *state = fe->demodulator_priv; | 396 | struct af9033_state *state = fe->demodulator_priv; |
393 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 397 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
394 | int ret, i; | 398 | int ret, i, spec_inv; |
395 | u8 tmp, buf[3], bandwidth_reg_val; | 399 | u8 tmp, buf[3], bandwidth_reg_val; |
396 | u32 if_frequency, freq_cw; | 400 | u32 if_frequency, freq_cw, adc_freq; |
397 | 401 | ||
398 | pr_debug("%s: frequency=%d bandwidth_hz=%d\n", __func__, c->frequency, | 402 | pr_debug("%s: frequency=%d bandwidth_hz=%d\n", __func__, c->frequency, |
399 | c->bandwidth_hz); | 403 | c->bandwidth_hz); |
@@ -433,22 +437,41 @@ static int af9033_set_frontend(struct dvb_frontend *fe) | |||
433 | 437 | ||
434 | /* program frequency control */ | 438 | /* program frequency control */ |
435 | if (c->bandwidth_hz != state->bandwidth_hz) { | 439 | if (c->bandwidth_hz != state->bandwidth_hz) { |
440 | spec_inv = state->cfg.spec_inv ? -1 : 1; | ||
441 | |||
442 | for (i = 0; i < ARRAY_SIZE(clock_adc_lut); i++) { | ||
443 | if (clock_adc_lut[i].clock == state->cfg.clock) | ||
444 | break; | ||
445 | } | ||
446 | adc_freq = clock_adc_lut[i].adc; | ||
447 | |||
436 | /* get used IF frequency */ | 448 | /* get used IF frequency */ |
437 | if (fe->ops.tuner_ops.get_if_frequency) | 449 | if (fe->ops.tuner_ops.get_if_frequency) |
438 | fe->ops.tuner_ops.get_if_frequency(fe, &if_frequency); | 450 | fe->ops.tuner_ops.get_if_frequency(fe, &if_frequency); |
439 | else | 451 | else |
440 | if_frequency = 0; | 452 | if_frequency = 0; |
441 | 453 | ||
442 | /* FIXME: we support only Zero-IF currently */ | 454 | while (if_frequency > (adc_freq / 2)) |
443 | if (if_frequency != 0) { | 455 | if_frequency -= adc_freq; |
444 | pr_debug("%s: only Zero-IF supported currently\n", | ||
445 | __func__); | ||
446 | 456 | ||
447 | ret = -ENODEV; | 457 | if (if_frequency >= 0) |
458 | spec_inv *= -1; | ||
459 | else | ||
460 | if_frequency *= -1; | ||
461 | |||
462 | freq_cw = af9033_div(if_frequency, adc_freq, 23ul); | ||
463 | |||
464 | if (spec_inv == -1) | ||
465 | freq_cw *= -1; | ||
466 | |||
467 | /* get adc multiplies */ | ||
468 | ret = af9033_rd_reg(state, 0x800045, &tmp); | ||
469 | if (ret < 0) | ||
448 | goto err; | 470 | goto err; |
449 | } | ||
450 | 471 | ||
451 | freq_cw = 0; | 472 | if (tmp == 1) |
473 | freq_cw /= 2; | ||
474 | |||
452 | buf[0] = (freq_cw >> 0) & 0xff; | 475 | buf[0] = (freq_cw >> 0) & 0xff; |
453 | buf[1] = (freq_cw >> 8) & 0xff; | 476 | buf[1] = (freq_cw >> 8) & 0xff; |
454 | buf[2] = (freq_cw >> 16) & 0x7f; | 477 | buf[2] = (freq_cw >> 16) & 0x7f; |
diff --git a/drivers/media/dvb/frontends/af9033.h b/drivers/media/dvb/frontends/af9033.h index af8c1e3e30d0..dcf7e290b6fe 100644 --- a/drivers/media/dvb/frontends/af9033.h +++ b/drivers/media/dvb/frontends/af9033.h | |||
@@ -40,6 +40,7 @@ struct af9033_config { | |||
40 | */ | 40 | */ |
41 | #define AF9033_TUNER_TUA9001 0x27 /* Infineon TUA 9001 */ | 41 | #define AF9033_TUNER_TUA9001 0x27 /* Infineon TUA 9001 */ |
42 | #define AF9033_TUNER_FC0011 0x28 /* Fitipower FC0011 */ | 42 | #define AF9033_TUNER_FC0011 0x28 /* Fitipower FC0011 */ |
43 | #define AF9033_TUNER_MXL5007T 0xa0 /* MaxLinear MxL5007T */ | ||
43 | u8 tuner; | 44 | u8 tuner; |
44 | 45 | ||
45 | /* | 46 | /* |
diff --git a/drivers/media/dvb/frontends/af9033_priv.h b/drivers/media/dvb/frontends/af9033_priv.h index 337964257dab..e6041bc7c2fc 100644 --- a/drivers/media/dvb/frontends/af9033_priv.h +++ b/drivers/media/dvb/frontends/af9033_priv.h | |||
@@ -397,5 +397,40 @@ static const struct reg_val tuner_init_fc0011[] = { | |||
397 | { 0x80F1E6, 0x00 }, | 397 | { 0x80F1E6, 0x00 }, |
398 | }; | 398 | }; |
399 | 399 | ||
400 | /* MaxLinear MxL5007T tuner init | ||
401 | AF9033_TUNER_MXL5007T = 0xa0 */ | ||
402 | static const struct reg_val tuner_init_mxl5007t[] = { | ||
403 | { 0x800046, 0x1b }, | ||
404 | { 0x800057, 0x01 }, | ||
405 | { 0x800058, 0x01 }, | ||
406 | { 0x80005f, 0x00 }, | ||
407 | { 0x800060, 0x00 }, | ||
408 | { 0x800068, 0x96 }, | ||
409 | { 0x800071, 0x05 }, | ||
410 | { 0x800072, 0x02 }, | ||
411 | { 0x800074, 0x01 }, | ||
412 | { 0x800079, 0x01 }, | ||
413 | { 0x800093, 0x00 }, | ||
414 | { 0x800094, 0x00 }, | ||
415 | { 0x800095, 0x00 }, | ||
416 | { 0x800096, 0x00 }, | ||
417 | { 0x8000b3, 0x01 }, | ||
418 | { 0x8000c1, 0x01 }, | ||
419 | { 0x8000c2, 0x00 }, | ||
420 | { 0x80f007, 0x00 }, | ||
421 | { 0x80f00c, 0x19 }, | ||
422 | { 0x80f00d, 0x1a }, | ||
423 | { 0x80f012, 0xda }, | ||
424 | { 0x80f013, 0x00 }, | ||
425 | { 0x80f014, 0x00 }, | ||
426 | { 0x80f015, 0x02 }, | ||
427 | { 0x80f01f, 0x82 }, | ||
428 | { 0x80f020, 0x00 }, | ||
429 | { 0x80f029, 0x82 }, | ||
430 | { 0x80f02a, 0x00 }, | ||
431 | { 0x80f077, 0x02 }, | ||
432 | { 0x80f1e6, 0x00 }, | ||
433 | }; | ||
434 | |||
400 | #endif /* AF9033_PRIV_H */ | 435 | #endif /* AF9033_PRIV_H */ |
401 | 436 | ||