diff options
Diffstat (limited to 'board/jacuzzi')
-rw-r--r-- | board/jacuzzi/battery.c | 5 | ||||
-rw-r--r-- | board/jacuzzi/board.c | 128 | ||||
-rw-r--r-- | board/jacuzzi/board.h | 27 | ||||
-rw-r--r-- | board/jacuzzi/build.mk | 2 | ||||
-rw-r--r-- | board/jacuzzi/ec.tasklist | 2 | ||||
-rw-r--r-- | board/jacuzzi/gpio.inc | 2 | ||||
-rw-r--r-- | board/jacuzzi/led.c | 39 |
7 files changed, 99 insertions, 106 deletions
diff --git a/board/jacuzzi/battery.c b/board/jacuzzi/battery.c index 443bf1e98a..1caeb7e3c5 100644 --- a/board/jacuzzi/battery.c +++ b/board/jacuzzi/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. */ @@ -120,7 +120,8 @@ const struct board_batt_params board_battery_info[] = { }; BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT); -const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_PANASONIC_AC16L5J_KT00205009; +const enum battery_type DEFAULT_BATTERY_TYPE = + BATTERY_PANASONIC_AC16L5J_KT00205009; enum battery_present battery_hw_present(void) { diff --git a/board/jacuzzi/board.c b/board/jacuzzi/board.c index 861c139fdf..129b75f8e2 100644 --- a/board/jacuzzi/board.c +++ b/board/jacuzzi/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. */ @@ -32,6 +32,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" @@ -46,8 +47,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) { @@ -59,50 +60,42 @@ 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 = "typec", + .port = 0, + .kbps = 400, + .scl = GPIO_I2C1_SCL, + .sda = GPIO_I2C1_SDA }, #ifdef BOARD_JACUZZI - { - .name = "other", - .port = 1, - .kbps = 100, - .scl = GPIO_I2C2_SCL, - .sda = GPIO_I2C2_SDA - }, + { .name = "other", + .port = 1, + .kbps = 100, + .scl = GPIO_I2C2_SCL, + .sda = GPIO_I2C2_SDA }, #else /* Juniper */ - { - .name = "other", - .port = 1, - .kbps = 400, - .scl = GPIO_I2C2_SCL, - .sda = GPIO_I2C2_SDA - }, + { .name = "other", + .port = 1, + .kbps = 400, + .scl = GPIO_I2C2_SCL, + .sda = GPIO_I2C2_SDA }, #endif }; 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); @@ -110,8 +103,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); @@ -167,8 +160,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 */ @@ -181,13 +173,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, + }, }, }; @@ -249,12 +244,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) @@ -311,8 +306,7 @@ static void board_spi_enable(void) /* Pin mux spi peripheral toward the sensor. */ gpio_config_module(MODULE_SPI_CONTROLLER, 1); } -DECLARE_HOOK(HOOK_CHIPSET_STARTUP, - board_spi_enable, +DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_spi_enable, MOTION_SENSE_HOOK_PRIO - 1); static void board_spi_disable(void) @@ -329,8 +323,7 @@ static void board_spi_disable(void) spi_enable(&spi_devices[0], 0); STM32_RCC_APB1ENR &= ~STM32_RCC_PB1_SPI2; } -DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, - board_spi_disable, +DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_spi_disable, MOTION_SENSE_HOOK_PRIO + 1); #endif /* !VARIANT_KUKUI_NO_SENSORS */ @@ -368,14 +361,12 @@ static void board_init(void) #ifndef VARIANT_KUKUI_NO_SENSORS motion_sensor_count = 0; gpio_disable_interrupt(GPIO_ACCEL_INT_ODL); - gpio_set_flags(GPIO_ACCEL_INT_ODL, - GPIO_INPUT | GPIO_PULL_DOWN); + gpio_set_flags(GPIO_ACCEL_INT_ODL, GPIO_INPUT | GPIO_PULL_DOWN); #endif /* !VARIANT_KUKUI_NO_SENSORS */ /* Disable tablet mode. */ tablet_set_mode(0, TABLET_TRIGGER_LID); gmr_tablet_switch_disable(); - gpio_set_flags(GPIO_TABLET_MODE_L, - GPIO_INPUT | GPIO_PULL_UP); + gpio_set_flags(GPIO_TABLET_MODE_L, GPIO_INPUT | GPIO_PULL_UP); } } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); @@ -387,17 +378,13 @@ static struct mutex g_lid_mutex; static struct mutex g_base_mutex; /* Rotation matrixes */ -static const mat33_fp_t base_bmi160_ref = { - {FLOAT_TO_FP(1), 0, 0}, - {0, FLOAT_TO_FP(1), 0}, - {0, 0, FLOAT_TO_FP(1)} -}; +static const mat33_fp_t base_bmi160_ref = { { FLOAT_TO_FP(1), 0, 0 }, + { 0, FLOAT_TO_FP(1), 0 }, + { 0, 0, FLOAT_TO_FP(1) } }; -static const mat33_fp_t base_icm426xx_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_icm426xx_ref = { { 0, FLOAT_TO_FP(-1), 0 }, + { FLOAT_TO_FP(1), 0, 0 }, + { 0, 0, FLOAT_TO_FP(1) } }; /* sensor private data */ static struct kionix_accel_data g_kx022_data; @@ -558,10 +545,11 @@ static void board_detect_motionsensor(void) motion_sensors[BASE_ACCEL] = icm426xx_base_accel; motion_sensors[BASE_GYRO] = icm426xx_base_gyro; } - base_accelgyro_config = (val == ICM426XX_CHIP_ICM40608) - ? BASE_GYRO_ICM426XX : BASE_GYRO_BMI160; - CPRINTS("Base Accelgyro: %s", (val == ICM426XX_CHIP_ICM40608) - ? "ICM40608" : "BMI160"); + base_accelgyro_config = (val == ICM426XX_CHIP_ICM40608) ? + BASE_GYRO_ICM426XX : + BASE_GYRO_BMI160; + CPRINTS("Base Accelgyro: %s", + (val == ICM426XX_CHIP_ICM40608) ? "ICM40608" : "BMI160"); } DECLARE_HOOK(HOOK_INIT, board_detect_motionsensor, HOOK_PRIO_DEFAULT); diff --git a/board/jacuzzi/board.h b/board/jacuzzi/board.h index da66312411..0fd5f6496d 100644 --- a/board/jacuzzi/board.h +++ b/board/jacuzzi/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. */ @@ -58,7 +58,7 @@ /* Motion Sensors */ #ifndef VARIANT_KUKUI_NO_SENSORS #define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT -#define CONFIG_ACCEL_KX022 /* Lid accel */ +#define CONFIG_ACCEL_KX022 /* Lid accel */ #define CONFIG_ACCELGYRO_BMI160 /* Base accel */ #define CONFIG_ACCELGYRO_BMI160_INT_EVENT \ TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) @@ -71,7 +71,6 @@ #define CONFIG_ALS #define CONFIG_CMD_ACCEL_INFO - #define CONFIG_LID_ANGLE #define CONFIG_LID_ANGLE_UPDATE #define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL @@ -84,24 +83,24 @@ #endif /* VARIANT_KUKUI_NO_SENSORS */ /* I2C ports */ -#define I2C_PORT_BC12 0 -#define I2C_PORT_TCPC0 0 -#define I2C_PORT_USB_MUX 0 -#define I2C_PORT_CHARGER board_get_charger_i2c() -#define I2C_PORT_SENSORS 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_CHARGER board_get_charger_i2c() +#define I2C_PORT_SENSORS 1 +#define I2C_PORT_KB_DISCRETE 1 +#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY #ifdef BOARD_JACUZZI -#define I2C_PORT_BATTERY 1 +#define I2C_PORT_BATTERY 1 #else /* Juniper */ -#define I2C_PORT_BATTERY 2 +#define I2C_PORT_BATTERY 2 #endif /* IT8801 I2C address */ -#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1 +#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1 /* Enable Accel over SPI */ -#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */ +#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */ #define CONFIG_KEYBOARD_PROTOCOL_MKBP #define CONFIG_MKBP_EVENT diff --git a/board/jacuzzi/build.mk b/board/jacuzzi/build.mk index e449fce9fc..80c34a4e46 100644 --- a/board/jacuzzi/build.mk +++ b/board/jacuzzi/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/jacuzzi/ec.tasklist b/board/jacuzzi/ec.tasklist index b695d05a71..dd3b853c27 100644 --- a/board/jacuzzi/ec.tasklist +++ b/board/jacuzzi/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/jacuzzi/gpio.inc b/board/jacuzzi/gpio.inc index 60288e7195..b534ad2ea1 100644 --- a/board/jacuzzi/gpio.inc +++ b/board/jacuzzi/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/jacuzzi/led.c b/board/jacuzzi/led.c index e76b73bc9a..f648e879d0 100644 --- a/board/jacuzzi/led.c +++ b/board/jacuzzi/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. * @@ -15,22 +15,27 @@ __override const int led_charge_lvl_1 = 5; __override const int led_charge_lvl_2 = 95; __override struct led_descriptor - led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = { - [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} }, - [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} }, - [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} }, - [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} }, - [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC}, - {LED_OFF, 3 * LED_ONE_SEC} }, - [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} }, - [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC}, - {LED_OFF, 1 * LED_ONE_SEC} }, - [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC}, - {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} }, -}; -const enum ec_led_id supported_led_ids[] = { - EC_LED_ID_BATTERY_LED -}; + led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = { + [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER, + LED_INDEFINITE } }, + [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER, + LED_INDEFINITE } }, + [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE, + LED_INDEFINITE } }, + [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE, + LED_INDEFINITE } }, + [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER, + 1 * LED_ONE_SEC }, + { LED_OFF, 3 * LED_ONE_SEC } }, + [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } }, + [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER, + 1 * LED_ONE_SEC }, + { LED_OFF, 1 * LED_ONE_SEC } }, + [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC }, + { EC_LED_COLOR_AMBER, + 2 * LED_ONE_SEC } }, + }; +const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED }; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); __override void led_set_color_battery(enum ec_led_colors color) { |