6be34bf9b78725d4ed14aa1f0da382ad947d4012
[openwrt/staging/blocktrron.git] /
1 From ab304fd0099444dc7535c81abbbc0077cd878d7e Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Fri, 21 Apr 2023 15:48:39 +0100
4 Subject: [PATCH] hwmon: emc2305: Change OF properties pwm-min &
5 pwm-max to u8
6
7 There is no DT binding for emc2305 as mainline are still
8 discussing how to do a generic fan binding.
9 The 5.15 driver was reading the "emc2305," properties
10 "cooling-levels", "pwm-max", "pwm-min", and "pwm-channel" as u8.
11 The overlay was writing them as u16 (;) so it was working.
12
13 The 6.1 driver was reading as u32, which failed as there is
14 insufficient data.
15
16 As this is all downstream only, revert to u8 to match 5.15.
17
18 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
19 ---
20 drivers/hwmon/emc2305.c | 16 ++++++++--------
21 1 file changed, 8 insertions(+), 8 deletions(-)
22
23 --- a/drivers/hwmon/emc2305.c
24 +++ b/drivers/hwmon/emc2305.c
25 @@ -301,36 +301,36 @@ static int emc2305_get_tz_of(struct devi
26 struct device_node *np = dev->of_node;
27 struct emc2305_data *data = dev_get_drvdata(dev);
28 int ret = 0;
29 - u32 val;
30 + u8 val;
31 int i;
32
33 /* OF parameters are optional - overwrite default setting
34 * if some of them are provided.
35 */
36
37 - ret = of_property_read_u32(np, "emc2305,cooling-levels", &val);
38 + ret = of_property_read_u8(np, "emc2305,cooling-levels", &val);
39 if (!ret)
40 - data->max_state = (u8)val;
41 + data->max_state = val;
42 else if (ret != -EINVAL)
43 return ret;
44
45 - ret = of_property_read_u32(np, "emc2305,pwm-max", &val);
46 + ret = of_property_read_u8(np, "emc2305,pwm-max", &val);
47 if (!ret)
48 - data->pwm_max = (u8)val;
49 + data->pwm_max = val;
50 else if (ret != -EINVAL)
51 return ret;
52
53 - ret = of_property_read_u32(np, "emc2305,pwm-min", &val);
54 + ret = of_property_read_u8(np, "emc2305,pwm-min", &val);
55 if (!ret)
56 for (i = 0; i < EMC2305_PWM_MAX; i++)
57 - data->pwm_min[i] = (u8)val;
58 + data->pwm_min[i] = val;
59 else if (ret != -EINVAL)
60 return ret;
61
62 /* Not defined or 0 means one thermal zone over all cooling devices.
63 * Otherwise - separated thermal zones for each PWM channel.
64 */
65 - ret = of_property_read_u32(np, "emc2305,pwm-channel", &val);
66 + ret = of_property_read_u8(np, "emc2305,pwm-channel", &val);
67 if (!ret)
68 data->pwm_separate = (val != 0);
69 else if (ret != -EINVAL)