drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
Extension
.c
Size
18227 bytes
Lines
628
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 acp_pm_domain {
	void *adev;
	struct generic_pm_domain gpd;
};

static int acp_poweroff(struct generic_pm_domain *genpd)
{
	struct acp_pm_domain *apd;
	struct amdgpu_device *adev;

	apd = container_of(genpd, struct acp_pm_domain, gpd);
	adev = apd->adev;
	/* call smu to POWER GATE ACP block
	 * smu will
	 * 1. turn off the acp clock
	 * 2. power off the acp tiles
	 * 3. check and enter ulv state
	 */
	amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_ACP, true, 0);
	return 0;
}

static int acp_poweron(struct generic_pm_domain *genpd)
{
	struct acp_pm_domain *apd;
	struct amdgpu_device *adev;

	apd = container_of(genpd, struct acp_pm_domain, gpd);
	adev = apd->adev;
	/* call smu to UNGATE ACP block
	 * smu will
	 * 1. exit ulv
	 * 2. turn on acp clock
	 * 3. power on acp tiles
	 */
	amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_ACP, false, 0);
	return 0;
}

static int acp_genpd_add_device(struct device *dev, void *data)
{
	struct generic_pm_domain *gpd = data;
	int ret;

	ret = pm_genpd_add_device(gpd, dev);
	if (ret)
		dev_err(dev, "Failed to add dev to genpd %d\n", ret);

	return ret;
}

static int acp_genpd_remove_device(struct device *dev, void *data)
{
	int ret;

	ret = pm_genpd_remove_device(dev);
	if (ret)
		dev_err(dev, "Failed to remove dev from genpd %d\n", ret);

	/* Continue to remove */
	return 0;
}

static int acp_quirk_cb(const struct dmi_system_id *id)
{
	acp_machine_id = ST_JADEITE;
	return 1;
}

static const struct dmi_system_id acp_quirk_table[] = {
	{
		.callback = acp_quirk_cb,
		.matches = {
			DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMD"),
			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Jadeite"),
		}
	},
	{
		.callback = acp_quirk_cb,
		.matches = {
			DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "IP3 Technology CO.,Ltd."),
			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ASN1D"),
		},
	},
	{
		.callback = acp_quirk_cb,
		.matches = {
			DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Standard"),
			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ASN10"),
		},

Annotation

Implementation Notes