Skip to contentSkip to conversation

drm/amd/powerplay: report correct AC/DC event based on ctxid V2

PATCH New Evan Quan 1 participant 1 message May 9, 2020

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/1 drm/amd/powerplay: report correct AC/DC event based on ctxid V2

'ctxid' is used to distinguish different events raised from SMC. 0x3 and 0x4 are for AC and DC power mode.

V2: update the way to retrieve the ctxid and change the log level
to debug

Change-Id I7dbcb053fe9cea7c70e0a33afc2115b3745f6186
---
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +17 -2
index ab727f33b8d9..5792b224b0c3 100644
@@ -1522,6 +1522,11 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev,
 {
 	uint32_t client_id = entry->client_id;
 	uint32_t src_id = entry->src_id;
+	/*
+	 * ctxid is used to distinguish different
+	 * events for SMCToHost interrupt.
+	 */
+	uint32_t ctxid = entry->src_data[0];
 
 	if (client_id == SOC15_IH_CLIENTID_THM) {
 		switch (src_id) {
@@ -1547,8 +1552,18 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev,
 
 		}
 	} else if (client_id == SOC15_IH_CLIENTID_MP1) {
-		if (src_id == 0xfe)
-			smu_v11_0_ack_ac_dc_interrupt(&adev->smu);
+		if (src_id == 0xfe) {
+			switch (ctxid) {
+			case 0x3:
+				dev_dbg(adev->dev, "Switched to AC mode!\n");
+				smu_v11_0_ack_ac_dc_interrupt(&adev->smu);
+				break;
+			case 0x4:
+				dev_dbg(adev->dev, "Switched to DC mode!\n");
+				smu_v11_0_ack_ac_dc_interrupt(&adev->smu);
+				break;
+			}
+		}
 	}
 
 	return 0;
Signature · 6 lines
2.26.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx