Skip to contentSkip to conversation

hwmon: (dell-smm) Support additional attributes

PATCH Superseded [email protected] 2 participants 4 messages Sep 24, 2021

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover hwmon: (dell-smm) Support additional attributes

From: Armin Wolf <[email protected]>

This patch series adds support for fanX_min, fanX_max and fanX_target. A second patch also removes some unnecessary includes.

Both patches where tested on a Dell Inspiron 3505 and a Dell Latitude C600.

Changes in v2:
- update documentation
- prevent out-of-bounds read/write when module is loaded with custom fan_max value

Armin Wolf (2):
hwmon: (dell-smm) Add support for fanX_min, fanX_max and fanX_target
hwmon: (dell-smm) Remove unnecessary includes

 Documentation/hwmon/dell-smm-hwmon.rst |  3 ++
 drivers/hwmon/dell-smm-hwmon.c         | 65 ++++++++++++++++++++++----
 2 files changed, 60 insertions(+), 8 deletions(-)

--
2.20.1

#1 lore raw

PATCH v2 1/2 hwmon: (dell-smm) Add support for fanX_min, fanX_max and fanX_target

From: Armin Wolf <[email protected]>

The nominal speed of each fan can be obtained with i8k_get_fan_nominal_speed(), however the result is not available from userspace.
Change that by adding fanX_min, fanX_max and fanX_target attributes. All are RO since fan control happens over pwm.

Tested on a Dell Inspiron 3505 and a Dell Latitude C600.

---
 Documentation/hwmon/dell-smm-hwmon.rst |  3 ++
 drivers/hwmon/dell-smm-hwmon.c         | 63 +++++++++++++++++++++++---
 2 files changed, 60 insertions(+), 6 deletions(-)
Documentation/hwmon/dell-smm-hwmon.rst +3 -0
index 3bf77a5df995..beec88491171 100644
@@ -34,6 +34,9 @@ Name				Perm	Description
 =============================== ======= =======================================
 fan[1-3]_input                  RO      Fan speed in RPM.
 fan[1-3]_label                  RO      Fan label.
+fan[1-3]_min                    RO      Minimal Fan speed in RPM
+fan[1-3]_max                    RO      Maximal Fan speed in RPM
+fan[1-3]_target                 RO      Expected Fan speed in RPM
 pwm[1-3]                        RW      Control the fan PWM duty-cycle.
 pwm1_enable                     WO      Enable or disable automatic BIOS fan
                                         control (not supported on all laptops,
drivers/hwmon/dell-smm-hwmon.c +57 -6

99 lines not on this page · raw message

--
2.20.1

#2 lore raw

PATCH v2 2/2 hwmon: (dell-smm) Remove unnecessary includes

In reply to [email protected]

From: Armin Wolf <[email protected]>

sched.h and io.h are not used anywhere in dell-smm-hwmon.c.

---
 drivers/hwmon/dell-smm-hwmon.c | 2 --
 1 file changed, 2 deletions(-)
drivers/hwmon/dell-smm-hwmon.c +0 -2
index d7d8da4a63db..30be7e5574a3 100644
@@ -26,8 +26,6 @@
 #include <linux/mutex.h>
 #include <linux/hwmon.h>
 #include <linux/uaccess.h>
-#include <linux/io.h>
-#include <linux/sched.h>
 #include <linux/ctype.h>
 #include <linux/smp.h>
 

--
2.20.1

maintainer Reviewed-by on v2 2/2
#3 lore raw

Re: [PATCH v2 2/2] hwmon: (dell-smm) Remove unnecessary includes

Quoted 5 lines · On Friday 24 September 2021 13:45:05 [email protected] wrote:

From: Armin Wolf <[email protected]>

sched.h and io.h are not used anywhere in dell-smm-hwmon.c.

sched.h is not used anymore as driver now calls smp_call_on_cpu() function.

Quoted 20 lines
---
 drivers/hwmon/dell-smm-hwmon.c | 2 --
 1 file changed, 2 deletions(-)
drivers/hwmon/dell-smm-hwmon.c +0 -3
index d7d8da4a63db..30be7e5574a3 100644
@@ -26,8 +26,6 @@
 #include <linux/mutex.h>
 #include <linux/hwmon.h>
 #include <linux/uaccess.h>
-#include <linux/io.h>
-#include <linux/sched.h>
 #include <linux/ctype.h>
 #include <linux/smp.h>
 
--

2.20.1