Skip to contentSkip to conversation

hwmon: (scmi) Enable sensors to assure they can be read

PATCH Applied Marek Vasut 2 participants 2 messages Oct 15, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (scmi) Enable sensors to assure they can be read

The SCMI specification states that SENSOR_CONFIG_SET is used to enable/disable the sensors. The sensors can be disabled by default, which is the case at least on NXP i.MX95. Explicitly trigger the SENSOR_CONFIG_SET to enable the sensors, otherwise sensor read may fail and won't return valid data.

---
Cc: Cristian Marussi <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: Sudeep Holla <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 drivers/hwmon/scmi-hwmon.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/hwmon/scmi-hwmon.c +9 -0
index 364199b332c0a..eec223d174c07 100644
@@ -240,6 +240,8 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)
 	const struct hwmon_channel_info **ptr_scmi_ci;
 	const struct scmi_handle *handle = sdev->handle;
 	struct scmi_protocol_handle *ph;
+	u32 sensor_config = FIELD_PREP(SCMI_SENS_CFG_SENSOR_ENABLED_MASK,
+				       SCMI_SENS_CFG_SENSOR_ENABLE);
 
 	if (!handle)
 		return -ENODEV;
@@ -339,6 +341,13 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)
 		if (!sensor)
 			continue;
 
+		ret = sensor_ops->config_set(ph, i, sensor_config);
+		if (ret) {
+			dev_err(dev, "Error enabling sensor %s. err=%d\n",
+				sensor->name, ret);
+			continue;
+		}
+
 		/*
 		 * Warn on any misconfiguration related to thermal zones but
 		 * bail out of probing only on memory errors.
Signature · 1 line
2.51.0
maintainer Applied
#1 lore raw
Quoted 7 lines · Marek Vasut

The SCMI specification states that SENSOR_CONFIG_SET is used to enable/disable the sensors. The sensors can be disabled by default, which is the case at least on NXP i.MX95. Explicitly trigger the SENSOR_CONFIG_SET to enable the sensors, otherwise sensor read may fail and won't return valid data.

Applied.

Thanks,
Guenter