drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c
Extension
.c
Size
58405 bytes
Lines
1609
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

if (!dc->config.unify_link_enc_assignment) {
			if (new_pipe->stream)
				new_pipe_link_enc = new_pipe->stream->link_enc;
			if (pipe->stream)
				pipe_link_enc = pipe->stream->link_enc;
		}

		stream_changed_otg_dig_on = old_pipe->stream && new_pipe->stream &&
		old_pipe->stream != new_pipe->stream &&
		old_pipe->stream_res.tg == new_pipe->stream_res.tg &&
		new_pipe_link_enc && !new_pipe->stream->dpms_off &&
		new_pipe_link_enc->funcs->is_dig_enabled &&
		new_pipe_link_enc->funcs->is_dig_enabled(
		new_pipe_link_enc) &&
		new_pipe->stream_res.stream_enc &&
		new_pipe->stream_res.stream_enc->funcs->is_fifo_enabled &&
		new_pipe->stream_res.stream_enc->funcs->is_fifo_enabled(new_pipe->stream_res.stream_enc);

		if (old_pipe->stream && new_pipe->stream && old_pipe->stream == new_pipe->stream) {
			has_active_hpo =  dccg->ctx->dc->link_srv->dp_is_128b_132b_signal(old_pipe) &&
			dccg->ctx->dc->link_srv->dp_is_128b_132b_signal(new_pipe);
				has_active_hpo = has_active_hpo || (old_pipe->stream->signal == SIGNAL_TYPE_HDMI_FRL &&
				new_pipe->stream->signal == SIGNAL_TYPE_HDMI_FRL);

		}

		if (!has_active_hpo && !stream_changed_otg_dig_on && pipe->stream &&
		    (pipe->stream->dpms_off || dc_is_virtual_signal(pipe->stream->signal) || !pipe_link_enc) &&
		    !dccg->ctx->dc->link_srv->dp_is_128b_132b_signal(pipe)) {
			/* This w/a should not trigger when we have a dig active */
			if (disable) {
				if (pipe->stream_res.tg && pipe->stream_res.tg->funcs->immediate_disable_crtc)
					pipe->stream_res.tg->funcs->immediate_disable_crtc(pipe->stream_res.tg);

				reset_sync_context_for_pipe(dc, context, i);
			} else {
				pipe->stream_res.tg->funcs->enable_crtc(pipe->stream_res.tg);
			}
		}
	}
}

static void dcn35_update_clocks_update_dtb_dto(struct clk_mgr_internal *clk_mgr,
			struct dc_state *context,
			int ref_dtbclk_khz)
{
	struct dccg *dccg = clk_mgr->dccg;
	uint32_t tg_mask = 0;
	uint32_t i;

	for (i = 0; i < clk_mgr->base.ctx->dc->res_pool->pipe_count; i++) {
		struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
		struct dtbclk_dto_params dto_params = {0};

		/* use mask to program DTO once per tg */
		if (pipe_ctx->stream_res.tg &&
				!(tg_mask & (1 << pipe_ctx->stream_res.tg->inst))) {
			tg_mask |= (1 << pipe_ctx->stream_res.tg->inst);

			dto_params.otg_inst = pipe_ctx->stream_res.tg->inst;
			dto_params.ref_dtbclk_khz = ref_dtbclk_khz;

			if (dc_is_hdmi_frl_signal(pipe_ctx->stream->signal) ||
					dccg->ctx->dc->link_srv->dp_is_128b_132b_signal(pipe_ctx)) {
				dto_params.pixclk_khz = pipe_ctx->stream->timing.pix_clk_100hz / 10;

				if (pipe_ctx->stream_res.audio != NULL)
					dto_params.req_audio_dtbclk_khz = 24000;
			}

			if (dc_is_hdmi_signal(pipe_ctx->stream->signal) ||
					dc_is_dvi_signal(pipe_ctx->stream->signal))
				dto_params.is_hdmi = true;

			dccg->funcs->set_dtbclk_dto(clk_mgr->dccg, &dto_params);
			//dccg->funcs->set_audio_dtbclk_dto(clk_mgr->dccg, &dto_params);
		}
	}
}

static void dcn35_update_clocks_update_dpp_dto(struct clk_mgr_internal *clk_mgr,
		struct dc_state *context, bool safe_to_lower)
{
	uint32_t i;
	bool dppclk_active[MAX_PIPES] = {0};


	clk_mgr->dccg->ref_dppclk = clk_mgr->base.clks.dppclk_khz;
	for (i = 0; i < clk_mgr->base.ctx->dc->res_pool->pipe_count; i++) {
		int dpp_inst = 0, dppclk_khz, prev_dppclk_khz;

Annotation

Implementation Notes