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.
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/input.hgspca.hjpeg.h
Detected Declarations
struct sdenum sensorsfunction reg_rfunction reg_w1function reg_wfunction i2c_w1function i2c_w8function i2c_rfunction i2c_w_seqfunction hv7131r_probefunction mi0360_probefunction ov7630_probefunction ov7648_probefunction po2030n_probefunction sd_configfunction sd_initfunction sd_init_controlsfunction expo_adjustfunction setbrightnessfunction setcontrastfunction setcolorsfunction setredbluefunction setgammafunction setexposurefunction setautogainfunction setgainfunction sethvflipfunction setsharpnessfunction setillumfunction setfreqfunction setjpegqualfunction qual_updfunction sd_startfunction sd_stopNfunction sd_stop0function do_autogainfunction set_lumfunction sd_s_ctrlfunction sd_probe
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
- Immediate include surface: `linux/input.h`, `gspca.h`, `jpeg.h`.
- Detected declarations: `struct sd`, `enum sensors`, `function reg_r`, `function reg_w1`, `function reg_w`, `function i2c_w1`, `function i2c_w8`, `function i2c_r`, `function i2c_w_seq`, `function hv7131r_probe`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.