aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/i2c/nct7802y/chip.h
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2017-08-23 16:53:31 +0200
committerNico Huber <nico.h@gmx.de>2019-03-14 18:28:11 +0000
commita3f643a3c0b350703d2531bb54530b102fe68caf (patch)
treea85e69d4d21f939602d1e2aa1192ed4dbd2aae7c /src/drivers/i2c/nct7802y/chip.h
parent9421727c708e6b30831a24c190938ea2951a771b (diff)
drivers/i2c/nct7802y: Add new hardware-monitoring IC
Just another hardware-monitoring chip. Only limited fan control and PECI configuration is implemented. Change-Id: I35ea79e12941804e398c6304a08170a776f4ca76 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/29475 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src/drivers/i2c/nct7802y/chip.h')
-rw-r--r--src/drivers/i2c/nct7802y/chip.h96
1 files changed, 96 insertions, 0 deletions
diff --git a/src/drivers/i2c/nct7802y/chip.h b/src/drivers/i2c/nct7802y/chip.h
new file mode 100644
index 0000000000..11db12be35
--- /dev/null
+++ b/src/drivers/i2c/nct7802y/chip.h
@@ -0,0 +1,96 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2017 secunet Security Networks AG
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef DRIVERS_I2C_NCT7802Y_CHIP_H
+#define DRIVERS_I2C_NCT7802Y_CHIP_H
+
+#include <stdint.h>
+
+#define NCT7802Y_PECI_CNT 2
+#define NCT7802Y_FAN_CNT 3
+
+enum nct7802y_peci_mode {
+ PECI_DISABLED = 0,
+ PECI_DOMAIN_0,
+ PECI_DOMAIN_1,
+ PECI_HIGHEST,
+};
+
+struct nct7802y_peci_config {
+ enum nct7802y_peci_mode mode;
+ u8 base_temp;
+};
+
+enum nct7802y_fan_mode {
+ FAN_IGNORE = 0,
+ FAN_MANUAL,
+ FAN_SMART,
+};
+
+enum nct7802y_fan_smartmode {
+ SMART_FAN_DUTY = 0, /* Target values given in duty cycle %. */
+ SMART_FAN_RPM, /* Target valuse given in RPM. */
+};
+
+enum nct7802y_fan_speed {
+ FAN_SPEED_NORMAL = 0, /* RPM values <= 12,750. */
+ FAN_SPPED_HIGHSPEED, /* RPM values <= 25,500. */
+};
+
+enum nct7802y_fan_pecierror {
+ PECI_ERROR_KEEP = 0, /* Keep current value. */
+ PECI_ERROR_VALUE, /* Use `pecierror_minduty`. */
+ PECI_ERROR_FULLSPEED, /* Run PWM at 100% duty cycle. */
+};
+
+enum nct7802y_temp_source {
+ TEMP_SOURCE_REMOTE_1 = 0,
+ TEMP_SOURCE_REMOTE_2,
+ TEMP_SOURCE_REMOTE_3,
+ TEMP_SOURCE_LOCAL,
+ TEMP_SOURCE_PECI_0,
+ TEMP_SOURCE_PECI_1,
+ TEMP_SOURCE_PROGRAMMABLE_0,
+ TEMP_SOURCE_PROGRAMMABLE_1,
+};
+
+struct nct7802y_fan_smartconfig {
+ enum nct7802y_fan_smartmode mode;
+ enum nct7802y_fan_speed speed;
+ enum nct7802y_temp_source tempsrc;
+ struct {
+ u8 temp;
+ u16 target;
+ } table[4];
+ u8 critical_temp;
+};
+
+struct nct7802y_fan_config {
+ enum nct7802y_fan_mode mode;
+ union {
+ u8 duty_cycle;
+ struct nct7802y_fan_smartconfig smart;
+ };
+};
+
+/* Implements only those parts currently used by coreboot mainboards. */
+struct drivers_i2c_nct7802y_config {
+ struct nct7802y_peci_config peci[NCT7802Y_PECI_CNT];
+ struct nct7802y_fan_config fan[NCT7802Y_FAN_CNT];
+ enum nct7802y_fan_pecierror on_pecierror;
+ u8 pecierror_minduty;
+};
+
+#endif /* DRIVERS_I2C_NCT7802Y_CHIP_H */