Lines Matching refs:gspca_dev
37 struct gspca_dev gspca_dev; /* !! must be the first item */ member
51 static void setbrightness(struct gspca_dev *gspca_dev, s32 val);
52 static void setcolors(struct gspca_dev *gspca_dev, s32 val);
53 static void setgamma(struct gspca_dev *gspca_dev, s32 val);
54 static void setsharpness(struct gspca_dev *gspca_dev, s32 val);
81 static void reg_w(struct gspca_dev *gspca_dev, in reg_w() argument
86 if (gspca_dev->usb_err < 0) in reg_w()
89 ret = usb_bulk_msg(gspca_dev->dev, in reg_w()
90 usb_sndbulkpipe(gspca_dev->dev, 4), in reg_w()
91 gspca_dev->usb_buf, in reg_w()
97 gspca_dev->usb_buf[0], ret); in reg_w()
98 gspca_dev->usb_err = ret; in reg_w()
102 static void mi_w(struct gspca_dev *gspca_dev, in mi_w() argument
106 gspca_dev->usb_buf[0] = 0x1f; in mi_w()
107 gspca_dev->usb_buf[1] = 0; /* control byte */ in mi_w()
108 gspca_dev->usb_buf[2] = addr; in mi_w()
109 gspca_dev->usb_buf[3] = value; in mi_w()
111 reg_w(gspca_dev, 4); in mi_w()
114 static void setbrightness(struct gspca_dev *gspca_dev, s32 val) in setbrightness() argument
116 gspca_dev->usb_buf[0] = 0x61; in setbrightness()
117 gspca_dev->usb_buf[1] = val; in setbrightness()
118 reg_w(gspca_dev, 2); in setbrightness()
121 static void setcolors(struct gspca_dev *gspca_dev, s32 val) in setcolors() argument
123 gspca_dev->usb_buf[0] = 0x5f; in setcolors()
124 gspca_dev->usb_buf[1] = val << 3; in setcolors()
125 gspca_dev->usb_buf[2] = ((val >> 2) & 0xf8) | 0x04; in setcolors()
126 reg_w(gspca_dev, 3); in setcolors()
129 static void setgamma(struct gspca_dev *gspca_dev, s32 val) in setgamma() argument
131 gspca_dev->usb_buf[0] = 0x06; in setgamma()
132 gspca_dev->usb_buf[1] = val * 0x40; in setgamma()
133 reg_w(gspca_dev, 2); in setgamma()
136 static void setsharpness(struct gspca_dev *gspca_dev, s32 val) in setsharpness() argument
138 gspca_dev->usb_buf[0] = 0x67; in setsharpness()
139 gspca_dev->usb_buf[1] = val * 4 + 3; in setsharpness()
140 reg_w(gspca_dev, 2); in setsharpness()
143 static void setilluminators(struct gspca_dev *gspca_dev, bool top, bool bottom) in setilluminators() argument
146 gspca_dev->usb_buf[0] = 0x22; in setilluminators()
148 gspca_dev->usb_buf[1] = 0x76; in setilluminators()
150 gspca_dev->usb_buf[1] = 0x7a; in setilluminators()
152 gspca_dev->usb_buf[1] = 0x7e; in setilluminators()
153 reg_w(gspca_dev, 2); in setilluminators()
158 struct gspca_dev *gspca_dev = in mars_s_ctrl() local
159 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in mars_s_ctrl()
160 struct sd *sd = (struct sd *)gspca_dev; in mars_s_ctrl()
162 gspca_dev->usb_err = 0; in mars_s_ctrl()
172 if (!gspca_dev->streaming) in mars_s_ctrl()
177 setbrightness(gspca_dev, ctrl->val); in mars_s_ctrl()
180 setcolors(gspca_dev, ctrl->val); in mars_s_ctrl()
183 setgamma(gspca_dev, ctrl->val); in mars_s_ctrl()
186 setilluminators(gspca_dev, sd->illum_top->val, in mars_s_ctrl()
190 setsharpness(gspca_dev, ctrl->val); in mars_s_ctrl()
195 return gspca_dev->usb_err; in mars_s_ctrl()
203 static int sd_init_controls(struct gspca_dev *gspca_dev) in sd_init_controls() argument
205 struct sd *sd = (struct sd *) gspca_dev; in sd_init_controls()
206 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; in sd_init_controls()
208 gspca_dev->vdev.ctrl_handler = hdl; in sd_init_controls()
233 static int sd_config(struct gspca_dev *gspca_dev, in sd_config() argument
238 cam = &gspca_dev->cam; in sd_config()
245 static int sd_init(struct gspca_dev *gspca_dev) in sd_init() argument
250 static int sd_start(struct gspca_dev *gspca_dev) in sd_start() argument
252 struct sd *sd = (struct sd *) gspca_dev; in sd_start()
257 jpeg_define(sd->jpeg_hdr, gspca_dev->pixfmt.height, in sd_start()
258 gspca_dev->pixfmt.width, in sd_start()
262 data = gspca_dev->usb_buf; in sd_start()
266 reg_w(gspca_dev, 2); in sd_start()
274 data[3] = gspca_dev->pixfmt.width / 8; /* h_size , reg 2 */ in sd_start()
275 data[4] = gspca_dev->pixfmt.height / 8; /* v_size , reg 3 */ in sd_start()
288 reg_w(gspca_dev, 11); in sd_start()
293 reg_w(gspca_dev, 2); in sd_start()
302 reg_w(gspca_dev, 2); in sd_start()
316 reg_w(gspca_dev, 6); in sd_start()
322 reg_w(gspca_dev, 3); in sd_start()
328 reg_w(gspca_dev, 4); in sd_start()
332 reg_w(gspca_dev, 2); in sd_start()
337 mi_w(gspca_dev, i + 1, mi_data[i]); in sd_start()
341 reg_w(gspca_dev, 2); in sd_start()
343 setilluminators(gspca_dev, v4l2_ctrl_g_ctrl(sd->illum_top), in sd_start()
346 return gspca_dev->usb_err; in sd_start()
349 static void sd_stopN(struct gspca_dev *gspca_dev) in sd_stopN() argument
351 struct sd *sd = (struct sd *) gspca_dev; in sd_stopN()
355 setilluminators(gspca_dev, false, false); in sd_stopN()
359 gspca_dev->usb_buf[0] = 1; in sd_stopN()
360 gspca_dev->usb_buf[1] = 0; in sd_stopN()
361 reg_w(gspca_dev, 2); in sd_stopN()
364 static void sd_pkt_scan(struct gspca_dev *gspca_dev, in sd_pkt_scan() argument
368 struct sd *sd = (struct sd *) gspca_dev; in sd_pkt_scan()
387 gspca_frame_add(gspca_dev, LAST_PACKET, in sd_pkt_scan()
391 gspca_frame_add(gspca_dev, FIRST_PACKET, in sd_pkt_scan()
399 gspca_frame_add(gspca_dev, INTER_PACKET, data, len); in sd_pkt_scan()