Check the BACO capabilities from the powerplay table.

Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c 
b/drivers/gpu/drm/amd/amdgpu/soc15.c
index b3291a19a771..c49f7a78a2d5 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
@@ -589,6 +589,28 @@ static int soc15_asic_reset(struct amdgpu_device *adev)
        }
 }
 
+static bool soc15_supports_baco(struct amdgpu_device *adev)
+{
+       bool baco_support;
+
+       switch (adev->asic_type) {
+       case CHIP_VEGA10:
+       case CHIP_VEGA12:
+               soc15_asic_get_baco_capability(adev, &baco_support);
+               break;
+       case CHIP_VEGA20:
+               if (adev->psp.sos_fw_version >= 0x80067)
+                       soc15_asic_get_baco_capability(adev, &baco_support);
+               else
+                       baco_support = false;
+               break;
+       default:
+               return false;
+       }
+
+       return baco_support;
+}
+
 /*static int soc15_set_uvd_clock(struct amdgpu_device *adev, u32 clock,
                        u32 cntl_reg, u32 status_reg)
 {
@@ -989,6 +1011,7 @@ static const struct amdgpu_asic_funcs soc15_asic_funcs =
        .get_pcie_usage = &soc15_get_pcie_usage,
        .need_reset_on_init = &soc15_need_reset_on_init,
        .get_pcie_replay_count = &soc15_get_pcie_replay_count,
+       .supports_baco = &soc15_supports_baco,
 };
 
 static const struct amdgpu_asic_funcs vega20_asic_funcs =
@@ -997,6 +1020,7 @@ static const struct amdgpu_asic_funcs vega20_asic_funcs =
        .read_bios_from_rom = &soc15_read_bios_from_rom,
        .read_register = &soc15_read_register,
        .reset = &soc15_asic_reset,
+       .reset_method = &soc15_asic_reset_method,
        .set_vga_state = &soc15_vga_set_state,
        .get_xclk = &soc15_get_xclk,
        .set_uvd_clocks = &soc15_set_uvd_clocks,
@@ -1009,7 +1033,7 @@ static const struct amdgpu_asic_funcs vega20_asic_funcs =
        .get_pcie_usage = &vega20_get_pcie_usage,
        .need_reset_on_init = &soc15_need_reset_on_init,
        .get_pcie_replay_count = &soc15_get_pcie_replay_count,
-       .reset_method = &soc15_asic_reset_method
+       .supports_baco = &soc15_supports_baco,
 };
 
 static int soc15_common_early_init(void *handle)
-- 
2.20.1

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

Reply via email to