aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMalcolm Priestley <tvboxspy@gmail.com>2011-02-12 20:35:08 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-22 15:37:44 -0400
commit9d4540c9395f5f01cdd0cf60d230ec8bee165bb8 (patch)
tree97b7284af4fd45c5466b99c1252d456fd6b58376 /drivers
parenta07500ef690fcbec76e879ee2093d7ca69883825 (diff)
[media] v180 - DM04/QQBOX added support for BS2F7HZ0194 versions
Old versions of these boxes have the BS2F7HZ0194 tuner module on both the LME2510 and LME2510C. Firmware dvb-usb-lme2510-s0194.fw and/or dvb-usb-lme2510c-s0194.fw files are required. See Documentation/dvb/lmedm04.txt Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/dvb-usb/lmedm04.c230
1 files changed, 170 insertions, 60 deletions
diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c
index 46ccd01a7696..fa64b6c15ef9 100644
--- a/drivers/media/dvb/dvb-usb/lmedm04.c
+++ b/drivers/media/dvb/dvb-usb/lmedm04.c
@@ -2,7 +2,9 @@
2 * 2 *
3 * DM04/QQBOX DVB-S USB BOX LME2510C + SHARP:BS2F7HZ7395 3 * DM04/QQBOX DVB-S USB BOX LME2510C + SHARP:BS2F7HZ7395
4 * LME2510C + LG TDQY-P001F 4 * LME2510C + LG TDQY-P001F
5 * LME2510C + BS2F7HZ0194
5 * LME2510 + LG TDQY-P001F 6 * LME2510 + LG TDQY-P001F
7 * LME2510 + BS2F7HZ0194
6 * 8 *
7 * MVB7395 (LME2510C+SHARP:BS2F7HZ7395) 9 * MVB7395 (LME2510C+SHARP:BS2F7HZ7395)
8 * SHARP:BS2F7HZ7395 = (STV0288+Sharp IX2505V) 10 * SHARP:BS2F7HZ7395 = (STV0288+Sharp IX2505V)
@@ -12,20 +14,22 @@
12 * 14 *
13 * MVB0001F (LME2510C+LGTDQT-P001F) 15 * MVB0001F (LME2510C+LGTDQT-P001F)
14 * 16 *
17 * MV0194 (LME2510+SHARP:BS2F7HZ0194)
18 * SHARP:BS2F7HZ0194 = (STV0299+IX2410)
19 *
20 * MVB0194 (LME2510C+SHARP0194)
21 *
15 * For firmware see Documentation/dvb/lmedm04.txt 22 * For firmware see Documentation/dvb/lmedm04.txt
16 * 23 *
17 * I2C addresses: 24 * I2C addresses:
18 * 0xd0 - STV0288 - Demodulator 25 * 0xd0 - STV0288 - Demodulator
19 * 0xc0 - Sharp IX2505V - Tuner 26 * 0xc0 - Sharp IX2505V - Tuner
20 * --or-- 27 * --
21 * 0x1c - TDA10086 - Demodulator 28 * 0x1c - TDA10086 - Demodulator
22 * 0xc0 - TDA8263 - Tuner 29 * 0xc0 - TDA8263 - Tuner
23 * 30 * --
24 * ***Please Note*** 31 * 0xd0 - STV0299 - Demodulator
25 * There are other variants of the DM04 32 * 0xc0 - IX2410 - Tuner
26 * ***NOT SUPPORTED***
27 * MV0194 (LME2510+SHARP0194)
28 * MVB0194 (LME2510C+SHARP0194)
29 * 33 *
30 * 34 *
31 * VID = 3344 PID LME2510=1122 LME2510C=1120 35 * VID = 3344 PID LME2510=1122 LME2510C=1120
@@ -55,6 +59,9 @@
55 * 59 *
56 * QQbox suffers from noise on LNB voltage. 60 * QQbox suffers from noise on LNB voltage.
57 * 61 *
62 * LME2510: SHARP:BS2F7HZ0194(MV0194) cannot cold reset and share system
63 * with other tuners. After a cold reset streaming will not start.
64 *
58 * PID functions have been removed from this driver version due to 65 * PID functions have been removed from this driver version due to
59 * problems with different firmware and application versions. 66 * problems with different firmware and application versions.
60 */ 67 */
@@ -69,6 +76,9 @@
69#include "tda10086.h" 76#include "tda10086.h"
70#include "stv0288.h" 77#include "stv0288.h"
71#include "ix2505v.h" 78#include "ix2505v.h"
79#include "stv0299.h"
80#include "dvb-pll.h"
81#include "z0194a.h"
72 82
73 83
74 84
@@ -96,8 +106,11 @@ MODULE_PARM_DESC(firmware, "set default firmware 0=Sharp7395 1=LG");
96 106
97 107
98DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 108DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
109
110#define TUNER_DEFAULT 0x0
99#define TUNER_LG 0x1 111#define TUNER_LG 0x1
100#define TUNER_S7395 0x2 112#define TUNER_S7395 0x2
113#define TUNER_S0194 0x3
101 114
102struct lme2510_state { 115struct lme2510_state {
103 u8 id; 116 u8 id;
@@ -249,6 +262,7 @@ static void lme2510_int_response(struct urb *lme_urb)
249 st->time_key = ibuf[7]; 262 st->time_key = ibuf[7];
250 break; 263 break;
251 case TUNER_S7395: 264 case TUNER_S7395:
265 case TUNER_S0194:
252 /* Tweak for earlier firmware*/ 266 /* Tweak for earlier firmware*/
253 if (ibuf[1] == 0x03) { 267 if (ibuf[1] == 0x03) {
254 if (ibuf[2] > 1) 268 if (ibuf[2] > 1)
@@ -364,6 +378,18 @@ static int lme2510_msg(struct dvb_usb_device *d,
364 msleep(5); 378 msleep(5);
365 } 379 }
366 break; 380 break;
381 case TUNER_S0194:
382 if (wbuf[2] == 0xd0) {
383 if (wbuf[3] == 0x1b) {
384 st->signal_lock = rbuf[1];
385 if ((st->stream_on & 1) &&
386 (st->signal_lock & 0x8)) {
387 lme2510_stream_restart(d);
388 st->i2c_talk_onoff = 0;
389 }
390 }
391 }
392 break;
367 default: 393 default:
368 break; 394 break;
369 } 395 }
@@ -423,6 +449,34 @@ static int lme2510_msg(struct dvb_usb_device *d,
423 break; 449 break;
424 } 450 }
425 break; 451 break;
452 case TUNER_S0194:
453 switch (wbuf[3]) {
454 case 0x18:
455 rbuf[0] = 0x55;
456 rbuf[1] = (st->signal_level & 0x80)
457 ? 0 : (st->signal_level * 2);
458 break;
459 case 0x24:
460 rbuf[0] = 0x55;
461 rbuf[1] = st->signal_sn;
462 break;
463 case 0x1b:
464 rbuf[0] = 0x55;
465 rbuf[1] = st->signal_lock;
466 break;
467 case 0x19:
468 case 0x25:
469 case 0x1e:
470 case 0x1d:
471 rbuf[0] = 0x55;
472 rbuf[1] = 0x00;
473 break;
474 default:
475 lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen);
476 st->i2c_talk_onoff = 1;
477 break;
478 }
479 break;
426 default: 480 default:
427 break; 481 break;
428 } 482 }
@@ -517,17 +571,14 @@ static int lme2510_identify_state(struct usb_device *udev,
517 struct dvb_usb_device_description **desc, 571 struct dvb_usb_device_description **desc,
518 int *cold) 572 int *cold)
519{ 573{
520 if (lme2510_return_status(udev) == 0x44) 574 *cold = 0;
521 *cold = 1;
522 else
523 *cold = 0;
524 return 0; 575 return 0;
525} 576}
526 577
527static int lme2510_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) 578static int lme2510_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
528{ 579{
529 struct lme2510_state *st = adap->dev->priv; 580 struct lme2510_state *st = adap->dev->priv;
530 static u8 clear_reg_3[] = LME_CLEAR_PID; 581 static u8 clear_reg_3[] = LME_CLEAR_PID;
531 static u8 rbuf[1]; 582 static u8 rbuf[1];
532 int ret = 0, rlen = sizeof(rbuf); 583 int ret = 0, rlen = sizeof(rbuf);
533 584
@@ -658,9 +709,6 @@ static int lme2510_download_firmware(struct usb_device *dev,
658 return (ret < 0) ? -ENODEV : 0; 709 return (ret < 0) ? -ENODEV : 0;
659} 710}
660 711
661/* Default firmware for LME2510C */
662char lme_firmware[50] = "dvb-usb-lme2510c-s7395.fw";
663
664static void lme_coldreset(struct usb_device *dev) 712static void lme_coldreset(struct usb_device *dev)
665{ 713{
666 int ret = 0, len_in; 714 int ret = 0, len_in;
@@ -678,49 +726,83 @@ static void lme_coldreset(struct usb_device *dev)
678static int lme_firmware_switch(struct usb_device *udev, int cold) 726static int lme_firmware_switch(struct usb_device *udev, int cold)
679{ 727{
680 const struct firmware *fw = NULL; 728 const struct firmware *fw = NULL;
681 char lme2510c_s7395[] = "dvb-usb-lme2510c-s7395.fw"; 729 const char fw_c_s7395[] = "dvb-usb-lme2510c-s7395.fw";
682 char lme2510c_lg[] = "dvb-usb-lme2510c-lg.fw"; 730 const char fw_c_lg[] = "dvb-usb-lme2510c-lg.fw";
683 char *firm_msg[] = {"Loading", "Switching to"}; 731 const char fw_c_s0194[] = "dvb-usb-lme2510c-s0194.fw";
684 int ret; 732 const char fw_lg[] = "dvb-usb-lme2510-lg.fw";
733 const char fw_s0194[] = "dvb-usb-lme2510-s0194.fw";
734 const char *fw_lme;
735 int ret, cold_fw;
685 736
686 cold = (cold > 0) ? (cold & 1) : 0; 737 cold = (cold > 0) ? (cold & 1) : 0;
687 738
688 if (udev->descriptor.idProduct == 0x1122) 739 cold_fw = !cold;
689 return 0;
690 740
691 switch (dvb_usb_lme2510_firmware) { 741 if (udev->descriptor.idProduct == 0x1122) {
692 case 0: 742 switch (dvb_usb_lme2510_firmware) {
693 default: 743 default:
694 memcpy(&lme_firmware, lme2510c_s7395, sizeof(lme2510c_s7395)); 744 dvb_usb_lme2510_firmware = TUNER_S0194;
695 ret = request_firmware(&fw, lme_firmware, &udev->dev); 745 case TUNER_S0194:
696 if (ret == 0) { 746 fw_lme = fw_s0194;
697 info("FRM %s S7395 Firmware", firm_msg[cold]); 747 ret = request_firmware(&fw, fw_lme, &udev->dev);
748 if (ret == 0) {
749 cold = 0;/*lme2510-s0194 cannot cold reset*/
750 break;
751 }
752 dvb_usb_lme2510_firmware = TUNER_LG;
753 case TUNER_LG:
754 fw_lme = fw_lg;
755 ret = request_firmware(&fw, fw_lme, &udev->dev);
756 if (ret == 0)
757 break;
758 info("FRM No Firmware Found - please install");
759 dvb_usb_lme2510_firmware = TUNER_DEFAULT;
760 cold = 0;
761 cold_fw = 0;
698 break; 762 break;
699 } 763 }
700 if (cold == 0) 764 } else {
701 dvb_usb_lme2510_firmware = 1; 765 switch (dvb_usb_lme2510_firmware) {
702 else 766 default:
767 dvb_usb_lme2510_firmware = TUNER_S7395;
768 case TUNER_S7395:
769 fw_lme = fw_c_s7395;
770 ret = request_firmware(&fw, fw_lme, &udev->dev);
771 if (ret == 0)
772 break;
773 dvb_usb_lme2510_firmware = TUNER_LG;
774 case TUNER_LG:
775 fw_lme = fw_c_lg;
776 ret = request_firmware(&fw, fw_lme, &udev->dev);
777 if (ret == 0)
778 break;
779 dvb_usb_lme2510_firmware = TUNER_S0194;
780 case TUNER_S0194:
781 fw_lme = fw_c_s0194;
782 ret = request_firmware(&fw, fw_lme, &udev->dev);
783 if (ret == 0)
784 break;
785 info("FRM No Firmware Found - please install");
786 dvb_usb_lme2510_firmware = TUNER_DEFAULT;
703 cold = 0; 787 cold = 0;
704 case 1: 788 cold_fw = 0;
705 memcpy(&lme_firmware, lme2510c_lg, sizeof(lme2510c_lg));
706 ret = request_firmware(&fw, lme_firmware, &udev->dev);
707 if (ret == 0) {
708 info("FRM %s LG Firmware", firm_msg[cold]);
709 break; 789 break;
710 } 790 }
711 info("FRM No Firmware Found - please install");
712 dvb_usb_lme2510_firmware = 0;
713 cold = 0;
714 break;
715 } 791 }
716 792
717 release_firmware(fw); 793 if (cold_fw) {
794 info("FRM Loading %s file", fw_lme);
795 ret = lme2510_download_firmware(udev, fw);
796 }
718 797
719 if (cold) { 798 if (cold) {
799 info("FRM Changing to %s firmware", fw_lme);
720 lme_coldreset(udev); 800 lme_coldreset(udev);
721 return -ENODEV; 801 return -ENODEV;
722 } 802 }
723 803
804 release_firmware(fw);
805
724 return ret; 806 return ret;
725} 807}
726 808
@@ -758,6 +840,18 @@ static struct ix2505v_config lme_tuner = {
758 .tuner_chargepump = 0x3, 840 .tuner_chargepump = 0x3,
759}; 841};
760 842
843static struct stv0299_config sharp_z0194_config = {
844 .demod_address = 0xd0,
845 .inittab = sharp_z0194a_inittab,
846 .mclk = 88000000UL,
847 .invert = 0,
848 .skip_reinit = 0,
849 .lock_output = STV0299_LOCKOUTPUT_1,
850 .volt13_op0_op1 = STV0299_VOLT13_OP1,
851 .min_delay_ms = 100,
852 .set_symbol_rate = sharp_z0194a_set_symbol_rate,
853};
854
761static int dm04_lme2510_set_voltage(struct dvb_frontend *fe, 855static int dm04_lme2510_set_voltage(struct dvb_frontend *fe,
762 fe_sec_voltage_t voltage) 856 fe_sec_voltage_t voltage)
763{ 857{
@@ -793,7 +887,8 @@ static int lme_name(struct dvb_usb_adapter *adap)
793{ 887{
794 struct lme2510_state *st = adap->dev->priv; 888 struct lme2510_state *st = adap->dev->priv;
795 const char *desc = adap->dev->desc->name; 889 const char *desc = adap->dev->desc->name;
796 char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"}; 890 char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395",
891 " SHARP:BS2F7HZ0194"};
797 char *name = adap->fe->ops.info.name; 892 char *name = adap->fe->ops.info.name;
798 893
799 strlcpy(name, desc, 128); 894 strlcpy(name, desc, 128);
@@ -820,26 +915,40 @@ static int dm04_lme2510_frontend_attach(struct dvb_usb_adapter *adap)
820 st->i2c_tuner_gate_r = 4; 915 st->i2c_tuner_gate_r = 4;
821 st->i2c_tuner_addr = 0xc0; 916 st->i2c_tuner_addr = 0xc0;
822 st->tuner_config = TUNER_LG; 917 st->tuner_config = TUNER_LG;
823 if (dvb_usb_lme2510_firmware != 1) { 918 if (dvb_usb_lme2510_firmware != TUNER_LG) {
824 dvb_usb_lme2510_firmware = 1; 919 dvb_usb_lme2510_firmware = TUNER_LG;
825 ret = lme_firmware_switch(adap->dev->udev, 1); 920 ret = lme_firmware_switch(adap->dev->udev, 1);
826 } else /*stops LG/Sharp multi tuner problems*/ 921 }
827 dvb_usb_lme2510_firmware = 0; 922 goto end;
923 }
924
925 st->i2c_gate = 4;
926 adap->fe = dvb_attach(stv0299_attach, &sharp_z0194_config,
927 &adap->dev->i2c_adap);
928 if (adap->fe) {
929 info("FE Found Stv0299");
930 st->i2c_tuner_gate_w = 4;
931 st->i2c_tuner_gate_r = 5;
932 st->i2c_tuner_addr = 0xc0;
933 st->tuner_config = TUNER_S0194;
934 if (dvb_usb_lme2510_firmware != TUNER_S0194) {
935 dvb_usb_lme2510_firmware = TUNER_S0194;
936 ret = lme_firmware_switch(adap->dev->udev, 1);
937 }
828 goto end; 938 goto end;
829 } 939 }
830 940
831 st->i2c_gate = 5; 941 st->i2c_gate = 5;
832 adap->fe = dvb_attach(stv0288_attach, &lme_config, 942 adap->fe = dvb_attach(stv0288_attach, &lme_config,
833 &adap->dev->i2c_adap); 943 &adap->dev->i2c_adap);
834
835 if (adap->fe) { 944 if (adap->fe) {
836 info("FE Found Stv0288"); 945 info("FE Found Stv0288");
837 st->i2c_tuner_gate_w = 4; 946 st->i2c_tuner_gate_w = 4;
838 st->i2c_tuner_gate_r = 5; 947 st->i2c_tuner_gate_r = 5;
839 st->i2c_tuner_addr = 0xc0; 948 st->i2c_tuner_addr = 0xc0;
840 st->tuner_config = TUNER_S7395; 949 st->tuner_config = TUNER_S7395;
841 if (dvb_usb_lme2510_firmware != 0) { 950 if (dvb_usb_lme2510_firmware != TUNER_S7395) {
842 dvb_usb_lme2510_firmware = 0; 951 dvb_usb_lme2510_firmware = TUNER_S7395;
843 ret = lme_firmware_switch(adap->dev->udev, 1); 952 ret = lme_firmware_switch(adap->dev->udev, 1);
844 } 953 }
845 } else { 954 } else {
@@ -847,6 +956,7 @@ static int dm04_lme2510_frontend_attach(struct dvb_usb_adapter *adap)
847 return -ENODEV; 956 return -ENODEV;
848 } 957 }
849 958
959
850end: if (ret) { 960end: if (ret) {
851 kfree(adap->fe); 961 kfree(adap->fe);
852 adap->fe = NULL; 962 adap->fe = NULL;
@@ -855,14 +965,13 @@ end: if (ret) {
855 965
856 adap->fe->ops.set_voltage = dm04_lme2510_set_voltage; 966 adap->fe->ops.set_voltage = dm04_lme2510_set_voltage;
857 ret = lme_name(adap); 967 ret = lme_name(adap);
858
859 return ret; 968 return ret;
860} 969}
861 970
862static int dm04_lme2510_tuner(struct dvb_usb_adapter *adap) 971static int dm04_lme2510_tuner(struct dvb_usb_adapter *adap)
863{ 972{
864 struct lme2510_state *st = adap->dev->priv; 973 struct lme2510_state *st = adap->dev->priv;
865 char *tun_msg[] = {"", "TDA8263", "IX2505V"}; 974 char *tun_msg[] = {"", "TDA8263", "IX2505V", "DVB_PLL_OPERA"};
866 int ret = 0; 975 int ret = 0;
867 976
868 switch (st->tuner_config) { 977 switch (st->tuner_config) {
@@ -876,6 +985,11 @@ static int dm04_lme2510_tuner(struct dvb_usb_adapter *adap)
876 &adap->dev->i2c_adap)) 985 &adap->dev->i2c_adap))
877 ret = st->tuner_config; 986 ret = st->tuner_config;
878 break; 987 break;
988 case TUNER_S0194:
989 if (dvb_attach(dvb_pll_attach , adap->fe, 0xc0,
990 &adap->dev->i2c_adap, DVB_PLL_OPERA1))
991 ret = st->tuner_config;
992 break;
879 default: 993 default:
880 break; 994 break;
881 } 995 }
@@ -936,7 +1050,10 @@ static int lme2510_probe(struct usb_interface *intf,
936 return -ENODEV; 1050 return -ENODEV;
937 } 1051 }
938 1052
939 lme_firmware_switch(udev, 0); 1053 if (lme2510_return_status(udev) == 0x44) {
1054 lme_firmware_switch(udev, 0);
1055 return -ENODEV;
1056 }
940 1057
941 if (0 == dvb_usb_device_init(intf, &lme2510_properties, 1058 if (0 == dvb_usb_device_init(intf, &lme2510_properties,
942 THIS_MODULE, NULL, adapter_nr)) { 1059 THIS_MODULE, NULL, adapter_nr)) {
@@ -964,10 +1081,6 @@ MODULE_DEVICE_TABLE(usb, lme2510_table);
964 1081
965static struct dvb_usb_device_properties lme2510_properties = { 1082static struct dvb_usb_device_properties lme2510_properties = {
966 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 1083 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
967 .usb_ctrl = DEVICE_SPECIFIC,
968 .download_firmware = lme2510_download_firmware,
969 .firmware = "dvb-usb-lme2510-lg.fw",
970
971 .size_of_priv = sizeof(struct lme2510_state), 1084 .size_of_priv = sizeof(struct lme2510_state),
972 .num_adapters = 1, 1085 .num_adapters = 1,
973 .adapter = { 1086 .adapter = {
@@ -1004,9 +1117,6 @@ static struct dvb_usb_device_properties lme2510_properties = {
1004 1117
1005static struct dvb_usb_device_properties lme2510c_properties = { 1118static struct dvb_usb_device_properties lme2510c_properties = {
1006 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 1119 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
1007 .usb_ctrl = DEVICE_SPECIFIC,
1008 .download_firmware = lme2510_download_firmware,
1009 .firmware = (const char *)&lme_firmware,
1010 .size_of_priv = sizeof(struct lme2510_state), 1120 .size_of_priv = sizeof(struct lme2510_state),
1011 .num_adapters = 1, 1121 .num_adapters = 1,
1012 .adapter = { 1122 .adapter = {
@@ -1109,5 +1219,5 @@ module_exit(lme2510_module_exit);
1109 1219
1110MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); 1220MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>");
1111MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0"); 1221MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0");
1112MODULE_VERSION("1.75"); 1222MODULE_VERSION("1.80");
1113MODULE_LICENSE("GPL"); 1223MODULE_LICENSE("GPL");