drm/amd: Convert SMUv11 microcode to use `amdgpu_ucode_ip_version_decode`
authorMario Limonciello <mario.limonciello@amd.com>
Wed, 28 Dec 2022 07:20:25 +0000 (01:20 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 9 Jan 2023 21:27:43 +0000 (16:27 -0500)
Remove the special casing from SMU v11 code. No intended functional
changes.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

index ad66d57..d4756bd 100644 (file)
@@ -93,7 +93,7 @@ static void smu_v11_0_poll_baco_exit(struct smu_context *smu)
 int smu_v11_0_init_microcode(struct smu_context *smu)
 {
        struct amdgpu_device *adev = smu->adev;
-       const char *chip_name;
+       char ucode_prefix[30];
        char fw_name[SMU_FW_NAME_LEN];
        int err = 0;
        const struct smc_firmware_header_v1_0 *hdr;
@@ -105,38 +105,9 @@ int smu_v11_0_init_microcode(struct smu_context *smu)
             (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 7))))
                return 0;
 
-       switch (adev->ip_versions[MP1_HWIP][0]) {
-       case IP_VERSION(11, 0, 0):
-               chip_name = "navi10";
-               break;
-       case IP_VERSION(11, 0, 5):
-               chip_name = "navi14";
-               break;
-       case IP_VERSION(11, 0, 9):
-               chip_name = "navi12";
-               break;
-       case IP_VERSION(11, 0, 7):
-               chip_name = "sienna_cichlid";
-               break;
-       case IP_VERSION(11, 0, 11):
-               chip_name = "navy_flounder";
-               break;
-       case IP_VERSION(11, 0, 12):
-               chip_name = "dimgrey_cavefish";
-               break;
-       case IP_VERSION(11, 0, 13):
-               chip_name = "beige_goby";
-               break;
-       case IP_VERSION(11, 0, 2):
-               chip_name = "arcturus";
-               break;
-       default:
-               dev_err(adev->dev, "Unsupported IP version 0x%x\n",
-                       adev->ip_versions[MP1_HWIP][0]);
-               return -EINVAL;
-       }
+       amdgpu_ucode_ip_version_decode(adev, MP1_HWIP, ucode_prefix, sizeof(ucode_prefix));
 
-       snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_smc.bin", chip_name);
+       snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
 
        err = request_firmware(&adev->pm.fw, fw_name, adev->dev);
        if (err)