drivers/media/usb/gspca/konica.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/gspca/konica.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/gspca/konica.c- Extension
.c- Size
- 12131 bytes
- Lines
- 479
- 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
linux/input.hgspca.h
Detected Declarations
struct sdfunction reg_wfunction reg_rfunction konica_stream_onfunction konica_stream_offfunction sd_configfunction sd_initfunction sd_startfunction sd_stopNfunction sd_isoc_irqfunction sd_s_ctrlfunction sd_init_controlsfunction sd_probe
Annotated Snippet
struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */
struct urb *last_data_urb;
u8 snapshot_pressed;
};
/* .priv is what goes to register 8 for this mode, known working values:
0x00 -> 176x144, cropped
0x01 -> 176x144, cropped
0x02 -> 176x144, cropped
0x03 -> 176x144, cropped
0x04 -> 176x144, binned
0x05 -> 320x240
0x06 -> 320x240
0x07 -> 160x120, cropped
0x08 -> 160x120, cropped
0x09 -> 160x120, binned (note has 136 lines)
0x0a -> 160x120, binned (note has 136 lines)
0x0b -> 160x120, cropped
*/
static const struct v4l2_pix_format vga_mode[] = {
{160, 120, V4L2_PIX_FMT_KONICA420, V4L2_FIELD_NONE,
.bytesperline = 160,
.sizeimage = 160 * 136 * 3 / 2 + 960,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 0x0a},
{176, 144, V4L2_PIX_FMT_KONICA420, V4L2_FIELD_NONE,
.bytesperline = 176,
.sizeimage = 176 * 144 * 3 / 2 + 960,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 0x04},
{320, 240, V4L2_PIX_FMT_KONICA420, V4L2_FIELD_NONE,
.bytesperline = 320,
.sizeimage = 320 * 240 * 3 / 2 + 960,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 0x05},
};
static void sd_isoc_irq(struct urb *urb);
static void reg_w(struct gspca_dev *gspca_dev, u16 value, u16 index)
{
struct usb_device *dev = gspca_dev->dev;
int ret;
if (gspca_dev->usb_err < 0)
return;
ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
0x02,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
value,
index,
NULL,
0,
1000);
if (ret < 0) {
pr_err("reg_w err writing %02x to %02x: %d\n",
value, index, ret);
gspca_dev->usb_err = ret;
}
}
static void reg_r(struct gspca_dev *gspca_dev, u16 value, u16 index)
{
struct usb_device *dev = gspca_dev->dev;
int ret;
if (gspca_dev->usb_err < 0)
return;
ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
0x03,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
value,
index,
gspca_dev->usb_buf,
2,
1000);
if (ret < 0) {
pr_err("reg_r err %d\n", ret);
gspca_dev->usb_err = ret;
/*
* Make sure the buffer is zeroed to avoid uninitialized
* values.
*/
memset(gspca_dev->usb_buf, 0, 2);
}
}
static void konica_stream_on(struct gspca_dev *gspca_dev)
Annotation
- Immediate include surface: `linux/input.h`, `gspca.h`.
- Detected declarations: `struct sd`, `function reg_w`, `function reg_r`, `function konica_stream_on`, `function konica_stream_off`, `function sd_config`, `function sd_init`, `function sd_start`, `function sd_stopN`, `function sd_isoc_irq`.
- 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.