diff options
Diffstat (limited to 'board/jinlon')
-rw-r--r-- | board/jinlon/battery.c | 2 | ||||
-rw-r--r-- | board/jinlon/board.c | 137 | ||||
-rw-r--r-- | board/jinlon/board.h | 39 | ||||
-rw-r--r-- | board/jinlon/build.mk | 2 | ||||
-rw-r--r-- | board/jinlon/ec.tasklist | 2 | ||||
-rw-r--r-- | board/jinlon/gpio.inc | 6 | ||||
-rw-r--r-- | board/jinlon/led.c | 46 | ||||
-rw-r--r-- | board/jinlon/thermal.c | 132 |
8 files changed, 183 insertions, 183 deletions
diff --git a/board/jinlon/battery.c b/board/jinlon/battery.c index 12c2e38d84..9cf4c15458 100644 --- a/board/jinlon/battery.c +++ b/board/jinlon/battery.c @@ -1,4 +1,4 @@ -/* Copyright 2019 The Chromium OS Authors. All rights reserved. +/* Copyright 2019 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * diff --git a/board/jinlon/board.c b/board/jinlon/board.c index 58e7e1b427..717c8db09c 100644 --- a/board/jinlon/board.c +++ b/board/jinlon/board.c @@ -1,4 +1,4 @@ -/* Copyright 2019 The Chromium OS Authors. All rights reserved. +/* Copyright 2019 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -44,8 +44,8 @@ #include "usbc_ppc.h" #include "util.h" -#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) -#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args) +#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args) +#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args) static void check_reboot_deferred(void); DECLARE_DEFERRED(check_reboot_deferred); @@ -114,18 +114,19 @@ static void bc12_interrupt(enum gpio_signal signal) /******************************************************************************/ /* SPI devices */ -const struct spi_device_t spi_devices[] = { -}; +const struct spi_device_t spi_devices[] = {}; const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); /******************************************************************************/ /* PWM channels. Must be in the exactly same order as in enum pwm_channel. */ 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}, + [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); @@ -150,16 +151,20 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { }, }; -const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { +const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_TCPC_0] = { - .usb_port = USB_PD_PORT_TCPC_0, - .driver = &tcpci_tcpm_usb_mux_driver, - .hpd_update = &ps8xxx_tcpc_update_hpd_status, + .mux = &(const struct usb_mux) { + .usb_port = USB_PD_PORT_TCPC_0, + .driver = &tcpci_tcpm_usb_mux_driver, + .hpd_update = &ps8xxx_tcpc_update_hpd_status, + }, }, [USB_PD_PORT_TCPC_1] = { - .usb_port = USB_PD_PORT_TCPC_1, - .driver = &tcpci_tcpm_usb_mux_driver, - .hpd_update = &ps8xxx_tcpc_update_hpd_status, + .mux = &(const struct usb_mux) { + .usb_port = USB_PD_PORT_TCPC_1, + .driver = &tcpci_tcpm_usb_mux_driver, + .hpd_update = &ps8xxx_tcpc_update_hpd_status, + }, } }; @@ -188,17 +193,13 @@ static struct bmi_drv_data_t g_bmi160_data; static struct accelgyro_saved_data_t g_bma255_data; /* Matrix to rotate accelrator into standard reference frame */ -static const mat33_fp_t base_standard_ref = { - { 0, FLOAT_TO_FP(-1), 0}, - { FLOAT_TO_FP(-1), 0, 0}, - { 0, 0, FLOAT_TO_FP(-1)} -}; +static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 }, + { FLOAT_TO_FP(-1), 0, 0 }, + { 0, 0, FLOAT_TO_FP(-1) } }; -static const mat33_fp_t lid_standard_ref = { - { FLOAT_TO_FP(-1), 0, 0}, - { 0, FLOAT_TO_FP(-1), 0}, - { 0, 0, FLOAT_TO_FP(1)} -}; +static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 }, + { 0, FLOAT_TO_FP(-1), 0 }, + { 0, 0, FLOAT_TO_FP(1) } }; struct motion_sensor_t motion_sensors[] = { [LID_ACCEL] = { @@ -278,14 +279,14 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); const struct fan_conf fan_conf_0 = { .flags = FAN_USE_RPM_MODE, - .ch = MFT_CH_0, /* Use MFT id to control fan */ + .ch = MFT_CH_0, /* Use MFT id to control fan */ .pgood_gpio = -1, .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 */ + .ch = MFT_CH_1, /* Use MFT id to control fan */ .pgood_gpio = -1, .enable_gpio = GPIO_EN_PP5000_FAN2, }; @@ -311,49 +312,48 @@ const struct fan_t fans[FAN_CH_COUNT] = { /******************************************************************************/ /* 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}, + [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); /* ADC channels */ const struct adc_t adc_channels[] = { - [ADC_TEMP_SENSOR_1] = { - "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0}, - [ADC_TEMP_SENSOR_2] = { - "TEMP_5V_REG", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0}, - [ADC_TEMP_SENSOR_3] = { - "TEMP_CPU", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX+1, 0}, + [ADC_TEMP_SENSOR_1] = { "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT, + ADC_READ_MAX + 1, 0 }, + [ADC_TEMP_SENSOR_2] = { "TEMP_5V_REG", NPCX_ADC_CH1, ADC_MAX_VOLT, + ADC_READ_MAX + 1, 0 }, + [ADC_TEMP_SENSOR_3] = { "TEMP_CPU", NPCX_ADC_CH2, ADC_MAX_VOLT, + ADC_READ_MAX + 1, 0 }, }; BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); const struct temp_sensor_t temp_sensors[] = { - [TEMP_SENSOR_1] = {.name = "Charger", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_30k9_47k_4050b, - .idx = ADC_TEMP_SENSOR_1}, - [TEMP_SENSOR_2] = {.name = "5v Reg", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_30k9_47k_4050b, - .idx = ADC_TEMP_SENSOR_2}, - [TEMP_SENSOR_3] = {.name = "CPU", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_30k9_47k_4050b, - .idx = ADC_TEMP_SENSOR_3}, - [TEMP_SENSOR_4] = {.name = "IR Sensor", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = oti502_get_val, - .idx = OTI502_IDX_OBJECT}, + [TEMP_SENSOR_1] = { .name = "Charger", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_30k9_47k_4050b, + .idx = ADC_TEMP_SENSOR_1 }, + [TEMP_SENSOR_2] = { .name = "5v Reg", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_30k9_47k_4050b, + .idx = ADC_TEMP_SENSOR_2 }, + [TEMP_SENSOR_3] = { .name = "CPU", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_30k9_47k_4050b, + .idx = ADC_TEMP_SENSOR_3 }, + [TEMP_SENSOR_4] = { .name = "IR Sensor", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = oti502_get_val, + .idx = OTI502_IDX_OBJECT }, }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); - /* Dratini Temperature sensors */ /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_A \ - { \ +#define THERMAL_A \ + { \ .temp_host = { \ [EC_TEMP_THRESH_WARN] = 0, \ [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ @@ -368,8 +368,8 @@ __maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; /* * TODO(b/202062363): Remove when clang is fixed. */ -#define THERMAL_B \ - { \ +#define THERMAL_B \ + { \ .temp_host = { \ [EC_TEMP_THRESH_WARN] = 0, \ [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \ @@ -438,8 +438,8 @@ static const struct ec_response_keybd_config keybd2 = { .capabilities = KEYBD_CAP_SCRNLOCK_KEY, }; -__override const struct ec_response_keybd_config -*board_vivaldi_keybd_config(void) +__override const struct ec_response_keybd_config * +board_vivaldi_keybd_config(void) { /* * Future boards should use fw_config instead of SKU ID @@ -487,15 +487,15 @@ void board_overcurrent_event(int port, int is_overcurrented) * The connector has 24 pins total, and there is no pin 0. */ const int keyboard_factory_scan_pins[][2] = { - {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6}, - {0, 7}, {1, 4}, {1, 3}, {1, 6}, {1, 7}, - {3, 1}, {2, 0}, {1, 5}, {2, 6}, {2, 7}, - {2, 1}, {2, 4}, {2, 5}, {1, 2}, {2, 3}, - {2, 2}, {3, 0}, {-1, -1}, {-1, -1}, {-1, -1}, + { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, + { 0, 7 }, { 1, 4 }, { 1, 3 }, { 1, 6 }, { 1, 7 }, + { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 }, + { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, + { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 }, }; const int keyboard_factory_scan_pins_used = - ARRAY_SIZE(keyboard_factory_scan_pins); + ARRAY_SIZE(keyboard_factory_scan_pins); #endif bool board_is_convertible(void) @@ -503,10 +503,9 @@ bool board_is_convertible(void) const uint8_t sku = get_board_sku(); return (sku == 255) || (sku == 1) || (sku == 2) || (sku == 21) || - (sku == 22); + (sku == 22); } - void all_sys_pgood_check_reboot(void) { hook_call_deferred(&check_reboot_deferred_data, 3000 * MSEC); @@ -517,7 +516,7 @@ __override void board_chipset_forced_shutdown(void) hook_call_deferred(&check_reboot_deferred_data, -1); } DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_forced_shutdown, - HOOK_PRIO_DEFAULT); + HOOK_PRIO_DEFAULT); static void check_reboot_deferred(void) { diff --git a/board/jinlon/board.h b/board/jinlon/board.h index d4ecf9bbd6..350376dd63 100644 --- a/board/jinlon/board.h +++ b/board/jinlon/board.h @@ -1,4 +1,4 @@ -/* Copyright 2019 The Chromium OS Authors. All rights reserved. +/* Copyright 2019 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -32,10 +32,10 @@ * Jinlon's battery takes several seconds to come back out of its disconnect * state (~4 seconds, but give it 6 for margin). */ -#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT +#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT #define CONFIG_POWER_BUTTON_INIT_TIMEOUT 6 -#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 5000 +#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 5000 /* Sensors */ /* BMI160 Base accel/gyro */ @@ -117,16 +117,16 @@ * then redefined here to so it's more clear which signal is being used for * which purpose. */ -#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L -#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L -#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL -#define GPIO_AC_PRESENT GPIO_ACOK_OD -#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L -#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK -#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L -#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L -#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS -#define GPIO_EN_PP5000 GPIO_EN_PP5000_A +#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L +#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L +#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL +#define GPIO_AC_PRESENT GPIO_ACOK_OD +#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L +#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK +#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L +#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L +#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS +#define GPIO_EN_PP5000 GPIO_EN_PP5000_A #ifndef __ASSEMBLER__ @@ -134,9 +134,9 @@ #include "registers.h" enum adc_channel { - ADC_TEMP_SENSOR_1, /* ADC0 */ - ADC_TEMP_SENSOR_2, /* ADC1 */ - ADC_TEMP_SENSOR_3, /* ADC2 */ + ADC_TEMP_SENSOR_1, /* ADC0 */ + ADC_TEMP_SENSOR_2, /* ADC1 */ + ADC_TEMP_SENSOR_3, /* ADC2 */ ADC_CH_COUNT }; @@ -147,12 +147,7 @@ enum sensor_id { SENSOR_COUNT, }; -enum pwm_channel { - PWM_CH_KBLIGHT, - PWM_CH_FAN, - PWM_CH_FAN2, - PWM_CH_COUNT -}; +enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_FAN, PWM_CH_FAN2, PWM_CH_COUNT }; enum fan_channel { FAN_CH_0 = 0, diff --git a/board/jinlon/build.mk b/board/jinlon/build.mk index 2d6118ea70..4e42a0616e 100644 --- a/board/jinlon/build.mk +++ b/board/jinlon/build.mk @@ -1,5 +1,5 @@ # -*- makefile -*- -# Copyright 2019 The Chromium OS Authors. All rights reserved. +# Copyright 2019 The ChromiumOS Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # diff --git a/board/jinlon/ec.tasklist b/board/jinlon/ec.tasklist index 4a1024a091..829be2b7c8 100644 --- a/board/jinlon/ec.tasklist +++ b/board/jinlon/ec.tasklist @@ -1,4 +1,4 @@ -/* Copyright 2019 The Chromium OS Authors. All rights reserved. +/* Copyright 2019 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ diff --git a/board/jinlon/gpio.inc b/board/jinlon/gpio.inc index f57a331436..91002dacc1 100644 --- a/board/jinlon/gpio.inc +++ b/board/jinlon/gpio.inc @@ -1,6 +1,6 @@ /* -*- mode:c -*- * - * Copyright 2019 The Chromium OS Authors. All rights reserved. + * Copyright 2019 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -17,10 +17,10 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex /* Power sequencing interrupts */ GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt) -#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3 +#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3 GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt) #endif -#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4 +#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4 GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt) #endif GPIO_INT(PG_EC_RSMRST_L, PIN(E, 2), GPIO_INT_BOTH, intel_x86_rsmrst_signal_interrupt) diff --git a/board/jinlon/led.c b/board/jinlon/led.c index 4cef6dc3ae..8ab3d7631f 100644 --- a/board/jinlon/led.c +++ b/board/jinlon/led.c @@ -1,4 +1,4 @@ -/* Copyright 2019 The Chromium OS Authors. All rights reserved. +/* Copyright 2019 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * @@ -25,11 +25,9 @@ #define LED_ON_TICKS 5 #define POWER_LED_ON_TICKS 2 -const enum ec_led_id supported_led_ids[] = { - EC_LED_ID_LEFT_LED, - EC_LED_ID_RIGHT_LED, - EC_LED_ID_POWER_LED -}; +const enum ec_led_id supported_led_ids[] = { EC_LED_ID_LEFT_LED, + EC_LED_ID_RIGHT_LED, + EC_LED_ID_POWER_LED }; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); @@ -37,7 +35,7 @@ enum led_color { LED_OFF = 0, LED_AMBER, LED_WHITE, - LED_COLOR_COUNT /* Number of colors, not a color itself */ + LED_COLOR_COUNT /* Number of colors, not a color itself */ }; static void led_set_color_battery(int port, enum led_color color) @@ -147,7 +145,6 @@ static void set_active_port_color(enum led_color color) static void led_set_battery(void) { static int battery_ticks; - uint32_t chflags = charge_get_flags(); battery_ticks++; @@ -159,9 +156,12 @@ static void led_set_battery(void) case PWR_STATE_DISCHARGE: if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) { if (charge_get_percent() < 10) - led_set_color_battery(0, (battery_ticks % - LED_TICKS_PER_CYCLE < LED_ON_TICKS) ? - LED_WHITE : LED_OFF); + led_set_color_battery( + 0, + (battery_ticks % LED_TICKS_PER_CYCLE < + LED_ON_TICKS) ? + LED_WHITE : + LED_OFF); else led_set_color_battery(0, LED_OFF); } @@ -170,19 +170,20 @@ static void led_set_battery(void) led_set_color_battery(1, LED_OFF); break; case PWR_STATE_ERROR: - set_active_port_color((battery_ticks & 0x2) ? - LED_WHITE : LED_OFF); + set_active_port_color((battery_ticks & 0x2) ? LED_WHITE : + LED_OFF); break; case PWR_STATE_CHARGE_NEAR_FULL: set_active_port_color(LED_WHITE); break; case PWR_STATE_IDLE: /* External power connected in IDLE */ - if (chflags & CHARGE_FLAG_FORCE_IDLE) - set_active_port_color((battery_ticks % - LED_TICKS_PER_CYCLE < LED_ON_TICKS) ? - LED_AMBER : LED_OFF); - else - set_active_port_color(LED_WHITE); + set_active_port_color(LED_WHITE); + break; + case PWR_STATE_FORCED_IDLE: + set_active_port_color( + (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ? + LED_AMBER : + LED_OFF); break; default: /* Other states don't alter LED behavior */ @@ -200,9 +201,10 @@ static void led_set_power(void) led_set_color_power(LED_WHITE); else if (chipset_in_state(CHIPSET_STATE_SUSPEND | CHIPSET_STATE_STANDBY)) - led_set_color_power((power_tick % - LED_TICKS_PER_CYCLE < POWER_LED_ON_TICKS) ? - LED_WHITE : LED_OFF); + led_set_color_power((power_tick % LED_TICKS_PER_CYCLE < + POWER_LED_ON_TICKS) ? + LED_WHITE : + LED_OFF); else led_set_color_power(LED_OFF); } diff --git a/board/jinlon/thermal.c b/board/jinlon/thermal.c index 03437fa3cd..70e6016109 100644 --- a/board/jinlon/thermal.c +++ b/board/jinlon/thermal.c @@ -1,8 +1,9 @@ -/* Copyright 2019 The Chromium OS Authors. All rights reserved. +/* Copyright 2019 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ +#include "builtin/assert.h" #include "chipset.h" #include "common.h" #include "console.h" @@ -16,7 +17,7 @@ /* Console output macros */ #define CPUTS(outstr) cputs(CC_THERMAL, outstr) -#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args) +#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ##args) struct fan_step { /* @@ -40,109 +41,108 @@ static const struct fan_step *fan_step_table; static const struct fan_step fan_table_clamshell[] = { { /* level 0 */ - .on = {0, -1, 54, 37}, - .off = {99, -1, 99, 99}, - .rpm = {0, 0}, + .on = { 0, -1, 54, 37 }, + .off = { 99, -1, 99, 99 }, + .rpm = { 0, 0 }, }, { /* level 1 */ - .on = {0, -1, 57, 39}, - .off = {99, -1, 54, 37}, - .rpm = {3950, 3850}, + .on = { 0, -1, 57, 39 }, + .off = { 99, -1, 54, 37 }, + .rpm = { 3950, 3850 }, }, { /* level 2 */ - .on = {0, -1, 58, 40}, - .off = {99, -1, 57, 39}, - .rpm = {4200, 4100}, + .on = { 0, -1, 58, 40 }, + .off = { 99, -1, 57, 39 }, + .rpm = { 4200, 4100 }, }, { /* level 3 */ - .on = {0, -1, 59, 41}, - .off = {99, -1, 58, 40}, - .rpm = {4550, 4450}, + .on = { 0, -1, 59, 41 }, + .off = { 99, -1, 58, 40 }, + .rpm = { 4550, 4450 }, }, { /* level 4 */ - .on = {62, -1, 60, 42}, - .off = {58, -1, 59, 41}, - .rpm = {4900, 4800}, + .on = { 62, -1, 60, 42 }, + .off = { 58, -1, 59, 41 }, + .rpm = { 4900, 4800 }, }, { /* level 5 */ - .on = {64, -1, 61, 43}, - .off = {62, -1, 60, 42}, - .rpm = {5250, 5150}, + .on = { 64, -1, 61, 43 }, + .off = { 62, -1, 60, 42 }, + .rpm = { 5250, 5150 }, }, { /* level 6 */ - .on = {65, -1, 64, 45}, - .off = {63, -1, 61, 43}, - .rpm = {5400, 5300}, + .on = { 65, -1, 64, 45 }, + .off = { 63, -1, 61, 43 }, + .rpm = { 5400, 5300 }, }, { /* level 7 */ - .on = {100, -1, 100, 100}, - .off = {65, -1, 62, 44}, - .rpm = {6000, 5900}, + .on = { 100, -1, 100, 100 }, + .off = { 65, -1, 62, 44 }, + .rpm = { 6000, 5900 }, }, }; static const struct fan_step fan_table_tablet[] = { { /* level 0 */ - .on = {0, -1, 55, 41}, - .off = {99, -1, 99, 99}, - .rpm = {0, 0}, + .on = { 0, -1, 55, 41 }, + .off = { 99, -1, 99, 99 }, + .rpm = { 0, 0 }, }, { /* level 1 */ - .on = {0, -1, 56, 42}, - .off = {99, -1, 55, 41}, - .rpm = {0, 0}, + .on = { 0, -1, 56, 42 }, + .off = { 99, -1, 55, 41 }, + .rpm = { 0, 0 }, }, { /* level 2 */ - .on = {0, -1, 57, 43}, - .off = {99, -1, 56, 42}, - .rpm = {4000, 3350}, + .on = { 0, -1, 57, 43 }, + .off = { 99, -1, 56, 42 }, + .rpm = { 4000, 3350 }, }, { /* level 3 */ - .on = {0, -1, 58, 44}, - .off = {99, -1, 57, 43}, - .rpm = {4200, 3400}, + .on = { 0, -1, 58, 44 }, + .off = { 99, -1, 57, 43 }, + .rpm = { 4200, 3400 }, }, { /* level 4 */ - .on = {60, -1, 59, 45}, - .off = {58, -1, 58, 44}, - .rpm = {4400, 3500}, + .on = { 60, -1, 59, 45 }, + .off = { 58, -1, 58, 44 }, + .rpm = { 4400, 3500 }, }, { /* level 5 */ - .on = {62, -1, 60, 46}, - .off = {60, -1, 59, 45}, - .rpm = {4800, 4350}, + .on = { 62, -1, 60, 46 }, + .off = { 60, -1, 59, 45 }, + .rpm = { 4800, 4350 }, }, { /* level 6 */ - .on = {65, -1, 61, 47}, - .off = {62, -1, 60, 46}, - .rpm = {5000, 4500}, + .on = { 65, -1, 61, 47 }, + .off = { 62, -1, 60, 46 }, + .rpm = { 5000, 4500 }, }, { /* level 7 */ - .on = {100, -1, 100, 100}, - .off = {65, -1, 61, 47}, - .rpm = {5200, 5100}, + .on = { 100, -1, 100, 100 }, + .off = { 65, -1, 61, 47 }, + .rpm = { 5200, 5100 }, }, }; #define NUM_FAN_LEVELS ARRAY_SIZE(fan_table_clamshell) -BUILD_ASSERT(ARRAY_SIZE(fan_table_clamshell) == - ARRAY_SIZE(fan_table_tablet)); +BUILD_ASSERT(ARRAY_SIZE(fan_table_clamshell) == ARRAY_SIZE(fan_table_tablet)); int fan_table_to_rpm(int fan, int *temp) { @@ -165,12 +165,15 @@ int fan_table_to_rpm(int fan, int *temp) */ if (temp[TEMP_SENSOR_1] < prev_tmp[TEMP_SENSOR_1] || - temp[TEMP_SENSOR_3] < prev_tmp[TEMP_SENSOR_3] || - temp[TEMP_SENSOR_4] < prev_tmp[TEMP_SENSOR_4]) { + temp[TEMP_SENSOR_3] < prev_tmp[TEMP_SENSOR_3] || + temp[TEMP_SENSOR_4] < prev_tmp[TEMP_SENSOR_4]) { for (i = current_level; i > 0; i--) { - if (temp[TEMP_SENSOR_1] < fan_step_table[i].off[TEMP_SENSOR_1] && - temp[TEMP_SENSOR_4] < fan_step_table[i].off[TEMP_SENSOR_4] && - temp[TEMP_SENSOR_3] < fan_step_table[i].off[TEMP_SENSOR_3]) + if (temp[TEMP_SENSOR_1] < + fan_step_table[i].off[TEMP_SENSOR_1] && + temp[TEMP_SENSOR_4] < + fan_step_table[i].off[TEMP_SENSOR_4] && + temp[TEMP_SENSOR_3] < + fan_step_table[i].off[TEMP_SENSOR_3]) current_level = i - 1; else break; @@ -179,9 +182,12 @@ int fan_table_to_rpm(int fan, int *temp) temp[TEMP_SENSOR_3] > prev_tmp[TEMP_SENSOR_3] || temp[TEMP_SENSOR_4] > prev_tmp[TEMP_SENSOR_4]) { for (i = current_level; i < NUM_FAN_LEVELS; i++) { - if ((temp[TEMP_SENSOR_1] > fan_step_table[i].on[TEMP_SENSOR_1] && - temp[TEMP_SENSOR_4] > fan_step_table[i].on[TEMP_SENSOR_4]) || - temp[TEMP_SENSOR_3] > fan_step_table[i].on[TEMP_SENSOR_3]) + if ((temp[TEMP_SENSOR_1] > + fan_step_table[i].on[TEMP_SENSOR_1] && + temp[TEMP_SENSOR_4] > + fan_step_table[i].on[TEMP_SENSOR_4]) || + temp[TEMP_SENSOR_3] > + fan_step_table[i].on[TEMP_SENSOR_3]) current_level = i + 1; else break; @@ -212,10 +218,8 @@ int fan_table_to_rpm(int fan, int *temp) void board_override_fan_control(int fan, int *tmp) { - if (chipset_in_state(CHIPSET_STATE_ON | - CHIPSET_STATE_ANY_SUSPEND)) { + if (chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND)) { fan_set_rpm_mode(FAN_CH(fan), 1); - fan_set_rpm_target(FAN_CH(fan), - fan_table_to_rpm(fan, tmp)); + fan_set_rpm_target(FAN_CH(fan), fan_table_to_rpm(fan, tmp)); } } |