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>
This commit is contained in:
Dave Stevenson 2023-04-21 15:48:39 +01:00 committed by Stephen Chen
commit 7d2a4e5309

View file

@ -315,36 +315,36 @@ static int emc2305_get_tz_of(struct device *dev)
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)