mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jerome Tollet <jerome.tollet@gmail.com>
To: Jean Delvare <jdelvare@suse.com>, Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org, Benoit Masson <yahoo@perenite.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jerome Tollet <jerome.tollet@gmail.com>
Subject: [RFC PATCH] hwmon: it87: Add basic IT8613E fan monitoring support
Date: Sat, 29 Aug 2026 13:08:29 +0200	[thread overview]
Message-ID: <20260829110829.34269-1-jerome.tollet@gmail.com> (raw)

The IT8613E is not recognized by the in-tree it87 driver. Full
support was proposed previously but withdrawn after problems were found
in the temperature and PWM paths.

Add conservative support limited to fan input monitoring. Detect device
ID 0x8613, check the fan pin muxes, use the existing 16-bit tachometer
layout, and expose enabled fan inputs read-only. Do not expose voltage,
temperature, PWM, limit, beep, or alarm interfaces.

The device ID and fan pin-mux checks follow the earlier v4 proposal by
Benoit Masson.

Tested on a system with an IT8613E at 0xa30, revision 12. Only
fan2_input was exposed, with stable readings between 1268 and 1320 RPM.
In a back-to-back comparison, the in-tree driver with force_id=0x8622
reported 1483 RPM and the out-of-tree driver reported 1442 RPM.

Link: https://lore.kernel.org/linux-hwmon/20260114221210.98071-1-yahoo@perenite.com/
Signed-off-by: Jerome Tollet <jerome.tollet@gmail.com>
---
 Documentation/hwmon/it87.rst | 10 ++++++
 drivers/hwmon/it87.c         | 65 ++++++++++++++++++++++++++++++++----
 2 files changed, 68 insertions(+), 7 deletions(-)

diff --git a/Documentation/hwmon/it87.rst b/Documentation/hwmon/it87.rst
index fc1c90b02..d00238e7e 100644
--- a/Documentation/hwmon/it87.rst
+++ b/Documentation/hwmon/it87.rst
@@ -11,6 +11,16 @@ Supported chips:
 
     Datasheet: Not publicly available
 
+  * IT8613E
+
+    Prefix: 'it8613'
+
+    Addresses scanned: from Super I/O config space (8 I/O ports)
+
+    Datasheet: Not publicly available
+
+    Only fan input monitoring is currently supported.
+
   * IT8620E
 
     Prefix: 'it8620'
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 87edb1b60..2f5800424 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -12,6 +12,7 @@
  *  similar parts.  The other devices are supported by different drivers.
  *
  *  Supports: IT8603E  Super I/O chip w/LPC interface
+ *            IT8613E  Super I/O chip w/LPC interface (fan inputs only)
  *            IT8620E  Super I/O chip w/LPC interface
  *            IT8622E  Super I/O chip w/LPC interface
  *            IT8623E  Super I/O chip w/LPC interface
@@ -65,7 +66,7 @@
 
 enum chips { it87, it8712, it8716, it8718, it8720, it8721, it8728, it8732,
 	     it8771, it8772, it8781, it8782, it8783, it8786, it8790,
-	     it8792, it8603, it8620, it8622, it8628, it8689, it87952 };
+	     it8792, it8603, it8613, it8620, it8622, it8628, it8689, it87952 };
 
 static struct platform_device *it87_pdev[2];
 
@@ -159,6 +160,7 @@ static inline void superio_exit(int ioreg, bool noexit)
 #define IT8786E_DEVID 0x8786
 #define IT8790E_DEVID 0x8790
 #define IT8603E_DEVID 0x8603
+#define IT8613E_DEVID 0x8613
 #define IT8620E_DEVID 0x8620
 #define IT8622E_DEVID 0x8622
 #define IT8623E_DEVID 0x8623
@@ -328,6 +330,7 @@ struct it87_devices {
 #define FEAT_FOUR_PWM		BIT(21)	/* Supports four fan controls */
 #define FEAT_FOUR_TEMP		BIT(22)
 #define FEAT_FANCTL_ONOFF	BIT(23)	/* chip has FAN_CTL ON/OFF */
+#define FEAT_FAN_INPUT_ONLY	BIT(24)	/* only fan inputs are supported */
 
 static const struct it87_devices it87_devices[] = {
 	[it87] = {
@@ -476,6 +479,12 @@ static const struct it87_devices it87_devices[] = {
 		  | FEAT_AVCC3 | FEAT_PWM_FREQ2,
 		.peci_mask = 0x07,
 	},
+	[it8613] = {
+		.name = "it8613",
+		.model = "IT8613E",
+		.features = FEAT_16BIT_FANS | FEAT_FIVE_FANS
+		  | FEAT_FAN_INPUT_ONLY,
+	},
 	[it8620] = {
 		.name = "it8620",
 		.model = "IT8620E",
@@ -560,6 +569,7 @@ static const struct it87_devices it87_devices[] = {
 #define has_scaling(data)	((data)->features & (FEAT_12MV_ADC | \
 						     FEAT_10_9MV_ADC))
 #define has_fanctl_onoff(data)	((data)->features & FEAT_FANCTL_ONOFF)
+#define has_fan_input_only(data)	((data)->features & FEAT_FAN_INPUT_ONLY)
 
 struct it87_sio_data {
 	int sioaddr;
@@ -2427,6 +2437,9 @@ static umode_t it87_is_visible(struct kobject *kobj,
 	struct device *dev = kobj_to_dev(kobj);
 	struct it87_data *data = dev_get_drvdata(dev);
 
+	if (has_fan_input_only(data))
+		return 0;
+
 	if ((index == 2 || index == 3) && !data->has_vid)
 		return 0;
 
@@ -2469,6 +2482,9 @@ static umode_t it87_fan_is_visible(struct kobject *kobj,
 	if (!(data->has_fan & BIT(i)))
 		return 0;
 
+	if (has_fan_input_only(data) && a != 0)
+		return 0;
+
 	if (a == 3) {				/* beep */
 		if (!data->has_beep)
 			return 0;
@@ -2790,6 +2806,9 @@ static int __init it87_find(int sioaddr, unsigned short *address,
 	case IT8623E_DEVID:
 		sio_data->type = it8603;
 		break;
+	case IT8613E_DEVID:
+		sio_data->type = it8613;
+		break;
 	case IT8620E_DEVID:
 		sio_data->type = it8620;
 		break;
@@ -2944,6 +2963,28 @@ static int __init it87_find(int sioaddr, unsigned short *address,
 
 		sio_data->beep_pin = superio_inb(sioaddr,
 						 IT87_SIO_BEEP_PIN_REG) & 0x3f;
+	} else if (sio_data->type == it8613) {
+		int reg27, reg29, reg2a;
+
+		superio_select(sioaddr, GPIO);
+
+		reg27 = superio_inb(sioaddr, IT87_SIO_GPIO3_REG);
+		reg29 = superio_inb(sioaddr, IT87_SIO_GPIO5_REG);
+		reg2a = superio_inb(sioaddr, IT87_SIO_PINX1_REG);
+
+		/* fan1 is not available on IT8613E. */
+		sio_data->skip_fan |= BIT(0);
+		if (reg29 & BIT(2))
+			sio_data->skip_fan |= BIT(1);
+		if (reg27 & BIT(7))
+			sio_data->skip_fan |= BIT(2);
+		if (!(reg2a & BIT(0)) || (reg29 & BIT(7)))
+			sio_data->skip_fan |= BIT(3);
+		if (!(reg27 & BIT(1)))
+			sio_data->skip_fan |= BIT(4);
+
+		/* PWM control is not yet supported. */
+		sio_data->skip_pwm |= GENMASK(5, 0);
 	} else if (sio_data->type == it8603) {
 		int reg27, reg29;
 
@@ -3355,7 +3396,8 @@ static void it87_init_device(struct platform_device *pdev)
 		data->auto_pwm[i][3] = 0x7f;	/* Full speed, hard-coded */
 	}
 
-	it87_check_limit_regs(data);
+	if (!has_fan_input_only(data))
+		it87_check_limit_regs(data);
 
 	/*
 	 * Temperature channels are not forcibly enabled, as they can be
@@ -3364,7 +3406,8 @@ static void it87_init_device(struct platform_device *pdev)
 	 * run-time through the temp{1-3}_type sysfs accessors if needed.
 	 */
 
-	it87_check_voltage_monitors_reset(data);
+	if (!has_fan_input_only(data))
+		it87_check_voltage_monitors_reset(data);
 
 	it87_check_tachometers_reset(pdev);
 
@@ -3525,10 +3568,14 @@ static int it87_probe(struct platform_device *pdev)
 	}
 
 	/* Check PWM configuration */
-	enable_pwm_interface = it87_check_pwm(dev);
-	if (!enable_pwm_interface)
-		dev_info(dev,
-			 "Detected broken BIOS defaults, disabling PWM interface\n");
+	if (has_fan_input_only(data)) {
+		enable_pwm_interface = 0;
+	} else {
+		enable_pwm_interface = it87_check_pwm(dev);
+		if (!enable_pwm_interface)
+			dev_info(dev,
+				 "Detected broken BIOS defaults, disabling PWM interface\n");
+	}
 
 	/* Starting with IT8721F, we handle scaling of internal voltages */
 	if (has_scaling(data)) {
@@ -3580,6 +3627,10 @@ static int it87_probe(struct platform_device *pdev)
 		if (((reg >> 4) & 0x03) == 0x01)
 			data->has_in |= BIT(12);
 	}
+	if (has_fan_input_only(data)) {
+		data->has_in = 0;
+		data->has_temp = 0;
+	}
 
 	data->has_beep = !!sio_data->beep_pin;
 

base-commit: 75f2c0b3690702c90863c2e138cb5520670845ea
-- 
2.55.0


                 reply	other threads:[~2026-08-29 11:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260829110829.34269-1-jerome.tollet@gmail.com \
    --to=jerome.tollet@gmail.com \
    --cc=corbet@lwn.net \
    --cc=jdelvare@suse.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    --cc=yahoo@perenite.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®