diff options
Diffstat (limited to 'board/dooly')
-rw-r--r-- | board/dooly/board.c | 274 | ||||
-rw-r--r-- | board/dooly/board.h | 135 | ||||
-rw-r--r-- | board/dooly/build.mk | 2 | ||||
-rw-r--r-- | board/dooly/ec.tasklist | 2 | ||||
-rw-r--r-- | board/dooly/gpio.inc | 6 | ||||
-rw-r--r-- | board/dooly/led.c | 14 | ||||
-rw-r--r-- | board/dooly/usb_pd_policy.c | 7 |
7 files changed, 201 insertions, 239 deletions
diff --git a/board/dooly/board.c b/board/dooly/board.c index 545ec86ebe..6e1f6ebbeb 100644 --- a/board/dooly/board.c +++ b/board/dooly/board.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. */ @@ -50,8 +50,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) /* Sensors */ static struct mutex g_accel_mutex; @@ -109,11 +109,9 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = { .saturation.atime = TCS_DEFAULT_ATIME, }; -const mat33_fp_t screen_standard_ref = { - { 0, FLOAT_TO_FP(1), 0}, - { FLOAT_TO_FP(1), 0, 0}, - { 0, 0, FLOAT_TO_FP(-1)} -}; +const mat33_fp_t screen_standard_ref = { { 0, FLOAT_TO_FP(1), 0 }, + { FLOAT_TO_FP(1), 0, 0 }, + { 0, 0, FLOAT_TO_FP(-1) } }; struct motion_sensor_t motion_sensors[] = { [SCREEN_ACCEL] = { @@ -190,15 +188,15 @@ DECLARE_DEFERRED(power_monitor); * that range, so we define and use a 64-bit fixed representation instead. */ typedef int64_t fp64_t; -#define INT_TO_FP64(x) ((int64_t)(x) << 32) -#define FP64_TO_INT(x) ((x) >> 32) +#define INT_TO_FP64(x) ((int64_t)(x) << 32) +#define FP64_TO_INT(x) ((x) >> 32) #define FLOAT_TO_FP64(x) ((int64_t)((x) * (float)(1LL << 32))) __override void tcs3400_translate_to_xyz(struct motion_sensor_t *s, int32_t *crgb_data, int32_t *xyz_data) { struct tcs_saturation_t *sat_p = - &(TCS3400_RGB_DRV_DATA(s+1)->saturation); + &(TCS3400_RGB_DRV_DATA(s + 1)->saturation); int32_t cur_gain = (1 << (2 * sat_p->again)); int32_t integration_time_us = @@ -208,40 +206,37 @@ __override void tcs3400_translate_to_xyz(struct motion_sensor_t *s, fp64_t result; /* Use different coefficients based on n_interval = (G+B)/C */ - fp64_t gb_sum = INT_TO_FP64(crgb_data[2]) + - INT_TO_FP64(crgb_data[3]); + fp64_t gb_sum = INT_TO_FP64(crgb_data[2]) + INT_TO_FP64(crgb_data[3]); fp64_t n_interval = gb_sum / MAX(crgb_data[0], 1); if (n_interval < FLOAT_TO_FP64(0.692)) { const float scale = 799.797; - c_coeff = FLOAT_TO_FP64(0.009 * scale); - r_coeff = FLOAT_TO_FP64(0.056 * scale); - g_coeff = FLOAT_TO_FP64(2.735 * scale); + c_coeff = FLOAT_TO_FP64(0.009 * scale); + r_coeff = FLOAT_TO_FP64(0.056 * scale); + g_coeff = FLOAT_TO_FP64(2.735 * scale); b_coeff = FLOAT_TO_FP64(-1.903 * scale); } else if (n_interval < FLOAT_TO_FP64(1.012)) { const float scale = 801.347; - c_coeff = FLOAT_TO_FP64(0.202 * scale); - r_coeff = FLOAT_TO_FP64(-1.1 * scale); - g_coeff = FLOAT_TO_FP64(8.692 * scale); + c_coeff = FLOAT_TO_FP64(0.202 * scale); + r_coeff = FLOAT_TO_FP64(-1.1 * scale); + g_coeff = FLOAT_TO_FP64(8.692 * scale); b_coeff = FLOAT_TO_FP64(-7.068 * scale); } else { const float scale = 795.574; c_coeff = FLOAT_TO_FP64(-0.661 * scale); - r_coeff = FLOAT_TO_FP64(1.334 * scale); - g_coeff = FLOAT_TO_FP64(1.095 * scale); + r_coeff = FLOAT_TO_FP64(1.334 * scale); + g_coeff = FLOAT_TO_FP64(1.095 * scale); b_coeff = FLOAT_TO_FP64(-1.821 * scale); } /* Multiply each channel by the coefficient and compute the sum. * Note: int * fp64_t = fp64_t and fp64_t + fp64_t = fp64_t. */ - result = crgb_data[0] * c_coeff + - crgb_data[1] * r_coeff + - crgb_data[2] * g_coeff + - crgb_data[3] * b_coeff; + result = crgb_data[0] * c_coeff + crgb_data[1] * r_coeff + + crgb_data[2] * g_coeff + crgb_data[3] * b_coeff; /* Adjust for exposure time and sensor gain. * Note: fp64_t / int = fp64_t. @@ -328,8 +323,8 @@ uint16_t tcpc_get_alert_status(void) } /* Called when the charge manager has switched to a new port. */ -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) { /* Blink alert if insufficient power per system_can_boot_ap(). */ int insufficient_power = @@ -346,12 +341,12 @@ static int32_t base_5v_power; * Power usage for each port as measured or estimated. * Units are milliwatts (5v x ma current) */ -#define PWR_BASE_LOAD (5*1335) -#define PWR_FRONT_HIGH (5*1603) -#define PWR_FRONT_LOW (5*963) -#define PWR_C_HIGH (5*3740) -#define PWR_C_LOW (5*2090) -#define PWR_MAX (5*10000) +#define PWR_BASE_LOAD (5 * 1335) +#define PWR_FRONT_HIGH (5 * 1603) +#define PWR_FRONT_LOW (5 * 963) +#define PWR_C_HIGH (5 * 3740) +#define PWR_C_LOW (5 * 2090) +#define PWR_MAX (5 * 10000) /* * Update the 5V power usage, assuming no throttling, @@ -416,16 +411,14 @@ static const struct { int current; } bj_power[] = { { /* 0 - 65W (also default) */ - .voltage = 19500, - .current = 3200 - }, + .voltage = 19500, + .current = 3200 }, { /* 1 - 90W */ - .voltage = 19500, - .current = 4600 - }, + .voltage = 19500, + .current = 4600 }, }; -#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */ +#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */ /* Debounced connection state of the barrel jack */ static int8_t adp_connected = -1; static void adp_connect_deferred(void) @@ -470,29 +463,26 @@ static void adp_state_init(void) } DECLARE_HOOK(HOOK_INIT, adp_state_init, HOOK_PRIO_INIT_CHARGE_MANAGER + 1); - #include "gpio_list.h" /* Must come after other header files. */ /******************************************************************************/ /* 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_FAN] = { .channel = 5, - .flags = PWM_CONFIG_OPEN_DRAIN, - .freq = 25000}, - [PWM_CH_LED_RED] = { .channel = 0, - .flags = PWM_CONFIG_ACTIVE_LOW | - PWM_CONFIG_DSLEEP, - .freq = 2000 }, - [PWM_CH_LED_WHITE] = { .channel = 2, - .flags = PWM_CONFIG_ACTIVE_LOW | - PWM_CONFIG_DSLEEP, - .freq = 2000 }, + [PWM_CH_FAN] = { .channel = 5, + .flags = PWM_CONFIG_OPEN_DRAIN, + .freq = 25000 }, + [PWM_CH_LED_RED] = { .channel = 0, + .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, + .freq = 2000 }, + [PWM_CH_LED_WHITE] = { .channel = 2, + .flags = PWM_CONFIG_ACTIVE_LOW | + PWM_CONFIG_DSLEEP, + .freq = 2000 }, }; /******************************************************************************/ @@ -517,71 +507,61 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { .flags = TCPC_FLAGS_RESET_ACTIVE_HIGH, }, }; -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 = &anx7447_usb_mux_driver, - .hpd_update = &anx7447_tcpc_update_hpd_status, + .mux = &(const struct usb_mux) { + .usb_port = USB_PD_PORT_TCPC_0, + .driver = &anx7447_usb_mux_driver, + .hpd_update = &anx7447_tcpc_update_hpd_status, + }, }, [USB_PD_PORT_TCPC_1] = { - .usb_port = USB_PD_PORT_TCPC_1, - .driver = &anx7447_usb_mux_driver, - .hpd_update = &anx7447_tcpc_update_hpd_status, + .mux = &(const struct usb_mux) { + .usb_port = USB_PD_PORT_TCPC_1, + .driver = &anx7447_usb_mux_driver, + .hpd_update = &anx7447_tcpc_update_hpd_status, + }, }, }; /******************************************************************************/ /* I2C port map configuration */ const struct i2c_port_t i2c_ports[] = { - { - .name = "ina", - .port = I2C_PORT_INA, - .kbps = 400, - .scl = GPIO_I2C0_SCL, - .sda = GPIO_I2C0_SDA - }, - { - .name = "ppc0", - .port = I2C_PORT_PPC0, - .kbps = 400, - .scl = GPIO_I2C1_SCL, - .sda = GPIO_I2C1_SDA - }, - { - .name = "ppc1", - .port = I2C_PORT_PPC1, - .kbps = 400, - .scl = GPIO_I2C2_SCL, - .sda = GPIO_I2C2_SDA - }, - { - .name = "tcpc0", - .port = I2C_PORT_TCPC0, - .kbps = 400, - .scl = GPIO_I2C3_SCL, - .sda = GPIO_I2C3_SDA - }, - { - .name = "tcpc1", - .port = I2C_PORT_TCPC1, - .kbps = 400, - .scl = GPIO_I2C4_SCL, - .sda = GPIO_I2C4_SDA - }, - { - .name = "power", - .port = I2C_PORT_POWER, - .kbps = 400, - .scl = GPIO_I2C5_SCL, - .sda = GPIO_I2C5_SDA - }, - { - .name = "eeprom", - .port = I2C_PORT_EEPROM, - .kbps = 400, - .scl = GPIO_I2C7_SCL, - .sda = GPIO_I2C7_SDA - }, + { .name = "ina", + .port = I2C_PORT_INA, + .kbps = 400, + .scl = GPIO_I2C0_SCL, + .sda = GPIO_I2C0_SDA }, + { .name = "ppc0", + .port = I2C_PORT_PPC0, + .kbps = 400, + .scl = GPIO_I2C1_SCL, + .sda = GPIO_I2C1_SDA }, + { .name = "ppc1", + .port = I2C_PORT_PPC1, + .kbps = 400, + .scl = GPIO_I2C2_SCL, + .sda = GPIO_I2C2_SDA }, + { .name = "tcpc0", + .port = I2C_PORT_TCPC0, + .kbps = 400, + .scl = GPIO_I2C3_SCL, + .sda = GPIO_I2C3_SDA }, + { .name = "tcpc1", + .port = I2C_PORT_TCPC1, + .kbps = 400, + .scl = GPIO_I2C4_SCL, + .sda = GPIO_I2C4_SDA }, + { .name = "power", + .port = I2C_PORT_POWER, + .kbps = 400, + .scl = GPIO_I2C5_SCL, + .sda = GPIO_I2C5_SDA }, + { .name = "eeprom", + .port = I2C_PORT_EEPROM, + .kbps = 400, + .scl = GPIO_I2C7_SCL, + .sda = GPIO_I2C7_SDA }, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); @@ -637,15 +617,14 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); /******************************************************************************/ /* Wake up pins */ -const enum gpio_signal hibernate_wake_pins[] = { -}; +const enum gpio_signal hibernate_wake_pins[] = {}; const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); /******************************************************************************/ /* Physical fans. These are logically separate from pwm_channels. */ 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 = -1, }; @@ -664,7 +643,7 @@ BUILD_ASSERT(ARRAY_SIZE(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_2, TCKC_LFCLK, PWM_CH_FAN}, + [MFT_CH_0] = { NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN }, }; BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); @@ -673,8 +652,8 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); /* * 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), \ @@ -727,7 +706,7 @@ static void cbi_init(void) if (cbi_get_ssfc(&val) == EC_SUCCESS) ssfc = val; CPRINTS("Board Version: %d, SKU ID: 0x%08x, " - "F/W config: 0x%08x, SSFC: 0x%08x ", + "F/W config: 0x%08x, SSFC: 0x%08x ", board_version, sku_id, fw_config, ssfc); } DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1); @@ -793,29 +772,23 @@ static void board_chipset_startup(void) /* set high to enable EDID ROM WP */ gpio_set_level(GPIO_EC_EDID_WP_DISABLE_L, 1); } -DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, - HOOK_PRIO_DEFAULT); +DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT); static void board_chipset_shutdown(void) { /* set low to prevent power leakage */ gpio_set_level(GPIO_EC_EDID_WP_DISABLE_L, 0); } -DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, - HOOK_PRIO_DEFAULT); +DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT); /******************************************************************************/ /* USB-C PPC Configuration */ struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = { - [USB_PD_PORT_TCPC_0] = { - .i2c_port = I2C_PORT_PPC0, - .i2c_addr_flags = SN5S330_ADDR0_FLAGS, - .drv = &sn5s330_drv - }, - [USB_PD_PORT_TCPC_1] = { - .i2c_port = I2C_PORT_PPC1, - .i2c_addr_flags = SN5S330_ADDR0_FLAGS, - .drv = &sn5s330_drv - }, + [USB_PD_PORT_TCPC_0] = { .i2c_port = I2C_PORT_PPC0, + .i2c_addr_flags = SN5S330_ADDR0_FLAGS, + .drv = &sn5s330_drv }, + [USB_PD_PORT_TCPC_1] = { .i2c_port = I2C_PORT_PPC1, + .i2c_addr_flags = SN5S330_ADDR0_FLAGS, + .drv = &sn5s330_drv }, }; unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); @@ -842,7 +815,6 @@ static void board_tcpc_init(void) /* Enable other overcurrent interrupts */ gpio_enable_interrupt(GPIO_USB_A0_OC_ODL); gpio_enable_interrupt(GPIO_USB_A1_OC_ODL); - } /* Make sure this is called after fw_config is initialised */ DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 2); @@ -965,8 +937,8 @@ void board_enable_s0_rails(int enable) unsigned int ec_config_get_bj_power(void) { - unsigned int bj = - (fw_config & EC_CFG_BJ_POWER_MASK) >> EC_CFG_BJ_POWER_L; + unsigned int bj = (fw_config & EC_CFG_BJ_POWER_MASK) >> + EC_CFG_BJ_POWER_L; /* Out of range value defaults to 0 */ if (bj >= ARRAY_SIZE(bj_power)) bj = 0; @@ -1021,28 +993,28 @@ unsigned int ec_ssfc_get_led_ic(void) * * All measurements are in milliwatts. */ -#define THROT_TYPE_A BIT(0) -#define THROT_TYPE_C BIT(1) -#define THROT_PROCHOT BIT(2) +#define THROT_TYPE_A BIT(0) +#define THROT_TYPE_C BIT(1) +#define THROT_PROCHOT BIT(2) /* * Power gain if front USB A ports are limited. */ -#define POWER_GAIN_TYPE_A 3200 +#define POWER_GAIN_TYPE_A 3200 /* * Power gain if Type C port is limited. */ -#define POWER_GAIN_TYPE_C 8800 +#define POWER_GAIN_TYPE_C 8800 /* * Power is averaged over 10 ms, with a reading every 2 ms. */ -#define POWER_DELAY_MS 2 -#define POWER_READINGS (10/POWER_DELAY_MS) +#define POWER_DELAY_MS 2 +#define POWER_READINGS (10 / POWER_DELAY_MS) /* PROCHOT_DEFER_OFF is to extend CPU prochot long enough * to pass safety requirement 30 * 2ms = 60 ms */ -#define PROCHOT_DEFER_OFF 30 +#define PROCHOT_DEFER_OFF 30 static void power_monitor(void) { @@ -1058,8 +1030,7 @@ static void power_monitor(void) * If CPU is off or suspended, no need to throttle * or restrict power. */ - if (chipset_in_state(CHIPSET_STATE_ANY_OFF | - CHIPSET_STATE_SUSPEND)) { + if (chipset_in_state(CHIPSET_STATE_ANY_OFF | CHIPSET_STATE_SUSPEND)) { /* * Slow down monitoring, assume no throttling required. */ @@ -1087,7 +1058,7 @@ static void power_monitor(void) */ power = (adc_read_channel(ADC_VBUS) * adc_read_channel(ADC_PPVAR_IMON)) / - 1000; + 1000; /* Init power table */ if (history[0] == 0) { for (i = 0; i < POWER_READINGS; i++) @@ -1114,8 +1085,7 @@ static void power_monitor(void) * For barrel-jack supplies, the rating can be * exceeded briefly, so use the average. */ - if (charge_manager_get_supplier() == - CHARGE_SUPPLIER_PD) + if (charge_manager_get_supplier() == CHARGE_SUPPLIER_PD) power = max; else power = total / POWER_READINGS; @@ -1184,8 +1154,8 @@ static void power_monitor(void) * Check whether type C is not throttled, * and is not overcurrent. */ - if (!((new_state & THROT_TYPE_C) || - usbc_0_overcurrent || usbc_1_overcurrent)) { + if (!((new_state & THROT_TYPE_C) || usbc_0_overcurrent || + usbc_1_overcurrent)) { /* * [1] Type C not in overcurrent, throttle it. */ @@ -1218,8 +1188,9 @@ static void power_monitor(void) gpio_set_level(GPIO_EC_PROCHOT_ODL, prochot); } if (diff & THROT_TYPE_C) { - enum tcpc_rp_value rp = (new_state & THROT_TYPE_C) - ? TYPEC_RP_1A5 : TYPEC_RP_3A0; + enum tcpc_rp_value rp = (new_state & THROT_TYPE_C) ? + TYPEC_RP_1A5 : + TYPEC_RP_3A0; ppc_set_vbus_source_current_limit(0, rp); tcpm_select_rp_value(0, rp); @@ -1302,5 +1273,4 @@ void board_backlight_enable_interrupt(enum gpio_signal signal) oz554_interrupt(signal); break; } - } diff --git a/board/dooly/board.h b/board/dooly/board.h index 884117bbbc..cb9d12f4ff 100644 --- a/board/dooly/board.h +++ b/board/dooly/board.h @@ -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. */ @@ -15,13 +15,13 @@ * By default, enable all console messages except HC, ACPI and event: * The sensor stack is generating a lot of activity. */ -#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC))) +#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC))) #undef CONFIG_HOSTCMD_DEBUG_MODE #define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF /* NPCX7 config */ -#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */ -#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */ +#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */ +#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */ /* Internal SPI flash on NPCX796FC is 512 kB */ #define CONFIG_FLASH_SIZE_BYTES (512 * 1024) @@ -49,14 +49,13 @@ /* TCS3400 ALS */ #define CONFIG_ALS -#define ALS_COUNT 1 +#define ALS_COUNT 1 #define CONFIG_ALS_TCS3400 -#define CONFIG_ALS_TCS3400_INT_EVENT\ +#define CONFIG_ALS_TCS3400_INT_EVENT \ TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS) /* Sensors without hardware FIFO are in forced mode */ -#define CONFIG_ACCEL_FORCE_MODE_MASK \ - (BIT(SCREEN_ACCEL) | BIT(CLEAR_ALS)) +#define CONFIG_ACCEL_FORCE_MODE_MASK (BIT(SCREEN_ACCEL) | BIT(CLEAR_ALS)) /* EC Defines */ #define CONFIG_ADC @@ -74,7 +73,7 @@ #undef CONFIG_HIBERNATE #define CONFIG_HOST_INTERFACE_ESPI #define CONFIG_LED_COMMON -#undef CONFIG_LID_SWITCH +#undef CONFIG_LID_SWITCH #define CONFIG_LTO #define CONFIG_PWM #define CONFIG_VBOOT_EFS2 @@ -83,7 +82,6 @@ #define CONFIG_VSTORE_SLOT_COUNT 1 #define CONFIG_SHA256 - /* EC Commands */ #define CONFIG_CMD_BUTTON /* Include CLI command needed to support CCD testing. */ @@ -120,7 +118,7 @@ #define CONFIG_CPU_PROCHOT_ACTIVE_LOW /* Dedicated barreljack charger port */ -#undef CONFIG_DEDICATED_CHARGE_PORT_COUNT +#undef CONFIG_DEDICATED_CHARGE_PORT_COUNT #define CONFIG_DEDICATED_CHARGE_PORT_COUNT 1 #define DEDICATED_CHARGE_PORT 2 @@ -141,15 +139,15 @@ #define CONFIG_INA3221 /* b/143501304 */ -#define PD_POWER_SUPPLY_TURN_ON_DELAY 4000 /* us */ -#define PD_POWER_SUPPLY_TURN_OFF_DELAY 2000 /* us */ +#define PD_POWER_SUPPLY_TURN_ON_DELAY 4000 /* us */ +#define PD_POWER_SUPPLY_TURN_OFF_DELAY 2000 /* us */ #undef CONFIG_USBC_VCONN_SWAP_DELAY_US -#define CONFIG_USBC_VCONN_SWAP_DELAY_US 8000 /* us */ +#define CONFIG_USBC_VCONN_SWAP_DELAY_US 8000 /* us */ -#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON -#define PD_MAX_POWER_MW 100000 -#define PD_MAX_CURRENT_MA 5000 -#define PD_MAX_VOLTAGE_MV 20000 +#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON +#define PD_MAX_POWER_MW 100000 +#define PD_MAX_CURRENT_MA 5000 +#define PD_MAX_VOLTAGE_MV 20000 /* Fan and temp. */ #define CONFIG_FANS 1 @@ -173,7 +171,7 @@ #define CONFIG_USB_PD_DECODE_SOP #undef CONFIG_USB_CHARGER #define CONFIG_USB_POWER_DELIVERY -#define CONFIG_USB_PID 0x5040 +#define CONFIG_USB_PID 0x5040 #define CONFIG_USB_PD_ALT_MODE #define CONFIG_USB_PD_ALT_MODE_DFP #define CONFIG_USB_PD_DISCHARGE_PPC @@ -193,10 +191,10 @@ #define CONFIG_USBC_VCONN #define CONFIG_USBC_VCONN_SWAP -#define USB_PD_PORT_TCPC_0 0 +#define USB_PD_PORT_TCPC_0 0 #define BOARD_TCPC_C0_RESET_HOLD_DELAY ANX74XX_RESET_HOLD_MS #define BOARD_TCPC_C0_RESET_POST_DELAY ANX74XX_RESET_HOLD_MS -#define USB_PD_PORT_TCPC_1 1 +#define USB_PD_PORT_TCPC_1 1 #define BOARD_TCPC_C1_RESET_HOLD_DELAY ANX74XX_RESET_HOLD_MS #define BOARD_TCPC_C1_RESET_POST_DELAY ANX74XX_RESET_HOLD_MS @@ -208,16 +206,16 @@ /* I2C Bus Configuration */ #define CONFIG_I2C #define CONFIG_I2C_CONTROLLER -#define I2C_PORT_INA NPCX_I2C_PORT0_0 -#define I2C_PORT_SENSORS NPCX_I2C_PORT0_0 -#define I2C_PORT_PPC0 NPCX_I2C_PORT1_0 -#define I2C_PORT_PPC1 NPCX_I2C_PORT2_0 -#define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0 -#define I2C_PORT_TCPC1 NPCX_I2C_PORT4_1 -#define I2C_PORT_POWER NPCX_I2C_PORT5_0 -#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0 -#define I2C_ADDR_EEPROM_FLAGS 0x50 -#define I2C_PORT_BACKLIGHT NPCX_I2C_PORT7_0 +#define I2C_PORT_INA NPCX_I2C_PORT0_0 +#define I2C_PORT_SENSORS NPCX_I2C_PORT0_0 +#define I2C_PORT_PPC0 NPCX_I2C_PORT1_0 +#define I2C_PORT_PPC1 NPCX_I2C_PORT2_0 +#define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0 +#define I2C_PORT_TCPC1 NPCX_I2C_PORT4_1 +#define I2C_PORT_POWER NPCX_I2C_PORT5_0 +#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0 +#define I2C_ADDR_EEPROM_FLAGS 0x50 +#define I2C_PORT_BACKLIGHT NPCX_I2C_PORT7_0 /* * LED backlight controller @@ -239,11 +237,11 @@ enum charge_port { }; enum adc_channel { - ADC_SNS_PP3300, /* ADC2 */ - ADC_SNS_PP1050, /* ADC7 */ - ADC_VBUS, /* ADC4 */ - ADC_PPVAR_IMON, /* ADC9 */ - ADC_TEMP_SENSOR_1, /* ADC0 */ + ADC_SNS_PP3300, /* ADC2 */ + ADC_SNS_PP1050, /* ADC7 */ + ADC_VBUS, /* ADC4 */ + ADC_PPVAR_IMON, /* ADC9 */ + ADC_TEMP_SENSOR_1, /* ADC0 */ /* Number of ADC channels */ ADC_CH_COUNT }; @@ -268,10 +266,7 @@ enum mft_channel { MFT_CH_COUNT, }; -enum temp_sensor_id { - TEMP_SENSOR_1, - TEMP_SENSOR_COUNT -}; +enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_COUNT }; enum sensor_id { SCREEN_ACCEL = 0, @@ -286,7 +281,6 @@ enum ssfc_led_id { SSFC_LED_COUNT, }; - /* Board specific handlers */ void board_reset_pd_mcu(void); void board_set_tcpc_power_mode(int port, int mode); @@ -299,20 +293,20 @@ void show_critical_error(void); /* * Barrel-jack power (4 bits). */ -#define EC_CFG_BJ_POWER_L 0 -#define EC_CFG_BJ_POWER_H 3 +#define EC_CFG_BJ_POWER_L 0 +#define EC_CFG_BJ_POWER_H 3 #define EC_CFG_BJ_POWER_MASK GENMASK(EC_CFG_BJ_POWER_H, EC_CFG_BJ_POWER_L) /* * USB Connector 4 not present (1 bit) (not used). */ -#define EC_CFG_NO_USB4_L 4 -#define EC_CFG_NO_USB4_H 4 +#define EC_CFG_NO_USB4_L 4 +#define EC_CFG_NO_USB4_H 4 #define EC_CFG_NO_USB4_MASK GENMASK(EC_CFG_NO_USB4_H, EC_CFG_NO_USB4_L) /* * Thermal solution config (3 bits). */ -#define EC_CFG_THERMAL_L 5 -#define EC_CFG_THERMAL_H 7 +#define EC_CFG_THERMAL_L 5 +#define EC_CFG_THERMAL_H 7 #define EC_CFG_THERMAL_MASK GENMASK(EC_CFG_THERMAL_H, EC_CFG_THERMAL_L) /* @@ -321,11 +315,10 @@ void show_critical_error(void); /* * Led driver IC (2 bits). */ -#define EC_SSFC_LED_L 0 -#define EC_SSFC_LED_H 1 +#define EC_SSFC_LED_L 0 +#define EC_SSFC_LED_H 1 #define EC_SSFC_LED_MASK GENMASK(EC_SSFC_LED_H, EC_SSFC_LED_L) - unsigned int ec_config_get_bj_power(void); unsigned int ec_config_get_thermal_solution(void); unsigned int ec_ssfc_get_led_ic(void); @@ -335,31 +328,31 @@ void board_backlight_enable_interrupt(enum gpio_signal signal); #endif /* !__ASSEMBLER__ */ /* Pin renaming */ -#define GPIO_WP_L GPIO_EC_WP_ODL -#define GPIO_PP5000_A_PG_OD GPIO_PG_PP5000_A_OD -#define GPIO_EN_PP5000 GPIO_EN_PP5000_A -#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL -#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL -#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL -#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL -#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL -#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL -#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW -#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL -#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L -#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL -#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST -#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK -#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L -#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_ROA_RAILS -#define GPIO_AC_PRESENT GPIO_BJ_ADP_PRESENT_L +#define GPIO_WP_L GPIO_EC_WP_ODL +#define GPIO_PP5000_A_PG_OD GPIO_PG_PP5000_A_OD +#define GPIO_EN_PP5000 GPIO_EN_PP5000_A +#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL +#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL +#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL +#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL +#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL +#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL +#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW +#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL +#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L +#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL +#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST +#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK +#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L +#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_ROA_RAILS +#define GPIO_AC_PRESENT GPIO_BJ_ADP_PRESENT_L /* * There is no RSMRST input, so alias it to the output. This short-circuits * common_intel_x86_handle_rsmrst. */ -#define GPIO_PG_EC_RSMRST_ODL GPIO_PCH_RSMRST_L +#define GPIO_PG_EC_RSMRST_ODL GPIO_PCH_RSMRST_L #endif /* __CROS_EC_BOARD_H */ diff --git a/board/dooly/build.mk b/board/dooly/build.mk index 0f55c45f77..f9096c64ff 100644 --- a/board/dooly/build.mk +++ b/board/dooly/build.mk @@ -1,5 +1,5 @@ # -*- makefile -*- -# 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. # diff --git a/board/dooly/ec.tasklist b/board/dooly/ec.tasklist index 72b81be8d8..cf509f86a2 100644 --- a/board/dooly/ec.tasklist +++ b/board/dooly/ec.tasklist @@ -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. */ diff --git a/board/dooly/gpio.inc b/board/dooly/gpio.inc index 65488936b7..d92dedd145 100644 --- a/board/dooly/gpio.inc +++ b/board/dooly/gpio.inc @@ -1,6 +1,6 @@ /* -*- mode:c -*- * - * 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. */ @@ -25,12 +25,12 @@ GPIO_INT(PG_VPRIM_CORE_A_OD, PIN(2, 3), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(PG_PP1050_A_OD, PIN(2, 2), GPIO_INT_BOTH, power_signal_interrupt) /* EC output, but also interrupt so this can be polled as a power signal */ GPIO_INT(EC_PCH_RSMRST_L, PIN(A, 6), GPIO_OUTPUT | GPIO_INT_F_RISING | GPIO_INT_F_FALLING, power_signal_interrupt) -#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_PP2500_DRAM_U_OD, PIN(2, 0), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(PG_PP1200_U_OD, PIN(2, 1), 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, slp_s3_interrupt) #endif GPIO_INT(PG_PP950_VCCIO_OD, PIN(1, 7), GPIO_INT_BOTH, power_signal_interrupt) diff --git a/board/dooly/led.c b/board/dooly/led.c index fefa8908fe..224db77dc0 100644 --- a/board/dooly/led.c +++ b/board/dooly/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. * @@ -19,16 +19,16 @@ #include "timer.h" #include "util.h" -#define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args) +#define CPRINTS(format, args...) cprints(CC_GPIO, format, ##args) /* * Due to the CSME-Lite processing, upon startup the CPU transitions through * S0->S3->S5->S3->S0, causing the LED to turn on/off/on, so * delay turning off the LED during suspend/shutdown. */ -#define LED_CPU_DELAY_MS (2000 * MSEC) +#define LED_CPU_DELAY_MS (2000 * MSEC) -const enum ec_led_id supported_led_ids[] = {EC_LED_ID_POWER_LED}; +const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED }; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); enum led_color { @@ -88,9 +88,9 @@ static int set_color(enum ec_led_id id, enum led_color color, int duty) } } -#define LED_PULSE_US (2 * SECOND) +#define LED_PULSE_US (2 * SECOND) /* 40 msec for nice and smooth transition. */ -#define LED_PULSE_TICK_US (40 * MSEC) +#define LED_PULSE_TICK_US (40 * MSEC) /* When pulsing is enabled, brightness is incremented by <duty_inc> every * <interval> usec from 0 to 100% in LED_PULSE_US usec. Then it's decremented @@ -213,7 +213,7 @@ void show_critical_error(void) set_color(EC_LED_ID_POWER_LED, LED_RED, 100); } -static int command_led(int argc, char **argv) +static int command_led(int argc, const char **argv) { enum ec_led_id id = EC_LED_ID_POWER_LED; diff --git a/board/dooly/usb_pd_policy.c b/board/dooly/usb_pd_policy.c index a8d89130c2..71396e8797 100644 --- a/board/dooly/usb_pd_policy.c +++ b/board/dooly/usb_pd_policy.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. */ @@ -19,9 +19,8 @@ #include "usbc_ppc.h" #include "util.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) { |