From: Alex Deucher Date: Fri, 30 Nov 2012 15:56:57 +0000 (-0500) Subject: drm/radeon/dpm: track whether we are on AC or battery X-Git-Tag: firefly_0821_release~176^2~5752^2~60^2~78 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5ca302f70171ca90b43166cbf975a4b1d883b127;p=firefly-linux-kernel-4.4.55.git drm/radeon/dpm: track whether we are on AC or battery Driver needs this information to validate power states. Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 170d72be998d..db31f20e2204 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -1309,6 +1309,7 @@ struct radeon_dpm { u32 tdp_adjustment; u16 load_line_slope; bool power_control; + bool ac_power; /* special states active */ bool thermal_active; bool uvd_active; diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index a97af88a81de..79e35d6a40e3 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c @@ -1215,6 +1215,7 @@ static void radeon_pm_compute_clocks_dpm(struct radeon_device *rdev) mutex_lock(&rdev->pm.mutex); + /* update active crtc counts */ rdev->pm.dpm.new_active_crtcs = 0; rdev->pm.dpm.new_active_crtc_count = 0; list_for_each_entry(crtc, @@ -1226,6 +1227,12 @@ static void radeon_pm_compute_clocks_dpm(struct radeon_device *rdev) } } + /* update battery/ac status */ + if (power_supply_is_system_supplied() > 0) + rdev->pm.dpm.ac_power = true; + else + rdev->pm.dpm.ac_power = false; + radeon_dpm_change_power_state_locked(rdev); mutex_unlock(&rdev->pm.mutex);