openwrt/target/linux/bcm27xx/patches-6.1/950-0695-hwmon-emc2305-Change-OF-properties-pwm-min-pwm-max-t.patch

70 lines
2.2 KiB
Diff
Raw Normal View History

From ab304fd0099444dc7535c81abbbc0077cd878d7e Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Fri, 21 Apr 2023 15:48:39 +0100
Subject: [PATCH] hwmon: emc2305: Change OF properties pwm-min &
pwm-max to u8
There is no DT binding for emc2305 as mainline are still
discussing how to do a generic fan binding.
The 5.15 driver was reading the "emc2305," properties
"cooling-levels", "pwm-max", "pwm-min", and "pwm-channel" as u8.
The overlay was writing them as u16 (;) so it was working.
The 6.1 driver was reading as u32, which failed as there is
insufficient data.
As this is all downstream only, revert to u8 to match 5.15.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/hwmon/emc2305.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
--- a/drivers/hwmon/emc2305.c
+++ b/drivers/hwmon/emc2305.c
@@ -301,36 +301,36 @@ static int emc2305_get_tz_of(struct devi
struct device_node *np = dev->of_node;
struct emc2305_data *data = dev_get_drvdata(dev);
int ret = 0;
- u32 val;
+ u8 val;
int i;
/* OF parameters are optional - overwrite default setting
* if some of them are provided.
*/
- ret = of_property_read_u32(np, "emc2305,cooling-levels", &val);
+ ret = of_property_read_u8(np, "emc2305,cooling-levels", &val);
if (!ret)
- data->max_state = (u8)val;
+ data->max_state = val;
else if (ret != -EINVAL)
return ret;
- ret = of_property_read_u32(np, "emc2305,pwm-max", &val);
+ ret = of_property_read_u8(np, "emc2305,pwm-max", &val);
if (!ret)
- data->pwm_max = (u8)val;
+ data->pwm_max = val;
else if (ret != -EINVAL)
return ret;
- ret = of_property_read_u32(np, "emc2305,pwm-min", &val);
+ ret = of_property_read_u8(np, "emc2305,pwm-min", &val);
if (!ret)
for (i = 0; i < EMC2305_PWM_MAX; i++)
- data->pwm_min[i] = (u8)val;
+ data->pwm_min[i] = val;
else if (ret != -EINVAL)
return ret;
/* Not defined or 0 means one thermal zone over all cooling devices.
* Otherwise - separated thermal zones for each PWM channel.
*/
- ret = of_property_read_u32(np, "emc2305,pwm-channel", &val);
+ ret = of_property_read_u8(np, "emc2305,pwm-channel", &val);
if (!ret)
data->pwm_separate = (val != 0);
else if (ret != -EINVAL)