drivers/media/usb/gspca/spca508.c

Source file repositories/reference/linux-study-clean/drivers/media/usb/gspca/spca508.c

File Facts

System
Linux kernel
Corpus path
drivers/media/usb/gspca/spca508.c
Extension
.c
Size
41019 bytes
Lines
1527
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct sd {
	struct gspca_dev gspca_dev;		/* !! must be the first item */

	u8 subtype;
#define CreativeVista 0
#define HamaUSBSightcam 1
#define HamaUSBSightcam2 2
#define IntelEasyPCCamera 3
#define MicroInnovationIC200 4
#define ViewQuestVQ110 5
};

static const struct v4l2_pix_format sif_mode[] = {
	{160, 120, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
		.bytesperline = 160,
		.sizeimage = 160 * 120 * 3 / 2,
		.colorspace = V4L2_COLORSPACE_SRGB,
		.priv = 3},
	{176, 144, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
		.bytesperline = 176,
		.sizeimage = 176 * 144 * 3 / 2,
		.colorspace = V4L2_COLORSPACE_SRGB,
		.priv = 2},
	{320, 240, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
		.bytesperline = 320,
		.sizeimage = 320 * 240 * 3 / 2,
		.colorspace = V4L2_COLORSPACE_SRGB,
		.priv = 1},
	{352, 288, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
		.bytesperline = 352,
		.sizeimage = 352 * 288 * 3 / 2,
		.colorspace = V4L2_COLORSPACE_SRGB,
		.priv = 0},
};

/* Frame packet header offsets for the spca508 */
#define SPCA508_OFFSET_DATA 37

/*
 * Initialization data: this is the first set-up data written to the
 * device (before the open data).
 */
static const u16 spca508_init_data[][2] = {
	{0x0000, 0x870b},

	{0x0020, 0x8112},	/* Video drop enable, ISO streaming disable */
	{0x0003, 0x8111},	/* Reset compression & memory */
	{0x0000, 0x8110},	/* Disable all outputs */
	/* READ {0x0000, 0x8114} -> 0000: 00  */
	{0x0000, 0x8114},	/* SW GPIO data */
	{0x0008, 0x8110},	/* Enable charge pump output */
	{0x0002, 0x8116},	/* 200 kHz pump clock */
	/* UNKNOWN DIRECTION (URB_FUNCTION_SELECT_INTERFACE:) */
	{0x0003, 0x8111},	/* Reset compression & memory */
	{0x0000, 0x8111},	/* Normal mode (not reset) */
	{0x0098, 0x8110},
		/* Enable charge pump output, sync.serial,external 2x clock */
	{0x000d, 0x8114},	/* SW GPIO data */
	{0x0002, 0x8116},	/* 200 kHz pump clock */
	{0x0020, 0x8112},	/* Video drop enable, ISO streaming disable */
/* --------------------------------------- */
	{0x000f, 0x8402},	/* memory bank */
	{0x0000, 0x8403},	/* ... address */
/* --------------------------------------- */
/* 0x88__ is Synchronous Serial Interface. */
/* TBD: This table could be expressed more compactly */
/* using spca508_write_i2c_vector(). */
/* TBD: Should see if the values in spca50x_i2c_data */
/* would work with the VQ110 instead of the values */
/* below. */
	{0x00c0, 0x8804},	/* SSI slave addr */
	{0x0008, 0x8802},	/* 375 Khz SSI clock */
	/* READ { 0x0001, 0x8803 } -> 0000: 00  */
	/* READ { 0x0001, 0x8802 } -> 0000: 08  */
	{0x0008, 0x8802},	/* 375 Khz SSI clock */
	{0x0012, 0x8801},	/* SSI reg addr */
	{0x0080, 0x8800},	/* SSI data to write */
	/* READ { 0x0001, 0x8803 } -> 0000: 00  */
	/* READ { 0x0001, 0x8803 } -> 0000: 00  */
	/* READ { 0x0001, 0x8802 } -> 0000: 08  */
	{0x0008, 0x8802},	/* 375 Khz SSI clock */
	{0x0012, 0x8801},	/* SSI reg addr */
	{0x0000, 0x8800},	/* SSI data to write */
	/* READ { 0x0001, 0x8803 } -> 0000: 00  */
	/* READ { 0x0001, 0x8803 } -> 0000: 00  */
	/* READ { 0x0001, 0x8802 } -> 0000: 08  */
	{0x0008, 0x8802},	/* 375 Khz SSI clock */
	{0x0011, 0x8801},	/* SSI reg addr */
	{0x0040, 0x8800},	/* SSI data to write */
	/* READ { 0x0001, 0x8803 } -> 0000: 00  */

Annotation

Implementation Notes