diff options
Diffstat (limited to 'drivers/media/dvb/ttpci/budget-ci.c')
| -rw-r--r-- | drivers/media/dvb/ttpci/budget-ci.c | 197 |
1 files changed, 191 insertions, 6 deletions
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index a1267054bc01..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 |
| @@ -548,9 +549,8 @@ static int alps_bsru6_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 ra | |||
| 548 | return 0; | 549 | return 0; |
| 549 | } | 550 | } |
| 550 | 551 | ||
| 551 | static int alps_bsru6_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 552 | static int alps_bsru6_pll_set(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters *params) |
| 552 | { | 553 | { |
| 553 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; | ||
| 554 | u8 buf[4]; | 554 | u8 buf[4]; |
| 555 | u32 div; | 555 | u32 div; |
| 556 | struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = sizeof(buf) }; | 556 | struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = sizeof(buf) }; |
| @@ -567,7 +567,7 @@ static int alps_bsru6_pll_set(struct dvb_frontend *fe, struct dvb_frontend_param | |||
| 567 | if (params->frequency > 1530000) | 567 | if (params->frequency > 1530000) |
| 568 | buf[3] = 0xc0; | 568 | buf[3] = 0xc0; |
| 569 | 569 | ||
| 570 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &msg, 1) != 1) | 570 | if (i2c_transfer(i2c, &msg, 1) != 1) |
| 571 | return -EIO; | 571 | return -EIO; |
| 572 | return 0; | 572 | return 0; |
| 573 | } | 573 | } |
| @@ -669,9 +669,9 @@ static int philips_su1278_tt_set_symbol_rate(struct dvb_frontend *fe, u32 srate, | |||
| 669 | } | 669 | } |
| 670 | 670 | ||
| 671 | static int philips_su1278_tt_pll_set(struct dvb_frontend *fe, | 671 | static int philips_su1278_tt_pll_set(struct dvb_frontend *fe, |
| 672 | struct i2c_adapter *i2c, | ||
| 672 | struct dvb_frontend_parameters *params) | 673 | struct dvb_frontend_parameters *params) |
| 673 | { | 674 | { |
| 674 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; | ||
| 675 | u32 div; | 675 | u32 div; |
| 676 | u8 buf[4]; | 676 | u8 buf[4]; |
| 677 | struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) }; | 677 | struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) }; |
| @@ -697,7 +697,7 @@ static int philips_su1278_tt_pll_set(struct dvb_frontend *fe, | |||
| 697 | else if (params->frequency < 2150000) | 697 | else if (params->frequency < 2150000) |
| 698 | buf[3] |= 0xC0; | 698 | buf[3] |= 0xC0; |
| 699 | 699 | ||
| 700 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &msg, 1) != 1) | 700 | if (i2c_transfer(i2c, &msg, 1) != 1) |
| 701 | return -EIO; | 701 | return -EIO; |
| 702 | return 0; | 702 | return 0; |
| 703 | } | 703 | } |
| @@ -848,6 +848,180 @@ static struct tda1004x_config philips_tdm1316l_config = { | |||
| 848 | .request_firmware = philips_tdm1316l_request_firmware, | 848 | .request_firmware = philips_tdm1316l_request_firmware, |
| 849 | }; | 849 | }; |
| 850 | 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 | |||
| 851 | 1025 | ||
| 852 | 1026 | ||
| 853 | static void frontend_init(struct budget_ci *budget_ci) | 1027 | static void frontend_init(struct budget_ci *budget_ci) |
| @@ -869,6 +1043,15 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
| 869 | } | 1043 | } |
| 870 | break; | 1044 | break; |
| 871 | 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 | |||
| 872 | 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) |
| 873 | budget_ci->tuner_pll_address = 0x63; | 1056 | budget_ci->tuner_pll_address = 0x63; |
| 874 | budget_ci->budget.dvb_frontend = | 1057 | budget_ci->budget.dvb_frontend = |
| @@ -878,7 +1061,7 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
| 878 | } | 1061 | } |
| 879 | break; | 1062 | break; |
| 880 | 1063 | ||
| 881 | 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)) |
| 882 | budget_ci->tuner_pll_address = 0x60; | 1065 | budget_ci->tuner_pll_address = 0x60; |
| 883 | budget_ci->budget.dvb_frontend = | 1066 | budget_ci->budget.dvb_frontend = |
| 884 | tda10046_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); | 1067 | tda10046_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); |
| @@ -966,10 +1149,12 @@ static struct saa7146_extension budget_extension; | |||
| 966 | 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); |
| 967 | 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); |
| 968 | 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); | ||
| 969 | 1153 | ||
| 970 | static struct pci_device_id pci_tbl[] = { | 1154 | static struct pci_device_id pci_tbl[] = { |
| 971 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100c), | 1155 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100c), |
| 972 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100f), | 1156 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100f), |
| 1157 | MAKE_EXTENSION_PCI(ttbcci, 0x13c2, 0x1010), | ||
| 973 | MAKE_EXTENSION_PCI(ttbt2, 0x13c2, 0x1011), | 1158 | MAKE_EXTENSION_PCI(ttbt2, 0x13c2, 0x1011), |
| 974 | MAKE_EXTENSION_PCI(ttbtci, 0x13c2, 0x1012), | 1159 | MAKE_EXTENSION_PCI(ttbtci, 0x13c2, 0x1012), |
| 975 | { | 1160 | { |
