Lines Matching defs:state
81 static int bcm3510_writebytes (struct bcm3510_state *state, u8 reg, u8 *buf, u8 len)
85 struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = b, .len = len + 1 };
94 if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) {
97 __func__, state->config->demod_address, reg, err);
104 static int bcm3510_readbytes (struct bcm3510_state *state, u8 reg, u8 *buf, u8 len)
107 { .addr = state->config->demod_address, .flags = 0, .buf = ®, .len = 1 },
108 { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = buf, .len = len }
114 if ((err = i2c_transfer (state->i2c, msg, 2)) != 2) {
116 __func__, state->config->demod_address, reg, err);
126 static int bcm3510_writeB(struct bcm3510_state *state, u8 reg, bcm3510_register_value v)
128 return bcm3510_writebytes(state,reg,&v.raw,1);
131 static int bcm3510_readB(struct bcm3510_state *state, u8 reg, bcm3510_register_value *v)
133 return bcm3510_readbytes(state,reg,&v->raw,1);
374 /* Set duration of the initial state of TUNCTL = 3.34 micro Sec */
600 struct bcm3510_state* state = fe->demodulator_priv;
601 kfree(state);
745 /* tri-state */
799 struct bcm3510_state* state = NULL;
803 /* allocate memory for the internal state */
804 state = kzalloc(sizeof(struct bcm3510_state), GFP_KERNEL);
805 if (state == NULL)
808 /* setup the state */
810 state->config = config;
811 state->i2c = i2c;
814 memcpy(&state->frontend.ops, &bcm3510_ops, sizeof(struct dvb_frontend_ops));
815 state->frontend.demodulator_priv = state;
817 mutex_init(&state->hab_mutex);
819 if ((ret = bcm3510_readB(state,0xe0,&v)) < 0)
830 bcm3510_reset(state);
832 return &state->frontend;
835 kfree(state);