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 &
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.
13 The 6.1 driver was reading as u32, which failed as there is
16 As this is all downstream only, revert to u8 to match 5.15.
18 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
20 drivers/hwmon/emc2305.c | 16 ++++++++--------
21 1 file changed, 8 insertions(+), 8 deletions(-)
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);
33 /* OF parameters are optional - overwrite default setting
34 * if some of them are provided.
37 - ret = of_property_read_u32(np, "emc2305,cooling-levels", &val);
38 + ret = of_property_read_u8(np, "emc2305,cooling-levels", &val);
40 - data->max_state = (u8)val;
41 + data->max_state = val;
42 else if (ret != -EINVAL)
45 - ret = of_property_read_u32(np, "emc2305,pwm-max", &val);
46 + ret = of_property_read_u8(np, "emc2305,pwm-max", &val);
48 - data->pwm_max = (u8)val;
49 + data->pwm_max = val;
50 else if (ret != -EINVAL)
53 - ret = of_property_read_u32(np, "emc2305,pwm-min", &val);
54 + ret = of_property_read_u8(np, "emc2305,pwm-min", &val);
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)
62 /* Not defined or 0 means one thermal zone over all cooling devices.
63 * Otherwise - separated thermal zones for each PWM channel.
65 - ret = of_property_read_u32(np, "emc2305,pwm-channel", &val);
66 + ret = of_property_read_u8(np, "emc2305,pwm-channel", &val);
68 data->pwm_separate = (val != 0);
69 else if (ret != -EINVAL)