diff options
Diffstat (limited to 'board/kappa')
-rw-r--r-- | board/kappa/battery.c | 2 | ||||
-rw-r--r-- | board/kappa/board.c | 82 | ||||
-rw-r--r-- | board/kappa/board.h | 18 | ||||
-rw-r--r-- | board/kappa/build.mk | 2 | ||||
-rw-r--r-- | board/kappa/ec.tasklist | 2 | ||||
-rw-r--r-- | board/kappa/gpio.inc | 2 | ||||
-rw-r--r-- | board/kappa/led.c | 27 |
7 files changed, 64 insertions, 71 deletions
diff --git a/board/kappa/battery.c b/board/kappa/battery.c index a098e2b8ce..bd8f05b418 100644 --- a/board/kappa/battery.c +++ b/board/kappa/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/kappa/board.c b/board/kappa/board.c index a0d5fda409..c04b24d3ed 100644 --- a/board/kappa/board.c +++ b/board/kappa/board.c @@ -1,4 +1,4 @@ -/* Copyright 2018 The Chromium OS Authors. All rights reserved. +/* Copyright 2018 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -30,6 +30,7 @@ #include "it8801.h" #include "keyboard_scan.h" #include "lid_switch.h" +#include "panic.h" #include "power.h" #include "power_button.h" #include "registers.h" @@ -44,8 +45,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) static void tcpc_alert_event(enum gpio_signal signal) { @@ -57,40 +58,34 @@ static void tcpc_alert_event(enum gpio_signal signal) /******************************************************************************/ /* ADC channels. Must be in the exactly same order as in enum adc_channel. */ const struct adc_t adc_channels[] = { - [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)}, - [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8)}, + [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(10) }, + [ADC_EC_SKU_ID] = { "EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8) }, }; BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); /******************************************************************************/ /* I2C ports */ const struct i2c_port_t i2c_ports[] = { - { - .name = "typec", - .port = 0, - .kbps = 400, - .scl = GPIO_I2C1_SCL, - .sda = GPIO_I2C1_SDA - }, - { - .name = "other", - .port = 1, - .kbps = 100, - .scl = GPIO_I2C2_SCL, - .sda = GPIO_I2C2_SDA - }, + { .name = "typec", + .port = 0, + .kbps = 400, + .scl = GPIO_I2C1_SCL, + .sda = GPIO_I2C1_SDA }, + { .name = "other", + .port = 1, + .kbps = 100, + .scl = GPIO_I2C2_SCL, + .sda = GPIO_I2C2_SDA }, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); const struct i2c_port_t i2c_bitbang_ports[] = { - { - .name = "battery", - .port = 2, - .kbps = 100, - .scl = GPIO_I2C3_SCL, - .sda = GPIO_I2C3_SDA, - .drv = &bitbang_drv - }, + { .name = "battery", + .port = 2, + .kbps = 100, + .scl = GPIO_I2C3_SCL, + .sda = GPIO_I2C3_SDA, + .drv = &bitbang_drv }, }; const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports); @@ -98,8 +93,8 @@ const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports); /* power signal list. Must match order of enum power_signal. */ const struct power_signal_info power_signal_list[] = { - {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"}, - {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"}, + { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" }, + { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" }, }; BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT); @@ -132,8 +127,7 @@ struct ioexpander_config_t ioex_config[CONFIG_IO_EXPANDER_PORT_COUNT] = { /******************************************************************************/ /* SPI devices */ /* TODO: to be added once sensors land via CL:1714436 */ -const struct spi_device_t spi_devices[] = { -}; +const struct spi_device_t spi_devices[] = {}; const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = { @@ -155,8 +149,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { }, }; -static void board_hpd_status(const struct usb_mux *me, - mux_state_t mux_state, +static void board_hpd_status(const struct usb_mux *me, mux_state_t mux_state, bool *ack_required) { /* This driver does not use host command ACKs */ @@ -169,13 +162,16 @@ static void board_hpd_status(const struct usb_mux *me, host_set_single_event(EC_HOST_EVENT_USB_MUX); } -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 = IT5205_I2C_ADDR1_FLAGS, - .driver = &it5205_usb_mux_driver, - .hpd_update = &board_hpd_status, + .mux = + &(const struct usb_mux){ + .usb_port = 0, + .i2c_port = I2C_PORT_USB_MUX, + .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS, + .driver = &it5205_usb_mux_driver, + .hpd_update = &board_hpd_status, + }, }, }; @@ -221,12 +217,12 @@ int board_set_active_charge_port(int charge_port) return EC_SUCCESS; } -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_ma = (charge_ma * 95) / 100; - 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); } int board_discharge_on_ac(int enable) diff --git a/board/kappa/board.h b/board/kappa/board.h index 7cc7f68406..6b6461ae83 100644 --- a/board/kappa/board.h +++ b/board/kappa/board.h @@ -1,4 +1,4 @@ -/* Copyright 2018 The Chromium OS Authors. All rights reserved. +/* Copyright 2018 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -50,16 +50,16 @@ #undef CONFIG_TABLET_MODE_SWITCH /* I2C ports */ -#define I2C_PORT_BC12 0 -#define I2C_PORT_TCPC0 0 -#define I2C_PORT_USB_MUX 0 -#define I2C_PORT_BATTERY 2 -#define I2C_PORT_CHARGER 1 -#define I2C_PORT_KB_DISCRETE 1 -#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY +#define I2C_PORT_BC12 0 +#define I2C_PORT_TCPC0 0 +#define I2C_PORT_USB_MUX 0 +#define I2C_PORT_BATTERY 2 +#define I2C_PORT_CHARGER 1 +#define I2C_PORT_KB_DISCRETE 1 +#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY /* IT8801 I2C address */ -#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1 +#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1 #define CONFIG_KEYBOARD_PROTOCOL_MKBP #define CONFIG_MKBP_EVENT diff --git a/board/kappa/build.mk b/board/kappa/build.mk index e449fce9fc..80c34a4e46 100644 --- a/board/kappa/build.mk +++ b/board/kappa/build.mk @@ -1,5 +1,5 @@ # -*- makefile -*- -# Copyright 2018 The Chromium OS Authors. All rights reserved. +# Copyright 2018 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/kappa/ec.tasklist b/board/kappa/ec.tasklist index c41e203780..3705823bac 100644 --- a/board/kappa/ec.tasklist +++ b/board/kappa/ec.tasklist @@ -1,4 +1,4 @@ -/* Copyright 2018 The Chromium OS Authors. All rights reserved. +/* Copyright 2018 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/kappa/gpio.inc b/board/kappa/gpio.inc index 0e01d54f10..d7d6c5267b 100644 --- a/board/kappa/gpio.inc +++ b/board/kappa/gpio.inc @@ -1,6 +1,6 @@ /* -*- mode:c -*- * - * Copyright 2018 The Chromium OS Authors. All rights reserved. + * Copyright 2018 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/kappa/led.c b/board/kappa/led.c index 5b65d7b948..1c7979eac0 100644 --- a/board/kappa/led.c +++ b/board/kappa/led.c @@ -1,4 +1,4 @@ -/* Copyright 2020 The Chromium OS Authors. All rights reserved. +/* Copyright 2020 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * @@ -14,7 +14,7 @@ #define BAT_LED_ON 0 #define BAT_LED_OFF 1 -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); @@ -22,7 +22,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 int led_set_color_battery(enum led_color color) @@ -82,16 +82,14 @@ static void led_set_battery(void) { static int battery_ticks; static int power_ticks; - uint32_t chflags = charge_get_flags(); battery_ticks++; /* override battery led for system suspend */ - if (chipset_in_state(CHIPSET_STATE_SUSPEND | - CHIPSET_STATE_STANDBY) && + if (chipset_in_state(CHIPSET_STATE_SUSPEND | CHIPSET_STATE_STANDBY) && charge_get_state() != PWR_STATE_CHARGE) { - led_set_color_battery(power_ticks++ & 0x2 ? - LED_WHITE : LED_OFF); + led_set_color_battery(power_ticks++ & 0x2 ? LED_WHITE : + LED_OFF); return; } @@ -119,19 +117,18 @@ static void led_set_battery(void) led_set_color_battery(LED_OFF); break; case PWR_STATE_ERROR: - led_set_color_battery( - (battery_ticks % 0x2) ? LED_WHITE : LED_OFF); + led_set_color_battery((battery_ticks % 0x2) ? LED_WHITE : + LED_OFF); break; case PWR_STATE_CHARGE_NEAR_FULL: led_set_color_battery(LED_WHITE); break; case PWR_STATE_IDLE: /* External power connected in IDLE */ - if (chflags & CHARGE_FLAG_FORCE_IDLE) - led_set_color_battery( - (battery_ticks & 0x2) ? LED_AMBER : LED_OFF); - else - led_set_color_battery(LED_WHITE); + led_set_color_battery(LED_WHITE); break; + case PWR_STATE_FORCED_IDLE: + led_set_color_battery((battery_ticks & 0x2) ? LED_AMBER : + LED_OFF); default: /* Other states don't alter LED behavior */ break; |