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>
This commit is contained in:
Ted Kuo 2015-03-27 18:59:07 +08:00 committed by Martin Roth
parent 4e8f23b896
commit 08debacad1
2 changed files with 20 additions and 8 deletions

View File

@ -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 */

View File

@ -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