Lines Matching refs:gspca_dev
36 struct gspca_dev gspca_dev; /* !! must be the first item */ member
54 static u8 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, 1, in reg_r()
71 gspca_dev->usb_err = ret; in reg_r()
74 return gspca_dev->usb_buf[0]; in reg_r()
78 static void reg_w(struct gspca_dev *gspca_dev, in reg_w() argument
81 struct usb_device *dev = gspca_dev->dev; in reg_w()
84 if (gspca_dev->usb_err < 0) in reg_w()
96 gspca_dev->usb_err = ret; in reg_w()
101 static void rcv_val(struct gspca_dev *gspca_dev, in rcv_val() argument
104 struct usb_device *dev = gspca_dev->dev; in rcv_val()
107 reg_w(gspca_dev, 0x634, (ads >> 16) & 0xff); in rcv_val()
108 reg_w(gspca_dev, 0x635, (ads >> 8) & 0xff); in rcv_val()
109 reg_w(gspca_dev, 0x636, ads & 0xff); in rcv_val()
110 reg_w(gspca_dev, 0x637, 0); in rcv_val()
111 reg_w(gspca_dev, 0x638, 4); /* len & 0xff */ in rcv_val()
112 reg_w(gspca_dev, 0x639, 0); /* len >> 8 */ in rcv_val()
113 reg_w(gspca_dev, 0x63a, 0); in rcv_val()
114 reg_w(gspca_dev, 0x63b, 0); in rcv_val()
115 reg_w(gspca_dev, 0x630, 5); in rcv_val()
116 if (gspca_dev->usb_err < 0) in rcv_val()
120 gspca_dev->usb_buf, in rcv_val()
126 gspca_dev->usb_err = ret; in rcv_val()
131 static void snd_val(struct gspca_dev *gspca_dev, in snd_val() argument
135 struct usb_device *dev = gspca_dev->dev; in snd_val()
140 reg_r(gspca_dev, 0x0704); in snd_val()
141 seq = reg_r(gspca_dev, 0x0705); in snd_val()
142 reg_r(gspca_dev, 0x0650); in snd_val()
143 reg_w(gspca_dev, 0x654, seq); in snd_val()
145 reg_w(gspca_dev, 0x654, (ads >> 16) & 0xff); in snd_val()
147 reg_w(gspca_dev, 0x655, (ads >> 8) & 0xff); in snd_val()
148 reg_w(gspca_dev, 0x656, ads & 0xff); in snd_val()
149 reg_w(gspca_dev, 0x657, 0); in snd_val()
150 reg_w(gspca_dev, 0x658, 0x04); /* size */ in snd_val()
151 reg_w(gspca_dev, 0x659, 0); in snd_val()
152 reg_w(gspca_dev, 0x65a, 0); in snd_val()
153 reg_w(gspca_dev, 0x65b, 0); in snd_val()
154 reg_w(gspca_dev, 0x650, 5); in snd_val()
155 if (gspca_dev->usb_err < 0) in snd_val()
157 gspca_dev->usb_buf[0] = val >> 24; in snd_val()
158 gspca_dev->usb_buf[1] = val >> 16; in snd_val()
159 gspca_dev->usb_buf[2] = val >> 8; in snd_val()
160 gspca_dev->usb_buf[3] = val; in snd_val()
163 gspca_dev->usb_buf, in snd_val()
169 gspca_dev->usb_err = ret; in snd_val()
174 reg_w(gspca_dev, 0x705, seq); in snd_val()
180 static void set_par(struct gspca_dev *gspca_dev, in set_par() argument
183 snd_val(gspca_dev, 0x003f08, parval); in set_par()
186 static void setbrightness(struct gspca_dev *gspca_dev, s32 val) in setbrightness() argument
192 set_par(gspca_dev, parval); in setbrightness()
195 static void setcontrast(struct gspca_dev *gspca_dev, s32 val) in setcontrast() argument
201 set_par(gspca_dev, parval); in setcontrast()
204 static void setcolors(struct gspca_dev *gspca_dev, s32 val) in setcolors() argument
210 set_par(gspca_dev, parval); in setcolors()
213 static void setlightfreq(struct gspca_dev *gspca_dev, s32 val) in setlightfreq() argument
215 set_par(gspca_dev, val == 1 in setlightfreq()
221 static int sd_config(struct gspca_dev *gspca_dev, in sd_config() argument
224 gspca_dev->cam.cam_mode = vga_mode; in sd_config()
225 gspca_dev->cam.nmodes = ARRAY_SIZE(vga_mode); in sd_config()
230 static int sd_init(struct gspca_dev *gspca_dev) in sd_init() argument
235 usb_set_interface(gspca_dev->dev, gspca_dev->iface, 1); in sd_init()
236 ret = reg_r(gspca_dev, 0x0740); in sd_init()
237 if (gspca_dev->usb_err >= 0) { in sd_init()
240 gspca_dev->usb_err = -EIO; in sd_init()
243 return gspca_dev->usb_err; in sd_init()
247 static int sd_start(struct gspca_dev *gspca_dev) in sd_start() argument
249 struct sd *sd = (struct sd *) gspca_dev; in sd_start()
253 jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, in sd_start()
254 gspca_dev->pixfmt.width, in sd_start()
259 usb_set_interface(gspca_dev->dev, gspca_dev->iface, 1); in sd_start()
261 set_par(gspca_dev, 0x10000000); in sd_start()
262 set_par(gspca_dev, 0x00000000); in sd_start()
263 set_par(gspca_dev, 0x8002e001); in sd_start()
264 set_par(gspca_dev, 0x14000000); in sd_start()
265 if (gspca_dev->pixfmt.width > 320) in sd_start()
269 set_par(gspca_dev, value); in sd_start()
270 ret = usb_set_interface(gspca_dev->dev, in sd_start()
271 gspca_dev->iface, in sd_start()
272 gspca_dev->alt); in sd_start()
275 gspca_dev->iface, gspca_dev->alt); in sd_start()
276 gspca_dev->usb_err = ret; in sd_start()
279 reg_r(gspca_dev, 0x0630); in sd_start()
280 rcv_val(gspca_dev, 0x000020); /* << (value ff ff ff ff) */ in sd_start()
281 reg_r(gspca_dev, 0x0650); in sd_start()
282 snd_val(gspca_dev, 0x000020, 0xffffffff); in sd_start()
283 reg_w(gspca_dev, 0x0620, 0); in sd_start()
284 reg_w(gspca_dev, 0x0630, 0); in sd_start()
285 reg_w(gspca_dev, 0x0640, 0); in sd_start()
286 reg_w(gspca_dev, 0x0650, 0); in sd_start()
287 reg_w(gspca_dev, 0x0660, 0); in sd_start()
288 set_par(gspca_dev, 0x09800000); /* Red ? */ in sd_start()
289 set_par(gspca_dev, 0x0a800000); /* Green ? */ in sd_start()
290 set_par(gspca_dev, 0x0b800000); /* Blue ? */ in sd_start()
291 set_par(gspca_dev, 0x0d030000); /* Gamma ? */ in sd_start()
294 set_par(gspca_dev, 0x01000000); in sd_start()
295 set_par(gspca_dev, 0x01000000); in sd_start()
296 if (gspca_dev->usb_err >= 0) in sd_start()
298 gspca_dev->alt); in sd_start()
300 return gspca_dev->usb_err; in sd_start()
303 static void sd_stopN(struct gspca_dev *gspca_dev) in sd_stopN() argument
305 struct usb_device *dev = gspca_dev->dev; in sd_stopN()
307 set_par(gspca_dev, 0x02000000); in sd_stopN()
308 set_par(gspca_dev, 0x02000000); in sd_stopN()
309 usb_set_interface(dev, gspca_dev->iface, 1); in sd_stopN()
310 reg_r(gspca_dev, 0x0630); in sd_stopN()
311 rcv_val(gspca_dev, 0x000020); /* << (value ff ff ff ff) */ in sd_stopN()
312 reg_r(gspca_dev, 0x0650); in sd_stopN()
313 snd_val(gspca_dev, 0x000020, 0xffffffff); in sd_stopN()
314 reg_w(gspca_dev, 0x0620, 0); in sd_stopN()
315 reg_w(gspca_dev, 0x0630, 0); in sd_stopN()
316 reg_w(gspca_dev, 0x0640, 0); in sd_stopN()
317 reg_w(gspca_dev, 0x0650, 0); in sd_stopN()
318 reg_w(gspca_dev, 0x0660, 0); in sd_stopN()
322 static void sd_pkt_scan(struct gspca_dev *gspca_dev, in sd_pkt_scan() argument
326 struct sd *sd = (struct sd *) gspca_dev; in sd_pkt_scan()
339 gspca_frame_add(gspca_dev, LAST_PACKET, in sd_pkt_scan()
343 gspca_frame_add(gspca_dev, FIRST_PACKET, in sd_pkt_scan()
351 gspca_frame_add(gspca_dev, INTER_PACKET, data, len); in sd_pkt_scan()
356 struct gspca_dev *gspca_dev = in sd_s_ctrl() local
357 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in sd_s_ctrl()
359 gspca_dev->usb_err = 0; in sd_s_ctrl()
361 if (!gspca_dev->streaming) in sd_s_ctrl()
366 setbrightness(gspca_dev, ctrl->val); in sd_s_ctrl()
369 setcontrast(gspca_dev, ctrl->val); in sd_s_ctrl()
372 setcolors(gspca_dev, ctrl->val); in sd_s_ctrl()
375 setlightfreq(gspca_dev, ctrl->val); in sd_s_ctrl()
378 return gspca_dev->usb_err; in sd_s_ctrl()
385 static int sd_init_controls(struct gspca_dev *gspca_dev) in sd_init_controls() argument
387 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; in sd_init_controls()
389 gspca_dev->vdev.ctrl_handler = hdl; in sd_init_controls()