drivers/media/usb/gspca/stv06xx/stv06xx.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/gspca/stv06xx/stv06xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/gspca/stv06xx/stv06xx.c- Extension
.c- Size
- 17362 bytes
- Lines
- 648
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/input.hstv06xx_sensor.h
Detected Declarations
function stv06xx_write_bridgefunction stv06xx_read_bridgefunction stv06xx_write_sensorfunction stv06xx_write_sensor_finishfunction stv06xx_write_sensor_bytesfunction stv06xx_write_sensor_wordsfunction stv06xx_read_sensorfunction stv06xx_dump_bridgefunction stv06xx_initfunction stv06xx_init_controlsfunction stv06xx_startfunction stv06xx_isoc_initfunction stv06xx_isoc_negofunction stv06xx_stopNfunction stv06xx_probe_errorfunction stv06xx_configfunction sd_probefunction sd_disconnect
Annotated Snippet
if (len < 4) {
gspca_dbg(gspca_dev, D_PACK, "Packet is smaller than 4 bytes\n");
return;
}
/* Capture the id */
id = (data[0] << 8) | data[1];
/* Capture the chunk length */
chunk_len = (data[2] << 8) | data[3];
gspca_dbg(gspca_dev, D_PACK, "Chunk id: %x, length: %d\n",
id, chunk_len);
data += 4;
len -= 4;
if (len < chunk_len) {
gspca_err(gspca_dev, "URB packet length is smaller than the specified chunk length\n");
gspca_dev->last_packet_type = DISCARD_PACKET;
return;
}
/* First byte seem to be 02=data 2nd byte is unknown??? */
if (sd->bridge == BRIDGE_ST6422 && (id & 0xff00) == 0x0200)
goto frame_data;
switch (id) {
case 0x0200:
case 0x4200:
frame_data:
gspca_dbg(gspca_dev, D_PACK, "Frame data packet detected\n");
if (sd->to_skip) {
int skip = (sd->to_skip < chunk_len) ?
sd->to_skip : chunk_len;
data += skip;
len -= skip;
chunk_len -= skip;
sd->to_skip -= skip;
}
gspca_frame_add(gspca_dev, INTER_PACKET,
data, chunk_len);
break;
case 0x8001:
case 0x8005:
case 0xc001:
case 0xc005:
gspca_dbg(gspca_dev, D_PACK, "Starting new frame\n");
/* Create a new frame, chunk length should be zero */
gspca_frame_add(gspca_dev, FIRST_PACKET,
NULL, 0);
if (sd->bridge == BRIDGE_ST6422)
sd->to_skip = gspca_dev->pixfmt.width * 4;
if (chunk_len)
gspca_err(gspca_dev, "Chunk length is non-zero on a SOF\n");
break;
case 0x8002:
case 0x8006:
case 0xc002:
gspca_dbg(gspca_dev, D_PACK, "End of frame detected\n");
/* Complete the last frame (if any) */
gspca_frame_add(gspca_dev, LAST_PACKET,
NULL, 0);
if (chunk_len)
gspca_err(gspca_dev, "Chunk length is non-zero on a EOF\n");
break;
case 0x0005:
gspca_dbg(gspca_dev, D_PACK, "Chunk 0x005 detected\n");
/* Unknown chunk with 11 bytes of data,
occurs just before end of each frame
in compressed mode */
break;
case 0x0100:
gspca_dbg(gspca_dev, D_PACK, "Chunk 0x0100 detected\n");
/* Unknown chunk with 2 bytes of data,
occurs 2-3 times per USB interrupt */
break;
case 0x42ff:
gspca_dbg(gspca_dev, D_PACK, "Chunk 0x42ff detected\n");
/* Special chunk seen sometimes on the ST6422 */
Annotation
- Immediate include surface: `linux/input.h`, `stv06xx_sensor.h`.
- Detected declarations: `function stv06xx_write_bridge`, `function stv06xx_read_bridge`, `function stv06xx_write_sensor`, `function stv06xx_write_sensor_finish`, `function stv06xx_write_sensor_bytes`, `function stv06xx_write_sensor_words`, `function stv06xx_read_sensor`, `function stv06xx_dump_bridge`, `function stv06xx_init`, `function stv06xx_init_controls`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.