diff options
Diffstat (limited to 'board')
-rw-r--r-- | board/fizz/board.c | 27 | ||||
-rw-r--r-- | board/host/fan.c | 25 | ||||
-rw-r--r-- | board/it83xx_evb/board.c | 28 | ||||
-rw-r--r-- | board/kahlee/board.c | 25 | ||||
-rw-r--r-- | board/nami/board.c | 27 | ||||
-rw-r--r-- | board/npcx7_evb/board.c | 25 | ||||
-rw-r--r-- | board/npcx_evb/board.c | 48 | ||||
-rw-r--r-- | board/npcx_evb_arm/board.c | 25 | ||||
-rw-r--r-- | board/samus/board.c | 40 |
9 files changed, 159 insertions, 111 deletions
diff --git a/board/fizz/board.c b/board/fizz/board.c index 212d609f81..24d31a99c8 100644 --- a/board/fizz/board.c +++ b/board/fizz/board.c @@ -150,16 +150,21 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); /******************************************************************************/ /* Physical fans. These are logically separate from pwm_channels. */ -const struct fan_t fans[] = { - [FAN_CH_0] = { - .flags = FAN_USE_RPM_MODE, - .rpm_min = 2800, - .rpm_start = 2800, - .rpm_max = 5600, - .ch = MFT_CH_0, /* Use MFT id to control fan */ - .pgood_gpio = -1, - .enable_gpio = GPIO_FAN_PWR_EN, - }, +const struct fan_conf fan_conf_0 = { + .flags = FAN_USE_RPM_MODE, + .ch = MFT_CH_0, /* Use MFT id to control fan */ + .pgood_gpio = -1, + .enable_gpio = GPIO_FAN_PWR_EN, +}; + +const struct fan_rpm fan_rpm_0 = { + .rpm_min = 2800, + .rpm_start = 2800, + .rpm_max = 5600, +}; + +struct fan_t fans[] = { + [FAN_CH_0] = { .conf = &fan_conf_0, .rpm = &fan_rpm_0, }, }; BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT); @@ -660,7 +665,7 @@ static int get_custom_rpm(int fan, int pct, int oem_id) previous_pct = pct; if (fan_table[current_level].rpm != - fan_get_rpm_target(fans[fan].ch)) + fan_get_rpm_target(FAN_CH(fan))) cprintf(CC_THERMAL, "[%T Setting fan RPM to %d]\n", fan_table[current_level].rpm); diff --git a/board/host/fan.c b/board/host/fan.c index ee7b15ef12..557baaaa7d 100644 --- a/board/host/fan.c +++ b/board/host/fan.c @@ -8,17 +8,22 @@ #include "fan.h" #include "util.h" -const struct fan_t fans[] = { - {.flags = FAN_USE_RPM_MODE, - .rpm_min = 1000, - .rpm_start = 1500, - .rpm_max = 5000, - .ch = 0, - .pgood_gpio = -1, - .enable_gpio = -1, - }, +const struct fan_conf fan_conf_0 = { + .flags = FAN_USE_RPM_MODE, + .ch = 0, + .pgood_gpio = -1, + .enable_gpio = -1, +}; + +const struct fan_rpm fan_rpm_0 = { + .rpm_min = 1000, + .rpm_start = 1500, + .rpm_max = 5000, +}; + +struct fan_t fans[CONFIG_FANS] = { + { .conf = &fan_conf_0, .rpm = &fan_rpm_0, }, }; -BUILD_ASSERT(ARRAY_SIZE(fans) == CONFIG_FANS); static int mock_enabled; void fan_set_enabled(int ch, int enabled) diff --git a/board/it83xx_evb/board.c b/board/it83xx_evb/board.c index cd0b9ff1e4..8bc2740beb 100644 --- a/board/it83xx_evb/board.c +++ b/board/it83xx_evb/board.c @@ -106,19 +106,21 @@ const struct pwm_t pwm_channels[] = { BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); -const struct fan_t fans[] = { - {.flags = FAN_USE_RPM_MODE, - .rpm_min = 1500, - .rpm_start = 1500, - .rpm_max = 6500, - /* - * index of pwm_channels, not pwm output channel. - * pwm output channel is member "channel" of pwm_t. - */ - .ch = 0, - .pgood_gpio = -1, - .enable_gpio = -1, - }, +const struct fan_conf fan_conf_0 = { + .flags = FAN_USE_RPM_MODE, + .ch = 0, /* Use MFT id to control fan */ + .pgood_gpio = -1, + .enable_gpio = -1, +}; + +const struct fan_rpm fan_rpm_0 = { + .rpm_min = 1500, + .rpm_start = 1500, + .rpm_max = 6500, +}; + +struct fan_t fans[] = { + { .conf = &fan_conf_0, .rpm = &fan_rpm_0, }, }; BUILD_ASSERT(ARRAY_SIZE(fans) == CONFIG_FANS); diff --git a/board/kahlee/board.c b/board/kahlee/board.c index 1369dce43e..97a6ae40ce 100644 --- a/board/kahlee/board.c +++ b/board/kahlee/board.c @@ -132,16 +132,21 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /******************************************************************************/ /* Physical fans. These are logically separate from pwm_channels. */ -const struct fan_t fans[] = { - [FAN_CH_0] = { - .flags = FAN_USE_RPM_MODE, - .rpm_min = 1000, - .rpm_start = 1000, - .rpm_max = 4300, - .ch = 0,/* Use MFT id to control fan */ - .pgood_gpio = -1, - .enable_gpio = -1, - }, +const struct fan_conf fan_conf_0 = { + .flags = FAN_USE_RPM_MODE, + .ch = 0, /* Use MFT id to control fan */ + .pgood_gpio = -1, + .enable_gpio = -1, +}; + +const struct fan_rpm fan_rpm_0 = { + .rpm_min = 1000, + .rpm_start = 1000, + .rpm_max = 4300, +}; + +struct fan_t fans[] = { + [FAN_CH_0] = { .conf = &fan_conf_0, .rpm = &fan_rpm_0, }, }; BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT); diff --git a/board/nami/board.c b/board/nami/board.c index 2c17571d51..dd612f4269 100644 --- a/board/nami/board.c +++ b/board/nami/board.c @@ -142,18 +142,23 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); /******************************************************************************/ /* Physical fans. These are logically separate from pwm_channels. */ -const struct fan_t fans[] = { - [FAN_CH_0] = { - .flags = FAN_USE_RPM_MODE, - .rpm_min = 2800, - .rpm_start = 3000, - .rpm_max = 6000, - .ch = MFT_CH_0, /* Use MFT id to control fan */ - .pgood_gpio = -1, - .enable_gpio = -1, - }, + +const struct fan_conf fan_conf_0 = { + .flags = FAN_USE_RPM_MODE, + .ch = MFT_CH_0, /* Use MFT id to control fan */ + .pgood_gpio = -1, + .enable_gpio = -1, +}; + +const struct fan_rpm fan_rpm_0 = { + .rpm_min = 2800, + .rpm_start = 3000, + .rpm_max = 6000, +}; + +struct fan_t fans[FAN_CH_COUNT] = { + [FAN_CH_0] = { .conf = &fan_conf_0, .rpm = &fan_rpm_0, }, }; -BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT); /******************************************************************************/ /* MFT channels. These are logically separate from pwm_channels. */ diff --git a/board/npcx7_evb/board.c b/board/npcx7_evb/board.c index 0a97942dbb..671671a21f 100644 --- a/board/npcx7_evb/board.c +++ b/board/npcx7_evb/board.c @@ -55,16 +55,21 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /******************************************************************************/ /* Physical fans. These are logically separate from pwm_channels. */ -const struct fan_t fans[] = { - [FAN_CH_0] = { - .flags = FAN_USE_RPM_MODE, - .rpm_min = 1000, - .rpm_start = 1000, - .rpm_max = 5200, - .ch = 0,/* Use MFT id to control fan */ - .pgood_gpio = GPIO_PGOOD_FAN, - .enable_gpio = -1, - }, +const struct fan_conf fan_conf_0 = { + .flags = FAN_USE_RPM_MODE, + .ch = 0, /* Use MFT id to control fan */ + .pgood_gpio = GPIO_PGOOD_FAN, + .enable_gpio = -1, +}; + +const struct fan_rpm fan_rpm_0 = { + .rpm_min = 1000, + .rpm_start = 1000, + .rpm_max = 5200, +}; + +struct fan_t fans[] = { + [FAN_CH_0] = { .conf = &fan_conf_0, .rpm = &fan_rpm_0, }, }; BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT); diff --git a/board/npcx_evb/board.c b/board/npcx_evb/board.c index 9a185ada2f..d4741fbe31 100644 --- a/board/npcx_evb/board.c +++ b/board/npcx_evb/board.c @@ -55,26 +55,36 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /******************************************************************************/ /* Physical fans. These are logically separate from pwm_channels. */ -const struct fan_t fans[] = { - [FAN_CH_0] = { - .flags = FAN_USE_RPM_MODE, - .rpm_min = 1000, - .rpm_start = 1000, - .rpm_max = 5200, - .ch = 0,/* Use MFT id to control fan */ - .pgood_gpio = GPIO_PGOOD_FAN, - .enable_gpio = -1, - }, +const struct fan_conf fan_conf_0 = { + .flags = FAN_USE_RPM_MODE, + .ch = 0, /* Use MFT id to control fan */ + .pgood_gpio = GPIO_PGOOD_FAN, + .enable_gpio = -1, +}; + +const struct fan_conf fan_conf_1 = { + .flags = FAN_USE_RPM_MODE, + .ch = 1, /* Use MFT id to control fan */ + .pgood_gpio = -1, + .enable_gpio = -1, +}; + +const struct fan_rpm fan_rpm_0 = { + .rpm_min = 1000, + .rpm_start = 1000, + .rpm_max = 5200, +}; + +const struct fan_rpm fan_rpm_1 = { + .rpm_min = 1000, + .rpm_start = 1000, + .rpm_max = 4300, +}; + +struct fan_t fans[] = { + [FAN_CH_0] = { .conf = &fan_conf_0, .rpm = &fan_rpm_0, }, #if (CONFIG_FANS == 2) - [FAN_CH_1] = { - .flags = FAN_USE_RPM_MODE, - .rpm_min = 1000, - .rpm_start = 1000, - .rpm_max = 4300, - .ch = 1,/* Use MFT id to control fan */ - .pgood_gpio = -1, - .enable_gpio = -1, - }, + [FAN_CH_1] = { .conf = &fan_conf_1, .rpm = &fan_rpm_1, }, #endif }; BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT); diff --git a/board/npcx_evb_arm/board.c b/board/npcx_evb_arm/board.c index 9e3ae7d0dd..da4d55a3bd 100644 --- a/board/npcx_evb_arm/board.c +++ b/board/npcx_evb_arm/board.c @@ -52,16 +52,21 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /******************************************************************************/ /* Physical fans. These are logically separate from pwm_channels. */ -const struct fan_t fans[] = { - [FAN_CH_0] = { - .flags = FAN_USE_RPM_MODE, - .rpm_min = 1000, - .rpm_start = 1000, - .rpm_max = 5200, - .ch = 0,/* Use MFT id to control fan */ - .pgood_gpio = GPIO_PGOOD_FAN, - .enable_gpio = -1, - }, +const struct fan_conf fan_conf_0 = { + .flags = FAN_USE_RPM_MODE, + .ch = 0, /* Use MFT id to control fan */ + .pgood_gpio = GPIO_PGOOD_FAN, + .enable_gpio = -1, +}; + +const struct fan_rpm fan_rpm_0 = { + .rpm_min = 1000, + .rpm_start = 1000, + .rpm_max = 5200, +}; + +struct fan_t fans[] = { + [FAN_CH_0] = { .conf = &fan_conf_0, .rpm = &fan_rpm_0, }, }; BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT); diff --git a/board/samus/board.c b/board/samus/board.c index db49a573af..167b20093c 100644 --- a/board/samus/board.c +++ b/board/samus/board.c @@ -96,23 +96,29 @@ const struct pwm_t pwm_channels[] = { BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /* Physical fans. These are logically separate from pwm_channels. */ -const struct fan_t fans[] = { - {.flags = FAN_USE_RPM_MODE, - .rpm_min = 1000, - .rpm_start = 1000, - .rpm_max = 6350, - .ch = 2, - .pgood_gpio = -1, - .enable_gpio = -1, - }, - {.flags = FAN_USE_RPM_MODE, - .rpm_min = 1000, - .rpm_start = 1000, - .rpm_max = 6350, - .ch = 3, - .pgood_gpio = -1, - .enable_gpio = -1, - }, +const struct fan_conf fan_conf_0 = { + .flags = FAN_USE_RPM_MODE, + .ch = 2, /* Use MFT id to control fan */ + .pgood_gpio = -1, + .enable_gpio = -1, +}; + +const struct fan_conf fan_conf_1 = { + .flags = FAN_USE_RPM_MODE, + .ch = 3, /* Use MFT id to control fan */ + .pgood_gpio = -1, + .enable_gpio = -1, +}; + +const struct fan_rpm fan_rpm_0 = { + .rpm_min = 1000, + .rpm_start = 1000, + .rpm_max = 6350, +}; + +struct fan_t fans[] = { + { .conf = &fan_conf_0, .rpm = &fan_rpm_0, }, + { .conf = &fan_conf_1, .rpm = &fan_rpm_0, }, }; BUILD_ASSERT(ARRAY_SIZE(fans) == CONFIG_FANS); |