aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/dvb/bt8xx/dst.c57
-rw-r--r--drivers/media/dvb/bt8xx/dst_common.h6
2 files changed, 41 insertions, 22 deletions
diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c
index 0f42ac90ee2c..f41585673424 100644
--- a/drivers/media/dvb/bt8xx/dst.c
+++ b/drivers/media/dvb/bt8xx/dst.c
@@ -81,9 +81,7 @@ int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh, int
81 dprintk("%s: dst_gpio_enb error (err == %i, mask == %02x, enb == %02x)\n", __FUNCTION__, err, mask, enbb); 81 dprintk("%s: dst_gpio_enb error (err == %i, mask == %02x, enb == %02x)\n", __FUNCTION__, err, mask, enbb);
82 return -EREMOTEIO; 82 return -EREMOTEIO;
83 } 83 }
84 84 udelay(1000);
85 msleep(1);
86
87 /* because complete disabling means no output, no need to do output packet */ 85 /* because complete disabling means no output, no need to do output packet */
88 if (enbb == 0) 86 if (enbb == 0)
89 return 0; 87 return 0;
@@ -150,8 +148,7 @@ int rdc_8820_reset(struct dst_state *state)
150 dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__); 148 dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__);
151 return -1; 149 return -1;
152 } 150 }
153 msleep(1); 151 udelay(1000);
154
155 if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET, RDC_8820_RESET, DELAY) < 0) { 152 if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET, RDC_8820_RESET, DELAY) < 0) {
156 dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__); 153 dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__);
157 return -1; 154 return -1;
@@ -167,8 +164,7 @@ int dst_pio_enable(struct dst_state *state)
167 dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__); 164 dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__);
168 return -1; 165 return -1;
169 } 166 }
170 msleep(1); 167 udelay(1000);
171
172 return 0; 168 return 0;
173} 169}
174EXPORT_SYMBOL(dst_pio_enable); 170EXPORT_SYMBOL(dst_pio_enable);
@@ -179,6 +175,8 @@ int dst_pio_disable(struct dst_state *state)
179 dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__); 175 dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__);
180 return -1; 176 return -1;
181 } 177 }
178 if (state->type_flags & DST_TYPE_HAS_FW_1)
179 udelay(1000);
182 180
183 return 0; 181 return 0;
184} 182}
@@ -200,7 +198,7 @@ int dst_wait_dst_ready(struct dst_state *state, u8 delay_mode)
200 dprintk("%s: dst wait ready after %d\n", __FUNCTION__, i); 198 dprintk("%s: dst wait ready after %d\n", __FUNCTION__, i);
201 return 1; 199 return 1;
202 } 200 }
203 msleep(1); 201 msleep(35);
204 } 202 }
205 if (verbose > 1) 203 if (verbose > 1)
206 dprintk("%s: dst wait NOT ready after %d\n", __FUNCTION__, i); 204 dprintk("%s: dst wait NOT ready after %d\n", __FUNCTION__, i);
@@ -245,6 +243,11 @@ int dst_comm_init(struct dst_state* state)
245 dprintk("%s: RDC 8820 State RESET Failed.\n", __FUNCTION__); 243 dprintk("%s: RDC 8820 State RESET Failed.\n", __FUNCTION__);
246 return -1; 244 return -1;
247 } 245 }
246 if (state->type_flags & DST_TYPE_HAS_FW_1)
247 msleep(100);
248 else
249 msleep(5);
250
248 return 0; 251 return 0;
249} 252}
250EXPORT_SYMBOL(dst_comm_init); 253EXPORT_SYMBOL(dst_comm_init);
@@ -328,8 +331,9 @@ static int dst_set_freq(struct dst_state *state, u32 freq)
328 u8 *val; 331 u8 *val;
329 332
330 state->frequency = freq; 333 state->frequency = freq;
334 if (debug > 4)
335 dprintk("%s: set Frequency %u\n", __FUNCTION__, freq);
331 336
332 // dprintk("%s: set frequency %u\n", __FUNCTION__, freq);
333 if (state->dst_type == DST_TYPE_IS_SAT) { 337 if (state->dst_type == DST_TYPE_IS_SAT) {
334 freq = freq / 1000; 338 freq = freq / 1000;
335 if (freq < 950 || freq > 2150) 339 if (freq < 950 || freq > 2150)
@@ -452,7 +456,8 @@ static int dst_set_symbolrate(struct dst_state* state, u32 srate)
452 if (state->dst_type == DST_TYPE_IS_TERR) { 456 if (state->dst_type == DST_TYPE_IS_TERR) {
453 return 0; 457 return 0;
454 } 458 }
455 // dprintk("%s: set srate %u\n", __FUNCTION__, srate); 459 if (debug > 4)
460 dprintk("%s: set symrate %u\n", __FUNCTION__, srate);
456 srate /= 1000; 461 srate /= 1000;
457 val = &state->tx_tuna[0]; 462 val = &state->tx_tuna[0];
458 463
@@ -461,7 +466,10 @@ static int dst_set_symbolrate(struct dst_state* state, u32 srate)
461 sval <<= 20; 466 sval <<= 20;
462 do_div(sval, 88000); 467 do_div(sval, 88000);
463 symcalc = (u32) sval; 468 symcalc = (u32) sval;
464 // dprintk("%s: set symcalc %u\n", __FUNCTION__, symcalc); 469
470 if (debug > 4)
471 dprintk("%s: set symcalc %u\n", __FUNCTION__, symcalc);
472
465 val[5] = (u8) (symcalc >> 12); 473 val[5] = (u8) (symcalc >> 12);
466 val[6] = (u8) (symcalc >> 4); 474 val[6] = (u8) (symcalc >> 4);
467 val[7] = (u8) (symcalc << 4); 475 val[7] = (u8) (symcalc << 4);
@@ -504,6 +512,7 @@ static void dst_type_flags_print(u32 type_flags)
504 printk(" 0x%x firmware version = 2", DST_TYPE_HAS_FW_2); 512 printk(" 0x%x firmware version = 2", DST_TYPE_HAS_FW_2);
505 if (type_flags & DST_TYPE_HAS_FW_3) 513 if (type_flags & DST_TYPE_HAS_FW_3)
506 printk(" 0x%x firmware version = 3", DST_TYPE_HAS_FW_3); 514 printk(" 0x%x firmware version = 3", DST_TYPE_HAS_FW_3);
515// if ((type_flags & DST_TYPE_HAS_FW_BUILD) && new_fw)
507 516
508 printk("\n"); 517 printk("\n");
509} 518}
@@ -617,13 +626,13 @@ struct dst_types dst_tlist[] = {
617 .dst_type = DST_TYPE_IS_SAT, 626 .dst_type = DST_TYPE_IS_SAT,
618 .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1, 627 .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1,
619 .dst_feature = DST_TYPE_HAS_CA 628 .dst_feature = DST_TYPE_HAS_CA
620 }, /* unknown to vendor */ 629 }, /* An OEM board */
621 630
622 { 631 {
623 .device_id = "DSTMCI", 632 .device_id = "DSTMCI",
624 .offset = 1, 633 .offset = 1,
625 .dst_type = DST_TYPE_IS_SAT, 634 .dst_type = DST_TYPE_IS_SAT,
626 .type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_2, 635 .type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_FW_BUILD,
627 .dst_feature = DST_TYPE_HAS_CA | DST_TYPE_HAS_DISEQC3 | DST_TYPE_HAS_DISEQC4 636 .dst_feature = DST_TYPE_HAS_CA | DST_TYPE_HAS_DISEQC3 | DST_TYPE_HAS_DISEQC4
628 | DST_TYPE_HAS_MOTO | DST_TYPE_HAS_MAC 637 | DST_TYPE_HAS_MOTO | DST_TYPE_HAS_MAC
629 }, 638 },
@@ -640,7 +649,8 @@ struct dst_types dst_tlist[] = {
640 .device_id = "DCT-CI", 649 .device_id = "DCT-CI",
641 .offset = 1, 650 .offset = 1,
642 .dst_type = DST_TYPE_IS_CABLE, 651 .dst_type = DST_TYPE_IS_CABLE,
643 .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1 | DST_TYPE_HAS_FW_2, 652 .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1
653 | DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_FW_BUILD,
644 .dst_feature = DST_TYPE_HAS_CA 654 .dst_feature = DST_TYPE_HAS_CA
645 }, 655 },
646 656
@@ -656,7 +666,7 @@ struct dst_types dst_tlist[] = {
656 .device_id = "DTT-CI", 666 .device_id = "DTT-CI",
657 .offset = 1, 667 .offset = 1,
658 .dst_type = DST_TYPE_IS_TERR, 668 .dst_type = DST_TYPE_IS_TERR,
659 .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_FW_2, 669 .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_FW_BUILD,
660 .dst_feature = 0 670 .dst_feature = 0
661 }, 671 },
662 672
@@ -782,7 +792,7 @@ static int dst_probe(struct dst_state *state)
782 dprintk("%s: DST Initialization Failed.\n", __FUNCTION__); 792 dprintk("%s: DST Initialization Failed.\n", __FUNCTION__);
783 return -1; 793 return -1;
784 } 794 }
785 795 msleep(100);
786 if (dst_get_device_id(state) < 0) { 796 if (dst_get_device_id(state) < 0) {
787 dprintk("%s: unknown device.\n", __FUNCTION__); 797 dprintk("%s: unknown device.\n", __FUNCTION__);
788 return -1; 798 return -1;
@@ -812,6 +822,8 @@ int dst_command(struct dst_state* state, u8 * data, u8 len)
812 dprintk("%s: PIO Disable Failed.\n", __FUNCTION__); 822 dprintk("%s: PIO Disable Failed.\n", __FUNCTION__);
813 return -1; 823 return -1;
814 } 824 }
825 if (state->type_flags & DST_TYPE_HAS_FW_1)
826 udelay(3000);
815 827
816 if (read_dst(state, &reply, GET_ACK)) { 828 if (read_dst(state, &reply, GET_ACK)) {
817 if (verbose > 1) 829 if (verbose > 1)
@@ -829,6 +841,13 @@ int dst_command(struct dst_state* state, u8 * data, u8 len)
829 } 841 }
830 if (len >= 2 && data[0] == 0 && (data[1] == 1 || data[1] == 3)) 842 if (len >= 2 && data[0] == 0 && (data[1] == 1 || data[1] == 3))
831 return 0; 843 return 0;
844
845// udelay(3000);
846 if (state->type_flags & DST_TYPE_HAS_FW_1)
847 udelay(3000);
848 else
849 udelay(2000);
850
832 if (!dst_wait_dst_ready(state, NO_DELAY)) 851 if (!dst_wait_dst_ready(state, NO_DELAY))
833 return -1; 852 return -1;
834 853
@@ -919,8 +938,6 @@ static int dst_get_tuna(struct dst_state* state)
919 if (!dst_wait_dst_ready(state, NO_DELAY)) 938 if (!dst_wait_dst_ready(state, NO_DELAY))
920 return 0; 939 return 0;
921 940
922 msleep(10);
923
924 if (state->type_flags & DST_TYPE_HAS_NEWTUNE) { 941 if (state->type_flags & DST_TYPE_HAS_NEWTUNE) {
925 /* how to get variable length reply ???? */ 942 /* how to get variable length reply ???? */
926 retval = read_dst(state, state->rx_tuna, 10); 943 retval = read_dst(state, state->rx_tuna, 10);
@@ -969,7 +986,9 @@ static int dst_write_tuna(struct dvb_frontend* fe)
969 int retval; 986 int retval;
970 u8 reply; 987 u8 reply;
971 988
972 dprintk("%s: type_flags 0x%x \n", __FUNCTION__, state->type_flags); 989 if (debug > 4)
990 dprintk("%s: type_flags 0x%x \n", __FUNCTION__, state->type_flags);
991
973 state->decode_freq = 0; 992 state->decode_freq = 0;
974 state->decode_lock = state->decode_strength = state->decode_snr = 0; 993 state->decode_lock = state->decode_strength = state->decode_snr = 0;
975 if (state->dst_type == DST_TYPE_IS_SAT) { 994 if (state->dst_type == DST_TYPE_IS_SAT) {
diff --git a/drivers/media/dvb/bt8xx/dst_common.h b/drivers/media/dvb/bt8xx/dst_common.h
index 10046d6292b7..e3b59f16c7af 100644
--- a/drivers/media/dvb/bt8xx/dst_common.h
+++ b/drivers/media/dvb/bt8xx/dst_common.h
@@ -46,7 +46,7 @@
46#define DST_TYPE_HAS_FW_1 8 46#define DST_TYPE_HAS_FW_1 8
47#define DST_TYPE_HAS_FW_2 16 47#define DST_TYPE_HAS_FW_2 16
48#define DST_TYPE_HAS_FW_3 32 48#define DST_TYPE_HAS_FW_3 32
49 49#define DST_TYPE_HAS_FW_BUILD 64
50 50
51 51
52/* Card capability list */ 52/* Card capability list */
@@ -117,8 +117,8 @@ struct dst_types {
117 char *device_id; 117 char *device_id;
118 int offset; 118 int offset;
119 u8 dst_type; 119 u8 dst_type;
120 u32 type_flags; 120 u64 type_flags;
121 u8 dst_feature; 121 u64 dst_feature;
122}; 122};
123 123
124 124