Lines Matching +full:ati +full:- +full:target

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Support for NXT2002 and NXT2004 - VSB/QAM
6 * Copyright (C) 2006-2014 Michael Krufky <mkrufky@linuxtv.org>
8 * and nxt2004 by Jean-Francois Thibert <jeanfrancois@sagetv.com>
15 * B2C2/BBTI Technisat Air2PC - ATSC (NXT2002)
17 * ATI HDTV Wonder (NXT2004)
31 #define NXT2002_DEFAULT_FIRMWARE "dvb-fe-nxt2002.fw"
32 #define NXT2004_DEFAULT_FIRMWARE "dvb-fe-nxt2004.fw"
63 if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { in i2c_writebytes()
66 return -EREMOTEIO; in i2c_writebytes()
76 if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { in i2c_readbytes()
79 return -EREMOTEIO; in i2c_readbytes()
89 …struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf2, .len = len +… in nxt200x_writebytes()
94 return -EINVAL; in nxt200x_writebytes()
100 if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { in nxt200x_writebytes()
102 __func__, state->config->demod_address, err); in nxt200x_writebytes()
103 return -EREMOTEIO; in nxt200x_writebytes()
112 …struct i2c_msg msg [] = { { .addr = state->config->demod_address, .flags = 0, .buf = reg2, .len = … in nxt200x_readbytes()
113 { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = buf, .len = len } }; in nxt200x_readbytes()
117 if ((err = i2c_transfer (state->i2c, msg, 2)) != 2) { in nxt200x_readbytes()
119 __func__, state->config->demod_address, err); in nxt200x_readbytes()
120 return -EREMOTEIO; in nxt200x_readbytes()
152 switch (state->demod_chip) { in nxt200x_writereg_multibyte()
170 return -EINVAL; in nxt200x_writereg_multibyte()
182 switch (state->demod_chip) { in nxt200x_writereg_multibyte()
192 return -EINVAL; in nxt200x_writereg_multibyte()
210 switch (state->demod_chip) { in nxt200x_readreg_multibyte()
244 return -EINVAL; in nxt200x_readreg_multibyte()
255 switch (state->demod_chip) { in nxt200x_microcontroller_stop()
332 switch (state->demod_chip) { in nxt200x_writetuner()
376 return -EINVAL; in nxt200x_writetuner()
387 switch (state->demod_chip) { in nxt200x_agc_reset()
410 struct nxt200x_state* state = fe->demodulator_priv; in nxt2002_load_firmware()
415 dprintk("Firmware is %zu bytes\n", fw->size); in nxt2002_load_firmware()
431 for (position = 0; position < fw->size; position++) { in nxt2002_load_firmware()
445 nxt200x_writebytes(state, chunkpos, &fw->data[position-3], 4); in nxt2002_load_firmware()
447 crc = nxt200x_crc(crc, fw->data[position]); in nxt2002_load_firmware()
449 if ((written == 255) || (position+1 == fw->size)) { in nxt2002_load_firmware()
451 nxt200x_writebytes(state, chunkpos+4-(written %4), in nxt2002_load_firmware()
452 &fw->data[position-(written %4) + 1], in nxt2002_load_firmware()
477 struct nxt200x_state* state = fe->demodulator_priv; in nxt2004_load_firmware()
482 dprintk("Firmware is %zu bytes\n", fw->size); in nxt2004_load_firmware()
492 for (position = 0; position < fw->size; position++) { in nxt2004_load_firmware()
493 crc = nxt200x_crc(crc, fw->data[position]); 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()
504 fw->size-position > 255 ? 255 : fw->size-position); in nxt2004_load_firmware()
505 position += (fw->size-position > 255 ? 255 : fw->size-position); in nxt2004_load_firmware()
527 struct dtv_frontend_properties *p = &fe->dtv_property_cache; in nxt200x_setup_frontend_parameters()
528 struct nxt200x_state* state = fe->demodulator_priv; in nxt200x_setup_frontend_parameters()
534 if (state->demod_chip == NXT2004) { in nxt200x_setup_frontend_parameters()
543 switch (p->modulation) { in nxt200x_setup_frontend_parameters()
548 if (state->config->set_ts_params) in nxt200x_setup_frontend_parameters()
549 state->config->set_ts_params(fe, 1); in nxt200x_setup_frontend_parameters()
552 /* Set non-punctured clock for VSB */ in nxt200x_setup_frontend_parameters()
553 if (state->config->set_ts_params) in nxt200x_setup_frontend_parameters()
554 state->config->set_ts_params(fe, 0); in nxt200x_setup_frontend_parameters()
557 return -EINVAL; in nxt200x_setup_frontend_parameters()
561 if (fe->ops.tuner_ops.calc_regs) { in nxt200x_setup_frontend_parameters()
563 fe->ops.tuner_ops.calc_regs(fe, buf, 5); in nxt200x_setup_frontend_parameters()
572 /* set target power level */ in nxt200x_setup_frontend_parameters()
573 switch (p->modulation) { in nxt200x_setup_frontend_parameters()
582 return -EINVAL; in nxt200x_setup_frontend_parameters()
588 switch (state->demod_chip) { in nxt200x_setup_frontend_parameters()
596 return -EINVAL; in nxt200x_setup_frontend_parameters()
604 switch (state->demod_chip) { in nxt200x_setup_frontend_parameters()
612 return -EINVAL; in nxt200x_setup_frontend_parameters()
617 switch (p->modulation) { in nxt200x_setup_frontend_parameters()
628 return -EINVAL; in nxt200x_setup_frontend_parameters()
632 switch (state->demod_chip) { in nxt200x_setup_frontend_parameters()
640 return -EINVAL; in nxt200x_setup_frontend_parameters()
648 if (state->demod_chip == NXT2004) { in nxt200x_setup_frontend_parameters()
658 switch (state->demod_chip) { in nxt200x_setup_frontend_parameters()
666 return -EINVAL; in nxt200x_setup_frontend_parameters()
682 if (state->demod_chip == NXT2004) { in nxt200x_setup_frontend_parameters()
711 switch (p->modulation) { in nxt200x_setup_frontend_parameters()
722 return -EINVAL; in nxt200x_setup_frontend_parameters()
734 switch (state->demod_chip) { in nxt200x_setup_frontend_parameters()
744 return -EINVAL; in nxt200x_setup_frontend_parameters()
754 if (state->demod_chip == NXT2004) { in nxt200x_setup_frontend_parameters()
771 struct nxt200x_state* state = fe->demodulator_priv; in nxt200x_read_status()
788 struct nxt200x_state* state = fe->demodulator_priv; in nxt200x_read_ber()
800 struct nxt200x_state* state = fe->demodulator_priv; in nxt200x_read_signal_strength()
812 *strength = ((0x7FFF - temp) & 0x0FFF) * 16; in nxt200x_read_signal_strength()
820 struct nxt200x_state* state = fe->demodulator_priv; in nxt200x_read_snr()
833 temp2 = 0x7FFF - temp; in nxt200x_read_snr()
837 snrdb = 1000*24 + ( 1000*(30-24) * ( temp2 - 0x7F00 ) / ( 0x7FFF - 0x7F00 ) ); in nxt200x_read_snr()
839 snrdb = 1000*18 + ( 1000*(24-18) * ( temp2 - 0x7EC0 ) / ( 0x7F00 - 0x7EC0 ) ); 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()
853 struct nxt200x_state* state = fe->demodulator_priv; in nxt200x_read_ucblocks()
869 struct nxt200x_state* state = fe->demodulator_priv; in nxt2002_init()
878 state->i2c->dev.parent); in nxt2002_init()
932 struct nxt200x_state* state = fe->demodulator_priv; in nxt2004_init()
945 state->i2c->dev.parent); in nxt2004_init()
1104 struct nxt200x_state* state = fe->demodulator_priv; in nxt200x_init()
1107 if (!state->initialised) { in nxt200x_init()
1108 switch (state->demod_chip) { in nxt200x_init()
1116 return -EINVAL; in nxt200x_init()
1119 state->initialised = 1; in nxt200x_init()
1126 fesettings->min_delay_ms = 500; in nxt200x_get_tune_settings()
1127 fesettings->step_size = 0; in nxt200x_get_tune_settings()
1128 fesettings->max_drift = 0; in nxt200x_get_tune_settings()
1134 struct nxt200x_state* state = fe->demodulator_priv; in nxt200x_release()
1152 state->config = config; in nxt200x_attach()
1153 state->i2c = i2c; in nxt200x_attach()
1154 state->initialised = 0; in nxt200x_attach()
1163 state->demod_chip = NXT2002; in nxt200x_attach()
1167 state->demod_chip = NXT2004; in nxt200x_attach()
1175 switch (state->demod_chip) { in nxt200x_attach()
1191 memcpy(&state->frontend.ops, &nxt200x_ops, sizeof(struct dvb_frontend_ops)); in nxt200x_attach()
1192 state->frontend.demodulator_priv = state; in nxt200x_attach()
1193 return &state->frontend; in nxt200x_attach()
1231 MODULE_DESCRIPTION("NXT200X (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver");
1232 MODULE_AUTHOR("Kirk Lapray, Michael Krufky, Jean-Francois Thibert, and Taylor Jacob");