developer | 9851a29 | 2022-12-15 17:33:43 +0800 | [diff] [blame] | 1 | From 7dec2d2252d53a22731ba2656dc4cd21e8f4e685 Mon Sep 17 00:00:00 2001 |
developer | 51f6fcf | 2022-12-14 17:08:01 +0800 | [diff] [blame] | 2 | From: Howard Hsu <howard-yh.hsu@mediatek.com> |
| 3 | Date: Mon, 12 Dec 2022 13:18:49 +0800 |
developer | 9851a29 | 2022-12-15 17:33:43 +0800 | [diff] [blame] | 4 | Subject: [PATCH 4/5] wifi: mt76: mt7915: add error message in |
developer | 51f6fcf | 2022-12-14 17:08:01 +0800 | [diff] [blame] | 5 | mt7915_thermal_set_cur_throttle_state() |
| 6 | |
| 7 | Add dev_err so that it is easier to see invalid setting while looking at |
| 8 | dmesg. |
| 9 | |
| 10 | Co-developed-by: Ryder Lee <ryder.lee@mediatek.com> |
| 11 | Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> |
| 12 | Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com> |
| 13 | --- |
| 14 | mt7915/init.c | 12 +++++++----- |
| 15 | mt7915/mt7915.h | 2 ++ |
| 16 | 2 files changed, 9 insertions(+), 5 deletions(-) |
| 17 | |
| 18 | diff --git a/mt7915/init.c b/mt7915/init.c |
| 19 | index 98655e4d..b23a2fb8 100644 |
| 20 | --- a/mt7915/init.c |
| 21 | +++ b/mt7915/init.c |
| 22 | @@ -145,8 +145,11 @@ mt7915_thermal_set_cur_throttle_state(struct thermal_cooling_device *cdev, |
| 23 | u8 throttling = MT7915_THERMAL_THROTTLE_MAX - state; |
| 24 | int ret; |
| 25 | |
| 26 | - if (state > MT7915_CDEV_THROTTLE_MAX) |
| 27 | + if (state > MT7915_CDEV_THROTTLE_MAX) { |
| 28 | + dev_err(phy->dev->mt76.dev, |
| 29 | + "please specify a valid throttling state\n"); |
| 30 | return -EINVAL; |
| 31 | + } |
| 32 | |
| 33 | if (state == phy->cdev_state) |
| 34 | return 0; |
| 35 | @@ -175,7 +178,7 @@ static void mt7915_unregister_thermal(struct mt7915_phy *phy) |
| 36 | struct wiphy *wiphy = phy->mt76->hw->wiphy; |
| 37 | |
| 38 | if (!phy->cdev) |
| 39 | - return; |
| 40 | + return; |
| 41 | |
| 42 | sysfs_remove_link(&wiphy->dev.kobj, "cooling_device"); |
| 43 | thermal_cooling_device_unregister(phy->cdev); |
| 44 | @@ -209,8 +212,8 @@ static int mt7915_thermal_init(struct mt7915_phy *phy) |
| 45 | return PTR_ERR(hwmon); |
| 46 | |
| 47 | /* initialize critical/maximum high temperature */ |
| 48 | - phy->throttle_temp[MT7915_CRIT_TEMP_IDX] = 110; |
| 49 | - phy->throttle_temp[MT7915_MAX_TEMP_IDX] = 120; |
| 50 | + phy->throttle_temp[MT7915_CRIT_TEMP_IDX] = MT7915_CRIT_TEMP; |
| 51 | + phy->throttle_temp[MT7915_MAX_TEMP_IDX] = MT7915_MAX_TEMP; |
| 52 | |
| 53 | return 0; |
| 54 | } |
| 55 | @@ -1185,7 +1188,6 @@ static void mt7915_stop_hardware(struct mt7915_dev *dev) |
| 56 | mt7986_wmac_disable(dev); |
| 57 | } |
| 58 | |
| 59 | - |
| 60 | int mt7915_register_device(struct mt7915_dev *dev) |
| 61 | { |
| 62 | struct mt7915_phy *phy2; |
| 63 | diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
| 64 | index e58650bb..942d70c5 100644 |
| 65 | --- a/mt7915/mt7915.h |
| 66 | +++ b/mt7915/mt7915.h |
| 67 | @@ -72,6 +72,8 @@ |
| 68 | |
| 69 | #define MT7915_CRIT_TEMP_IDX 0 |
| 70 | #define MT7915_MAX_TEMP_IDX 1 |
| 71 | +#define MT7915_CRIT_TEMP 110 |
| 72 | +#define MT7915_MAX_TEMP 120 |
| 73 | |
| 74 | struct mt7915_vif; |
| 75 | struct mt7915_sta; |
| 76 | -- |
| 77 | 2.18.0 |
| 78 | |