drivers/media/platform/atmel/atmel-isi.c

Source file repositories/reference/linux-study-clean/drivers/media/platform/atmel/atmel-isi.c

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/atmel/atmel-isi.c
Extension
.c
Size
34517 bytes
Lines
1372
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 fbd {
	/* Physical address of the frame buffer */
	u32 fb_address;
	/* DMA Control Register(only in HISI2) */
	u32 dma_ctrl;
	/* Physical address of the next fbd */
	u32 next_fbd_address;
};

static void set_dma_ctrl(struct fbd *fb_desc, u32 ctrl)
{
	fb_desc->dma_ctrl = ctrl;
}

struct isi_dma_desc {
	struct list_head list;
	struct fbd *p_fbd;
	dma_addr_t fbd_phys;
};

/* Frame buffer data */
struct frame_buffer {
	struct vb2_v4l2_buffer vb;
	struct isi_dma_desc *p_dma_desc;
	struct list_head list;
};

struct isi_graph_entity {
	struct device_node *node;

	struct v4l2_subdev *subdev;
};

/*
 * struct isi_format - ISI media bus format information
 * @fourcc:		Fourcc code for this format
 * @mbus_code:		V4L2 media bus format code.
 * @bpp:		Bytes per pixel (when stored in memory)
 * @swap:		Byte swap configuration value
 * @support:		Indicates format supported by subdev
 * @skip:		Skip duplicate format supported by subdev
 */
struct isi_format {
	u32	fourcc;
	u32	mbus_code;
	u8	bpp;
	u32	swap;
};


struct atmel_isi {
	/* Protects the access of variables shared with the ISR */
	spinlock_t			irqlock;
	struct device			*dev;
	void __iomem			*regs;

	int				sequence;

	/* Allocate descriptors for dma buffer use */
	struct fbd			*p_fb_descriptors;
	dma_addr_t			fb_descriptors_phys;
	struct				list_head dma_desc_head;
	struct isi_dma_desc		dma_desc[VIDEO_MAX_FRAME];
	bool				enable_preview_path;

	struct completion		complete;
	/* ISI peripheral clock */
	struct clk			*pclk;
	unsigned int			irq;

	struct isi_platform_data	pdata;
	u16				width_flags;	/* max 12 bits */

	struct list_head		video_buffer_list;
	struct frame_buffer		*active;

	struct v4l2_device		v4l2_dev;
	struct video_device		*vdev;
	struct v4l2_async_notifier	notifier;
	struct isi_graph_entity		entity;
	struct v4l2_format		fmt;

	const struct isi_format		**user_formats;
	unsigned int			num_user_formats;
	const struct isi_format		*current_fmt;

	struct mutex			lock;
	struct vb2_queue		queue;
};

Annotation

Implementation Notes