summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin Lu <devin.lu@quantatw.com>2019-11-22 14:29:00 +0800
committerCommit Bot <commit-bot@chromium.org>2019-11-24 11:05:11 +0000
commit7adfccc97d0b7f03f9feb6702078d4bfd14f5918 (patch)
tree6b7cd5ed1be0aeef8661d91db79f9e37825c5775
parentb42c094e59da719d37a22ec4571b0a085aea0e09 (diff)
downloadchrome-ec-7adfccc97d0b7f03f9feb6702078d4bfd14f5918.tar.gz
jinlon: add FAN2 support
BUG=b:141259174 BRANCH=hatch TEST=faninfo can see the 2nd fan works with console. 2019-11-22 14:23:55 Fan 0 Actual: 3309 rpm 2019-11-22 14:23:55 Fan 0 Target: 3291 rpm 2019-11-22 14:23:55 Fan 0 Duty: 42% 2019-11-22 14:23:55 Fan 0 Status: 2 (locked) 2019-11-22 14:23:55 Fan 0 Mode: rpm 2019-11-22 14:23:55 Fan 0 Auto: yes 2019-11-22 14:23:55 Fan 0 Enable: yes 2019-11-22 14:23:55 Fan 0 Power: yes 2019-11-22 14:23:55 2019-11-22 14:23:55 Fan 1 Actual: 3101 rpm 2019-11-22 14:23:55 Fan 1 Target: 3291 rpm 2019-11-22 14:23:55 Fan 1 Duty: 37% 2019-11-22 14:23:55 Fan 1 Status: 2 (locked) 2019-11-22 14:23:55 Fan 1 Mode: rpm 2019-11-22 14:23:55 Fan 1 Auto: yes 2019-11-22 14:23:55 Fan 1 Enable: yes Change-Id: I88aa8efcbb55d8a64ae51c68b5a142e5a4997f46 Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1928542 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
-rw-r--r--board/jinlon/board.c17
-rw-r--r--board/jinlon/board.h5
-rw-r--r--board/jinlon/gpio.inc2
3 files changed, 23 insertions, 1 deletions
diff --git a/board/jinlon/board.c b/board/jinlon/board.c
index 55faaae736..4df25350a9 100644
--- a/board/jinlon/board.c
+++ b/board/jinlon/board.c
@@ -120,6 +120,8 @@ const struct pwm_t pwm_channels[] = {
[PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 100 },
[PWM_CH_FAN] = {.channel = 5, .flags = PWM_CONFIG_OPEN_DRAIN,
.freq = 25000},
+ [PWM_CH_FAN2] = {.channel = 6, .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000},
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -275,6 +277,13 @@ const struct fan_conf fan_conf_0 = {
.enable_gpio = GPIO_EN_PP5000_FAN,
};
+const struct fan_conf fan_conf_1 = {
+ .flags = FAN_USE_RPM_MODE,
+ .ch = MFT_CH_1, /* Use MFT id to control fan */
+ .pgood_gpio = -1,
+ .enable_gpio = -1,
+};
+
/* Default */
const struct fan_rpm fan_rpm_0 = {
.rpm_min = 3100,
@@ -282,14 +291,22 @@ const struct fan_rpm fan_rpm_0 = {
.rpm_max = 6900,
};
+const struct fan_rpm fan_rpm_1 = {
+ .rpm_min = 3100,
+ .rpm_start = 3100,
+ .rpm_max = 6900,
+};
+
const struct fan_t fans[FAN_CH_COUNT] = {
[FAN_CH_0] = { .conf = &fan_conf_0, .rpm = &fan_rpm_0, },
+ [FAN_CH_1] = { .conf = &fan_conf_1, .rpm = &fan_rpm_1, },
};
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
[MFT_CH_0] = {NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_1] = {NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN2},
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
diff --git a/board/jinlon/board.h b/board/jinlon/board.h
index 9891173781..34200c41be 100644
--- a/board/jinlon/board.h
+++ b/board/jinlon/board.h
@@ -86,7 +86,7 @@
#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
/* Fan features */
-#define CONFIG_FANS 1
+#define CONFIG_FANS 2
#undef CONFIG_FAN_INIT_SPEED
#define CONFIG_FAN_INIT_SPEED 50
#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_A_RAILS
@@ -140,17 +140,20 @@ enum sensor_id {
enum pwm_channel {
PWM_CH_KBLIGHT,
PWM_CH_FAN,
+ PWM_CH_FAN2,
PWM_CH_COUNT
};
enum fan_channel {
FAN_CH_0 = 0,
+ FAN_CH_1,
/* Number of FAN channels */
FAN_CH_COUNT,
};
enum mft_channel {
MFT_CH_0 = 0,
+ MFT_CH_1,
/* Number of MFT channels */
MFT_CH_COUNT,
};
diff --git a/board/jinlon/gpio.inc b/board/jinlon/gpio.inc
index 7f14dc575d..81f96d437a 100644
--- a/board/jinlon/gpio.inc
+++ b/board/jinlon/gpio.inc
@@ -121,7 +121,9 @@ ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* UA
/* PWM */
ALTERNATE(PIN_MASK(8, 0x01), 0, MODULE_PWM, 0) /* PWM3 - Keyboard backlight */
ALTERNATE(PIN_MASK(B, 0x80), 0, MODULE_PWM, 0) /* PWM5 - FAN */
+ALTERNATE(PIN_MASK(C, 0x01), 0, MODULE_PWM, 0) /* PWM6 - FAN2 */
ALTERNATE(PIN_MASK(4, 0x01), 0, MODULE_PWM, 0) /* TA1 - Fan Tachometer */
+ALTERNATE(PIN_MASK(7, 0x08), 0, MODULE_PWM, 0) /* TA2 - Fan Tachometer */
/* ADC */
ALTERNATE(PIN_MASK(4, 0x38), 0, MODULE_ADC, 0) /* ADC0-2*/