]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/amdgpu: Get real power source to initizlize ac_power
authorRex Zhu <Rex.Zhu@amd.com>
Mon, 4 Jun 2018 10:26:18 +0000 (18:26 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 15 Jun 2018 17:20:46 +0000 (12:20 -0500)
driver need to know the real power source to do some power
related configuration when initialize.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

index 3317d1536f4fc352247756e3c650d72c9236916b..fe76ec1f9737484670366ebedac441e2027df577 100644 (file)
@@ -25,6 +25,7 @@
  *          Alex Deucher
  *          Jerome Glisse
  */
+#include <linux/power_supply.h>
 #include <linux/kthread.h>
 #include <linux/console.h>
 #include <linux/slab.h>
@@ -2293,6 +2294,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
        INIT_DELAYED_WORK(&adev->late_init_work,
                          amdgpu_device_ip_late_init_func_handler);
 
+       adev->pm.ac_power = power_supply_is_system_supplied() > 0 ? true : false;
+
        /* Registers mapping */
        /* TODO: block userspace mapping of io register */
        if (adev->asic_type >= CHIP_BONAIRE) {