Lines Matching refs:usbvision
8 * This module is part of usbvision driver project.
36 #include "usbvision.h"
51 static int usbvision_i2c_write(struct usb_usbvision *usbvision, unsigned char addr, char *buf,
53 static int usbvision_i2c_read(struct usb_usbvision *usbvision, unsigned char addr, char *buf,
59 struct usb_usbvision *usbvision;
63 usbvision = (struct usb_usbvision *)i2c_get_adapdata(i2c_adap);
66 ret = (usbvision_i2c_write(usbvision, addr, buf, 1));
84 struct usb_usbvision *usbvision;
88 usbvision = (struct usb_usbvision *)i2c_get_adapdata(i2c_adap);
90 ret = (usbvision_i2c_read(usbvision, addr, buf, 1));
157 struct usb_usbvision *usbvision;
161 usbvision = (struct usb_usbvision *)i2c_get_adapdata(i2c_adap);
173 ret = (usbvision_i2c_read(usbvision, addr, pmsg->buf, pmsg->len));
179 ret = (usbvision_i2c_write(usbvision, addr, pmsg->buf, pmsg->len));
203 /* usbvision specific I2C functions */
207 int usbvision_i2c_register(struct usb_usbvision *usbvision)
214 memcpy(&usbvision->i2c_adap, &i2c_adap_template,
217 sprintf(usbvision->i2c_adap.name, "%s-%d-%s", i2c_adap_template.name,
218 usbvision->dev->bus->busnum, usbvision->dev->devpath);
219 PDEBUG(DBG_I2C,"Adaptername: %s", usbvision->i2c_adap.name);
220 usbvision->i2c_adap.dev.parent = &usbvision->dev->dev;
222 i2c_set_adapdata(&usbvision->i2c_adap, &usbvision->v4l2_dev);
224 if (usbvision_write_reg(usbvision, USBVISION_SER_MODE, USBVISION_IIC_LRNACK) < 0) {
234 usbvision->i2c_adap.algo = &usbvision_algo;
236 usbvision->i2c_adap.timeout = 100; /* default values, should */
237 usbvision->i2c_adap.retries = 3; /* be replaced by defines */
239 i2c_add_adapter(&usbvision->i2c_adap);
241 PDEBUG(DBG_I2C, "i2c bus for %s registered", usbvision->i2c_adap.name);
244 switch (usbvision_device_data[usbvision->DevModel].Codec) {
250 v4l2_i2c_new_subdev(&usbvision->v4l2_dev,
251 &usbvision->i2c_adap, "saa7115",
255 if (usbvision_device_data[usbvision->DevModel].Tuner == 1) {
260 sd = v4l2_i2c_new_subdev(&usbvision->v4l2_dev,
261 &usbvision->i2c_adap, "tuner",
267 sd = v4l2_i2c_new_subdev(&usbvision->v4l2_dev,
268 &usbvision->i2c_adap, "tuner",
271 if (usbvision->tuner_type != -1) {
273 tun_setup.type = usbvision->tuner_type;
275 call_all(usbvision, tuner, s_type_addr, &tun_setup);
282 int usbvision_i2c_unregister(struct usb_usbvision *usbvision)
285 i2c_del_adapter(&(usbvision->i2c_adap));
287 PDEBUG(DBG_I2C,"i2c bus for %s unregistered", usbvision->i2c_adap.name);
293 usbvision_i2c_read_max4(struct usb_usbvision *usbvision, unsigned char addr,
299 rc = usbvision_write_reg(usbvision, USBVISION_SER_ADRS, addr);
306 rc = usbvision_write_reg(usbvision, USBVISION_SER_CONT,
314 rc = usbvision_read_reg(usbvision, USBVISION_SER_CONT);
324 rc = usbvision_write_reg(usbvision, USBVISION_SER_CONT, 0x00);
334 buf[3] = usbvision_read_reg(usbvision, USBVISION_SER_DAT4);
336 buf[2] = usbvision_read_reg(usbvision, USBVISION_SER_DAT3);
338 buf[1] = usbvision_read_reg(usbvision, USBVISION_SER_DAT2);
340 buf[0] = usbvision_read_reg(usbvision, USBVISION_SER_DAT1);
357 static int usbvision_i2c_write_max4(struct usb_usbvision *usbvision,
374 rc = usb_control_msg(usbvision->dev,
375 usb_sndctrlpipe(usbvision->dev, 1),
385 rc = usbvision_write_reg(usbvision, USBVISION_SER_CONT,
392 rc = usbvision_read_reg(usbvision, USBVISION_SER_CONT);
401 usbvision_write_reg(usbvision, USBVISION_SER_CONT, 0x00);
417 static int usbvision_i2c_write(struct usb_usbvision *usbvision, unsigned char addr, char *buf,
428 retval = usbvision_i2c_write_max4(usbvision, addr, bufPtr, count);
439 static int usbvision_i2c_read(struct usb_usbvision *usbvision, unsigned char addr, char *buf,
449 retval = usbvision_i2c_read_max4(usbvision, addr, temp, count);
463 .name = "usbvision",