drm/amd/powerplay: return errno code to caller when error occur
[linux-2.6-microblaze.git] / drivers / gpu / drm / amd / powerplay / smumgr / vegam_smumgr.c
index 7c960b0..50896e9 100644 (file)
@@ -456,7 +456,7 @@ static int vegam_populate_smc_mvdd_table(struct pp_hwmgr *hwmgr,
                        count = SMU_MAX_SMIO_LEVELS;
                for (level = 0; level < count; level++) {
                        table->SmioTable2.Pattern[level].Voltage = PP_HOST_TO_SMC_US(
-                                       data->mvdd_voltage_table.entries[count].value * VOLTAGE_SCALE);
+                                       data->mvdd_voltage_table.entries[level].value * VOLTAGE_SCALE);
                        /* Index into DpmTable.Smio. Drive bits from Smio entry to get this voltage level.*/
                        table->SmioTable2.Pattern[level].Smio =
                                (uint8_t) level;
@@ -1114,7 +1114,6 @@ static int vegam_populate_smc_acpi_level(struct pp_hwmgr *hwmgr,
                        (struct phm_ppt_v1_information *)(hwmgr->pptable);
        SMIO_Pattern vol_level;
        uint32_t mvdd;
-       uint16_t us_mvdd;
 
        table->ACPILevel.Flags &= ~PPSMC_SWSTATE_FLAG_DC;
 
@@ -1168,17 +1167,6 @@ static int vegam_populate_smc_acpi_level(struct pp_hwmgr *hwmgr,
                        "in Clock Dependency Table",
                        );
 
-       us_mvdd = 0;
-       if ((SMU7_VOLTAGE_CONTROL_NONE == data->mvdd_control) ||
-                       (data->mclk_dpm_key_disabled))
-               us_mvdd = data->vbios_boot_state.mvdd_bootup_value;
-       else {
-               if (!vegam_populate_mvdd_value(hwmgr,
-                               data->dpm_table.mclk_table.dpm_levels[0].value,
-                               &vol_level))
-                       us_mvdd = vol_level.Voltage;
-       }
-
        if (!vegam_populate_mvdd_value(hwmgr, 0, &vol_level))
                table->MemoryACPILevel.MinMvdd = PP_HOST_TO_SMC_UL(vol_level.Voltage);
        else
@@ -1383,11 +1371,16 @@ static int vegam_populate_smc_boot_level(struct pp_hwmgr *hwmgr,
        result = phm_find_boot_level(&(data->dpm_table.sclk_table),
                        data->vbios_boot_state.sclk_bootup_value,
                        (uint32_t *)&(table->GraphicsBootLevel));
+       if (result)
+               return result;
 
        result = phm_find_boot_level(&(data->dpm_table.mclk_table),
                        data->vbios_boot_state.mclk_bootup_value,
                        (uint32_t *)&(table->MemoryBootLevel));
 
+       if (result)
+               return result;
+
        table->BootVddc  = data->vbios_boot_state.vddc_bootup_value *
                        VOLTAGE_SCALE;
        table->BootVddci = data->vbios_boot_state.vddci_bootup_value *