drivers/gpu/drm/loongson/lsdc_drv.h

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/loongson/lsdc_drv.h

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/loongson/lsdc_drv.h
Extension
.h
Size
9384 bytes
Lines
389
Domain
Driver Families
Bucket
drivers/gpu
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 lsdc_desc {
	u32 num_of_crtc;
	u32 max_pixel_clk;
	u32 max_width;
	u32 max_height;
	u32 num_of_hw_cursor;
	u32 hw_cursor_w;
	u32 hw_cursor_h;
	u32 pitch_align;         /* CRTC DMA alignment constraint */
	bool has_vblank_counter; /* 32 bit hw vsync counter */

	/* device dependent ops, dc side */
	const struct lsdc_kms_funcs *funcs;
};

/* GFX related resources wrangler */

struct loongson_gfx_desc {
	struct lsdc_desc dc;

	u32 conf_reg_base;

	/* GFXPLL shared by the DC, GMC and GPU */
	struct {
		u32 reg_offset;
		u32 reg_size;
	} gfxpll;

	/* Pixel PLL, per display pipe */
	struct {
		u32 reg_offset;
		u32 reg_size;
	} pixpll[LSDC_NUM_CRTC];

	enum loongson_chip_id chip_id;
	char model[64];
};

static inline const struct loongson_gfx_desc *
to_loongson_gfx(const struct lsdc_desc *dcp)
{
	return container_of_const(dcp, struct loongson_gfx_desc, dc);
};

struct lsdc_reg32 {
	char *name;
	u32 offset;
};

/* crtc hardware related ops */

struct lsdc_crtc;

struct lsdc_crtc_hw_ops {
	void (*enable)(struct lsdc_crtc *lcrtc);
	void (*disable)(struct lsdc_crtc *lcrtc);
	void (*enable_vblank)(struct lsdc_crtc *lcrtc);
	void (*disable_vblank)(struct lsdc_crtc *lcrtc);
	void (*flip)(struct lsdc_crtc *lcrtc);
	void (*clone)(struct lsdc_crtc *lcrtc);
	void (*get_scan_pos)(struct lsdc_crtc *lcrtc, int *hpos, int *vpos);
	void (*set_mode)(struct lsdc_crtc *lcrtc, const struct drm_display_mode *mode);
	void (*soft_reset)(struct lsdc_crtc *lcrtc);
	void (*reset)(struct lsdc_crtc *lcrtc);

	u32  (*get_vblank_counter)(struct lsdc_crtc *lcrtc);
	void (*set_dma_step)(struct lsdc_crtc *lcrtc, enum lsdc_dma_steps step);
};

struct lsdc_crtc {
	struct drm_crtc base;
	struct lsdc_pixpll pixpll;
	struct lsdc_device *ldev;
	const struct lsdc_crtc_hw_ops *hw_ops;
	const struct lsdc_reg32 *preg;
	unsigned int nreg;
	struct drm_info_list *p_info_list;
	unsigned int n_info_list;
	bool has_vblank;
};

/* primary plane hardware related ops */

struct lsdc_primary;

struct lsdc_primary_plane_ops {
	void (*update_fb_addr)(struct lsdc_primary *plane, u64 addr);
	void (*update_fb_stride)(struct lsdc_primary *plane, u32 stride);
	void (*update_fb_format)(struct lsdc_primary *plane,
				 const struct drm_format_info *format);

Annotation

Implementation Notes