developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 1 | From b5829fc76a9451651a8710a6c8b8f74b93d0a1cf Mon Sep 17 00:00:00 2001 |
developer | 8bff647 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 2 | From: Howard Hsu <howard-yh.hsu@mediatek.com> |
| 3 | Date: Thu, 13 Jul 2023 15:50:00 +0800 |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 4 | Subject: [PATCH 3/7] wifi: mt76: mt7915: move temperature margin check to |
developer | 8bff647 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 5 | mt7915_thermal_temp_store() |
| 6 | |
| 7 | Originally, we would reduce the 10-degree margin to the restore |
| 8 | temperature, but the user would not be aware of this when setting it. |
| 9 | Moving the margin reduction to the user setting check allows the user to |
| 10 | clearly understand that there is a 10-degree difference between the |
| 11 | restore and trigger temperature. |
| 12 | |
| 13 | Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com> |
| 14 | --- |
| 15 | mt7915/init.c | 7 ++++--- |
| 16 | mt7915/mcu.c | 3 +-- |
| 17 | 2 files changed, 5 insertions(+), 5 deletions(-) |
| 18 | |
| 19 | diff --git a/mt7915/init.c b/mt7915/init.c |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 20 | index c1f234e..294876a 100644 |
developer | 8bff647 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 21 | --- a/mt7915/init.c |
| 22 | +++ b/mt7915/init.c |
| 23 | @@ -83,12 +83,13 @@ static ssize_t mt7915_thermal_temp_store(struct device *dev, |
| 24 | mutex_lock(&phy->dev->mt76.mutex); |
| 25 | val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), 60, 130); |
| 26 | |
| 27 | + /* add a safety margin ~10 */ |
| 28 | if ((i - 1 == MT7915_CRIT_TEMP_IDX && |
| 29 | - val > phy->throttle_temp[MT7915_MAX_TEMP_IDX]) || |
| 30 | + val > phy->throttle_temp[MT7915_MAX_TEMP_IDX] - 10) || |
| 31 | (i - 1 == MT7915_MAX_TEMP_IDX && |
| 32 | - val < phy->throttle_temp[MT7915_CRIT_TEMP_IDX])) { |
| 33 | + val - 10 < phy->throttle_temp[MT7915_CRIT_TEMP_IDX])) { |
| 34 | dev_err(phy->dev->mt76.dev, |
| 35 | - "temp1_max shall be greater than temp1_crit."); |
| 36 | + "temp1_max shall be 10 degrees greater than temp1_crit."); |
| 37 | mutex_unlock(&phy->dev->mt76.mutex); |
| 38 | return -EINVAL; |
| 39 | } |
| 40 | diff --git a/mt7915/mcu.c b/mt7915/mcu.c |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 41 | index 9996c08..9a79119 100644 |
developer | 8bff647 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 42 | --- a/mt7915/mcu.c |
| 43 | +++ b/mt7915/mcu.c |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 44 | @@ -3156,8 +3156,7 @@ int mt7915_mcu_set_thermal_protect(struct mt7915_phy *phy) |
developer | 8bff647 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 45 | |
| 46 | /* set high-temperature trigger threshold */ |
| 47 | req.ctrl.ctrl_id = THERMAL_PROTECT_ENABLE; |
| 48 | - /* add a safety margin ~10 */ |
| 49 | - req.restore_temp = cpu_to_le32(phy->throttle_temp[0] - 10); |
| 50 | + req.restore_temp = cpu_to_le32(phy->throttle_temp[0]); |
| 51 | req.trigger_temp = cpu_to_le32(phy->throttle_temp[1]); |
| 52 | req.sustain_time = cpu_to_le16(10); |
| 53 | |
| 54 | -- |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 55 | 2.18.0 |
developer | 8bff647 | 2023-07-17 11:11:44 +0800 | [diff] [blame] | 56 | |