Lines Matching refs:gspca_dev

29 	struct gspca_dev gspca_dev;  /* !! must be the first item */  member
68 static int sn9c2028_command(struct gspca_dev *gspca_dev, u8 *command) in sn9c2028_command() argument
72 gspca_dbg(gspca_dev, D_USBO, "sending command %02x%02x%02x%02x%02x%02x\n", in sn9c2028_command()
76 memcpy(gspca_dev->usb_buf, command, 6); in sn9c2028_command()
77 rc = usb_control_msg(gspca_dev->dev, in sn9c2028_command()
78 usb_sndctrlpipe(gspca_dev->dev, 0), in sn9c2028_command()
81 2, 0, gspca_dev->usb_buf, 6, 500); in sn9c2028_command()
84 gspca_dev->usb_buf[0], rc); in sn9c2028_command()
91 static int sn9c2028_read1(struct gspca_dev *gspca_dev) in sn9c2028_read1() argument
95 rc = usb_control_msg(gspca_dev->dev, in sn9c2028_read1()
96 usb_rcvctrlpipe(gspca_dev->dev, 0), in sn9c2028_read1()
99 1, 0, gspca_dev->usb_buf, 1, 500); in sn9c2028_read1()
104 gspca_dbg(gspca_dev, D_USBI, "read1 response %02x\n", in sn9c2028_read1()
105 gspca_dev->usb_buf[0]); in sn9c2028_read1()
106 return gspca_dev->usb_buf[0]; in sn9c2028_read1()
109 static int sn9c2028_read4(struct gspca_dev *gspca_dev, u8 *reading) in sn9c2028_read4() argument
112 rc = usb_control_msg(gspca_dev->dev, in sn9c2028_read4()
113 usb_rcvctrlpipe(gspca_dev->dev, 0), in sn9c2028_read4()
116 4, 0, gspca_dev->usb_buf, 4, 500); in sn9c2028_read4()
121 memcpy(reading, gspca_dev->usb_buf, 4); in sn9c2028_read4()
122 gspca_dbg(gspca_dev, D_USBI, "read4 response %02x%02x%02x%02x\n", in sn9c2028_read4()
127 static int sn9c2028_long_command(struct gspca_dev *gspca_dev, u8 *command) in sn9c2028_long_command() argument
132 status = sn9c2028_command(gspca_dev, command); in sn9c2028_long_command()
138 status = sn9c2028_read1(gspca_dev); in sn9c2028_long_command()
145 status = sn9c2028_read4(gspca_dev, reading); in sn9c2028_long_command()
151 status = sn9c2028_read1(gspca_dev); in sn9c2028_long_command()
158 static int sn9c2028_short_command(struct gspca_dev *gspca_dev, u8 *command) in sn9c2028_short_command() argument
162 err_code = sn9c2028_command(gspca_dev, command); in sn9c2028_short_command()
166 err_code = sn9c2028_read1(gspca_dev); in sn9c2028_short_command()
174 static int sd_config(struct gspca_dev *gspca_dev, in sd_config() argument
177 struct sd *sd = (struct sd *) gspca_dev; in sd_config()
178 struct cam *cam = &gspca_dev->cam; in sd_config()
180 gspca_dbg(gspca_dev, D_PROBE, "SN9C2028 camera detected (vid/pid 0x%04X:0x%04X)\n", in sd_config()
187 gspca_dbg(gspca_dev, D_PROBE, "Genius Smart 300 camera\n"); in sd_config()
190 gspca_dbg(gspca_dev, D_PROBE, "Genius Videocam Live v2\n"); in sd_config()
193 gspca_dbg(gspca_dev, D_PROBE, "DC31VC\n"); in sd_config()
196 gspca_dbg(gspca_dev, D_PROBE, "Spy camera\n"); in sd_config()
199 gspca_dbg(gspca_dev, D_PROBE, "CIF camera\n"); in sd_config()
202 gspca_dbg(gspca_dev, D_PROBE, "Mini-Shotz ms-350 camera\n"); in sd_config()
205 gspca_dbg(gspca_dev, D_PROBE, "Vivitar 3350b type camera\n"); in sd_config()
225 static int sd_init(struct gspca_dev *gspca_dev) in sd_init() argument
229 sn9c2028_read1(gspca_dev); in sd_init()
230 sn9c2028_read1(gspca_dev); in sd_init()
231 status = sn9c2028_read1(gspca_dev); in sd_init()
236 static int run_start_commands(struct gspca_dev *gspca_dev, in run_start_commands() argument
244 err_code = sn9c2028_long_command(gspca_dev, in run_start_commands()
248 err_code = sn9c2028_short_command(gspca_dev, in run_start_commands()
252 err_code = sn9c2028_command(gspca_dev, in run_start_commands()
262 static void set_gain(struct gspca_dev *gspca_dev, s32 g) in set_gain() argument
264 struct sd *sd = (struct sd *) gspca_dev; in set_gain()
270 if (!gspca_dev->streaming) in set_gain()
276 run_start_commands(gspca_dev, genius_vcam_live_gain_cmds, in set_gain()
286 struct gspca_dev *gspca_dev = in sd_s_ctrl() local
287 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in sd_s_ctrl()
288 struct sd *sd = (struct sd *)gspca_dev; in sd_s_ctrl()
290 gspca_dev->usb_err = 0; in sd_s_ctrl()
292 if (!gspca_dev->streaming) in sd_s_ctrl()
298 set_gain(gspca_dev, ctrl->val); in sd_s_ctrl()
302 set_gain(gspca_dev, sd->gain->val); in sd_s_ctrl()
305 return gspca_dev->usb_err; in sd_s_ctrl()
313 static int sd_init_controls(struct gspca_dev *gspca_dev) in sd_init_controls() argument
315 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; in sd_init_controls()
316 struct sd *sd = (struct sd *)gspca_dev; in sd_init_controls()
318 gspca_dev->vdev.ctrl_handler = hdl; in sd_init_controls()
334 static int start_spy_cam(struct gspca_dev *gspca_dev) in start_spy_cam() argument
395 return run_start_commands(gspca_dev, spy_start_commands, in start_spy_cam()
399 static int start_cif_cam(struct gspca_dev *gspca_dev) in start_cif_cam() argument
472 return run_start_commands(gspca_dev, cif_start_commands, in start_cif_cam()
476 static int start_ms350_cam(struct gspca_dev *gspca_dev) in start_ms350_cam() argument
540 return run_start_commands(gspca_dev, ms350_start_commands, in start_ms350_cam()
544 static int start_genius_cam(struct gspca_dev *gspca_dev) in start_genius_cam() argument
612 return run_start_commands(gspca_dev, genius_start_commands, in start_genius_cam()
616 static int start_genius_videocam_live(struct gspca_dev *gspca_dev) in start_genius_videocam_live() argument
619 struct sd *sd = (struct sd *) gspca_dev; in start_genius_videocam_live()
718 r = run_start_commands(gspca_dev, genius_vcam_live_start_commands, in start_genius_videocam_live()
724 set_gain(gspca_dev, v4l2_ctrl_g_ctrl(sd->gain)); in start_genius_videocam_live()
729 static int start_vivitar_cam(struct gspca_dev *gspca_dev) in start_vivitar_cam() argument
807 return run_start_commands(gspca_dev, vivitar_start_commands, in start_vivitar_cam()
811 static int sd_start(struct gspca_dev *gspca_dev) in sd_start() argument
813 struct sd *sd = (struct sd *) gspca_dev; in sd_start()
820 err_code = start_genius_cam(gspca_dev); in sd_start()
823 err_code = start_genius_videocam_live(gspca_dev); in sd_start()
826 err_code = start_spy_cam(gspca_dev); in sd_start()
829 err_code = start_cif_cam(gspca_dev); in sd_start()
832 err_code = start_ms350_cam(gspca_dev); in sd_start()
835 err_code = start_vivitar_cam(gspca_dev); in sd_start()
847 static void sd_stopN(struct gspca_dev *gspca_dev) in sd_stopN() argument
852 result = sn9c2028_read1(gspca_dev); in sd_stopN()
854 gspca_err(gspca_dev, "Camera Stop read failed\n"); in sd_stopN()
858 result = sn9c2028_command(gspca_dev, data); in sd_stopN()
860 gspca_err(gspca_dev, "Camera Stop command failed\n"); in sd_stopN()
863 static void do_autogain(struct gspca_dev *gspca_dev, int avg_lum) in do_autogain() argument
865 struct sd *sd = (struct sd *) gspca_dev; in do_autogain()
886 static void sd_dqcallback(struct gspca_dev *gspca_dev) in sd_dqcallback() argument
888 struct sd *sd = (struct sd *) gspca_dev; in sd_dqcallback()
893 do_autogain(gspca_dev, sd->avg_lum); in sd_dqcallback()
899 static void sd_pkt_scan(struct gspca_dev *gspca_dev, in sd_pkt_scan() argument
905 sof = sn9c2028_find_sof(gspca_dev, data, len); in sd_pkt_scan()
915 gspca_frame_add(gspca_dev, LAST_PACKET, data, n); in sd_pkt_scan()
917 gspca_frame_add(gspca_dev, FIRST_PACKET, in sd_pkt_scan()
922 gspca_frame_add(gspca_dev, INTER_PACKET, data, len); in sd_pkt_scan()