drivers/accel/amdxdna/aie2_pm.c

Source file repositories/reference/linux-study-clean/drivers/accel/amdxdna/aie2_pm.c

File Facts

System
Linux kernel
Corpus path
drivers/accel/amdxdna/aie2_pm.c
Extension
.c
Size
2742 bytes
Lines
135
Domain
Driver Families
Bucket
drivers/accel
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 (ndev->hwctx_num) {
			XDNA_ERR(xdna, "Can not set turbo when there is active hwctx");
			return -EINVAL;
		}

		clk_gating = AIE2_CLK_GATING_DISABLE;
		dpm_level = ndev->max_dpm_level;
		break;
	case POWER_MODE_HIGH:
		clk_gating = AIE2_CLK_GATING_ENABLE;
		dpm_level = ndev->max_dpm_level;
		break;
	case POWER_MODE_DEFAULT:
		clk_gating = AIE2_CLK_GATING_ENABLE;
		dpm_level = ndev->dft_dpm_level;
		break;
	case POWER_MODE_LOW:
		clk_gating = AIE2_CLK_GATING_ENABLE;
		dpm_level = 0;
		break;
	case POWER_MODE_MEDIUM:
		clk_gating = AIE2_CLK_GATING_ENABLE;
		dpm_level = ndev->max_dpm_level / 2;
		break;
	default:
		return -EOPNOTSUPP;
	}

	ret = aie2_pm_set_dpm(ndev, dpm_level);
	if (ret)
		return ret;

	ret = aie2_pm_set_clk_gating(ndev, clk_gating);
	if (ret)
		return ret;

	ndev->pw_mode = target;

	return 0;
}

Annotation

Implementation Notes