drm/amd/powerplay: add firmware loading interface
authorHuang Rui <ray.huang@amd.com>
Sun, 2 Dec 2018 10:12:10 +0000 (18:12 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 19 Mar 2019 20:03:53 +0000 (15:03 -0500)
This patch adds firmware loading interface for smu.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
drivers/gpu/drm/amd/powerplay/smu_v11_0.c

index 247cd63c44351486fb417fe22492610450b232f6..afdef545fbed39df0936a8a166cb3ea44aa66ae3 100644 (file)
@@ -96,6 +96,12 @@ static int smu_hw_init(void *handle)
        if (adev->asic_type < CHIP_VEGA20)
                return -EINVAL;
 
+       if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) {
+               ret = smu_load_microcode(smu);
+               if (ret)
+                       return ret;
+       }
+
        mutex_lock(&smu->mutex);
 
        /* TODO */
index f655224537b04263ca59e536a9110595681f7ac0..ab1deb52932c5a465ec91721119d497620b6a10d 100644 (file)
@@ -35,10 +35,13 @@ struct smu_context
 struct smu_funcs
 {
        int (*init_microcode)(struct smu_context *smu);
+       int (*load_microcode)(struct smu_context *smu);
 };
 
 #define smu_init_microcode(smu) \
        ((smu)->funcs->init_microcode ? (smu)->funcs->init_microcode((smu)) : 0)
+#define smu_load_microcode(smu) \
+       ((smu)->funcs->load_microcode ? (smu)->funcs->load_microcode((smu)) : 0)
 
 extern const struct amd_ip_funcs smu_ip_funcs;
 
index 7fafc6719005423defa41b89f0dee7363de64e3a..c50c8cb233b03e18429bba7f98e30ff1a9eae29d 100644 (file)
@@ -32,8 +32,14 @@ static int smu_v11_0_init_microcode(struct smu_context *smu)
        return 0;
 }
 
+static int smu_v11_0_load_microcode(struct smu_context *smu)
+{
+       return 0;
+}
+
 static const struct smu_funcs smu_v11_0_funcs = {
        .init_microcode = smu_v11_0_init_microcode,
+       .load_microcode = smu_v11_0_load_microcode,
 };
 
 void smu_v11_0_set_smu_funcs(struct smu_context *smu)