Skip to content

Commit ef8b1b4

Browse files
Florin Leotescugroeck
authored andcommitted
hwmon: (emc2305) Enable PWM polarity and output configuration
Enable configuration of PWM polarity and PWM output config based Device Tree properties. Signed-off-by: Florin Leotescu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 2ed4db7 commit ef8b1b4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/hwmon/emc2305.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
#define EMC2305_TACH_RANGE_MIN 480
2929
#define EMC2305_DEFAULT_OUTPUT 0x0
3030
#define EMC2305_DEFAULT_POLARITY 0x0
31+
#define EMC2305_REG_POLARITY 0x2a
32+
#define EMC2305_REG_DRIVE_PWM_OUT 0x2b
33+
#define EMC2305_OPEN_DRAIN 0x0
34+
#define EMC2305_PUSH_PULL 0x1
3135

3236
#define EMC2305_PWM_DUTY2STATE(duty, max_state, pwm_max) \
3337
DIV_ROUND_CLOSEST((duty) * (max_state), (pwm_max))
@@ -686,6 +690,16 @@ static int emc2305_probe(struct i2c_client *client)
686690
}
687691
}
688692

693+
ret = i2c_smbus_write_byte_data(client, EMC2305_REG_DRIVE_PWM_OUT,
694+
data->pwm_output_mask);
695+
if (ret < 0)
696+
dev_err(dev, "Failed to configure pwm output, using default\n");
697+
698+
ret = i2c_smbus_write_byte_data(client, EMC2305_REG_POLARITY,
699+
data->pwm_polarity_mask);
700+
if (ret < 0)
701+
dev_err(dev, "Failed to configure pwm polarity, using default\n");
702+
689703
for (i = 0; i < data->pwm_num; i++) {
690704
ret = i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_MIN_DRIVE(i),
691705
data->pwm_min[i]);

0 commit comments

Comments
 (0)