drivers/media/pci/cobalt/cobalt-driver.h
Source file repositories/reference/linux-study-clean/drivers/media/pci/cobalt/cobalt-driver.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/pci/cobalt/cobalt-driver.h- Extension
.h- Size
- 10082 bytes
- Lines
- 374
- 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/bitops.hlinux/module.hlinux/pci.hlinux/spinlock.hlinux/i2c.hlinux/list.hlinux/workqueue.hlinux/mutex.hmedia/v4l2-common.hmedia/v4l2-ioctl.hmedia/v4l2-device.hmedia/v4l2-fh.hmedia/videobuf2-v4l2.hmedia/videobuf2-dma-sg.hm00233_video_measure_memmap_package.hm00235_fdma_packer_memmap_package.hm00389_cvi_memmap_package.hm00460_evcnt_memmap_package.hm00473_freewheel_memmap_package.hm00479_clk_loss_detector_memmap_package.hm00514_syncgen_flow_evcnt_memmap_package.h
Detected Declarations
struct cobaltstruct cobalt_i2c_regsstruct cobalt_i2c_datastruct pci_consistent_bufferstruct sg_dma_desc_infostruct cobalt_bufferstruct cobalt_streamstruct snd_cobalt_cardstruct cobaltfunction cobalt_write_bar0function cobalt_read_bar0function cobalt_write_bar1function cobalt_read_bar1function cobalt_g_sysctrlfunction cobalt_s_bit_sysctrlfunction cobalt_g_sysstatfunction cobalt_bus_read32function cobalt_bus_write16function cobalt_bus_write32
Annotated Snippet
struct cobalt_i2c_data {
struct cobalt *cobalt;
struct cobalt_i2c_regs __iomem *regs;
};
struct pci_consistent_buffer {
void *virt;
dma_addr_t bus;
size_t bytes;
};
struct sg_dma_desc_info {
void *virt;
dma_addr_t bus;
unsigned size;
void *last_desc_virt;
struct device *dev;
};
#define COBALT_MAX_WIDTH 1920
#define COBALT_MAX_HEIGHT 1200
#define COBALT_MAX_BPP 3
#define COBALT_MAX_FRAMESZ \
(COBALT_MAX_WIDTH * COBALT_MAX_HEIGHT * COBALT_MAX_BPP)
#define NR_BUFS VIDEO_MAX_FRAME
#define COBALT_STREAM_FL_DMA_IRQ 0
#define COBALT_STREAM_FL_ADV_IRQ 1
struct cobalt_buffer {
struct vb2_v4l2_buffer vb;
struct list_head list;
};
static inline
struct cobalt_buffer *to_cobalt_buffer(struct vb2_v4l2_buffer *vb2)
{
return container_of(vb2, struct cobalt_buffer, vb);
}
struct cobalt_stream {
struct video_device vdev;
struct vb2_queue q;
struct list_head bufs;
struct i2c_adapter *i2c_adap;
struct v4l2_subdev *sd;
struct mutex lock;
spinlock_t irqlock;
struct v4l2_dv_timings timings;
u32 input;
u32 pad_source;
u32 width, height, bpp;
u32 stride;
u32 pixfmt;
u32 sequence;
u32 colorspace;
u32 xfer_func;
u32 ycbcr_enc;
u32 quantization;
u8 dma_channel;
int video_channel;
unsigned dma_fifo_mask;
unsigned adv_irq_mask;
struct sg_dma_desc_info dma_desc_info[NR_BUFS];
unsigned long flags;
bool unstable_frame;
bool enable_cvi;
bool enable_freewheel;
unsigned skip_first_frames;
bool is_output;
bool is_audio;
bool is_dummy;
struct cobalt *cobalt;
struct snd_cobalt_card *alsa;
};
struct snd_cobalt_card;
/* Struct to hold info about cobalt cards */
struct cobalt {
int instance;
struct pci_dev *pci_dev;
struct v4l2_device v4l2_dev;
/* serialize PCI access in cobalt_s_bit_sysctrl() */
struct mutex pci_lock;
void __iomem *bar0, *bar1;
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/module.h`, `linux/pci.h`, `linux/spinlock.h`, `linux/i2c.h`, `linux/list.h`, `linux/workqueue.h`, `linux/mutex.h`.
- Detected declarations: `struct cobalt`, `struct cobalt_i2c_regs`, `struct cobalt_i2c_data`, `struct pci_consistent_buffer`, `struct sg_dma_desc_info`, `struct cobalt_buffer`, `struct cobalt_stream`, `struct snd_cobalt_card`, `struct cobalt`, `function cobalt_write_bar0`.
- 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.