drm/amdgpu/pp: endian fixes for process_pptables_v1_0.c
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 7 Aug 2018 20:17:09 +0000 (15:17 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 27 Aug 2018 16:10:08 +0000 (11:10 -0500)
Properly swap when reading from the vbios.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c

index 4e1fd53938458ed3ff488ce5ad451abf12fe0480..ae64ff7153d627857624e7e0289d7270c36ca467 100644 (file)
@@ -214,23 +214,23 @@ static int get_platform_power_management_table(
        ptr->ppm_design
                = atom_ppm_table->ucPpmDesign;
        ptr->cpu_core_number
-               = atom_ppm_table->usCpuCoreNumber;
+               = le16_to_cpu(atom_ppm_table->usCpuCoreNumber);
        ptr->platform_tdp
-               = atom_ppm_table->ulPlatformTDP;
+               = le32_to_cpu(atom_ppm_table->ulPlatformTDP);
        ptr->small_ac_platform_tdp
-               = atom_ppm_table->ulSmallACPlatformTDP;
+               = le32_to_cpu(atom_ppm_table->ulSmallACPlatformTDP);
        ptr->platform_tdc
-               = atom_ppm_table->ulPlatformTDC;
+               = le32_to_cpu(atom_ppm_table->ulPlatformTDC);
        ptr->small_ac_platform_tdc
-               = atom_ppm_table->ulSmallACPlatformTDC;
+               = le32_to_cpu(atom_ppm_table->ulSmallACPlatformTDC);
        ptr->apu_tdp
-               = atom_ppm_table->ulApuTDP;
+               = le32_to_cpu(atom_ppm_table->ulApuTDP);
        ptr->dgpu_tdp
-               = atom_ppm_table->ulDGpuTDP;
+               = le32_to_cpu(atom_ppm_table->ulDGpuTDP);
        ptr->dgpu_ulv_power
-               = atom_ppm_table->ulDGpuUlvPower;
+               = le32_to_cpu(atom_ppm_table->ulDGpuUlvPower);
        ptr->tj_max
-               = atom_ppm_table->ulTjmax;
+               = le32_to_cpu(atom_ppm_table->ulTjmax);
 
        pp_table_information->ppm_parameter_table = ptr;
 
@@ -355,11 +355,11 @@ static int get_hard_limits(
        PP_ASSERT_WITH_CODE((0 != limitable->ucNumEntries), "Invalid PowerPlay Table!", return -1);
 
        /* currently we always take entries[0] parameters */
-       limits->sclk = (uint32_t)limitable->entries[0].ulSCLKLimit;
-       limits->mclk = (uint32_t)limitable->entries[0].ulMCLKLimit;
-       limits->vddc = (uint16_t)limitable->entries[0].usVddcLimit;
-       limits->vddci = (uint16_t)limitable->entries[0].usVddciLimit;
-       limits->vddgfx = (uint16_t)limitable->entries[0].usVddgfxLimit;
+       limits->sclk = le32_to_cpu(limitable->entries[0].ulSCLKLimit);
+       limits->mclk = le32_to_cpu(limitable->entries[0].ulMCLKLimit);
+       limits->vddc = le16_to_cpu(limitable->entries[0].usVddcLimit);
+       limits->vddci = le16_to_cpu(limitable->entries[0].usVddciLimit);
+       limits->vddgfx = le16_to_cpu(limitable->entries[0].usVddgfxLimit);
 
        return 0;
 }
@@ -396,10 +396,10 @@ static int get_mclk_voltage_dependency_table(
                                        ATOM_Tonga_MCLK_Dependency_Record,
                                                entries, mclk_dep_table, i);
                mclk_table_record->vddInd = mclk_dep_record->ucVddcInd;
-               mclk_table_record->vdd_offset = mclk_dep_record->usVddgfxOffset;
-               mclk_table_record->vddci = mclk_dep_record->usVddci;
-               mclk_table_record->mvdd = mclk_dep_record->usMvdd;
-               mclk_table_record->clk = mclk_dep_record->ulMclk;
+               mclk_table_record->vdd_offset = le16_to_cpu(mclk_dep_record->usVddgfxOffset);
+               mclk_table_record->vddci = le16_to_cpu(mclk_dep_record->usVddci);
+               mclk_table_record->mvdd = le16_to_cpu(mclk_dep_record->usMvdd);
+               mclk_table_record->clk = le32_to_cpu(mclk_dep_record->ulMclk);
        }
 
        *pp_tonga_mclk_dep_table = mclk_table;
@@ -443,8 +443,8 @@ static int get_sclk_voltage_dependency_table(
                                                phm_ppt_v1_clock_voltage_dependency_record,
                                                entries, sclk_table, i);
                        sclk_table_record->vddInd = sclk_dep_record->ucVddInd;
-                       sclk_table_record->vdd_offset = sclk_dep_record->usVddcOffset;
-                       sclk_table_record->clk = sclk_dep_record->ulSclk;
+                       sclk_table_record->vdd_offset = le16_to_cpu(sclk_dep_record->usVddcOffset);
+                       sclk_table_record->clk = le32_to_cpu(sclk_dep_record->ulSclk);
                        sclk_table_record->cks_enable =
                                (((sclk_dep_record->ucCKSVOffsetandDisable & 0x80) >> 7) == 0) ? 1 : 0;
                        sclk_table_record->cks_voffset = (sclk_dep_record->ucCKSVOffsetandDisable & 0x7F);
@@ -475,12 +475,12 @@ static int get_sclk_voltage_dependency_table(
                                                phm_ppt_v1_clock_voltage_dependency_record,
                                                entries, sclk_table, i);
                        sclk_table_record->vddInd = sclk_dep_record->ucVddInd;
-                       sclk_table_record->vdd_offset = sclk_dep_record->usVddcOffset;
-                       sclk_table_record->clk = sclk_dep_record->ulSclk;
+                       sclk_table_record->vdd_offset = le16_to_cpu(sclk_dep_record->usVddcOffset);
+                       sclk_table_record->clk = le32_to_cpu(sclk_dep_record->ulSclk);
                        sclk_table_record->cks_enable =
                                (((sclk_dep_record->ucCKSVOffsetandDisable & 0x80) >> 7) == 0) ? 1 : 0;
                        sclk_table_record->cks_voffset = (sclk_dep_record->ucCKSVOffsetandDisable & 0x7F);
-                       sclk_table_record->sclk_offset = sclk_dep_record->ulSclkOffset;
+                       sclk_table_record->sclk_offset = le32_to_cpu(sclk_dep_record->ulSclkOffset);
                }
        }
        *pp_tonga_sclk_dep_table = sclk_table;
@@ -534,7 +534,7 @@ static int get_pcie_table(
                                                ATOM_Tonga_PCIE_Record,
                                                entries, atom_pcie_table, i);
                        pcie_record->gen_speed = atom_pcie_record->ucPCIEGenSpeed;
-                       pcie_record->lane_width = atom_pcie_record->usPCIELaneWidth;
+                       pcie_record->lane_width = le16_to_cpu(atom_pcie_record->usPCIELaneWidth);
                }
 
                *pp_tonga_pcie_table = pcie_table;
@@ -574,8 +574,8 @@ static int get_pcie_table(
                                                ATOM_Polaris10_PCIE_Record,
                                                entries, atom_pcie_table, i);
                        pcie_record->gen_speed = atom_pcie_record->ucPCIEGenSpeed;
-                       pcie_record->lane_width = atom_pcie_record->usPCIELaneWidth;
-                       pcie_record->pcie_sclk = atom_pcie_record->ulPCIE_Sclk;
+                       pcie_record->lane_width = le16_to_cpu(atom_pcie_record->usPCIELaneWidth);
+                       pcie_record->pcie_sclk = le32_to_cpu(atom_pcie_record->ulPCIE_Sclk);
                }
 
                *pp_tonga_pcie_table = pcie_table;
@@ -609,64 +609,64 @@ static int get_cac_tdp_table(
        if (table->ucRevId < 3) {
                const ATOM_Tonga_PowerTune_Table *tonga_table =
                        (ATOM_Tonga_PowerTune_Table *)table;
-               tdp_table->usTDP = tonga_table->usTDP;
+               tdp_table->usTDP = le16_to_cpu(tonga_table->usTDP);
                tdp_table->usConfigurableTDP =
-                       tonga_table->usConfigurableTDP;
-               tdp_table->usTDC = tonga_table->usTDC;
+                       le16_to_cpu(tonga_table->usConfigurableTDP);
+               tdp_table->usTDC = le16_to_cpu(tonga_table->usTDC);
                tdp_table->usBatteryPowerLimit =
-                       tonga_table->usBatteryPowerLimit;
+                       le16_to_cpu(tonga_table->usBatteryPowerLimit);
                tdp_table->usSmallPowerLimit =
-                       tonga_table->usSmallPowerLimit;
+                       le16_to_cpu(tonga_table->usSmallPowerLimit);
                tdp_table->usLowCACLeakage =
-                       tonga_table->usLowCACLeakage;
+                       le16_to_cpu(tonga_table->usLowCACLeakage);
                tdp_table->usHighCACLeakage =
-                       tonga_table->usHighCACLeakage;
+                       le16_to_cpu(tonga_table->usHighCACLeakage);
                tdp_table->usMaximumPowerDeliveryLimit =
-                       tonga_table->usMaximumPowerDeliveryLimit;
+                       le16_to_cpu(tonga_table->usMaximumPowerDeliveryLimit);
                tdp_table->usDefaultTargetOperatingTemp =
-                       tonga_table->usTjMax;
+                       le16_to_cpu(tonga_table->usTjMax);
                tdp_table->usTargetOperatingTemp =
-                       tonga_table->usTjMax; /*Set the initial temp to the same as default */
+                       le16_to_cpu(tonga_table->usTjMax); /*Set the initial temp to the same as default */
                tdp_table->usPowerTuneDataSetID =
-                       tonga_table->usPowerTuneDataSetID;
+                       le16_to_cpu(tonga_table->usPowerTuneDataSetID);
                tdp_table->usSoftwareShutdownTemp =
-                       tonga_table->usSoftwareShutdownTemp;
+                       le16_to_cpu(tonga_table->usSoftwareShutdownTemp);
                tdp_table->usClockStretchAmount =
-                       tonga_table->usClockStretchAmount;
+                       le16_to_cpu(tonga_table->usClockStretchAmount);
        } else {   /* Fiji and newer */
                const ATOM_Fiji_PowerTune_Table *fijitable =
                        (ATOM_Fiji_PowerTune_Table *)table;
-               tdp_table->usTDP = fijitable->usTDP;
-               tdp_table->usConfigurableTDP = fijitable->usConfigurableTDP;
-               tdp_table->usTDC = fijitable->usTDC;
-               tdp_table->usBatteryPowerLimit = fijitable->usBatteryPowerLimit;
-               tdp_table->usSmallPowerLimit = fijitable->usSmallPowerLimit;
-               tdp_table->usLowCACLeakage = fijitable->usLowCACLeakage;
-               tdp_table->usHighCACLeakage = fijitable->usHighCACLeakage;
+               tdp_table->usTDP = le16_to_cpu(fijitable->usTDP);
+               tdp_table->usConfigurableTDP = le16_to_cpu(fijitable->usConfigurableTDP);
+               tdp_table->usTDC = le16_to_cpu(fijitable->usTDC);
+               tdp_table->usBatteryPowerLimit = le16_to_cpu(fijitable->usBatteryPowerLimit);
+               tdp_table->usSmallPowerLimit = le16_to_cpu(fijitable->usSmallPowerLimit);
+               tdp_table->usLowCACLeakage = le16_to_cpu(fijitable->usLowCACLeakage);
+               tdp_table->usHighCACLeakage = le16_to_cpu(fijitable->usHighCACLeakage);
                tdp_table->usMaximumPowerDeliveryLimit =
-                       fijitable->usMaximumPowerDeliveryLimit;
+                       le16_to_cpu(fijitable->usMaximumPowerDeliveryLimit);
                tdp_table->usDefaultTargetOperatingTemp =
-                       fijitable->usTjMax;
+                       le16_to_cpu(fijitable->usTjMax);
                tdp_table->usTargetOperatingTemp =
-                       fijitable->usTjMax; /*Set the initial temp to the same as default */
+                       le16_to_cpu(fijitable->usTjMax); /*Set the initial temp to the same as default */
                tdp_table->usPowerTuneDataSetID =
-                       fijitable->usPowerTuneDataSetID;
+                       le16_to_cpu(fijitable->usPowerTuneDataSetID);
                tdp_table->usSoftwareShutdownTemp =
-                       fijitable->usSoftwareShutdownTemp;
+                       le16_to_cpu(fijitable->usSoftwareShutdownTemp);
                tdp_table->usClockStretchAmount =
-                       fijitable->usClockStretchAmount;
+                       le16_to_cpu(fijitable->usClockStretchAmount);
                tdp_table->usTemperatureLimitHotspot =
-                       fijitable->usTemperatureLimitHotspot;
+                       le16_to_cpu(fijitable->usTemperatureLimitHotspot);
                tdp_table->usTemperatureLimitLiquid1 =
-                       fijitable->usTemperatureLimitLiquid1;
+                       le16_to_cpu(fijitable->usTemperatureLimitLiquid1);
                tdp_table->usTemperatureLimitLiquid2 =
-                       fijitable->usTemperatureLimitLiquid2;
+                       le16_to_cpu(fijitable->usTemperatureLimitLiquid2);
                tdp_table->usTemperatureLimitVrVddc =
-                       fijitable->usTemperatureLimitVrVddc;
+                       le16_to_cpu(fijitable->usTemperatureLimitVrVddc);
                tdp_table->usTemperatureLimitVrMvdd =
-                       fijitable->usTemperatureLimitVrMvdd;
+                       le16_to_cpu(fijitable->usTemperatureLimitVrMvdd);
                tdp_table->usTemperatureLimitPlx =
-                       fijitable->usTemperatureLimitPlx;
+                       le16_to_cpu(fijitable->usTemperatureLimitPlx);
                tdp_table->ucLiquid1_I2C_address =
                        fijitable->ucLiquid1_I2C_address;
                tdp_table->ucLiquid2_I2C_address =
@@ -715,12 +715,12 @@ static int get_mm_clock_voltage_table(
                                        phm_ppt_v1_mm_clock_voltage_dependency_record,
                                        entries, mm_table, i);
                mm_table_record->vddcInd = mm_dependency_record->ucVddcInd;
-               mm_table_record->vddgfx_offset = mm_dependency_record->usVddgfxOffset;
-               mm_table_record->aclk = mm_dependency_record->ulAClk;
-               mm_table_record->samclock = mm_dependency_record->ulSAMUClk;
-               mm_table_record->eclk = mm_dependency_record->ulEClk;
-               mm_table_record->vclk = mm_dependency_record->ulVClk;
-               mm_table_record->dclk = mm_dependency_record->ulDClk;
+               mm_table_record->vddgfx_offset = le16_to_cpu(mm_dependency_record->usVddgfxOffset);
+               mm_table_record->aclk = le32_to_cpu(mm_dependency_record->ulAClk);
+               mm_table_record->samclock = le32_to_cpu(mm_dependency_record->ulSAMUClk);
+               mm_table_record->eclk = le32_to_cpu(mm_dependency_record->ulEClk);
+               mm_table_record->vclk = le32_to_cpu(mm_dependency_record->ulVClk);
+               mm_table_record->dclk = le32_to_cpu(mm_dependency_record->ulDClk);
        }
 
        *tonga_mm_table = mm_table;
@@ -939,33 +939,33 @@ static int init_thermal_controller(
                hwmgr->thermal_controller.advanceFanControlParameters.ucTHyst
                        = tonga_fan_table->ucTHyst;
                hwmgr->thermal_controller.advanceFanControlParameters.usTMin
-                       = tonga_fan_table->usTMin;
+                       = le16_to_cpu(tonga_fan_table->usTMin);
                hwmgr->thermal_controller.advanceFanControlParameters.usTMed
-                       = tonga_fan_table->usTMed;
+                       = le16_to_cpu(tonga_fan_table->usTMed);
                hwmgr->thermal_controller.advanceFanControlParameters.usTHigh
-                       = tonga_fan_table->usTHigh;
+                       = le16_to_cpu(tonga_fan_table->usTHigh);
                hwmgr->thermal_controller.advanceFanControlParameters.usPWMMin
-                       = tonga_fan_table->usPWMMin;
+                       = le16_to_cpu(tonga_fan_table->usPWMMin);
                hwmgr->thermal_controller.advanceFanControlParameters.usPWMMed
-                       = tonga_fan_table->usPWMMed;
+                       = le16_to_cpu(tonga_fan_table->usPWMMed);
                hwmgr->thermal_controller.advanceFanControlParameters.usPWMHigh
-                       = tonga_fan_table->usPWMHigh;
+                       = le16_to_cpu(tonga_fan_table->usPWMHigh);
                hwmgr->thermal_controller.advanceFanControlParameters.usTMax
                        = 10900;                  /* hard coded */
                hwmgr->thermal_controller.advanceFanControlParameters.usTMax
-                       = tonga_fan_table->usTMax;
+                       = le16_to_cpu(tonga_fan_table->usTMax);
                hwmgr->thermal_controller.advanceFanControlParameters.ucFanControlMode
                        = tonga_fan_table->ucFanControlMode;
                hwmgr->thermal_controller.advanceFanControlParameters.usDefaultMaxFanPWM
-                       = tonga_fan_table->usFanPWMMax;
+                       = le16_to_cpu(tonga_fan_table->usFanPWMMax);
                hwmgr->thermal_controller.advanceFanControlParameters.usDefaultFanOutputSensitivity
                        = 4836;
                hwmgr->thermal_controller.advanceFanControlParameters.usFanOutputSensitivity
-                       = tonga_fan_table->usFanOutputSensitivity;
+                       = le16_to_cpu(tonga_fan_table->usFanOutputSensitivity);
                hwmgr->thermal_controller.advanceFanControlParameters.usDefaultMaxFanRPM
-                       = tonga_fan_table->usFanRPMMax;
+                       = le16_to_cpu(tonga_fan_table->usFanRPMMax);
                hwmgr->thermal_controller.advanceFanControlParameters.ulMinFanSCLKAcousticLimit
-                       = (tonga_fan_table->ulMinFanSCLKAcousticLimit / 100); /* PPTable stores it in 10Khz unit for 2 decimal places.  SMC wants MHz. */
+                       = (le32_to_cpu(tonga_fan_table->ulMinFanSCLKAcousticLimit) / 100); /* PPTable stores it in 10Khz unit for 2 decimal places.  SMC wants MHz. */
                hwmgr->thermal_controller.advanceFanControlParameters.ucTargetTemperature
                        = tonga_fan_table->ucTargetTemperature;
                hwmgr->thermal_controller.advanceFanControlParameters.ucMinimumPWMLimit
@@ -976,50 +976,50 @@ static int init_thermal_controller(
                hwmgr->thermal_controller.advanceFanControlParameters.ucTHyst
                        = fiji_fan_table->ucTHyst;
                hwmgr->thermal_controller.advanceFanControlParameters.usTMin
-                       = fiji_fan_table->usTMin;
+                       = le16_to_cpu(fiji_fan_table->usTMin);
                hwmgr->thermal_controller.advanceFanControlParameters.usTMed
-                       = fiji_fan_table->usTMed;
+                       = le16_to_cpu(fiji_fan_table->usTMed);
                hwmgr->thermal_controller.advanceFanControlParameters.usTHigh
-                       = fiji_fan_table->usTHigh;
+                       = le16_to_cpu(fiji_fan_table->usTHigh);
                hwmgr->thermal_controller.advanceFanControlParameters.usPWMMin
-                       = fiji_fan_table->usPWMMin;
+                       = le16_to_cpu(fiji_fan_table->usPWMMin);
                hwmgr->thermal_controller.advanceFanControlParameters.usPWMMed
-                       = fiji_fan_table->usPWMMed;
+                       = le16_to_cpu(fiji_fan_table->usPWMMed);
                hwmgr->thermal_controller.advanceFanControlParameters.usPWMHigh
-                       = fiji_fan_table->usPWMHigh;
+                       = le16_to_cpu(fiji_fan_table->usPWMHigh);
                hwmgr->thermal_controller.advanceFanControlParameters.usTMax
-                       = fiji_fan_table->usTMax;
+                       = le16_to_cpu(fiji_fan_table->usTMax);
                hwmgr->thermal_controller.advanceFanControlParameters.ucFanControlMode
                        = fiji_fan_table->ucFanControlMode;
                hwmgr->thermal_controller.advanceFanControlParameters.usDefaultMaxFanPWM
-                       = fiji_fan_table->usFanPWMMax;
+                       = le16_to_cpu(fiji_fan_table->usFanPWMMax);
                hwmgr->thermal_controller.advanceFanControlParameters.usDefaultFanOutputSensitivity
                        = 4836;
                hwmgr->thermal_controller.advanceFanControlParameters.usFanOutputSensitivity
-                       = fiji_fan_table->usFanOutputSensitivity;
+                       = le16_to_cpu(fiji_fan_table->usFanOutputSensitivity);
                hwmgr->thermal_controller.advanceFanControlParameters.usDefaultMaxFanRPM
-                       = fiji_fan_table->usFanRPMMax;
+                       = le16_to_cpu(fiji_fan_table->usFanRPMMax);
                hwmgr->thermal_controller.advanceFanControlParameters.ulMinFanSCLKAcousticLimit
-                       = (fiji_fan_table->ulMinFanSCLKAcousticLimit / 100); /* PPTable stores it in 10Khz unit for 2 decimal places.  SMC wants MHz. */
+                       = (le32_to_cpu(fiji_fan_table->ulMinFanSCLKAcousticLimit) / 100); /* PPTable stores it in 10Khz unit for 2 decimal places.  SMC wants MHz. */
                hwmgr->thermal_controller.advanceFanControlParameters.ucTargetTemperature
                        = fiji_fan_table->ucTargetTemperature;
                hwmgr->thermal_controller.advanceFanControlParameters.ucMinimumPWMLimit
                        = fiji_fan_table->ucMinimumPWMLimit;
 
                hwmgr->thermal_controller.advanceFanControlParameters.usFanGainEdge
-                       = fiji_fan_table->usFanGainEdge;
+                       = le16_to_cpu(fiji_fan_table->usFanGainEdge);
                hwmgr->thermal_controller.advanceFanControlParameters.usFanGainHotspot
-                       = fiji_fan_table->usFanGainHotspot;
+                       = le16_to_cpu(fiji_fan_table->usFanGainHotspot);
                hwmgr->thermal_controller.advanceFanControlParameters.usFanGainLiquid
-                       = fiji_fan_table->usFanGainLiquid;
+                       = le16_to_cpu(fiji_fan_table->usFanGainLiquid);
                hwmgr->thermal_controller.advanceFanControlParameters.usFanGainVrVddc
-                       = fiji_fan_table->usFanGainVrVddc;
+                       = le16_to_cpu(fiji_fan_table->usFanGainVrVddc);
                hwmgr->thermal_controller.advanceFanControlParameters.usFanGainVrMvdd
-                       = fiji_fan_table->usFanGainVrMvdd;
+                       = le16_to_cpu(fiji_fan_table->usFanGainVrMvdd);
                hwmgr->thermal_controller.advanceFanControlParameters.usFanGainPlx
-                       = fiji_fan_table->usFanGainPlx;
+                       = le16_to_cpu(fiji_fan_table->usFanGainPlx);
                hwmgr->thermal_controller.advanceFanControlParameters.usFanGainHbm
-                       = fiji_fan_table->usFanGainHbm;
+                       = le16_to_cpu(fiji_fan_table->usFanGainHbm);
        }
 
        return 0;
@@ -1256,9 +1256,9 @@ static int ppt_get_vce_state_table_entry_v1_0(struct pp_hwmgr *hwmgr, uint32_t i
                                        vce_state_record->ucVCEClockIndex);
        *flag = vce_state_record->ucFlag;
 
-       vce_state->evclk = mm_dep_record->ulEClk;
-       vce_state->ecclk = mm_dep_record->ulEClk;
-       vce_state->sclk = sclk_dep_record->ulSclk;
+       vce_state->evclk = le32_to_cpu(mm_dep_record->ulEClk);
+       vce_state->ecclk = le32_to_cpu(mm_dep_record->ulEClk);
+       vce_state->sclk = le32_to_cpu(sclk_dep_record->ulSclk);
 
        if (vce_state_record->ucMCLKIndex >= mclk_dep_table->ucNumEntries)
                mclk_dep_record = GET_FLEXIBLE_ARRAY_MEMBER_ADDR(
@@ -1271,7 +1271,7 @@ static int ppt_get_vce_state_table_entry_v1_0(struct pp_hwmgr *hwmgr, uint32_t i
                                        entries, mclk_dep_table,
                                        vce_state_record->ucMCLKIndex);
 
-       vce_state->mclk = mclk_dep_record->ulMclk;
+       vce_state->mclk = le32_to_cpu(mclk_dep_record->ulMclk);
        return 0;
 }