diff options
Diffstat (limited to 'drivers/media/video/gspca/stv0680.c')
-rw-r--r-- | drivers/media/video/gspca/stv0680.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/media/video/gspca/stv0680.c b/drivers/media/video/gspca/stv0680.c index 2a69d7ccb50d..e50dd7693f74 100644 --- a/drivers/media/video/gspca/stv0680.c +++ b/drivers/media/video/gspca/stv0680.c | |||
@@ -45,7 +45,7 @@ struct sd { | |||
45 | }; | 45 | }; |
46 | 46 | ||
47 | /* V4L2 controls supported by the driver */ | 47 | /* V4L2 controls supported by the driver */ |
48 | static struct ctrl sd_ctrls[] = { | 48 | static const struct ctrl sd_ctrls[] = { |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static int stv_sndctrl(struct gspca_dev *gspca_dev, int set, u8 req, u16 val, | 51 | static int stv_sndctrl(struct gspca_dev *gspca_dev, int set, u8 req, u16 val, |
@@ -53,24 +53,28 @@ static int stv_sndctrl(struct gspca_dev *gspca_dev, int set, u8 req, u16 val, | |||
53 | { | 53 | { |
54 | int ret = -1; | 54 | int ret = -1; |
55 | u8 req_type = 0; | 55 | u8 req_type = 0; |
56 | unsigned int pipe = 0; | ||
56 | 57 | ||
57 | switch (set) { | 58 | switch (set) { |
58 | case 0: /* 0xc1 */ | 59 | case 0: /* 0xc1 */ |
59 | req_type = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT; | 60 | req_type = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT; |
61 | pipe = usb_rcvctrlpipe(gspca_dev->dev, 0); | ||
60 | break; | 62 | break; |
61 | case 1: /* 0x41 */ | 63 | case 1: /* 0x41 */ |
62 | req_type = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT; | 64 | req_type = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT; |
65 | pipe = usb_sndctrlpipe(gspca_dev->dev, 0); | ||
63 | break; | 66 | break; |
64 | case 2: /* 0x80 */ | 67 | case 2: /* 0x80 */ |
65 | req_type = USB_DIR_IN | USB_RECIP_DEVICE; | 68 | req_type = USB_DIR_IN | USB_RECIP_DEVICE; |
69 | pipe = usb_rcvctrlpipe(gspca_dev->dev, 0); | ||
66 | break; | 70 | break; |
67 | case 3: /* 0x40 */ | 71 | case 3: /* 0x40 */ |
68 | req_type = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE; | 72 | req_type = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE; |
73 | pipe = usb_sndctrlpipe(gspca_dev->dev, 0); | ||
69 | break; | 74 | break; |
70 | } | 75 | } |
71 | 76 | ||
72 | ret = usb_control_msg(gspca_dev->dev, | 77 | ret = usb_control_msg(gspca_dev->dev, pipe, |
73 | usb_rcvctrlpipe(gspca_dev->dev, 0), | ||
74 | req, req_type, | 78 | req, req_type, |
75 | val, 0, gspca_dev->usb_buf, size, 500); | 79 | val, 0, gspca_dev->usb_buf, size, 500); |
76 | 80 | ||
@@ -138,6 +142,10 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
138 | struct sd *sd = (struct sd *) gspca_dev; | 142 | struct sd *sd = (struct sd *) gspca_dev; |
139 | struct cam *cam = &gspca_dev->cam; | 143 | struct cam *cam = &gspca_dev->cam; |
140 | 144 | ||
145 | /* Give the camera some time to settle, otherwise initalization will | ||
146 | fail on hotplug, and yes it really needs a full second. */ | ||
147 | msleep(1000); | ||
148 | |||
141 | /* ping camera to be sure STV0680 is present */ | 149 | /* ping camera to be sure STV0680 is present */ |
142 | if (stv_sndctrl(gspca_dev, 0, 0x88, 0x5678, 0x02) != 0x02 || | 150 | if (stv_sndctrl(gspca_dev, 0, 0x88, 0x5678, 0x02) != 0x02 || |
143 | gspca_dev->usb_buf[0] != 0x56 || gspca_dev->usb_buf[1] != 0x78) { | 151 | gspca_dev->usb_buf[0] != 0x56 || gspca_dev->usb_buf[1] != 0x78) { |
@@ -169,6 +177,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
169 | PDEBUG(D_PROBE, "Camera supports CIF mode"); | 177 | PDEBUG(D_PROBE, "Camera supports CIF mode"); |
170 | if (gspca_dev->usb_buf[7] & 0x02) | 178 | if (gspca_dev->usb_buf[7] & 0x02) |
171 | PDEBUG(D_PROBE, "Camera supports VGA mode"); | 179 | PDEBUG(D_PROBE, "Camera supports VGA mode"); |
180 | if (gspca_dev->usb_buf[7] & 0x04) | ||
181 | PDEBUG(D_PROBE, "Camera supports QCIF mode"); | ||
172 | if (gspca_dev->usb_buf[7] & 0x08) | 182 | if (gspca_dev->usb_buf[7] & 0x08) |
173 | PDEBUG(D_PROBE, "Camera supports QVGA mode"); | 183 | PDEBUG(D_PROBE, "Camera supports QVGA mode"); |
174 | 184 | ||