[coreboot-gerrit] Change in coreboot[master]: asus/f2a85-m: Enable automatic fan control

Tobias Diedrich (Code Review) gerrit at coreboot.org
Fri Apr 14 20:27:34 CEST 2017


Tobias Diedrich has uploaded a new change for review. ( https://review.coreboot.org/19293 )

Change subject: asus/f2a85-m: Enable automatic fan control
......................................................................

asus/f2a85-m: Enable automatic fan control

This adds fancontrol registers for the IT8728F and enables automatic
fancontrol for the F2A85-M and F2A85-M LE with the ASUS 'normal'
register settings.

Only the main CPU fan can be speed controlled on this board.

Before this change the fan speed is stuck at a default value of 50%
PWM duty cycle.

In particular the following fan control registers are involved:

reg 0x0b (0x40, default 0x00)
Fan PWM Smoothing Step Frequency Selection Register
bits 7-6 control sampling rate, this changes the sampling rate from 1Hz (Default) to 16Hz (ASUS).

reg 0x15 (0x80, default 0x00)
FAN_CTL1 PWM Control Register
bit7 enables automatic control

reg 0x60 (0x80, default 0x7f)
FAN_CTL1 SmartGuardian Automatic Mode Temperature Limit of OFF Register
With the default value of 0x7f the fan is never turned on in auto mode, with 0x80 (-128) it is never turned off.

reg 0x61 (0x14, default 0x7f)
FAN_CTL1 SmartGuardian Automatic Mode Temperature Limit of Fan Start Register
Minimum PWM reached at 20 degrees (vs default of 127 degrees)

reg 0x62 (0x46, default 0x7f)
FAN_CTL1 SmartGuardian Automatic Mode Temperature Limit of Full Speed Register
100% threshold at 70 degress (vs default of 127 degrees)

reg 0x64 (0xa0, default 0x00)
FAN_CTL1 SmartGuardian Automatic Mode Control Register
bit7 enables data smoothing
bit6-0 set the slope of the control curve (32)

reg 0x65 (0x40, default 0x00)
FAN_CTL1 SmartGuardian Automatic Mode △-Temperature Registers
bit6 enable full duty cycle if any thermal limit is reached

Change-Id: Idf0c8908ba5ad6ff552b8302bffc638aa9052941
Signed-off-by: Tobias Diedrich <ranma+coreboot at tdiedrich.de>
---
M src/mainboard/asus/f2a85-m/devicetree_f2a85-m.cb
M src/mainboard/asus/f2a85-m/devicetree_f2a85-m_le.cb
M src/superio/ite/it8728f/chip.h
M src/superio/ite/it8728f/it8728f_hwm.c
4 files changed, 86 insertions(+), 4 deletions(-)


  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/93/19293/1

diff --git a/src/mainboard/asus/f2a85-m/devicetree_f2a85-m.cb b/src/mainboard/asus/f2a85-m/devicetree_f2a85-m.cb
index d942445..5bd5271 100644
--- a/src/mainboard/asus/f2a85-m/devicetree_f2a85-m.cb
+++ b/src/mainboard/asus/f2a85-m/devicetree_f2a85-m.cb
@@ -61,9 +61,25 @@
 						register hwm_ctl_register = "0xc0"
 						register hwm_main_ctl_register = "0x33"
 						register hwm_adc_temp_chan_en_reg = "0x38"
-						register hwm_fan1_ctl_pwm = "0x00"
+						register hwm_fan_pwm_smoothing = "0x40"
+						register hwm_fan1_ctl_pwm = "0x80"
+						register hwm_fan1_temp_off = "0x80" # never off
+						register hwm_fan1_temp_start = "20"
+						register hwm_fan1_temp_full = "70"
+						register hwm_fan1_auto_ctl = "0xa0"
+						register hwm_fan1_delta_temp = "0x40"
 						register hwm_fan2_ctl_pwm = "0x00"
+						register hwm_fan2_temp_off = "0x80"
+						register hwm_fan2_temp_start = "20"
+						register hwm_fan2_temp_full = "70"
+						register hwm_fan2_auto_ctl = "0xa0"
+						register hwm_fan2_delta_temp = "0x40"
 						register hwm_fan3_ctl_pwm = "0x00"
+						register hwm_fan3_temp_off = "0x7f"
+						register hwm_fan3_temp_start = "0x7f"
+						register hwm_fan3_temp_full = "0x7f"
+						register hwm_fan3_auto_ctl = "0x00"
+						register hwm_fan3_delta_temp = "0x00"
 
 						device pnp 2e.0 off #  Floppy
 							io 0x60 = 0x3f0
diff --git a/src/mainboard/asus/f2a85-m/devicetree_f2a85-m_le.cb b/src/mainboard/asus/f2a85-m/devicetree_f2a85-m_le.cb
index d83f466..2106f28 100644
--- a/src/mainboard/asus/f2a85-m/devicetree_f2a85-m_le.cb
+++ b/src/mainboard/asus/f2a85-m/devicetree_f2a85-m_le.cb
@@ -59,11 +59,27 @@
 				device pci 14.3 on      # LPC	0x439d
 					chip superio/ite/it8728f
 						register hwm_ctl_register = "0xc0"
-						register hwm_main_ctl_register = "0x33"
+						register hwm_main_ctl_register = "0x31"
 						register hwm_adc_temp_chan_en_reg = "0x38"
-						register hwm_fan1_ctl_pwm = "0x00"
+						register hwm_fan_pwm_smoothing = "0x40"
+						register hwm_fan1_ctl_pwm = "0x80"
+						register hwm_fan1_temp_off = "0x80" # never off
+						register hwm_fan1_temp_start = "20"
+						register hwm_fan1_temp_full = "70"
+						register hwm_fan1_auto_ctl = "0xa0"
+						register hwm_fan1_delta_temp = "0x40"
 						register hwm_fan2_ctl_pwm = "0x00"
+						register hwm_fan2_temp_off = "0x80"
+						register hwm_fan2_temp_start = "0x7f"
+						register hwm_fan2_temp_full = "0x7f"
+						register hwm_fan2_auto_ctl = "0x00"
+						register hwm_fan2_delta_temp = "0x00"
 						register hwm_fan3_ctl_pwm = "0x00"
+						register hwm_fan3_temp_off = "0x7f"
+						register hwm_fan3_temp_start = "0x7f"
+						register hwm_fan3_temp_full = "0x7f"
+						register hwm_fan3_auto_ctl = "0x00"
+						register hwm_fan3_delta_temp = "0x00"
 
 						device pnp 2e.0 off #  Floppy
 							io 0x60 = 0x3f0
diff --git a/src/superio/ite/it8728f/chip.h b/src/superio/ite/it8728f/chip.h
index c925c85..1ab9783 100644
--- a/src/superio/ite/it8728f/chip.h
+++ b/src/superio/ite/it8728f/chip.h
@@ -22,9 +22,25 @@
 	uint8_t hwm_ctl_register;
 	uint8_t hwm_main_ctl_register;
 	uint8_t hwm_adc_temp_chan_en_reg;
+	uint8_t hwm_fan_pwm_smoothing;
 	uint8_t hwm_fan1_ctl_pwm;
+	uint8_t hwm_fan1_temp_off;
+	uint8_t hwm_fan1_temp_start;
+	uint8_t hwm_fan1_temp_full;
+	uint8_t hwm_fan1_auto_ctl;
+	uint8_t hwm_fan1_delta_temp;
 	uint8_t hwm_fan2_ctl_pwm;
+	uint8_t hwm_fan2_temp_off;
+	uint8_t hwm_fan2_temp_start;
+	uint8_t hwm_fan2_temp_full;
+	uint8_t hwm_fan2_auto_ctl;
+	uint8_t hwm_fan2_delta_temp;
 	uint8_t hwm_fan3_ctl_pwm;
+	uint8_t hwm_fan3_temp_off;
+	uint8_t hwm_fan3_temp_start;
+	uint8_t hwm_fan3_temp_full;
+	uint8_t hwm_fan3_auto_ctl;
+	uint8_t hwm_fan3_delta_temp;
 };
 
 #endif /* SUPERIO_ITE_IT8728F_CHIP_H */
diff --git a/src/superio/ite/it8728f/it8728f_hwm.c b/src/superio/ite/it8728f/it8728f_hwm.c
index 5ab4a39..4c7d550 100644
--- a/src/superio/ite/it8728f/it8728f_hwm.c
+++ b/src/superio/ite/it8728f/it8728f_hwm.c
@@ -24,12 +24,28 @@
 /*
  * FAN controller configuration register index's
  */
+#define HWM_FAN_PWM_SMOOTHING		 0x0b	/* default 0x0f */
 #define HWM_MAIN_CTL_REG		 0x13	/* default 0x07 */
 #define HWM_CTL_REG			 0x14	/* default 0x40 */
 #define HWM_FAN1_CTL_PWM		 0x15	/* default 0x00 */
 #define HWM_FAN2_CTL_PWM		 0x16	/* default 0x00 */
 #define HWM_FAN3_CTL_PWM		 0x17	/* default 0x00 */
-#define HWM_ADC_TEMP_CHAN_EN_REG 0x51	/* default 0x00 */
+#define HWM_ADC_TEMP_CHAN_EN_REG	 0x51	/* default 0x00 */
+#define HWM_FAN1_TEMP_OFF		 0x60	/* default 0x7f */
+#define HWM_FAN1_TEMP_START		 0x61	/* default 0x7f */
+#define HWM_FAN1_TEMP_FULL		 0x62	/* default 0x7f */
+#define HWM_FAN1_AUTO_CTL		 0x64	/* default 0x00 */
+#define HWM_FAN1_DELTA_TEMP		 0x65	/* default 0x00 */
+#define HWM_FAN2_TEMP_OFF		 0x68	/* default 0x7f */
+#define HWM_FAN2_TEMP_START		 0x69	/* default 0x7f */
+#define HWM_FAN2_TEMP_FULL		 0x6a	/* default 0x7f */
+#define HWM_FAN2_AUTO_CTL		 0x6c	/* default 0x00 */
+#define HWM_FAN2_DELTA_TEMP		 0x6d	/* default 0x00 */
+#define HWM_FAN3_TEMP_OFF		 0x70	/* default 0x7f */
+#define HWM_FAN3_TEMP_START		 0x71	/* default 0x7f */
+#define HWM_FAN3_TEMP_FULL		 0x72	/* default 0x7f */
+#define HWM_FAN3_AUTO_CTL		 0x74	/* default 0x00 */
+#define HWM_FAN3_DELTA_TEMP		 0x75	/* default 0x00 */
 
 void it8728f_hwm_ec_init(struct device *dev)
 {
@@ -67,5 +83,23 @@
 	pnp_write_index(port, HWM_FAN2_CTL_PWM, conf->hwm_fan2_ctl_pwm);
 	pnp_write_index(port, HWM_FAN3_CTL_PWM, conf->hwm_fan3_ctl_pwm);
 
+	/* configure automatic fan control */
+	pnp_write_index(port, HWM_FAN_PWM_SMOOTHING, conf->hwm_fan_pwm_smoothing);
+	pnp_write_index(port, HWM_FAN1_TEMP_OFF, conf->hwm_fan1_temp_off);
+	pnp_write_index(port, HWM_FAN1_TEMP_START, conf->hwm_fan1_temp_start);
+	pnp_write_index(port, HWM_FAN1_TEMP_FULL, conf->hwm_fan1_temp_full);
+	pnp_write_index(port, HWM_FAN1_AUTO_CTL, conf->hwm_fan1_auto_ctl);
+	pnp_write_index(port, HWM_FAN1_DELTA_TEMP, conf->hwm_fan1_delta_temp);
+	pnp_write_index(port, HWM_FAN2_TEMP_OFF, conf->hwm_fan2_temp_off);
+	pnp_write_index(port, HWM_FAN2_TEMP_START, conf->hwm_fan2_temp_start);
+	pnp_write_index(port, HWM_FAN2_TEMP_FULL, conf->hwm_fan2_temp_full);
+	pnp_write_index(port, HWM_FAN2_AUTO_CTL, conf->hwm_fan2_auto_ctl);
+	pnp_write_index(port, HWM_FAN2_DELTA_TEMP, conf->hwm_fan2_delta_temp);
+	pnp_write_index(port, HWM_FAN3_TEMP_OFF, conf->hwm_fan3_temp_off);
+	pnp_write_index(port, HWM_FAN3_TEMP_START, conf->hwm_fan3_temp_start);
+	pnp_write_index(port, HWM_FAN3_TEMP_FULL, conf->hwm_fan3_temp_full);
+	pnp_write_index(port, HWM_FAN3_AUTO_CTL, conf->hwm_fan3_auto_ctl);
+	pnp_write_index(port, HWM_FAN3_DELTA_TEMP, conf->hwm_fan3_delta_temp);
+
 	pnp_exit_conf_mode(dev);
 }

-- 
To view, visit https://review.coreboot.org/19293
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf0c8908ba5ad6ff552b8302bffc638aa9052941
Gerrit-PatchSet: 1
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Owner: Tobias Diedrich <ranma+coreboot at tdiedrich.de>



More information about the coreboot-gerrit mailing list