Lines Matching +full:cam +full:- +full:if
1 // SPDX-License-Identifier: GPL-2.0-or-later
45 pipe = usb_rcvctrlpipe(gspca_dev->dev, 0); in stv_sndctrl()
49 pipe = usb_sndctrlpipe(gspca_dev->dev, 0); in stv_sndctrl()
53 pipe = usb_rcvctrlpipe(gspca_dev->dev, 0); in stv_sndctrl()
57 pipe = usb_sndctrlpipe(gspca_dev->dev, 0); in stv_sndctrl()
61 ret = usb_control_msg(gspca_dev->dev, pipe, in stv_sndctrl()
63 val, 0, gspca_dev->usb_buf, size, 500); in stv_sndctrl()
65 if ((ret < 0) && (req != 0x0a)) in stv_sndctrl()
76 gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]); in stv0680_handle_error()
82 /* Note not sure if this init of usb_buf is really necessary */ in stv0680_get_video_mode()
83 memset(gspca_dev->usb_buf, 0, 8); in stv0680_get_video_mode()
84 gspca_dev->usb_buf[0] = 0x0f; in stv0680_get_video_mode()
86 if (stv_sndctrl(gspca_dev, 0, 0x87, 0, 0x08) != 0x08) { in stv0680_get_video_mode()
88 return stv0680_handle_error(gspca_dev, -EIO); in stv0680_get_video_mode()
91 return gspca_dev->usb_buf[0]; /* 01 = VGA, 03 = QVGA, 00 = CIF */ in stv0680_get_video_mode()
98 if (sd->current_mode == mode) in stv0680_set_video_mode()
101 memset(gspca_dev->usb_buf, 0, 8); in stv0680_set_video_mode()
102 gspca_dev->usb_buf[0] = mode; in stv0680_set_video_mode()
104 if (stv_sndctrl(gspca_dev, 3, 0x07, 0x0100, 0x08) != 0x08) { in stv0680_set_video_mode()
106 return stv0680_handle_error(gspca_dev, -EIO); in stv0680_set_video_mode()
110 if (stv0680_get_video_mode(gspca_dev) != mode) { in stv0680_set_video_mode()
112 return -EIO; in stv0680_set_video_mode()
115 sd->current_mode = mode; in stv0680_set_video_mode()
126 struct cam *cam = &gspca_dev->cam; in sd_config() local
133 if (stv_sndctrl(gspca_dev, 0, 0x88, 0x5678, 0x02) != 0x02 || in sd_config()
134 gspca_dev->usb_buf[0] != 0x56 || gspca_dev->usb_buf[1] != 0x78) { in sd_config()
136 return stv0680_handle_error(gspca_dev, -ENODEV); in sd_config()
140 if (stv_sndctrl(gspca_dev, 2, 0x06, 0x0200, 0x09) != 0x09) in sd_config()
141 return stv0680_handle_error(gspca_dev, -ENODEV); in sd_config()
143 if (stv_sndctrl(gspca_dev, 2, 0x06, 0x0200, 0x22) != 0x22 || in sd_config()
144 gspca_dev->usb_buf[7] != 0xa0 || gspca_dev->usb_buf[8] != 0x23) { in sd_config()
146 return stv0680_handle_error(gspca_dev, -ENODEV); in sd_config()
148 if (stv_sndctrl(gspca_dev, 0, 0x8a, 0, 0x02) != 0x02) in sd_config()
149 return stv0680_handle_error(gspca_dev, -ENODEV); in sd_config()
150 if (stv_sndctrl(gspca_dev, 0, 0x8b, 0, 0x24) != 0x24) in sd_config()
151 return stv0680_handle_error(gspca_dev, -ENODEV); in sd_config()
152 if (stv_sndctrl(gspca_dev, 0, 0x85, 0, 0x10) != 0x10) in sd_config()
153 return stv0680_handle_error(gspca_dev, -ENODEV); in sd_config()
155 if (!(gspca_dev->usb_buf[7] & 0x09)) { in sd_config()
157 return -ENODEV; in sd_config()
159 if (gspca_dev->usb_buf[7] & 0x01) in sd_config()
161 if (gspca_dev->usb_buf[7] & 0x02) in sd_config()
163 if (gspca_dev->usb_buf[7] & 0x04) in sd_config()
165 if (gspca_dev->usb_buf[7] & 0x08) in sd_config()
168 if (gspca_dev->usb_buf[7] & 0x01) in sd_config()
169 sd->video_mode = 0x00; /* CIF */ in sd_config()
171 sd->video_mode = 0x03; /* QVGA */ in sd_config()
175 gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]); in sd_config()
177 gspca_dev->usb_buf[2], gspca_dev->usb_buf[3]); in sd_config()
179 (gspca_dev->usb_buf[4]*16) + (gspca_dev->usb_buf[5]>>4)); in sd_config()
183 if (ret < 0) in sd_config()
185 sd->current_mode = sd->orig_mode = ret; in sd_config()
187 ret = stv0680_set_video_mode(gspca_dev, sd->video_mode); in sd_config()
188 if (ret < 0) in sd_config()
192 if (stv_sndctrl(gspca_dev, 0, 0x8f, 0, 0x10) != 0x10) in sd_config()
193 return stv0680_handle_error(gspca_dev, -EIO); in sd_config()
195 cam->bulk = 1; in sd_config()
196 cam->bulk_nurbs = 1; /* The cam cannot handle more */ in sd_config()
197 cam->bulk_size = (gspca_dev->usb_buf[0] << 24) | in sd_config()
198 (gspca_dev->usb_buf[1] << 16) | in sd_config()
199 (gspca_dev->usb_buf[2] << 8) | in sd_config()
200 (gspca_dev->usb_buf[3]); in sd_config()
201 sd->mode.width = (gspca_dev->usb_buf[4] << 8) | in sd_config()
202 (gspca_dev->usb_buf[5]); /* 322, 356, 644 */ in sd_config()
203 sd->mode.height = (gspca_dev->usb_buf[6] << 8) | in sd_config()
204 (gspca_dev->usb_buf[7]); /* 242, 292, 484 */ in sd_config()
205 sd->mode.pixelformat = V4L2_PIX_FMT_STV0680; in sd_config()
206 sd->mode.field = V4L2_FIELD_NONE; in sd_config()
207 sd->mode.bytesperline = sd->mode.width; in sd_config()
208 sd->mode.sizeimage = cam->bulk_size; in sd_config()
209 sd->mode.colorspace = V4L2_COLORSPACE_SRGB; in sd_config()
211 /* origGain = gspca_dev->usb_buf[12]; */ in sd_config()
213 cam->cam_mode = &sd->mode; in sd_config()
214 cam->nmodes = 1; in sd_config()
217 ret = stv0680_set_video_mode(gspca_dev, sd->orig_mode); in sd_config()
218 if (ret < 0) in sd_config()
221 if (stv_sndctrl(gspca_dev, 2, 0x06, 0x0100, 0x12) != 0x12 || in sd_config()
222 gspca_dev->usb_buf[8] != 0x53 || gspca_dev->usb_buf[9] != 0x05) { in sd_config()
224 return stv0680_handle_error(gspca_dev, -EIO); in sd_config()
236 /* -- start the camera -- */
242 ret = stv0680_set_video_mode(gspca_dev, sd->video_mode); in sd_start()
243 if (ret < 0) in sd_start()
246 if (stv_sndctrl(gspca_dev, 0, 0x85, 0, 0x10) != 0x10) in sd_start()
247 return stv0680_handle_error(gspca_dev, -EIO); in sd_start()
253 if (stv_sndctrl(gspca_dev, 1, 0x09, sd->video_mode << 8, 0x0) != 0x0) in sd_start()
254 return stv0680_handle_error(gspca_dev, -EIO); in sd_start()
262 if (stv_sndctrl(gspca_dev, 1, 0x04, 0x0000, 0x0) != 0x0) in sd_stopN()
263 stv0680_handle_error(gspca_dev, -EIO); in sd_stopN()
270 if (!sd->gspca_dev.present) in sd_stop0()
273 stv0680_set_video_mode(gspca_dev, sd->orig_mode); in sd_stop0()
286 if (len != sd->mode.sizeimage) { in sd_pkt_scan()
287 gspca_dev->last_packet_type = DISCARD_PACKET; in sd_pkt_scan()
300 /* sub-driver description */
311 /* -- module initialisation -- */
319 /* -- device connect -- */