diff options
author | Vijendar Mukunda <vijendar.mukunda@amd.com> | 2018-07-29 07:08:32 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-08-27 12:09:43 -0400 |
commit | 1062ddb6d5749f58fb3f086b9cdf596487ca2d6a (patch) | |
tree | 89c8cd3dbaf4d2c1ef1f73db01e995cbcfa0a463 | |
parent | be2d6aa51e66625f93d3ba1eb817cd33d8136c60 (diff) |
drm/amd/amdgpu: Enabling Power Gating for Stoney platform
Removed condition checks to skip the power gating feature for
stoney platform.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Vijendar Mukunda <vijendar.mukunda@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c index d4d1738da3b6..bab8fab118d6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | |||
@@ -301,20 +301,19 @@ static int acp_hw_init(void *handle) | |||
301 | 301 | ||
302 | acp_base = adev->rmmio_base; | 302 | acp_base = adev->rmmio_base; |
303 | 303 | ||
304 | if (adev->asic_type != CHIP_STONEY) { | ||
305 | adev->acp.acp_genpd = kzalloc(sizeof(struct acp_pm_domain), GFP_KERNEL); | ||
306 | if (adev->acp.acp_genpd == NULL) | ||
307 | return -ENOMEM; | ||
308 | 304 | ||
309 | adev->acp.acp_genpd->gpd.name = "ACP_AUDIO"; | 305 | adev->acp.acp_genpd = kzalloc(sizeof(struct acp_pm_domain), GFP_KERNEL); |
310 | adev->acp.acp_genpd->gpd.power_off = acp_poweroff; | 306 | if (adev->acp.acp_genpd == NULL) |
311 | adev->acp.acp_genpd->gpd.power_on = acp_poweron; | 307 | return -ENOMEM; |
312 | 308 | ||
309 | adev->acp.acp_genpd->gpd.name = "ACP_AUDIO"; | ||
310 | adev->acp.acp_genpd->gpd.power_off = acp_poweroff; | ||
311 | adev->acp.acp_genpd->gpd.power_on = acp_poweron; | ||
313 | 312 | ||
314 | adev->acp.acp_genpd->cgs_dev = adev->acp.cgs_device; | ||
315 | 313 | ||
316 | pm_genpd_init(&adev->acp.acp_genpd->gpd, NULL, false); | 314 | adev->acp.acp_genpd->cgs_dev = adev->acp.cgs_device; |
317 | } | 315 | |
316 | pm_genpd_init(&adev->acp.acp_genpd->gpd, NULL, false); | ||
318 | 317 | ||
319 | adev->acp.acp_cell = kcalloc(ACP_DEVS, sizeof(struct mfd_cell), | 318 | adev->acp.acp_cell = kcalloc(ACP_DEVS, sizeof(struct mfd_cell), |
320 | GFP_KERNEL); | 319 | GFP_KERNEL); |
@@ -431,17 +430,17 @@ static int acp_hw_init(void *handle) | |||
431 | if (r) | 430 | if (r) |
432 | return r; | 431 | return r; |
433 | 432 | ||
434 | if (adev->asic_type != CHIP_STONEY) { | 433 | |
435 | for (i = 0; i < ACP_DEVS ; i++) { | 434 | for (i = 0; i < ACP_DEVS ; i++) { |
436 | dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i); | 435 | dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i); |
437 | r = pm_genpd_add_device(&adev->acp.acp_genpd->gpd, dev); | 436 | r = pm_genpd_add_device(&adev->acp.acp_genpd->gpd, dev); |
438 | if (r) { | 437 | if (r) { |
439 | dev_err(dev, "Failed to add dev to genpd\n"); | 438 | dev_err(dev, "Failed to add dev to genpd\n"); |
440 | return r; | 439 | return r; |
441 | } | ||
442 | } | 440 | } |
443 | } | 441 | } |
444 | 442 | ||
443 | |||
445 | /* Assert Soft reset of ACP */ | 444 | /* Assert Soft reset of ACP */ |
446 | val = cgs_read_register(adev->acp.cgs_device, mmACP_SOFT_RESET); | 445 | val = cgs_read_register(adev->acp.cgs_device, mmACP_SOFT_RESET); |
447 | 446 | ||
@@ -499,7 +498,7 @@ static int acp_hw_fini(void *handle) | |||
499 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 498 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
500 | 499 | ||
501 | /* return early if no ACP */ | 500 | /* return early if no ACP */ |
502 | if (!adev->acp.acp_cell) { | 501 | if (!adev->acp.acp_genpd) { |
503 | amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_ACP, false); | 502 | amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_ACP, false); |
504 | return 0; | 503 | return 0; |
505 | } | 504 | } |
@@ -540,19 +539,17 @@ static int acp_hw_fini(void *handle) | |||
540 | udelay(100); | 539 | udelay(100); |
541 | } | 540 | } |
542 | 541 | ||
543 | if (adev->acp.acp_genpd) { | 542 | for (i = 0; i < ACP_DEVS ; i++) { |
544 | for (i = 0; i < ACP_DEVS ; i++) { | 543 | dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i); |
545 | dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i); | 544 | ret = pm_genpd_remove_device(dev); |
546 | ret = pm_genpd_remove_device(dev); | 545 | /* If removal fails, dont giveup and try rest */ |
547 | /* If removal fails, dont giveup and try rest */ | 546 | if (ret) |
548 | if (ret) | 547 | dev_err(dev, "remove dev from genpd failed\n"); |
549 | dev_err(dev, "remove dev from genpd failed\n"); | ||
550 | } | ||
551 | kfree(adev->acp.acp_genpd); | ||
552 | } | 548 | } |
553 | 549 | ||
554 | mfd_remove_devices(adev->acp.parent); | 550 | mfd_remove_devices(adev->acp.parent); |
555 | kfree(adev->acp.acp_res); | 551 | kfree(adev->acp.acp_res); |
552 | kfree(adev->acp.acp_genpd); | ||
556 | kfree(adev->acp.acp_cell); | 553 | kfree(adev->acp.acp_cell); |
557 | 554 | ||
558 | return 0; | 555 | return 0; |