Lines Matching defs:state
46 struct mt352_state* state = fe->demodulator_priv;
48 struct i2c_msg msg = { .addr = state->config.demod_address, .flags = 0,
50 int err = i2c_transfer(state->i2c, &msg, 1);
68 static int mt352_read_register(struct mt352_state* state, u8 reg)
73 struct i2c_msg msg [] = { { .addr = state->config.demod_address,
76 { .addr = state->config.demod_address,
80 ret = i2c_transfer(state->i2c, msg, 2);
99 static void mt352_calc_nominal_rate(struct mt352_state* state,
118 if (state->config.adc_clock)
119 adc_clock = state->config.adc_clock;
129 static void mt352_calc_input_freq(struct mt352_state* state,
136 if (state->config.adc_clock)
137 adc_clock = state->config.adc_clock;
138 if (state->config.if2)
139 if2 = state->config.if2;
158 struct mt352_state* state = fe->demodulator_priv;
277 mt352_calc_nominal_rate(state, op->bandwidth_hz, buf+4);
278 mt352_calc_input_freq(state, buf+6);
280 if (state->config.no_tuner) {
304 struct mt352_state* state = fe->demodulator_priv;
320 if ( (mt352_read_register(state,0x00) & 0xC0) != 0xC0 )
326 tps = (mt352_read_register(state, TPS_RECEIVED_1) << 8) | mt352_read_register(state, TPS_RECEIVED_0);
327 div = (mt352_read_register(state, CHAN_START_1) << 8) | mt352_read_register(state, CHAN_START_0);
328 trl = mt352_read_register(state, TRL_NOMINAL_RATE_1);
399 if (mt352_read_register(state, STATUS_2) & 0x02)
409 struct mt352_state* state = fe->demodulator_priv;
424 if ((s0 = mt352_read_register(state, STATUS_0)) < 0)
426 if ((s1 = mt352_read_register(state, STATUS_1)) < 0)
428 if ((s3 = mt352_read_register(state, STATUS_3)) < 0)
452 struct mt352_state* state = fe->demodulator_priv;
454 *ber = (mt352_read_register (state, RS_ERR_CNT_2) << 16) |
455 (mt352_read_register (state, RS_ERR_CNT_1) << 8) |
456 (mt352_read_register (state, RS_ERR_CNT_0));
463 struct mt352_state* state = fe->demodulator_priv;
466 u16 signal = ((mt352_read_register(state, AGC_GAIN_1) & 0x0f) << 12) |
467 (mt352_read_register(state, AGC_GAIN_0) << 4);
476 struct mt352_state* state = fe->demodulator_priv;
478 u8 _snr = mt352_read_register (state, SNR);
486 struct mt352_state* state = fe->demodulator_priv;
488 *ucblocks = (mt352_read_register (state, RS_UBC_1) << 8) |
489 (mt352_read_register (state, RS_UBC_0));
505 struct mt352_state* state = fe->demodulator_priv;
511 if ((mt352_read_register(state, CLOCK_CTL) & 0x10) == 0 ||
512 (mt352_read_register(state, CONFIG) & 0x20) == 0) {
516 return state->config.demod_init(fe);
524 struct mt352_state* state = fe->demodulator_priv;
525 kfree(state);
533 struct mt352_state* state = NULL;
535 /* allocate memory for the internal state */
536 state = kzalloc(sizeof(struct mt352_state), GFP_KERNEL);
537 if (state == NULL) goto error;
539 /* setup the state */
540 state->i2c = i2c;
541 memcpy(&state->config,config,sizeof(struct mt352_config));
544 if (mt352_read_register(state, CHIP_ID) != ID_MT352) goto error;
547 memcpy(&state->frontend.ops, &mt352_ops, sizeof(struct dvb_frontend_ops));
548 state->frontend.demodulator_priv = state;
549 return &state->frontend;
552 kfree(state);