diff options
Diffstat (limited to 'drivers/media/dvb/ttpci/budget-av.c')
-rw-r--r-- | drivers/media/dvb/ttpci/budget-av.c | 147 |
1 files changed, 80 insertions, 67 deletions
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index 3035b224c7a3..0e817d6f1ce5 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | #include "budget.h" | 36 | #include "budget.h" |
37 | #include "stv0299.h" | 37 | #include "stv0299.h" |
38 | #include "tda10021.h" | 38 | #include "tda1002x.h" |
39 | #include "tda1004x.h" | 39 | #include "tda1004x.h" |
40 | #include "tua6100.h" | 40 | #include "tua6100.h" |
41 | #include "dvb-pll.h" | 41 | #include "dvb-pll.h" |
@@ -66,9 +66,6 @@ struct budget_av { | |||
66 | int slot_status; | 66 | int slot_status; |
67 | struct dvb_ca_en50221 ca; | 67 | struct dvb_ca_en50221 ca; |
68 | u8 reinitialise_demod:1; | 68 | u8 reinitialise_demod:1; |
69 | u8 tda10021_poclkp:1; | ||
70 | u8 tda10021_ts_enabled; | ||
71 | int (*tda10021_set_frontend)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p); | ||
72 | }; | 69 | }; |
73 | 70 | ||
74 | static int ciintf_slot_shutdown(struct dvb_ca_en50221 *ca, int slot); | 71 | static int ciintf_slot_shutdown(struct dvb_ca_en50221 *ca, int slot); |
@@ -234,12 +231,6 @@ static int ciintf_slot_reset(struct dvb_ca_en50221 *ca, int slot) | |||
234 | if (budget_av->reinitialise_demod) | 231 | if (budget_av->reinitialise_demod) |
235 | dvb_frontend_reinitialise(budget_av->budget.dvb_frontend); | 232 | dvb_frontend_reinitialise(budget_av->budget.dvb_frontend); |
236 | 233 | ||
237 | /* set tda10021 back to original clock configuration on reset */ | ||
238 | if (budget_av->tda10021_poclkp) { | ||
239 | tda10021_writereg(budget_av->budget.dvb_frontend, 0x12, 0xa0); | ||
240 | budget_av->tda10021_ts_enabled = 0; | ||
241 | } | ||
242 | |||
243 | return 0; | 234 | return 0; |
244 | } | 235 | } |
245 | 236 | ||
@@ -256,11 +247,6 @@ static int ciintf_slot_shutdown(struct dvb_ca_en50221 *ca, int slot) | |||
256 | ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTB); | 247 | ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTB); |
257 | budget_av->slot_status = SLOTSTATUS_NONE; | 248 | budget_av->slot_status = SLOTSTATUS_NONE; |
258 | 249 | ||
259 | /* set tda10021 back to original clock configuration when cam removed */ | ||
260 | if (budget_av->tda10021_poclkp) { | ||
261 | tda10021_writereg(budget_av->budget.dvb_frontend, 0x12, 0xa0); | ||
262 | budget_av->tda10021_ts_enabled = 0; | ||
263 | } | ||
264 | return 0; | 250 | return 0; |
265 | } | 251 | } |
266 | 252 | ||
@@ -276,12 +262,6 @@ static int ciintf_slot_ts_enable(struct dvb_ca_en50221 *ca, int slot) | |||
276 | 262 | ||
277 | ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTA); | 263 | ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTA); |
278 | 264 | ||
279 | /* tda10021 seems to need a different TS clock config when data is routed to the CAM */ | ||
280 | if (budget_av->tda10021_poclkp) { | ||
281 | tda10021_writereg(budget_av->budget.dvb_frontend, 0x12, 0xa1); | ||
282 | budget_av->tda10021_ts_enabled = 1; | ||
283 | } | ||
284 | |||
285 | return 0; | 265 | return 0; |
286 | } | 266 | } |
287 | 267 | ||
@@ -631,37 +611,62 @@ static struct stv0299_config cinergy_1200s_1894_0010_config = { | |||
631 | static int philips_cu1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 611 | static int philips_cu1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
632 | { | 612 | { |
633 | struct budget *budget = (struct budget *) fe->dvb->priv; | 613 | struct budget *budget = (struct budget *) fe->dvb->priv; |
634 | u8 buf[4]; | 614 | u8 buf[6]; |
635 | struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) }; | 615 | struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) }; |
616 | int i; | ||
636 | 617 | ||
618 | #define CU1216_IF 36125000 | ||
637 | #define TUNER_MUL 62500 | 619 | #define TUNER_MUL 62500 |
638 | 620 | ||
639 | u32 div = (params->frequency + 36125000 + TUNER_MUL / 2) / TUNER_MUL; | 621 | u32 div = (params->frequency + CU1216_IF + TUNER_MUL / 2) / TUNER_MUL; |
640 | 622 | ||
641 | buf[0] = (div >> 8) & 0x7f; | 623 | buf[0] = (div >> 8) & 0x7f; |
642 | buf[1] = div & 0xff; | 624 | buf[1] = div & 0xff; |
643 | buf[2] = 0x86; | 625 | buf[2] = 0xce; |
644 | buf[3] = (params->frequency < 150000000 ? 0x01 : | 626 | buf[3] = (params->frequency < 150000000 ? 0x01 : |
645 | params->frequency < 445000000 ? 0x02 : 0x04); | 627 | params->frequency < 445000000 ? 0x02 : 0x04); |
628 | buf[4] = 0xde; | ||
629 | buf[5] = 0x20; | ||
630 | |||
631 | if (fe->ops.i2c_gate_ctrl) | ||
632 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
633 | if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1) | ||
634 | return -EIO; | ||
646 | 635 | ||
636 | /* wait for the pll lock */ | ||
637 | msg.flags = I2C_M_RD; | ||
638 | msg.len = 1; | ||
639 | for (i = 0; i < 20; i++) { | ||
640 | if (fe->ops.i2c_gate_ctrl) | ||
641 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
642 | if (i2c_transfer(&budget->i2c_adap, &msg, 1) == 1 && (buf[0] & 0x40)) | ||
643 | break; | ||
644 | msleep(10); | ||
645 | } | ||
646 | |||
647 | /* switch the charge pump to the lower current */ | ||
648 | msg.flags = 0; | ||
649 | msg.len = 2; | ||
650 | msg.buf = &buf[2]; | ||
651 | buf[2] &= ~0x40; | ||
647 | if (fe->ops.i2c_gate_ctrl) | 652 | if (fe->ops.i2c_gate_ctrl) |
648 | fe->ops.i2c_gate_ctrl(fe, 1); | 653 | fe->ops.i2c_gate_ctrl(fe, 1); |
649 | if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1) | 654 | if (i2c_transfer(&budget->i2c_adap, &msg, 1) != 1) |
650 | return -EIO; | 655 | return -EIO; |
656 | |||
651 | return 0; | 657 | return 0; |
652 | } | 658 | } |
653 | 659 | ||
654 | static struct tda10021_config philips_cu1216_config = { | 660 | static struct tda1002x_config philips_cu1216_config = { |
655 | .demod_address = 0x0c, | 661 | .demod_address = 0x0c, |
662 | .invert = 1, | ||
656 | }; | 663 | }; |
657 | 664 | ||
658 | static struct tda10021_config philips_cu1216_config_altaddress = { | 665 | static struct tda1002x_config philips_cu1216_config_altaddress = { |
659 | .demod_address = 0x0d, | 666 | .demod_address = 0x0d, |
667 | .invert = 0, | ||
660 | }; | 668 | }; |
661 | 669 | ||
662 | |||
663 | |||
664 | |||
665 | static int philips_tu1216_tuner_init(struct dvb_frontend *fe) | 670 | static int philips_tu1216_tuner_init(struct dvb_frontend *fe) |
666 | { | 671 | { |
667 | struct budget *budget = (struct budget *) fe->dvb->priv; | 672 | struct budget *budget = (struct budget *) fe->dvb->priv; |
@@ -908,41 +913,28 @@ static u8 read_pwm(struct budget_av *budget_av) | |||
908 | return pwm; | 913 | return pwm; |
909 | } | 914 | } |
910 | 915 | ||
911 | #define SUBID_DVBS_KNC1 0x0010 | 916 | #define SUBID_DVBS_KNC1 0x0010 |
912 | #define SUBID_DVBS_KNC1_PLUS 0x0011 | 917 | #define SUBID_DVBS_KNC1_PLUS 0x0011 |
913 | #define SUBID_DVBS_TYPHOON 0x4f56 | 918 | #define SUBID_DVBS_TYPHOON 0x4f56 |
914 | #define SUBID_DVBS_CINERGY1200 0x1154 | 919 | #define SUBID_DVBS_CINERGY1200 0x1154 |
915 | #define SUBID_DVBS_CYNERGY1200N 0x1155 | 920 | #define SUBID_DVBS_CYNERGY1200N 0x1155 |
916 | 921 | #define SUBID_DVBS_TV_STAR 0x0014 | |
917 | #define SUBID_DVBS_TV_STAR 0x0014 | 922 | #define SUBID_DVBS_TV_STAR_CI 0x0016 |
918 | #define SUBID_DVBS_TV_STAR_CI 0x0016 | 923 | #define SUBID_DVBS_EASYWATCH_1 0x001a |
919 | #define SUBID_DVBS_EASYWATCH_1 0x001a | 924 | #define SUBID_DVBS_EASYWATCH 0x001e |
920 | #define SUBID_DVBS_EASYWATCH 0x001e | 925 | |
921 | #define SUBID_DVBC_EASYWATCH 0x002a | 926 | #define SUBID_DVBC_EASYWATCH 0x002a |
922 | #define SUBID_DVBC_KNC1 0x0020 | 927 | #define SUBID_DVBC_EASYWATCH_MK3 0x002c |
923 | #define SUBID_DVBC_KNC1_PLUS 0x0021 | 928 | #define SUBID_DVBC_KNC1 0x0020 |
924 | #define SUBID_DVBC_CINERGY1200 0x1156 | 929 | #define SUBID_DVBC_KNC1_PLUS 0x0021 |
925 | 930 | #define SUBID_DVBC_KNC1_MK3 0x0022 | |
926 | #define SUBID_DVBT_KNC1_PLUS 0x0031 | 931 | #define SUBID_DVBC_KNC1_PLUS_MK3 0x0023 |
927 | #define SUBID_DVBT_KNC1 0x0030 | 932 | #define SUBID_DVBC_CINERGY1200 0x1156 |
928 | #define SUBID_DVBT_CINERGY1200 0x1157 | 933 | #define SUBID_DVBC_CINERGY1200_MK3 0x1176 |
929 | 934 | ||
930 | 935 | #define SUBID_DVBT_KNC1_PLUS 0x0031 | |
931 | static int tda10021_set_frontend(struct dvb_frontend *fe, | 936 | #define SUBID_DVBT_KNC1 0x0030 |
932 | struct dvb_frontend_parameters *p) | 937 | #define SUBID_DVBT_CINERGY1200 0x1157 |
933 | { | ||
934 | struct budget_av* budget_av = fe->dvb->priv; | ||
935 | int result; | ||
936 | |||
937 | result = budget_av->tda10021_set_frontend(fe, p); | ||
938 | if (budget_av->tda10021_ts_enabled) { | ||
939 | tda10021_writereg(budget_av->budget.dvb_frontend, 0x12, 0xa1); | ||
940 | } else { | ||
941 | tda10021_writereg(budget_av->budget.dvb_frontend, 0x12, 0xa0); | ||
942 | } | ||
943 | |||
944 | return result; | ||
945 | } | ||
946 | 938 | ||
947 | static void frontend_init(struct budget_av *budget_av) | 939 | static void frontend_init(struct budget_av *budget_av) |
948 | { | 940 | { |
@@ -961,6 +953,7 @@ static void frontend_init(struct budget_av *budget_av) | |||
961 | case SUBID_DVBC_KNC1_PLUS: | 953 | case SUBID_DVBC_KNC1_PLUS: |
962 | case SUBID_DVBT_KNC1_PLUS: | 954 | case SUBID_DVBT_KNC1_PLUS: |
963 | case SUBID_DVBC_EASYWATCH: | 955 | case SUBID_DVBC_EASYWATCH: |
956 | case SUBID_DVBC_KNC1_PLUS_MK3: | ||
964 | saa7146_setgpio(saa, 3, SAA7146_GPIO_OUTHI); | 957 | saa7146_setgpio(saa, 3, SAA7146_GPIO_OUTHI); |
965 | break; | 958 | break; |
966 | } | 959 | } |
@@ -1017,6 +1010,7 @@ static void frontend_init(struct budget_av *budget_av) | |||
1017 | case SUBID_DVBC_CINERGY1200: | 1010 | case SUBID_DVBC_CINERGY1200: |
1018 | case SUBID_DVBC_EASYWATCH: | 1011 | case SUBID_DVBC_EASYWATCH: |
1019 | budget_av->reinitialise_demod = 1; | 1012 | budget_av->reinitialise_demod = 1; |
1013 | budget_av->budget.dev->i2c_bitrate = SAA7146_I2C_BUS_BIT_RATE_240; | ||
1020 | fe = dvb_attach(tda10021_attach, &philips_cu1216_config, | 1014 | fe = dvb_attach(tda10021_attach, &philips_cu1216_config, |
1021 | &budget_av->budget.i2c_adap, | 1015 | &budget_av->budget.i2c_adap, |
1022 | read_pwm(budget_av)); | 1016 | read_pwm(budget_av)); |
@@ -1025,9 +1019,20 @@ static void frontend_init(struct budget_av *budget_av) | |||
1025 | &budget_av->budget.i2c_adap, | 1019 | &budget_av->budget.i2c_adap, |
1026 | read_pwm(budget_av)); | 1020 | read_pwm(budget_av)); |
1027 | if (fe) { | 1021 | if (fe) { |
1028 | budget_av->tda10021_poclkp = 1; | 1022 | fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set_params; |
1029 | budget_av->tda10021_set_frontend = fe->ops.set_frontend; | 1023 | } |
1030 | fe->ops.set_frontend = tda10021_set_frontend; | 1024 | break; |
1025 | |||
1026 | case SUBID_DVBC_EASYWATCH_MK3: | ||
1027 | case SUBID_DVBC_CINERGY1200_MK3: | ||
1028 | case SUBID_DVBC_KNC1_MK3: | ||
1029 | case SUBID_DVBC_KNC1_PLUS_MK3: | ||
1030 | budget_av->reinitialise_demod = 1; | ||
1031 | budget_av->budget.dev->i2c_bitrate = SAA7146_I2C_BUS_BIT_RATE_240; | ||
1032 | fe = dvb_attach(tda10023_attach, &philips_cu1216_config, | ||
1033 | &budget_av->budget.i2c_adap, | ||
1034 | read_pwm(budget_av)); | ||
1035 | if (fe) { | ||
1031 | fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set_params; | 1036 | fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set_params; |
1032 | } | 1037 | } |
1033 | break; | 1038 | break; |
@@ -1260,12 +1265,16 @@ MAKE_BUDGET_INFO(kncxs, "KNC TV STAR DVB-S", BUDGET_TVSTAR); | |||
1260 | MAKE_BUDGET_INFO(satewpls, "Satelco EasyWatch DVB-S light", BUDGET_TVSTAR); | 1265 | MAKE_BUDGET_INFO(satewpls, "Satelco EasyWatch DVB-S light", BUDGET_TVSTAR); |
1261 | MAKE_BUDGET_INFO(satewpls1, "Satelco EasyWatch DVB-S light", BUDGET_KNC1S); | 1266 | MAKE_BUDGET_INFO(satewpls1, "Satelco EasyWatch DVB-S light", BUDGET_KNC1S); |
1262 | MAKE_BUDGET_INFO(satewplc, "Satelco EasyWatch DVB-C", BUDGET_KNC1CP); | 1267 | MAKE_BUDGET_INFO(satewplc, "Satelco EasyWatch DVB-C", BUDGET_KNC1CP); |
1268 | MAKE_BUDGET_INFO(satewcmk3, "Satelco EasyWatch DVB-C MK3", BUDGET_KNC1C_MK3); | ||
1263 | MAKE_BUDGET_INFO(knc1sp, "KNC1 DVB-S Plus", BUDGET_KNC1SP); | 1269 | MAKE_BUDGET_INFO(knc1sp, "KNC1 DVB-S Plus", BUDGET_KNC1SP); |
1264 | MAKE_BUDGET_INFO(knc1cp, "KNC1 DVB-C Plus", BUDGET_KNC1CP); | 1270 | MAKE_BUDGET_INFO(knc1cp, "KNC1 DVB-C Plus", BUDGET_KNC1CP); |
1271 | MAKE_BUDGET_INFO(knc1cmk3, "KNC1 DVB-C MK3", BUDGET_KNC1C_MK3); | ||
1272 | MAKE_BUDGET_INFO(knc1cpmk3, "KNC1 DVB-C Plus MK3", BUDGET_KNC1CP_MK3); | ||
1265 | MAKE_BUDGET_INFO(knc1tp, "KNC1 DVB-T Plus", BUDGET_KNC1TP); | 1273 | MAKE_BUDGET_INFO(knc1tp, "KNC1 DVB-T Plus", BUDGET_KNC1TP); |
1266 | MAKE_BUDGET_INFO(cin1200s, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S); | 1274 | MAKE_BUDGET_INFO(cin1200s, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S); |
1267 | MAKE_BUDGET_INFO(cin1200sn, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S); | 1275 | MAKE_BUDGET_INFO(cin1200sn, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S); |
1268 | MAKE_BUDGET_INFO(cin1200c, "Terratec Cinergy 1200 DVB-C", BUDGET_CIN1200C); | 1276 | MAKE_BUDGET_INFO(cin1200c, "Terratec Cinergy 1200 DVB-C", BUDGET_CIN1200C); |
1277 | MAKE_BUDGET_INFO(cin1200cmk3, "Terratec Cinergy 1200 DVB-C MK3", BUDGET_CIN1200C_MK3); | ||
1269 | MAKE_BUDGET_INFO(cin1200t, "Terratec Cinergy 1200 DVB-T", BUDGET_CIN1200T); | 1278 | MAKE_BUDGET_INFO(cin1200t, "Terratec Cinergy 1200 DVB-T", BUDGET_CIN1200T); |
1270 | 1279 | ||
1271 | static struct pci_device_id pci_tbl[] = { | 1280 | static struct pci_device_id pci_tbl[] = { |
@@ -1279,13 +1288,17 @@ static struct pci_device_id pci_tbl[] = { | |||
1279 | MAKE_EXTENSION_PCI(satewpls, 0x1894, 0x001e), | 1288 | MAKE_EXTENSION_PCI(satewpls, 0x1894, 0x001e), |
1280 | MAKE_EXTENSION_PCI(satewpls1, 0x1894, 0x001a), | 1289 | MAKE_EXTENSION_PCI(satewpls1, 0x1894, 0x001a), |
1281 | MAKE_EXTENSION_PCI(satewplc, 0x1894, 0x002a), | 1290 | MAKE_EXTENSION_PCI(satewplc, 0x1894, 0x002a), |
1291 | MAKE_EXTENSION_PCI(satewcmk3, 0x1894, 0x002c), | ||
1282 | MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020), | 1292 | MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020), |
1283 | MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021), | 1293 | MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021), |
1294 | MAKE_EXTENSION_PCI(knc1cmk3, 0x1894, 0x0022), | ||
1295 | MAKE_EXTENSION_PCI(knc1cpmk3, 0x1894, 0x0023), | ||
1284 | MAKE_EXTENSION_PCI(knc1t, 0x1894, 0x0030), | 1296 | MAKE_EXTENSION_PCI(knc1t, 0x1894, 0x0030), |
1285 | MAKE_EXTENSION_PCI(knc1tp, 0x1894, 0x0031), | 1297 | MAKE_EXTENSION_PCI(knc1tp, 0x1894, 0x0031), |
1286 | MAKE_EXTENSION_PCI(cin1200s, 0x153b, 0x1154), | 1298 | MAKE_EXTENSION_PCI(cin1200s, 0x153b, 0x1154), |
1287 | MAKE_EXTENSION_PCI(cin1200sn, 0x153b, 0x1155), | 1299 | MAKE_EXTENSION_PCI(cin1200sn, 0x153b, 0x1155), |
1288 | MAKE_EXTENSION_PCI(cin1200c, 0x153b, 0x1156), | 1300 | MAKE_EXTENSION_PCI(cin1200c, 0x153b, 0x1156), |
1301 | MAKE_EXTENSION_PCI(cin1200cmk3, 0x153b, 0x1176), | ||
1289 | MAKE_EXTENSION_PCI(cin1200t, 0x153b, 0x1157), | 1302 | MAKE_EXTENSION_PCI(cin1200t, 0x153b, 0x1157), |
1290 | { | 1303 | { |
1291 | .vendor = 0, | 1304 | .vendor = 0, |