drivers/gpu/drm/msm/dp/dp_ctrl.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/dp/dp_ctrl.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/msm/dp/dp_ctrl.c
Extension
.c
Size
74923 bytes
Lines
2763
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 msm_dp_tu_calc_input {
	u64 lclk;        /* 162, 270, 540 and 810 */
	u64 pclk_khz;    /* in KHz */
	u64 hactive;     /* active h-width */
	u64 hporch;      /* bp + fp + pulse */
	int nlanes;      /* no.of.lanes */
	int bpp;         /* bits */
	int pixel_enc;   /* 444, 420, 422 */
	int dsc_en;     /* dsc on/off */
	int async_en;   /* async mode */
	int fec_en;     /* fec */
	int compress_ratio; /* 2:1 = 200, 3:1 = 300, 3.75:1 = 375 */
	int num_of_dsc_slices; /* number of slices per line */
};

struct msm_dp_vc_tu_mapping_table {
	u32 vic;
	u8 lanes;
	u8 lrate; /* DP_LINK_RATE -> 162(6), 270(10), 540(20), 810 (30) */
	u8 bpp;
	u8 valid_boundary_link;
	u16 delay_start_link;
	bool boundary_moderation_en;
	u8 valid_lower_boundary_link;
	u8 upper_boundary_count;
	u8 lower_boundary_count;
	u8 tu_size_minus1;
};

struct msm_dp_ctrl_private {
	struct msm_dp_ctrl msm_dp_ctrl;
	struct drm_device *drm_dev;
	struct device *dev;
	struct drm_dp_aux *aux;
	struct msm_dp_panel *panel;
	struct msm_dp_link *link;
	void __iomem *ahb_base;
	void __iomem *link_base;

	struct phy *phy;

	unsigned int num_core_clks;
	struct clk_bulk_data *core_clks;

	unsigned int num_link_clks;
	struct clk_bulk_data *link_clks;

	struct clk *pixel_clk;

	union phy_configure_opts phy_opts;

	struct completion idle_comp;
	struct completion psr_op_comp;
	struct completion video_comp;

	u32 hw_revision;

	bool core_clks_on;
	bool link_clks_on;
	bool stream_clks_on;
};

static inline u32 msm_dp_read_ahb(const struct msm_dp_ctrl_private *ctrl, u32 offset)
{
	return readl_relaxed(ctrl->ahb_base + offset);
}

static inline void msm_dp_write_ahb(struct msm_dp_ctrl_private *ctrl,
			       u32 offset, u32 data)
{
	/*
	 * To make sure phy reg writes happens before any other operation,
	 * this function uses writel() instread of writel_relaxed()
	 */
	writel(data, ctrl->ahb_base + offset);
}

static inline u32 msm_dp_read_link(struct msm_dp_ctrl_private *ctrl, u32 offset)
{
	return readl_relaxed(ctrl->link_base + offset);
}

static inline void msm_dp_write_link(struct msm_dp_ctrl_private *ctrl,
			       u32 offset, u32 data)
{
	/*
	 * To make sure link reg writes happens before any other operation,
	 * this function uses writel() instread of writel_relaxed()
	 */
	writel(data, ctrl->link_base + offset);

Annotation

Implementation Notes