drivers/media/usb/gspca/dtcs033.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/gspca/dtcs033.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/gspca/dtcs033.c- Extension
.c- Size
- 12423 bytes
- Lines
- 431
- 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
gspca.h
Detected Declarations
struct dtcs033_usb_requestsstruct sdfunction reg_rwfunction reg_reqsfunction sd_configfunction sd_initfunction dtcs033_pkt_scanfunction dtcs033_setexposurefunction sd_s_ctrlfunction dtcs033_init_controlsfunction sd_probefunction dtcs033_startfunction dtcs033_stopN
Annotated Snippet
struct dtcs033_usb_requests {
u8 bRequestType;
u8 bRequest;
u16 wValue;
u16 wIndex;
u16 wLength;
};
/* send a usb request */
static void reg_rw(struct gspca_dev *gspca_dev,
u8 bRequestType, u8 bRequest,
u16 wValue, u16 wIndex, u16 wLength)
{
struct usb_device *udev = gspca_dev->dev;
int ret;
if (gspca_dev->usb_err < 0)
return;
ret = usb_control_msg(udev,
usb_rcvctrlpipe(udev, 0),
bRequest,
bRequestType,
wValue, wIndex,
gspca_dev->usb_buf, wLength, 500);
if (ret < 0) {
gspca_dev->usb_err = ret;
pr_err("usb_control_msg error %d\n", ret);
}
return;
}
/* send several usb in/out requests */
static int reg_reqs(struct gspca_dev *gspca_dev,
const struct dtcs033_usb_requests *preqs, int n_reqs)
{
int i = 0;
const struct dtcs033_usb_requests *preq;
while ((i < n_reqs) && (gspca_dev->usb_err >= 0)) {
preq = &preqs[i];
reg_rw(gspca_dev, preq->bRequestType, preq->bRequest,
preq->wValue, preq->wIndex, preq->wLength);
if (gspca_dev->usb_err < 0) {
gspca_err(gspca_dev, "usb error request no: %d / %d\n",
i, n_reqs);
} else if (preq->bRequestType & USB_DIR_IN) {
gspca_dbg(gspca_dev, D_STREAM,
"USB IN (%d) returned[%d] %3ph %s",
i,
preq->wLength,
gspca_dev->usb_buf,
preq->wLength > 3 ? "...\n" : "\n");
}
i++;
}
return gspca_dev->usb_err;
}
/* -- subdriver interface implementation -- */
#define DT_COLS (640)
static const struct v4l2_pix_format dtcs033_mode[] = {
/* raw Bayer patterned output */
{DT_COLS, 480, V4L2_PIX_FMT_GREY, V4L2_FIELD_NONE,
.bytesperline = DT_COLS,
.sizeimage = DT_COLS*480,
.colorspace = V4L2_COLORSPACE_SRGB,
},
/* this mode will demosaic the Bayer pattern */
{DT_COLS, 480, V4L2_PIX_FMT_SRGGB8, V4L2_FIELD_NONE,
.bytesperline = DT_COLS,
.sizeimage = DT_COLS*480,
.colorspace = V4L2_COLORSPACE_SRGB,
}
};
/* config called at probe time */
static int sd_config(struct gspca_dev *gspca_dev,
const struct usb_device_id *id)
{
gspca_dev->cam.cam_mode = dtcs033_mode;
gspca_dev->cam.nmodes = ARRAY_SIZE(dtcs033_mode);
Annotation
- Immediate include surface: `gspca.h`.
- Detected declarations: `struct dtcs033_usb_requests`, `struct sd`, `function reg_rw`, `function reg_reqs`, `function sd_config`, `function sd_init`, `function dtcs033_pkt_scan`, `function dtcs033_setexposure`, `function sd_s_ctrl`, `function dtcs033_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.