blob: 8f9fa4584349f64a66d5373d271f90656a5cfe0e [file] [log] [blame]
developer51f6fcf2022-12-14 17:08:01 +08001From 30bd3547690ec1463b34c726577ae821e92a4390 Mon Sep 17 00:00:00 2001
2From: Howard Hsu <howard-yh.hsu@mediatek.com>
3Date: Mon, 12 Dec 2022 13:18:49 +0800
4Subject: [PATCH 4/4] wifi: mt76: mt7915: add error message in
5 mt7915_thermal_set_cur_throttle_state()
6
7Add dev_err so that it is easier to see invalid setting while looking at
8dmesg.
9
10Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
11Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
12Signed-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
18diff --git a/mt7915/init.c b/mt7915/init.c
19index 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;
63diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
64index 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--
772.18.0
78