drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c- Extension
.c- Size
- 6584 bytes
- Lines
- 274
- 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
stv06xx_st6422.h
Detected Declarations
function st6422_s_ctrlfunction st6422_init_controlsfunction st6422_probefunction st6422_initfunction setbrightnessfunction setcontrastfunction setgainfunction setexposurefunction st6422_startfunction st6422_stop
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Support for the sensor part which is integrated (I think) into the
* st6422 stv06xx alike bridge, as its integrated there are no i2c writes
* but instead direct bridge writes.
*
* Copyright (c) 2009 Hans de Goede <hdegoede@redhat.com>
*
* Strongly based on qc-usb-messenger, which is:
* Copyright (c) 2001 Jean-Fredric Clere, Nikolas Zimmermann, Georg Acher
* Mark Cave-Ayland, Carlo E Prelz, Dick Streefland
* Copyright (c) 2002, 2003 Tuukka Toivonen
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include "stv06xx_st6422.h"
static struct v4l2_pix_format st6422_mode[] = {
/* Note we actually get 124 lines of data, of which we skip the 4st
4 as they are garbage */
{
162,
120,
V4L2_PIX_FMT_SGRBG8,
V4L2_FIELD_NONE,
.sizeimage = 162 * 120,
.bytesperline = 162,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 1
},
/* Note we actually get 248 lines of data, of which we skip the 4st
4 as they are garbage, and we tell the app it only gets the
first 240 of the 244 lines it actually gets, so that it ignores
the last 4. */
{
324,
240,
V4L2_PIX_FMT_SGRBG8,
V4L2_FIELD_NONE,
.sizeimage = 324 * 244,
.bytesperline = 324,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 0
},
};
/* V4L2 controls supported by the driver */
static int setbrightness(struct sd *sd, s32 val);
static int setcontrast(struct sd *sd, s32 val);
static int setgain(struct sd *sd, u8 gain);
static int setexposure(struct sd *sd, s16 expo);
static int st6422_s_ctrl(struct v4l2_ctrl *ctrl)
{
struct gspca_dev *gspca_dev =
container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
struct sd *sd = (struct sd *)gspca_dev;
int err = -EINVAL;
switch (ctrl->id) {
case V4L2_CID_BRIGHTNESS:
err = setbrightness(sd, ctrl->val);
break;
case V4L2_CID_CONTRAST:
err = setcontrast(sd, ctrl->val);
break;
case V4L2_CID_GAIN:
err = setgain(sd, ctrl->val);
break;
case V4L2_CID_EXPOSURE:
err = setexposure(sd, ctrl->val);
break;
}
/* commit settings */
if (err >= 0)
err = stv06xx_write_bridge(sd, 0x143f, 0x01);
sd->gspca_dev.usb_err = err;
return err;
}
static const struct v4l2_ctrl_ops st6422_ctrl_ops = {
.s_ctrl = st6422_s_ctrl,
};
static int st6422_init_controls(struct sd *sd)
{
struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler;
Annotation
- Immediate include surface: `stv06xx_st6422.h`.
- Detected declarations: `function st6422_s_ctrl`, `function st6422_init_controls`, `function st6422_probe`, `function st6422_init`, `function setbrightness`, `function setcontrast`, `function setgain`, `function setexposure`, `function st6422_start`, `function st6422_stop`.
- 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.