drivers/media/usb/gspca/m5602/m5602_core.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/gspca/m5602/m5602_core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/gspca/m5602/m5602_core.c- Extension
.c- Size
- 11158 bytes
- Lines
- 447
- 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
m5602_ov9650.hm5602_ov7660.hm5602_mt9m111.hm5602_po1030.hm5602_s5k83a.hm5602_s5k4aa.h
Detected Declarations
function m5602_read_bridgefunction m5602_write_bridgefunction m5602_wait_for_i2cfunction m5602_read_sensorfunction m5602_write_sensorfunction m5602_dump_bridgefunction m5602_probe_sensorfunction m5602_initfunction m5602_init_controlsfunction m5602_start_transferfunction m5602_urb_completefunction m5602_stop_transferfunction m5602_configurefunction m5602_probefunction m5602_disconnect
Annotated Snippet
if (cur_frame_len + len <= gspca_dev->pixfmt.sizeimage) {
gspca_dbg(gspca_dev, D_FRAM, "Continuing frame %d copying %d bytes\n",
sd->frame_count, len);
gspca_frame_add(gspca_dev, INTER_PACKET,
data, len);
} else {
/* Add the remaining data up to frame size */
gspca_frame_add(gspca_dev, INTER_PACKET, data,
gspca_dev->pixfmt.sizeimage - cur_frame_len);
}
}
}
static void m5602_stop_transfer(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
/* Run the sensor specific end transfer sequence */
if (sd->sensor->stop)
sd->sensor->stop(sd);
}
/* sub-driver description */
static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.config = m5602_configure,
.init = m5602_init,
.init_controls = m5602_init_controls,
.start = m5602_start_transfer,
.stopN = m5602_stop_transfer,
.pkt_scan = m5602_urb_complete
};
/* this function is called at probe time */
static int m5602_configure(struct gspca_dev *gspca_dev,
const struct usb_device_id *id)
{
struct sd *sd = (struct sd *) gspca_dev;
struct cam *cam;
int err;
cam = &gspca_dev->cam;
if (dump_bridge)
m5602_dump_bridge(sd);
/* Probe sensor */
err = m5602_probe_sensor(sd);
if (err)
goto fail;
return 0;
fail:
gspca_err(gspca_dev, "ALi m5602 webcam failed\n");
cam->cam_mode = NULL;
cam->nmodes = 0;
return err;
}
static int m5602_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
THIS_MODULE);
}
static void m5602_disconnect(struct usb_interface *intf)
{
struct gspca_dev *gspca_dev = usb_get_intfdata(intf);
struct sd *sd = (struct sd *) gspca_dev;
if (sd->sensor->disconnect)
sd->sensor->disconnect(sd);
gspca_disconnect(intf);
}
static struct usb_driver sd_driver = {
.name = MODULE_NAME,
.id_table = m5602_table,
.probe = m5602_probe,
#ifdef CONFIG_PM
.suspend = gspca_suspend,
.resume = gspca_resume,
.reset_resume = gspca_resume,
#endif
.disconnect = m5602_disconnect
Annotation
- Immediate include surface: `m5602_ov9650.h`, `m5602_ov7660.h`, `m5602_mt9m111.h`, `m5602_po1030.h`, `m5602_s5k83a.h`, `m5602_s5k4aa.h`.
- Detected declarations: `function m5602_read_bridge`, `function m5602_write_bridge`, `function m5602_wait_for_i2c`, `function m5602_read_sensor`, `function m5602_write_sensor`, `function m5602_dump_bridge`, `function m5602_probe_sensor`, `function m5602_init`, `function m5602_init_controls`, `function m5602_start_transfer`.
- 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.