Lines Matching +full:cam +full:- +full:0

1 // SPDX-License-Identifier: GPL-2.0-or-later
51 uint8_t obuf[0x400]; /* output buffer for control commands */
52 uint8_t ibuf[0x200]; /* input buffer for control commands */
55 #define MODE_640x480 0x0001
56 #define MODE_640x488 0x0002
57 #define MODE_1280x1024 0x0004
59 #define FORMAT_BAYER 0x0010
60 #define FORMAT_UYVY 0x0020
61 #define FORMAT_Y10B 0x0040
63 #define FPS_HIGH 0x0100
105 usb_sndctrlpipe(udev, 0), in kinect_write()
106 0x00, in kinect_write()
108 0, 0, data, wLength, CTRL_TIMEOUT); in kinect_write()
114 usb_rcvctrlpipe(udev, 0), in kinect_read()
115 0x00, in kinect_read()
117 0, 0, data, wLength, CTRL_TIMEOUT); in kinect_read()
124 struct usb_device *udev = gspca_dev->dev; in send_cmd()
126 uint8_t *obuf = sd->obuf; in send_cmd()
127 uint8_t *ibuf = sd->ibuf; in send_cmd()
131 if (cmd_len & 1 || cmd_len > (0x400 - sizeof(*chdr))) { in send_cmd()
132 pr_err("send_cmd: Invalid command length (0x%x)\n", cmd_len); in send_cmd()
133 return -1; in send_cmd()
136 chdr->magic[0] = 0x47; in send_cmd()
137 chdr->magic[1] = 0x4d; in send_cmd()
138 chdr->cmd = cpu_to_le16(cmd); in send_cmd()
139 chdr->tag = cpu_to_le16(sd->cam_tag); in send_cmd()
140 chdr->len = cpu_to_le16(cmd_len / 2); in send_cmd()
147 sd->cam_tag, cmd_len, res); in send_cmd()
148 if (res < 0) { in send_cmd()
154 actual_len = kinect_read(udev, ibuf, 0x200); in send_cmd()
155 } while (actual_len == 0); in send_cmd()
160 return actual_len < 0 ? actual_len : -EREMOTEIO; in send_cmd()
162 actual_len -= sizeof(*rhdr); in send_cmd()
164 if (rhdr->magic[0] != 0x52 || rhdr->magic[1] != 0x42) { in send_cmd()
166 rhdr->magic[0], rhdr->magic[1]); in send_cmd()
167 return -1; in send_cmd()
169 if (rhdr->cmd != chdr->cmd) { in send_cmd()
171 rhdr->cmd, chdr->cmd); in send_cmd()
172 return -1; in send_cmd()
174 if (rhdr->tag != chdr->tag) { in send_cmd()
176 rhdr->tag, chdr->tag); in send_cmd()
177 return -1; in send_cmd()
179 if (le16_to_cpu(rhdr->len) != (actual_len/2)) { in send_cmd()
181 le16_to_cpu(rhdr->len), (int)(actual_len/2)); in send_cmd()
182 return -1; in send_cmd()
193 sd->cam_tag++; in send_cmd()
205 cmd[0] = cpu_to_le16(reg); in write_register()
208 gspca_dbg(gspca_dev, D_USBO, "Write Reg 0x%04x <= 0x%02x\n", reg, data); in write_register()
209 res = send_cmd(gspca_dev, 0x03, cmd, 4, reply, 4); in write_register()
210 if (res < 0) in write_register()
214 res, reply[0], reply[1]); in write_register()
216 return 0; in write_register()
224 struct cam *cam; in sd_config_video() local
226 sd->cam_tag = 0; in sd_config_video()
228 sd->stream_flag = 0x80; in sd_config_video()
230 cam = &gspca_dev->cam; in sd_config_video()
232 cam->cam_mode = video_camera_mode; in sd_config_video()
233 cam->nmodes = ARRAY_SIZE(video_camera_mode); in sd_config_video()
235 gspca_dev->xfer_ep = 0x81; in sd_config_video()
237 #if 0 in sd_config_video()
239 cam->npkt = 15; in sd_config_video()
240 gspca_dev->pkt_size = 960 * 2; in sd_config_video()
243 return 0; in sd_config_video()
250 struct cam *cam; in sd_config_depth() local
252 sd->cam_tag = 0; in sd_config_depth()
254 sd->stream_flag = 0x70; in sd_config_depth()
256 cam = &gspca_dev->cam; in sd_config_depth()
258 cam->cam_mode = depth_camera_mode; in sd_config_depth()
259 cam->nmodes = ARRAY_SIZE(depth_camera_mode); in sd_config_depth()
261 gspca_dev->xfer_ep = 0x82; in sd_config_depth()
263 return 0; in sd_config_depth()
271 return 0; in sd_init()
282 mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv; in sd_start_video()
285 fmt_reg = 0x19; in sd_start_video()
286 res_reg = 0x1a; in sd_start_video()
287 fps_reg = 0x1b; in sd_start_video()
288 mode_val = 0x03; in sd_start_video()
290 fmt_reg = 0x0c; in sd_start_video()
291 res_reg = 0x0d; in sd_start_video()
292 fps_reg = 0x0e; in sd_start_video()
293 mode_val = 0x01; in sd_start_video()
298 fmt_val = 0x05; in sd_start_video()
300 fmt_val = 0x00; in sd_start_video()
303 res_val = 0x02; in sd_start_video()
305 res_val = 0x01; in sd_start_video()
308 fps_val = 0x1e; in sd_start_video()
310 fps_val = 0x0f; in sd_start_video()
313 /* turn off IR-reset function */ in sd_start_video()
314 write_register(gspca_dev, 0x105, 0x00); in sd_start_video()
317 write_register(gspca_dev, 0x05, 0x00); in sd_start_video()
327 write_register(gspca_dev, 0x13, 0x01); in sd_start_video()
328 write_register(gspca_dev, 0x14, 0x1e); in sd_start_video()
329 write_register(gspca_dev, 0x06, 0x02); in sd_start_video()
330 write_register(gspca_dev, 0x06, 0x00); in sd_start_video()
338 write_register(gspca_dev, 0x05, mode_val); in sd_start_video()
341 write_register(gspca_dev, 0x47, 0x00); in sd_start_video()
343 return 0; in sd_start_video()
348 /* turn off IR-reset function */ in sd_start_depth()
349 write_register(gspca_dev, 0x105, 0x00); in sd_start_depth()
352 write_register(gspca_dev, 0x06, 0x00); in sd_start_depth()
353 /* Depth Stream Format 0x03: 11 bit stream | 0x02: 10 bit */ in sd_start_depth()
354 write_register(gspca_dev, 0x12, 0x02); in sd_start_depth()
356 write_register(gspca_dev, 0x13, 0x01); in sd_start_depth()
357 /* Depth Framerate / 0x1e (30): 30 fps */ in sd_start_depth()
358 write_register(gspca_dev, 0x14, 0x1e); in sd_start_depth()
360 write_register(gspca_dev, 0x06, 0x02); in sd_start_depth()
361 /* disable depth hflip / LSB = 0: Smoothing Disabled */ in sd_start_depth()
362 write_register(gspca_dev, 0x17, 0x00); in sd_start_depth()
364 return 0; in sd_start_depth()
370 write_register(gspca_dev, 0x05, 0x00); in sd_stopN_video()
376 write_register(gspca_dev, 0x06, 0x00); in sd_stopN_depth()
385 int datalen = len - sizeof(*hdr); in sd_pkt_scan()
387 uint8_t sof = sd->stream_flag | 1; in sd_pkt_scan()
388 uint8_t mof = sd->stream_flag | 2; in sd_pkt_scan()
389 uint8_t eof = sd->stream_flag | 5; in sd_pkt_scan()
394 if (hdr->magic[0] != 'R' || hdr->magic[1] != 'B') { in sd_pkt_scan()
396 sd->stream_flag, hdr->magic[0], hdr->magic[1]); in sd_pkt_scan()
400 if (hdr->flag == sof) in sd_pkt_scan()
403 else if (hdr->flag == mof) in sd_pkt_scan()
406 else if (hdr->flag == eof) in sd_pkt_scan()
413 /* sub-driver description */
439 /* -- module initialisation -- */
441 {USB_DEVICE(0x045e, 0x02ae)},
442 {USB_DEVICE(0x045e, 0x02bf)},
448 /* -- device connect -- */
474 MODULE_PARM_DESC(depth_mode, "0=video 1=depth");