From: Johan Dahlin <jdahlin@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
Alwyn Kik <alwyn@kik.pw>,
Fabio Baltieri <fabio.baltieri@gmail.com>,
Hamza Mahfooz <someguy@effective-light.com>,
Johan Dahlin <jdahlin@gmail.com>
Subject: [PATCH v2 6/7] hwmon: (nct6683) Name the fan headers of the ASRock B850 Steel Legend WiFi
Date: Wed, 11 Nov 2026 09:28:37 +0100 [thread overview]
Message-ID: <20261111082838.1418051-7-jdahlin@gmail.com> (raw)
In-Reply-To: <20261111082838.1418051-1-jdahlin@gmail.com>
With fan control available, users need to know which pwm channel drives
which header. The driver has no fan labels.
Add a fanN_label attribute, visible on boards with a name table, and name
the channels of the ASRock B850 Steel Legend WiFi after the headers
printed on the board: CPU_FAN1, CPU_FAN2, AIO_PUMP and CHA_FAN1 to
CHA_FAN3. The order was inferred from the readings and the BIOS defaults.
Signed-off-by: Johan Dahlin <jdahlin@gmail.com>
---
Documentation/hwmon/nct6683.rst | 3 ++-
drivers/hwmon/nct6683.c | 32 ++++++++++++++++++++++++++++++--
2 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/Documentation/hwmon/nct6683.rst b/Documentation/hwmon/nct6683.rst
index a9c53d6eab9c..c8b8ade3b95b 100644
--- a/Documentation/hwmon/nct6683.rst
+++ b/Documentation/hwmon/nct6683.rst
@@ -62,7 +62,8 @@ customer ID 0x164a), where pwm1 to pwm6 control the fan headers reported
by fan1 to fan6, and on the ASRock BC-250 (NCT6686D, customer ID 0x162b).
On the ASRock B850 Steel Legend WiFi the temperature and voltage inputs
-are named after the H/W Monitor page of the BIOS setup.
+are named after the H/W Monitor page of the BIOS setup, and fanN_label
+names the fan header each channel is wired to.
pwmN_enable selects the fan control mode:
diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c
index 4fcd0c74af44..dcad72d1ef97 100644
--- a/drivers/hwmon/nct6683.c
+++ b/drivers/hwmon/nct6683.c
@@ -354,6 +354,15 @@ static const struct nct6683_mon_desc asrock_b850sl_mon_desc[] = {
{ }
};
+/*
+ * Fan headers as printed on the board, see the ASRock B850 Steel Legend WiFi
+ * User Manual, section 1.3 "Motherboard Layout", page 7, and section 2.12
+ * "Onboard Headers and Connectors", pages 44 to 46.
+ */
+static const char * const asrock_b850sl_fan_label[] = {
+ "CPU_FAN1", "CPU_FAN2", "AIO_PUMP", "CHA_FAN1", "CHA_FAN2", "CHA_FAN3",
+};
+
/* ------------------------------------------------------- */
struct nct6683_data {
@@ -375,6 +384,8 @@ struct nct6683_data {
/* Board specific sensor names, NULL if none */
const struct nct6683_mon_desc *mon_desc;
+ const char * const *fan_label;
+ int num_fan_label;
struct mutex update_lock; /* used to protect sensor updates */
bool valid; /* true if following fields are valid */
@@ -822,17 +833,30 @@ show_fan_pulses(struct device *dev, struct device_attribute *attr, char *buf)
((data->fanin_cfg[sattr->index] >> 5) & 0x03) + 1);
}
+static ssize_t
+show_fan_label(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
+ struct nct6683_data *data = dev_get_drvdata(dev);
+
+ return sysfs_emit(buf, "%s\n", data->fan_label[sattr->index]);
+}
+
static umode_t nct6683_fan_is_visible(struct kobject *kobj,
struct attribute *attr, int index)
{
struct device *dev = kobj_to_dev(kobj);
struct nct6683_data *data = dev_get_drvdata(dev);
- int fan = index / 3; /* fan index */
- int nr = index % 3; /* attribute index */
+ int fan = index / 4; /* fan index */
+ int nr = index % 4; /* attribute index */
if (!(data->have_fan & (1 << fan)))
return 0;
+ /* Fan names are only known for some boards */
+ if (nr == 3 && fan >= data->num_fan_label)
+ return 0;
+
/*
* Intel may have minimum fan speed limits,
* but register location and encoding are unknown.
@@ -846,6 +870,7 @@ static umode_t nct6683_fan_is_visible(struct kobject *kobj,
SENSOR_TEMPLATE(fan_input, "fan%d_input", S_IRUGO, show_fan, NULL, 0);
SENSOR_TEMPLATE(fan_pulses, "fan%d_pulses", S_IRUGO, show_fan_pulses, NULL, 0);
SENSOR_TEMPLATE(fan_min, "fan%d_min", S_IRUGO, show_fan_min, NULL, 0);
+SENSOR_TEMPLATE(fan_label, "fan%d_label", 0444, show_fan_label, NULL, 0);
/*
* nct6683_fan_is_visible uses the index into the following array
@@ -856,6 +881,7 @@ static struct sensor_device_template *nct6683_attributes_fan_template[] = {
&sensor_dev_template_fan_input,
&sensor_dev_template_fan_pulses,
&sensor_dev_template_fan_min,
+ &sensor_dev_template_fan_label,
NULL
};
@@ -1722,6 +1748,8 @@ static int nct6683_probe(struct platform_device *pdev)
break;
case NCT6683_CUSTOMER_ID_ASROCK8:
data->mon_desc = asrock_b850sl_mon_desc;
+ data->fan_label = asrock_b850sl_fan_label;
+ data->num_fan_label = ARRAY_SIZE(asrock_b850sl_fan_label);
break;
default:
if (!force)
--
2.53.0
next prev parent reply other threads:[~2026-11-11 8:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 8:28 [PATCH v2 0/7] hwmon: (nct6683) Fan control and sensor names for ASRock NCT6686D boards Johan Dahlin
2026-11-11 8:28 ` [PATCH v2 1/7] hwmon: (nct6683) Add customer ID for ASRock B850 Steel Legend WiFi Johan Dahlin
2026-11-11 8:28 ` [PATCH v2 2/7] hwmon: (nct6683) Restore automatic fan control on driver removal Johan Dahlin
2026-11-11 8:28 ` [PATCH v2 3/7] hwmon: (nct6683) Enable fan control on ASRock B850 Steel Legend WiFi Johan Dahlin
2026-11-11 8:28 ` [PATCH v2 4/7] hwmon: (nct6683) Enable fan control on ASRock BC-250 Johan Dahlin
2026-11-11 8:28 ` [PATCH v2 5/7] hwmon: (nct6683) Name the sensors of the ASRock B850 Steel Legend WiFi Johan Dahlin
2026-11-11 8:28 ` Johan Dahlin [this message]
2026-11-11 8:28 ` [PATCH v2 7/7] hwmon: (nct6683) Scale the +5V and +12V inputs " Johan Dahlin
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=20261111082838.1418051-7-jdahlin@gmail.com \
--to=jdahlin@gmail.com \
--cc=alwyn@kik.pw \
--cc=fabio.baltieri@gmail.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=someguy@effective-light.com \
/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®