• Home
  • Raw
  • Download

Lines Matching refs:gspca_dev

21 	struct gspca_dev gspca_dev;	/* !! must be the first item */  member
49 static void reg_r(struct gspca_dev *gspca_dev, in reg_r() argument
57 struct usb_device *dev = gspca_dev->dev; in reg_r()
60 if (gspca_dev->usb_err < 0) in reg_r()
67 gspca_dev->usb_buf, len, in reg_r()
69 gspca_dbg(gspca_dev, D_USBI, "GET %02x 0000 %04x %02x\n", req, index, in reg_r()
70 gspca_dev->usb_buf[0]); in reg_r()
73 gspca_dev->usb_err = ret; in reg_r()
78 memset(gspca_dev->usb_buf, 0, USB_BUF_SZ); in reg_r()
82 static void reg_w(struct gspca_dev *gspca_dev, in reg_w() argument
87 struct usb_device *dev = gspca_dev->dev; in reg_w()
90 if (gspca_dev->usb_err < 0) in reg_w()
92 gspca_dbg(gspca_dev, D_USBO, "SET %02x %04x %04x\n", req, value, index); in reg_w()
100 gspca_dev->usb_err = ret; in reg_w()
104 static void reg_wb(struct gspca_dev *gspca_dev, in reg_wb() argument
110 struct usb_device *dev = gspca_dev->dev; in reg_wb()
113 if (gspca_dev->usb_err < 0) in reg_wb()
115 gspca_dbg(gspca_dev, D_USBO, "SET %02x %04x %04x %02x\n", in reg_wb()
117 gspca_dev->usb_buf[0] = byte; in reg_wb()
122 gspca_dev->usb_buf, 1, 500); in reg_wb()
125 gspca_dev->usb_err = ret; in reg_wb()
129 static void wait_status_0(struct gspca_dev *gspca_dev) in wait_status_0() argument
136 reg_r(gspca_dev, 0x21, 0x0000, 1); in wait_status_0()
137 if (gspca_dev->usb_buf[0] == 0) in wait_status_0()
142 gspca_err(gspca_dev, "wait_status_0 timeout\n"); in wait_status_0()
143 gspca_dev->usb_err = -ETIME; in wait_status_0()
146 static void wait_status_1(struct gspca_dev *gspca_dev) in wait_status_1() argument
152 reg_r(gspca_dev, 0x21, 0x0001, 1); in wait_status_1()
154 if (gspca_dev->usb_buf[0] == 1) { in wait_status_1()
155 reg_wb(gspca_dev, 0x21, 0x0000, 0x0001, 0x00); in wait_status_1()
156 reg_r(gspca_dev, 0x21, 0x0001, 1); in wait_status_1()
160 gspca_err(gspca_dev, "wait_status_1 timeout\n"); in wait_status_1()
161 gspca_dev->usb_err = -ETIME; in wait_status_1()
164 static void setbrightness(struct gspca_dev *gspca_dev, s32 val) in setbrightness() argument
166 reg_wb(gspca_dev, 0xc0, 0x0000, 0x00c0, val); in setbrightness()
169 static void setcontrast(struct gspca_dev *gspca_dev, s32 val) in setcontrast() argument
171 reg_wb(gspca_dev, 0xc1, 0x0000, 0x00c1, val); in setcontrast()
174 static void sethue(struct gspca_dev *gspca_dev, s32 val) in sethue() argument
176 reg_wb(gspca_dev, 0xc2, 0x0000, 0x0000, val); in sethue()
179 static void setcolor(struct gspca_dev *gspca_dev, s32 val) in setcolor() argument
181 reg_wb(gspca_dev, 0xc3, 0x0000, 0x00c3, val); in setcolor()
184 static void setsharpness(struct gspca_dev *gspca_dev, s32 val) in setsharpness() argument
186 reg_wb(gspca_dev, 0xc4, 0x0000, 0x00c4, val); in setsharpness()
190 static int sd_config(struct gspca_dev *gspca_dev, in sd_config() argument
193 gspca_dev->cam.cam_mode = vga_mode; in sd_config()
194 gspca_dev->cam.nmodes = ARRAY_SIZE(vga_mode); in sd_config()
195 gspca_dev->cam.npkt = 128; /* number of packets per ISOC message */ in sd_config()
202 static int sd_init(struct gspca_dev *gspca_dev) in sd_init() argument
204 reg_w(gspca_dev, 0x00, 0x0001, 0x2067); in sd_init()
205 reg_w(gspca_dev, 0x00, 0x00d0, 0x206b); in sd_init()
206 reg_w(gspca_dev, 0x00, 0x0000, 0x206c); in sd_init()
207 reg_w(gspca_dev, 0x00, 0x0001, 0x2069); in sd_init()
209 reg_w(gspca_dev, 0x00, 0x00c0, 0x206b); in sd_init()
210 reg_w(gspca_dev, 0x00, 0x0000, 0x206c); in sd_init()
211 reg_w(gspca_dev, 0x00, 0x0001, 0x2069); in sd_init()
213 reg_r(gspca_dev, 0x20, 0x0000, 1); in sd_init()
214 reg_r(gspca_dev, 0x20, 0x0000, 5); in sd_init()
215 reg_r(gspca_dev, 0x23, 0x0000, 64); in sd_init()
216 gspca_dbg(gspca_dev, D_PROBE, "%s%s\n", &gspca_dev->usb_buf[0x1c], in sd_init()
217 &gspca_dev->usb_buf[0x30]); in sd_init()
218 reg_r(gspca_dev, 0x23, 0x0001, 64); in sd_init()
219 return gspca_dev->usb_err; in sd_init()
223 static int sd_isoc_init(struct gspca_dev *gspca_dev) in sd_isoc_init() argument
227 reg_r(gspca_dev, 0x00, 0x2520, 1); in sd_isoc_init()
228 wait_status_0(gspca_dev); in sd_isoc_init()
229 reg_w(gspca_dev, 0xc5, 0x0003, 0x0000); in sd_isoc_init()
230 wait_status_1(gspca_dev); in sd_isoc_init()
232 wait_status_0(gspca_dev); in sd_isoc_init()
233 mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv; in sd_isoc_init()
234 reg_wb(gspca_dev, 0x25, 0x0000, 0x0004, mode); in sd_isoc_init()
235 reg_r(gspca_dev, 0x25, 0x0004, 1); in sd_isoc_init()
236 reg_wb(gspca_dev, 0x27, 0x0000, 0x0000, 0x06); /* 420 */ in sd_isoc_init()
237 reg_r(gspca_dev, 0x27, 0x0000, 1); in sd_isoc_init()
242 return gspca_dev->usb_err; in sd_isoc_init()
246 static int sd_start(struct gspca_dev *gspca_dev) in sd_start() argument
248 struct sd *sd = (struct sd *) gspca_dev; in sd_start()
251 jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, in sd_start()
252 gspca_dev->pixfmt.width, in sd_start()
258 reg_r(gspca_dev, 0x00, 0x2520, 1); in sd_start()
262 wait_status_0(gspca_dev); in sd_start()
263 reg_w(gspca_dev, 0x31, 0x0000, 0x0004); /* start request */ in sd_start()
264 wait_status_1(gspca_dev); in sd_start()
265 wait_status_0(gspca_dev); in sd_start()
269 return gspca_dev->usb_err; in sd_start()
272 static void sd_stopN(struct gspca_dev *gspca_dev) in sd_stopN() argument
275 wait_status_0(gspca_dev); in sd_stopN()
276 reg_w(gspca_dev, 0x31, 0x0000, 0x0000); /* stop request */ in sd_stopN()
277 wait_status_1(gspca_dev); in sd_stopN()
278 wait_status_0(gspca_dev); in sd_stopN()
282 static void add_packet(struct gspca_dev *gspca_dev, in add_packet() argument
291 gspca_frame_add(gspca_dev, INTER_PACKET, in add_packet()
299 gspca_frame_add(gspca_dev, INTER_PACKET, data, len); in add_packet()
302 static void sd_pkt_scan(struct gspca_dev *gspca_dev, in sd_pkt_scan() argument
306 struct sd *sd = (struct sd *) gspca_dev; in sd_pkt_scan()
320 add_packet(gspca_dev, data + 2, len - 2); in sd_pkt_scan()
321 gspca_frame_add(gspca_dev, LAST_PACKET, in sd_pkt_scan()
327 if (gspca_dev->last_packet_type == LAST_PACKET) in sd_pkt_scan()
328 gspca_frame_add(gspca_dev, FIRST_PACKET, in sd_pkt_scan()
330 add_packet(gspca_dev, data + 2, len - 2); in sd_pkt_scan()
334 gspca_dev->last_packet_type = DISCARD_PACKET; in sd_pkt_scan()
339 struct gspca_dev *gspca_dev = in sd_s_ctrl() local
340 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in sd_s_ctrl()
342 gspca_dev->usb_err = 0; in sd_s_ctrl()
344 if (!gspca_dev->streaming) in sd_s_ctrl()
349 setbrightness(gspca_dev, ctrl->val); in sd_s_ctrl()
352 setcontrast(gspca_dev, ctrl->val); in sd_s_ctrl()
355 sethue(gspca_dev, ctrl->val); in sd_s_ctrl()
358 setcolor(gspca_dev, ctrl->val); in sd_s_ctrl()
361 setsharpness(gspca_dev, ctrl->val); in sd_s_ctrl()
364 return gspca_dev->usb_err; in sd_s_ctrl()
371 static int sd_init_controls(struct gspca_dev *gspca_dev) in sd_init_controls() argument
373 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; in sd_init_controls()
375 gspca_dev->vdev.ctrl_handler = hdl; in sd_init_controls()