Lines Matching +full:1 +full:- +full:sd

1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * GSPCA by Jean-Francois Moine <http://moinejf.free.fr>
40 MODULE_PARM_DESC(AC50Hz, " Does AC power frequency is 50Hz? (0/1)");
52 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in sd_s_ctrl()
53 struct sd *sd = (struct sd *) gspca_dev; in sd_s_ctrl() local
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()
105 struct sd *sd = (struct sd *) gspca_dev; in sd_init_controls() local
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 =======================*/
234 .priv = 1
261 .priv = 1
288 .priv = 1
309 .priv = 1
313 /*========================= sud-driver functions ===========================*/
319 struct sd *sd = (struct sd *) gspca_dev; 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()
332 sd->sensor = ID_MI1320; in sd_config()
334 sd->sensor = ID_OV2640; in sd_config()
336 sd->sensor = ID_OV9655; 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()
378 ((struct sd *) gspca_dev)->vcur.AC50Hz = AC50Hz; in sd_config()
386 struct sd *sd = (struct sd *) gspca_dev; in sd_init() local
388 return sd->dev_init_at_startup(gspca_dev); in sd_init()
394 struct sd *sd = (struct sd *) gspca_dev; in sd_isoc_init() local
396 return sd->dev_configure_alt(gspca_dev); in sd_isoc_init()
402 struct sd *sd = (struct sd *) gspca_dev; in sd_start() local
404 return sd->dev_init_pre_alt(gspca_dev); in sd_start()
410 struct sd *sd = (struct sd *) gspca_dev; in sd_stop0() local
412 if (!sd->gspca_dev.present) in sd_stop0()
415 return sd->dev_post_unset_alt(gspca_dev); in sd_stop0()
422 struct sd *sd = (struct sd *) gspca_dev; in sd_pkt_scan() local
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()
446 data += nToSkip - nSkipped; in sd_pkt_scan()
447 len -= nToSkip - nSkipped; in sd_pkt_scan()
448 nSkipped = nToSkip + 1; in sd_pkt_scan()
461 struct sd *sd = (struct sd *) gspca_dev; in sd_callback() local
468 ctrl_in(gspca_dev, 0xc0, 2, 0x0000, 0x0000, 1, (void *)&state); 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()
512 &sd_desc_mi1320, sizeof(struct sd), THIS_MODULE); in sd_probe()
542 struct usb_device *udev = gspca_dev->dev; in gl860_RTx()
547 memcpy(gspca_dev->usb_buf, pdata, len); in gl860_RTx()
550 gspca_dev->usb_buf, in gl860_RTx()
551 len, 400 + 200 * (len > 1)); in gl860_RTx()
560 gspca_dev->usb_buf, in gl860_RTx()
561 len, 400 + 200 * (len > 1)); in gl860_RTx()
562 memcpy(pdata, gspca_dev->usb_buf, len); in gl860_RTx()
572 else if (len > 1 && r < len) in gl860_RTx()
575 msleep(1); in gl860_RTx()
586 ctrl_out(gspca_dev, 0x40, 1, tbl[n].val, in fetch_validx()
601 ctrl_out(gspca_dev, 0x40, 1, tbl[n].val, tbl[n].idx, in keep_on_fetching_validx()
627 struct sd *sd = (struct sd *) gspca_dev; in gl860_guess_sensor() local
631 sd->sensor = ID_MI1320; in gl860_guess_sensor()
633 if (sd->sensor == 0xff) { in gl860_guess_sensor()
634 ctrl_in(gspca_dev, 0xc0, 2, 0x0000, 0x0004, 1, &probe); in gl860_guess_sensor()
635 ctrl_in(gspca_dev, 0xc0, 2, 0x0000, 0x0004, 1, &probe); in gl860_guess_sensor()
637 ctrl_out(gspca_dev, 0x40, 1, 0x0000, 0x0000, 0, NULL); in gl860_guess_sensor()
639 ctrl_out(gspca_dev, 0x40, 1, 0x0010, 0x0010, 0, NULL); in gl860_guess_sensor()
641 ctrl_out(gspca_dev, 0x40, 1, 0x0008, 0x00c0, 0, NULL); in gl860_guess_sensor()
643 ctrl_out(gspca_dev, 0x40, 1, 0x0001, 0x00c1, 0, NULL); in gl860_guess_sensor()
645 ctrl_out(gspca_dev, 0x40, 1, 0x0001, 0x00c2, 0, NULL); in gl860_guess_sensor()
647 ctrl_out(gspca_dev, 0x40, 1, 0x0020, 0x0006, 0, NULL); in gl860_guess_sensor()
649 ctrl_out(gspca_dev, 0x40, 1, 0x006a, 0x000d, 0, NULL); in gl860_guess_sensor()
655 ctrl_out(gspca_dev, 0x40, 1, 0x0040, 0x0000, 0, NULL); in gl860_guess_sensor()
657 ctrl_out(gspca_dev, 0x40, 1, 0x0063, 0x0006, 0, NULL); in gl860_guess_sensor()
659 ctrl_out(gspca_dev, 0x40, 1, 0x7a00, 0x8030, 0, NULL); in gl860_guess_sensor()
661 ctrl_in(gspca_dev, 0xc0, 2, 0x7a00, 0x8030, 1, &probe); in gl860_guess_sensor()
668 gspca_dbg(gspca_dev, D_PROBE, "0xff -> OVXXXX\n"); in gl860_guess_sensor()
673 ctrl_out(gspca_dev, 0x40, 1, 0x0040, 0x0000, in gl860_guess_sensor()
676 ctrl_out(gspca_dev, 0x40, 1, 0x6000, 0x800a, in gl860_guess_sensor()
682 1, &probe); in gl860_guess_sensor()
686 "probe=0x%02x -> OV2640\n", in gl860_guess_sensor()
688 sd->sensor = ID_OV2640; in gl860_guess_sensor()
694 "probe=0x%02x -> OV9655\n", in gl860_guess_sensor()
696 sd->sensor = ID_OV9655; 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()
726 return -1; in gl860_guess_sensor()