Lines Matching +full:sensor +full:- +full:gain

1 // SPDX-License-Identifier: GPL-2.0-only
4 * Driver for the ov9650 sensor
41 {SENSOR, OV9650_COM7, OV9650_REGISTER_RESET},
43 {SENSOR, OV9650_CLKRC, 0x80},
45 {SENSOR, OV9650_OFON, 0x40}
67 {SENSOR, OV9650_COM7, OV9650_REGISTER_RESET},
68 /* One extra reset is needed in order to make the sensor behave
70 {SENSOR, OV9650_COM7, OV9650_REGISTER_RESET},
73 {SENSOR, OV9650_CLKRC, 0x80},
75 {SENSOR, OV9650_OFON, 0x40},
78 {SENSOR, OV9650_COM8, OV9650_FAST_AGC_AEC |
81 {SENSOR, OV9650_CHLF, 0x10},
82 {SENSOR, OV9650_ARBLM, 0xbf},
83 {SENSOR, OV9650_ACOM38, 0x81},
85 {SENSOR, OV9650_COM16, 0x00},
88 {SENSOR, OV9650_COM13, 0x19},
90 {SENSOR, OV9650_TSLB, 0x0c},
92 {SENSOR, OV9650_COM24, 0x00},
94 {SENSOR, OV9650_COM12, 0x73},
97 {SENSOR, OV9650_DBLC1, 0xdf},
98 {SENSOR, OV9650_COM21, 0x06},
99 {SENSOR, OV9650_RSVD35, 0x91},
101 {SENSOR, OV9650_RSVD16, 0x06},
102 {SENSOR, OV9650_RSVD94, 0x99},
103 {SENSOR, OV9650_RSVD95, 0x99},
104 {SENSOR, OV9650_RSVD96, 0x04},
106 {SENSOR, OV9650_COM15, 0x0},
109 {SENSOR, OV9650_COM6, 0x4b},
111 {SENSOR, OV9650_BBIAS, 0xa0},
113 {SENSOR, OV9650_GbBIAS, 0xa0},
115 {SENSOR, OV9650_Gr_COM, 0x00},
117 {SENSOR, OV9650_RBIAS, 0xa0},
119 {SENSOR, OV9650_RBIAS, 0x0},
120 {SENSOR, OV9650_COM26, 0x80},
121 {SENSOR, OV9650_ACOMA9, 0x98},
123 {SENSOR, OV9650_AEW, 0x68},
125 {SENSOR, OV9650_AEB, 0x5c},
127 {SENSOR, OV9650_VPT, 0xc3},
128 /* Set the Automatic Gain Ceiling (AGC) to 128x,
132 {SENSOR, OV9650_COM9, 0x6e},
135 {SENSOR, OV9650_COM10, 0x42},
137 {SENSOR, OV9650_HSTART, 0x1a}, /* 210 */
139 {SENSOR, OV9650_HSTOP, 0xbf}, /* 1534 */
141 {SENSOR, OV9650_HREF, 0xb2},
143 {SENSOR, OV9650_VSTRT, 0x02},
145 {SENSOR, OV9650_VSTOP, 0x7e},
147 {SENSOR, OV9650_VREF, 0x10},
148 {SENSOR, OV9650_ADC, 0x04},
149 {SENSOR, OV9650_HV, 0x40},
151 /* Enable denoise, and white-pixel erase */
152 {SENSOR, OV9650_COM22, OV9650_DENOISE_ENABLE |
157 {SENSOR, OV9650_COM3, OV9650_VARIOPIXEL},
158 {SENSOR, OV9650_COM4, OV9650_QVGA_VARIOPIXEL},
160 /* Put the sensor in soft sleep mode */
161 {SENSOR, OV9650_COM2, OV9650_SOFT_SLEEP | OV9650_OUTPUT_DRIVE_2X},
165 {SENSOR, OV9650_COM2, OV9650_OUTPUT_DRIVE_2X},
175 where the sensor is mounted upside down */
302 pr_info("Forcing an %s sensor\n", ov9650.name); in ov9650_probe()
305 /* If we want to force another sensor, in ov9650_probe()
307 return -ENODEV; in ov9650_probe()
310 gspca_dbg(gspca_dev, D_PROBE, "Probing for an ov9650 sensor\n"); in ov9650_probe()
312 /* Run the pre-init before probing the sensor */ in ov9650_probe()
315 if (preinit_ov9650[i][0] == SENSOR) in ov9650_probe()
327 return -ENODEV; in ov9650_probe()
330 return -ENODEV; in ov9650_probe()
333 pr_info("Detected an ov9650 sensor\n"); in ov9650_probe()
336 return -ENODEV; in ov9650_probe()
339 sd->gspca_dev.cam.cam_mode = ov9650_modes; in ov9650_probe()
340 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(ov9650_modes); in ov9650_probe()
355 if (init_ov9650[i][0] == SENSOR) in ov9650_init()
367 struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler; in ov9650_init_controls()
369 sd->gspca_dev.vdev.ctrl_handler = hdl; in ov9650_init_controls()
372 sd->auto_white_bal = v4l2_ctrl_new_std(hdl, &ov9650_ctrl_ops, in ov9650_init_controls()
375 sd->red_bal = v4l2_ctrl_new_std(hdl, &ov9650_ctrl_ops, in ov9650_init_controls()
378 sd->blue_bal = v4l2_ctrl_new_std(hdl, &ov9650_ctrl_ops, in ov9650_init_controls()
382 sd->autoexpo = v4l2_ctrl_new_std_menu(hdl, &ov9650_ctrl_ops, in ov9650_init_controls()
384 sd->expo = v4l2_ctrl_new_std(hdl, &ov9650_ctrl_ops, V4L2_CID_EXPOSURE, in ov9650_init_controls()
387 sd->autogain = v4l2_ctrl_new_std(hdl, &ov9650_ctrl_ops, in ov9650_init_controls()
389 sd->gain = v4l2_ctrl_new_std(hdl, &ov9650_ctrl_ops, V4L2_CID_GAIN, 0, in ov9650_init_controls()
392 sd->hflip = v4l2_ctrl_new_std(hdl, &ov9650_ctrl_ops, V4L2_CID_HFLIP, in ov9650_init_controls()
394 sd->vflip = v4l2_ctrl_new_std(hdl, &ov9650_ctrl_ops, V4L2_CID_VFLIP, in ov9650_init_controls()
397 if (hdl->error) { in ov9650_init_controls()
399 return hdl->error; in ov9650_init_controls()
402 v4l2_ctrl_auto_cluster(3, &sd->auto_white_bal, 0, false); in ov9650_init_controls()
403 v4l2_ctrl_auto_cluster(2, &sd->autoexpo, 0, false); in ov9650_init_controls()
404 v4l2_ctrl_auto_cluster(2, &sd->autogain, 0, false); in ov9650_init_controls()
405 v4l2_ctrl_cluster(2, &sd->hflip); in ov9650_init_controls()
414 struct cam *cam = &sd->gspca_dev.cam; in ov9650_start()
416 int width = cam->cam_mode[sd->gspca_dev.curr_mode].width; in ov9650_start()
417 int height = cam->cam_mode[sd->gspca_dev.curr_mode].height; in ov9650_start()
418 int ver_offs = cam->cam_mode[sd->gspca_dev.curr_mode].priv; in ov9650_start()
423 sd->vflip->val) || in ov9650_start()
425 !sd->vflip->val)) in ov9650_start()
426 ver_offs--; in ov9650_start()
436 else if (res_init_ov9650[i][0] == SENSOR) { in ov9650_start()
548 sd->sensor = NULL; in ov9650_disconnect()
585 gspca_dbg(gspca_dev, D_CONF, "Setting gain to %d\n", val); in ov9650_set_gain()
613 gspca_dbg(gspca_dev, D_CONF, "Set red gain to %d\n", val); in ov9650_set_red_balance()
626 gspca_dbg(gspca_dev, D_CONF, "Set blue gain to %d\n", val); in ov9650_set_blue_balance()
638 int hflip = sd->hflip->val; in ov9650_set_hvflip()
639 int vflip = sd->vflip->val; in ov9650_set_hvflip()
652 if (gspca_dev->streaming) in ov9650_set_hvflip()
702 gspca_dbg(gspca_dev, D_CONF, "Set auto gain control to %d\n", val); in ov9650_set_auto_gain()
716 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in ov9650_s_ctrl()
720 if (!gspca_dev->streaming) in ov9650_s_ctrl()
723 switch (ctrl->id) { in ov9650_s_ctrl()
725 err = ov9650_set_auto_white_balance(gspca_dev, ctrl->val); in ov9650_s_ctrl()
726 if (err || ctrl->val) in ov9650_s_ctrl()
728 err = ov9650_set_red_balance(gspca_dev, sd->red_bal->val); in ov9650_s_ctrl()
731 err = ov9650_set_blue_balance(gspca_dev, sd->blue_bal->val); in ov9650_s_ctrl()
734 err = ov9650_set_auto_exposure(gspca_dev, ctrl->val); in ov9650_s_ctrl()
735 if (err || ctrl->val == V4L2_EXPOSURE_AUTO) in ov9650_s_ctrl()
737 err = ov9650_set_exposure(gspca_dev, sd->expo->val); in ov9650_s_ctrl()
740 err = ov9650_set_auto_gain(gspca_dev, ctrl->val); in ov9650_s_ctrl()
741 if (err || ctrl->val) in ov9650_s_ctrl()
743 err = ov9650_set_gain(gspca_dev, sd->gain->val); in ov9650_s_ctrl()
749 return -EINVAL; in ov9650_s_ctrl()