blob: 2334dd5ad4faec8e3834db18e56985824f91e117 [file] [log] [blame]
developer699cda22022-12-17 15:21:57 +08001From 52c2b1c1b68a4bf886a86a39f9d2a489de0b3914 Mon Sep 17 00:00:00 2001
developer51f6fcf2022-12-14 17:08:01 +08002From: Howard Hsu <howard-yh.hsu@mediatek.com>
3Date: Mon, 12 Dec 2022 13:18:49 +0800
developer30d39c22022-12-16 10:29:49 +08004Subject: [PATCH 4/6] wifi: mt76: mt7915: add error message in
developer51f6fcf2022-12-14 17:08:01 +08005 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
developer699cda22022-12-17 15:21:57 +080019index 98655e4..b23a2fb 100644
developer51f6fcf2022-12-14 17:08:01 +080020--- 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
developer699cda22022-12-17 15:21:57 +080064index e58650b..942d70c 100644
developer51f6fcf2022-12-14 17:08:01 +080065--- 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--
developer699cda22022-12-17 15:21:57 +0800772.36.1
developer51f6fcf2022-12-14 17:08:01 +080078