drivers/media/usb/gspca/sonixj.c

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

File Facts

System
Linux kernel
Corpus path
drivers/media/usb/gspca/sonixj.c
Extension
.c
Size
95058 bytes
Lines
2982
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 */

	atomic_t avg_lum;
	struct v4l2_ctrl *brightness;
	struct v4l2_ctrl *contrast;
	struct v4l2_ctrl *saturation;
	struct { /* red/blue balance control cluster */
		struct v4l2_ctrl *red_bal;
		struct v4l2_ctrl *blue_bal;
	};
	struct { /* hflip/vflip control cluster */
		struct v4l2_ctrl *vflip;
		struct v4l2_ctrl *hflip;
	};
	struct v4l2_ctrl *gamma;
	struct v4l2_ctrl *illum;
	struct v4l2_ctrl *sharpness;
	struct v4l2_ctrl *freq;
	u32 exposure;

	struct work_struct work;

	u32 pktsz;			/* (used by pkt_scan) */
	u16 npkt;
	s8 nchg;
	s8 short_mark;

	u8 quality;			/* image quality */
#define QUALITY_MIN 25
#define QUALITY_MAX 90
#define QUALITY_DEF 70

	u8 reg01;
	u8 reg17;
	u8 reg18;
	u8 flags;

	s8 ag_cnt;
#define AG_CNT_START 13

	u8 bridge;
#define BRIDGE_SN9C102P 0
#define BRIDGE_SN9C105 1
#define BRIDGE_SN9C110 2
#define BRIDGE_SN9C120 3
	u8 sensor;			/* Type of image sensor chip */
	u8 i2c_addr;

	u8 jpeg_hdr[JPEG_HDR_SZ];
};
enum sensors {
	SENSOR_ADCM1700,
	SENSOR_GC0307,
	SENSOR_HV7131R,
	SENSOR_MI0360,
	SENSOR_MI0360B,
	SENSOR_MO4000,
	SENSOR_MT9V111,
	SENSOR_OM6802,
	SENSOR_OV7630,
	SENSOR_OV7648,
	SENSOR_OV7660,
	SENSOR_PO1030,
	SENSOR_PO2030N,
	SENSOR_SOI768,
	SENSOR_SP80708,
};

static void qual_upd(struct work_struct *work);

/* device flags */
#define F_PDN_INV	0x01	/* inverse pin S_PWR_DN / sn_xxx tables */
#define F_ILLUM		0x02	/* presence of illuminator */

/* sn9c1xx definitions */
/* register 0x01 */
#define S_PWR_DN	0x01	/* sensor power down */
#define S_PDN_INV	0x02	/* inverse pin S_PWR_DN */
#define V_TX_EN		0x04	/* video transfer enable */
#define LED		0x08	/* output to pin LED */
#define SCL_SEL_OD	0x20	/* open-drain mode */
#define SYS_SEL_48M	0x40	/* system clock 0: 24MHz, 1: 48MHz */
/* register 0x17 */
#define MCK_SIZE_MASK	0x1f	/* sensor master clock */
#define SEN_CLK_EN	0x20	/* enable sensor clock */
#define DEF_EN		0x80	/* defect pixel by 0: soft, 1: hard */

static const struct v4l2_pix_format cif_mode[] = {
	{352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,

Annotation

Implementation Notes