[coreboot-gerrit] New patch to review for coreboot: IT8772F: add register to set the default value of FAN speed

Matt DeVillier (matt.devillier@gmail.com) gerrit at coreboot.org
Thu Dec 24 21:29:13 CET 2015


Matt DeVillier (matt.devillier at gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12799

-gerrit

commit 269c5b675c2f1401d9ce6dab80ed304887b15006
Author: Ted Kuo <tedkuo at ami.com.tw>
Date:   Fri Mar 27 18:59:07 2015 +0800

    IT8772F: add register to set the default value of FAN speed
    
    BUG=none
    TEST=Compiled, verified
    Signed-off-by: Ted Kuo <tedkuo at ami.com.tw>
    
    Change-Id: I70d7b572e9ae030136a39fb6fa933f486d559aef
    Reviewed-on: https://chromium-review.googlesource.com/262832
    Reviewed-by: Shawn N <shawnn at chromium.org>
    Commit-Queue: Ted Kuo <tedkuo at ami.com.tw>
    Tested-by: Ted Kuo <tedkuo at ami.com.tw>
    Signed-off-by: Matt DeVillier <matt.devillier at gmail.com>
---
 src/superio/ite/it8772f/chip.h    |  6 ++++++
 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 2ceeee0..1d84850 100644
--- a/src/superio/ite/it8772f/chip.h
+++ b/src/superio/ite/it8772f/chip.h
@@ -48,6 +48,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 cac6898..2b891b2 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



More information about the coreboot-gerrit mailing list