Lines Matching +full:- +full:alt
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (c) 2001 Jean-Fredric Clere, Nikolas Zimmermann, Georg Acher
4 * Mark Cave-Ayland, Carlo E Prelz, Dick Streefland
9 * P/N 861050-0010: Sensor HDCS1000 ASIC STV0600
10 * P/N 861050-0020: Sensor Photobit PB100 ASIC STV0600-1 - QuickCam Express
11 * P/N 861055: Sensor ST VV6410 ASIC STV0610 - LEGO cam
12 * P/N 861075-0040: Sensor HDCS1000 ASIC
13 * P/N 961179-0700: Sensor ST VV6410 ASIC STV0602 - Dexxa WebCam USB
14 * P/N 861040-0000: Sensor ST VV6410 ASIC STV0610 - QuickCam Web
33 struct usb_device *udev = sd->gspca_dev.dev; in stv06xx_write_bridge()
34 __u8 *buf = sd->gspca_dev.usb_buf; in stv06xx_write_bridge()
55 struct usb_device *udev = sd->gspca_dev.dev; in stv06xx_read_bridge()
56 __u8 *buf = sd->gspca_dev.usb_buf; in stv06xx_read_bridge()
74 if (sd->sensor->i2c_len == 2) { in stv06xx_write_sensor()
87 if (sd->bridge == BRIDGE_STV610) { in stv06xx_write_sensor_finish()
88 struct usb_device *udev = sd->gspca_dev.dev; in stv06xx_write_sensor_finish()
89 __u8 *buf = sd->gspca_dev.usb_buf; in stv06xx_write_sensor_finish()
104 struct usb_device *udev = sd->gspca_dev.dev; in stv06xx_write_sensor_bytes()
105 __u8 *buf = sd->gspca_dev.usb_buf; in stv06xx_write_sensor_bytes()
118 buf[0x20] = sd->sensor->i2c_addr; in stv06xx_write_sensor_bytes()
119 buf[0x21] = j - 1; /* Number of commands to send - 1 */ in stv06xx_write_sensor_bytes()
135 struct usb_device *udev = sd->gspca_dev.dev; in stv06xx_write_sensor_words()
136 __u8 *buf = sd->gspca_dev.usb_buf; in stv06xx_write_sensor_words()
151 buf[0x20] = sd->sensor->i2c_addr; in stv06xx_write_sensor_words()
152 buf[0x21] = j - 1; /* Number of commands to send - 1 */ in stv06xx_write_sensor_words()
168 struct usb_device *udev = sd->gspca_dev.dev; in stv06xx_read_sensor()
169 __u8 *buf = sd->gspca_dev.usb_buf; in stv06xx_read_sensor()
171 err = stv06xx_write_bridge(sd, STV_I2C_FLUSH, sd->sensor->i2c_flush); in stv06xx_read_sensor()
179 buf[0x20] = sd->sensor->i2c_addr; in stv06xx_read_sensor()
194 0x04, 0xc0, 0x1410, 0, buf, sd->sensor->i2c_len, in stv06xx_read_sensor()
196 if (sd->sensor->i2c_len == 2) in stv06xx_read_sensor()
233 pr_info("Register 0x%x is read-only\n", i); in stv06xx_dump_bridge()
251 err = sd->sensor->init(sd); in stv06xx_init()
253 if (dump_sensor && sd->sensor->dump) in stv06xx_init()
254 sd->sensor->dump(sd); in stv06xx_init()
266 gspca_dev->vdev.ctrl_handler = &gspca_dev->ctrl_handler; in stv06xx_init_controls()
267 return sd->sensor->init_controls(sd); in stv06xx_init_controls()
274 struct usb_host_interface *alt; in stv06xx_start() local
278 intf = usb_ifnum_to_if(sd->gspca_dev.dev, sd->gspca_dev.iface); in stv06xx_start()
279 alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt); in stv06xx_start()
280 if (!alt) { in stv06xx_start()
282 return -EIO; in stv06xx_start()
285 if (alt->desc.bNumEndpoints < 1) in stv06xx_start()
286 return -ENODEV; in stv06xx_start()
288 packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); in stv06xx_start()
294 err = sd->sensor->start(sd); in stv06xx_start()
313 struct usb_host_interface *alt; in stv06xx_isoc_init() local
316 intfc = gspca_dev->dev->actconfig->intf_cache[0]; in stv06xx_isoc_init()
318 if (intfc->num_altsetting < 2) in stv06xx_isoc_init()
319 return -ENODEV; in stv06xx_isoc_init()
321 alt = &intfc->altsetting[1]; in stv06xx_isoc_init()
323 if (alt->desc.bNumEndpoints < 1) in stv06xx_isoc_init()
324 return -ENODEV; in stv06xx_isoc_init()
327 alt->endpoint[0].desc.wMaxPacketSize = in stv06xx_isoc_init()
328 cpu_to_le16(sd->sensor->max_packet_size[gspca_dev->curr_mode]); in stv06xx_isoc_init()
336 struct usb_host_interface *alt; in stv06xx_isoc_nego() local
343 alt = &gspca_dev->dev->actconfig->intf_cache[0]->altsetting[1]; in stv06xx_isoc_nego()
344 packet_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize); in stv06xx_isoc_nego()
345 min_packet_size = sd->sensor->min_packet_size[gspca_dev->curr_mode]; in stv06xx_isoc_nego()
347 return -EIO; in stv06xx_isoc_nego()
349 packet_size -= 100; in stv06xx_isoc_nego()
352 alt->endpoint[0].desc.wMaxPacketSize = cpu_to_le16(packet_size); in stv06xx_isoc_nego()
354 ret = usb_set_interface(gspca_dev->dev, gspca_dev->iface, 1); in stv06xx_isoc_nego()
356 gspca_err(gspca_dev, "set alt 1 err %d\n", ret); in stv06xx_isoc_nego()
366 /* stop ISO-streaming */ in stv06xx_stopN()
371 err = sd->sensor->stop(sd); in stv06xx_stopN()
383 * 2-bytes identification, followed by 2-bytes that describe the chunk
385 * 8001/8005/C001/C005 - Begin new frame
386 * 8002/8006/C002/C006 - End frame
387 * 0200/4200 - Contains actual image data, bayer or compressed
388 * 0005 - 11 bytes of unknown data
389 * 0100 - 2 bytes of unknown data
419 len -= 4; in stv06xx_pkt_scan()
423 gspca_dev->last_packet_type = DISCARD_PACKET; in stv06xx_pkt_scan()
428 if (sd->bridge == BRIDGE_ST6422 && (id & 0xff00) == 0x0200) in stv06xx_pkt_scan()
437 if (sd->to_skip) { in stv06xx_pkt_scan()
438 int skip = (sd->to_skip < chunk_len) ? in stv06xx_pkt_scan()
439 sd->to_skip : chunk_len; in stv06xx_pkt_scan()
441 len -= skip; in stv06xx_pkt_scan()
442 chunk_len -= skip; in stv06xx_pkt_scan()
443 sd->to_skip -= skip; in stv06xx_pkt_scan()
460 if (sd->bridge == BRIDGE_ST6422) in stv06xx_pkt_scan()
461 sd->to_skip = gspca_dev->pixfmt.width * 4; in stv06xx_pkt_scan()
464 gspca_err(gspca_dev, "Chunk length is non-zero on a SOF\n"); in stv06xx_pkt_scan()
477 gspca_err(gspca_dev, "Chunk length is non-zero on a EOF\n"); in stv06xx_pkt_scan()
490 occurs 2-3 times per USB interrupt */ in stv06xx_pkt_scan()
502 len -= chunk_len; in stv06xx_pkt_scan()
511 int ret = -EINVAL; in sd_int_pkt_scan()
514 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1); in sd_int_pkt_scan()
515 input_sync(gspca_dev->input_dev); in sd_int_pkt_scan()
520 input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0); in sd_int_pkt_scan()
521 input_sync(gspca_dev->input_dev); in sd_int_pkt_scan()
532 /* sub-driver description */
556 sd->bridge = id->driver_info; in stv06xx_config()
557 gspca_dev->sd_desc = &sd_desc; in stv06xx_config()
562 sd->sensor = &stv06xx_sensor_st6422; in stv06xx_config()
563 if (!sd->sensor->probe(sd)) in stv06xx_config()
566 sd->sensor = &stv06xx_sensor_vv6410; in stv06xx_config()
567 if (!sd->sensor->probe(sd)) in stv06xx_config()
570 sd->sensor = &stv06xx_sensor_hdcs1x00; in stv06xx_config()
571 if (!sd->sensor->probe(sd)) in stv06xx_config()
574 sd->sensor = &stv06xx_sensor_hdcs1020; in stv06xx_config()
575 if (!sd->sensor->probe(sd)) in stv06xx_config()
578 sd->sensor = &stv06xx_sensor_pb0100; in stv06xx_config()
579 if (!sd->sensor->probe(sd)) in stv06xx_config()
582 sd->sensor = NULL; in stv06xx_config()
583 return -ENODEV; in stv06xx_config()
588 /* -- module initialisation -- */
600 /* -- device connect -- */
612 void *priv = sd->sensor_priv; in sd_disconnect()
615 sd->sensor = NULL; in sd_disconnect()