Files
build/patch/kernel/spacemit-legacy-6.1/patches.bianbu/add-minimal-hwmon-support.patch
The-going 2e5611c92d spacemit: opensbi, u-boot, kernel legacy: Update for v1.0.15
Re-extract the kernel patches as a series.
Re-extract the u-boot patches as "git format-patch" command.

Unified patch extraction makes it easier to work with patches.
2024-10-09 20:47:00 +02:00

58 lines
1.7 KiB
Diff

From 3e033a705ea7266609cd7b92cf9d144c2fc30860 Mon Sep 17 00:00:00 2001
From: Luca Barbato <noone@nowhere.com>
Date: Thu, 6 Jun 2024 03:49:34 -0400
Subject: add minimal hwmon support
Signed-off-by: Luca Barbato
---
drivers/thermal/k1x-thermal.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/drivers/thermal/k1x-thermal.c b/drivers/thermal/k1x-thermal.c
index 9c66a0a23b1b..2267bcbce335 100644
--- a/drivers/thermal/k1x-thermal.c
+++ b/drivers/thermal/k1x-thermal.c
@@ -71,7 +71,7 @@ static int init_sensors(struct platform_device *pdev)
if (s->sr[1] >= MAX_SENSOR_NUMBER) {
dev_err(&pdev->dev, "un-fitable sensor range\n");
- return -EINVAL;
+ return -EINVAL;
}
#if 0
@@ -287,15 +287,24 @@ static int k1x_thermal_probe(struct platform_device *pdev)
for (i = s->sr[0]; i <= s->sr[1]; ++i) {
s->sdesc[i].base = s->base;
- s->sdesc[i].tzd = devm_thermal_of_zone_register(dev,
- i, s->sdesc + i, &k1x_of_thermal_ops);
- if (IS_ERR(s->sdesc[i].tzd)) {
- ret = PTR_ERR(s->sdesc[i].tzd);
- dev_err(dev, "faild to register sensor id %d: %d\n",
- i, ret);
+ struct thermal_zone_device *tzd =
+ devm_thermal_of_zone_register(dev, i, s->sdesc + i, &k1x_of_thermal_ops);
+ if (IS_ERR(tzd)) {
+ ret = PTR_ERR(tzd);
+ dev_err_probe(dev, ret, "faild to register sensor id %d", i);
return ret;
}
+ tzd->tzp->no_hwmon = false;
+
+ ret = devm_thermal_add_hwmon_sysfs(tzd);
+ if (ret < 0) {
+ dev_err_probe(dev, ret, "failed to register the hwmon entry");
+ return ret;
+ }
+
+ s->sdesc[i].tzd = tzd;
+
ret = devm_request_threaded_irq(dev, s->irq, k1x_thermal_irq,
k1x_thermal_irq_thread, IRQF_SHARED,
dev_name(&s->sdesc[i].tzd->device), s->sdesc + i);
--
2.35.3