drm/radeon/dpm: track whether we are on AC or battery
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 30 Nov 2012 15:56:57 +0000 (10:56 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 27 Jun 2013 23:15:51 +0000 (19:15 -0400)
Driver needs this information to validate power states.

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

index 170d72be998d909caceb85cc666ff5199a278934..db31f20e2204e802d2c96144df642e91b38e3d3a 100644 (file)
@@ -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;
index a97af88a81de365c35a87a3628305d0bb982cdf3..79e35d6a40e319365d2a8bcaa615980a27361ff3 100644 (file)
@@ -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);