Lines Matching refs:state

49 static int tda8083_writereg (struct tda8083_state* state, u8 reg, u8 data)
53 struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 };
55 ret = i2c_transfer(state->i2c, &msg, 1);
64 static int tda8083_readregs (struct tda8083_state* state, u8 reg1, u8 *b, u8 len)
67 struct i2c_msg msg [] = { { .addr = state->config->demod_address, .flags = 0, .buf = &reg1, .len = 1 },
68 { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b, .len = len } };
70 ret = i2c_transfer(state->i2c, msg, 2);
79 static inline u8 tda8083_readreg (struct tda8083_state* state, u8 reg)
83 tda8083_readregs (state, reg, &val, 1);
88 static int tda8083_set_inversion(struct tda8083_state *state,
98 static int tda8083_set_fec(struct tda8083_state *state, enum fe_code_rate fec)
101 return tda8083_writereg (state, 0x07, 0xff);
104 return tda8083_writereg (state, 0x07, 1 << (FEC_8_9 - fec));
109 static enum fe_code_rate tda8083_get_fec(struct tda8083_state *state)
117 index = tda8083_readreg(state, 0x0e) & 0x07;
122 static int tda8083_set_symbolrate (struct tda8083_state* state, u32 srate)
150 tda8083_writereg (state, 0x05, filter);
151 tda8083_writereg (state, 0x02, (ratio >> 16) & 0xff);
152 tda8083_writereg (state, 0x03, (ratio >> 8) & 0xff);
153 tda8083_writereg (state, 0x04, (ratio ) & 0xff);
155 tda8083_writereg (state, 0x00, 0x3c);
156 tda8083_writereg (state, 0x00, 0x04);
161 static void tda8083_wait_diseqc_fifo (struct tda8083_state* state, int timeout)
166 !(tda8083_readreg(state, 0x02) & 0x80))
172 static int tda8083_set_tone(struct tda8083_state *state,
175 tda8083_writereg (state, 0x26, 0xf1);
179 return tda8083_writereg (state, 0x29, 0x00);
181 return tda8083_writereg (state, 0x29, 0x80);
187 static int tda8083_set_voltage(struct tda8083_state *state,
192 return tda8083_writereg (state, 0x20, 0x00);
194 return tda8083_writereg (state, 0x20, 0x11);
200 static int tda8083_send_diseqc_burst(struct tda8083_state *state,
205 tda8083_writereg (state, 0x29, (5 << 2)); /* send burst A */
208 tda8083_writereg (state, 0x29, (7 << 2)); /* send B */
214 tda8083_wait_diseqc_fifo (state, 100);
222 struct tda8083_state* state = fe->demodulator_priv;
225 tda8083_writereg (state, 0x29, (m->msg_len - 3) | (1 << 2)); /* enable */
228 tda8083_writereg (state, 0x23 + i, m->msg[i]);
230 tda8083_writereg (state, 0x29, (m->msg_len - 3) | (3 << 2)); /* send!! */
232 tda8083_wait_diseqc_fifo (state, 100);
240 struct tda8083_state* state = fe->demodulator_priv;
242 u8 signal = ~tda8083_readreg (state, 0x01);
243 u8 sync = tda8083_readreg (state, 0x02);
270 struct tda8083_state* state = fe->demodulator_priv;
274 if ((ret = tda8083_readregs(state, 0x0b, buf, sizeof(buf))))
284 struct tda8083_state* state = fe->demodulator_priv;
286 u8 signal = ~tda8083_readreg (state, 0x01);
294 struct tda8083_state* state = fe->demodulator_priv;
296 u8 _snr = tda8083_readreg (state, 0x08);
304 struct tda8083_state* state = fe->demodulator_priv;
306 *ucblocks = tda8083_readreg(state, 0x0f);
316 struct tda8083_state* state = fe->demodulator_priv;
323 tda8083_set_inversion (state, p->inversion);
324 tda8083_set_fec(state, p->fec_inner);
325 tda8083_set_symbolrate(state, p->symbol_rate);
327 tda8083_writereg (state, 0x00, 0x3c);
328 tda8083_writereg (state, 0x00, 0x04);
336 struct tda8083_state* state = fe->demodulator_priv;
340 p->inversion = (tda8083_readreg (state, 0x0e) & 0x80) ?
342 p->fec_inner = tda8083_get_fec(state);
343 /*p->symbol_rate = tda8083_get_symbolrate (state);*/
350 struct tda8083_state* state = fe->demodulator_priv;
352 tda8083_writereg (state, 0x00, 0x02);
358 struct tda8083_state* state = fe->demodulator_priv;
362 tda8083_writereg (state, i, tda8083_init_tab[i]);
364 tda8083_writereg (state, 0x00, 0x3c);
365 tda8083_writereg (state, 0x00, 0x04);
373 struct tda8083_state* state = fe->demodulator_priv;
375 tda8083_send_diseqc_burst (state, burst);
376 tda8083_writereg (state, 0x00, 0x3c);
377 tda8083_writereg (state, 0x00, 0x04);
385 struct tda8083_state* state = fe->demodulator_priv;
387 tda8083_set_tone (state, tone);
388 tda8083_writereg (state, 0x00, 0x3c);
389 tda8083_writereg (state, 0x00, 0x04);
397 struct tda8083_state* state = fe->demodulator_priv;
399 tda8083_set_voltage (state, voltage);
400 tda8083_writereg (state, 0x00, 0x3c);
401 tda8083_writereg (state, 0x00, 0x04);
408 struct tda8083_state* state = fe->demodulator_priv;
409 kfree(state);
417 struct tda8083_state* state = NULL;
419 /* allocate memory for the internal state */
420 state = kzalloc(sizeof(struct tda8083_state), GFP_KERNEL);
421 if (state == NULL) goto error;
423 /* setup the state */
424 state->config = config;
425 state->i2c = i2c;
428 if ((tda8083_readreg(state, 0x00)) != 0x05) goto error;
431 memcpy(&state->frontend.ops, &tda8083_ops, sizeof(struct dvb_frontend_ops));
432 state->frontend.demodulator_priv = state;
433 return &state->frontend;
436 kfree(state);