Lines Matching +full:camera +full:- +full:command +full:- +full:set
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Supports some Jeilin dual-mode cameras which use bulk transport and
23 MODULE_DESCRIPTION("GSPCA/JEILINJ USB Camera Driver");
86 static void jlj_write2(struct gspca_dev *gspca_dev, unsigned char *command) in jlj_write2() argument
90 if (gspca_dev->usb_err < 0) in jlj_write2()
92 memcpy(gspca_dev->usb_buf, command, 2); in jlj_write2()
93 retval = usb_bulk_msg(gspca_dev->dev, in jlj_write2()
94 usb_sndbulkpipe(gspca_dev->dev, 3), in jlj_write2()
95 gspca_dev->usb_buf, 2, NULL, 500); in jlj_write2()
97 pr_err("command write [%02x] error %d\n", in jlj_write2()
98 gspca_dev->usb_buf[0], retval); in jlj_write2()
99 gspca_dev->usb_err = retval; in jlj_write2()
108 if (gspca_dev->usb_err < 0) in jlj_read1()
110 retval = usb_bulk_msg(gspca_dev->dev, in jlj_read1()
111 usb_rcvbulkpipe(gspca_dev->dev, 0x84), in jlj_read1()
112 gspca_dev->usb_buf, 1, NULL, 500); in jlj_read1()
113 *response = gspca_dev->usb_buf[0]; in jlj_read1()
115 pr_err("read command [%02x] error %d\n", in jlj_read1()
116 gspca_dev->usb_buf[0], retval); in jlj_read1()
117 gspca_dev->usb_err = retval; in jlj_read1()
142 /* adapt camera quality from jpeg quality */ in setcamquality()
143 camquality = ((QUALITY_MAX - val) * CAMQUALITY_MAX) in setcamquality()
144 / (QUALITY_MAX - QUALITY_MIN); in setcamquality()
213 {{0x71, 0x81 - gspca_dev->curr_mode}, 0, 0}, in jlj_start()
236 sd->blocks_left = 0; in jlj_start()
240 if (sd->type == SPORTSCAM_DV15) in jlj_start()
252 setcamquality(gspca_dev, v4l2_ctrl_g_ctrl(sd->jpegqual)); in jlj_start()
254 setfreq(gspca_dev, v4l2_ctrl_g_ctrl(sd->freq)); in jlj_start()
255 if (gspca_dev->usb_err < 0) in jlj_start()
256 gspca_err(gspca_dev, "Start streaming command failed\n"); in jlj_start()
257 return gspca_dev->usb_err; in jlj_start()
276 sd->blocks_left = data[0x0a] - 1; in sd_pkt_scan()
278 sd->blocks_left); in sd_pkt_scan()
281 sd->jpeg_hdr, JPEG_HDR_SZ); in sd_pkt_scan()
285 JEILINJ_MAX_TRANSFER - FRAME_HEADER_LEN); in sd_pkt_scan()
286 } else if (sd->blocks_left > 0) { in sd_pkt_scan()
288 sd->blocks_left); in sd_pkt_scan()
289 sd->blocks_left -= 1; in sd_pkt_scan()
290 if (sd->blocks_left == 0) in sd_pkt_scan()
301 gspca_dev->last_packet_type = DISCARD_PACKET; in sd_pkt_scan()
308 struct cam *cam = &gspca_dev->cam; in sd_config()
311 dev->type = id->driver_info; in sd_config()
312 dev->quality = QUALITY_DEF; in sd_config()
314 cam->cam_mode = jlj_mode; in sd_config()
315 cam->nmodes = ARRAY_SIZE(jlj_mode); in sd_config()
316 cam->bulk = 1; in sd_config()
317 cam->bulk_nurbs = 1; in sd_config()
318 cam->bulk_size = JEILINJ_MAX_TRANSFER; in sd_config()
335 usb_bulk_msg(gspca_dev->dev, in sd_stopN()
336 gspca_dev->urb[0]->pipe, in sd_stopN()
337 gspca_dev->urb[0]->transfer_buffer, in sd_stopN()
343 buf = gspca_dev->urb[0]->transfer_buffer; in sd_stopN()
344 while ((i < (JEILINJ_MAX_TRANSFER - 1)) && in sd_stopN()
348 if (i != (JEILINJ_MAX_TRANSFER - 1)) in sd_stopN()
360 return gspca_dev->usb_err; in sd_init()
363 /* Set up for getting frames. */
369 jpeg_define(dev->jpeg_hdr, gspca_dev->pixfmt.height, in sd_start()
370 gspca_dev->pixfmt.width, in sd_start()
372 jpeg_set_qual(dev->jpeg_hdr, dev->quality); in sd_start()
374 gspca_dev->pixfmt.height, gspca_dev->pixfmt.width); in sd_start()
376 return gspca_dev->usb_err; in sd_start()
391 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in sd_s_ctrl()
394 gspca_dev->usb_err = 0; in sd_s_ctrl()
396 if (!gspca_dev->streaming) in sd_s_ctrl()
399 switch (ctrl->id) { in sd_s_ctrl()
401 setfreq(gspca_dev, ctrl->val); in sd_s_ctrl()
404 setred(gspca_dev, ctrl->val); in sd_s_ctrl()
407 setgreen(gspca_dev, ctrl->val); in sd_s_ctrl()
410 setblue(gspca_dev, ctrl->val); in sd_s_ctrl()
413 setautogain(gspca_dev, ctrl->val); in sd_s_ctrl()
416 jpeg_set_qual(sd->jpeg_hdr, ctrl->val); in sd_s_ctrl()
417 setcamquality(gspca_dev, ctrl->val); in sd_s_ctrl()
420 return gspca_dev->usb_err; in sd_s_ctrl()
430 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; in sd_init_controls()
441 gspca_dev->vdev.ctrl_handler = hdl; in sd_init_controls()
443 sd->freq = v4l2_ctrl_new_std_menu(hdl, &sd_ctrl_ops, in sd_init_controls()
454 sd->jpegqual = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
458 if (hdl->error) { in sd_init_controls()
460 return hdl->error; in sd_init_controls()
470 v4l2_ctrl_s_ctrl(sd->jpegqual, jcomp->quality); in sd_set_jcomp()
480 jcomp->quality = v4l2_ctrl_g_ctrl(sd->jpegqual); in sd_get_jcomp()
481 jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT in sd_get_jcomp()
487 /* sub-driver description */
497 /* sub-driver description */
515 /* -- device connect -- */
520 sd_desc[id->driver_info], in sd_probe()