diff options
author | Ted Kuo <tedkuo@ami.com.tw> | 2015-03-27 18:59:07 +0800 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2015-12-31 17:40:17 +0100 |
commit | 08debacad18a946892d8046af5d892c493d8c383 (patch) | |
tree | 288855eb6131b9a9930247ad166147119f1c10b4 | |
parent | 4e8f23b896fe31851c26e056ee55fb8191419fa0 (diff) |
superio/it8772f: Add register to set the default value of FAN speed
Original-Signed-off-by: Ted Kuo <tedkuo@ami.com.tw>
Change-Id: I70d7b572e9ae030136a39fb6fa933f486d559aef
Original-Reviewed-on: https://chromium-review.googlesource.com/262832
Original-Reviewed-by: Shawn N <shawnn@chromium.org>
Original-Commit-Queue: Ted Kuo <tedkuo@ami.com.tw>
Original-Tested-by: Ted Kuo <tedkuo@ami.com.tw>
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/12799
Tested-by: build bot (Jenkins)
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
-rw-r--r-- | src/superio/ite/it8772f/chip.h | 6 | ||||
-rw-r--r-- | src/superio/ite/it8772f/superio.c | 22 |
2 files changed, 20 insertions, 8 deletions
diff --git a/src/superio/ite/it8772f/chip.h b/src/superio/ite/it8772f/chip.h index 0d80fb833c..6ae3989e6c 100644 --- a/src/superio/ite/it8772f/chip.h +++ b/src/superio/ite/it8772f/chip.h @@ -49,6 +49,12 @@ struct superio_ite_it8772f_config { u8 fan1_enable; u8 fan2_enable; u8 fan3_enable; + + /* + * Default FAN speed + */ + u8 fan2_speed; + u8 fan3_speed; }; #endif /* SUPERIO_ITE_IT8772F_CHIP_H */ diff --git a/src/superio/ite/it8772f/superio.c b/src/superio/ite/it8772f/superio.c index 2d897d83ba..400bbbe001 100644 --- a/src/superio/ite/it8772f/superio.c +++ b/src/superio/ite/it8772f/superio.c @@ -137,7 +137,7 @@ static void it8772f_enable_tmpin(struct resource *res, int tmpin, /* * Setup a FAN PWM interface for software control */ -static void it8772f_enable_fan(struct resource *res, int fan) +static void it8772f_enable_fan(struct resource *res, int fan, u8 fan_speed) { u8 reg; @@ -165,8 +165,10 @@ static void it8772f_enable_fan(struct resource *res, int fan) /* Disable Smoothing */ it8772f_envc_write(res, IT8772F_FAN_CTL2_AUTO_MODE, IT8772F_FAN_CTL_AUTO_SMOOTHING_DIS); - /* Set a default medium fan speed */ - it8772f_envc_write(res, IT8772F_FAN_CTL2_PWM_START, 0x80); + /* Set a default fan speed */ + if (fan_speed) + it8772f_envc_write(res, IT8772F_FAN_CTL2_PWM_START, + fan_speed); break; case 3: /* Enable software operation */ @@ -175,8 +177,10 @@ static void it8772f_enable_fan(struct resource *res, int fan) /* Disable Smoothing */ it8772f_envc_write(res, IT8772F_FAN_CTL3_AUTO_MODE, IT8772F_FAN_CTL_AUTO_SMOOTHING_DIS); - /* Set a default medium fan speed */ - it8772f_envc_write(res, IT8772F_FAN_CTL3_PWM_START, 0x80); + /* Set a default fan speed */ + if (fan_speed) + it8772f_envc_write(res, IT8772F_FAN_CTL3_PWM_START, + fan_speed); break; } } @@ -206,11 +210,13 @@ static void it8772f_init(struct device *dev) /* Enable FANx if configured */ if (conf->fan1_enable) - it8772f_enable_fan(res, 1); + it8772f_enable_fan(res, 1, 0); if (conf->fan2_enable) - it8772f_enable_fan(res, 2); + it8772f_enable_fan(res, 2, + conf->fan2_speed ? conf->fan2_speed : 0x80); if (conf->fan3_enable) - it8772f_enable_fan(res, 3); + it8772f_enable_fan(res, 3, + conf->fan3_speed ? conf->fan3_speed : 0x80); /* * System may get wrong temperature data when SIO is in |