Lines Matching refs:btv
48 struct bttv *btv = (struct bttv*)data; in bttv_bit_setscl() local
51 btv->i2c_state |= 0x02; in bttv_bit_setscl()
53 btv->i2c_state &= ~0x02; in bttv_bit_setscl()
54 btwrite(btv->i2c_state, BT848_I2C); in bttv_bit_setscl()
60 struct bttv *btv = (struct bttv*)data; in bttv_bit_setsda() local
63 btv->i2c_state |= 0x01; in bttv_bit_setsda()
65 btv->i2c_state &= ~0x01; in bttv_bit_setsda()
66 btwrite(btv->i2c_state, BT848_I2C); in bttv_bit_setsda()
72 struct bttv *btv = (struct bttv*)data; in bttv_bit_getscl() local
81 struct bttv *btv = (struct bttv*)data; in bttv_bit_getsda() local
106 bttv_i2c_wait_done(struct bttv *btv) in bttv_i2c_wait_done() argument
111 if (wait_event_interruptible_timeout(btv->i2c_queue, in bttv_i2c_wait_done()
112 btv->i2c_done, msecs_to_jiffies(85)) == -ERESTARTSYS) in bttv_i2c_wait_done()
115 if (btv->i2c_done & BT848_INT_RACK) in bttv_i2c_wait_done()
117 btv->i2c_done = 0; in bttv_i2c_wait_done()
125 bttv_i2c_sendbytes(struct bttv *btv, const struct i2c_msg *msg, int last) in bttv_i2c_sendbytes() argument
139 retval = bttv_i2c_wait_done(btv); in bttv_i2c_sendbytes()
154 retval = bttv_i2c_wait_done(btv); in bttv_i2c_sendbytes()
175 bttv_i2c_readbytes(struct bttv *btv, const struct i2c_msg *msg, int last) in bttv_i2c_readbytes() argument
196 retval = bttv_i2c_wait_done(btv); in bttv_i2c_readbytes()
223 struct bttv *btv = to_bttv(v4l2_dev); in bttv_i2c_xfer() local
234 retval = bttv_i2c_readbytes(btv, &msgs[i], i+1 == num); in bttv_i2c_xfer()
239 retval = bttv_i2c_sendbytes(btv, &msgs[i], i+1 == num); in bttv_i2c_xfer()
259 int bttv_I2CRead(struct bttv *btv, unsigned char addr, char *probe_for) in bttv_I2CRead() argument
263 if (0 != btv->i2c_rc) in bttv_I2CRead()
267 btv->c.nr, probe_for, addr); in bttv_I2CRead()
268 btv->i2c_client.addr = addr >> 1; in bttv_I2CRead()
269 if (1 != i2c_master_recv(&btv->i2c_client, &buffer, 1)) { in bttv_I2CRead()
275 btv->c.nr, addr); in bttv_I2CRead()
284 int bttv_I2CWrite(struct bttv *btv, unsigned char addr, unsigned char b1, in bttv_I2CWrite() argument
290 if (0 != btv->i2c_rc) in bttv_I2CWrite()
292 btv->i2c_client.addr = addr >> 1; in bttv_I2CWrite()
295 if (bytes != i2c_master_send(&btv->i2c_client, buffer, bytes)) in bttv_I2CWrite()
301 void bttv_readee(struct bttv *btv, unsigned char *eedata, int addr) in bttv_readee() argument
304 if (0 != btv->i2c_rc) in bttv_readee()
306 btv->i2c_client.addr = addr >> 1; in bttv_readee()
307 tveeprom_read(&btv->i2c_client, eedata, 256); in bttv_readee()
336 int init_bttv_i2c(struct bttv *btv) in init_bttv_i2c() argument
338 strscpy(btv->i2c_client.name, "bttv internal", I2C_NAME_SIZE); in init_bttv_i2c()
341 btv->use_i2c_hw = 1; in init_bttv_i2c()
342 if (btv->use_i2c_hw) { in init_bttv_i2c()
344 strscpy(btv->c.i2c_adap.name, "bt878", in init_bttv_i2c()
345 sizeof(btv->c.i2c_adap.name)); in init_bttv_i2c()
346 btv->c.i2c_adap.algo = &bttv_algo; in init_bttv_i2c()
353 strscpy(btv->c.i2c_adap.name, "bttv", in init_bttv_i2c()
354 sizeof(btv->c.i2c_adap.name)); in init_bttv_i2c()
355 btv->i2c_algo = bttv_i2c_algo_bit_template; in init_bttv_i2c()
356 btv->i2c_algo.udelay = i2c_udelay; in init_bttv_i2c()
357 btv->i2c_algo.data = btv; in init_bttv_i2c()
358 btv->c.i2c_adap.algo_data = &btv->i2c_algo; in init_bttv_i2c()
360 btv->c.i2c_adap.owner = THIS_MODULE; in init_bttv_i2c()
362 btv->c.i2c_adap.dev.parent = &btv->c.pci->dev; in init_bttv_i2c()
363 snprintf(btv->c.i2c_adap.name, sizeof(btv->c.i2c_adap.name), in init_bttv_i2c()
364 "bt%d #%d [%s]", btv->id, btv->c.nr, in init_bttv_i2c()
365 btv->use_i2c_hw ? "hw" : "sw"); in init_bttv_i2c()
367 i2c_set_adapdata(&btv->c.i2c_adap, &btv->c.v4l2_dev); in init_bttv_i2c()
368 btv->i2c_client.adapter = &btv->c.i2c_adap; in init_bttv_i2c()
371 if (btv->use_i2c_hw) { in init_bttv_i2c()
372 btv->i2c_rc = i2c_add_adapter(&btv->c.i2c_adap); in init_bttv_i2c()
374 bttv_bit_setscl(btv,1); in init_bttv_i2c()
375 bttv_bit_setsda(btv,1); in init_bttv_i2c()
376 btv->i2c_rc = i2c_bit_add_bus(&btv->c.i2c_adap); in init_bttv_i2c()
378 if (0 == btv->i2c_rc && i2c_scan) in init_bttv_i2c()
379 do_i2c_scan(btv->c.v4l2_dev.name, &btv->i2c_client); in init_bttv_i2c()
381 return btv->i2c_rc; in init_bttv_i2c()
384 int fini_bttv_i2c(struct bttv *btv) in fini_bttv_i2c() argument
386 if (btv->i2c_rc == 0) in fini_bttv_i2c()
387 i2c_del_adapter(&btv->c.i2c_adap); in fini_bttv_i2c()