diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-11-12 13:18:20 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-11-12 13:18:20 -0800 |
commit | de34b81bc2d034c9ba8d6b276725f975e728270a (patch) | |
tree | 58274c8d637e21ef6b84390e89d6257c06238fdb /drivers/hwmon/pwm-fan.c | |
parent | 999f81dd1937f2a9e56ce40e98be00758668ca19 (diff) | |
parent | 0bd52941586b3b59ab9b6e89e55b2dc9e2680de9 (diff) |
Merge tag 'hwmon-for-linus-v3.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon fixes from Guenter Roeck:
- fix PCI device ID in fam15h_power driver
- fix suspend/resume behavior in pwm-fan driver
- reduce logging noise created by ibmpowernv driver
* tag 'hwmon-for-linus-v3.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: (fam15h_power) Fix NB device ID for F16h M30h
hwmon: (pwm-fan) Fix suspend/resume behavior
hwmon: (ibmpowernv) Quieten when probing finds no device
Diffstat (limited to 'drivers/hwmon/pwm-fan.c')
-rw-r--r-- | drivers/hwmon/pwm-fan.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c index 823c877a1ec0..1991d9032c38 100644 --- a/drivers/hwmon/pwm-fan.c +++ b/drivers/hwmon/pwm-fan.c @@ -161,10 +161,17 @@ static int pwm_fan_suspend(struct device *dev) static int pwm_fan_resume(struct device *dev) { struct pwm_fan_ctx *ctx = dev_get_drvdata(dev); + unsigned long duty; + int ret; - if (ctx->pwm_value) - return pwm_enable(ctx->pwm); - return 0; + if (ctx->pwm_value == 0) + return 0; + + duty = DIV_ROUND_UP(ctx->pwm_value * (ctx->pwm->period - 1), MAX_PWM); + ret = pwm_config(ctx->pwm, duty, ctx->pwm->period); + if (ret) + return ret; + return pwm_enable(ctx->pwm); } #endif |