Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: linux-hwmon@vger.kernel.org
Cc: Tomasz Bojanowski <tomasz@bojanowski.me>,
	Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH 3/4] hwmon: (msi_mystic_light) Make sensor read function board specific
Date: Sat,  7 Nov 2026 16:01:30 -0800	[thread overview]
Message-ID: <20261108000131.1249664-4-linux@roeck-us.net> (raw)
In-Reply-To: <20261108000131.1249664-1-linux@roeck-us.net>

Mystic Light controllers on different generations of MSI motherboards
use different HID communication mechanisms to retrieve voltage sensor
data. While 800-series motherboards expose sensor readings directly via
a synchronous HID_REQ_GET_REPORT request on feature report 0xf0, older
500- and 600-series motherboards require requesting sensor data via an
output report and receiving the response asynchronously as an input
event.

Add a read_report() callback to struct msi_ml_board, rename the existing
implementation to msi_ml_read_report_7e61() for MS-7E61, and turn
msi_ml_read_report() into a dispatch wrapper so probe and hwmon read
paths remain board-independent.

Cc: Tomasz Bojanowski <tomasz@bojanowski.me>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/hwmon/msi_mystic_light.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/msi_mystic_light.c b/drivers/hwmon/msi_mystic_light.c
index 4b4e07f15aa8..098b4ecd0596 100644
--- a/drivers/hwmon/msi_mystic_light.c
+++ b/drivers/hwmon/msi_mystic_light.c
@@ -59,6 +59,7 @@ struct msi_ml_board {
 	const char *const *in_label;
 	/* little endian u16 in mV, offset at most MSI_ML_SENSOR_REPORT_SIZE - 2 */
 	const u8 *in_offset;
+	int (*read_report)(struct msi_ml_data *priv);
 };
 
 /*
@@ -67,7 +68,7 @@ struct msi_ml_board {
  * hwmon core serializes. No additional locking is needed for the buffer
  * and the cached values.
  */
-static int msi_ml_read_report(struct msi_ml_data *priv)
+static int msi_ml_read_report_7e61(struct msi_ml_data *priv)
 {
 	const struct msi_ml_board *board = priv->board;
 	u8 *buf = priv->buf;
@@ -98,6 +99,11 @@ static int msi_ml_read_report(struct msi_ml_data *priv)
 	return 0;
 }
 
+static int msi_ml_read_report(struct msi_ml_data *priv)
+{
+	return priv->board->read_report(priv);
+}
+
 static umode_t msi_ml_is_visible(const void *data,
 				 enum hwmon_sensor_types type, u32 attr,
 				 int channel)
@@ -265,6 +271,7 @@ static const struct msi_ml_board msi_ml_7e61 = {
 	.num_in = ARRAY_SIZE(msi_ml_7e61_in_label),
 	.in_label = msi_ml_7e61_in_label,
 	.in_offset = msi_ml_7e61_in_offset,
+	.read_report = msi_ml_read_report_7e61,
 };
 
 static const struct dmi_system_id msi_ml_dmi_table[] __initconst = {
-- 
2.45.2


  parent reply	other threads:[~2026-11-08  0:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-08  0:01 [PATCH 0/4] hwmon: (msi_mystic_light) Add support for additional MSI motherboards Guenter Roeck
2026-11-08  0:01 ` [PATCH 1/4] hwmon: (msi_mystic_light) Rearrange code to simplify adding per-board read functions Guenter Roeck
2026-11-08  0:01 ` [PATCH 2/4] hwmon: (msi_mystic_light) Stop calling hid_hw_power() Guenter Roeck
2026-11-08  0:01 ` Guenter Roeck [this message]
2026-11-08  0:01 ` [PATCH 4/4] hwmon: (msi_mystic_light) Add support for additional boards Guenter Roeck
2026-11-08  8:14 ` [PATCH 0/4] hwmon: (msi_mystic_light) Add support for additional MSI motherboards Tomasz Bojanowski

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=20261108000131.1249664-4-linux@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=tomasz@bojanowski.me \
    /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