summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authormkarthik <mkarthik@nvidia.com>2020-07-01 09:26:10 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2020-09-02 09:24:37 -0400
commitd489e9eab5e854ca996753f7fe314f1337e1308c (patch)
treefbd727fffa3172a5537deb56063df046bac1aec1 /include/linux
parentcbb2711e952b18d5b671d491bb79ae70dfd3aa25 (diff)
thermal: pwm-fan: Add tach feedback support
Why? The current implementation of the pwm-fan driver only writes a pwm value to the HW when requested. There is no tachometer rpm read back to check if the thermal performance is as expected. This change aims to add the rpm offsets necessary to maintain the desired fan rpm. How? A new work queue is added which gets the pwm fan rpm and checks the same for a rpm diff tolerance value. In case the tolerance value is exceeded, the next pwm corresponding to the next rpm ramp index is written to the pwm controller. Bug 200646929 Change-Id: Iff780a7edf98ca457ace10079149925adf06189d Signed-off-by: Mantravadi Karthik <mkarthik@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2369412 Tested-by: Rajkumar Kasirajan <rkasirajan@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: Rajkumar Kasirajan <rkasirajan@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: Sandipan Patra <spatra@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/therm_est.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/include/linux/therm_est.h b/include/linux/therm_est.h
index 6cca50946..fa1ea7ffc 100644
--- a/include/linux/therm_est.h
+++ b/include/linux/therm_est.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * include/linux/therm_est.h 2 * include/linux/therm_est.h
3 * 3 *
4 * Copyright (c) 2010-2019, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2010-2020, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This software is licensed under the terms of the GNU General Public 6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 7 * License version 2, as published by the Free Software Foundation, and
@@ -177,6 +177,22 @@ struct fan_dev_data {
177 u64 last_irq; 177 u64 last_irq;
178 u64 old_irq; 178 u64 old_irq;
179 179
180 struct device_node *of_node_tach;
181 bool use_tach_feedback;
182 int rpm_diff_tolerance;
183 int fan_rpm_target_hit_count;
184 int fan_rpm_ramp_index;
185 int next_target_rpm;
186 int fan_ramp_time_ms;
187 struct delayed_work fan_ramp_pwm_work;
188 struct delayed_work fan_ramp_rpm_work;
189 struct device *pwm_tach_dev;
190 struct mutex pwm_set;
191 bool fan_rpm_in_limits;
192 int rpm_valid_retry_delay;
193 int rpm_invalid_retry_delay;
194 int rpm_valid_retry_count;
195
180 bool continuous_gov; 196 bool continuous_gov;
181}; 197};
182 198
@@ -222,4 +238,20 @@ struct therm_fan_estimator {
222 238
223 bool is_continuous_gov; 239 bool is_continuous_gov;
224}; 240};
241
242#if IS_ENABLED(CONFIG_GENERIC_PWM_TACHOMETER)
243int pwm_tach_capture_rpm(struct device *dev);
244struct device *pwm_get_tach_dev(void);
245#else
246static inline int pwm_tach_capture_rpm(struct device *dev)
247{
248 return 0;
249}
250
251static inline struct device *pwm_get_tach_dev(void)
252{
253 return NULL;
254}
255#endif
256
225#endif /* _LINUX_THERM_EST_H */ 257#endif /* _LINUX_THERM_EST_H */