Skip to content

Commit 28922a4

Browse files
Yang Wangalexdeucher
authored andcommitted
drm/amd/pm: disable OD_FAN_CURVE if temp or pwm range invalid for smu v14
Forcibly disable the OD_FAN_CURVE feature when temperature or PWM range is invalid, otherwise PMFW will reject this configuration on smu v14.0.2/14.0.3. example: $ sudo cat /sys/bus/pci/devices/<BDF>/gpu_od/fan_ctrl/fan_curve OD_FAN_CURVE: 0: 0C 0% 1: 0C 0% 2: 0C 0% 3: 0C 0% 4: 0C 0% OD_RANGE: FAN_CURVE(hotspot temp): 0C 0C FAN_CURVE(fan speed): 0% 0% $ echo "0 50 40" | sudo tee fan_curve kernel log: [ 969.761627] amdgpu 0000:03:00.0: amdgpu: Fan curve temp setting(50) must be within [0, 0]! [ 1010.897800] amdgpu 0000:03:00.0: amdgpu: Fan curve temp setting(50) must be within [0, 0]! Signed-off-by: Yang Wang <[email protected]> Acked-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit ab4905d) Cc: [email protected]
1 parent 429aec2 commit 28922a4

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656

5757
#define to_amdgpu_device(x) (container_of(x, struct amdgpu_device, pm.smu_i2c))
5858

59+
static void smu_v14_0_2_get_od_setting_limits(struct smu_context *smu,
60+
int od_feature_bit,
61+
int32_t *min, int32_t *max);
62+
5963
static const struct smu_feature_bits smu_v14_0_2_dpm_features = {
6064
.bits = { SMU_FEATURE_BIT_INIT(FEATURE_DPM_GFXCLK_BIT),
6165
SMU_FEATURE_BIT_INIT(FEATURE_DPM_UCLK_BIT),
@@ -922,8 +926,35 @@ static bool smu_v14_0_2_is_od_feature_supported(struct smu_context *smu,
922926
PPTable_t *pptable = smu->smu_table.driver_pptable;
923927
const OverDriveLimits_t * const overdrive_upperlimits =
924928
&pptable->SkuTable.OverDriveLimitsBasicMax;
929+
int32_t min_value, max_value;
930+
bool feature_enabled;
925931

926-
return overdrive_upperlimits->FeatureCtrlMask & (1U << od_feature_bit);
932+
switch (od_feature_bit) {
933+
case PP_OD_FEATURE_FAN_CURVE_BIT:
934+
feature_enabled = !!(overdrive_upperlimits->FeatureCtrlMask & (1U << od_feature_bit));
935+
if (feature_enabled) {
936+
smu_v14_0_2_get_od_setting_limits(smu, PP_OD_FEATURE_FAN_CURVE_TEMP,
937+
&min_value, &max_value);
938+
if (!min_value && !max_value) {
939+
feature_enabled = false;
940+
goto out;
941+
}
942+
943+
smu_v14_0_2_get_od_setting_limits(smu, PP_OD_FEATURE_FAN_CURVE_PWM,
944+
&min_value, &max_value);
945+
if (!min_value && !max_value) {
946+
feature_enabled = false;
947+
goto out;
948+
}
949+
}
950+
break;
951+
default:
952+
feature_enabled = !!(overdrive_upperlimits->FeatureCtrlMask & (1U << od_feature_bit));
953+
break;
954+
}
955+
956+
out:
957+
return feature_enabled;
927958
}
928959

929960
static void smu_v14_0_2_get_od_setting_limits(struct smu_context *smu,

0 commit comments

Comments
 (0)