openwrt/target/linux/bcm27xx/patches-6.1/950-0687-hwmon-emc2305-Add-calls-to-initialise-of-cooling-map.patch
Álvaro Fernández Rojas 793f8ab62c bcm27xx: 6.1: add kernel patches
Add kernel patches for version 6.1.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-06-09 19:12:30 +02:00

55 lines
1.8 KiB
Diff

From 76f8210c9498983b492645ec2c90c5c547ae415b 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