Lines Matching full:fc
11 static int flexcop_i2c_operation(struct flexcop_device *fc, in flexcop_i2c_operation() argument
20 fc->write_ibi_reg(fc, tw_sm_c_100, ibi_zero); in flexcop_i2c_operation()
21 fc->write_ibi_reg(fc, tw_sm_c_100, *r100); /* initiating i2c operation */ in flexcop_i2c_operation()
24 r = fc->read_ibi_reg(fc, tw_sm_c_100); in flexcop_i2c_operation()
59 if (i2c->fc->dev_type == FC_SKY_REV27) in flexcop_i2c_read4()
62 ret = flexcop_i2c_operation(i2c->fc, &r100); in flexcop_i2c_read4()
66 ret = flexcop_i2c_operation(i2c->fc, &r100); in flexcop_i2c_read4()
76 r104 = i2c->fc->read_ibi_reg(i2c->fc, tw_sm_c_104); in flexcop_i2c_read4()
87 static int flexcop_i2c_write4(struct flexcop_device *fc, in flexcop_i2c_write4() argument
103 fc->write_ibi_reg(fc, tw_sm_c_104, r104); in flexcop_i2c_write4()
104 return flexcop_i2c_operation(fc, &r100); in flexcop_i2c_write4()
147 ret = flexcop_i2c_write4(i2c->fc, r100, p); in flexcop_i2c_request()
180 if (mutex_lock_interruptible(&i2c->fc->i2c_mutex)) in flexcop_master_xfer()
186 ret = i2c->fc->i2c_request(i2c, FC_READ, msgs[i].addr, in flexcop_master_xfer()
191 ret = i2c->fc->i2c_request(i2c, FC_WRITE, msgs[i].addr, in flexcop_master_xfer()
200 mutex_unlock(&i2c->fc->i2c_mutex); in flexcop_master_xfer()
217 int flexcop_i2c_init(struct flexcop_device *fc) in flexcop_i2c_init() argument
220 mutex_init(&fc->i2c_mutex); in flexcop_i2c_init()
222 fc->fc_i2c_adap[0].fc = fc; in flexcop_i2c_init()
223 fc->fc_i2c_adap[1].fc = fc; in flexcop_i2c_init()
224 fc->fc_i2c_adap[2].fc = fc; in flexcop_i2c_init()
225 fc->fc_i2c_adap[0].port = FC_I2C_PORT_DEMOD; in flexcop_i2c_init()
226 fc->fc_i2c_adap[1].port = FC_I2C_PORT_EEPROM; in flexcop_i2c_init()
227 fc->fc_i2c_adap[2].port = FC_I2C_PORT_TUNER; in flexcop_i2c_init()
229 strscpy(fc->fc_i2c_adap[0].i2c_adap.name, "B2C2 FlexCop I2C to demod", in flexcop_i2c_init()
230 sizeof(fc->fc_i2c_adap[0].i2c_adap.name)); in flexcop_i2c_init()
231 strscpy(fc->fc_i2c_adap[1].i2c_adap.name, "B2C2 FlexCop I2C to eeprom", in flexcop_i2c_init()
232 sizeof(fc->fc_i2c_adap[1].i2c_adap.name)); in flexcop_i2c_init()
233 strscpy(fc->fc_i2c_adap[2].i2c_adap.name, "B2C2 FlexCop I2C to tuner", in flexcop_i2c_init()
234 sizeof(fc->fc_i2c_adap[2].i2c_adap.name)); in flexcop_i2c_init()
236 i2c_set_adapdata(&fc->fc_i2c_adap[0].i2c_adap, &fc->fc_i2c_adap[0]); in flexcop_i2c_init()
237 i2c_set_adapdata(&fc->fc_i2c_adap[1].i2c_adap, &fc->fc_i2c_adap[1]); in flexcop_i2c_init()
238 i2c_set_adapdata(&fc->fc_i2c_adap[2].i2c_adap, &fc->fc_i2c_adap[2]); in flexcop_i2c_init()
240 fc->fc_i2c_adap[0].i2c_adap.algo = in flexcop_i2c_init()
241 fc->fc_i2c_adap[1].i2c_adap.algo = in flexcop_i2c_init()
242 fc->fc_i2c_adap[2].i2c_adap.algo = &flexcop_algo; in flexcop_i2c_init()
243 fc->fc_i2c_adap[0].i2c_adap.algo_data = in flexcop_i2c_init()
244 fc->fc_i2c_adap[1].i2c_adap.algo_data = in flexcop_i2c_init()
245 fc->fc_i2c_adap[2].i2c_adap.algo_data = NULL; in flexcop_i2c_init()
246 fc->fc_i2c_adap[0].i2c_adap.dev.parent = in flexcop_i2c_init()
247 fc->fc_i2c_adap[1].i2c_adap.dev.parent = in flexcop_i2c_init()
248 fc->fc_i2c_adap[2].i2c_adap.dev.parent = fc->dev; in flexcop_i2c_init()
250 ret = i2c_add_adapter(&fc->fc_i2c_adap[0].i2c_adap); in flexcop_i2c_init()
254 ret = i2c_add_adapter(&fc->fc_i2c_adap[1].i2c_adap); in flexcop_i2c_init()
258 ret = i2c_add_adapter(&fc->fc_i2c_adap[2].i2c_adap); in flexcop_i2c_init()
262 fc->init_state |= FC_STATE_I2C_INIT; in flexcop_i2c_init()
266 i2c_del_adapter(&fc->fc_i2c_adap[1].i2c_adap); in flexcop_i2c_init()
268 i2c_del_adapter(&fc->fc_i2c_adap[0].i2c_adap); in flexcop_i2c_init()
272 void flexcop_i2c_exit(struct flexcop_device *fc) in flexcop_i2c_exit() argument
274 if (fc->init_state & FC_STATE_I2C_INIT) { in flexcop_i2c_exit()
275 i2c_del_adapter(&fc->fc_i2c_adap[2].i2c_adap); in flexcop_i2c_exit()
276 i2c_del_adapter(&fc->fc_i2c_adap[1].i2c_adap); in flexcop_i2c_exit()
277 i2c_del_adapter(&fc->fc_i2c_adap[0].i2c_adap); in flexcop_i2c_exit()
279 fc->init_state &= ~FC_STATE_I2C_INIT; in flexcop_i2c_exit()