@@ -1497,6 +1497,59 @@ static int smu_v13_0_7_print_clk_levels(struct smu_context *smu,
14971497 return size ;
14981498}
14991499
1500+ static int smu_v13_0_7_od_restore_table_single (struct smu_context * smu , long input )
1501+ {
1502+ struct smu_table_context * table_context = & smu -> smu_table ;
1503+ OverDriveTableExternal_t * boot_overdrive_table =
1504+ (OverDriveTableExternal_t * )table_context -> boot_overdrive_table ;
1505+ OverDriveTableExternal_t * od_table =
1506+ (OverDriveTableExternal_t * )table_context -> overdrive_table ;
1507+ struct amdgpu_device * adev = smu -> adev ;
1508+ int i ;
1509+
1510+ switch (input ) {
1511+ case PP_OD_EDIT_FAN_CURVE :
1512+ for (i = 0 ; i < NUM_OD_FAN_MAX_POINTS ; i ++ ) {
1513+ od_table -> OverDriveTable .FanLinearTempPoints [i ] =
1514+ boot_overdrive_table -> OverDriveTable .FanLinearTempPoints [i ];
1515+ od_table -> OverDriveTable .FanLinearPwmPoints [i ] =
1516+ boot_overdrive_table -> OverDriveTable .FanLinearPwmPoints [i ];
1517+ }
1518+ od_table -> OverDriveTable .FanMode = FAN_MODE_AUTO ;
1519+ od_table -> OverDriveTable .FeatureCtrlMask |= BIT (PP_OD_FEATURE_FAN_CURVE_BIT );
1520+ break ;
1521+ case PP_OD_EDIT_ACOUSTIC_LIMIT :
1522+ od_table -> OverDriveTable .AcousticLimitRpmThreshold =
1523+ boot_overdrive_table -> OverDriveTable .AcousticLimitRpmThreshold ;
1524+ od_table -> OverDriveTable .FanMode = FAN_MODE_AUTO ;
1525+ od_table -> OverDriveTable .FeatureCtrlMask |= BIT (PP_OD_FEATURE_FAN_CURVE_BIT );
1526+ break ;
1527+ case PP_OD_EDIT_ACOUSTIC_TARGET :
1528+ od_table -> OverDriveTable .AcousticTargetRpmThreshold =
1529+ boot_overdrive_table -> OverDriveTable .AcousticTargetRpmThreshold ;
1530+ od_table -> OverDriveTable .FanMode = FAN_MODE_AUTO ;
1531+ od_table -> OverDriveTable .FeatureCtrlMask |= BIT (PP_OD_FEATURE_FAN_CURVE_BIT );
1532+ break ;
1533+ case PP_OD_EDIT_FAN_TARGET_TEMPERATURE :
1534+ od_table -> OverDriveTable .FanTargetTemperature =
1535+ boot_overdrive_table -> OverDriveTable .FanTargetTemperature ;
1536+ od_table -> OverDriveTable .FanMode = FAN_MODE_AUTO ;
1537+ od_table -> OverDriveTable .FeatureCtrlMask |= BIT (PP_OD_FEATURE_FAN_CURVE_BIT );
1538+ break ;
1539+ case PP_OD_EDIT_FAN_MINIMUM_PWM :
1540+ od_table -> OverDriveTable .FanMinimumPwm =
1541+ boot_overdrive_table -> OverDriveTable .FanMinimumPwm ;
1542+ od_table -> OverDriveTable .FanMode = FAN_MODE_AUTO ;
1543+ od_table -> OverDriveTable .FeatureCtrlMask |= BIT (PP_OD_FEATURE_FAN_CURVE_BIT );
1544+ break ;
1545+ default :
1546+ dev_info (adev -> dev , "Invalid table index: %ld\n" , input );
1547+ return - EINVAL ;
1548+ }
1549+
1550+ return 0 ;
1551+ }
1552+
15001553static int smu_v13_0_7_od_edit_dpm_table (struct smu_context * smu ,
15011554 enum PP_OD_DPM_TABLE_COMMAND type ,
15021555 long input [],
@@ -1783,11 +1836,17 @@ static int smu_v13_0_7_od_edit_dpm_table(struct smu_context *smu,
17831836 break ;
17841837
17851838 case PP_OD_RESTORE_DEFAULT_TABLE :
1786- feature_ctrlmask = od_table -> OverDriveTable .FeatureCtrlMask ;
1787- memcpy (od_table ,
1788- table_context -> boot_overdrive_table ,
1789- sizeof (OverDriveTableExternal_t ));
1790- od_table -> OverDriveTable .FeatureCtrlMask = feature_ctrlmask ;
1839+ if (size == 1 ) {
1840+ ret = smu_v13_0_7_od_restore_table_single (smu , input [0 ]);
1841+ if (ret )
1842+ return ret ;
1843+ } else {
1844+ feature_ctrlmask = od_table -> OverDriveTable .FeatureCtrlMask ;
1845+ memcpy (od_table ,
1846+ table_context -> boot_overdrive_table ,
1847+ sizeof (OverDriveTableExternal_t ));
1848+ od_table -> OverDriveTable .FeatureCtrlMask = feature_ctrlmask ;
1849+ }
17911850 fallthrough ;
17921851
17931852 case PP_OD_COMMIT_DPM_TABLE :
0 commit comments