Lines Matching +full:cam +full:- +full:if
1 // SPDX-License-Identifier: GPL-2.0-or-later
37 int vga; /* 1 if vga cam, 0 if cif cam */
69 * cam uses endpoint 0x03 to send commands, 0x84 for read commands,
78 memcpy(gspca_dev->usb_buf, command, 2); in jl2005c_write2()
79 retval = usb_bulk_msg(gspca_dev->dev, in jl2005c_write2()
80 usb_sndbulkpipe(gspca_dev->dev, 3), in jl2005c_write2()
81 gspca_dev->usb_buf, 2, NULL, 500); in jl2005c_write2()
82 if (retval < 0) in jl2005c_write2()
84 gspca_dev->usb_buf[0], retval); in jl2005c_write2()
88 /* Response to a command is one byte in usb_buf[0], only if requested. */
93 retval = usb_bulk_msg(gspca_dev->dev, in jl2005c_read1()
94 usb_rcvbulkpipe(gspca_dev->dev, 0x84), in jl2005c_read1()
95 gspca_dev->usb_buf, 1, NULL, 500); in jl2005c_read1()
96 if (retval < 0) in jl2005c_read1()
98 gspca_dev->usb_buf[0], retval); in jl2005c_read1()
102 /* Response appears in gspca_dev->usb_buf[0] */
112 if (retval < 0) in jl2005c_read_reg()
128 if (retval < 0) in jl2005c_start_new_frame()
133 /* If we tried 20 times, give up. */ in jl2005c_start_new_frame()
135 if (retval < 0) in jl2005c_start_new_frame()
137 frame_brightness = gspca_dev->usb_buf[0]; in jl2005c_start_new_frame()
139 if (retval < 0) in jl2005c_start_new_frame()
144 gspca_dev->usb_buf[0]); in jl2005c_start_new_frame()
158 if (retval < 0) in jl2005c_write_reg()
177 gspca_dev->usb_buf[0]); in jl2005c_get_firmware_id()
178 if (retval < 0) in jl2005c_get_firmware_id()
183 if (retval < 0) in jl2005c_get_firmware_id()
185 sd->firmware_id[i] = gspca_dev->usb_buf[0]; in jl2005c_get_firmware_id()
188 sd->firmware_id[0], in jl2005c_get_firmware_id()
189 sd->firmware_id[1], in jl2005c_get_firmware_id()
190 sd->firmware_id[2], in jl2005c_get_firmware_id()
191 sd->firmware_id[3], in jl2005c_get_firmware_id()
192 sd->firmware_id[4], in jl2005c_get_firmware_id()
193 sd->firmware_id[5]); in jl2005c_get_firmware_id()
201 int retval = -1; in jl2005c_stream_start_vga_lg()
214 if (retval < 0) in jl2005c_stream_start_vga_lg()
224 int retval = -1; in jl2005c_stream_start_vga_small()
237 if (retval < 0) in jl2005c_stream_start_vga_small()
247 int retval = -1; in jl2005c_stream_start_cif_lg()
260 if (retval < 0) in jl2005c_stream_start_cif_lg()
270 int retval = -1; in jl2005c_stream_start_cif_small()
283 if (retval < 0) in jl2005c_stream_start_cif_small()
300 * threads attempting to use gspca_dev->usb_buf we take the usb_lock when
307 struct gspca_dev *gspca_dev = &dev->gspca_dev; in jl2005c_dostream()
318 if (!buffer) { in jl2005c_dostream()
323 while (gspca_dev->present && gspca_dev->streaming) { in jl2005c_dostream()
325 if (gspca_dev->frozen) in jl2005c_dostream()
328 /* Check if this is a new frame. If so, start the frame first */ in jl2005c_dostream()
329 if (!header_read) { in jl2005c_dostream()
330 mutex_lock(&gspca_dev->usb_lock); in jl2005c_dostream()
332 mutex_unlock(&gspca_dev->usb_lock); in jl2005c_dostream()
333 if (ret < 0) in jl2005c_dostream()
335 ret = usb_bulk_msg(gspca_dev->dev, in jl2005c_dostream()
336 usb_rcvbulkpipe(gspca_dev->dev, 0x82), in jl2005c_dostream()
342 if (ret < 0 || act_len < JL2005C_MAX_TRANSFER) in jl2005c_dostream()
345 if (memcmp(header_sig, buffer, 2) != 0) { in jl2005c_dostream()
351 bytes_left = buffer[0x07] * dev->block_size - act_len; in jl2005c_dostream()
360 while (bytes_left > 0 && gspca_dev->present) { in jl2005c_dostream()
363 ret = usb_bulk_msg(gspca_dev->dev, in jl2005c_dostream()
364 usb_rcvbulkpipe(gspca_dev->dev, 0x82), in jl2005c_dostream()
367 if (ret < 0 || act_len < data_len) in jl2005c_dostream()
372 bytes_left -= data_len; in jl2005c_dostream()
373 if (bytes_left == 0) { in jl2005c_dostream()
383 if (gspca_dev->present) { in jl2005c_dostream()
384 mutex_lock(&gspca_dev->usb_lock); in jl2005c_dostream()
386 mutex_unlock(&gspca_dev->usb_lock); in jl2005c_dostream()
398 struct cam *cam; in sd_config() local
401 cam = &gspca_dev->cam; in sd_config()
403 cam->bulk_size = 64; in sd_config()
404 cam->bulk = 1; in sd_config()
410 * {0x45, 0x02, 0x08, 0xb9, 0x00, 0xd2} No-name JL2005B in sd_config()
412 * {0x01, 0x0c, 0x16, 0x10, 0xf8, 0xc8} Argus DC-1512 in sd_config()
419 if ((sd->firmware_id[0] & 0xf0) == 0x40) { in sd_config()
420 cam->cam_mode = cif_mode; in sd_config()
421 cam->nmodes = ARRAY_SIZE(cif_mode); in sd_config()
422 sd->block_size = 0x80; in sd_config()
424 cam->cam_mode = vga_mode; in sd_config()
425 cam->nmodes = ARRAY_SIZE(vga_mode); in sd_config()
426 sd->block_size = 0x200; in sd_config()
429 INIT_WORK(&sd->work_struct, jl2005c_dostream); in sd_config()
444 sd->cap_mode = gspca_dev->cam.cam_mode; in sd_start()
446 switch (gspca_dev->pixfmt.width) { in sd_start()
465 return -1; in sd_start()
468 schedule_work(&sd->work_struct); in sd_start()
474 /* the usb_lock is held at entry - restore on exit */
480 mutex_unlock(&gspca_dev->usb_lock); in sd_stop0()
482 flush_work(&dev->work_struct); in sd_stop0()
483 mutex_lock(&gspca_dev->usb_lock); in sd_stop0()
488 /* sub-driver description */
497 /* -- module initialisation -- */
504 /* -- device connect -- */