diff options
author | Andrew de Quincey <adq_dvb@lidskialf.net> | 2005-09-09 16:03:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-09 16:57:45 -0400 |
commit | dc27a1696089a9a9d317fc815915e6761e22eeb5 (patch) | |
tree | ce797c46a6c8ef98d7c7bcc5da90e210967799d3 /drivers/media/dvb/ttpci/budget-ci.c | |
parent | f63f5346c943008fe8f6ac66a9026f6c35e24947 (diff) |
[PATCH] dvb: budget-ci: add support for TT DVB-C CI card
Add support for TT DVB-C CI card.
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/dvb/ttpci/budget-ci.c')
-rw-r--r-- | drivers/media/dvb/ttpci/budget-ci.c | 188 |
1 files changed, 187 insertions, 1 deletions
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 88f27a532163..2980db3ef22f 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c | |||
@@ -40,6 +40,7 @@ | |||
40 | 40 | ||
41 | #include "dvb_ca_en50221.h" | 41 | #include "dvb_ca_en50221.h" |
42 | #include "stv0299.h" | 42 | #include "stv0299.h" |
43 | #include "stv0297.h" | ||
43 | #include "tda1004x.h" | 44 | #include "tda1004x.h" |
44 | 45 | ||
45 | #define DEBIADDR_IR 0x1234 | 46 | #define DEBIADDR_IR 0x1234 |
@@ -847,6 +848,180 @@ static struct tda1004x_config philips_tdm1316l_config = { | |||
847 | .request_firmware = philips_tdm1316l_request_firmware, | 848 | .request_firmware = philips_tdm1316l_request_firmware, |
848 | }; | 849 | }; |
849 | 850 | ||
851 | static int dvbc_philips_tdm1316l_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
852 | { | ||
853 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; | ||
854 | u8 tuner_buf[5]; | ||
855 | struct i2c_msg tuner_msg = {.addr = budget_ci->tuner_pll_address, | ||
856 | .flags = 0, | ||
857 | .buf = tuner_buf, | ||
858 | .len = sizeof(tuner_buf) }; | ||
859 | int tuner_frequency = 0; | ||
860 | u8 band, cp, filter; | ||
861 | |||
862 | // determine charge pump | ||
863 | tuner_frequency = params->frequency + 36125000; | ||
864 | if (tuner_frequency < 87000000) | ||
865 | return -EINVAL; | ||
866 | else if (tuner_frequency < 130000000) { | ||
867 | cp = 3; | ||
868 | band = 1; | ||
869 | } else if (tuner_frequency < 160000000) { | ||
870 | cp = 5; | ||
871 | band = 1; | ||
872 | } else if (tuner_frequency < 200000000) { | ||
873 | cp = 6; | ||
874 | band = 1; | ||
875 | } else if (tuner_frequency < 290000000) { | ||
876 | cp = 3; | ||
877 | band = 2; | ||
878 | } else if (tuner_frequency < 420000000) { | ||
879 | cp = 5; | ||
880 | band = 2; | ||
881 | } else if (tuner_frequency < 480000000) { | ||
882 | cp = 6; | ||
883 | band = 2; | ||
884 | } else if (tuner_frequency < 620000000) { | ||
885 | cp = 3; | ||
886 | band = 4; | ||
887 | } else if (tuner_frequency < 830000000) { | ||
888 | cp = 5; | ||
889 | band = 4; | ||
890 | } else if (tuner_frequency < 895000000) { | ||
891 | cp = 7; | ||
892 | band = 4; | ||
893 | } else | ||
894 | return -EINVAL; | ||
895 | |||
896 | // assume PLL filter should always be 8MHz for the moment. | ||
897 | filter = 1; | ||
898 | |||
899 | // calculate divisor | ||
900 | tuner_frequency = (params->frequency + 36125000 + (62500/2)) / 62500; | ||
901 | |||
902 | // setup tuner buffer | ||
903 | tuner_buf[0] = tuner_frequency >> 8; | ||
904 | tuner_buf[1] = tuner_frequency & 0xff; | ||
905 | tuner_buf[2] = 0xc8; | ||
906 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; | ||
907 | tuner_buf[4] = 0x80; | ||
908 | |||
909 | stv0297_enable_plli2c(fe); | ||
910 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) | ||
911 | return -EIO; | ||
912 | |||
913 | msleep(50); | ||
914 | |||
915 | stv0297_enable_plli2c(fe); | ||
916 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) | ||
917 | return -EIO; | ||
918 | |||
919 | msleep(1); | ||
920 | |||
921 | return 0; | ||
922 | } | ||
923 | |||
924 | static u8 dvbc_philips_tdm1316l_inittab[] = { | ||
925 | 0x80, 0x01, | ||
926 | 0x80, 0x00, | ||
927 | 0x81, 0x01, | ||
928 | 0x81, 0x00, | ||
929 | 0x00, 0x09, | ||
930 | 0x01, 0x69, | ||
931 | 0x03, 0x00, | ||
932 | 0x04, 0x00, | ||
933 | 0x07, 0x00, | ||
934 | 0x08, 0x00, | ||
935 | 0x20, 0x00, | ||
936 | 0x21, 0x40, | ||
937 | 0x22, 0x00, | ||
938 | 0x23, 0x00, | ||
939 | 0x24, 0x40, | ||
940 | 0x25, 0x88, | ||
941 | 0x30, 0xff, | ||
942 | 0x31, 0x00, | ||
943 | 0x32, 0xff, | ||
944 | 0x33, 0x00, | ||
945 | 0x34, 0x50, | ||
946 | 0x35, 0x7f, | ||
947 | 0x36, 0x00, | ||
948 | 0x37, 0x20, | ||
949 | 0x38, 0x00, | ||
950 | 0x40, 0x1c, | ||
951 | 0x41, 0xff, | ||
952 | 0x42, 0x29, | ||
953 | 0x43, 0x20, | ||
954 | 0x44, 0xff, | ||
955 | 0x45, 0x00, | ||
956 | 0x46, 0x00, | ||
957 | 0x49, 0x04, | ||
958 | 0x4a, 0x00, | ||
959 | 0x4b, 0x7b, | ||
960 | 0x52, 0x30, | ||
961 | 0x55, 0xae, | ||
962 | 0x56, 0x47, | ||
963 | 0x57, 0xe1, | ||
964 | 0x58, 0x3a, | ||
965 | 0x5a, 0x1e, | ||
966 | 0x5b, 0x34, | ||
967 | 0x60, 0x00, | ||
968 | 0x63, 0x00, | ||
969 | 0x64, 0x00, | ||
970 | 0x65, 0x00, | ||
971 | 0x66, 0x00, | ||
972 | 0x67, 0x00, | ||
973 | 0x68, 0x00, | ||
974 | 0x69, 0x00, | ||
975 | 0x6a, 0x02, | ||
976 | 0x6b, 0x00, | ||
977 | 0x70, 0xff, | ||
978 | 0x71, 0x00, | ||
979 | 0x72, 0x00, | ||
980 | 0x73, 0x00, | ||
981 | 0x74, 0x0c, | ||
982 | 0x80, 0x00, | ||
983 | 0x81, 0x00, | ||
984 | 0x82, 0x00, | ||
985 | 0x83, 0x00, | ||
986 | 0x84, 0x04, | ||
987 | 0x85, 0x80, | ||
988 | 0x86, 0x24, | ||
989 | 0x87, 0x78, | ||
990 | 0x88, 0x10, | ||
991 | 0x89, 0x00, | ||
992 | 0x90, 0x01, | ||
993 | 0x91, 0x01, | ||
994 | 0xa0, 0x04, | ||
995 | 0xa1, 0x00, | ||
996 | 0xa2, 0x00, | ||
997 | 0xb0, 0x91, | ||
998 | 0xb1, 0x0b, | ||
999 | 0xc0, 0x53, | ||
1000 | 0xc1, 0x70, | ||
1001 | 0xc2, 0x12, | ||
1002 | 0xd0, 0x00, | ||
1003 | 0xd1, 0x00, | ||
1004 | 0xd2, 0x00, | ||
1005 | 0xd3, 0x00, | ||
1006 | 0xd4, 0x00, | ||
1007 | 0xd5, 0x00, | ||
1008 | 0xde, 0x00, | ||
1009 | 0xdf, 0x00, | ||
1010 | 0x61, 0x38, | ||
1011 | 0x62, 0x0a, | ||
1012 | 0x53, 0x13, | ||
1013 | 0x59, 0x08, | ||
1014 | 0xff, 0xff, | ||
1015 | }; | ||
1016 | |||
1017 | static struct stv0297_config dvbc_philips_tdm1316l_config = { | ||
1018 | .demod_address = 0x1c, | ||
1019 | .inittab = dvbc_philips_tdm1316l_inittab, | ||
1020 | .invert = 0, | ||
1021 | .pll_set = dvbc_philips_tdm1316l_pll_set, | ||
1022 | }; | ||
1023 | |||
1024 | |||
850 | 1025 | ||
851 | 1026 | ||
852 | static void frontend_init(struct budget_ci *budget_ci) | 1027 | static void frontend_init(struct budget_ci *budget_ci) |
@@ -868,6 +1043,15 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
868 | } | 1043 | } |
869 | break; | 1044 | break; |
870 | 1045 | ||
1046 | case 0x1010: // TT DVB-C CI budget (stv0297/Philips tdm1316l(tda6651tt)) | ||
1047 | budget_ci->tuner_pll_address = 0x61; | ||
1048 | budget_ci->budget.dvb_frontend = | ||
1049 | stv0297_attach(&dvbc_philips_tdm1316l_config, &budget_ci->budget.i2c_adap); | ||
1050 | if (budget_ci->budget.dvb_frontend) { | ||
1051 | break; | ||
1052 | } | ||
1053 | break; | ||
1054 | |||
871 | case 0x1011: // Hauppauge/TT Nova-T budget (tda10045/Philips tdm1316l(tda6651tt) + TDA9889) | 1055 | case 0x1011: // Hauppauge/TT Nova-T budget (tda10045/Philips tdm1316l(tda6651tt) + TDA9889) |
872 | budget_ci->tuner_pll_address = 0x63; | 1056 | budget_ci->tuner_pll_address = 0x63; |
873 | budget_ci->budget.dvb_frontend = | 1057 | budget_ci->budget.dvb_frontend = |
@@ -877,7 +1061,7 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
877 | } | 1061 | } |
878 | break; | 1062 | break; |
879 | 1063 | ||
880 | case 0x1012: // Hauppauge/TT Nova-T CI budget (tda10045/Philips tdm1316l(tda6651tt) + TDA9889) | 1064 | case 0x1012: // TT DVB-T CI budget (tda10046/Philips tdm1316l(tda6651tt)) |
881 | budget_ci->tuner_pll_address = 0x60; | 1065 | budget_ci->tuner_pll_address = 0x60; |
882 | budget_ci->budget.dvb_frontend = | 1066 | budget_ci->budget.dvb_frontend = |
883 | tda10046_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); | 1067 | tda10046_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); |
@@ -965,10 +1149,12 @@ static struct saa7146_extension budget_extension; | |||
965 | MAKE_BUDGET_INFO(ttbci, "TT-Budget/WinTV-NOVA-CI PCI", BUDGET_TT_HW_DISEQC); | 1149 | MAKE_BUDGET_INFO(ttbci, "TT-Budget/WinTV-NOVA-CI PCI", BUDGET_TT_HW_DISEQC); |
966 | MAKE_BUDGET_INFO(ttbt2, "TT-Budget/WinTV-NOVA-T PCI", BUDGET_TT); | 1150 | MAKE_BUDGET_INFO(ttbt2, "TT-Budget/WinTV-NOVA-T PCI", BUDGET_TT); |
967 | MAKE_BUDGET_INFO(ttbtci, "TT-Budget-T-CI PCI", BUDGET_TT); | 1151 | MAKE_BUDGET_INFO(ttbtci, "TT-Budget-T-CI PCI", BUDGET_TT); |
1152 | MAKE_BUDGET_INFO(ttbcci, "TT-Budget-C-CI PCI", BUDGET_TT); | ||
968 | 1153 | ||
969 | static struct pci_device_id pci_tbl[] = { | 1154 | static struct pci_device_id pci_tbl[] = { |
970 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100c), | 1155 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100c), |
971 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100f), | 1156 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100f), |
1157 | MAKE_EXTENSION_PCI(ttbcci, 0x13c2, 0x1010), | ||
972 | MAKE_EXTENSION_PCI(ttbt2, 0x13c2, 0x1011), | 1158 | MAKE_EXTENSION_PCI(ttbt2, 0x13c2, 0x1011), |
973 | MAKE_EXTENSION_PCI(ttbtci, 0x13c2, 0x1012), | 1159 | MAKE_EXTENSION_PCI(ttbtci, 0x13c2, 0x1012), |
974 | { | 1160 | { |