Lines Matching +full:cam +full:- +full:if
1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * GSPCA by Jean-Francois Moine <http://moinejf.free.fr>
52 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in sd_s_ctrl()
55 switch (ctrl->id) { in sd_s_ctrl()
57 sd->vcur.brightness = ctrl->val; in sd_s_ctrl()
60 sd->vcur.contrast = ctrl->val; in sd_s_ctrl()
63 sd->vcur.saturation = ctrl->val; in sd_s_ctrl()
66 sd->vcur.hue = ctrl->val; in sd_s_ctrl()
69 sd->vcur.gamma = ctrl->val; in sd_s_ctrl()
72 sd->vcur.mirror = ctrl->val; in sd_s_ctrl()
75 sd->vcur.flip = ctrl->val; in sd_s_ctrl()
78 sd->vcur.AC50Hz = ctrl->val; in sd_s_ctrl()
81 sd->vcur.whitebal = ctrl->val; in sd_s_ctrl()
84 sd->vcur.sharpness = ctrl->val; in sd_s_ctrl()
87 sd->vcur.backlight = ctrl->val; in sd_s_ctrl()
90 return -EINVAL; in sd_s_ctrl()
93 if (gspca_dev->streaming) in sd_s_ctrl()
94 sd->waitSet = 1; in sd_s_ctrl()
106 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; in sd_init_controls()
108 gspca_dev->vdev.ctrl_handler = hdl; in sd_init_controls()
111 if (sd->vmax.brightness) in sd_init_controls()
113 0, sd->vmax.brightness, 1, in sd_init_controls()
114 sd->vcur.brightness); in sd_init_controls()
116 if (sd->vmax.contrast) in sd_init_controls()
118 0, sd->vmax.contrast, 1, in sd_init_controls()
119 sd->vcur.contrast); in sd_init_controls()
121 if (sd->vmax.saturation) in sd_init_controls()
123 0, sd->vmax.saturation, 1, in sd_init_controls()
124 sd->vcur.saturation); in sd_init_controls()
126 if (sd->vmax.hue) in sd_init_controls()
128 0, sd->vmax.hue, 1, sd->vcur.hue); in sd_init_controls()
130 if (sd->vmax.gamma) in sd_init_controls()
132 0, sd->vmax.gamma, 1, sd->vcur.gamma); in sd_init_controls()
134 if (sd->vmax.mirror) in sd_init_controls()
136 0, sd->vmax.mirror, 1, sd->vcur.mirror); in sd_init_controls()
138 if (sd->vmax.flip) in sd_init_controls()
140 0, sd->vmax.flip, 1, sd->vcur.flip); in sd_init_controls()
142 if (sd->vmax.AC50Hz) in sd_init_controls()
145 sd->vmax.AC50Hz, 0, sd->vcur.AC50Hz); in sd_init_controls()
147 if (sd->vmax.whitebal) in sd_init_controls()
150 0, sd->vmax.whitebal, 1, sd->vcur.whitebal); in sd_init_controls()
152 if (sd->vmax.sharpness) in sd_init_controls()
154 0, sd->vmax.sharpness, 1, in sd_init_controls()
155 sd->vcur.sharpness); in sd_init_controls()
157 if (sd->vmax.backlight) in sd_init_controls()
160 0, sd->vmax.backlight, 1, in sd_init_controls()
161 sd->vcur.backlight); in sd_init_controls()
163 if (hdl->error) { in sd_init_controls()
165 return hdl->error; in sd_init_controls()
171 /*==================== sud-driver structure initialisation =================*/
221 /*=========================== sub-driver image sizes =======================*/
313 /*========================= sud-driver functions ===========================*/
320 struct cam *cam; in sd_config() local
324 vendor_id = id->idVendor; in sd_config()
325 product_id = id->idProduct; in sd_config()
327 sd->nbRightUp = 1; in sd_config()
328 sd->nbIm = -1; in sd_config()
330 sd->sensor = 0xff; in sd_config()
331 if (strcmp(sensor, "MI1320") == 0) in sd_config()
332 sd->sensor = ID_MI1320; in sd_config()
333 else if (strcmp(sensor, "OV2640") == 0) in sd_config()
334 sd->sensor = ID_OV2640; in sd_config()
335 else if (strcmp(sensor, "OV9655") == 0) in sd_config()
336 sd->sensor = ID_OV9655; in sd_config()
337 else if (strcmp(sensor, "MI2020") == 0) in sd_config()
338 sd->sensor = ID_MI2020; in sd_config()
341 if (gl860_guess_sensor(gspca_dev, vendor_id, product_id) == -1) in sd_config()
342 return -1; in sd_config()
344 cam = &gspca_dev->cam; in sd_config()
346 switch (sd->sensor) { in sd_config()
348 gspca_dev->sd_desc = &sd_desc_mi1320; in sd_config()
349 cam->cam_mode = mi1320_mode; in sd_config()
350 cam->nmodes = ARRAY_SIZE(mi1320_mode); in sd_config()
355 gspca_dev->sd_desc = &sd_desc_mi2020; in sd_config()
356 cam->cam_mode = mi2020_mode; in sd_config()
357 cam->nmodes = ARRAY_SIZE(mi2020_mode); in sd_config()
362 gspca_dev->sd_desc = &sd_desc_ov2640; in sd_config()
363 cam->cam_mode = ov2640_mode; in sd_config()
364 cam->nmodes = ARRAY_SIZE(ov2640_mode); in sd_config()
369 gspca_dev->sd_desc = &sd_desc_ov9655; in sd_config()
370 cam->cam_mode = ov9655_mode; in sd_config()
371 cam->nmodes = ARRAY_SIZE(ov9655_mode); in sd_config()
377 if (AC50Hz != 0xff) in sd_config()
378 ((struct sd *) gspca_dev)->vcur.AC50Hz = AC50Hz; in sd_config()
388 return sd->dev_init_at_startup(gspca_dev); in sd_init()
396 return sd->dev_configure_alt(gspca_dev); in sd_isoc_init()
404 return sd->dev_init_pre_alt(gspca_dev); in sd_start()
412 if (!sd->gspca_dev.present) in sd_stop0()
415 return sd->dev_post_unset_alt(gspca_dev); in sd_stop0()
425 s32 mode = (s32) gspca_dev->curr_mode; in sd_pkt_scan()
427 sd->swapRB * (gspca_dev->cam.cam_mode[mode].bytesperline + 1); in sd_pkt_scan()
434 if (sd->nbIm >= 0 && sd->nbIm < 10) in sd_pkt_scan()
435 sd->nbIm++; in sd_pkt_scan()
441 len -= 2; in sd_pkt_scan()
442 if (nSkipped + len <= nToSkip) in sd_pkt_scan()
445 if (nSkipped < nToSkip && nSkipped + len > nToSkip) { in sd_pkt_scan()
446 data += nToSkip - nSkipped; in sd_pkt_scan()
447 len -= nToSkip - nSkipped; in sd_pkt_scan()
463 if (!_OV9655_) { in sd_callback()
470 /* C8/40 means upside-down (looking backwards) */ in sd_callback()
471 /* D8/50 means right-up (looking onwards) */ in sd_callback()
474 if (upsideDown && sd->nbRightUp > -4) { in sd_callback()
475 if (sd->nbRightUp > 0) in sd_callback()
476 sd->nbRightUp = 0; in sd_callback()
477 if (sd->nbRightUp == -3) { in sd_callback()
478 sd->mirrorMask = 1; in sd_callback()
479 sd->waitSet = 1; in sd_callback()
481 sd->nbRightUp--; in sd_callback()
483 if (!upsideDown && sd->nbRightUp < 4) { in sd_callback()
484 if (sd->nbRightUp < 0) in sd_callback()
485 sd->nbRightUp = 0; in sd_callback()
486 if (sd->nbRightUp == 3) { in sd_callback()
487 sd->mirrorMask = 0; in sd_callback()
488 sd->waitSet = 1; in sd_callback()
490 sd->nbRightUp++; in sd_callback()
494 if (sd->waitSet) in sd_callback()
495 sd->dev_camera_settings(gspca_dev); in sd_callback()
542 struct usb_device *udev = gspca_dev->dev; in gl860_RTx()
545 if (pref == 0x40) { /* Send */ in gl860_RTx()
546 if (len > 0) { in gl860_RTx()
547 memcpy(gspca_dev->usb_buf, pdata, len); in gl860_RTx()
550 gspca_dev->usb_buf, in gl860_RTx()
557 if (len > 0) { in gl860_RTx()
560 gspca_dev->usb_buf, in gl860_RTx()
562 memcpy(pdata, gspca_dev->usb_buf, len); in gl860_RTx()
564 gspca_err(gspca_dev, "zero-length read request\n"); in gl860_RTx()
565 r = -EINVAL; in gl860_RTx()
569 if (r < 0) in gl860_RTx()
572 else if (len > 1 && r < len) in gl860_RTx()
585 if (tbl[n].idx != 0xffff) in fetch_validx()
588 else if (tbl[n].val == 0xffff) in fetch_validx()
600 if (tbl[n].idx != 0xffff) in keep_on_fetching_validx()
603 else if (tbl[n].val == 0xffff) in keep_on_fetching_validx()
616 if (memcmp(tbl[n].data, "\xff\xff\xff", 3) != 0) in fetch_idxdata()
630 if (product_id == 0xf191) in gl860_guess_sensor()
631 sd->sensor = ID_MI1320; in gl860_guess_sensor()
633 if (sd->sensor == 0xff) { in gl860_guess_sensor()
663 if (probe == 0xff) in gl860_guess_sensor()
667 if (nOV) { in gl860_guess_sensor()
668 gspca_dbg(gspca_dev, D_PROBE, "0xff -> OVXXXX\n"); in gl860_guess_sensor()
684 if (probe == 0x26 || probe == 0x40) { in gl860_guess_sensor()
686 "probe=0x%02x -> OV2640\n", in gl860_guess_sensor()
688 sd->sensor = ID_OV2640; in gl860_guess_sensor()
692 if (probe == 0x96 || probe == 0x55) { in gl860_guess_sensor()
694 "probe=0x%02x -> OV9655\n", in gl860_guess_sensor()
696 sd->sensor = ID_OV9655; in gl860_guess_sensor()
702 if (probe == 0x00) in gl860_guess_sensor()
704 if (probe == 0xff) in gl860_guess_sensor()
708 if (nb26 < 4 && nb96 < 4) in gl860_guess_sensor()
709 return -1; in gl860_guess_sensor()
711 gspca_dbg(gspca_dev, D_PROBE, "Not any 0xff -> MI2020\n"); in gl860_guess_sensor()
712 sd->sensor = ID_MI2020; in gl860_guess_sensor()
716 if (_MI1320_) { in gl860_guess_sensor()
718 } else if (_MI2020_) { in gl860_guess_sensor()
720 } else if (_OV9655_) { in gl860_guess_sensor()
722 } else if (_OV2640_) { in gl860_guess_sensor()
726 return -1; in gl860_guess_sensor()