drivers/media/platform/marvell/mcam-core.h
Source file repositories/reference/linux-study-clean/drivers/media/platform/marvell/mcam-core.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/marvell/mcam-core.h- Extension
.h- Size
- 11398 bytes
- Lines
- 380
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/list.hlinux/clk-provider.hlinux/workqueue.hmedia/v4l2-common.hmedia/v4l2-ctrls.hmedia/v4l2-dev.hmedia/videobuf2-v4l2.h
Detected Declarations
struct mcam_frame_statestruct mcam_cameraenum mcam_stateenum mcam_buffer_modeenum mcam_chip_idfunction mcam_buffer_mode_supportedfunction mcam_reg_writefunction mcam_reg_readfunction mcam_reg_write_maskfunction mcam_reg_clear_bitfunction mcam_reg_set_bit
Annotated Snippet
struct mcam_frame_state {
unsigned int frames;
unsigned int singles;
unsigned int delivered;
};
#define NR_MCAM_CLK 3
/*
* A description of one of our devices.
* Locking: controlled by s_mutex. Certain fields, however, require
* the dev_lock spinlock; they are marked as such by comments.
* dev_lock is also required for access to device registers.
*/
struct mcam_camera {
/*
* These fields should be set by the platform code prior to
* calling mcam_register().
*/
unsigned char __iomem *regs;
unsigned regs_size; /* size in bytes of the register space */
spinlock_t dev_lock;
struct device *dev; /* For messages, dma alloc */
enum mcam_chip_id chip_id;
enum mcam_buffer_mode buffer_mode;
int mclk_src; /* which clock source the mclk derives from */
int mclk_div; /* Clock Divider Value for MCLK */
enum v4l2_mbus_type bus_type;
/* MIPI support */
/* The dphy config value, allocated in board file
* dphy[0]: DPHY3
* dphy[1]: DPHY5
* dphy[2]: DPHY6
*/
int *dphy;
bool mipi_enabled; /* flag whether mipi is enabled already */
int lane; /* lane number */
/* clock tree support */
struct clk *clk[NR_MCAM_CLK];
struct clk_hw mclk_hw;
struct clk *mclk;
/*
* Callbacks from the core to the platform code.
*/
int (*plat_power_up) (struct mcam_camera *cam);
void (*plat_power_down) (struct mcam_camera *cam);
void (*calc_dphy) (struct mcam_camera *cam);
/*
* Everything below here is private to the mcam core and
* should not be touched by the platform code.
*/
struct v4l2_device v4l2_dev;
struct v4l2_ctrl_handler ctrl_handler;
enum mcam_state state;
unsigned long flags; /* Buffer status, mainly (dev_lock) */
struct mcam_frame_state frame_state; /* Frame state counter */
/*
* Subsystem structures.
*/
struct video_device vdev;
struct v4l2_async_notifier notifier;
struct v4l2_subdev *sensor;
/* Videobuf2 stuff */
struct vb2_queue vb_queue;
struct list_head buffers; /* Available frames */
unsigned int nbufs; /* How many are alloc'd */
int next_buf; /* Next to consume (dev_lock) */
char bus_info[32]; /* querycap bus_info */
/* DMA buffers - vmalloc mode */
#ifdef MCAM_MODE_VMALLOC
unsigned int dma_buf_size; /* allocated size */
void *dma_bufs[MAX_DMA_BUFS]; /* Internal buffer addresses */
dma_addr_t dma_handles[MAX_DMA_BUFS]; /* Buffer bus addresses */
struct work_struct s_bh_work;
#endif
unsigned int sequence; /* Frame sequence number */
unsigned int buf_seq[MAX_DMA_BUFS]; /* Sequence for individual bufs */
/* DMA buffers - DMA modes */
struct mcam_vb_buffer *vb_bufs[MAX_DMA_BUFS];
Annotation
- Immediate include surface: `linux/list.h`, `linux/clk-provider.h`, `linux/workqueue.h`, `media/v4l2-common.h`, `media/v4l2-ctrls.h`, `media/v4l2-dev.h`, `media/videobuf2-v4l2.h`.
- Detected declarations: `struct mcam_frame_state`, `struct mcam_camera`, `enum mcam_state`, `enum mcam_buffer_mode`, `enum mcam_chip_id`, `function mcam_buffer_mode_supported`, `function mcam_reg_write`, `function mcam_reg_read`, `function mcam_reg_write_mask`, `function mcam_reg_clear_bit`.
- 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.