From 54e87d28be07e4edf37b9285fc918bc4cdaee0b9 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Thu, 3 Oct 2013 10:08:20 -0400 Subject: [PATCH] drm/radeon: automatically switch between states on ac power events Some laptops require automatic switching to battery states when on DC power to avoid going over their power envelop. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=70053 Signed-off-by: Alex Deucher --- drivers/gpu/drm/radeon/radeon_pm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 4f6b7fc..be79b78 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c @@ -69,13 +69,17 @@ void radeon_pm_acpi_event_handler(struct radeon_device *rdev) { if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) { mutex_lock(&rdev->pm.mutex); - if (power_supply_is_system_supplied() > 0) + if (power_supply_is_system_supplied() > 0) { rdev->pm.dpm.ac_power = true; - else + rdev->pm.dpm.user_state = POWER_STATE_TYPE_BALANCED; + } else { rdev->pm.dpm.ac_power = false; + rdev->pm.dpm.user_state = POWER_STATE_TYPE_BATTERY; + } if (rdev->asic->dpm.enable_bapm) radeon_dpm_enable_bapm(rdev, rdev->pm.dpm.ac_power); mutex_unlock(&rdev->pm.mutex); + radeon_pm_compute_clocks(rdev); } else if (rdev->pm.pm_method == PM_METHOD_PROFILE) { if (rdev->pm.profile == PM_PROFILE_AUTO) { mutex_lock(&rdev->pm.mutex); -- 1.8.3.1