Lines Matching +full:0 +full:x7c00

33 #define CRC_CCIT_MASK 0x1021
56 #define dprintk(args...) do { if (debug) pr_debug(args); } while (0)
61 struct i2c_msg msg = { .addr = addr, .flags = 0, .buf = buf, .len = len }; in i2c_writebytes()
64 pr_warn("%s: i2c write error (addr 0x%02x, err == %i)\n", in i2c_writebytes()
68 return 0; in i2c_writebytes()
77 pr_warn("%s: i2c read error (addr 0x%02x, err == %i)\n", in i2c_readbytes()
81 return 0; in i2c_readbytes()
89 …struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf2, .len = len +… in nxt200x_writebytes()
97 buf2[0] = reg; in nxt200x_writebytes()
101 pr_warn("%s: i2c write error (addr 0x%02x, err == %i)\n", in nxt200x_writebytes()
105 return 0; in nxt200x_writebytes()
112 …struct i2c_msg msg [] = { { .addr = state->config->demod_address, .flags = 0, .buf = reg2, .len = … in nxt200x_readbytes()
118 pr_warn("%s: i2c read error (addr 0x%02x, err == %i)\n", in nxt200x_readbytes()
122 return 0; in nxt200x_readbytes()
128 u16 input = (u16) c & 0xFF; in nxt200x_crc()
131 for(i=0; i<8; i++) { in nxt200x_crc()
132 if((crc^input) & 0x8000) in nxt200x_crc()
147 nxt200x_writebytes(state, 0x35, &reg, 1); in nxt200x_writereg_multibyte()
150 nxt200x_writebytes(state, 0x36, data, len); in nxt200x_writereg_multibyte()
155 buf = 0x02; in nxt200x_writereg_multibyte()
159 attr = 0x02; in nxt200x_writereg_multibyte()
160 if (reg & 0x80) { in nxt200x_writereg_multibyte()
162 if (reg & 0x04) in nxt200x_writereg_multibyte()
166 len2 = ((attr << 4) | 0x10) | len; in nxt200x_writereg_multibyte()
167 buf = 0x80; in nxt200x_writereg_multibyte()
175 nxt200x_writebytes(state, 0x34, &len2, 1); in nxt200x_writereg_multibyte()
178 nxt200x_writebytes(state, 0x21, &buf, 1); in nxt200x_writereg_multibyte()
180 nxt200x_readbytes(state, 0x21, &buf, 1); in nxt200x_writereg_multibyte()
184 if ((buf & 0x02) == 0) in nxt200x_writereg_multibyte()
185 return 0; in nxt200x_writereg_multibyte()
188 if (buf == 0) in nxt200x_writereg_multibyte()
189 return 0; in nxt200x_writereg_multibyte()
196 pr_warn("Error writing multireg register 0x%02X\n", reg); in nxt200x_writereg_multibyte()
198 return 0; in nxt200x_writereg_multibyte()
208 nxt200x_writebytes(state, 0x35, &reg, 1); in nxt200x_readreg_multibyte()
213 len2 = len & 0x80; in nxt200x_readreg_multibyte()
214 nxt200x_writebytes(state, 0x34, &len2, 1); in nxt200x_readreg_multibyte()
218 return 0; in nxt200x_readreg_multibyte()
222 attr = 0x02; in nxt200x_readreg_multibyte()
223 if (reg & 0x80) { in nxt200x_readreg_multibyte()
225 if (reg & 0x04) in nxt200x_readreg_multibyte()
231 nxt200x_writebytes(state, 0x34, &len2, 1); in nxt200x_readreg_multibyte()
234 buf = 0x80; in nxt200x_readreg_multibyte()
235 nxt200x_writebytes(state, 0x21, &buf, 1); in nxt200x_readreg_multibyte()
238 for(i = 0; i < len; i++) { in nxt200x_readreg_multibyte()
239 nxt200x_readbytes(state, 0x36 + i, &data[i], 1); in nxt200x_readreg_multibyte()
241 return 0; in nxt200x_readreg_multibyte()
251 u8 buf, stopval, counter = 0; in nxt200x_microcontroller_stop()
257 stopval = 0x40; in nxt200x_microcontroller_stop()
260 stopval = 0x10; in nxt200x_microcontroller_stop()
263 stopval = 0; in nxt200x_microcontroller_stop()
267 buf = 0x80; in nxt200x_microcontroller_stop()
268 nxt200x_writebytes(state, 0x22, &buf, 1); in nxt200x_microcontroller_stop()
271 nxt200x_readbytes(state, 0x31, &buf, 1); in nxt200x_microcontroller_stop()
287 buf = 0x00; in nxt200x_microcontroller_start()
288 nxt200x_writebytes(state, 0x22, &buf, 1); in nxt200x_microcontroller_start()
294 u8 counter = 0; in nxt2004_microcontroller_init()
297 buf[0] = 0x00; in nxt2004_microcontroller_init()
298 nxt200x_writebytes(state, 0x2b, buf, 1); in nxt2004_microcontroller_init()
299 buf[0] = 0x70; in nxt2004_microcontroller_init()
300 nxt200x_writebytes(state, 0x34, buf, 1); in nxt2004_microcontroller_init()
301 buf[0] = 0x04; in nxt2004_microcontroller_init()
302 nxt200x_writebytes(state, 0x35, buf, 1); in nxt2004_microcontroller_init()
303 buf[0] = 0x01; buf[1] = 0x23; buf[2] = 0x45; buf[3] = 0x67; buf[4] = 0x89; in nxt2004_microcontroller_init()
304 buf[5] = 0xAB; buf[6] = 0xCD; buf[7] = 0xEF; buf[8] = 0xC0; in nxt2004_microcontroller_init()
305 nxt200x_writebytes(state, 0x36, buf, 9); in nxt2004_microcontroller_init()
306 buf[0] = 0x80; in nxt2004_microcontroller_init()
307 nxt200x_writebytes(state, 0x21, buf, 1); in nxt2004_microcontroller_init()
310 nxt200x_readbytes(state, 0x21, buf, 1); in nxt2004_microcontroller_init()
311 if (buf[0] == 0) in nxt2004_microcontroller_init()
324 u8 buf, count = 0; in nxt200x_writetuner()
334 if (i2c_writebytes(state, data[0], data+1, 4)) in nxt200x_writetuner()
338 i2c_readbytes(state, data[0], &buf, 1); in nxt200x_writetuner()
339 if (buf & 0x40) in nxt200x_writetuner()
340 return 0; in nxt200x_writetuner()
348 buf = 0x03; in nxt200x_writetuner()
349 nxt200x_writebytes(state, 0x20, &buf, 1); in nxt200x_writetuner()
352 buf = 0x04; in nxt200x_writetuner()
353 nxt200x_writebytes(state, 0x34, &buf, 1); in nxt200x_writetuner()
356 nxt200x_writebytes(state, 0x36, data+1, 4); in nxt200x_writetuner()
359 buf = data[0] << 1; in nxt200x_writetuner()
360 nxt200x_writebytes(state, 0x35, &buf, 1); in nxt200x_writetuner()
363 buf = 0x80; in nxt200x_writetuner()
364 nxt200x_writebytes(state, 0x21, &buf, 1); in nxt200x_writetuner()
367 nxt200x_readbytes(state, 0x21, &buf, 1); in nxt200x_writetuner()
368 if ((buf & 0x80)== 0x00) in nxt200x_writetuner()
369 return 0; in nxt200x_writetuner()
379 return 0; in nxt200x_writetuner()
389 buf = 0x08; in nxt200x_agc_reset()
390 nxt200x_writebytes(state, 0x08, &buf, 1); in nxt200x_agc_reset()
391 buf = 0x00; in nxt200x_agc_reset()
392 nxt200x_writebytes(state, 0x08, &buf, 1); in nxt200x_agc_reset()
395 nxt200x_readreg_multibyte(state, 0x08, &buf, 1); in nxt200x_agc_reset()
396 buf = 0x08; in nxt200x_agc_reset()
397 nxt200x_writereg_multibyte(state, 0x08, &buf, 1); in nxt200x_agc_reset()
398 buf = 0x00; in nxt200x_agc_reset()
399 nxt200x_writereg_multibyte(state, 0x08, &buf, 1); in nxt200x_agc_reset()
411 u8 buf[3], written = 0, chunkpos = 0; in nxt2002_load_firmware()
412 u16 rambase, position, crc = 0; in nxt2002_load_firmware()
418 nxt200x_readbytes(state, 0x10, buf, 1); in nxt2002_load_firmware()
420 if (buf[0] & 0x10) in nxt2002_load_firmware()
421 rambase = 0x1000; in nxt2002_load_firmware()
423 rambase = 0x0000; in nxt2002_load_firmware()
428 buf[0] = 0x80; in nxt2002_load_firmware()
429 nxt200x_writebytes(state, 0x2B, buf, 1); in nxt2002_load_firmware()
431 for (position = 0; position < fw->size; position++) { in nxt2002_load_firmware()
432 if (written == 0) { in nxt2002_load_firmware()
433 crc = 0; in nxt2002_load_firmware()
434 chunkpos = 0x28; in nxt2002_load_firmware()
435 buf[0] = ((rambase + position) >> 8); in nxt2002_load_firmware()
436 buf[1] = (rambase + position) & 0xFF; in nxt2002_load_firmware()
437 buf[2] = 0x81; in nxt2002_load_firmware()
439 nxt200x_writebytes(state, 0x29, buf, 3); in nxt2002_load_firmware()
444 if ((written % 4) == 0) in nxt2002_load_firmware()
454 buf[0] = crc << 8; in nxt2002_load_firmware()
455 buf[1] = crc & 0xFF; in nxt2002_load_firmware()
458 nxt200x_writebytes(state, 0x2C, buf, 2); in nxt2002_load_firmware()
461 nxt200x_readbytes(state, 0x2A, buf, 1); in nxt2002_load_firmware()
464 buf[0] = 0x80; in nxt2002_load_firmware()
465 nxt200x_writebytes(state, 0x2B, buf, 1); in nxt2002_load_firmware()
467 written = 0; in nxt2002_load_firmware()
471 return 0; in nxt2002_load_firmware()
479 u16 rambase, position, crc=0; in nxt2004_load_firmware()
485 rambase = 0x1000; in nxt2004_load_firmware()
488 buf[0] = 0x80; in nxt2004_load_firmware()
489 nxt200x_writebytes(state, 0x2B, buf,1); in nxt2004_load_firmware()
492 for (position = 0; position < fw->size; position++) { in nxt2004_load_firmware()
496 buf[0] = rambase >> 8; in nxt2004_load_firmware()
497 buf[1] = rambase & 0xFF; in nxt2004_load_firmware()
498 buf[2] = 0x81; in nxt2004_load_firmware()
500 nxt200x_writebytes(state,0x29,buf,3); in nxt2004_load_firmware()
502 for (position = 0; position < fw->size;) { in nxt2004_load_firmware()
503 nxt200x_writebytes(state, 0x2C, &fw->data[position], in nxt2004_load_firmware()
507 buf[0] = crc >> 8; in nxt2004_load_firmware()
508 buf[1] = crc & 0xFF; in nxt2004_load_firmware()
510 dprintk("firmware crc is 0x%02X 0x%02X\n", buf[0], buf[1]); in nxt2004_load_firmware()
513 nxt200x_writebytes(state, 0x2C, buf,2); in nxt2004_load_firmware()
516 nxt200x_readbytes(state, 0x2C, buf, 1); in nxt2004_load_firmware()
519 buf[0] = 0x80; in nxt2004_load_firmware()
520 nxt200x_writebytes(state, 0x2B, buf,1); in nxt2004_load_firmware()
522 return 0; in nxt2004_load_firmware()
536 buf[0] = 0x04; in nxt200x_setup_frontend_parameters()
537 nxt200x_writebytes(state, 0x14, buf, 1); in nxt200x_setup_frontend_parameters()
538 buf[0] = 0x00; in nxt200x_setup_frontend_parameters()
539 nxt200x_writebytes(state, 0x17, buf, 1); in nxt200x_setup_frontend_parameters()
554 state->config->set_ts_params(fe, 0); in nxt200x_setup_frontend_parameters()
576 buf[0] = 0x74; in nxt200x_setup_frontend_parameters()
579 buf[0] = 0x70; in nxt200x_setup_frontend_parameters()
585 nxt200x_writebytes(state, 0x42, buf, 1); in nxt200x_setup_frontend_parameters()
590 buf[0] = 0x87; in nxt200x_setup_frontend_parameters()
593 buf[0] = 0x07; in nxt200x_setup_frontend_parameters()
599 nxt200x_writebytes(state, 0x57, buf, 1); in nxt200x_setup_frontend_parameters()
602 buf[0] = 0x10; in nxt200x_setup_frontend_parameters()
603 buf[1] = 0x00; in nxt200x_setup_frontend_parameters()
606 nxt200x_writereg_multibyte(state, 0x58, buf, 2); in nxt200x_setup_frontend_parameters()
609 nxt200x_writebytes(state, 0x58, buf, 2); in nxt200x_setup_frontend_parameters()
619 buf[0] = 0x68; in nxt200x_setup_frontend_parameters()
622 buf[0] = 0x64; in nxt200x_setup_frontend_parameters()
625 buf[0] = 0x60; in nxt200x_setup_frontend_parameters()
631 buf[1] = 0x00; in nxt200x_setup_frontend_parameters()
634 nxt200x_writereg_multibyte(state, 0x5C, buf, 2); in nxt200x_setup_frontend_parameters()
637 nxt200x_writebytes(state, 0x5C, buf, 2); in nxt200x_setup_frontend_parameters()
645 buf[0] = 0x05; in nxt200x_setup_frontend_parameters()
646 nxt200x_writebytes(state, 0x43, buf, 1); in nxt200x_setup_frontend_parameters()
650 buf[0] = 0x00; in nxt200x_setup_frontend_parameters()
651 buf[1] = 0x00; in nxt200x_setup_frontend_parameters()
652 nxt200x_writebytes(state, 0x46, buf, 2); in nxt200x_setup_frontend_parameters()
656 buf[0] = 0x80; in nxt200x_setup_frontend_parameters()
657 buf[1] = 0x00; in nxt200x_setup_frontend_parameters()
660 nxt200x_writereg_multibyte(state, 0x4B, buf, 2); in nxt200x_setup_frontend_parameters()
663 nxt200x_writebytes(state, 0x4B, buf, 2); in nxt200x_setup_frontend_parameters()
671 buf[0] = 0x00; in nxt200x_setup_frontend_parameters()
672 nxt200x_writebytes(state, 0x4D, buf, 1); in nxt200x_setup_frontend_parameters()
675 buf[0] = 0x44; in nxt200x_setup_frontend_parameters()
676 nxt200x_writebytes(state, 0x55, buf, 1); in nxt200x_setup_frontend_parameters()
679 buf[0] = 0x04; in nxt200x_setup_frontend_parameters()
680 nxt200x_writebytes(state, 0x41, buf, 1); in nxt200x_setup_frontend_parameters()
683 nxt200x_readreg_multibyte(state, 0x80, buf, 1); in nxt200x_setup_frontend_parameters()
684 buf[0] = 0x24; in nxt200x_setup_frontend_parameters()
685 nxt200x_writereg_multibyte(state, 0x80, buf, 1); in nxt200x_setup_frontend_parameters()
688 nxt200x_readreg_multibyte(state, 0x08, buf, 1); in nxt200x_setup_frontend_parameters()
689 buf[0] = 0x10; in nxt200x_setup_frontend_parameters()
690 nxt200x_writereg_multibyte(state, 0x08, buf, 1); in nxt200x_setup_frontend_parameters()
691 nxt200x_readreg_multibyte(state, 0x08, buf, 1); in nxt200x_setup_frontend_parameters()
692 buf[0] = 0x00; in nxt200x_setup_frontend_parameters()
693 nxt200x_writereg_multibyte(state, 0x08, buf, 1); in nxt200x_setup_frontend_parameters()
695 nxt200x_readreg_multibyte(state, 0x80, buf, 1); in nxt200x_setup_frontend_parameters()
696 buf[0] = 0x04; in nxt200x_setup_frontend_parameters()
697 nxt200x_writereg_multibyte(state, 0x80, buf, 1); in nxt200x_setup_frontend_parameters()
698 buf[0] = 0x00; in nxt200x_setup_frontend_parameters()
699 nxt200x_writereg_multibyte(state, 0x81, buf, 1); in nxt200x_setup_frontend_parameters()
700 buf[0] = 0x80; buf[1] = 0x00; buf[2] = 0x00; in nxt200x_setup_frontend_parameters()
701 nxt200x_writereg_multibyte(state, 0x82, buf, 3); in nxt200x_setup_frontend_parameters()
702 nxt200x_readreg_multibyte(state, 0x88, buf, 1); in nxt200x_setup_frontend_parameters()
703 buf[0] = 0x11; in nxt200x_setup_frontend_parameters()
704 nxt200x_writereg_multibyte(state, 0x88, buf, 1); in nxt200x_setup_frontend_parameters()
705 nxt200x_readreg_multibyte(state, 0x80, buf, 1); in nxt200x_setup_frontend_parameters()
706 buf[0] = 0x44; in nxt200x_setup_frontend_parameters()
707 nxt200x_writereg_multibyte(state, 0x80, buf, 1); in nxt200x_setup_frontend_parameters()
713 buf[0] = 0x02; in nxt200x_setup_frontend_parameters()
716 buf[0] = 0x03; in nxt200x_setup_frontend_parameters()
719 buf[0] = 0x00; in nxt200x_setup_frontend_parameters()
725 nxt200x_writebytes(state, 0x30, buf, 1); in nxt200x_setup_frontend_parameters()
728 buf[0] = 0x00; in nxt200x_setup_frontend_parameters()
729 nxt200x_writebytes(state, 0x41, buf, 1); in nxt200x_setup_frontend_parameters()
732 buf[0] = 0x80; in nxt200x_setup_frontend_parameters()
733 buf[1] = 0x00; in nxt200x_setup_frontend_parameters()
736 nxt200x_writereg_multibyte(state, 0x49, buf, 2); in nxt200x_setup_frontend_parameters()
737 nxt200x_writereg_multibyte(state, 0x4B, buf, 2); in nxt200x_setup_frontend_parameters()
740 nxt200x_writebytes(state, 0x49, buf, 2); in nxt200x_setup_frontend_parameters()
741 nxt200x_writebytes(state, 0x4B, buf, 2); in nxt200x_setup_frontend_parameters()
749 buf[0] = 0x04; in nxt200x_setup_frontend_parameters()
750 nxt200x_writebytes(state, 0x41, buf, 1); in nxt200x_setup_frontend_parameters()
758 buf[0] = 0xF0; in nxt200x_setup_frontend_parameters()
759 buf[1] = 0x00; in nxt200x_setup_frontend_parameters()
760 nxt200x_writebytes(state, 0x5C, buf, 2); in nxt200x_setup_frontend_parameters()
766 return 0; in nxt200x_setup_frontend_parameters()
773 nxt200x_readbytes(state, 0x31, &lock, 1); in nxt200x_read_status()
775 *status = 0; in nxt200x_read_status()
776 if (lock & 0x20) { in nxt200x_read_status()
783 return 0; in nxt200x_read_status()
791 nxt200x_readreg_multibyte(state, 0xE6, b, 3); in nxt200x_read_ber()
793 *ber = ((b[0] << 8) + b[1]) * 8; in nxt200x_read_ber()
795 return 0; in nxt200x_read_ber()
802 u16 temp = 0; in nxt200x_read_signal_strength()
805 b[0] = 0x00; in nxt200x_read_signal_strength()
806 nxt200x_writebytes(state, 0xA1, b, 1); in nxt200x_read_signal_strength()
809 nxt200x_readreg_multibyte(state, 0xA6, b, 2); in nxt200x_read_signal_strength()
811 temp = (b[0] << 8) | b[1]; in nxt200x_read_signal_strength()
812 *strength = ((0x7FFF - temp) & 0x0FFF) * 16; in nxt200x_read_signal_strength()
814 return 0; in nxt200x_read_signal_strength()
822 u16 temp = 0, temp2; in nxt200x_read_snr()
823 u32 snrdb = 0; in nxt200x_read_snr()
826 b[0] = 0x00; in nxt200x_read_snr()
827 nxt200x_writebytes(state, 0xA1, b, 1); in nxt200x_read_snr()
829 /* get multreg val from 0xA6 */ in nxt200x_read_snr()
830 nxt200x_readreg_multibyte(state, 0xA6, b, 2); in nxt200x_read_snr()
832 temp = (b[0] << 8) | b[1]; in nxt200x_read_snr()
833 temp2 = 0x7FFF - temp; in nxt200x_read_snr()
836 if (temp2 > 0x7F00) in nxt200x_read_snr()
837 snrdb = 1000*24 + ( 1000*(30-24) * ( temp2 - 0x7F00 ) / ( 0x7FFF - 0x7F00 ) ); in nxt200x_read_snr()
838 else if (temp2 > 0x7EC0) in nxt200x_read_snr()
839 snrdb = 1000*18 + ( 1000*(24-18) * ( temp2 - 0x7EC0 ) / ( 0x7F00 - 0x7EC0 ) ); in nxt200x_read_snr()
840 else if (temp2 > 0x7C00) in nxt200x_read_snr()
841 snrdb = 1000*12 + ( 1000*(18-12) * ( temp2 - 0x7C00 ) / ( 0x7EC0 - 0x7C00 ) ); in nxt200x_read_snr()
843 snrdb = 1000*0 + ( 1000*(12-0) * ( temp2 - 0 ) / ( 0x7C00 - 0 ) ); in nxt200x_read_snr()
845 /* the value reported back from the frontend will be FFFF=32db 0000=0db */ in nxt200x_read_snr()
846 *snr = snrdb * (0xFFFF/32000); in nxt200x_read_snr()
848 return 0; in nxt200x_read_snr()
856 nxt200x_readreg_multibyte(state, 0xE6, b, 3); in nxt200x_read_ucblocks()
859 return 0; in nxt200x_read_ucblocks()
864 return 0; in nxt200x_sleep()
898 buf[0]=0x00; in nxt2002_init()
899 nxt200x_writebytes(state, 0x2B, buf, 1); in nxt2002_init()
905 buf[0] = 0x0F; in nxt2002_init()
906 nxt200x_writebytes(state, 0x08, buf, 1); in nxt2002_init()
907 buf[0] = 0x00; in nxt2002_init()
908 nxt200x_writebytes(state, 0x08, buf, 1); in nxt2002_init()
911 buf[0] = 0xF1; in nxt2002_init()
912 nxt200x_writebytes(state, 0x57, buf, 1); in nxt2002_init()
915 buf[0] = 0x20; in nxt2002_init()
916 nxt200x_writebytes(state, 0x09, buf, 1); in nxt2002_init()
919 buf[0] = 0x7E; in nxt2002_init()
920 buf[1] = 0x00; in nxt2002_init()
921 nxt200x_writebytes(state, 0xE9, buf, 2); in nxt2002_init()
924 buf[0] = 0x00; in nxt2002_init()
925 nxt200x_writebytes(state, 0xCC, buf, 1); in nxt2002_init()
927 return 0; in nxt2002_init()
938 buf[0]=0x00; in nxt2004_init()
939 nxt200x_writebytes(state, 0x1E, buf, 1); in nxt2004_init()
962 buf[0] = 0x01; in nxt2004_init()
963 nxt200x_writebytes(state, 0x19, buf, 1); in nxt2004_init()
972 buf[0] = 0xFF; in nxt2004_init()
973 nxt200x_writereg_multibyte(state, 0x08, buf, 1); in nxt2004_init()
974 buf[0] = 0x00; in nxt2004_init()
975 nxt200x_writereg_multibyte(state, 0x08, buf, 1); in nxt2004_init()
978 buf[0] = 0xD7; in nxt2004_init()
979 nxt200x_writebytes(state, 0x57, buf, 1); in nxt2004_init()
982 buf[0] = 0x07; in nxt2004_init()
983 buf[1] = 0xfe; in nxt2004_init()
984 nxt200x_writebytes(state, 0x35, buf, 2); in nxt2004_init()
985 buf[0] = 0x12; in nxt2004_init()
986 nxt200x_writebytes(state, 0x34, buf, 1); in nxt2004_init()
987 buf[0] = 0x80; in nxt2004_init()
988 nxt200x_writebytes(state, 0x21, buf, 1); in nxt2004_init()
991 buf[0] = 0x21; in nxt2004_init()
992 nxt200x_writebytes(state, 0x0A, buf, 1); in nxt2004_init()
995 buf[0] = 0x01; in nxt2004_init()
996 nxt200x_writereg_multibyte(state, 0x80, buf, 1); in nxt2004_init()
999 buf[0] = 0x7E; in nxt2004_init()
1000 buf[1] = 0x00; in nxt2004_init()
1001 nxt200x_writebytes(state, 0xE9, buf, 2); in nxt2004_init()
1004 buf[0] = 0x00; in nxt2004_init()
1005 nxt200x_writebytes(state, 0xCC, buf, 1); in nxt2004_init()
1008 nxt200x_readreg_multibyte(state, 0x80, buf, 1); in nxt2004_init()
1009 buf[0] = 0x00; in nxt2004_init()
1010 nxt200x_writereg_multibyte(state, 0x80, buf, 1); in nxt2004_init()
1013 nxt200x_readreg_multibyte(state, 0x08, buf, 1); in nxt2004_init()
1014 buf[0] = 0x10; in nxt2004_init()
1015 nxt200x_writereg_multibyte(state, 0x08, buf, 1); in nxt2004_init()
1016 nxt200x_readreg_multibyte(state, 0x08, buf, 1); in nxt2004_init()
1017 buf[0] = 0x00; in nxt2004_init()
1018 nxt200x_writereg_multibyte(state, 0x08, buf, 1); in nxt2004_init()
1021 nxt200x_readreg_multibyte(state, 0x80, buf, 1); in nxt2004_init()
1022 buf[0] = 0x01; in nxt2004_init()
1023 nxt200x_writereg_multibyte(state, 0x80, buf, 1); in nxt2004_init()
1024 buf[0] = 0x70; in nxt2004_init()
1025 nxt200x_writereg_multibyte(state, 0x81, buf, 1); in nxt2004_init()
1026 buf[0] = 0x31; buf[1] = 0x5E; buf[2] = 0x66; in nxt2004_init()
1027 nxt200x_writereg_multibyte(state, 0x82, buf, 3); in nxt2004_init()
1029 nxt200x_readreg_multibyte(state, 0x88, buf, 1); in nxt2004_init()
1030 buf[0] = 0x11; in nxt2004_init()
1031 nxt200x_writereg_multibyte(state, 0x88, buf, 1); in nxt2004_init()
1032 nxt200x_readreg_multibyte(state, 0x80, buf, 1); in nxt2004_init()
1033 buf[0] = 0x40; in nxt2004_init()
1034 nxt200x_writereg_multibyte(state, 0x80, buf, 1); in nxt2004_init()
1036 nxt200x_readbytes(state, 0x10, buf, 1); in nxt2004_init()
1037 buf[0] = 0x10; in nxt2004_init()
1038 nxt200x_writebytes(state, 0x10, buf, 1); in nxt2004_init()
1039 nxt200x_readbytes(state, 0x0A, buf, 1); in nxt2004_init()
1040 buf[0] = 0x21; in nxt2004_init()
1041 nxt200x_writebytes(state, 0x0A, buf, 1); in nxt2004_init()
1045 buf[0] = 0x21; in nxt2004_init()
1046 nxt200x_writebytes(state, 0x0A, buf, 1); in nxt2004_init()
1047 buf[0] = 0x7E; in nxt2004_init()
1048 nxt200x_writebytes(state, 0xE9, buf, 1); in nxt2004_init()
1049 buf[0] = 0x00; in nxt2004_init()
1050 nxt200x_writebytes(state, 0xEA, buf, 1); in nxt2004_init()
1052 nxt200x_readreg_multibyte(state, 0x80, buf, 1); in nxt2004_init()
1053 buf[0] = 0x00; in nxt2004_init()
1054 nxt200x_writereg_multibyte(state, 0x80, buf, 1); in nxt2004_init()
1055 nxt200x_readreg_multibyte(state, 0x80, buf, 1); in nxt2004_init()
1056 buf[0] = 0x00; in nxt2004_init()
1057 nxt200x_writereg_multibyte(state, 0x80, buf, 1); in nxt2004_init()
1060 nxt200x_readreg_multibyte(state, 0x08, buf, 1); in nxt2004_init()
1061 buf[0] = 0x10; in nxt2004_init()
1062 nxt200x_writereg_multibyte(state, 0x08, buf, 1); in nxt2004_init()
1063 nxt200x_readreg_multibyte(state, 0x08, buf, 1); in nxt2004_init()
1064 buf[0] = 0x00; in nxt2004_init()
1065 nxt200x_writereg_multibyte(state, 0x08, buf, 1); in nxt2004_init()
1067 nxt200x_readreg_multibyte(state, 0x80, buf, 1); in nxt2004_init()
1068 buf[0] = 0x04; in nxt2004_init()
1069 nxt200x_writereg_multibyte(state, 0x80, buf, 1); in nxt2004_init()
1070 buf[0] = 0x00; in nxt2004_init()
1071 nxt200x_writereg_multibyte(state, 0x81, buf, 1); in nxt2004_init()
1072 buf[0] = 0x80; buf[1] = 0x00; buf[2] = 0x00; in nxt2004_init()
1073 nxt200x_writereg_multibyte(state, 0x82, buf, 3); in nxt2004_init()
1075 nxt200x_readreg_multibyte(state, 0x88, buf, 1); in nxt2004_init()
1076 buf[0] = 0x11; in nxt2004_init()
1077 nxt200x_writereg_multibyte(state, 0x88, buf, 1); in nxt2004_init()
1079 nxt200x_readreg_multibyte(state, 0x80, buf, 1); in nxt2004_init()
1080 buf[0] = 0x44; in nxt2004_init()
1081 nxt200x_writereg_multibyte(state, 0x80, buf, 1); in nxt2004_init()
1084 nxt200x_readbytes(state, 0x10, buf, 1); in nxt2004_init()
1085 buf[0] = 0x12; in nxt2004_init()
1086 nxt200x_writebytes(state, 0x10, buf, 1); in nxt2004_init()
1087 buf[0] = 0x04; in nxt2004_init()
1088 nxt200x_writebytes(state, 0x13, buf, 1); in nxt2004_init()
1089 buf[0] = 0x00; in nxt2004_init()
1090 nxt200x_writebytes(state, 0x16, buf, 1); in nxt2004_init()
1091 buf[0] = 0x04; in nxt2004_init()
1092 nxt200x_writebytes(state, 0x14, buf, 1); in nxt2004_init()
1093 buf[0] = 0x00; in nxt2004_init()
1094 nxt200x_writebytes(state, 0x14, buf, 1); in nxt2004_init()
1095 nxt200x_writebytes(state, 0x17, buf, 1); in nxt2004_init()
1096 nxt200x_writebytes(state, 0x14, buf, 1); in nxt2004_init()
1097 nxt200x_writebytes(state, 0x17, buf, 1); in nxt2004_init()
1099 return 0; in nxt2004_init()
1105 int ret = 0; in nxt200x_init()
1127 fesettings->step_size = 0; in nxt200x_get_tune_settings()
1128 fesettings->max_drift = 0; in nxt200x_get_tune_settings()
1129 return 0; in nxt200x_get_tune_settings()
1144 u8 buf [] = {0,0,0,0,0}; in nxt200x_attach()
1154 state->initialised = 0; in nxt200x_attach()
1157 nxt200x_readbytes(state, 0x00, buf, 5); in nxt200x_attach()
1161 switch (buf[0]) { in nxt200x_attach()
1162 case 0x04: in nxt200x_attach()
1166 case 0x05: in nxt200x_attach()
1177 if (buf[0] != 0x04) goto error; /* device id */ in nxt200x_attach()
1178 if (buf[1] != 0x02) goto error; /* fab id */ in nxt200x_attach()
1179 if (buf[2] != 0x11) goto error; /* month */ in nxt200x_attach()
1180 if (buf[3] != 0x20) goto error; /* year msb */ in nxt200x_attach()
1181 if (buf[4] != 0x00) goto error; /* year lsb */ in nxt200x_attach()
1184 if (buf[0] != 0x05) goto error; /* device id */ in nxt200x_attach()