drivers/gpu/drm/mediatek/mtk_ddp_comp.h

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/mediatek/mtk_ddp_comp.h

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/mediatek/mtk_ddp_comp.h
Extension
.h
Size
10358 bytes
Lines
366
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 mtk_ddp_comp_funcs {
	int (*power_on)(struct device *dev);
	void (*power_off)(struct device *dev);
	int (*clk_enable)(struct device *dev);
	void (*clk_disable)(struct device *dev);
	void (*config)(struct device *dev, unsigned int w,
		       unsigned int h, unsigned int vrefresh,
		       unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
	void (*start)(struct device *dev);
	void (*stop)(struct device *dev);
	void (*register_vblank_cb)(struct device *dev,
				   void (*vblank_cb)(void *),
				   void *vblank_cb_data);
	void (*unregister_vblank_cb)(struct device *dev);
	void (*enable_vblank)(struct device *dev);
	void (*disable_vblank)(struct device *dev);
	unsigned int (*supported_rotations)(struct device *dev);
	unsigned int (*layer_nr)(struct device *dev);
	int (*layer_check)(struct device *dev,
			   unsigned int idx,
			   struct mtk_plane_state *state);
	void (*layer_config)(struct device *dev, unsigned int idx,
			     struct mtk_plane_state *state,
			     struct cmdq_pkt *cmdq_pkt);
	unsigned int (*gamma_get_lut_size)(struct device *dev);
	void (*gamma_set)(struct device *dev,
			  struct drm_crtc_state *state);
	void (*bgclr_in_on)(struct device *dev);
	void (*bgclr_in_off)(struct device *dev);
	void (*ctm_set)(struct device *dev,
			struct drm_crtc_state *state);
	struct device * (*dma_dev_get)(struct device *dev);
	u32 (*get_blend_modes)(struct device *dev);
	const u32 *(*get_formats)(struct device *dev);
	size_t (*get_num_formats)(struct device *dev);
	bool (*is_afbc_supported)(struct device *dev);
	void (*connect)(struct device *dev, struct device *mmsys_dev, unsigned int next);
	void (*disconnect)(struct device *dev, struct device *mmsys_dev, unsigned int next);
	void (*add)(struct device *dev, struct mtk_mutex *mutex);
	void (*remove)(struct device *dev, struct mtk_mutex *mutex);
	unsigned int (*encoder_index)(struct device *dev);
	enum drm_mode_status (*mode_valid)(struct device *dev, const struct drm_display_mode *mode);
};

struct mtk_ddp_comp {
	struct device *dev;
	int irq;
	unsigned int id;
	int encoder_index;
	const struct mtk_ddp_comp_funcs *funcs;
};

static inline int mtk_ddp_comp_power_on(struct mtk_ddp_comp *comp)
{
	if (comp->funcs && comp->funcs->power_on)
		return comp->funcs->power_on(comp->dev);
	else
		return pm_runtime_resume_and_get(comp->dev);
	return 0;
}

static inline void mtk_ddp_comp_power_off(struct mtk_ddp_comp *comp)
{
	if (comp->funcs && comp->funcs->power_off)
		comp->funcs->power_off(comp->dev);
	else
		pm_runtime_put(comp->dev);
}

static inline int mtk_ddp_comp_clk_enable(struct mtk_ddp_comp *comp)
{
	if (comp->funcs && comp->funcs->clk_enable)
		return comp->funcs->clk_enable(comp->dev);

	return 0;
}

static inline void mtk_ddp_comp_clk_disable(struct mtk_ddp_comp *comp)
{
	if (comp->funcs && comp->funcs->clk_disable)
		comp->funcs->clk_disable(comp->dev);
}

static inline
enum drm_mode_status mtk_ddp_comp_mode_valid(struct mtk_ddp_comp *comp,
					     const struct drm_display_mode *mode)
{
	if (comp && comp->funcs && comp->funcs->mode_valid)
		return comp->funcs->mode_valid(comp->dev, mode);
	return MODE_OK;

Annotation

Implementation Notes