• Home
  • Raw
  • Download

Lines Matching refs:state

58 				state->bt->nr, __func__ , ##arg);	\
61 state->bt->nr, __func__ , ##arg); \
64 state->bt->nr, __func__ , ##arg); \
67 state->bt->nr, __func__ , ##arg); \
74 static int dst_command(struct dst_state *state, u8 *data, u8 len);
76 static void dst_packsize(struct dst_state *state, int psize) in dst_packsize() argument
81 bt878_device_control(state->bt, DST_IG_TS, &bits); in dst_packsize()
84 static int dst_gpio_outb(struct dst_state *state, u32 mask, u32 enbb, in dst_gpio_outb() argument
95 if ((err = bt878_device_control(state->bt, DST_IG_ENABLE, &enb)) < 0) { in dst_gpio_outb()
107 if ((err = bt878_device_control(state->bt, DST_IG_WRITE, &bits)) < 0) { in dst_gpio_outb()
115 static int dst_gpio_inb(struct dst_state *state, u8 *result) in dst_gpio_inb() argument
121 if ((err = bt878_device_control(state->bt, DST_IG_READ, &rd_packet)) < 0) { in dst_gpio_inb()
130 int rdc_reset_state(struct dst_state *state) in rdc_reset_state() argument
133 if (dst_gpio_outb(state, RDC_8820_INT, RDC_8820_INT, 0, NO_DELAY) < 0) { in rdc_reset_state()
138 if (dst_gpio_outb(state, RDC_8820_INT, RDC_8820_INT, RDC_8820_INT, NO_DELAY) < 0) { in rdc_reset_state()
148 static int rdc_8820_reset(struct dst_state *state) in rdc_8820_reset() argument
151 if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET, 0, NO_DELAY) < 0) { in rdc_8820_reset()
156 if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET, RDC_8820_RESET, DELAY) < 0) { in rdc_8820_reset()
164 static int dst_pio_enable(struct dst_state *state) in dst_pio_enable() argument
166 if (dst_gpio_outb(state, ~0, RDC_8820_PIO_0_ENABLE, 0, NO_DELAY) < 0) { in dst_pio_enable()
175 int dst_pio_disable(struct dst_state *state) in dst_pio_disable() argument
177 if (dst_gpio_outb(state, ~0, RDC_8820_PIO_0_DISABLE, RDC_8820_PIO_0_DISABLE, NO_DELAY) < 0) { in dst_pio_disable()
181 if (state->type_flags & DST_TYPE_HAS_FW_1) in dst_pio_disable()
188 int dst_wait_dst_ready(struct dst_state *state, u8 delay_mode) in dst_wait_dst_ready() argument
194 if (dst_gpio_inb(state, &reply) < 0) { in dst_wait_dst_ready()
210 int dst_error_recovery(struct dst_state *state) in dst_error_recovery() argument
213 dst_pio_disable(state); in dst_error_recovery()
215 dst_pio_enable(state); in dst_error_recovery()
222 int dst_error_bailout(struct dst_state *state) in dst_error_bailout() argument
225 rdc_8820_reset(state); in dst_error_bailout()
226 dst_pio_disable(state); in dst_error_bailout()
233 int dst_comm_init(struct dst_state *state) in dst_comm_init() argument
236 if ((dst_pio_enable(state)) < 0) { in dst_comm_init()
240 if ((rdc_reset_state(state)) < 0) { in dst_comm_init()
244 if (state->type_flags & DST_TYPE_HAS_FW_1) in dst_comm_init()
253 int write_dst(struct dst_state *state, u8 *data, u8 len) in write_dst() argument
256 .addr = state->config->demod_address, in write_dst()
271 if ((err = i2c_transfer(state->i2c, &msg, 1)) < 0) { in write_dst()
273 dst_error_recovery(state); in write_dst()
280 dst_error_bailout(state); in write_dst()
289 int read_dst(struct dst_state *state, u8 *ret, u8 len) in read_dst() argument
292 .addr = state->config->demod_address, in read_dst()
302 if ((err = i2c_transfer(state->i2c, &msg, 1)) < 0) { in read_dst()
304 dst_error_recovery(state); in read_dst()
311 dst_error_bailout(state); in read_dst()
325 static int dst_set_polarization(struct dst_state *state) in dst_set_polarization() argument
327 switch (state->voltage) { in dst_set_polarization()
330 state->tx_tuna[8] &= ~0x40; in dst_set_polarization()
334 state->tx_tuna[8] |= 0x40; in dst_set_polarization()
343 static int dst_set_freq(struct dst_state *state, u32 freq) in dst_set_freq() argument
345 state->frequency = freq; in dst_set_freq()
348 if (state->dst_type == DST_TYPE_IS_SAT) { in dst_set_freq()
352 state->tx_tuna[2] = (freq >> 8); in dst_set_freq()
353 state->tx_tuna[3] = (u8) freq; in dst_set_freq()
354 state->tx_tuna[4] = 0x01; in dst_set_freq()
355 state->tx_tuna[8] &= ~0x04; in dst_set_freq()
356 if (state->type_flags & DST_TYPE_HAS_OBS_REGS) { in dst_set_freq()
358 state->tx_tuna[8] |= 0x04; in dst_set_freq()
360 } else if (state->dst_type == DST_TYPE_IS_TERR) { in dst_set_freq()
364 state->tx_tuna[2] = (freq >> 16) & 0xff; in dst_set_freq()
365 state->tx_tuna[3] = (freq >> 8) & 0xff; in dst_set_freq()
366 state->tx_tuna[4] = (u8) freq; in dst_set_freq()
367 } else if (state->dst_type == DST_TYPE_IS_CABLE) { in dst_set_freq()
369 state->tx_tuna[2] = (freq >> 16) & 0xff; in dst_set_freq()
370 state->tx_tuna[3] = (freq >> 8) & 0xff; in dst_set_freq()
371 state->tx_tuna[4] = (u8) freq; in dst_set_freq()
372 } else if (state->dst_type == DST_TYPE_IS_ATSC) { in dst_set_freq()
376 state->tx_tuna[2] = (freq >> 16) & 0xff; in dst_set_freq()
377 state->tx_tuna[3] = (freq >> 8) & 0xff; in dst_set_freq()
378 state->tx_tuna[4] = (u8) freq; in dst_set_freq()
379 state->tx_tuna[5] = 0x00; /* ATSC */ in dst_set_freq()
380 state->tx_tuna[6] = 0x00; in dst_set_freq()
381 if (state->dst_hw_cap & DST_TYPE_HAS_ANALOG) in dst_set_freq()
382 state->tx_tuna[7] = 0x00; /* Digital */ in dst_set_freq()
389 static int dst_set_bandwidth(struct dst_state *state, u32 bandwidth) in dst_set_bandwidth() argument
391 state->bandwidth = bandwidth; in dst_set_bandwidth()
393 if (state->dst_type != DST_TYPE_IS_TERR) in dst_set_bandwidth()
398 if (state->dst_hw_cap & DST_TYPE_HAS_CA) in dst_set_bandwidth()
399 state->tx_tuna[7] = 0x06; in dst_set_bandwidth()
401 state->tx_tuna[6] = 0x06; in dst_set_bandwidth()
402 state->tx_tuna[7] = 0x00; in dst_set_bandwidth()
406 if (state->dst_hw_cap & DST_TYPE_HAS_CA) in dst_set_bandwidth()
407 state->tx_tuna[7] = 0x07; in dst_set_bandwidth()
409 state->tx_tuna[6] = 0x07; in dst_set_bandwidth()
410 state->tx_tuna[7] = 0x00; in dst_set_bandwidth()
414 if (state->dst_hw_cap & DST_TYPE_HAS_CA) in dst_set_bandwidth()
415 state->tx_tuna[7] = 0x08; in dst_set_bandwidth()
417 state->tx_tuna[6] = 0x08; in dst_set_bandwidth()
418 state->tx_tuna[7] = 0x00; in dst_set_bandwidth()
428 static int dst_set_inversion(struct dst_state *state, in dst_set_inversion() argument
431 state->inversion = inversion; in dst_set_inversion()
434 state->tx_tuna[8] &= ~0x80; in dst_set_inversion()
437 state->tx_tuna[8] |= 0x80; in dst_set_inversion()
446 static int dst_set_fec(struct dst_state *state, enum fe_code_rate fec) in dst_set_fec() argument
448 state->fec = fec; in dst_set_fec()
452 static enum fe_code_rate dst_get_fec(struct dst_state *state) in dst_get_fec() argument
454 return state->fec; in dst_get_fec()
457 static int dst_set_symbolrate(struct dst_state *state, u32 srate) in dst_set_symbolrate() argument
462 state->symbol_rate = srate; in dst_set_symbolrate()
463 if (state->dst_type == DST_TYPE_IS_TERR) { in dst_set_symbolrate()
468 if (state->dst_type == DST_TYPE_IS_SAT) { in dst_set_symbolrate()
469 if (state->type_flags & DST_TYPE_HAS_SYMDIV) { in dst_set_symbolrate()
475 state->tx_tuna[5] = (u8) (symcalc >> 12); in dst_set_symbolrate()
476 state->tx_tuna[6] = (u8) (symcalc >> 4); in dst_set_symbolrate()
477 state->tx_tuna[7] = (u8) (symcalc << 4); in dst_set_symbolrate()
479 state->tx_tuna[5] = (u8) (srate >> 16) & 0x7f; in dst_set_symbolrate()
480 state->tx_tuna[6] = (u8) (srate >> 8); in dst_set_symbolrate()
481 state->tx_tuna[7] = (u8) srate; in dst_set_symbolrate()
483 state->tx_tuna[8] &= ~0x20; in dst_set_symbolrate()
484 if (state->type_flags & DST_TYPE_HAS_OBS_REGS) { in dst_set_symbolrate()
486 state->tx_tuna[8] |= 0x20; in dst_set_symbolrate()
488 } else if (state->dst_type == DST_TYPE_IS_CABLE) { in dst_set_symbolrate()
489 dprintk(verbose, DST_DEBUG, 1, "%s", state->fw_name); in dst_set_symbolrate()
490 if (!strncmp(state->fw_name, "DCTNEW", 6)) { in dst_set_symbolrate()
491 state->tx_tuna[5] = (u8) (srate >> 8); in dst_set_symbolrate()
492 state->tx_tuna[6] = (u8) srate; in dst_set_symbolrate()
493 state->tx_tuna[7] = 0x00; in dst_set_symbolrate()
494 } else if (!strncmp(state->fw_name, "DCT-CI", 6)) { in dst_set_symbolrate()
495 state->tx_tuna[5] = 0x00; in dst_set_symbolrate()
496 state->tx_tuna[6] = (u8) (srate >> 8); in dst_set_symbolrate()
497 state->tx_tuna[7] = (u8) srate; in dst_set_symbolrate()
503 static int dst_set_modulation(struct dst_state *state, in dst_set_modulation() argument
506 if (state->dst_type != DST_TYPE_IS_CABLE) in dst_set_modulation()
509 state->modulation = modulation; in dst_set_modulation()
512 state->tx_tuna[8] = 0x10; in dst_set_modulation()
515 state->tx_tuna[8] = 0x20; in dst_set_modulation()
518 state->tx_tuna[8] = 0x40; in dst_set_modulation()
521 state->tx_tuna[8] = 0x80; in dst_set_modulation()
524 if (!strncmp(state->fw_name, "DCTNEW", 6)) in dst_set_modulation()
525 state->tx_tuna[8] = 0xff; in dst_set_modulation()
526 else if (!strncmp(state->fw_name, "DCT-CI", 6)) in dst_set_modulation()
527 state->tx_tuna[8] = 0x00; in dst_set_modulation()
541 static enum fe_modulation dst_get_modulation(struct dst_state *state) in dst_get_modulation() argument
543 return state->modulation; in dst_get_modulation()
560 static void dst_type_flags_print(struct dst_state *state) in dst_type_flags_print() argument
562 u32 type_flags = state->type_flags; in dst_type_flags_print()
585 static int dst_type_print(struct dst_state *state, u8 type) in dst_type_print() argument
912 static int dst_get_mac(struct dst_state *state) in dst_get_mac() argument
916 if (dst_command(state, get_mac, 8) < 0) { in dst_get_mac()
920 memset(&state->mac_address, '\0', 8); in dst_get_mac()
921 memcpy(&state->mac_address, &state->rxbuffer, 6); in dst_get_mac()
922 dprintk(verbose, DST_ERROR, 1, "MAC Address=[%pM]", state->mac_address); in dst_get_mac()
927 static int dst_fw_ver(struct dst_state *state) in dst_fw_ver() argument
931 if (dst_command(state, get_ver, 8) < 0) { in dst_fw_ver()
935 memcpy(&state->fw_version, &state->rxbuffer, 8); in dst_fw_ver()
937 state->fw_version[0] >> 4, state->fw_version[0] & 0x0f, in dst_fw_ver()
938 state->fw_version[1], in dst_fw_ver()
939 state->fw_version[5], state->fw_version[6], in dst_fw_ver()
940 state->fw_version[4], state->fw_version[3], state->fw_version[2]); in dst_fw_ver()
945 static int dst_card_type(struct dst_state *state) in dst_card_type() argument
952 if (dst_command(state, get_type, 8) < 0) { in dst_card_type()
956 memset(&state->card_info, '\0', 8); in dst_card_type()
957 memcpy(&state->card_info, &state->rxbuffer, 7); in dst_card_type()
958 dprintk(verbose, DST_ERROR, 1, "Device Model=[%s]", &state->card_info[0]); in dst_card_type()
961 if (!strcmp(&state->card_info[0], p_tuner_list->board_name)) { in dst_card_type()
962 state->tuner_type = p_tuner_list->tuner_type; in dst_card_type()
971 static int dst_get_vendor(struct dst_state *state) in dst_get_vendor() argument
975 if (dst_command(state, get_vendor, 8) < 0) { in dst_get_vendor()
979 memset(&state->vendor, '\0', 8); in dst_get_vendor()
980 memcpy(&state->vendor, &state->rxbuffer, 7); in dst_get_vendor()
981 dprintk(verbose, DST_ERROR, 1, "Vendor=[%s]", &state->vendor[0]); in dst_get_vendor()
986 static void debug_dst_buffer(struct dst_state *state) in debug_dst_buffer() argument
993 printk(" %02x", state->rxbuffer[i]); in debug_dst_buffer()
998 static int dst_check_stv0299(struct dst_state *state) in dst_check_stv0299() argument
1003 if (dst_command(state, check_stv0299, 8) < 0) { in dst_check_stv0299()
1007 debug_dst_buffer(state); in dst_check_stv0299()
1009 if (memcmp(&check_stv0299, &state->rxbuffer, 8)) { in dst_check_stv0299()
1011 state->tuner_type = TUNER_TYPE_STV0299; in dst_check_stv0299()
1018 static int dst_check_mb86a15(struct dst_state *state) in dst_check_mb86a15() argument
1023 if (dst_command(state, check_mb86a15, 8) < 0) { in dst_check_mb86a15()
1027 debug_dst_buffer(state); in dst_check_mb86a15()
1029 if (memcmp(&check_mb86a15, &state->rxbuffer, 8) < 0) { in dst_check_mb86a15()
1031 state->tuner_type = TUNER_TYPE_MB86A15; in dst_check_mb86a15()
1038 static int dst_get_tuner_info(struct dst_state *state) in dst_get_tuner_info() argument
1046 if (state->type_flags & DST_TYPE_HAS_MULTI_FE) { in dst_get_tuner_info()
1047 if (dst_command(state, get_tuner_1, 8) < 0) { in dst_get_tuner_info()
1052 if (dst_command(state, get_tuner_2, 8) < 0) { in dst_get_tuner_info()
1057 memcpy(&state->board_info, &state->rxbuffer, 8); in dst_get_tuner_info()
1058 if (state->type_flags & DST_TYPE_HAS_MULTI_FE) { in dst_get_tuner_info()
1061 if (state->board_info[0] == 0xbc) { in dst_get_tuner_info()
1062 if (state->dst_type != DST_TYPE_IS_ATSC) in dst_get_tuner_info()
1063 state->type_flags |= DST_TYPE_HAS_TS188; in dst_get_tuner_info()
1065 state->type_flags |= DST_TYPE_HAS_NEWTUNE_2; in dst_get_tuner_info()
1067 if (state->board_info[1] == 0x01) { in dst_get_tuner_info()
1068 state->dst_hw_cap |= DST_TYPE_HAS_DBOARD; in dst_get_tuner_info()
1075 if (!strncmp(state->fw_name, "DCT-CI", 6)) { in dst_get_tuner_info()
1076 state->type_flags |= DST_TYPE_HAS_TS204; in dst_get_tuner_info()
1077 dprintk(verbose, DST_ERROR, 1, "Forcing [%s] to TS188", state->fw_name); in dst_get_tuner_info()
1083 static int dst_get_device_id(struct dst_state *state) in dst_get_device_id() argument
1096 state->tuner_type = 0; in dst_get_device_id()
1099 if (write_dst(state, device_type, FIXED_COMM)) in dst_get_device_id()
1101 if ((dst_pio_disable(state)) < 0) in dst_get_device_id()
1103 if (read_dst(state, &reply, GET_ACK)) in dst_get_device_id()
1109 if (!dst_wait_dst_ready(state, DEVICE_INIT)) in dst_get_device_id()
1111 if (read_dst(state, state->rxbuffer, FIXED_COMM)) in dst_get_device_id()
1114 dst_pio_disable(state); in dst_get_device_id()
1115 if (state->rxbuffer[7] != dst_check_sum(state->rxbuffer, 7)) { in dst_get_device_id()
1119 state->rxbuffer[7] = '\0'; in dst_get_device_id()
1122 …if (!strncmp (&state->rxbuffer[p_dst_type->offset], p_dst_type->device_id, strlen (p_dst_type->dev… in dst_get_device_id()
1127 state->dst_hw_cap = p_dst_type->dst_feature; in dst_get_device_id()
1129 strncpy(&state->fw_name[0], p_dst_type->device_id, 6); in dst_get_device_id()
1135 if (dst_check_stv0299(state) < 0) { in dst_get_device_id()
1137 state->tuner_type = TUNER_TYPE_MB86A15; in dst_get_device_id()
1143 if (dst_check_mb86a15(state) < 0) in dst_get_device_id()
1147 state->tuner_type = p_dst_type->tuner_type; in dst_get_device_id()
1151 p_tuner_list->tuner_type == state->tuner_type) { in dst_get_device_id()
1161 …dprintk(verbose, DST_ERROR, 1, "Unable to recognize %s or %s", &state->rxbuffer[0], &state->rxbuff… in dst_get_device_id()
1166 dst_type_print(state, use_dst_type); in dst_get_device_id()
1167 state->type_flags = use_type_flags; in dst_get_device_id()
1168 state->dst_type = use_dst_type; in dst_get_device_id()
1169 dst_type_flags_print(state); in dst_get_device_id()
1174 static int dst_probe(struct dst_state *state) in dst_probe() argument
1176 mutex_init(&state->dst_mutex); in dst_probe()
1178 if ((rdc_8820_reset(state)) < 0) { in dst_probe()
1186 if ((dst_comm_init(state)) < 0) { in dst_probe()
1191 if (dst_get_device_id(state) < 0) { in dst_probe()
1195 if (dst_get_mac(state) < 0) { in dst_probe()
1198 if ((state->type_flags & DST_TYPE_HAS_MULTI_FE) || (state->type_flags & DST_TYPE_HAS_FW_BUILD)) { in dst_probe()
1199 if (dst_get_tuner_info(state) < 0) in dst_probe()
1202 if (state->type_flags & DST_TYPE_HAS_TS204) { in dst_probe()
1203 dst_packsize(state, 204); in dst_probe()
1205 if (state->type_flags & DST_TYPE_HAS_FW_BUILD) { in dst_probe()
1206 if (dst_fw_ver(state) < 0) { in dst_probe()
1210 if (dst_card_type(state) < 0) { in dst_probe()
1214 if (dst_get_vendor(state) < 0) { in dst_probe()
1223 static int dst_command(struct dst_state *state, u8 *data, u8 len) in dst_command() argument
1227 mutex_lock(&state->dst_mutex); in dst_command()
1228 if ((dst_comm_init(state)) < 0) { in dst_command()
1232 if (write_dst(state, data, len)) { in dst_command()
1234 if ((dst_error_recovery(state)) < 0) { in dst_command()
1240 if ((dst_pio_disable(state)) < 0) { in dst_command()
1244 if (state->type_flags & DST_TYPE_HAS_FW_1) in dst_command()
1246 if (read_dst(state, &reply, GET_ACK)) { in dst_command()
1248 if ((dst_error_recovery(state)) < 0) { in dst_command()
1260 if (state->type_flags & DST_TYPE_HAS_FW_1) in dst_command()
1264 if (!dst_wait_dst_ready(state, NO_DELAY)) in dst_command()
1266 if (read_dst(state, state->rxbuffer, FIXED_COMM)) { in dst_command()
1268 if ((dst_error_recovery(state)) < 0) { in dst_command()
1274 if (state->rxbuffer[7] != dst_check_sum(state->rxbuffer, 7)) { in dst_command()
1278 mutex_unlock(&state->dst_mutex); in dst_command()
1282 mutex_unlock(&state->dst_mutex); in dst_command()
1287 static int dst_get_signal(struct dst_state *state) in dst_get_signal() argument
1292 if ((state->diseq_flags & ATTEMPT_TUNE) == 0) { in dst_get_signal()
1293 state->decode_lock = state->decode_strength = state->decode_snr = 0; in dst_get_signal()
1296 if (0 == (state->diseq_flags & HAS_LOCK)) { in dst_get_signal()
1297 state->decode_lock = state->decode_strength = state->decode_snr = 0; in dst_get_signal()
1300 if (time_after_eq(jiffies, state->cur_jiff + (HZ / 5))) { in dst_get_signal()
1301 retval = dst_command(state, get_signal, 8); in dst_get_signal()
1304 if (state->dst_type == DST_TYPE_IS_SAT) { in dst_get_signal()
1305 state->decode_lock = ((state->rxbuffer[6] & 0x10) == 0) ? 1 : 0; in dst_get_signal()
1306 state->decode_strength = state->rxbuffer[5] << 8; in dst_get_signal()
1307 state->decode_snr = state->rxbuffer[2] << 8 | state->rxbuffer[3]; in dst_get_signal()
1308 } else if ((state->dst_type == DST_TYPE_IS_TERR) || (state->dst_type == DST_TYPE_IS_CABLE)) { in dst_get_signal()
1309 state->decode_lock = (state->rxbuffer[1]) ? 1 : 0; in dst_get_signal()
1310 state->decode_strength = state->rxbuffer[4] << 8; in dst_get_signal()
1311 state->decode_snr = state->rxbuffer[3] << 8; in dst_get_signal()
1312 } else if (state->dst_type == DST_TYPE_IS_ATSC) { in dst_get_signal()
1313 state->decode_lock = (state->rxbuffer[6] == 0x00) ? 1 : 0; in dst_get_signal()
1314 state->decode_strength = state->rxbuffer[4] << 8; in dst_get_signal()
1315 state->decode_snr = state->rxbuffer[2] << 8 | state->rxbuffer[3]; in dst_get_signal()
1317 state->cur_jiff = jiffies; in dst_get_signal()
1322 static int dst_tone_power_cmd(struct dst_state *state) in dst_tone_power_cmd() argument
1326 if (state->dst_type != DST_TYPE_IS_SAT) in dst_tone_power_cmd()
1328 paket[4] = state->tx_tuna[4]; in dst_tone_power_cmd()
1329 paket[2] = state->tx_tuna[2]; in dst_tone_power_cmd()
1330 paket[3] = state->tx_tuna[3]; in dst_tone_power_cmd()
1332 return dst_command(state, paket, 8); in dst_tone_power_cmd()
1335 static int dst_get_tuna(struct dst_state *state) in dst_get_tuna() argument
1339 if ((state->diseq_flags & ATTEMPT_TUNE) == 0) in dst_get_tuna()
1341 state->diseq_flags &= ~(HAS_LOCK); in dst_get_tuna()
1342 if (!dst_wait_dst_ready(state, NO_DELAY)) in dst_get_tuna()
1344 if ((state->type_flags & DST_TYPE_HAS_VLF) && in dst_get_tuna()
1345 !(state->dst_type == DST_TYPE_IS_ATSC)) in dst_get_tuna()
1347 retval = read_dst(state, state->rx_tuna, 10); in dst_get_tuna()
1349 retval = read_dst(state, &state->rx_tuna[2], FIXED_COMM); in dst_get_tuna()
1354 if ((state->type_flags & DST_TYPE_HAS_VLF) && in dst_get_tuna()
1355 !(state->dst_type == DST_TYPE_IS_ATSC)) { in dst_get_tuna()
1357 if (state->rx_tuna[9] != dst_check_sum(&state->rx_tuna[0], 9)) { in dst_get_tuna()
1362 if (state->rx_tuna[9] != dst_check_sum(&state->rx_tuna[2], 7)) { in dst_get_tuna()
1367 if (state->rx_tuna[2] == 0 && state->rx_tuna[3] == 0) in dst_get_tuna()
1369 if (state->dst_type == DST_TYPE_IS_SAT) { in dst_get_tuna()
1370 state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 8) + state->rx_tuna[3]; in dst_get_tuna()
1372state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 16) + (state->rx_tuna[3] << 8) + state->rx_tun… in dst_get_tuna()
1374 state->decode_freq = state->decode_freq * 1000; in dst_get_tuna()
1375 state->decode_lock = 1; in dst_get_tuna()
1376 state->diseq_flags |= HAS_LOCK; in dst_get_tuna()
1386 struct dst_state *state = fe->demodulator_priv; in dst_write_tuna() local
1390 dprintk(verbose, DST_INFO, 1, "type_flags 0x%x ", state->type_flags); in dst_write_tuna()
1391 state->decode_freq = 0; in dst_write_tuna()
1392 state->decode_lock = state->decode_strength = state->decode_snr = 0; in dst_write_tuna()
1393 if (state->dst_type == DST_TYPE_IS_SAT) { in dst_write_tuna()
1394 if (!(state->diseq_flags & HAS_POWER)) in dst_write_tuna()
1397 state->diseq_flags &= ~(HAS_LOCK | ATTEMPT_TUNE); in dst_write_tuna()
1398 mutex_lock(&state->dst_mutex); in dst_write_tuna()
1399 if ((dst_comm_init(state)) < 0) { in dst_write_tuna()
1404 if ((state->type_flags & DST_TYPE_HAS_VLF) && in dst_write_tuna()
1405 (!(state->dst_type == DST_TYPE_IS_ATSC))) { in dst_write_tuna()
1407 state->tx_tuna[9] = dst_check_sum(&state->tx_tuna[0], 9); in dst_write_tuna()
1408 retval = write_dst(state, &state->tx_tuna[0], 10); in dst_write_tuna()
1410 state->tx_tuna[9] = dst_check_sum(&state->tx_tuna[2], 7); in dst_write_tuna()
1411 retval = write_dst(state, &state->tx_tuna[2], FIXED_COMM); in dst_write_tuna()
1414 dst_pio_disable(state); in dst_write_tuna()
1418 if ((dst_pio_disable(state)) < 0) { in dst_write_tuna()
1422 if ((read_dst(state, &reply, GET_ACK) < 0)) { in dst_write_tuna()
1430 state->diseq_flags |= ATTEMPT_TUNE; in dst_write_tuna()
1431 retval = dst_get_tuna(state); in dst_write_tuna()
1433 mutex_unlock(&state->dst_mutex); in dst_write_tuna()
1437 mutex_unlock(&state->dst_mutex); in dst_write_tuna()
1457 struct dst_state *state = fe->demodulator_priv; in dst_set_diseqc() local
1460 if (state->dst_type != DST_TYPE_IS_SAT) in dst_set_diseqc()
1464 else if (cmd->msg_len == 5 && state->dst_hw_cap & DST_TYPE_HAS_DISEQC5) in dst_set_diseqc()
1469 return dst_command(state, paket, 8); in dst_set_diseqc()
1475 struct dst_state *state = fe->demodulator_priv; in dst_set_voltage() local
1477 state->voltage = voltage; in dst_set_voltage()
1478 if (state->dst_type != DST_TYPE_IS_SAT) in dst_set_voltage()
1486 if ((state->diseq_flags & HAS_POWER) == 0) in dst_set_voltage()
1488 state->diseq_flags |= HAS_POWER; in dst_set_voltage()
1489 state->tx_tuna[4] = 0x01; in dst_set_voltage()
1493 state->diseq_flags &= ~(HAS_POWER | HAS_LOCK | ATTEMPT_TUNE); in dst_set_voltage()
1494 state->tx_tuna[4] = 0x00; in dst_set_voltage()
1501 retval = dst_tone_power_cmd(state); in dst_set_voltage()
1508 struct dst_state *state = fe->demodulator_priv; in dst_set_tone() local
1510 state->tone = tone; in dst_set_tone()
1511 if (state->dst_type != DST_TYPE_IS_SAT) in dst_set_tone()
1516 if (state->type_flags & DST_TYPE_HAS_OBS_REGS) in dst_set_tone()
1517 state->tx_tuna[2] = 0x00; in dst_set_tone()
1519 state->tx_tuna[2] = 0xff; in dst_set_tone()
1523 state->tx_tuna[2] = 0x02; in dst_set_tone()
1528 return dst_tone_power_cmd(state); in dst_set_tone()
1533 struct dst_state *state = fe->demodulator_priv; in dst_send_burst() local
1535 if (state->dst_type != DST_TYPE_IS_SAT) in dst_send_burst()
1537 state->minicmd = minicmd; in dst_send_burst()
1540 state->tx_tuna[3] = 0x02; in dst_send_burst()
1543 state->tx_tuna[3] = 0xff; in dst_send_burst()
1546 return dst_tone_power_cmd(state); in dst_send_burst()
1552 struct dst_state *state = fe->demodulator_priv; in bt8xx_dst_init() local
1562 state->inversion = INVERSION_OFF; in bt8xx_dst_init()
1563 state->voltage = SEC_VOLTAGE_13; in bt8xx_dst_init()
1564 state->tone = SEC_TONE_OFF; in bt8xx_dst_init()
1565 state->diseq_flags = 0; in bt8xx_dst_init()
1566 state->k22 = 0x02; in bt8xx_dst_init()
1567 state->bandwidth = 7000000; in bt8xx_dst_init()
1568 state->cur_jiff = jiffies; in bt8xx_dst_init()
1569 if (state->dst_type == DST_TYPE_IS_SAT) in bt8xx_dst_init()
1570 …memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_VLF) ? sat_tuna_188 : sat_tuna_204), siz… in bt8xx_dst_init()
1571 else if (state->dst_type == DST_TYPE_IS_TERR) in bt8xx_dst_init()
1572 …memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_VLF) ? ter_tuna_188 : ter_tuna_204), siz… in bt8xx_dst_init()
1573 else if (state->dst_type == DST_TYPE_IS_CABLE) in bt8xx_dst_init()
1574 …memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_VLF) ? cab_tuna_188 : cab_tuna_204), siz… in bt8xx_dst_init()
1575 else if (state->dst_type == DST_TYPE_IS_ATSC) in bt8xx_dst_init()
1576 memcpy(state->tx_tuna, atsc_tuner, sizeof (atsc_tuner)); in bt8xx_dst_init()
1583 struct dst_state *state = fe->demodulator_priv; in dst_read_status() local
1586 if (state->diseq_flags & HAS_LOCK) { in dst_read_status()
1588 if (state->decode_lock) in dst_read_status()
1597 struct dst_state *state = fe->demodulator_priv; in dst_read_signal_strength() local
1599 int retval = dst_get_signal(state); in dst_read_signal_strength()
1600 *strength = state->decode_strength; in dst_read_signal_strength()
1607 struct dst_state *state = fe->demodulator_priv; in dst_read_snr() local
1609 int retval = dst_get_signal(state); in dst_read_snr()
1610 *snr = state->decode_snr; in dst_read_snr()
1619 struct dst_state *state = fe->demodulator_priv; in dst_set_frontend() local
1622 retval = dst_set_freq(state, p->frequency); in dst_set_frontend()
1627 if (state->dst_type == DST_TYPE_IS_SAT) { in dst_set_frontend()
1628 if (state->type_flags & DST_TYPE_HAS_OBS_REGS) in dst_set_frontend()
1629 dst_set_inversion(state, p->inversion); in dst_set_frontend()
1630 dst_set_fec(state, p->fec_inner); in dst_set_frontend()
1631 dst_set_symbolrate(state, p->symbol_rate); in dst_set_frontend()
1632 dst_set_polarization(state); in dst_set_frontend()
1635 } else if (state->dst_type == DST_TYPE_IS_TERR) in dst_set_frontend()
1636 dst_set_bandwidth(state, p->bandwidth_hz); in dst_set_frontend()
1637 else if (state->dst_type == DST_TYPE_IS_CABLE) { in dst_set_frontend()
1638 dst_set_fec(state, p->fec_inner); in dst_set_frontend()
1639 dst_set_symbolrate(state, p->symbol_rate); in dst_set_frontend()
1640 dst_set_modulation(state, p->modulation); in dst_set_frontend()
1654 struct dst_state *state = fe->demodulator_priv; in dst_tune_frontend() local
1658 dst_set_freq(state, p->frequency); in dst_tune_frontend()
1661 if (state->dst_type == DST_TYPE_IS_SAT) { in dst_tune_frontend()
1662 if (state->type_flags & DST_TYPE_HAS_OBS_REGS) in dst_tune_frontend()
1663 dst_set_inversion(state, p->inversion); in dst_tune_frontend()
1664 dst_set_fec(state, p->fec_inner); in dst_tune_frontend()
1665 dst_set_symbolrate(state, p->symbol_rate); in dst_tune_frontend()
1666 dst_set_polarization(state); in dst_tune_frontend()
1669 } else if (state->dst_type == DST_TYPE_IS_TERR) in dst_tune_frontend()
1670 dst_set_bandwidth(state, p->bandwidth_hz); in dst_tune_frontend()
1671 else if (state->dst_type == DST_TYPE_IS_CABLE) { in dst_tune_frontend()
1672 dst_set_fec(state, p->fec_inner); in dst_tune_frontend()
1673 dst_set_symbolrate(state, p->symbol_rate); in dst_tune_frontend()
1674 dst_set_modulation(state, p->modulation); in dst_tune_frontend()
1694 struct dst_state *state = fe->demodulator_priv; in dst_get_frontend() local
1696 p->frequency = state->decode_freq; in dst_get_frontend()
1697 if (state->dst_type == DST_TYPE_IS_SAT) { in dst_get_frontend()
1698 if (state->type_flags & DST_TYPE_HAS_OBS_REGS) in dst_get_frontend()
1699 p->inversion = state->inversion; in dst_get_frontend()
1700 p->symbol_rate = state->symbol_rate; in dst_get_frontend()
1701 p->fec_inner = dst_get_fec(state); in dst_get_frontend()
1702 } else if (state->dst_type == DST_TYPE_IS_TERR) { in dst_get_frontend()
1703 p->bandwidth_hz = state->bandwidth; in dst_get_frontend()
1704 } else if (state->dst_type == DST_TYPE_IS_CABLE) { in dst_get_frontend()
1705 p->symbol_rate = state->symbol_rate; in dst_get_frontend()
1706 p->fec_inner = dst_get_fec(state); in dst_get_frontend()
1707 p->modulation = dst_get_modulation(state); in dst_get_frontend()
1715 struct dst_state *state = fe->demodulator_priv; in bt8xx_dst_release() local
1716 if (state->dst_ca) { in bt8xx_dst_release()
1717 dvb_unregister_device(state->dst_ca); in bt8xx_dst_release()
1722 kfree(state); in bt8xx_dst_release()
1730 struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter *dvb_adapter) in dst_attach() argument
1733 if (dst_probe(state) < 0) { in dst_attach()
1734 kfree(state); in dst_attach()
1739 switch (state->dst_type) { in dst_attach()
1741 memcpy(&state->frontend.ops, &dst_dvbt_ops, sizeof(struct dvb_frontend_ops)); in dst_attach()
1744 memcpy(&state->frontend.ops, &dst_dvbc_ops, sizeof(struct dvb_frontend_ops)); in dst_attach()
1747 memcpy(&state->frontend.ops, &dst_dvbs_ops, sizeof(struct dvb_frontend_ops)); in dst_attach()
1750 memcpy(&state->frontend.ops, &dst_atsc_ops, sizeof(struct dvb_frontend_ops)); in dst_attach()
1754 kfree(state); in dst_attach()
1757 state->frontend.demodulator_priv = state; in dst_attach()
1759 return state; /* Manu (DST is a card not a frontend) */ in dst_attach()