1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-02-15 04:42:02 +00:00
openmptcprouter/6.1/target/linux/bcm27xx/patches-6.1/950-0689-hwmon-emc2305-Add-calls-to-initialise-of-cooling-map.patch
Ycarus (Yannick Chabanois) 3743692973 Fix RPI5 support
2023-11-17 17:31:36 +01:00

53 lines
1.8 KiB
Diff

From f6031cf3ebf8a386dedfd7da0d561b705a762896 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Fri, 21 Apr 2023 14:49:38 +0100
Subject: [PATCH] hwmon: emc2305: Add calls to initialise of cooling maps
Commit 46ef9d4ed26b ("hwmon: emc2305: fixups for driver submitted to
mailing lists") missed adding the call to thermal_of_cooling_device_register
required to configure any cooling maps for the device, hence stopping it
from actually ever changing speed.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/hwmon/emc2305.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
--- a/drivers/hwmon/emc2305.c
+++ b/drivers/hwmon/emc2305.c
@@ -348,9 +348,17 @@ static int emc2305_set_single_tz(struct
cdev_idx = (idx) ? idx - 1 : 0;
pwm = data->pwm_min[cdev_idx];
- data->cdev_data[cdev_idx].cdev =
- thermal_cooling_device_register(emc2305_fan_name[idx], data,
- &emc2305_cooling_ops);
+ if (dev->of_node)
+ data->cdev_data[cdev_idx].cdev =
+ devm_thermal_of_cooling_device_register(dev, dev->of_node,
+ emc2305_fan_name[idx],
+ data,
+ &emc2305_cooling_ops);
+ else
+ data->cdev_data[cdev_idx].cdev =
+ thermal_cooling_device_register(emc2305_fan_name[idx],
+ data,
+ &emc2305_cooling_ops);
if (IS_ERR(data->cdev_data[cdev_idx].cdev)) {
dev_err(dev, "Failed to register cooling device %s\n", emc2305_fan_name[idx]);
@@ -403,9 +411,11 @@ static void emc2305_unset_tz(struct devi
int i;
/* Unregister cooling device. */
- for (i = 0; i < EMC2305_PWM_MAX; i++)
- if (data->cdev_data[i].cdev)
- thermal_cooling_device_unregister(data->cdev_data[i].cdev);
+ if (!dev->of_node) {
+ for (i = 0; i < EMC2305_PWM_MAX; i++)
+ if (data->cdev_data[i].cdev)
+ thermal_cooling_device_unregister(data->cdev_data[i].cdev);
+ }
}
static umode_t