Hi Alex and Evan, For the fan control via sysfs, I think we need to clarify the use case. We support manual/auto fan control mode. User can set the mode through pwm_enable. 1 mean manual. 2 mean auto User can set fan speed via pwm1 and fan1_input. For pwm1, user set the percentage value (0% - 100%) And can get the pwm1's range via sysfs: pwm1_min, pwm1_max. the range is [0, 255]. In driver, we transfer to [0% - 100%] For fan1_input, user set the fan's resolution per minute No way for user to get the range. On Tonga, the range is (0, 6000]. Not support zero-rpm on tonga. Do we need to add new sysfs to expose the RPM range or just print the range in dmesg if user's setting is out of range? Another question is: Currently, the default fan control mode is auto. When user change the fan speed via pwm1 or fan1_input, we switch to manual mode automatically. So if user want to change back to auto fan control mode, they need to echo 2 to pwm_enable. Best Regards Rex From: Deucher, Alexander Sent: Thursday, September 20, 2018 9:52 PM To: Zhu, Rex <Rex.Zhu at amd.com>; amd-gfx at lists.freedesktop.org Subject: Re: [PATCH 1/3] drm/amd/pp: Avoid divide-by-zero in smu7_fan_ctrl_set_fan_speed_rpm Series is: Reviewed-by: Alex Deucher <alexander.deucher at amd.com<mailto:alexander.deucher at amd.com>> ________________________________ From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx<mailto:amd-gfx-bounces at lists.freedesktop.org>> on behalf of Rex Zhu <Rex.Zhu at amd.com<mailto:Rex.Zhu at amd.com>> Sent: Thursday, September 20, 2018 3:14:25 AM To: amd-gfx at lists.freedesktop.org<mailto:amd-gfx at lists.freedesktop.org> Cc: Zhu, Rex Subject: [PATCH 1/3] drm/amd/pp: Avoid divide-by-zero in smu7_fan_ctrl_set_fan_speed_rpm The minRPM speed maybe equal to zero. so need to check input RPM not equal to 0, otherwise cause divide-by-zero driver crash. Signed-off-by: Rex Zhu <Rex.Zhu at amd.com<mailto:Rex.Zhu at amd.com>> --- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c index 44527755..d61a9b4 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_thermal.c @@ -260,6 +260,7 @@ int smu7_fan_ctrl_set_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t speed) if (hwmgr->thermal_controller.fanInfo.bNoFan || (hwmgr->thermal_controller.fanInfo. ucTachometerPulsesPerRevolution == 0) || + speed == 0 || (speed < hwmgr->thermal_controller.fanInfo.ulMinRPM) || (speed > hwmgr->thermal_controller.fanInfo.ulMaxRPM)) return 0; -- 1.9.1 _______________________________________________ amd-gfx mailing list amd-gfx at lists.freedesktop.org<mailto:amd-gfx at lists.freedesktop.org> https://lists.freedesktop.org/mailman/listinfo/amd-gfx -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20180920/d061999c/attachment.html>