From: Armin Wolf <W_Armin@gmx.de>
To: jdelvare@suse.com, linux@roeck-us.net
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] hwmon: Add pwmX_fan_channel attribute
Date: Sat, 23 Jul 2022 05:38:19 +0200 [thread overview]
Message-ID: <20220723033820.22612-2-W_Armin@gmx.de> (raw)
In-Reply-To: <20220723033820.22612-1-W_Armin@gmx.de>
Until now, userspace software needs to guess which
PWM channel is associated with which fan channel by
probing each PWM output and watch for fan speed changes.
This proccess is error-prone and unreliable.
Some hwmon chips, especially firmware-based ones, already
know which PWM output is associated with which fan channel.
Allow such chips to export this knowledge to userspace.
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
Documentation/ABI/testing/sysfs-class-hwmon | 8 ++++++++
Documentation/hwmon/sysfs-interface.rst | 3 +++
drivers/hwmon/hwmon.c | 1 +
include/linux/hwmon.h | 2 ++
4 files changed, 14 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-class-hwmon b/Documentation/ABI/testing/sysfs-class-hwmon
index 7271781a23b2..f3d653bcf736 100644
--- a/Documentation/ABI/testing/sysfs-class-hwmon
+++ b/Documentation/ABI/testing/sysfs-class-hwmon
@@ -315,6 +315,14 @@ Description:
RW
+What: /sys/class/hwmon/hwmonX/pwmY_fan_channel
+Description:
+ Select which fan channel is controlled by this PWM output.
+
+ Valid fan channel/PWM output combinations are chip-dependent.
+
+ RW
+
What: /sys/class/hwmon/hwmonX/pwmY_auto_channels_temp
Description:
Select which temperature channels affect this PWM output in
diff --git a/Documentation/hwmon/sysfs-interface.rst b/Documentation/hwmon/sysfs-interface.rst
index 209626fb2405..17fcec03d3c5 100644
--- a/Documentation/hwmon/sysfs-interface.rst
+++ b/Documentation/hwmon/sysfs-interface.rst
@@ -209,6 +209,9 @@ PWM
`pwm[1-*]_freq`
Base PWM frequency in Hz.
+`pwm[1-*]_fan_channel`
+ Select which fan channel is controlled by this PWM output.
+
`pwm[1-*]_auto_channels_temp`
Select which temperature channels affect this PWM output in
auto mode.
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 2e2cd79d89eb..8c2d7574c461 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -604,6 +604,7 @@ static const char * const hwmon_pwm_attr_templates[] = {
[hwmon_pwm_enable] = "pwm%d_enable",
[hwmon_pwm_mode] = "pwm%d_mode",
[hwmon_pwm_freq] = "pwm%d_freq",
+ [hwmon_pwm_fan_channel] = "pwm%d_fan_channel",
[hwmon_pwm_auto_channels_temp] = "pwm%d_auto_channels_temp",
};
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 14325f93c6b2..9d40cc1e520f 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -332,6 +332,7 @@ enum hwmon_pwm_attributes {
hwmon_pwm_enable,
hwmon_pwm_mode,
hwmon_pwm_freq,
+ hwmon_pwm_fan_channel,
hwmon_pwm_auto_channels_temp,
};
@@ -339,6 +340,7 @@ enum hwmon_pwm_attributes {
#define HWMON_PWM_ENABLE BIT(hwmon_pwm_enable)
#define HWMON_PWM_MODE BIT(hwmon_pwm_mode)
#define HWMON_PWM_FREQ BIT(hwmon_pwm_freq)
+#define HWMON_PWM_FAN_CHANNEL BIT(hwmon_pwm_fan_channel)
#define HWMON_PWM_AUTO_CHANNELS_TEMP BIT(hwmon_pwm_auto_channels_temp)
enum hwmon_intrusion_attributes {
--
2.30.2
next prev parent reply other threads:[~2022-07-23 3:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-23 3:38 [PATCH 0/2] hwmon: Add new " Armin Wolf
2022-07-23 3:38 ` Armin Wolf [this message]
2022-07-23 14:17 ` [PATCH 1/2] hwmon: Add " Guenter Roeck
2022-07-24 1:20 ` Armin Wolf
2022-07-24 14:44 ` Guenter Roeck
2022-07-24 16:06 ` Armin Wolf
2022-07-24 16:30 ` Guenter Roeck
2022-07-24 17:50 ` Armin Wolf
2022-07-23 3:38 ` [PATCH 2/2] hwmon: (dell-smm) Add support for " Armin Wolf
2022-07-23 14:14 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220723033820.22612-2-W_Armin@gmx.de \
--to=w_armin@gmx.de \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®