From c3cd2b4417ea8767d35b4e04ba9731fb58a2a477 Mon Sep 17 00:00:00 2001 From: Mantravadi Karthik Date: Fri, 20 Nov 2020 13:13:40 +0530 Subject: pwm: fan: Add support for always on fan Why? In case of continuous governor, the fan-poweron pwm value is assumed to be at index 1 of pwm values. In case of tmargin the pwm table would be reversed (high to low) and hence the assumption is invalid. How? While calculating the pwm value in the case of continuous governor, add a check if the cooling device is always on fan. If true, for all values of temp, pwm should be calculated instead of assigning 0. Bug 200646929 Change-Id: Ibed572fa2af9f8bd36a4a4cbb472029e21aeb442 Signed-off-by: Mantravadi Karthik Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2448826 Tested-by: mobile promotions Reviewed-by: svc-mobile-coverity Reviewed-by: Bibek Basu Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit --- include/linux/platform_data/pwm_fan.h | 4 ++++ include/linux/therm_est.h | 1 + 2 files changed, 5 insertions(+) (limited to 'include/linux') diff --git a/include/linux/platform_data/pwm_fan.h b/include/linux/platform_data/pwm_fan.h index cf35089ce..a5a874837 100644 --- a/include/linux/platform_data/pwm_fan.h +++ b/include/linux/platform_data/pwm_fan.h @@ -36,4 +36,8 @@ struct pwm_fan_platform_data { int tach_gpio; int pwm_gpio; }; + +#if IS_BUILTIN(CONFIG_PWM_FAN) +bool is_fan_always_on(struct thermal_cooling_device *cdev); +#endif #endif diff --git a/include/linux/therm_est.h b/include/linux/therm_est.h index 1e813e361..a321f91a4 100644 --- a/include/linux/therm_est.h +++ b/include/linux/therm_est.h @@ -195,6 +195,7 @@ struct fan_dev_data { bool continuous_gov; bool is_tmargin; + bool is_always_on; }; #define DEBUG 0 -- cgit v1.2.2