Lines Matching +full:lower +full:- +full:dark +full:- +full:gain

1 // SPDX-License-Identifier: GPL-2.0-or-later
7 * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
34 __u8 expo12a; /* expo/gain? for rev 12a */
151 {0x0000, 0x8603}, /* Non-automatic optical black level */
161 /* from ms-win */
166 /* from ms-win */
167 {0x0035, 0x8651}, /* R gain for white balance */
168 {0x0040, 0x8652}, /* Gr gain for white balance */
169 {0x005f, 0x8653}, /* B gain for white balance */
170 {0x0040, 0x8654}, /* Gb gain for white balance */
223 {0x00, 0x8102}, /* white balance - new */
244 {0x07, 0x8601}, /* white balance - new */
245 {0x07, 0x8602}, /* white balance - new */
250 {0x43, 0x8614}, /* green *red - white balance - was 0x35 */
251 {0x40, 0x8615}, /* 40 *green - white balance - was 0x35 */
252 {0x71, 0x8616}, /* 7a *blue - white balance - was 0x35 */
253 {0x40, 0x8617}, /* 40 *green - white balance - was 0x35 */
268 /* {0x99, 0x8700}, * - white balance - new (removed) */
278 struct usb_device *dev = gspca_dev->dev; in reg_w_val()
302 /* read 'len' bytes to gspca_dev->usb_buf */
306 usb_control_msg(gspca_dev->dev, in reg_r()
307 usb_rcvctrlpipe(gspca_dev->dev, 0), in reg_r()
311 index, gspca_dev->usb_buf, length, 500); in reg_r()
314 /* write 'len' bytes from gspca_dev->usb_buf */
318 usb_control_msg(gspca_dev->dev, in reg_w_buf()
319 usb_sndctrlpipe(gspca_dev->dev, 0), in reg_w_buf()
323 index, gspca_dev->usb_buf, len, 500); in reg_w_buf()
335 if (!gspca_dev->usb_buf[0]) in i2c_write()
338 } while (--retry); in i2c_write()
351 if (!gspca_dev->usb_buf[0]) { in i2c_read()
353 value = gspca_dev->usb_buf[0]; in i2c_read()
355 return ((int) value << 8) | gspca_dev->usb_buf[0]; in i2c_read()
358 } while (--retry); in i2c_read()
359 return -1; in i2c_read()
366 gspca_dev->usb_buf[0] = (*sensormap)[1]; in sensor_mapwrite()
367 gspca_dev->usb_buf[1] = (*sensormap)[1] >> 8; in sensor_mapwrite()
405 data1 = gspca_dev->usb_buf[0]; in sd_config()
407 data2 = gspca_dev->usb_buf[0]; in sd_config()
410 data1 = gspca_dev->usb_buf[0]; in sd_config()
412 data2 = gspca_dev->usb_buf[0]; in sd_config()
414 if (vendor != id->idVendor || product != id->idProduct) { in sd_config()
416 return -EINVAL; in sd_config()
419 cam = &gspca_dev->cam; in sd_config()
420 cam->needs_full_bandwidth = 1; in sd_config()
422 sd->chip_revision = id->driver_info; in sd_config()
423 if (sd->chip_revision == Rev012A) { in sd_config()
424 cam->cam_mode = sif_012a_mode; in sd_config()
425 cam->nmodes = ARRAY_SIZE(sif_012a_mode); in sd_config()
427 cam->cam_mode = sif_072a_mode; in sd_config()
428 cam->nmodes = ARRAY_SIZE(sif_072a_mode); in sd_config()
430 sd->expo12a = EXPO12A_DEF; in sd_config()
459 if (sd->chip_revision == Rev012A) in setbrightness()
476 /* try to emulate MS-win as possible */ in setwhite()
478 blue = 0x90 - white * 5 / 8; in setwhite()
479 if (sd->chip_revision == Rev012A) { in setwhite()
483 red += contrast - 0x20; in setwhite()
484 blue += contrast - 0x20; in setwhite()
498 the basic exposure setting goes from 1-2047, where 1 is completely in setexposure()
499 dark and 2047 is very bright. It not only influences exposure but in setexposure()
500 also the framerate (to allow for longer exposure) from 1 - 300 it in setexposure()
501 only raises the exposure time then from 300 - 600 it halves the in setexposure()
504 exposure time of circa 0.2 - 0.25 seconds (30 / (2000/3000) fps). in setexposure()
505 Sometimes this is not enough, the 1-2047 uses bits 0-10, bits 11-12 in setexposure()
507 exposure setting of 1-300. These bits configure the base framerate in setexposure()
515 for (i = 0; i < ARRAY_SIZE(table) - 1; i++) { in setexposure()
517 expo = val - table[i]; in setexposure()
525 gspca_dev->usb_buf[0] = expo; in setexposure()
526 gspca_dev->usb_buf[1] = expo >> 8; in setexposure()
533 /* gain reg low 6 bits 0-63 gain, bit 6 and 7, both double the in setgain()
537 gspca_dev->usb_buf[0] = val; in setgain()
539 gspca_dev->usb_buf[0] = (val / 2) | 0x40; in setgain()
541 gspca_dev->usb_buf[0] = (val / 4) | 0xc0; in setgain()
543 gspca_dev->usb_buf[1] = 0; in setgain()
552 sd->ag_cnt = AG_CNT_START; in setautogain()
554 sd->ag_cnt = -1; in setautogain()
563 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; in sd_start_12a()
572 } /* -- qq@kuku.eu.org */ in sd_start_12a()
574 gspca_dev->usb_buf[0] = 0xaa; in sd_start_12a()
575 gspca_dev->usb_buf[1] = 0x00; in sd_start_12a()
577 /* clock - lower 0x8X values lead to fps > 30 */ in sd_start_12a()
582 memcpy(gspca_dev->usb_buf, Reg8391, 8); in sd_start_12a()
586 /* Led ON (bit 3 -> 0 */ in sd_start_12a()
601 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; in sd_start_72a()
605 Clck = 0x27; /* ms-win 0x87 */ in sd_start_72a()
621 setwhite(gspca_dev, v4l2_ctrl_g_ctrl(sd->hue), in sd_start_72a()
622 v4l2_ctrl_g_ctrl(sd->contrast)); in sd_start_72a()
624 setautogain(gspca_dev, v4l2_ctrl_g_ctrl(sd->autogain)); in sd_start_72a()
633 if (sd->chip_revision == Rev012A) { in sd_stopN()
635 /* Led Off (bit 3 -> 1 */ in sd_stopN()
655 if (sd->ag_cnt < 0) in do_autogain()
657 if (--sd->ag_cnt >= 0) in do_autogain()
659 sd->ag_cnt = AG_CNT_START; in do_autogain()
661 switch (sd->chip_revision) { in do_autogain()
664 Gr = gspca_dev->usb_buf[0]; in do_autogain()
666 R = gspca_dev->usb_buf[0]; in do_autogain()
668 B = gspca_dev->usb_buf[0]; in do_autogain()
670 Gb = gspca_dev->usb_buf[0]; in do_autogain()
672 /* u= (128*B-(43*(Gr+Gb+R))) >> 8; */ in do_autogain()
673 /* v= (128*R-(53*(Gr+Gb))-21*B) >> 8; */ in do_autogain()
675 if (y < luma_mean - luma_delta || in do_autogain()
682 expotimes += (luma_mean - y) >> spring; in do_autogain()
683 gainG += (luma_mean - y) / 50; in do_autogain()
707 len--; in sd_pkt_scan()
715 gspca_dev->last_packet_type = DISCARD_PACKET; in sd_pkt_scan()
721 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1); in sd_pkt_scan()
722 input_sync(gspca_dev->input_dev); in sd_pkt_scan()
723 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0); in sd_pkt_scan()
724 input_sync(gspca_dev->input_dev); in sd_pkt_scan()
733 if (sd->chip_revision == Rev012A) { in sd_pkt_scan()
735 len -= 20; in sd_pkt_scan()
738 len -= 16; in sd_pkt_scan()
752 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in sd_s_ctrl()
755 gspca_dev->usb_err = 0; in sd_s_ctrl()
757 if (!gspca_dev->streaming) in sd_s_ctrl()
760 switch (ctrl->id) { in sd_s_ctrl()
762 setbrightness(gspca_dev, ctrl->val); in sd_s_ctrl()
766 setwhite(gspca_dev, sd->hue->val, ctrl->val); in sd_s_ctrl()
770 setwhite(gspca_dev, ctrl->val, 0); in sd_s_ctrl()
773 setexposure(gspca_dev, ctrl->val); in sd_s_ctrl()
776 setgain(gspca_dev, ctrl->val); in sd_s_ctrl()
779 setautogain(gspca_dev, ctrl->val); in sd_s_ctrl()
782 return gspca_dev->usb_err; in sd_s_ctrl()
791 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; in sd_init_controls_12a()
793 gspca_dev->vdev.ctrl_handler = hdl; in sd_init_controls_12a()
798 V4L2_CID_BRIGHTNESS, -128, 127, 1, 0); in sd_init_controls_12a()
804 if (hdl->error) { in sd_init_controls_12a()
806 return hdl->error; in sd_init_controls_12a()
814 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; in sd_init_controls_72a()
816 gspca_dev->vdev.ctrl_handler = hdl; in sd_init_controls_72a()
818 sd->contrast = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls_72a()
820 sd->hue = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls_72a()
824 sd->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls_72a()
827 if (hdl->error) { in sd_init_controls_72a()
829 return hdl->error; in sd_init_controls_72a()
831 v4l2_ctrl_cluster(2, &sd->contrast); in sd_init_controls_72a()
835 /* sub-driver description */
866 /* -- module initialisation -- */
889 /* -- device connect -- */
894 sd_desc[id->driver_info], in sd_probe()