drivers/gpu/drm/sun4i/sun8i_mixer.h

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/sun4i/sun8i_mixer.h

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/sun4i/sun8i_mixer.h
Extension
.h
Size
8537 bytes
Lines
275
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 sun8i_layer_cfg {
	unsigned int	vi_scaler_num;
	int		scaler_mask;
	int		ccsc;
	unsigned int	de_type;
	unsigned int	scanline_yuv;
	unsigned int	de2_fcc_alpha : 1;
};

/**
 * struct sun8i_mixer_cfg - mixer HW configuration
 * @lay_cfg: layer configuration
 * @vi_num: number of VI channels
 * @ui_num: number of UI channels
 * @de_type: sun8i_mixer_type enum representing the display engine generation.
 * @mod_rate: module clock rate that needs to be set in order to have
 *	a functional block.
 * @map: channel map for DE variants processing YUV separately (DE33)
 */

struct sun8i_mixer_cfg {
	struct sun8i_layer_cfg	lay_cfg;
	int			vi_num;
	int			ui_num;
	unsigned int		de_type;
	unsigned long		mod_rate;
	unsigned int		map[6];
};

struct sun8i_mixer {
	struct sunxi_engine		engine;

	const struct sun8i_mixer_cfg	*cfg;

	struct reset_control		*reset;

	struct clk			*bus_clk;
	struct clk			*mod_clk;

	struct regmap			*top_regs;
	struct regmap			*disp_regs;
};

enum {
	SUN8I_LAYER_TYPE_UI,
	SUN8I_LAYER_TYPE_VI,
};

struct sun8i_layer {
	struct drm_plane		plane;
	int				type;
	int				index;
	int				channel;
	int				overlay;
	struct regmap			*regs;
	const struct sun8i_layer_cfg	*cfg;
};

static inline struct sun8i_layer *
plane_to_sun8i_layer(struct drm_plane *plane)
{
	return container_of(plane, struct sun8i_layer, plane);
}

static inline struct sun8i_mixer *
engine_to_sun8i_mixer(struct sunxi_engine *engine)
{
	return container_of(engine, struct sun8i_mixer, engine);
}

static inline u32
sun8i_blender_base(struct sun8i_mixer *mixer)
{
	return mixer->cfg->de_type == SUN8I_MIXER_DE3 ? DE3_BLD_BASE : DE2_BLD_BASE;
}

static inline struct regmap *
sun8i_blender_regmap(struct sun8i_mixer *mixer)
{
	return mixer->cfg->de_type == SUN8I_MIXER_DE33 ?
		mixer->disp_regs : mixer->engine.regs;
}

static inline u32
sun8i_channel_base(struct sun8i_layer *layer)
{
	if (layer->cfg->de_type == SUN8I_MIXER_DE33)
		return DE33_CH_BASE + layer->channel * DE33_CH_SIZE;
	else if (layer->cfg->de_type == SUN8I_MIXER_DE3)
		return DE3_CH_BASE + layer->channel * DE3_CH_SIZE;

Annotation

Implementation Notes