drm/amdgpu/pm: Fix the power source flag error
commit ca1ffb174f16b699c536734fc12a4162097c49f4 upstream. The power source flag should be updated when [1] System receives an interrupt indicating that the power source has changed. [2] System resumes from suspend or runtime suspend Signed-off-by: Ma Jun <Jun.Ma2@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
b4cbd01832
commit
471ab2e8b7
3 changed files with 7 additions and 10 deletions
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include <linux/firmware.h>
|
#include <linux/firmware.h>
|
||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
|
#include <linux/power_supply.h>
|
||||||
#include <linux/reboot.h>
|
#include <linux/reboot.h>
|
||||||
|
|
||||||
#include "amdgpu.h"
|
#include "amdgpu.h"
|
||||||
|
|
@ -731,16 +732,8 @@ static int smu_late_init(void *handle)
|
||||||
* handle the switch automatically. Driver involvement
|
* handle the switch automatically. Driver involvement
|
||||||
* is unnecessary.
|
* is unnecessary.
|
||||||
*/
|
*/
|
||||||
if (!smu->dc_controlled_by_gpio) {
|
adev->pm.ac_power = power_supply_is_system_supplied() > 0;
|
||||||
ret = smu_set_power_source(smu,
|
smu_set_ac_dc(smu);
|
||||||
adev->pm.ac_power ? SMU_POWER_SOURCE_AC :
|
|
||||||
SMU_POWER_SOURCE_DC);
|
|
||||||
if (ret) {
|
|
||||||
dev_err(adev->dev, "Failed to switch to %s mode!\n",
|
|
||||||
adev->pm.ac_power ? "AC" : "DC");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 1)) ||
|
if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 1)) ||
|
||||||
(adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 3)))
|
(adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 3)))
|
||||||
|
|
|
||||||
|
|
@ -1467,10 +1467,12 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev,
|
||||||
case 0x3:
|
case 0x3:
|
||||||
dev_dbg(adev->dev, "Switched to AC mode!\n");
|
dev_dbg(adev->dev, "Switched to AC mode!\n");
|
||||||
schedule_work(&smu->interrupt_work);
|
schedule_work(&smu->interrupt_work);
|
||||||
|
adev->pm.ac_power = true;
|
||||||
break;
|
break;
|
||||||
case 0x4:
|
case 0x4:
|
||||||
dev_dbg(adev->dev, "Switched to DC mode!\n");
|
dev_dbg(adev->dev, "Switched to DC mode!\n");
|
||||||
schedule_work(&smu->interrupt_work);
|
schedule_work(&smu->interrupt_work);
|
||||||
|
adev->pm.ac_power = false;
|
||||||
break;
|
break;
|
||||||
case 0x7:
|
case 0x7:
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -1415,10 +1415,12 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev,
|
||||||
case 0x3:
|
case 0x3:
|
||||||
dev_dbg(adev->dev, "Switched to AC mode!\n");
|
dev_dbg(adev->dev, "Switched to AC mode!\n");
|
||||||
smu_v13_0_ack_ac_dc_interrupt(smu);
|
smu_v13_0_ack_ac_dc_interrupt(smu);
|
||||||
|
adev->pm.ac_power = true;
|
||||||
break;
|
break;
|
||||||
case 0x4:
|
case 0x4:
|
||||||
dev_dbg(adev->dev, "Switched to DC mode!\n");
|
dev_dbg(adev->dev, "Switched to DC mode!\n");
|
||||||
smu_v13_0_ack_ac_dc_interrupt(smu);
|
smu_v13_0_ack_ac_dc_interrupt(smu);
|
||||||
|
adev->pm.ac_power = false;
|
||||||
break;
|
break;
|
||||||
case 0x7:
|
case 0x7:
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue