Lines Matching defs:state
60 struct mt352_state* state = fe->demodulator_priv;
62 struct i2c_msg msg = { .addr = state->config.demod_address, .flags = 0,
64 int err = i2c_transfer(state->i2c, &msg, 1);
82 static int mt352_read_register(struct mt352_state* state, u8 reg)
87 struct i2c_msg msg [] = { { .addr = state->config.demod_address,
90 { .addr = state->config.demod_address,
94 ret = i2c_transfer(state->i2c, msg, 2);
113 static void mt352_calc_nominal_rate(struct mt352_state* state,
132 if (state->config.adc_clock)
133 adc_clock = state->config.adc_clock;
143 static void mt352_calc_input_freq(struct mt352_state* state,
150 if (state->config.adc_clock)
151 adc_clock = state->config.adc_clock;
152 if (state->config.if2)
153 if2 = state->config.if2;
172 struct mt352_state* state = fe->demodulator_priv;
291 mt352_calc_nominal_rate(state, op->bandwidth, buf+4);
292 mt352_calc_input_freq(state, buf+6);
294 if (state->config.no_tuner) {
318 struct mt352_state* state = fe->demodulator_priv;
335 if ( (mt352_read_register(state,0x00) & 0xC0) != 0xC0 )
341 tps = (mt352_read_register(state, TPS_RECEIVED_1) << 8) | mt352_read_register(state, TPS_RECEIVED_0);
342 div = (mt352_read_register(state, CHAN_START_1) << 8) | mt352_read_register(state, CHAN_START_0);
343 trl = mt352_read_register(state, TRL_NOMINAL_RATE_1);
414 if (mt352_read_register(state, STATUS_2) & 0x02)
424 struct mt352_state* state = fe->demodulator_priv;
428 if ((s0 = mt352_read_register(state, STATUS_0)) < 0)
430 if ((s1 = mt352_read_register(state, STATUS_1)) < 0)
432 if ((s3 = mt352_read_register(state, STATUS_3)) < 0)
456 struct mt352_state* state = fe->demodulator_priv;
458 *ber = (mt352_read_register (state, RS_ERR_CNT_2) << 16) |
459 (mt352_read_register (state, RS_ERR_CNT_1) << 8) |
460 (mt352_read_register (state, RS_ERR_CNT_0));
467 struct mt352_state* state = fe->demodulator_priv;
470 u16 signal = ((mt352_read_register(state, AGC_GAIN_1) & 0x0f) << 12) |
471 (mt352_read_register(state, AGC_GAIN_0) << 4);
480 struct mt352_state* state = fe->demodulator_priv;
482 u8 _snr = mt352_read_register (state, SNR);
490 struct mt352_state* state = fe->demodulator_priv;
492 *ucblocks = (mt352_read_register (state, RS_UBC_1) << 8) |
493 (mt352_read_register (state, RS_UBC_0));
509 struct mt352_state* state = fe->demodulator_priv;
515 if ((mt352_read_register(state, CLOCK_CTL) & 0x10) == 0 ||
516 (mt352_read_register(state, CONFIG) & 0x20) == 0) {
520 return state->config.demod_init(fe);
528 struct mt352_state* state = fe->demodulator_priv;
529 kfree(state);
537 struct mt352_state* state = NULL;
539 /* allocate memory for the internal state */
540 state = kzalloc(sizeof(struct mt352_state), GFP_KERNEL);
541 if (state == NULL) goto error;
543 /* setup the state */
544 state->i2c = i2c;
545 memcpy(&state->config,config,sizeof(struct mt352_config));
548 if (mt352_read_register(state, CHIP_ID) != ID_MT352) goto error;
551 memcpy(&state->frontend.ops, &mt352_ops, sizeof(struct dvb_frontend_ops));
552 state->frontend.demodulator_priv = state;
553 return &state->frontend;
556 kfree(state);