• Home
  • Raw
  • Download

Lines Matching refs:gspca_dev

100 	struct gspca_dev gspca_dev;		/* !! must be the first item */  member
232 static void reg_w_buf(struct gspca_dev *gspca_dev, in reg_w_buf() argument
238 if (gspca_dev->usb_err < 0) in reg_w_buf()
240 memcpy(gspca_dev->usb_buf, buffer, len); in reg_w_buf()
241 ret = usb_control_msg(gspca_dev->dev, in reg_w_buf()
242 usb_sndctrlpipe(gspca_dev->dev, 0), in reg_w_buf()
246 index, gspca_dev->usb_buf, len, in reg_w_buf()
251 gspca_dev->usb_err = ret; in reg_w_buf()
256 static void reg_w(struct gspca_dev *gspca_dev, in reg_w() argument
262 if (gspca_dev->usb_err < 0) in reg_w()
264 gspca_dev->usb_buf[0] = value; in reg_w()
265 ret = usb_control_msg(gspca_dev->dev, in reg_w()
266 usb_sndctrlpipe(gspca_dev->dev, 0), in reg_w()
269 0, index, gspca_dev->usb_buf, 1, in reg_w()
274 gspca_dev->usb_err = ret; in reg_w()
278 static void reg_w_seq(struct gspca_dev *gspca_dev, in reg_w_seq() argument
282 reg_w(gspca_dev, seq[0], seq[1]); in reg_w_seq()
288 static void reg_w_page(struct gspca_dev *gspca_dev, in reg_w_page() argument
294 if (gspca_dev->usb_err < 0) in reg_w_page()
299 gspca_dev->usb_buf[0] = page[index]; in reg_w_page()
300 ret = usb_control_msg(gspca_dev->dev, in reg_w_page()
301 usb_sndctrlpipe(gspca_dev->dev, 0), in reg_w_page()
304 0, index, gspca_dev->usb_buf, 1, in reg_w_page()
309 gspca_dev->usb_err = ret; in reg_w_page()
316 static void reg_w_var(struct gspca_dev *gspca_dev, in reg_w_var() argument
329 reg_w_page(gspca_dev, page3, page3_len); in reg_w_var()
333 gspca_err(gspca_dev, "Incorrect variable sequence\n"); in reg_w_var()
338 reg_w_buf(gspca_dev, in reg_w_var()
343 reg_w_buf(gspca_dev, index, seq, 8); in reg_w_var()
354 static int sd_config(struct gspca_dev *gspca_dev, in sd_config() argument
357 struct sd *sd = (struct sd *) gspca_dev; in sd_config()
360 cam = &gspca_dev->cam; in sd_config()
369 static void setbrightcont(struct gspca_dev *gspca_dev) in setbrightcont() argument
371 struct sd *sd = (struct sd *) gspca_dev; in setbrightcont()
380 reg_w(gspca_dev, 0xff, 0x00); /* page 0 */ in setbrightcont()
390 reg_w(gspca_dev, 0xa2 + i, v); in setbrightcont()
392 reg_w(gspca_dev, 0xdc, 0x01); in setbrightcont()
395 static void setcolors(struct gspca_dev *gspca_dev) in setcolors() argument
397 struct sd *sd = (struct sd *) gspca_dev; in setcolors()
404 reg_w(gspca_dev, 0xff, 0x03); /* page 3 */ in setcolors()
405 reg_w(gspca_dev, 0x11, 0x01); in setcolors()
406 reg_w(gspca_dev, 0xff, 0x00); /* page 0 */ in setcolors()
410 reg_w(gspca_dev, 0x0f + 2 * i, (v >> 8) & 0x07); in setcolors()
411 reg_w(gspca_dev, 0x0f + 2 * i + 1, v); in setcolors()
413 reg_w(gspca_dev, 0xdc, 0x01); in setcolors()
416 static void setwhitebalance(struct gspca_dev *gspca_dev) in setwhitebalance() argument
418 struct sd *sd = (struct sd *) gspca_dev; in setwhitebalance()
420 reg_w(gspca_dev, 0xff, 0x00); /* page 0 */ in setwhitebalance()
421 reg_w(gspca_dev, 0xc6, sd->white_balance->val); in setwhitebalance()
423 reg_w(gspca_dev, 0xdc, 0x01); in setwhitebalance()
444 static void setredbalance(struct gspca_dev *gspca_dev) in setredbalance() argument
446 struct sd *sd = (struct sd *) gspca_dev; in setredbalance()
448 reg_w(gspca_dev, 0xff, 0x00); /* page 0 */ in setredbalance()
449 reg_w(gspca_dev, 0x01, in setredbalance()
452 reg_w(gspca_dev, 0xdc, 0x01); in setredbalance()
455 static void setbluebalance(struct gspca_dev *gspca_dev) in setbluebalance() argument
457 struct sd *sd = (struct sd *) gspca_dev; in setbluebalance()
459 reg_w(gspca_dev, 0xff, 0x00); /* page 0 */ in setbluebalance()
460 reg_w(gspca_dev, 0x03, in setbluebalance()
463 reg_w(gspca_dev, 0xdc, 0x01); in setbluebalance()
466 static void setgain(struct gspca_dev *gspca_dev) in setgain() argument
470 if (gspca_dev->gain->val < 32) { in setgain()
471 reg10 = gspca_dev->gain->val; in setgain()
475 reg12 = gspca_dev->gain->val - 31; in setgain()
478 reg_w(gspca_dev, 0xff, 0x03); /* page 3 */ in setgain()
479 reg_w(gspca_dev, 0x10, reg10); in setgain()
480 reg_w(gspca_dev, 0x12, reg12); in setgain()
483 reg_w(gspca_dev, 0x11, 0x01); in setgain()
486 static void setexposure(struct gspca_dev *gspca_dev) in setexposure() argument
496 clockdiv = (90 * gspca_dev->exposure->val + 1999) / 2000; in setexposure()
521 exposure = (gspca_dev->exposure->val * 45 * 448) / (1000 * clockdiv); in setexposure()
525 reg_w(gspca_dev, 0xff, 0x03); /* page 3 */ in setexposure()
526 reg_w(gspca_dev, 0x02, clockdiv); in setexposure()
527 reg_w(gspca_dev, 0x0e, exposure & 0xff); in setexposure()
528 reg_w(gspca_dev, 0x0f, exposure >> 8); in setexposure()
531 reg_w(gspca_dev, 0x11, 0x01); in setexposure()
534 static void sethvflip(struct gspca_dev *gspca_dev) in sethvflip() argument
536 struct sd *sd = (struct sd *) gspca_dev; in sethvflip()
546 reg_w(gspca_dev, 0xff, 0x03); /* page 3 */ in sethvflip()
548 reg_w(gspca_dev, 0x21, data); in sethvflip()
551 reg_w(gspca_dev, 0x11, 0x01); in sethvflip()
554 static void setsharpness(struct gspca_dev *gspca_dev) in setsharpness() argument
556 struct sd *sd = (struct sd *) gspca_dev; in setsharpness()
558 reg_w(gspca_dev, 0xff, 0x00); /* page 0 */ in setsharpness()
559 reg_w(gspca_dev, 0xb6, sd->sharpness->val); in setsharpness()
561 reg_w(gspca_dev, 0xdc, 0x01); in setsharpness()
565 static int sd_init(struct gspca_dev *gspca_dev) in sd_init() argument
567 reg_w_seq(gspca_dev, init_7302, sizeof(init_7302)/2); in sd_init()
568 return gspca_dev->usb_err; in sd_init()
573 struct gspca_dev *gspca_dev = in sd_s_ctrl() local
574 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in sd_s_ctrl()
575 struct sd *sd = (struct sd *)gspca_dev; in sd_s_ctrl()
577 gspca_dev->usb_err = 0; in sd_s_ctrl()
584 gspca_dev->exposure->val = PAC7302_EXPOSURE_DEFAULT; in sd_s_ctrl()
585 gspca_dev->gain->val = PAC7302_GAIN_DEFAULT; in sd_s_ctrl()
589 if (!gspca_dev->streaming) in sd_s_ctrl()
594 setbrightcont(gspca_dev); in sd_s_ctrl()
597 setcolors(gspca_dev); in sd_s_ctrl()
600 setwhitebalance(gspca_dev); in sd_s_ctrl()
603 setredbalance(gspca_dev); in sd_s_ctrl()
606 setbluebalance(gspca_dev); in sd_s_ctrl()
609 if (gspca_dev->exposure->is_new || (ctrl->is_new && ctrl->val)) in sd_s_ctrl()
610 setexposure(gspca_dev); in sd_s_ctrl()
611 if (gspca_dev->gain->is_new || (ctrl->is_new && ctrl->val)) in sd_s_ctrl()
612 setgain(gspca_dev); in sd_s_ctrl()
615 sethvflip(gspca_dev); in sd_s_ctrl()
618 setsharpness(gspca_dev); in sd_s_ctrl()
623 return gspca_dev->usb_err; in sd_s_ctrl()
631 static int sd_init_controls(struct gspca_dev *gspca_dev) in sd_init_controls() argument
633 struct sd *sd = (struct sd *) gspca_dev; in sd_init_controls()
634 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; in sd_init_controls()
636 gspca_dev->vdev.ctrl_handler = hdl; in sd_init_controls()
660 gspca_dev->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
662 gspca_dev->exposure = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
665 gspca_dev->gain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
683 v4l2_ctrl_auto_cluster(3, &gspca_dev->autogain, 0, false); in sd_init_controls()
689 static int sd_start(struct gspca_dev *gspca_dev) in sd_start() argument
691 struct sd *sd = (struct sd *) gspca_dev; in sd_start()
693 reg_w_var(gspca_dev, start_7302, in sd_start()
701 reg_w(gspca_dev, 0xff, 0x01); in sd_start()
702 reg_w(gspca_dev, 0x78, 0x01); in sd_start()
704 return gspca_dev->usb_err; in sd_start()
707 static void sd_stopN(struct gspca_dev *gspca_dev) in sd_stopN() argument
711 reg_w(gspca_dev, 0xff, 0x01); in sd_stopN()
712 reg_w(gspca_dev, 0x78, 0x00); in sd_stopN()
716 static void sd_stop0(struct gspca_dev *gspca_dev) in sd_stop0() argument
718 if (!gspca_dev->present) in sd_stop0()
720 reg_w(gspca_dev, 0xff, 0x01); in sd_stop0()
721 reg_w(gspca_dev, 0x78, 0x40); in sd_stop0()
724 static void do_autogain(struct gspca_dev *gspca_dev) in do_autogain() argument
726 struct sd *sd = (struct sd *) gspca_dev; in do_autogain()
739 if (gspca_expo_autogain(gspca_dev, avg_lum, desired_lum, in do_autogain()
772 static void sd_pkt_scan(struct gspca_dev *gspca_dev, in sd_pkt_scan() argument
776 struct sd *sd = (struct sd *) gspca_dev; in sd_pkt_scan()
780 sof = pac_find_sof(gspca_dev, &sd->sof_read, data, len); in sd_pkt_scan()
796 gspca_dev->image_len += n; in sd_pkt_scan()
799 gspca_frame_add(gspca_dev, INTER_PACKET, data, n); in sd_pkt_scan()
802 image = gspca_dev->image; in sd_pkt_scan()
804 && image[gspca_dev->image_len - 2] == 0xff in sd_pkt_scan()
805 && image[gspca_dev->image_len - 1] == 0xd9) in sd_pkt_scan()
806 gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); in sd_pkt_scan()
813 if (gspca_dev->last_packet_type == LAST_PACKET && in sd_pkt_scan()
820 gspca_frame_add(gspca_dev, FIRST_PACKET, in sd_pkt_scan()
823 gspca_frame_add(gspca_dev, INTER_PACKET, data, len); in sd_pkt_scan()
827 static int sd_dbg_s_register(struct gspca_dev *gspca_dev, in sd_dbg_s_register() argument
851 reg_w(gspca_dev, 0xff, 0x00); /* page 0 */ in sd_dbg_s_register()
852 reg_w(gspca_dev, index, value); in sd_dbg_s_register()
854 reg_w(gspca_dev, 0xdc, 0x01); in sd_dbg_s_register()
856 return gspca_dev->usb_err; in sd_dbg_s_register()
861 static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, in sd_int_pkt_scan() argument
879 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1); in sd_int_pkt_scan()
880 input_sync(gspca_dev->input_dev); in sd_int_pkt_scan()
881 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0); in sd_int_pkt_scan()
882 input_sync(gspca_dev->input_dev); in sd_int_pkt_scan()