drivers/media/usb/gspca/topro.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/gspca/topro.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/gspca/topro.c- Extension
.c- Size
- 196347 bytes
- Lines
- 4973
- 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 sdstruct cmdenum bridgesenum sensorsfunction jpeg_definefunction jpeg_set_qualfunction reg_wfunction reg_rfunction reg_w_buffunction i2c_wfunction i2c_w_buffunction i2c_rfunction bulk_wfunction probe_6810function cx0342_6810_initfunction soi763a_6810_initfunction setexposurefunction set_dqtfunction setqualityfunction setgammafunction setsharpnessfunction setautogainfunction set_resolutionfunction get_fr_idxfunction setframeratefunction setrgainfunction sd_setgainfunction setbgainfunction sd_configfunction sd_initfunction sd_isoc_initfunction set_ledfunction cx0342_6800_startfunction cx0342_6810_startfunction soi763a_6800_startfunction soi763a_6810_startfunction sd_startfunction sd_stopNfunction sd_pkt_scanfunction sd_dq_callbackfunction sd_get_streamparmfunction sd_set_streamparmfunction sd_set_jcompfunction sd_get_jcompfunction sd_s_ctrlfunction sd_init_controlsfunction sd_probe
Annotated Snippet
struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */
struct v4l2_ctrl *jpegqual;
struct v4l2_ctrl *sharpness;
struct v4l2_ctrl *gamma;
struct v4l2_ctrl *blue;
struct v4l2_ctrl *red;
u8 framerate;
u8 quality; /* webcam current JPEG quality (0..16) */
s8 ag_cnt; /* autogain / start counter for tp6810 */
#define AG_CNT_START 13 /* check gain every N frames */
u8 bridge;
u8 sensor;
u8 jpeg_hdr[JPEG_HDR_SZ];
};
enum bridges {
BRIDGE_TP6800,
BRIDGE_TP6810,
};
enum sensors {
SENSOR_CX0342,
SENSOR_SOI763A, /* ~= ov7630 / ov7648 */
NSENSORS
};
static const struct v4l2_pix_format vga_mode[] = {
{320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
.bytesperline = 320,
.sizeimage = 320 * 240 * 4 / 8 + 590,
.colorspace = V4L2_COLORSPACE_JPEG},
{640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
.bytesperline = 640,
.sizeimage = 640 * 480 * 3 / 8 + 590,
.colorspace = V4L2_COLORSPACE_JPEG}
};
/*
* JPEG quality
* index: webcam compression
* value: JPEG quality in %
*/
static const u8 jpeg_q[17] = {
88, 77, 67, 57, 55, 55, 45, 45, 36, 36, 30, 30, 26, 26, 22, 22, 94
};
#define BULK_OUT_SIZE 0x20
#if BULK_OUT_SIZE > USB_BUF_SZ
#error "USB buffer too small"
#endif
#define DEFAULT_FRAME_RATE 30
static const u8 rates[] = {30, 20, 15, 10, 7, 5};
static const struct framerates framerates[] = {
{
.rates = rates,
.nrates = ARRAY_SIZE(rates)
},
{
.rates = rates,
.nrates = ARRAY_SIZE(rates)
}
};
static const u8 rates_6810[] = {30, 15, 10, 7, 5};
static const struct framerates framerates_6810[] = {
{
.rates = rates_6810,
.nrates = ARRAY_SIZE(rates_6810)
},
{
.rates = rates_6810,
.nrates = ARRAY_SIZE(rates_6810)
}
};
/*
* webcam quality in %
* the last value is the ultra fine quality
*/
/* TP6800 register offsets */
#define TP6800_R10_SIF_TYPE 0x10
#define TP6800_R11_SIF_CONTROL 0x11
#define TP6800_R12_SIF_ADDR_S 0x12
#define TP6800_R13_SIF_TX_DATA 0x13
Annotation
- Immediate include surface: `gspca.h`.
- Detected declarations: `struct sd`, `struct cmd`, `enum bridges`, `enum sensors`, `function jpeg_define`, `function jpeg_set_qual`, `function reg_w`, `function reg_r`, `function reg_w_buf`, `function i2c_w`.
- 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.