drm/radeon/dpm: add bapm callback for kb/kv
authorAlex Deucher <alexander.deucher@amd.com>
Mon, 9 Sep 2013 23:33:08 +0000 (19:33 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 11 Sep 2013 15:44:40 +0000 (11:44 -0400)
This adds the enable_bapm callback for kb/kv.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/kv_dpm.c
drivers/gpu/drm/radeon/radeon_asic.c
drivers/gpu/drm/radeon/radeon_asic.h

index 92bb998cc61179039a60c4fbf7637fa16aceabd1..b98b9c97b73276236ef0016f25b30594a115b0f4 100644 (file)
@@ -1109,6 +1109,18 @@ static void kv_update_requested_ps(struct radeon_device *rdev,
        pi->requested_rps.ps_priv = &pi->requested_ps;
 }
 
+void kv_dpm_enable_bapm(struct radeon_device *rdev, bool enable)
+{
+       struct kv_power_info *pi = kv_get_pi(rdev);
+       int ret;
+
+       if (pi->bapm_enable) {
+               ret = kv_smc_bapm_enable(rdev, enable);
+               if (ret)
+                       DRM_ERROR("kv_smc_bapm_enable failed\n");
+       }
+}
+
 int kv_dpm_enable(struct radeon_device *rdev)
 {
        struct kv_power_info *pi = kv_get_pi(rdev);
@@ -1772,6 +1784,14 @@ int kv_dpm_set_power_state(struct radeon_device *rdev)
                             RADEON_CG_BLOCK_BIF |
                             RADEON_CG_BLOCK_HDP), false);
 
+       if (pi->bapm_enable) {
+               ret = kv_smc_bapm_enable(rdev, rdev->pm.dpm.ac_power);
+               if (ret) {
+                       DRM_ERROR("kv_smc_bapm_enable failed\n");
+                       return ret;
+               }
+       }
+
        if (rdev->family == CHIP_KABINI) {
                if (pi->enable_dpm) {
                        kv_set_valid_clock_range(rdev, new_ps);
index 283951467ace47c0d7fa43acac8b8e2de9eeb8a3..5003385a75129098e7519702f49bf86d67fbc8b2 100644 (file)
@@ -2170,6 +2170,7 @@ static struct radeon_asic kv_asic = {
                .debugfs_print_current_performance_level = &kv_dpm_debugfs_print_current_performance_level,
                .force_performance_level = &kv_dpm_force_performance_level,
                .powergate_uvd = &kv_dpm_powergate_uvd,
+               .enable_bapm = &kv_dpm_enable_bapm,
        },
        .pflip = {
                .pre_page_flip = &evergreen_pre_page_flip,
index 7221bb05b51cba5ddd0261fa01a6e63db9e97e18..70c29d5e080dfffdf1a3511e12e0a663c7a57a8f 100644 (file)
@@ -785,6 +785,7 @@ void kv_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
 int kv_dpm_force_performance_level(struct radeon_device *rdev,
                                   enum radeon_dpm_forced_level level);
 void kv_dpm_powergate_uvd(struct radeon_device *rdev, bool gate);
+void kv_dpm_enable_bapm(struct radeon_device *rdev, bool enable);
 
 /* uvd v1.0 */
 uint32_t uvd_v1_0_get_rptr(struct radeon_device *rdev,