drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
Extension
.c
Size
62526 bytes
Lines
2040
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 (clk_type) {
		case SMU_MCLK:
		case SMU_UCLK:
			dpm_table = &dpm_context->dpm_tables.uclk_table;
			break;
		case SMU_GFXCLK:
		case SMU_SCLK:
			dpm_table = &dpm_context->dpm_tables.gfx_table;
			break;
		case SMU_SOCCLK:
			dpm_table = &dpm_context->dpm_tables.soc_table;
			break;
		case SMU_FCLK:
			dpm_table = &dpm_context->dpm_tables.fclk_table;
			break;
		case SMU_VCLK:
			dpm_table = &dpm_context->dpm_tables.vclk_table;
			break;
		case SMU_DCLK:
			dpm_table = &dpm_context->dpm_tables.dclk_table;
			break;
		default:
			return -EINVAL;
		}

		min_clk = SMU_DPM_TABLE_MIN(dpm_table);
		max_clk = SMU_DPM_TABLE_MAX(dpm_table);

		if (min) {
			if (!min_clk)
				return -ENODATA;
			*min = min_clk;
		}
		if (max) {
			if (!max_clk)
				return -ENODATA;
			*max = max_clk;
		}

	} else {
		return smu_v13_0_get_dpm_ultimate_freq(smu, clk_type, min, max);
	}

	return 0;
}

static int aldebaran_set_default_dpm_table(struct smu_context *smu)
{
	struct smu_13_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context;
	struct smu_dpm_table *dpm_table = NULL;
	PPTable_t *pptable = smu->smu_table.driver_pptable;
	int ret = 0;

	/* socclk dpm table setup */
	dpm_table = &dpm_context->dpm_tables.soc_table;
	dpm_table->clk_type = SMU_SOCCLK;
	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_SOCCLK_BIT)) {
		ret = smu_v13_0_set_single_dpm_table(smu,
						     SMU_SOCCLK,
						     dpm_table);
		if (ret)
			return ret;
	} else {
		dpm_table->count = 1;
		dpm_table->dpm_levels[0].value = smu->smu_table.boot_values.socclk / 100;
		dpm_table->dpm_levels[0].enabled = true;
	}

	/* gfxclk dpm table setup */
	dpm_table = &dpm_context->dpm_tables.gfx_table;
	dpm_table->clk_type = SMU_GFXCLK;
	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_GFXCLK_BIT)) {
		/* in the case of gfxclk, only fine-grained dpm is honored */
		dpm_table->count = 2;
		dpm_table->dpm_levels[0].value = pptable->GfxclkFmin;
		dpm_table->dpm_levels[0].enabled = true;
		dpm_table->dpm_levels[1].value = pptable->GfxclkFmax;
		dpm_table->dpm_levels[1].enabled = true;
		dpm_table->flags |= SMU_DPM_TABLE_FINE_GRAINED;
	} else {
		dpm_table->count = 1;
		dpm_table->dpm_levels[0].value = smu->smu_table.boot_values.gfxclk / 100;
		dpm_table->dpm_levels[0].enabled = true;
	}

	/* memclk dpm table setup */
	dpm_table = &dpm_context->dpm_tables.uclk_table;
	dpm_table->clk_type = SMU_UCLK;
	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_UCLK_BIT)) {
		ret = smu_v13_0_set_single_dpm_table(smu,

Annotation

Implementation Notes