diff options
Diffstat (limited to 'board/cappy2')
-rw-r--r-- | board/cappy2/battery.c | 10 | ||||
-rw-r--r-- | board/cappy2/board.c | 55 | ||||
-rw-r--r-- | board/cappy2/board.h | 35 | ||||
-rw-r--r-- | board/cappy2/build.mk | 2 | ||||
-rw-r--r-- | board/cappy2/cbi_ssfc.c | 6 | ||||
-rw-r--r-- | board/cappy2/cbi_ssfc.h | 3 | ||||
-rw-r--r-- | board/cappy2/ec.tasklist | 2 | ||||
-rw-r--r-- | board/cappy2/gpio.inc | 2 | ||||
-rw-r--r-- | board/cappy2/led.c | 65 | ||||
-rw-r--r-- | board/cappy2/usb_pd_policy.c | 6 |
10 files changed, 93 insertions, 93 deletions
diff --git a/board/cappy2/battery.c b/board/cappy2/battery.c index a0aef7bd4c..19be1825eb 100644 --- a/board/cappy2/battery.c +++ b/board/cappy2/battery.c @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * @@ -11,8 +11,8 @@ #include "common.h" #include "util.h" -#define CHARGING_VOLTAGE_MV_SAFE 8400 -#define CHARGING_CURRENT_MA_SAFE 1500 +#define CHARGING_VOLTAGE_MV_SAFE 8400 +#define CHARGING_CURRENT_MA_SAFE 1500 /* * Battery info for lalala battery types. Note that the fields @@ -165,13 +165,13 @@ int charger_profile_override(struct charge_state_data *curr) } enum ec_status charger_profile_override_get_param(uint32_t param, - uint32_t *value) + uint32_t *value) { return EC_RES_INVALID_PARAM; } enum ec_status charger_profile_override_set_param(uint32_t param, - uint32_t value) + uint32_t value) { return EC_RES_INVALID_PARAM; } diff --git a/board/cappy2/board.c b/board/cappy2/board.c index c6f560b503..de651ac874 100644 --- a/board/cappy2/board.c +++ b/board/cappy2/board.c @@ -1,11 +1,10 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /* cappy2 board-specific configuration */ - #include "adc_chip.h" #include "button.h" #include "cbi_fw_config.h" @@ -39,8 +38,8 @@ #include "usb_pd.h" #include "usb_pd_tcpm.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) #define INT_RECHECK_US 5000 @@ -80,7 +79,6 @@ static void usb_c0_interrupt(enum gpio_signal s) /* Check the line again in 5ms */ hook_call_deferred(&check_c0_line_data, INT_RECHECK_US); - } static void c0_ccsbu_ovp_interrupt(enum gpio_signal s) @@ -159,7 +157,6 @@ __override void board_power_5v_enable(int enable) */ gpio_set_level(GPIO_EN_PP5000, !!enable); gpio_set_level(GPIO_EN_USB_A0_VBUS, !!enable); - } int board_is_sourcing_vbus(int port) @@ -168,13 +165,11 @@ int board_is_sourcing_vbus(int port) tcpc_read(port, TCPC_REG_POWER_STATUS, ®val); return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS); - } int board_set_active_charge_port(int port) { - int is_real_port = (port >= 0 && - port < CONFIG_USB_PD_PORT_MAX_COUNT); + int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT); int i; int old_port; @@ -234,8 +229,8 @@ int board_set_active_charge_port(int 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) { int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT); @@ -289,12 +284,15 @@ 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_port = 0, - .i2c_port = I2C_PORT_USB_C0, - .i2c_addr_flags = PS8743_I2C_ADDR0_FLAG, - .driver = &ps8743_usb_mux_driver, + .mux = + &(const struct usb_mux){ + .usb_port = 0, + .i2c_port = I2C_PORT_USB_C0, + .i2c_addr_flags = PS8743_I2C_ADDR0_FLAG, + .driver = &ps8743_usb_mux_driver, + }, }, }; @@ -341,23 +339,22 @@ void board_init(void) /* modify AC DC prochot value */ isl923x_set_ac_prochot(CHARGER_SOLO, 4096); isl923x_set_dc_prochot(CHARGER_SOLO, 6000); - } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); /* Thermistors */ const struct temp_sensor_t temp_sensors[] = { - [TEMP_SENSOR_1] = {.name = "Memory", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_51k1_47k_4050b, - .idx = ADC_TEMP_SENSOR_1}, - [TEMP_SENSOR_2] = {.name = "Ambient", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_51k1_47k_4050b, - .idx = ADC_TEMP_SENSOR_2}, - [TEMP_SENSOR_3] = {.name = "Cpu", - .type = TEMP_SENSOR_TYPE_BOARD, - .read = get_temp_3v3_51k1_47k_4050b, - .idx = ADC_TEMP_SENSOR_3}, + [TEMP_SENSOR_1] = { .name = "Memory", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_51k1_47k_4050b, + .idx = ADC_TEMP_SENSOR_1 }, + [TEMP_SENSOR_2] = { .name = "Ambient", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_51k1_47k_4050b, + .idx = ADC_TEMP_SENSOR_2 }, + [TEMP_SENSOR_3] = { .name = "Cpu", + .type = TEMP_SENSOR_TYPE_BOARD, + .read = get_temp_3v3_51k1_47k_4050b, + .idx = ADC_TEMP_SENSOR_3 }, }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); diff --git a/board/cappy2/board.h b/board/cappy2/board.h index 5a2fa75bba..b21a20d6e5 100644 --- a/board/cappy2/board.h +++ b/board/cappy2/board.h @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -11,9 +11,9 @@ #define VARIANT_KEEBY_EC_NPCX797FC #include "baseboard.h" -#undef GPIO_VOLUME_UP_L -#undef GPIO_VOLUME_DOWN_L -#undef CONFIG_VOLUME_BUTTONS +#undef GPIO_VOLUME_UP_L +#undef GPIO_VOLUME_DOWN_L +#undef CONFIG_VOLUME_BUTTONS /* System unlocked in early development */ #define CONFIG_SYSTEM_UNLOCKED @@ -32,15 +32,16 @@ /* Charger */ #define CONFIG_CHARGER_RAA489000 +#define PD_MAX_VOLTAGE_MV 20000 #define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 #define CONFIG_CHARGER_SENSE_RESISTOR 10 #define CONFIG_CHARGER_SINGLE_CHIP #define CONFIG_CHARGER_PROFILE_OVERRIDE -#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE +#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE #define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC) /* Keyboard */ -#undef CONFIG_PWM_KBLIGHT +#undef CONFIG_PWM_KBLIGHT /* LED defines */ #define CONFIG_LED_COMMON @@ -50,7 +51,7 @@ #define GPIO_PWR_LED_BLUE_L GPIO_LED_B_ODL /* PWM */ -#define NPCX7_PWM1_SEL 0 /* GPIO C2 is used as PWM1. */ +#define NPCX7_PWM1_SEL 0 /* GPIO C2 is used as PWM1. */ /******************************************************************************/ @@ -81,11 +82,11 @@ #define GPIO_TEMP_SENSOR_POWER GPIO_EN_PP3300_A /* I2C configuration */ -#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0 -#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0 -#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0 -#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0 -#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 +#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0 +#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0 +#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0 +#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0 +#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 #define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */ @@ -95,11 +96,11 @@ #include "registers.h" enum adc_channel { - ADC_TEMP_SENSOR_1, /* ADC0 */ - ADC_TEMP_SENSOR_2, /* ADC1 */ - ADC_SUB_ANALOG, /* ADC2 */ - ADC_TEMP_SENSOR_3, /* ADC6 */ - ADC_VSNS_PP3300_A, /* ADC9 */ + ADC_TEMP_SENSOR_1, /* ADC0 */ + ADC_TEMP_SENSOR_2, /* ADC1 */ + ADC_SUB_ANALOG, /* ADC2 */ + ADC_TEMP_SENSOR_3, /* ADC6 */ + ADC_VSNS_PP3300_A, /* ADC9 */ ADC_CH_COUNT }; diff --git a/board/cappy2/build.mk b/board/cappy2/build.mk index b012d8d502..eb422dae93 100644 --- a/board/cappy2/build.mk +++ b/board/cappy2/build.mk @@ -1,5 +1,5 @@ # -*- makefile -*- -# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Copyright 2021 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/cappy2/cbi_ssfc.c b/board/cappy2/cbi_ssfc.c index c4b859f133..81f3ee0dad 100644 --- a/board/cappy2/cbi_ssfc.c +++ b/board/cappy2/cbi_ssfc.c @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST); enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void) { - return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor; + return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor; } enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void) { - return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor; + return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor; } diff --git a/board/cappy2/cbi_ssfc.h b/board/cappy2/cbi_ssfc.h index 935049b6ae..bf8853a43a 100644 --- a/board/cappy2/cbi_ssfc.h +++ b/board/cappy2/cbi_ssfc.h @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void); */ enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void); - #endif /* _DEDEDE_CBI_SSFC__H_ */ diff --git a/board/cappy2/ec.tasklist b/board/cappy2/ec.tasklist index 0025c2985b..386e8625b3 100644 --- a/board/cappy2/ec.tasklist +++ b/board/cappy2/ec.tasklist @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 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/cappy2/gpio.inc b/board/cappy2/gpio.inc index 00799bfdd8..1a32f31e06 100644 --- a/board/cappy2/gpio.inc +++ b/board/cappy2/gpio.inc @@ -1,6 +1,6 @@ /* -*- mode:c -*- * - * Copyright 2021 The Chromium OS Authors. All rights reserved. + * Copyright 2021 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/cappy2/led.c b/board/cappy2/led.c index fb6faae482..dba215ab51 100644 --- a/board/cappy2/led.c +++ b/board/cappy2/led.c @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * @@ -21,33 +21,36 @@ __override const int led_charge_lvl_2 = 100; /* cappy2 : There are 3 leds for AC, Battery and Power */ __override struct led_descriptor - led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = { - [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC}, - {LED_OFF, 1 * LED_ONE_SEC} }, - [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_RED, LED_INDEFINITE} }, - [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} }, - [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} }, - [STATE_DISCHARGE_S0_BAT_LOW] = {{LED_OFF, LED_INDEFINITE} }, - [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} }, - [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} }, - [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 0.5 * LED_ONE_SEC}, - {LED_OFF, 0.5 * LED_ONE_SEC} }, - [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC}, - {LED_OFF, 1 * LED_ONE_SEC} }, -}; + led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = { + [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED, + 1 * LED_ONE_SEC }, + { LED_OFF, 1 * LED_ONE_SEC } }, + [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_RED, + LED_INDEFINITE } }, + [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN, + LED_INDEFINITE } }, + [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE, + LED_INDEFINITE } }, + [STATE_DISCHARGE_S0_BAT_LOW] = { { LED_OFF, LED_INDEFINITE } }, + [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } }, + [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } }, + [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, + 0.5 * LED_ONE_SEC }, + { LED_OFF, 0.5 * LED_ONE_SEC } }, + [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC }, + { LED_OFF, 1 * LED_ONE_SEC } }, + }; __override const struct led_descriptor - led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = { - [PWR_LED_STATE_ON] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} }, - [PWR_LED_STATE_SUSPEND_AC] = {{LED_OFF, LED_INDEFINITE} }, - [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} }, - [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} }, -}; - -const enum ec_led_id supported_led_ids[] = { - EC_LED_ID_BATTERY_LED, - EC_LED_ID_POWER_LED -}; + led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = { + [PWR_LED_STATE_ON] = { { EC_LED_COLOR_BLUE, LED_INDEFINITE } }, + [PWR_LED_STATE_SUSPEND_AC] = { { LED_OFF, LED_INDEFINITE } }, + [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } }, + [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } }, + }; + +const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED, + EC_LED_ID_POWER_LED }; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); @@ -55,7 +58,7 @@ __override void led_set_color_power(enum ec_led_colors color) { /* Don't set led if led_auto_control is disabled. */ if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) || - !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) { + !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) { return; } @@ -73,7 +76,7 @@ __override void led_set_color_battery(enum ec_led_colors color) { /* Don't set led if led_auto_control is disabled. */ if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) || - !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) { + !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) { return; } @@ -117,12 +120,12 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) if (led_id == EC_LED_ID_BATTERY_LED) { gpio_set_level(GPIO_PWR_LED_BLUE_L, LED_OFF_LVL); gpio_set_level(GPIO_BAT_LED_GREEN_L, - !brightness[EC_LED_COLOR_GREEN]); + !brightness[EC_LED_COLOR_GREEN]); gpio_set_level(GPIO_BAT_LED_RED_L, - !brightness[EC_LED_COLOR_RED]); + !brightness[EC_LED_COLOR_RED]); } else if (led_id == EC_LED_ID_POWER_LED) { gpio_set_level(GPIO_PWR_LED_BLUE_L, - !brightness[EC_LED_COLOR_BLUE]); + !brightness[EC_LED_COLOR_BLUE]); gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL); gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL); } diff --git a/board/cappy2/usb_pd_policy.c b/board/cappy2/usb_pd_policy.c index fd9018a3f0..3410726e87 100644 --- a/board/cappy2/usb_pd_policy.c +++ b/board/cappy2/usb_pd_policy.c @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -10,8 +10,8 @@ #include "driver/tcpm/tcpci.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_check_vconn_swap(int port) { |