drivers/media/usb/gspca/spca501.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/gspca/spca501.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/gspca/spca501.c- Extension
.c- Size
- 51991 bytes
- Lines
- 2037
- 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 sdfunction reg_writefunction write_vectorfunction setbrightnessfunction setcontrastfunction setcolorsfunction setblue_balancefunction setred_balancefunction sd_configfunction sd_initfunction sd_startfunction sd_stopNfunction sd_stop0function sd_pkt_scanfunction sd_s_ctrlfunction sd_init_controlsfunction sd_probe
Annotated Snippet
struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */
unsigned short contrast;
__u8 brightness;
__u8 colors;
__u8 blue_balance;
__u8 red_balance;
char subtype;
#define Arowana300KCMOSCamera 0
#define IntelCreateAndShare 1
#define KodakDVC325 2
#define MystFromOriUnknownCamera 3
#define SmileIntlCamera 4
#define ThreeComHomeConnectLite 5
#define ViewQuestM318B 6
};
static const struct v4l2_pix_format vga_mode[] = {
{160, 120, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,
.bytesperline = 160,
.sizeimage = 160 * 120 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 2},
{320, 240, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,
.bytesperline = 320,
.sizeimage = 320 * 240 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 1},
{640, 480, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,
.bytesperline = 640,
.sizeimage = 640 * 480 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 0},
};
#define SPCA50X_REG_USB 0x2 /* spca505 501 */
/*
* Data to initialize a SPCA501. From a capture file provided by Bill Roehl
* With SPCA501 chip description
*/
#define CCDSP_SET /* set CCDSP parameters */
#define TG_SET /* set time generator set */
#undef DSPWIN_SET /* set DSP windows parameters */
#undef ALTER_GAMA /* Set alternate set to YUV transform coeffs. */
#define SPCA501_SNAPBIT 0x80
#define SPCA501_SNAPCTRL 0x10
/* Frame packet header offsets for the spca501 */
#define SPCA501_OFFSET_GPIO 1
#define SPCA501_OFFSET_TYPE 2
#define SPCA501_OFFSET_TURN3A 3
#define SPCA501_OFFSET_FRAMSEQ 4
#define SPCA501_OFFSET_COMPRESS 5
#define SPCA501_OFFSET_QUANT 6
#define SPCA501_OFFSET_QUANT2 7
#define SPCA501_OFFSET_DATA 8
#define SPCA501_PROP_COMP_ENABLE(d) ((d) & 1)
#define SPCA501_PROP_SNAP(d) ((d) & 0x40)
#define SPCA501_PROP_SNAP_CTRL(d) ((d) & 0x10)
#define SPCA501_PROP_COMP_THRESH(d) (((d) & 0x0e) >> 1)
#define SPCA501_PROP_COMP_QUANT(d) (((d) & 0x70) >> 4)
/* SPCA501 CCDSP control */
#define SPCA501_REG_CCDSP 0x01
/* SPCA501 control/status registers */
#define SPCA501_REG_CTLRL 0x02
/* registers for color correction and YUV transformation */
#define SPCA501_A11 0x08
#define SPCA501_A12 0x09
#define SPCA501_A13 0x0A
#define SPCA501_A21 0x0B
#define SPCA501_A22 0x0C
#define SPCA501_A23 0x0D
#define SPCA501_A31 0x0E
#define SPCA501_A32 0x0F
#define SPCA501_A33 0x10
/* Data for video camera initialization before capturing */
static const __u16 spca501_open_data[][3] = {
/* bmRequest,value,index */
{0x2, 0x50, 0x00}, /* C/S enable soft reset */
{0x2, 0x40, 0x00}, /* C/S disable soft reset */
{0x2, 0x02, 0x05}, /* C/S general purpose I/O data */
{0x2, 0x03, 0x05}, /* C/S general purpose I/O data */
#ifdef CCDSP_SET
Annotation
- Immediate include surface: `gspca.h`.
- Detected declarations: `struct sd`, `function reg_write`, `function write_vector`, `function setbrightness`, `function setcontrast`, `function setcolors`, `function setblue_balance`, `function setred_balance`, `function sd_config`, `function sd_init`.
- 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.