blob: f01c574d47a70a3cbd777b2e5cb8cd0591e9a203 [file] [log] [blame]
Nico Hubere34e1782016-09-29 12:33:01 +02001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
5 * Copyright (C) 2016 secunet Security Networks AG
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef SUPERIO_ITE_ENV_CTRL_CHIP_H
19#define SUPERIO_ITE_ENV_CTRL_CHIP_H
20
21#define ITE_EC_TMPIN_CNT 3
22#define ITE_EC_FAN_CNT 3
23
24/* Supported thermal mode on TMPINx */
25enum ite_ec_thermal_mode {
26 THERMAL_MODE_DISABLED = 0,
27 THERMAL_DIODE,
28 THERMAL_RESISTOR,
29};
30
31/* Bit mask for voltage pins VINx */
32enum ite_ec_voltage_pin {
33 VIN0 = 0x01,
34 VIN1 = 0x02,
35 VIN2 = 0x04,
36 VIN3 = 0x08,
37 VIN4 = 0x10,
38 VIN5 = 0x20,
39 VIN6 = 0x40,
40 VIN7 = 0x80,
41 VIN_ALL = 0xff
42};
43
44enum ite_ec_fan_mode {
45 FAN_IGNORE = 0,
46 FAN_MODE_ON,
47 FAN_MODE_OFF,
48 FAN_SMART_SOFTWARE,
49 FAN_SMART_AUTOMATIC,
50};
51
52struct ite_ec_fan_smartconfig {
53 u8 tmpin; /* select TMPINx (1, 2 or 3) */
54 u8 tmp_off; /* turn fan off below (°C) */
55 u8 tmp_start; /* turn fan on above (°C) */
56 u8 tmp_full; /* 100% duty cycle above (°C) */
57 u8 tmp_delta; /* adapt fan speed when temperature
58 changed by at least `tmp_delta`°C */
59 u8 smoothing; /* enable smoothing */
60 u8 pwm_start; /* start at this duty cycle (%) */
61 u8 slope; /* increase duty cycle by `slope`%/°C */
62};
63
64struct ite_ec_fan_config {
65 enum ite_ec_fan_mode mode;
66 struct ite_ec_fan_smartconfig smart;
67};
68
69struct ite_ec_config {
70 /*
71 * Enable external temperature sensor to use PECI GetTemp()
72 * command and store in register TMPIN 1, 2, or 3.
73 */
74 u8 peci_tmpin;
75
76 /*
77 * Enable thermal mode on TMPINx.
78 */
79 enum ite_ec_thermal_mode tmpin_mode[ITE_EC_TMPIN_CNT];
80
81 /*
82 * Enable reading of voltage pins VINx.
83 */
84 enum ite_ec_voltage_pin vin_mask;
85
86 /*
87 * Enable a FAN in given mode.
88 */
89 struct ite_ec_fan_config fan[ITE_EC_FAN_CNT];
90};
91
92/* Some shorthands for device trees */
93#define TMPIN1 ec.tmpin_mode[0]
94#define TMPIN2 ec.tmpin_mode[1]
95#define TMPIN3 ec.tmpin_mode[2]
96#define FAN1 ec.fan[0]
97#define FAN2 ec.fan[1]
98#define FAN3 ec.fan[2]
99
100#endif /* SUPERIO_ITE_ENV_CTRL_CHIP_H */