* [PATCH] hwmon: (scmi) Enable sensors to assure they can be read
@ 2025-10-15 11:49 Marek Vasut
2025-10-15 18:04 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Marek Vasut @ 2025-10-15 11:49 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Marek Vasut, Cristian Marussi, Guenter Roeck, Sudeep Holla,
arm-scmi, linux-hwmon
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.
Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
---
Cc: Cristian Marussi <cristian.marussi@arm.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: arm-scmi@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-hwmon@vger.kernel.org
---
drivers/hwmon/scmi-hwmon.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c
index 364199b332c0a..eec223d174c07 100644
--- a/drivers/hwmon/scmi-hwmon.c
+++ b/drivers/hwmon/scmi-hwmon.c
@@ -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.
--
2.51.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hwmon: (scmi) Enable sensors to assure they can be read
2025-10-15 11:49 [PATCH] hwmon: (scmi) Enable sensors to assure they can be read Marek Vasut
@ 2025-10-15 18:04 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2025-10-15 18:04 UTC (permalink / raw)
To: Marek Vasut
Cc: linux-arm-kernel, Cristian Marussi, Sudeep Holla, arm-scmi,
linux-hwmon
On Wed, Oct 15, 2025 at 01:49:28PM +0200, Marek Vasut wrote:
> 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.
>
> Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
Applied.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-15 18:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-15 11:49 [PATCH] hwmon: (scmi) Enable sensors to assure they can be read Marek Vasut
2025-10-15 18:04 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).