drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.c

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

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.c
Extension
.c
Size
20102 bytes
Lines
633
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

switch (idx) {
		case 0:
			/* OTG_CRC0_DATA_R32/G32/B32 has the CRC32 results */
			REG_GET(OTG_CRC0_DATA_R32,
				CRC0_R_CR32, r_cr);
			REG_GET(OTG_CRC0_DATA_G32,
				CRC0_G_Y32, g_y);
			REG_GET(OTG_CRC0_DATA_B32,
				CRC0_B_CB32, b_cb);
			break;
		case 1:
			/* OTG_CRC1_DATA_R32/G32/B32 has the CRC32 results */
			REG_GET(OTG_CRC1_DATA_R32,
				CRC1_R_CR32, r_cr);
			REG_GET(OTG_CRC1_DATA_G32,
				CRC1_G_Y32, g_y);
			REG_GET(OTG_CRC1_DATA_B32,
				CRC1_B_CB32, b_cb);
			break;
		default:
			return false;
		}
	} else {
		switch (idx) {
		case 0:
			/* OTG_CRC0_DATA_RG has the CRC16 results for the red and green component */
			REG_GET_2(OTG_CRC0_DATA_RG,
				CRC0_R_CR, r_cr,
				CRC0_G_Y, g_y);

			/* OTG_CRC0_DATA_B has the CRC16 results for the blue component */
			REG_GET(OTG_CRC0_DATA_B,
				CRC0_B_CB, b_cb);
			break;
		case 1:
			/* OTG_CRC1_DATA_RG has the CRC16 results for the red and green component */
			REG_GET_2(OTG_CRC1_DATA_RG,
				CRC1_R_CR, r_cr,
				CRC1_G_Y, g_y);

			/* OTG_CRC1_DATA_B has the CRC16 results for the blue component */
			REG_GET(OTG_CRC1_DATA_B,
				CRC1_B_CB, b_cb);
			break;
		default:
			return false;
			}
	}

	return true;
}

bool optc35_configure_crc(struct timing_generator *optc,
				 const struct crc_params *params)
{
	struct optc *optc1 = DCN10TG_FROM_TG(optc);

	/* Cannot configure crc on a CRTC that is disabled */
	if (!optc1_is_tg_enabled(optc))
		return false;

	if (!params->enable || params->reset)
		REG_WRITE(OTG_CRC_CNTL, 0);

	if (!params->enable)
		return true;

	/* Program frame boundaries */
	switch (params->crc_eng_inst) {
	case 0:
		/* Window A x axis start and end. */
		REG_UPDATE_2(OTG_CRC0_WINDOWA_X_CONTROL,
				OTG_CRC0_WINDOWA_X_START, params->windowa_x_start,
				OTG_CRC0_WINDOWA_X_END, params->windowa_x_end);

		/* Window A y axis start and end. */
		REG_UPDATE_2(OTG_CRC0_WINDOWA_Y_CONTROL,
				OTG_CRC0_WINDOWA_Y_START, params->windowa_y_start,
				OTG_CRC0_WINDOWA_Y_END, params->windowa_y_end);

		/* Window B x axis start and end. */
		REG_UPDATE_2(OTG_CRC0_WINDOWB_X_CONTROL,
				OTG_CRC0_WINDOWB_X_START, params->windowb_x_start,
				OTG_CRC0_WINDOWB_X_END, params->windowb_x_end);

		/* Window B y axis start and end. */
		REG_UPDATE_2(OTG_CRC0_WINDOWB_Y_CONTROL,
				OTG_CRC0_WINDOWB_Y_START, params->windowb_y_start,
				OTG_CRC0_WINDOWB_Y_END, params->windowb_y_end);

Annotation

Implementation Notes