Lines Matching +full:li +full:- +full:ion

1 // SPDX-License-Identifier: GPL-2.0-or-later
14 * Thomas Kaiser <thomas@kaiser-linux.li>
21 * Thomas Kaiser <thomas@kaiser-linux.li> and
63 MODULE_DESCRIPTION("GSPCA/Mars-Semi MR97310A USB Camera Driver");
67 static int force_sensor_type = -1;
69 MODULE_PARM_DESC(force_sensor_type, "Force sensor type (-1 (auto), 0 or 1)");
122 /* the bytes to write are in gspca_dev->usb_buf */
127 rc = usb_bulk_msg(gspca_dev->dev, in mr_write()
128 usb_sndbulkpipe(gspca_dev->dev, 4), in mr_write()
129 gspca_dev->usb_buf, len, NULL, 500); in mr_write()
132 gspca_dev->usb_buf[0], rc); in mr_write()
136 /* the bytes are read into gspca_dev->usb_buf */
141 rc = usb_bulk_msg(gspca_dev->dev, in mr_read()
142 usb_rcvbulkpipe(gspca_dev->dev, 3), in mr_read()
143 gspca_dev->usb_buf, len, NULL, 500); in mr_read()
146 gspca_dev->usb_buf[0], rc); in mr_read()
153 gspca_dev->usb_buf[0] = 0x1f; in sensor_write_reg()
154 gspca_dev->usb_buf[1] = flags; in sensor_write_reg()
155 gspca_dev->usb_buf[2] = reg; in sensor_write_reg()
156 memcpy(gspca_dev->usb_buf + 3, data, len); in sensor_write_reg()
183 if (sd->cam_type == CAM_TYPE_CIF) { in sensor_write1()
185 confirm_reg = sd->sensor_type ? 0x13 : 0x11; in sensor_write1()
205 gspca_dev->usb_buf[0] = reg; in cam_get_response16()
217 gspca_dev->usb_buf[0], in cam_get_response16()
218 gspca_dev->usb_buf[1], in cam_get_response16()
219 gspca_dev->usb_buf[2]); in cam_get_response16()
226 __u8 *data = gspca_dev->usb_buf; in zero_the_pointer()
309 gspca_dev->usb_buf[0] = 0x01; in stream_start()
310 gspca_dev->usb_buf[1] = 0x01; in stream_start()
316 gspca_dev->usb_buf[0] = 0x01; in stream_stop()
317 gspca_dev->usb_buf[1] = 0x00; in stream_stop()
324 gspca_dev->usb_buf[0] = 0x19; in lcd_stop()
325 gspca_dev->usb_buf[1] = 0x54; in lcd_stop()
332 gspca_dev->usb_buf[0] = 0x00; in isoc_enable()
333 gspca_dev->usb_buf[1] = 0x4d; /* ISOC transferring enable... */ in isoc_enable()
345 cam = &gspca_dev->cam; in sd_config()
346 cam->cam_mode = vga_mode; in sd_config()
347 cam->nmodes = ARRAY_SIZE(vga_mode); in sd_config()
348 sd->do_lcd_stop = 0; in sd_config()
371 if (id->idProduct == 0x0110 || id->idProduct == 0x010e) { in sd_config()
372 sd->cam_type = CAM_TYPE_CIF; in sd_config()
373 cam->nmodes--; in sd_config()
384 * Name sd->sensor_type reported by in sd_config()
386 * Sakar 56379 Spy-shot 0 T. Kilgore in sd_config()
391 * Elta-Media 8212dc 1 T. Kaiser in sd_config()
395 switch (gspca_dev->usb_buf[0]) { in sd_config()
397 sd->sensor_type = 0; in sd_config()
400 sd->sensor_type = 1; in sd_config()
404 gspca_dev->usb_buf[1]); in sd_config()
405 return -ENODEV; in sd_config()
408 sd->sensor_type); in sd_config()
410 sd->cam_type = CAM_TYPE_VGA; in sd_config()
417 * Name gspca_dev->usb_buf[] sd->sensor_type in sd_config()
418 * sd->do_lcd_stop in sd_config()
420 * ION digital 0300 0 1 in sd_config()
421 * Argus DC-1620 0450 1 0 in sd_config()
431 sd->sensor_type = 1; in sd_config()
432 sd->do_lcd_stop = 0; in sd_config()
433 sd->adj_colors = 0; in sd_config()
434 if (gspca_dev->usb_buf[0] == 0x01) { in sd_config()
435 sd->sensor_type = 2; in sd_config()
436 } else if ((gspca_dev->usb_buf[0] != 0x03) && in sd_config()
437 (gspca_dev->usb_buf[0] != 0x04)) { in sd_config()
439 gspca_dev->usb_buf[0]); in sd_config()
444 if ((gspca_dev->usb_buf[0] == 0x03) && in sd_config()
445 (gspca_dev->usb_buf[1] == 0x50)) in sd_config()
446 sd->adj_colors = 1; in sd_config()
447 if (gspca_dev->usb_buf[0] == 0x04) { in sd_config()
448 sd->do_lcd_stop = 1; in sd_config()
449 switch (gspca_dev->usb_buf[1]) { in sd_config()
451 sd->sensor_type = 0; in sd_config()
459 gspca_dev->usb_buf[1]); in sd_config()
465 sd->sensor_type); in sd_config()
470 if (force_sensor_type != -1) { in sd_config()
471 sd->sensor_type = !!force_sensor_type; in sd_config()
473 sd->sensor_type); in sd_config()
488 __u8 *data = gspca_dev->usb_buf; in start_cif_cam()
507 if (sd->sensor_type) in start_cif_cam()
510 switch (gspca_dev->pixfmt.width) { in start_cif_cam()
519 data[8] = 0x1a + sd->sensor_type; /* reg 7, V start */ in start_cif_cam()
528 data[8] = 0x06 - sd->sensor_type; /* reg 7, V start */ in start_cif_cam()
535 if (!sd->sensor_type) { in start_cif_cam()
556 } else { /* sd->sensor_type = 1 */ in start_cif_cam()
575 /* Without this command the cam won't work with USB-UHCI */ in start_cif_cam()
576 gspca_dev->usb_buf[0] = 0x0a; in start_cif_cam()
577 gspca_dev->usb_buf[1] = 0x00; in start_cif_cam()
590 __u8 *data = gspca_dev->usb_buf; in start_vga_cam()
598 if (!sd->sensor_type) { in start_vga_cam()
602 if (sd->sensor_type == 2) { in start_vga_cam()
607 switch (gspca_dev->pixfmt.width) { in start_vga_cam()
620 if (sd->sensor_type == 2) { in start_vga_cam()
624 if (sd->do_lcd_stop) in start_vga_cam()
636 if (sd->do_lcd_stop) in start_vga_cam()
645 if (!sd->sensor_type) { in start_vga_cam()
656 } else if (sd->sensor_type == 1) { in start_vga_cam()
682 if (sd->adj_colors) in start_vga_cam()
745 sd->sof_read = 0; in sd_start()
759 if (sd->cam_type == CAM_TYPE_CIF) { in sd_start()
777 if (sd->do_lcd_stop) in sd_stopN()
789 if (sd->cam_type == CAM_TYPE_VGA) { in setbrightness()
799 val = 257 - val; in setbrightness()
802 if (sd->do_lcd_stop) in setbrightness()
814 if (sd->cam_type == CAM_TYPE_CIF && sd->sensor_type == 1) { in setexposure()
816 so scale 0 - 4095 to 300 - 4095 */ in setexposure()
820 } else if (sd->sensor_type == 2) { in setexposure()
829 register setting (which goes from 0 - 511). in setexposure()
831 Note our 0 - 4095 exposure is mapped to 0 - 511 in setexposure()
836 if (clockdiv < min_clockdiv && gspca_dev->pixfmt.width >= 320) in setexposure()
841 if (sd->cam_type == CAM_TYPE_VGA && clockdiv < 4) in setexposure()
844 /* Frame exposure time in ms = 1000 * clockdiv / 60 -> in setexposure()
845 exposure = (sd->exposure / 8) * 511 / (1000 * clockdiv / 60) */ in setexposure()
851 exposure = 511 - exposure; in setexposure()
865 if (sd->cam_type == CAM_TYPE_CIF && sd->sensor_type == 1) in setgain()
867 else if (sd->cam_type == CAM_TYPE_VGA && sd->sensor_type == 2) in setgain()
884 container_of(ctrl->handler, struct gspca_dev, ctrl_handler); in sd_s_ctrl()
887 gspca_dev->usb_err = 0; in sd_s_ctrl()
889 if (!gspca_dev->streaming) in sd_s_ctrl()
892 switch (ctrl->id) { in sd_s_ctrl()
894 setbrightness(gspca_dev, ctrl->val); in sd_s_ctrl()
897 setcontrast(gspca_dev, ctrl->val); in sd_s_ctrl()
900 setexposure(gspca_dev, sd->exposure->val, in sd_s_ctrl()
901 sd->min_clockdiv ? sd->min_clockdiv->val : 0); in sd_s_ctrl()
904 setgain(gspca_dev, ctrl->val); in sd_s_ctrl()
907 return gspca_dev->usb_err; in sd_s_ctrl()
917 struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; in sd_init_controls()
936 gspca_dev->vdev.ctrl_handler = hdl; in sd_init_controls()
940 if (sd->cam_type == CAM_TYPE_CIF) { in sd_init_controls()
942 if (sd->sensor_type == 0) in sd_init_controls()
948 if (sd->sensor_type == 0) in sd_init_controls()
950 else if (sd->sensor_type == 2) in sd_init_controls()
952 else if (sd->do_lcd_stop) in sd_init_controls()
966 * but it does control brightness. The values are 0 - 15 only, and in sd_init_controls()
971 V4L2_CID_BRIGHTNESS, -254, 255, 1, in sd_init_controls()
990 sd->exposure = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, in sd_init_controls()
994 sd->min_clockdiv = v4l2_ctrl_new_custom(hdl, &clockdiv, NULL); in sd_init_controls()
996 if (hdl->error) { in sd_init_controls()
998 return hdl->error; in sd_init_controls()
1001 v4l2_ctrl_cluster(2, &sd->exposure); in sd_init_controls()
1015 sof = pac_find_sof(gspca_dev, &sd->sof_read, data, len); in sd_pkt_scan()
1020 n = sof - data; in sd_pkt_scan()
1022 n -= sizeof pac_sof_marker; in sd_pkt_scan()
1030 len -= sof - data; in sd_pkt_scan()
1036 /* sub-driver description */
1047 /* -- module initialisation -- */
1057 /* -- device connect -- */