Skip to content

Commit

Permalink
drm/radeon/dpm: handle bapm on trinity
Browse files Browse the repository at this point in the history
bapm is a power management feature for handling the
power budget between the CPU and GPU on APUs.  This
patch adds support for enabling or disabling it.
For now disable it by default.  Enabling it properly
requires quite a bit more work and will be addressed
in a separate patch.

This patch fixes hangs on boot on certain trinity
laptops when the system is on battery power.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
  • Loading branch information
Alex Deucher committed Sep 11, 2013
1 parent 6ea4e84 commit ef4e036
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/gpu/drm/radeon/ppsmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ typedef uint8_t PPSMC_Result;
#define PPSMC_MSG_VCEPowerON ((uint32_t) 0x10f)
#define PPSMC_MSG_DCE_RemoveVoltageAdjustment ((uint32_t) 0x11d)
#define PPSMC_MSG_DCE_AllowVoltageAdjustment ((uint32_t) 0x11e)
#define PPSMC_MSG_EnableBAPM ((uint32_t) 0x120)
#define PPSMC_MSG_DisableBAPM ((uint32_t) 0x121)
#define PPSMC_MSG_UVD_DPM_Config ((uint32_t) 0x124)


Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/radeon/trinity_dpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,7 @@ int trinity_dpm_enable(struct radeon_device *rdev)
trinity_program_sclk_dpm(rdev);
trinity_start_dpm(rdev);
trinity_wait_for_dpm_enabled(rdev);
trinity_dpm_bapm_enable(rdev, false);
trinity_release_mutex(rdev);

if (rdev->irq.installed &&
Expand All @@ -1116,6 +1117,7 @@ void trinity_dpm_disable(struct radeon_device *rdev)
trinity_release_mutex(rdev);
return;
}
trinity_dpm_bapm_enable(rdev, false);
trinity_disable_clock_power_gating(rdev);
sumo_clear_vc(rdev);
trinity_wait_for_level_0(rdev);
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/radeon/trinity_dpm.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ struct trinity_power_info {
#define TRINITY_AT_DFLT 30

/* trinity_smc.c */
int trinity_dpm_bapm_enable(struct radeon_device *rdev, bool enable);
int trinity_dpm_config(struct radeon_device *rdev, bool enable);
int trinity_uvd_dpm_config(struct radeon_device *rdev);
int trinity_dpm_force_state(struct radeon_device *rdev, u32 n);
Expand Down
8 changes: 8 additions & 0 deletions drivers/gpu/drm/radeon/trinity_smc.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ static int trinity_notify_message_to_smu(struct radeon_device *rdev, u32 id)
return 0;
}

int trinity_dpm_bapm_enable(struct radeon_device *rdev, bool enable)
{
if (enable)
return trinity_notify_message_to_smu(rdev, PPSMC_MSG_EnableBAPM);
else
return trinity_notify_message_to_smu(rdev, PPSMC_MSG_DisableBAPM);
}

int trinity_dpm_config(struct radeon_device *rdev, bool enable)
{
if (enable)
Expand Down

0 comments on commit ef4e036

Please sign in to comment.