Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 219159
b: refs/heads/master
c: 8403472
h: refs/heads/master
i:
  219157: 6a0d0a6
  219155: c60aba8
  219151: 618291d
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Oct 21, 2010
1 parent f77c324 commit eef2a3c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1f2052539666bd8b43ed26c9b1c3687628c49ecc
refs/heads/master: 8403472f19fea7e7cec7899e998f38b899e59604
9 changes: 9 additions & 0 deletions trunk/drivers/media/video/usbvision/usbvision-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ int usbvision_i2c_register(struct usb_usbvision *usbvision)
0x42 >> 1, 0x40 >> 1, /* SAA7114, SAA7115 and SAA7118 */
I2C_CLIENT_END };

if (usbvision->registered_i2c)
return 0;

memcpy(&usbvision->i2c_adap, &i2c_adap_template,
sizeof(struct i2c_adapter));

Expand Down Expand Up @@ -268,21 +271,27 @@ int usbvision_i2c_register(struct usb_usbvision *usbvision)
&usbvision->i2c_adap, "tuner",
"tuner", 0, v4l2_i2c_tuner_addrs(type));

if (sd == NULL)
return -ENODEV;
if (usbvision->tuner_type != -1) {
tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
tun_setup.type = usbvision->tuner_type;
tun_setup.addr = v4l2_i2c_subdev_addr(sd);
call_all(usbvision, tuner, s_type_addr, &tun_setup);
}
}
usbvision->registered_i2c = 1;

return 0;
}

int usbvision_i2c_unregister(struct usb_usbvision *usbvision)
{
if (!usbvision->registered_i2c)
return 0;

i2c_del_adapter(&(usbvision->i2c_adap));
usbvision->registered_i2c = 0;

PDEBUG(DBG_I2C,"i2c bus for %s unregistered", usbvision->i2c_adap.name);

Expand Down
8 changes: 3 additions & 5 deletions trunk/drivers/media/video/usbvision/usbvision-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ static int usbvision_v4l2_open(struct file *file)

PDEBUG(DBG_IO, "open");

lock_kernel();
mutex_lock(&usbvision->lock);
usbvision_reset_powerOffTimer(usbvision);

if (usbvision->user)
Expand All @@ -379,7 +379,6 @@ static int usbvision_v4l2_open(struct file *file)

/* If so far no errors then we shall start the camera */
if (!errCode) {
mutex_lock(&usbvision->lock);
if (usbvision->power == 0) {
usbvision_power_on(usbvision);
usbvision_i2c_register(usbvision);
Expand Down Expand Up @@ -408,14 +407,13 @@ static int usbvision_v4l2_open(struct file *file)
usbvision->initialized = 0;
}
}
mutex_unlock(&usbvision->lock);
}

/* prepare queues */
usbvision_empty_framequeues(usbvision);

PDEBUG(DBG_IO, "success");
unlock_kernel();
mutex_unlock(&usbvision->lock);
return errCode;
}

Expand Down Expand Up @@ -1645,8 +1643,8 @@ static int __devinit usbvision_probe(struct usb_interface *intf,
usbvision->usb_bandwidth = 0;
usbvision->user = 0;
usbvision->streaming = Stream_Off;
usbvision_register_video(usbvision);
usbvision_configure_video(usbvision);
usbvision_register_video(usbvision);
mutex_unlock(&usbvision->lock);

usbvision_create_sysfs(usbvision->vdev);
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/media/video/usbvision/usbvision.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ struct usb_usbvision {

/* i2c Declaration Section*/
struct i2c_adapter i2c_adap;
int registered_i2c;

struct urb *ctrlUrb;
unsigned char ctrlUrbBuffer[8];
Expand Down

0 comments on commit eef2a3c

Please sign in to comment.