Lines Matching refs:gspca_dev
37 struct gspca_dev gspca_dev; /* !! must be the first item */ member
318 static void reg_r(struct gspca_dev *gspca_dev, in reg_r() argument
322 usb_control_msg(gspca_dev->dev, in reg_r()
323 usb_rcvctrlpipe(gspca_dev->dev, 0), in reg_r()
327 index, gspca_dev->usb_buf, length, 500); in reg_r()
330 static int reg_w(struct gspca_dev *gspca_dev, in reg_w() argument
336 ret = usb_control_msg(gspca_dev->dev, in reg_w()
337 usb_sndctrlpipe(gspca_dev->dev, 0), in reg_w()
347 static int reg_r_12(struct gspca_dev *gspca_dev, in reg_r_12() argument
354 gspca_dev->usb_buf[1] = 0; in reg_r_12()
355 ret = usb_control_msg(gspca_dev->dev, in reg_r_12()
356 usb_rcvctrlpipe(gspca_dev->dev, 0), in reg_r_12()
361 gspca_dev->usb_buf, length, in reg_r_12()
367 return (gspca_dev->usb_buf[1] << 8) + gspca_dev->usb_buf[0]; in reg_r_12()
375 static int reg_r_wait(struct gspca_dev *gspca_dev, in reg_r_wait() argument
381 ret = reg_r_12(gspca_dev, reg, index, 1); in reg_r_wait()
389 static int write_vector(struct gspca_dev *gspca_dev, in write_vector() argument
395 ret = reg_w(gspca_dev, data[i][0], data[i][2], data[i][1]); in write_vector()
403 static int spca50x_setup_qtable(struct gspca_dev *gspca_dev, in spca50x_setup_qtable() argument
413 err = reg_w(gspca_dev, request, ybase + i, qtable[0][i]); in spca50x_setup_qtable()
420 err = reg_w(gspca_dev, request, cbase + i, qtable[1][i]); in spca50x_setup_qtable()
427 static void spca500_ping310(struct gspca_dev *gspca_dev) in spca500_ping310() argument
429 reg_r(gspca_dev, 0x0d04, 2); in spca500_ping310()
431 gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]); in spca500_ping310()
434 static void spca500_clksmart310_init(struct gspca_dev *gspca_dev) in spca500_clksmart310_init() argument
436 reg_r(gspca_dev, 0x0d05, 2); in spca500_clksmart310_init()
438 gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]); in spca500_clksmart310_init()
439 reg_w(gspca_dev, 0x00, 0x8167, 0x5a); in spca500_clksmart310_init()
440 spca500_ping310(gspca_dev); in spca500_clksmart310_init()
442 reg_w(gspca_dev, 0x00, 0x8168, 0x22); in spca500_clksmart310_init()
443 reg_w(gspca_dev, 0x00, 0x816a, 0xc0); in spca500_clksmart310_init()
444 reg_w(gspca_dev, 0x00, 0x816b, 0x0b); in spca500_clksmart310_init()
445 reg_w(gspca_dev, 0x00, 0x8169, 0x25); in spca500_clksmart310_init()
446 reg_w(gspca_dev, 0x00, 0x8157, 0x5b); in spca500_clksmart310_init()
447 reg_w(gspca_dev, 0x00, 0x8158, 0x5b); in spca500_clksmart310_init()
448 reg_w(gspca_dev, 0x00, 0x813f, 0x03); in spca500_clksmart310_init()
449 reg_w(gspca_dev, 0x00, 0x8151, 0x4a); in spca500_clksmart310_init()
450 reg_w(gspca_dev, 0x00, 0x8153, 0x78); in spca500_clksmart310_init()
451 reg_w(gspca_dev, 0x00, 0x0d01, 0x04); in spca500_clksmart310_init()
453 reg_w(gspca_dev, 0x00, 0x0d02, 0x01); in spca500_clksmart310_init()
454 reg_w(gspca_dev, 0x00, 0x8169, 0x25); in spca500_clksmart310_init()
455 reg_w(gspca_dev, 0x00, 0x0d01, 0x02); in spca500_clksmart310_init()
458 static void spca500_setmode(struct gspca_dev *gspca_dev, in spca500_setmode() argument
464 reg_w(gspca_dev, 0, 0x8001, xmult); in spca500_setmode()
467 reg_w(gspca_dev, 0, 0x8002, ymult); in spca500_setmode()
470 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; in spca500_setmode()
471 reg_w(gspca_dev, 0, 0x8003, mode << 4); in spca500_setmode()
474 static int spca500_full_reset(struct gspca_dev *gspca_dev) in spca500_full_reset() argument
479 err = reg_w(gspca_dev, 0xe0, 0x0001, 0x0000); in spca500_full_reset()
484 err = reg_r_wait(gspca_dev, 0x06, 0x0000, 0x0000); in spca500_full_reset()
487 err = reg_w(gspca_dev, 0xe0, 0x0000, 0x0000); in spca500_full_reset()
490 err = reg_r_wait(gspca_dev, 0x06, 0, 0); in spca500_full_reset()
505 static int spca500_synch310(struct gspca_dev *gspca_dev) in spca500_synch310() argument
507 if (usb_set_interface(gspca_dev->dev, gspca_dev->iface, 0) < 0) { in spca500_synch310()
511 spca500_ping310(gspca_dev); in spca500_synch310()
513 reg_r(gspca_dev, 0x0d00, 1); in spca500_synch310()
516 PDEBUG(D_PACK, "ClickSmart310 sync alt: %d", gspca_dev->alt); in spca500_synch310()
519 if (usb_set_interface(gspca_dev->dev, in spca500_synch310()
520 gspca_dev->iface, in spca500_synch310()
521 gspca_dev->alt) < 0) { in spca500_synch310()
530 static void spca500_reinit(struct gspca_dev *gspca_dev) in spca500_reinit() argument
537 reg_w(gspca_dev, 0x00, 0x0d01, 0x01); in spca500_reinit()
538 reg_w(gspca_dev, 0x00, 0x0d03, 0x00); in spca500_reinit()
539 reg_w(gspca_dev, 0x00, 0x0d02, 0x01); in spca500_reinit()
542 reg_w(gspca_dev, 0x00, 0x850a, 0x0001); in spca500_reinit()
544 err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840, in spca500_reinit()
550 reg_w(gspca_dev, 0x00, 0x8880, 2); in spca500_reinit()
552 reg_w(gspca_dev, 0x00, 0x800a, 0x00); in spca500_reinit()
554 reg_w(gspca_dev, 0x00, 0x820f, 0x01); in spca500_reinit()
556 reg_w(gspca_dev, 0x00, 0x870a, 0x04); in spca500_reinit()
558 reg_w(gspca_dev, 0, 0x8003, 0x00); in spca500_reinit()
560 reg_w(gspca_dev, 0x00, 0x8000, 0x0004); in spca500_reinit()
562 if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0) { in spca500_reinit()
563 reg_r(gspca_dev, 0x816b, 1); in spca500_reinit()
564 Data = gspca_dev->usb_buf[0]; in spca500_reinit()
565 reg_w(gspca_dev, 0x00, 0x816b, Data); in spca500_reinit()
570 static int sd_config(struct gspca_dev *gspca_dev, in sd_config() argument
573 struct sd *sd = (struct sd *) gspca_dev; in sd_config()
576 cam = &gspca_dev->cam; in sd_config()
589 static int sd_init(struct gspca_dev *gspca_dev) in sd_init() argument
591 struct sd *sd = (struct sd *) gspca_dev; in sd_init()
596 spca500_clksmart310_init(gspca_dev); in sd_init()
603 static int sd_start(struct gspca_dev *gspca_dev) in sd_start() argument
605 struct sd *sd = (struct sd *) gspca_dev; in sd_start()
611 jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, in sd_start()
612 gspca_dev->pixfmt.width, in sd_start()
625 reg_r(gspca_dev, 0x8a04, 1); in sd_start()
627 gspca_dev->usb_buf[0]); in sd_start()
629 gspca_dev->curr_mode, xmult, ymult); in sd_start()
634 spca500_setmode(gspca_dev, xmult, ymult); in sd_start()
637 reg_w(gspca_dev, 0x00, 0x850a, 0x0001); in sd_start()
638 reg_w(gspca_dev, 0x00, 0x8880, 3); in sd_start()
639 err = spca50x_setup_qtable(gspca_dev, in sd_start()
645 reg_w(gspca_dev, 0x00, 0x870a, 0x04); in sd_start()
648 reg_w(gspca_dev, 0x00, 0x8000, 0x0004); in sd_start()
650 if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0) in sd_start()
653 reg_r(gspca_dev, 0x816b, 1); in sd_start()
654 Data = gspca_dev->usb_buf[0]; in sd_start()
655 reg_w(gspca_dev, 0x00, 0x816b, Data); in sd_start()
657 spca500_synch310(gspca_dev); in sd_start()
659 write_vector(gspca_dev, spca500_visual_defaults); in sd_start()
660 spca500_setmode(gspca_dev, xmult, ymult); in sd_start()
662 err = reg_w(gspca_dev, 0x00, 0x850a, 0x0001); in sd_start()
665 reg_w(gspca_dev, 0x00, 0x8880, 3); in sd_start()
666 err = spca50x_setup_qtable(gspca_dev, in sd_start()
673 reg_w(gspca_dev, 0x00, 0x870a, 0x04); in sd_start()
676 reg_w(gspca_dev, 0x00, 0x8000, 0x0004); in sd_start()
678 if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0) in sd_start()
681 reg_r(gspca_dev, 0x816b, 1); in sd_start()
682 Data = gspca_dev->usb_buf[0]; in sd_start()
683 reg_w(gspca_dev, 0x00, 0x816b, Data); in sd_start()
691 err = spca500_full_reset(gspca_dev); in sd_start()
696 err = reg_w(gspca_dev, 0x00, 0x850a, 0x0001); in sd_start()
699 reg_w(gspca_dev, 0x00, 0x8880, 3); in sd_start()
700 err = spca50x_setup_qtable(gspca_dev, in sd_start()
706 spca500_setmode(gspca_dev, xmult, ymult); in sd_start()
707 reg_w(gspca_dev, 0x20, 0x0001, 0x0004); in sd_start()
710 reg_w(gspca_dev, 0x00, 0x8000, 0x0004); in sd_start()
712 if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0) in sd_start()
715 reg_r(gspca_dev, 0x816b, 1); in sd_start()
716 Data = gspca_dev->usb_buf[0]; in sd_start()
717 reg_w(gspca_dev, 0x00, 0x816b, Data); in sd_start()
724 err = spca500_full_reset(gspca_dev); in sd_start()
728 reg_w(gspca_dev, 0x00, 0x850a, 0x0001); in sd_start()
729 reg_w(gspca_dev, 0x00, 0x8880, 0); in sd_start()
730 err = spca50x_setup_qtable(gspca_dev, in sd_start()
735 spca500_setmode(gspca_dev, xmult, ymult); in sd_start()
737 reg_w(gspca_dev, 0x20, 0x0001, 0x0004); in sd_start()
740 reg_w(gspca_dev, 0x00, 0x8000, 0x0004); in sd_start()
742 if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0) in sd_start()
745 reg_r(gspca_dev, 0x816b, 1); in sd_start()
746 Data = gspca_dev->usb_buf[0]; in sd_start()
747 reg_w(gspca_dev, 0x00, 0x816b, Data); in sd_start()
761 spca500_reinit(gspca_dev); in sd_start()
762 reg_w(gspca_dev, 0x00, 0x0d01, 0x01); in sd_start()
764 reg_w(gspca_dev, 0x00, 0x850a, 0x0001); in sd_start()
766 err = spca50x_setup_qtable(gspca_dev, in sd_start()
770 reg_w(gspca_dev, 0x00, 0x8880, 2); in sd_start()
773 reg_w(gspca_dev, 0x00, 0x800a, 0x00); in sd_start()
775 reg_w(gspca_dev, 0x00, 0x820f, 0x01); in sd_start()
777 reg_w(gspca_dev, 0x00, 0x870a, 0x04); in sd_start()
779 spca500_setmode(gspca_dev, xmult, ymult); in sd_start()
781 reg_w(gspca_dev, 0x00, 0x8000, 0x0004); in sd_start()
783 reg_r_wait(gspca_dev, 0, 0x8000, 0x44); in sd_start()
785 reg_r(gspca_dev, 0x816b, 1); in sd_start()
786 Data = gspca_dev->usb_buf[0]; in sd_start()
787 reg_w(gspca_dev, 0x00, 0x816b, Data); in sd_start()
791 reg_w(gspca_dev, 0x02, 0x00, 0x00); in sd_start()
793 reg_w(gspca_dev, 0x00, 0x850a, 0x0001); in sd_start()
795 err = spca50x_setup_qtable(gspca_dev, in sd_start()
800 reg_w(gspca_dev, 0x00, 0x8880, 3); in sd_start()
801 reg_w(gspca_dev, 0x00, 0x800a, 0x00); in sd_start()
803 reg_w(gspca_dev, 0x00, 0x870a, 0x04); in sd_start()
805 spca500_setmode(gspca_dev, xmult, ymult); in sd_start()
808 reg_w(gspca_dev, 0x00, 0x8000, 0x0004); in sd_start()
809 reg_r_wait(gspca_dev, 0, 0x8000, 0x44); in sd_start()
811 reg_r(gspca_dev, 0x816b, 1); in sd_start()
812 Data = gspca_dev->usb_buf[0]; in sd_start()
813 reg_w(gspca_dev, 0x00, 0x816b, Data); in sd_start()
814 write_vector(gspca_dev, Clicksmart510_defaults); in sd_start()
820 static void sd_stopN(struct gspca_dev *gspca_dev) in sd_stopN() argument
822 reg_w(gspca_dev, 0, 0x8003, 0x00); in sd_stopN()
825 reg_w(gspca_dev, 0x00, 0x8000, 0x0004); in sd_stopN()
826 reg_r(gspca_dev, 0x8000, 1); in sd_stopN()
828 gspca_dev->usb_buf[0]); in sd_stopN()
831 static void sd_pkt_scan(struct gspca_dev *gspca_dev, in sd_pkt_scan() argument
835 struct sd *sd = (struct sd *) gspca_dev; in sd_pkt_scan()
845 gspca_frame_add(gspca_dev, LAST_PACKET, in sd_pkt_scan()
849 gspca_frame_add(gspca_dev, FIRST_PACKET, in sd_pkt_scan()
863 gspca_frame_add(gspca_dev, INTER_PACKET, in sd_pkt_scan()
872 gspca_frame_add(gspca_dev, INTER_PACKET, data, len); in sd_pkt_scan()
875 static void setbrightness(struct gspca_dev *gspca_dev, s32 val) in setbrightness() argument
877 reg_w(gspca_dev, 0x00, 0x8167, in setbrightness()
881 static void setcontrast(struct gspca_dev *gspca_dev, s32 val) in setcontrast() argument
883 reg_w(gspca_dev, 0x00, 0x8168, val); in setcontrast()
886 static void setcolors(struct gspca_dev *gspca_dev, s32 val) in setcolors() argument
888 reg_w(gspca_dev, 0x00, 0x8169, val); in setcolors()
893 struct gspca_dev *gspca_dev = in sd_s_ctrl() local
894 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in sd_s_ctrl()
896 gspca_dev->usb_err = 0; in sd_s_ctrl()
898 if (!gspca_dev->streaming) in sd_s_ctrl()
903 setbrightness(gspca_dev, ctrl->val); in sd_s_ctrl()
906 setcontrast(gspca_dev, ctrl->val); in sd_s_ctrl()
909 setcolors(gspca_dev, ctrl->val); in sd_s_ctrl()
912 return gspca_dev->usb_err; in sd_s_ctrl()
919 static int sd_init_controls(struct gspca_dev *gspca_dev) in sd_init_controls() argument
921 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; in sd_init_controls()
923 gspca_dev->vdev.ctrl_handler = hdl; in sd_init_controls()