drivers/media/platform/st/stm32/dma2d/dma2d.h

Source file repositories/reference/linux-study-clean/drivers/media/platform/st/stm32/dma2d/dma2d.h

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/st/stm32/dma2d/dma2d.h
Extension
.h
Size
2846 bytes
Lines
134
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct dma2d_fmt {
	u32	fourcc;
	int	depth;
	enum dma2d_cmode cmode;
};

struct dma2d_frame {
	/* Original dimensions */
	u32	width;
	u32	height;
	/* Crop size */
	u32	c_width;
	u32	c_height;
	/* Offset */
	u32	o_width;
	u32	o_height;
	u32	bottom;
	u32	right;
	u16	line_offset;
	/* Image format */
	struct dma2d_fmt *fmt;
	/* [0]: blue
	 * [1]: green
	 * [2]: red
	 * [3]: alpha
	 */
	u8	a_rgb[4];
	/*
	 * AM[1:0] of DMA2D_FGPFCCR
	 */
	enum dma2d_alpha_mode a_mode;
	u32 size;
	unsigned int	sequence;
};

struct dma2d_ctx {
	struct v4l2_fh fh;
	struct dma2d_dev	*dev;
	struct dma2d_frame	cap;
	struct dma2d_frame	out;
	struct dma2d_frame	bg;
	/*
	 * MODE[17:16] of DMA2D_CR
	 */
	enum dma2d_op_mode	op_mode;
	struct v4l2_ctrl_handler ctrl_handler;
	enum v4l2_colorspace	colorspace;
	enum v4l2_ycbcr_encoding ycbcr_enc;
	enum v4l2_xfer_func	xfer_func;
	enum v4l2_quantization	quant;
};

struct dma2d_dev {
	struct v4l2_device	v4l2_dev;
	struct v4l2_m2m_dev	*m2m_dev;
	struct video_device	*vfd;
	/* for device open/close etc */
	struct mutex		mutex;
	/* to avoid the conflict with device running and user setting
	 * at the same time
	 */
	spinlock_t		ctrl_lock;
	atomic_t		num_inst;
	void __iomem		*regs;
	struct clk		*gate;
	struct dma2d_ctx	*curr;
	int irq;
};

void dma2d_start(struct dma2d_dev *d);
u32 dma2d_get_int(struct dma2d_dev *d);
void dma2d_clear_int(struct dma2d_dev *d);
void dma2d_config_out(struct dma2d_dev *d, struct dma2d_frame *frm,
		      dma_addr_t o_addr);
void dma2d_config_fg(struct dma2d_dev *d, struct dma2d_frame *frm,
		     dma_addr_t f_addr);
void dma2d_config_bg(struct dma2d_dev *d, struct dma2d_frame *frm,
		     dma_addr_t b_addr);
void dma2d_config_common(struct dma2d_dev *d, enum dma2d_op_mode op_mode,
			 u16 width, u16 height);

#endif /* __DMA2D_H__ */

Annotation

Implementation Notes