diff options
Diffstat (limited to 'board/oak')
-rw-r--r-- | board/oak/battery.c | 14 | ||||
-rw-r--r-- | board/oak/board.c | 137 | ||||
-rw-r--r-- | board/oak/board.h | 48 | ||||
-rw-r--r-- | board/oak/board_revs.h | 4 | ||||
-rw-r--r-- | board/oak/build.mk | 2 | ||||
-rw-r--r-- | board/oak/ec.tasklist | 2 | ||||
-rw-r--r-- | board/oak/gpio.inc | 2 | ||||
-rw-r--r-- | board/oak/led.c | 30 | ||||
-rw-r--r-- | board/oak/usb_pd_policy.c | 15 |
9 files changed, 123 insertions, 131 deletions
diff --git a/board/oak/battery.c b/board/oak/battery.c index fffd2f7763..b9b410932d 100644 --- a/board/oak/battery.c +++ b/board/oak/battery.c @@ -1,4 +1,4 @@ -/* Copyright 2015 The Chromium OS Authors. All rights reserved. +/* Copyright 2015 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * @@ -11,7 +11,7 @@ #include "util.h" /* Shutdown mode parameter to write to manufacturer access register */ -#define PARAM_CUT_OFF_LOW 0x10 +#define PARAM_CUT_OFF_LOW 0x10 #define PARAM_CUT_OFF_HIGH 0x00 static const struct battery_info info = { @@ -21,7 +21,7 @@ static const struct battery_info info = { /* * TODO(crosbug.com/p/44428): * In order to compatible with 2S battery, set min voltage as 6V rather - * than 9V. Should set voltage_min to 9V, when 2S battery + * than 9V. Should set voltage_min to 9V, when 2S battery * phased out. */ .voltage_min = 6000, @@ -57,10 +57,10 @@ static int cutoff(void) buf[2] = PARAM_CUT_OFF_HIGH; i2c_lock(I2C_PORT_BATTERY, 1); - rv = i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS, - buf, 3, NULL, 0, I2C_XFER_SINGLE); - rv |= i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS, - buf, 3, NULL, 0, I2C_XFER_SINGLE); + rv = i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS, buf, 3, + NULL, 0, I2C_XFER_SINGLE); + rv |= i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS, buf, 3, + NULL, 0, I2C_XFER_SINGLE); i2c_lock(I2C_PORT_BATTERY, 0); return rv; diff --git a/board/oak/board.c b/board/oak/board.c index 1c2e65b12a..468b6e6677 100644 --- a/board/oak/board.c +++ b/board/oak/board.c @@ -1,4 +1,4 @@ -/* Copyright 2015 The Chromium OS Authors. All rights reserved. +/* Copyright 2015 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -52,8 +52,8 @@ #include "usb_pd_tcpm.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) /* Dispaly port hardware can connect to port 0, 1 or neither. */ #define PD_PORT_NONE -1 @@ -76,8 +76,8 @@ void usb_evt(enum gpio_signal signal) /* power signal list. Must match order of enum power_signal. */ const struct power_signal_info power_signal_list[] = { - {GPIO_SOC_POWER_GOOD, POWER_SIGNAL_ACTIVE_HIGH, "POWER_GOOD"}, - {GPIO_SUSPEND_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND#_ASSERTED"}, + { GPIO_SOC_POWER_GOOD, POWER_SIGNAL_ACTIVE_HIGH, "POWER_GOOD" }, + { GPIO_SUSPEND_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND#_ASSERTED" }, }; BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT); @@ -87,39 +87,32 @@ const struct adc_t adc_channels[] = { * PSYS_MONITOR(PA2): ADC_IN2, 1.44 uA/W on 6.05k Ohm * output in mW */ - [ADC_PSYS] = {"PSYS", 379415, 4096, 0, STM32_AIN(2)}, + [ADC_PSYS] = { "PSYS", 379415, 4096, 0, STM32_AIN(2) }, /* AMON_BMON(PC0): ADC_IN10, output in uV */ - [ADC_AMON_BMON] = {"AMON_BMON", 183333, 4096, 0, STM32_AIN(10)}, + [ADC_AMON_BMON] = { "AMON_BMON", 183333, 4096, 0, STM32_AIN(10) }, /* VDC_BOOSTIN_SENSE(PC1): ADC_IN11, output in mV */ - [ADC_VBUS] = {"VBUS", 33000, 4096, 0, STM32_AIN(11)}, + [ADC_VBUS] = { "VBUS", 33000, 4096, 0, STM32_AIN(11) }, }; BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); /* I2C ports */ -const struct i2c_port_t i2c_ports[] = { - { - .name = "battery", - .port = I2C_PORT_BATTERY, - .kbps = 100, - .scl = GPIO_I2C0_SCL, - .sda = GPIO_I2C0_SDA - }, - { - .name = "pd", - .port = I2C_PORT_PD_MCU, - .kbps = 1000, - .scl = GPIO_I2C1_SCL, - .sda = GPIO_I2C1_SDA - } -}; +const struct i2c_port_t i2c_ports[] = { { .name = "battery", + .port = I2C_PORT_BATTERY, + .kbps = 100, + .scl = GPIO_I2C0_SCL, + .sda = GPIO_I2C0_SDA }, + { .name = "pd", + .port = I2C_PORT_PD_MCU, + .kbps = 1000, + .scl = GPIO_I2C1_SCL, + .sda = GPIO_I2C1_SDA } }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); #ifdef CONFIG_ACCELGYRO_BMI160 /* SPI devices */ -const struct spi_device_t spi_devices[] = { - { CONFIG_SPI_ACCEL_PORT, 1, GPIO_SPI2_NSS } -}; +const struct spi_device_t spi_devices[] = { { CONFIG_SPI_ACCEL_PORT, 1, + GPIO_SPI2_NSS } }; const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); #endif @@ -184,42 +177,47 @@ const struct charger_config_t chg_chips[] = { * src/mainboard/google/${board}/acpi/dptf.asl */ const struct temp_sensor_t temp_sensors[] = { - {"TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val, - TMP432_IDX_LOCAL}, - {"TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val, - TMP432_IDX_REMOTE1}, - {"TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val, - TMP432_IDX_REMOTE2}, - {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, - 0}, + { "TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val, + TMP432_IDX_LOCAL }, + { "TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val, + TMP432_IDX_REMOTE1 }, + { "TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val, + TMP432_IDX_REMOTE2 }, + { "Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0 }, }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); #ifdef HAS_TASK_ALS /* ALS instances. Must be in same order as enum als_id. */ struct als_t als[] = { - {"TI", opt3001_init, opt3001_read_lux, 5}, + { "TI", opt3001_init, opt3001_read_lux, 5 }, }; BUILD_ASSERT(ARRAY_SIZE(als) == ALS_COUNT); #endif -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_port = 0, - .i2c_port = I2C_PORT_USB_MUX, - .i2c_addr_flags = PI3USB3X532_I2C_ADDR0, - .driver = &pi3usb3x532_usb_mux_driver, + .mux = + &(const struct usb_mux){ + .usb_port = 0, + .i2c_port = I2C_PORT_USB_MUX, + .i2c_addr_flags = PI3USB3X532_I2C_ADDR0, + .driver = &pi3usb3x532_usb_mux_driver, + }, }, { - .usb_port = 1, - .i2c_port = I2C_PORT_USB_MUX, + .mux = + &(const struct usb_mux){ + .usb_port = 1, + .i2c_port = I2C_PORT_USB_MUX, #if (BOARD_REV <= OAK_REV4) - .i2c_addr_flags = PI3USB3X532_I2C_ADDR1, - .driver = &pi3usb3x532_usb_mux_driver, + .i2c_addr_flags = PI3USB3X532_I2C_ADDR1, + .driver = &pi3usb3x532_usb_mux_driver, #else - .i2c_addr_flags = 0x10, - .driver = &ps8740_usb_mux_driver, + .i2c_addr_flags = 0x10, + .driver = &ps8740_usb_mux_driver, #endif + }, }, }; @@ -340,10 +338,12 @@ int board_set_active_charge_port(int charge_port) } else { /* Make sure non-charging port is disabled */ gpio_set_level(charge_port ? GPIO_USB_C0_CHARGE_L : - GPIO_USB_C1_CHARGE_L, 1); + GPIO_USB_C1_CHARGE_L, + 1); /* Enable charging port */ gpio_set_level(charge_port ? GPIO_USB_C1_CHARGE_L : - GPIO_USB_C0_CHARGE_L, 0); + GPIO_USB_C0_CHARGE_L, + 0); } return EC_SUCCESS; @@ -357,11 +357,11 @@ int board_set_active_charge_port(int charge_port) * @param charge_ma Desired charge limit (mA). * @param charge_mv Negotiated charge voltage (mV). */ -void board_set_charge_limit(int port, int supplier, int charge_ma, - int max_ma, int charge_mv) +void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma, + int charge_mv) { - charge_set_input_current_limit(MAX(charge_ma, - CONFIG_CHARGER_INPUT_CURRENT), charge_mv); + charge_set_input_current_limit( + MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv); pd_send_host_event(PD_EVENT_POWER_CHANGE); } @@ -552,8 +552,8 @@ void vbus_task(void *u) } if (wake) - usb_charger_task_set_event( - port, USB_CHG_EVENT_BC12); + usb_charger_task_set_event(port, + USB_CHG_EVENT_BC12); } task_wait_event(-1); } @@ -569,15 +569,15 @@ void vbus_task(void *u) #ifdef CONFIG_TEMP_SENSOR_TMP432 static void tmp432_set_power_deferred(void) { - /* Shut tmp432 down if not in S0 && no external power */ - if (!extpower_is_present() && !chipset_in_state(CHIPSET_STATE_ON)) { - if (EC_SUCCESS != tmp432_set_power(TMP432_POWER_OFF)) + /* Shut tmp432 down if not in S0 && no external power */ + if (!extpower_is_present() && !chipset_in_state(CHIPSET_STATE_ON)) { + if (EC_SUCCESS != tmp432_set_power(TMP432_POWER_OFF)) CPRINTS("ERROR: Can't shutdown TMP432."); - return; - } + return; + } - /* else, turn it on. */ - if (EC_SUCCESS != tmp432_set_power(TMP432_POWER_ON)) + /* else, turn it on. */ + if (EC_SUCCESS != tmp432_set_power(TMP432_POWER_ON)) CPRINTS("ERROR: Can't turn on TMP432."); } DECLARE_DEFERRED(tmp432_set_power_deferred); @@ -602,7 +602,7 @@ static void board_chipset_pre_init(void) board_extpower_buffer_to_soc(); #if BOARD_REV >= OAK_REV5 /* Enable DP muxer */ - gpio_set_level(GPIO_DP_MUX_EN_L , 0); + gpio_set_level(GPIO_DP_MUX_EN_L, 0); gpio_set_level(GPIO_PARADE_MUX_EN, 1); #endif } @@ -615,13 +615,12 @@ static void board_chipset_shutdown(void) gpio_set_level(GPIO_LEVEL_SHIFT_EN_L, 1); #if BOARD_REV >= OAK_REV5 /* Disable DP muxer */ - gpio_set_level(GPIO_DP_MUX_EN_L , 1); + gpio_set_level(GPIO_DP_MUX_EN_L, 1); gpio_set_level(GPIO_PARADE_MUX_EN, 0); #endif } DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT); - /* Called on AP S3 -> S0 transition */ static void board_chipset_resume(void) { @@ -650,11 +649,9 @@ static struct mutex g_lid_mutex; static struct mutex g_base_mutex; /* Matrix to rotate accelrator into standard reference frame */ -const mat33_fp_t base_standard_ref = { - { FLOAT_TO_FP(-1), 0, 0}, - { 0, FLOAT_TO_FP(-1), 0}, - { 0, 0, FLOAT_TO_FP(1)} -}; +const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 }, + { 0, FLOAT_TO_FP(-1), 0 }, + { 0, 0, FLOAT_TO_FP(1) } }; #endif static struct kionix_accel_data g_kx022_data; diff --git a/board/oak/board.h b/board/oak/board.h index b40215a7bf..6f5ed3fc87 100644 --- a/board/oak/board.h +++ b/board/oak/board.h @@ -1,4 +1,4 @@ -/* Copyright 2015 The Chromium OS Authors. All rights reserved. +/* Copyright 2015 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -23,7 +23,7 @@ #endif #define CONFIG_ADC -#undef CONFIG_ADC_WATCHDOG +#undef CONFIG_ADC_WATCHDOG #if BOARD_REV >= OAK_REV5 /* Add for Ambient Light Sensor */ @@ -107,10 +107,10 @@ #define CONFIG_SPI_CONTROLLER #define CONFIG_STM_HWTIMER32 #define CONFIG_VBOOT_HASH -#undef CONFIG_WATCHDOG_HELP +#undef CONFIG_WATCHDOG_HELP #define CONFIG_SWITCH #define CONFIG_BOARD_VERSION_GPIO -#undef CONFIG_UART_CONSOLE +#undef CONFIG_UART_CONSOLE #define CONFIG_UART_CONSOLE 1 #define CONFIG_TEMP_SENSOR #define CONFIG_TEMP_SENSOR_TMP432 @@ -149,19 +149,19 @@ #define KB_OUT_PORT_LIST GPIO_A, GPIO_B, GPIO_C, GPIO_D /* 2 I2C master ports, connect to battery, charger, pd and USB switches */ -#define I2C_PORT_MASTER 0 -#define I2C_PORT_ACCEL 0 -#define I2C_PORT_ALS 0 +#define I2C_PORT_MASTER 0 +#define I2C_PORT_ACCEL 0 +#define I2C_PORT_ALS 0 #define I2C_PORT_BATTERY 0 #define I2C_PORT_CHARGER 0 #define I2C_PORT_PERICOM 0 #define I2C_PORT_THERMAL 0 -#define I2C_PORT_PD_MCU 1 +#define I2C_PORT_PD_MCU 1 #define I2C_PORT_USB_MUX 1 -#define I2C_PORT_TCPC 1 +#define I2C_PORT_TCPC 1 /* Enable Accel over SPI */ -#define CONFIG_SPI_ACCEL_PORT 0 /* First SPI controller port (SPI2) */ +#define CONFIG_SPI_ACCEL_PORT 0 /* First SPI controller port (SPI2) */ /* Ambient Light Sensor address */ #define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS @@ -171,12 +171,12 @@ #define TIM_WATCHDOG 4 /* Define the host events which are allowed to wakeup AP in S3. */ -#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \ - (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\ - EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) |\ - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEY_PRESSED) |\ - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY) |\ - EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_FASTBOOT)) +#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \ + (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) | \ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) | \ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEY_PRESSED) | \ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY) | \ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_FASTBOOT)) #include "gpio_signal.h" @@ -194,9 +194,9 @@ enum pwm_channel { }; enum adc_channel { - ADC_PSYS = 0, /* PC1: STM32_AIN(2) */ + ADC_PSYS = 0, /* PC1: STM32_AIN(2) */ ADC_AMON_BMON, /* PC0: STM32_AIN(10) */ - ADC_VBUS, /* PA2: STM32_AIN(11) */ + ADC_VBUS, /* PA2: STM32_AIN(11) */ ADC_CH_COUNT }; @@ -235,16 +235,16 @@ enum als_id { * delay to turn on the power supply max is ~16ms. * delay to turn off the power supply max is about ~180ms. */ -#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */ +#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */ #define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */ /* delay to turn on/off vconn */ /* Define typical operating power and max power */ #define PD_OPERATING_POWER_MW 15000 -#define PD_MAX_POWER_MW 60000 -#define PD_MAX_CURRENT_MA CONFIG_CHARGER_MAX_INPUT_CURRENT -#define PD_MAX_VOLTAGE_MV 20000 +#define PD_MAX_POWER_MW 60000 +#define PD_MAX_CURRENT_MA CONFIG_CHARGER_MAX_INPUT_CURRENT +#define PD_MAX_VOLTAGE_MV 20000 /* Reset PD MCU */ void board_reset_pd_mcu(void); @@ -256,6 +256,6 @@ void board_typec_dp_on(int port); void board_typec_dp_off(int port, int *dp_flags); void board_typec_dp_set(int port, int level); -#endif /* !__ASSEMBLER__ */ +#endif /* !__ASSEMBLER__ */ -#endif /* __CROS_EC_BOARD_H */ +#endif /* __CROS_EC_BOARD_H */ diff --git a/board/oak/board_revs.h b/board/oak/board_revs.h index 34fc4bfc88..6220a05fb0 100644 --- a/board/oak/board_revs.h +++ b/board/oak/board_revs.h @@ -1,4 +1,4 @@ -/* Copyright 2015 The Chromium OS Authors. All rights reserved. +/* Copyright 2015 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -12,7 +12,7 @@ #define OAK_REV3 3 #define OAK_REV4 4 #define OAK_REV5 5 -#define OAK_REV_LAST OAK_REV5 +#define OAK_REV_LAST OAK_REV5 #define OAK_REV_DEFAULT OAK_REV5 #if !defined(BOARD_REV) diff --git a/board/oak/build.mk b/board/oak/build.mk index dc21970df0..1cbbb2ac63 100644 --- a/board/oak/build.mk +++ b/board/oak/build.mk @@ -1,5 +1,5 @@ #-*- makefile -*- -# Copyright 2015 The Chromium OS Authors. All rights reserved. +# Copyright 2015 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/oak/ec.tasklist b/board/oak/ec.tasklist index 2af7da77eb..80c39f2617 100644 --- a/board/oak/ec.tasklist +++ b/board/oak/ec.tasklist @@ -1,4 +1,4 @@ -/* Copyright 2015 The Chromium OS Authors. All rights reserved. +/* Copyright 2015 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/oak/gpio.inc b/board/oak/gpio.inc index 3789f3ec35..b2ce008363 100644 --- a/board/oak/gpio.inc +++ b/board/oak/gpio.inc @@ -1,6 +1,6 @@ /* -*- mode:c -*- * - * Copyright 2015 The Chromium OS Authors. All rights reserved. + * Copyright 2015 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/oak/led.c b/board/oak/led.c index 877f115a12..64f5123b3c 100644 --- a/board/oak/led.c +++ b/board/oak/led.c @@ -1,4 +1,4 @@ -/* Copyright 2015 The Chromium OS Authors. All rights reserved. +/* Copyright 2015 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * @@ -14,9 +14,7 @@ #include "util.h" #include "system.h" -const enum ec_led_id supported_led_ids[] = { - EC_LED_ID_BATTERY_LED -}; +const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED }; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); @@ -27,7 +25,7 @@ enum led_color { BAT_LED_AMBER, PWR_LED_GREEN, PWR_LED_ORANGE, - LED_COLOR_COUNT /* Number of colors, not a color itself */ + LED_COLOR_COUNT /* Number of colors, not a color itself */ }; static int bat_led_set(enum led_color color, int on) @@ -113,7 +111,7 @@ static void oak_led_set_power(int board_version) power_second++; - switch(board_version) { + switch (board_version) { case OAK_REV3: case OAK_REV4: /* @@ -131,8 +129,7 @@ static void oak_led_set_power(int board_version) bat_led_set(PWR_LED_ORANGE, 0); } else if (chipset_in_state(CHIPSET_STATE_SUSPEND)) { bat_led_set(PWR_LED_GREEN, 0); - bat_led_set(PWR_LED_ORANGE, - (power_second & 3) ? 0 : 1); + bat_led_set(PWR_LED_ORANGE, (power_second & 3) ? 0 : 1); } break; default: @@ -146,7 +143,7 @@ static void oak_led_set_battery(int board_version) battery_second++; - switch(board_version) { + switch (board_version) { case OAK_REV3: case OAK_REV4: /* @@ -169,10 +166,10 @@ static void oak_led_set_battery(int board_version) bat_led_set(BAT_LED_GREEN, 0); if (charge_get_percent() < 3) bat_led_set(BAT_LED_RED, - (battery_second & 1) ? 0 : 1); + (battery_second & 1) ? 0 : 1); else if (charge_get_percent() < 10) bat_led_set(BAT_LED_RED, - (battery_second & 3) ? 0 : 1); + (battery_second & 3) ? 0 : 1); else bat_led_set(BAT_LED_RED, 0); break; @@ -191,7 +188,8 @@ static void oak_led_set_battery(int board_version) default: /* * Put power control here since we are using the "battery" LED. - * This allows LED autocontrol to be turned off by cmd during factory test. + * This allows LED autocontrol to be turned off by cmd during + * factory test. * * PWR LED behavior: * Power on: Green @@ -205,8 +203,8 @@ static void oak_led_set_battery(int board_version) else if (chipset_in_state(CHIPSET_STATE_SUSPEND)) { int cycle_time = 4; /* Oak rev5 with GlaDOS ID has a extremely power - * comsuming LED. Increase LED blink cycle time to reduce - * S3 power comsuption. */ + * comsuming LED. Increase LED blink cycle time to + * reduce S3 power comsuption. */ if (board_version >= OAK_REV5) cycle_time = 10; bat_led_set(BAT_LED_GREEN, @@ -231,10 +229,10 @@ static void oak_led_set_battery(int board_version) case PWR_STATE_DISCHARGE: if (charge_get_percent() < 3) bat_led_set(BAT_LED_ORANGE, - (battery_second & 1) ? 0 : 1); + (battery_second & 1) ? 0 : 1); else if (charge_get_percent() < 10) bat_led_set(BAT_LED_ORANGE, - (battery_second & 3) ? 0 : 1); + (battery_second & 3) ? 0 : 1); else bat_led_set(BAT_LED_ORANGE, 0); break; diff --git a/board/oak/usb_pd_policy.c b/board/oak/usb_pd_policy.c index a4e62ebe88..c337aa4b59 100644 --- a/board/oak/usb_pd_policy.c +++ b/board/oak/usb_pd_policy.c @@ -1,4 +1,4 @@ -/* Copyright 2015 The Chromium OS Authors. All rights reserved. +/* Copyright 2015 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -18,17 +18,15 @@ #include "usb_mux.h" #include "usb_pd.h" -#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) -#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) +#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args) +#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args) int pd_set_power_supply_ready(int port) { /* Disable charging */ - gpio_set_level(port ? GPIO_USB_C1_CHARGE_L : - GPIO_USB_C0_CHARGE_L, 1); + gpio_set_level(port ? GPIO_USB_C1_CHARGE_L : GPIO_USB_C0_CHARGE_L, 1); /* Provide VBUS */ - gpio_set_level(port ? GPIO_USB_C1_5V_EN : - GPIO_USB_C0_5V_EN, 1); + gpio_set_level(port ? GPIO_USB_C1_5V_EN : GPIO_USB_C0_5V_EN, 1); /* notify host of power info change */ pd_send_host_event(PD_EVENT_POWER_CHANGE); @@ -39,8 +37,7 @@ int pd_set_power_supply_ready(int port) void pd_power_supply_reset(int port) { /* Disable VBUS */ - gpio_set_level(port ? GPIO_USB_C1_5V_EN : - GPIO_USB_C0_5V_EN, 0); + gpio_set_level(port ? GPIO_USB_C1_5V_EN : GPIO_USB_C0_5V_EN, 0); /* notify host of power info change */ pd_send_host_event(PD_EVENT_POWER_CHANGE); |