Lines Matching +full:clip +full:- +full:x +full:- +full:high
1 // SPDX-License-Identifier: GPL-2.0-or-later
45 /* -- read a register -- */
48 struct usb_device *dev = gspca_dev->dev; in reg_r()
51 if (gspca_dev->usb_err < 0) in reg_r()
58 gspca_dev->usb_buf, 1, in reg_r()
61 gspca_dbg(gspca_dev, D_USBI, "reg_r 0x%x=0x%02x\n", in reg_r()
62 index, gspca_dev->usb_buf[0]); in reg_r()
64 pr_err("reg_r 0x%x err %d\n", index, ret); in reg_r()
65 gspca_dev->usb_err = ret; in reg_r()
69 return gspca_dev->usb_buf[0]; in reg_r()
72 /* -- write a register -- */
76 struct usb_device *dev = gspca_dev->dev; in reg_w()
78 if (gspca_dev->usb_err < 0) in reg_w()
88 gspca_dbg(gspca_dev, D_USBO, "reg_w 0x%x:=0x%02x\n", index, val); in reg_w()
90 pr_err("reg_w 0x%x err %d\n", index, ret); in reg_w()
91 gspca_dev->usb_err = ret; in reg_w()
105 gspca_dev->cam.cam_mode = stk1135_modes; in sd_config()
106 gspca_dev->cam.nmodes = ARRAY_SIZE(stk1135_modes); in sd_config()
118 pr_err("serial bus timeout: status=0x%02x\n", val); in stk1135_serial_wait_ready()
119 return -1; in stk1135_serial_wait_ready()
171 if (page != sd->sensor_page) { in sensor_set_page()
173 sd->sensor_page = page; in sensor_set_page()
207 /* mode ctl: AWB on, AE both, clip aper corr, defect corr, AE */ in stk1135_configure_mt9m112()
210 { 0x2dd, 0x18e0 }, /* B-R thresholds, */ in stk1135_configure_mt9m112()
224 /* base matrix signs, scale K1-5, K6-9 */ in stk1135_configure_mt9m112()
227 { 0x209, 0x00cd }, { 0x20a, 0x0093 }, { 0x20b, 0x0004 },/*K1-3*/ in stk1135_configure_mt9m112()
228 { 0x20c, 0x005c }, { 0x20d, 0x00d9 }, { 0x20e, 0x0053 },/*K4-6*/ in stk1135_configure_mt9m112()
229 { 0x20f, 0x0008 }, { 0x210, 0x0091 }, { 0x211, 0x00cf },/*K7-9*/ in stk1135_configure_mt9m112()
232 { 0x216, 0x0000 }, { 0x217, 0x0000 }, { 0x218, 0x0000 },/*D1-3*/ in stk1135_configure_mt9m112()
233 { 0x219, 0x0000 }, { 0x21a, 0x0000 }, { 0x21b, 0x0000 },/*D4-6*/ in stk1135_configure_mt9m112()
234 { 0x21c, 0x0000 }, { 0x21d, 0x0000 }, { 0x21e, 0x0000 },/*D7-9*/ in stk1135_configure_mt9m112()
261 /* Gamma correction - context A */ in stk1135_configure_mt9m112()
264 /* Gamma correction - context B */ in stk1135_configure_mt9m112()
270 { 0x108, 0x0180 }, /* format control - enable bayer row flip */ in stk1135_configure_mt9m112()
274 /* default prg conf, prg ctl - by 0x2d2, prg advance - PA1 */ in stk1135_configure_mt9m112()
280 { 0x065, 0xa000 }, /* clk ctl - enable PLL (clear bit 14) */ in stk1135_configure_mt9m112()
307 width = gspca_dev->pixfmt.width; in stk1135_configure_mt9m112()
308 height = gspca_dev->pixfmt.height; in stk1135_configure_mt9m112()
331 /* and positive edge clocked pulse high when pixel counter = 0 */ in stk1135_configure_clock()
377 /* disable sensor (GPIO5) and enable GPIO0,3,6 (?) - sensor standby? */ in stk1135_camera_disable()
406 /* disable alt 2-wire serial interface */ in sd_init()
412 sd->sensor_page = 0xff; in sd_init()
422 pr_info("Detected sensor type %s (0x%x)\n", sensor_name, sensor_id); in sd_init()
426 return gspca_dev->usb_err; in sd_init()
429 /* -- start the camera -- */
440 /* set capture start position X = 0, Y = 0 */ in sd_start()
447 width = gspca_dev->pixfmt.width; in sd_start()
448 height = gspca_dev->pixfmt.height; in sd_start()
454 /* set 8-bit mode */ in sd_start()
462 if (gspca_dev->usb_err >= 0) in sd_start()
463 gspca_dbg(gspca_dev, D_STREAM, "camera started alt: 0x%02x\n", in sd_start()
464 gspca_dev->alt); in sd_start()
466 sd->pkt_seq = 0; in sd_start()
468 return gspca_dev->usb_err; in sd_start()
473 struct usb_device *dev = gspca_dev->dev; in sd_stopN()
475 usb_set_interface(dev, gspca_dev->iface, 0); in sd_stopN()
499 flip = !(le16_to_cpu(hdr->gpio) & (1 << 8)); in sd_pkt_scan()
501 if (sd->flip_status != flip) in sd_pkt_scan()
502 sd->flip_debounce++; in sd_pkt_scan()
504 sd->flip_debounce = 0; in sd_pkt_scan()
507 if (!(hdr->flags & STK1135_HDR_FRAME_START)) { in sd_pkt_scan()
508 seq = hdr->seq & STK1135_HDR_SEQ_MASK; in sd_pkt_scan()
509 if (seq != sd->pkt_seq) { in sd_pkt_scan()
510 gspca_dbg(gspca_dev, D_PACK, "received out-of-sequence packet\n"); in sd_pkt_scan()
512 sd->pkt_seq = seq; in sd_pkt_scan()
513 gspca_dev->last_packet_type = DISCARD_PACKET; in sd_pkt_scan()
517 sd->pkt_seq++; in sd_pkt_scan()
518 if (sd->pkt_seq > STK1135_HDR_SEQ_MASK) in sd_pkt_scan()
519 sd->pkt_seq = 0; in sd_pkt_scan()
524 if (hdr->flags & STK1135_HDR_FRAME_START) { /* new frame */ in sd_pkt_scan()
529 gspca_frame_add(gspca_dev, pkt_type, data + skip, len - skip); in sd_pkt_scan()
536 if (sd->flip_status) in sethflip()
545 if (sd->flip_status) in setvflip()
554 if (sd->flip_debounce > 100) { in stk1135_dq_callback()
555 sd->flip_status = !sd->flip_status; in stk1135_dq_callback()
556 sethflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip)); in stk1135_dq_callback()
557 setvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->vflip)); in stk1135_dq_callback()
564 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in sd_s_ctrl()
566 gspca_dev->usb_err = 0; in sd_s_ctrl()
568 if (!gspca_dev->streaming) in sd_s_ctrl()
571 switch (ctrl->id) { in sd_s_ctrl()
573 sethflip(gspca_dev, ctrl->val); in sd_s_ctrl()
576 setvflip(gspca_dev, ctrl->val); in sd_s_ctrl()
580 return gspca_dev->usb_err; in sd_s_ctrl()
590 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; in sd_init_controls()
592 gspca_dev->vdev.ctrl_handler = hdl; in sd_init_controls()
594 sd->hflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
596 sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
599 if (hdl->error) { in sd_init_controls()
601 return hdl->error; in sd_init_controls()
608 fmt->fmt.pix.width = clamp(fmt->fmt.pix.width, 32U, 1280U); in stk1135_try_fmt()
609 fmt->fmt.pix.height = clamp(fmt->fmt.pix.height, 32U, 1024U); in stk1135_try_fmt()
611 fmt->fmt.pix.width += (fmt->fmt.pix.width & 1); in stk1135_try_fmt()
612 fmt->fmt.pix.height += (fmt->fmt.pix.height & 1); in stk1135_try_fmt()
614 fmt->fmt.pix.bytesperline = fmt->fmt.pix.width; in stk1135_try_fmt()
615 fmt->fmt.pix.sizeimage = fmt->fmt.pix.width * fmt->fmt.pix.height; in stk1135_try_fmt()
621 if (fsize->index != 0 || fsize->pixel_format != V4L2_PIX_FMT_SBGGR8) in stk1135_enum_framesizes()
622 return -EINVAL; in stk1135_enum_framesizes()
624 fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE; in stk1135_enum_framesizes()
625 fsize->stepwise.min_width = 32; in stk1135_enum_framesizes()
626 fsize->stepwise.min_height = 32; in stk1135_enum_framesizes()
627 fsize->stepwise.max_width = 1280; in stk1135_enum_framesizes()
628 fsize->stepwise.max_height = 1024; in stk1135_enum_framesizes()
629 fsize->stepwise.step_width = 2; in stk1135_enum_framesizes()
630 fsize->stepwise.step_height = 2; in stk1135_enum_framesizes()
635 /* sub-driver description */
649 /* -- module initialisation -- */
656 /* -- device connect -- */