From 7bff3d8b41741d91bdd8013b80d211fcdf738074 Mon Sep 17 00:00:00 2001 From: Daisuke Nojiri Date: Wed, 24 Oct 2018 08:51:11 -0700 Subject: Kalista: Update baseboard directory This patch updates Kalista as follows: - Update BJ adapter list and current limit handling - Remove unused code (mostly for Proto Fizz) - Remove unused fan configurations - Change CBI field sizes (board version:1, OEM:1, SKU:4) - Update I2C port map: charger -> backlight - Simplify board_set_active_charge_port This patch updates GPIO list as follows: - Use GPIO34 for current limit control (and remove 33 and 34) - Remove ADP_IN_L (Power source is only BJ) - Remove AC_JACK_CHARGE (Power source is only BJ) Signed-off-by: Daisuke Nojiri BUG=b:111571989 BRANCH=none TEST=build karma Change-Id: I2af208df28d6e7b3472eeb8929d055b93b661af8 Reviewed-on: https://chromium-review.googlesource.com/1298318 Commit-Ready: Daisuke Nojiri Tested-by: Daisuke Nojiri Reviewed-by: Zhuohao Lee --- baseboard/kalista/baseboard.c | 367 +++++++------------------------------- baseboard/kalista/baseboard.h | 15 +- baseboard/kalista/usb_pd_policy.c | 34 ---- board/karma/gpio.inc | 12 +- 4 files changed, 68 insertions(+), 360 deletions(-) diff --git a/baseboard/kalista/baseboard.c b/baseboard/kalista/baseboard.c index 3febf8f801..d3c61c9f61 100644 --- a/baseboard/kalista/baseboard.c +++ b/baseboard/kalista/baseboard.c @@ -7,7 +7,7 @@ #include "adc.h" #include "adc_chip.h" -#include "als.h" +#include "baseboard.h" #include "battery.h" #include "bd99992gw.h" #include "board_config.h" @@ -54,68 +54,44 @@ #define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) #define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args) -static uint16_t board_version; -static uint8_t oem; -static uint8_t sku; +static uint8_t board_version; +static uint32_t oem; +static uint32_t sku; + +enum bj_adapter { + BJ_90W_19V, + BJ_135W_19V, +}; + +/* + * Bit masks to map SKU ID to BJ adapter wattage. 1:135W 0:90W + * KBL-R i7 8550U 4 135 + * KBL-R i5 8250U 5 135 + * KBL-R i3 8130U 6 135 + * KBL-U i7 7600 3 135 + * KBL-U i5 7500 2 135 + * KBL-U i3 7100 1 90 + * KBL-U Celeron 3965 7 90 + * KBL-U Celeron 3865 0 90 + */ +#define BJ_ADAPTER_135W_MASK (1 << 4 | 1 << 5 | 1 << 6 | 1 << 3 | 1 << 2) + +/* BJ adapter specs */ +static const struct charge_port_info bj_adapters[] = { + [BJ_90W_19V] = { .current = 4740, .voltage = 19000 }, + [BJ_135W_19V] = { .current = 7100, .voltage = 19000 }, +}; static void tcpc_alert_event(enum gpio_signal signal) { if (!gpio_get_level(GPIO_USB_C0_PD_RST_ODL)) return; - #ifdef HAS_TASK_PDCMD /* Exchange status with TCPCs */ host_command_pd_send_status(PD_CHARGE_NO_CHANGE); #endif } -#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */ -/* - * ADP_IN pin state. It's initialized to 1 (=unplugged) because the IRQ won't - * be triggered if BJ is the power source. - */ -static int adp_in_state = 1; - -static void adp_in_deferred(void); -DECLARE_DEFERRED(adp_in_deferred); -static void adp_in_deferred(void) -{ - struct charge_port_info pi = { 0 }; - int level = gpio_get_level(GPIO_ADP_IN_L); - - /* Debounce */ - if (level == adp_in_state) - return; - if (!level) { - /* BJ is inserted but the voltage isn't effective because PU3 - * is still disabled. */ - pi.voltage = 19500; - if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) - /* - * It doesn't matter what we set here because we'll - * brown out anyway when charge_manager switches - * input. - */ - pi.current = 3330; - } - charge_manager_update_charge(CHARGE_SUPPLIER_DEDICATED, - DEDICATED_CHARGE_PORT, &pi); - /* - * Explicitly notifies the host that BJ is plugged or unplugged - * (when running on a type-c adapter). - */ - pd_send_host_event(PD_EVENT_POWER_CHANGE); - adp_in_state = level; -} - -/* IRQ for BJ plug/unplug. It shouldn't be called if BJ is the power source. */ -void adp_in(enum gpio_signal signal) -{ - if (adp_in_state == gpio_get_level(GPIO_ADP_IN_L)) - return; - hook_call_deferred(&adp_in_deferred_data, ADP_DEBOUNCE_MS * MSEC); -} - void vbus0_evt(enum gpio_signal signal) { task_wake(TASK_ID_PD_C0); @@ -126,13 +102,8 @@ void vbus0_evt(enum gpio_signal signal) /* power signal list. Must match order of enum power_signal. */ const struct power_signal_info power_signal_list[] = { {GPIO_PCH_SLP_S0_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S0_DEASSERTED"}, -#ifdef CONFIG_HOSTCMD_ESPI_VW_SLP_SIGNALS {VW_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"}, {VW_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4_DEASSERTED"}, -#else - {GPIO_PCH_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"}, - {GPIO_PCH_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4_DEASSERTED"}, -#endif {GPIO_PCH_SLP_SUS_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_SUS_DEASSERTED"}, {GPIO_RSMRST_L_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "RSMRST_L_PGOOD"}, {GPIO_PMIC_DPWROK, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_DPWROK"}, @@ -152,8 +123,7 @@ const struct adc_t adc_channels[] = { }; BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); -/******************************************************************************/ -/* Physical fans. These are logically separate from pwm_channels. */ +/* TODO: Verify fan control and mft */ const struct fan_conf fan_conf_0 = { .flags = FAN_USE_RPM_MODE, .ch = MFT_CH_0, /* Use MFT id to control fan */ @@ -167,37 +137,28 @@ const struct fan_rpm fan_rpm_0 = { .rpm_max = 5600, }; -const struct fan_rpm fan_rpm_1 = { - .rpm_min = 2800, - .rpm_start = 2800, - .rpm_max = 5600, -}; - struct fan_t fans[] = { [FAN_CH_0] = { .conf = &fan_conf_0, .rpm = &fan_rpm_0, }, }; 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}, }; BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); -/* I2C port map */ const struct i2c_port_t i2c_ports[] = { - {"tcpc", NPCX_I2C_PORT0_0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA}, - {"eeprom", NPCX_I2C_PORT0_1, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA}, - {"charger", NPCX_I2C_PORT1, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA}, - {"pmic", NPCX_I2C_PORT2, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA}, - {"thermal", NPCX_I2C_PORT3, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA}, + {"tcpc", I2C_PORT_TCPC0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA}, + {"eeprom", I2C_PORT_EEPROM, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA}, + {"backlight", I2C_PORT_BACKLIGHT, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA}, + {"pmic", I2C_PORT_PMIC, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA}, + {"thermal", I2C_PORT_THERMAL, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA}, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); /* TCPC mux configuration */ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - {NPCX_I2C_PORT0_0, I2C_ADDR_TCPC0, &ps8xxx_tcpm_drv, + {I2C_PORT_TCPC0, I2C_ADDR_TCPC0, &ps8xxx_tcpm_drv, TCPC_ALERT_ACTIVE_LOW}, }; @@ -221,7 +182,6 @@ const int usb_port_enable[USB_PORT_COUNT] = { GPIO_USB2_ENABLE, GPIO_USB3_ENABLE, GPIO_USB4_ENABLE, - GPIO_USB5_ENABLE, }; void board_reset_pd_mcu(void) @@ -263,14 +223,10 @@ DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1); uint16_t tcpc_get_alert_status(void) { - uint16_t status = 0; - - if (!gpio_get_level(GPIO_USB_C0_PD_INT_ODL)) { - if (gpio_get_level(GPIO_USB_C0_PD_RST_ODL)) - status |= PD_STATUS_TCPC_ALERT_0; - } - - return status; + if (!gpio_get_level(GPIO_USB_C0_PD_INT_ODL) && + gpio_get_level(GPIO_USB_C0_PD_RST_ODL)) + return PD_STATUS_TCPC_ALERT_0; + return 0; } /* @@ -453,7 +409,7 @@ void chipset_pre_init_callback(void) } /** - * Notify the AC presence GPIO to the PCH. + * Notify PCH of the AC presence. */ static void board_extpower(void) { @@ -461,49 +417,10 @@ static void board_extpower(void) } DECLARE_HOOK(HOOK_AC_CHANGE, board_extpower, HOOK_PRIO_DEFAULT); -/* Mapping to the old schematics */ -#define GPIO_U42_P GPIO_TYPE_C_60W -#define GPIO_U22_C GPIO_TYPE_C_65W - -/* - * Board version 2.1 or before uses a different current monitoring circuitry. - */ -static void set_charge_limit(int charge_ma) -{ - /* - * We have two FETs connected to two registers: PR257 & PR258. - * These control thresholds of the over current monitoring system. - * - * PR257, PR258 - * For 4.62A (90W BJ adapter), on, off - * For 3.33A (65W BJ adapter), off, on - * For 3.00A (Type-C adapter), off, off - * - * The over current monitoring system doesn't support less than 3A - * (e.g. 2.25A, 2.00A). These current most likely won't be enough to - * power the system. However, if they're needed, EC can monitor - * PMON_PSYS and trigger H_PROCHOT by itself. - */ - if (charge_ma >= 4620) { - gpio_set_level(GPIO_U42_P, 1); - gpio_set_level(GPIO_U22_C, 0); - } else if (charge_ma >= 3330) { - gpio_set_level(GPIO_U42_P, 0); - gpio_set_level(GPIO_U22_C, 1); - } else if (charge_ma >= 3000) { - gpio_set_level(GPIO_U42_P, 0); - gpio_set_level(GPIO_U22_C, 0); - } else { - /* TODO(http://crosbug.com/p/65013352) */ - CPRINTS("Current %dmA not supported", charge_ma); - } -} - void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma, int charge_mv) { - int p87w = 0, p65w = 0, p60w = 0; - + int u22 = 0; /* * Turn on/off power shortage alert. Performs the same check as * system_can_boot_ap(). It's repeated here because charge_manager @@ -514,68 +431,18 @@ void board_set_charge_limit(int port, int supplier, int charge_ma, CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON * 1000); /* - * In terms of timing, this should always work because - * HOOK_PRIO_CHARGE_MANAGER_INIT is notified after HOOK_PRIO_INIT_I2C. - * If CBI isn't initialized or contains invalid data, we assume it's - * a new board. - */ - if (0 < board_version && board_version < 0x0202) - return set_charge_limit(charge_ma); - /* - * We have three FETs connected to three registers: PR257, PR258, - * PR7824. These control the thresholds of the current monitoring - * system. - * - * PR257 PR7824 PR258 - * For BJ (65W or 90W) off off off - * For 4.35A (87W) on off off - * For 3.25A (65W) off off on - * For 3.00A (60W) off on off - * - * The system power consumption is capped by PR259, which is stuffed - * differently depending on the SKU (65W v.s. 90W or U42 v.s. U22). - * So, we only need to monitor type-c adapters. For example: - * - * a 90W system powered by 65W type-c charger - * b 65W system powered by 60W type-c charger - * c 65W system powered by 87W type-c charger - * - * In a case such as (c), we actually do not need to monitor the current - * because the max is capped by PR259. - * - * AP is expected to read type-c adapter wattage from EC and control - * power consumption to avoid over-current or system browns out. - * + * Kalista has two types of charger: 90W, 135W. + * 135W charger offers 7.1A/19V. + * 90W charger offers 4.74A/19V. */ - if (supplier != CHARGE_SUPPLIER_DEDICATED) { - /* Apple 87W charger offers 4.3A @20V. */ - if (charge_ma >= 4300) { - p87w = 1; - } else if (charge_ma >= 3250) { - p65w = 1; - } else if (charge_ma >= 3000) { - p60w = 1; - } else { - /* - * TODO:http://crosbug.com/p/65013352. - * The current monitoring system doesn't support lower - * current. These currents are most likely not enough to - * power the system. However, if they're needed, EC can - * monitor PMON_PSYS and trigger H_PROCHOT by itself. - */ - p60w = 1; - CPRINTS("Current %dmA not supported", charge_ma); - } - } - - gpio_set_level(GPIO_TYPE_C_87W, p87w); - gpio_set_level(GPIO_TYPE_C_65W, p65w); - gpio_set_level(GPIO_TYPE_C_60W, p60w); + if (charge_ma < bj_adapters[BJ_135W_19V].current) + /* GPIO_U22_90W high means 90W charger */ + u22 = 1; + gpio_set_level(GPIO_U22_90W, u22); } enum battery_present battery_is_present(void) { - /* The GPIO is low when the battery is present */ return BP_NO; } @@ -598,8 +465,6 @@ struct fan_step { int rpm; }; -static const struct fan_step *fan_table; - /* Note: Do not make the fan on/off point equal to 0 or 100 */ static const struct fan_step fan_table0[] = { {.on = 0, .off = 1, .rpm = 0}, @@ -611,142 +476,51 @@ static const struct fan_step fan_table0[] = { {.on = 88, .off = 83, .rpm = 5200}, {.on = 98, .off = 91, .rpm = 5600}, }; -static const struct fan_step fan_table1[] = { - {.on = 0, .off = 1, .rpm = 0}, - {.on = 36, .off = 1, .rpm = 2800}, - {.on = 62, .off = 58, .rpm = 3200}, - {.on = 68, .off = 63, .rpm = 3400}, - {.on = 75, .off = 69, .rpm = 4200}, - {.on = 81, .off = 76, .rpm = 4800}, - {.on = 88, .off = 83, .rpm = 5200}, - {.on = 98, .off = 91, .rpm = 5600}, -}; -static const struct fan_step fan_table2[] = { - {.on = 0, .off = 1, .rpm = 0}, - {.on = 36, .off = 1, .rpm = 2200}, - {.on = 63, .off = 56, .rpm = 2900}, - {.on = 69, .off = 65, .rpm = 3000}, - {.on = 75, .off = 70, .rpm = 3300}, - {.on = 80, .off = 76, .rpm = 3600}, - {.on = 87, .off = 81, .rpm = 3900}, - {.on = 98, .off = 91, .rpm = 5000}, -}; /* All fan tables must have the same number of levels */ #define NUM_FAN_LEVELS ARRAY_SIZE(fan_table0) -BUILD_ASSERT(ARRAY_SIZE(fan_table1) == NUM_FAN_LEVELS); -BUILD_ASSERT(ARRAY_SIZE(fan_table2) == NUM_FAN_LEVELS); + +static const struct fan_step *fan_table = fan_table0; + static void cbi_init(void) { uint32_t val; - if (cbi_get_board_version(&val) == EC_SUCCESS && val <= UINT16_MAX) + if (cbi_get_board_version(&val) == EC_SUCCESS && val <= UINT8_MAX) board_version = val; - CPRINTS("Board Version: 0x%04x", board_version); + CPRINTS("Board Version: 0x%02x", board_version); if (cbi_get_oem_id(&val) == EC_SUCCESS && val < OEM_COUNT) oem = val; CPRINTS("OEM: %d", oem); - if (cbi_get_sku_id(&val) == EC_SUCCESS && val <= UINT8_MAX) + if (cbi_get_sku_id(&val) == EC_SUCCESS) sku = val; - CPRINTS("SKU: 0x%02x", sku); + CPRINTS("SKU: 0x%08x", sku); } DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1); -static void setup_fan(void) -{ - /* Configure Fan */ - switch (oem) { - case OEM_KENCH: - case OEM_TEEMO: - case OEM_BLEEMO: - default: - fans[FAN_CH_0].rpm = &fan_rpm_1; - fan_table = fan_table0; - break; - case OEM_SION: - fans[FAN_CH_0].rpm = &fan_rpm_1; - fan_table = fan_table1; - break; - case OEM_WUKONG_N: - case OEM_WUKONG_A: - case OEM_WUKONG_M: - fans[FAN_CH_0].rpm = &fan_rpm_0; - fan_table = fan_table2; - break; - } -} - -/* List of BJ adapters shipped with Fizz or its variants */ -enum bj_adapter { - BJ_65W_19V, - BJ_90W_19V, - BJ_65W_19P5V, - BJ_90W_19P5V, -}; - -/* BJ adapter specs */ -static const struct charge_port_info bj_adapters[] = { - [BJ_65W_19V] = { .current = 3420, .voltage = 19000 }, - [BJ_90W_19V] = { .current = 4740, .voltage = 19000 }, - [BJ_65W_19P5V] = { .current = 3330, .voltage = 19500 }, - [BJ_90W_19P5V] = { .current = 4620, .voltage = 19500 }, -}; - -/* - * Bit masks to map SKU ID to BJ adapter wattage. 1:90W 0:65W - * KBL-R i7 8550U 4 90 - * KBL-R i5 8250U 5 90 - * KBL-R i3 8130U 6 90 - * KBL-U i7 7600 3 65 - * KBL-U i5 7500 2 65 - * KBL-U i3 7100 1 65 - * KBL-U Celeron 3965 7 65 - * KBL-U Celeron 3865 0 65 - */ -#define BJ_ADAPTER_90W_MASK (1 << 4 | 1 << 5 | 1 << 6) - static void setup_bj(void) { - enum bj_adapter bj; - - switch (oem) { - case OEM_KENCH: - bj = (BJ_ADAPTER_90W_MASK & (1 << sku)) ? - BJ_90W_19P5V : BJ_65W_19P5V; - break; - case OEM_TEEMO: - case OEM_BLEEMO: - case OEM_SION: - case OEM_WUKONG_N: - case OEM_WUKONG_A: - case OEM_WUKONG_M: - bj = (BJ_ADAPTER_90W_MASK & (1 << sku)) ? - BJ_90W_19V : BJ_65W_19V; - break; - default: - bj = (BJ_ADAPTER_90W_MASK & (1 << sku)) ? - BJ_90W_19P5V : BJ_65W_19P5V; - break; - } + enum bj_adapter bj = (BJ_ADAPTER_135W_MASK & (1 << sku)) ? + BJ_135W_19V : BJ_90W_19V; charge_manager_update_charge(CHARGE_SUPPLIER_DEDICATED, DEDICATED_CHARGE_PORT, &bj_adapters[bj]); } /* - * Since fizz has no battery, it must source all of its power from either - * USB-C or the barrel jack (preferred). Fizz operates in continuous safe - * mode (charge_manager_leave_safe_mode() will never be called), which - * modifies port / ILIM selection as follows: + * Kalista has no battery and power is sourced only from a BJ adapter. + * Kalista operates in continuous safe mode (charge_manager_leave_safe_mode() + * will never be called), which modifies port / ILIM selection as follows: * * - Dual-role / dedicated capability of the port partner is ignored. * - Charge ceiling on PD voltage transition is ignored. * - CHARGE_PORT_NONE will never be selected. + * + * TODO: Set USB-C port as source only. */ static void board_charge_manager_init(void) { - enum charge_port port; int i, j; /* Initialize all charge suppliers to 0 */ @@ -755,28 +529,13 @@ static void board_charge_manager_init(void) charge_manager_update_charge(j, i, NULL); } - port = gpio_get_level(GPIO_ADP_IN_L) ? - CHARGE_PORT_TYPEC0 : CHARGE_PORT_BARRELJACK; - CPRINTS("Power source is p%d (%s)", port, - port == CHARGE_PORT_TYPEC0 ? "USB-C" : "BJ"); - - /* Initialize the power source supplier */ - switch (port) { - case CHARGE_PORT_TYPEC0: - typec_set_input_current_limit(port, 3000, 5000); - break; - case CHARGE_PORT_BARRELJACK: - setup_bj(); - break; - } + setup_bj(); } DECLARE_HOOK(HOOK_INIT, board_charge_manager_init, HOOK_PRIO_CHARGE_MANAGER_INIT + 1); static void board_init(void) { - setup_fan(); - /* Provide AC status to the PCH */ board_extpower(); diff --git a/baseboard/kalista/baseboard.h b/baseboard/kalista/baseboard.h index 295538a3b9..e72c28a0ee 100644 --- a/baseboard/kalista/baseboard.h +++ b/baseboard/kalista/baseboard.h @@ -121,7 +121,7 @@ /* USB-A config */ #define CONFIG_USB_PORT_POWER_DUMB -#define USB_PORT_COUNT 5 +#define USB_PORT_COUNT 4 /* Optional feature to configure npcx chip */ #define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */ @@ -131,8 +131,7 @@ /* I2C ports */ #define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0 #define I2C_PORT_EEPROM NPCX_I2C_PORT0_1 -#define I2C_PORT_BATTERY NPCX_I2C_PORT1 -#define I2C_PORT_CHARGER NPCX_I2C_PORT1 +#define I2C_PORT_BACKLIGHT NPCX_I2C_PORT1 #define I2C_PORT_PMIC NPCX_I2C_PORT2 #define I2C_PORT_THERMAL NPCX_I2C_PORT3 @@ -233,13 +232,7 @@ enum mft_channel { }; enum OEM_ID { - OEM_KENCH = 0, - OEM_TEEMO = 1, - OEM_SION = 2, - OEM_WUKONG_N = 3, - OEM_WUKONG_A = 4, - OEM_WUKONG_M = 5, - OEM_BLEEMO = 6, + OEM_KARMA = 7, /* Number of OEM IDs */ OEM_COUNT }; @@ -255,7 +248,7 @@ enum OEM_ID { /* delay to turn on/off vconn */ #define PD_VCONN_SWAP_DELAY 5000 /* us */ -/* Define typical operating power. Since Fizz doesn't have a battery to charge, +/* Define typical operating power. Since Kalista doesn't have a battery, * we're not interested in any power lower than the AP power-on threshold. */ #define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON #define PD_MAX_POWER_MW 100000 diff --git a/baseboard/kalista/usb_pd_policy.c b/baseboard/kalista/usb_pd_policy.c index bac29cfa52..d6fe6ab6a3 100644 --- a/baseboard/kalista/usb_pd_policy.c +++ b/baseboard/kalista/usb_pd_policy.c @@ -220,43 +220,9 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, int board_set_active_charge_port(int port) { - const int active_port = charge_manager_get_active_charge_port(); - if (port < 0 || CHARGE_PORT_COUNT <= port) return EC_ERROR_INVAL; - - if (port == active_port) - return EC_SUCCESS; - - /* Don't charge from a source port */ - if (board_vbus_source_enabled(port)) - return EC_ERROR_INVAL; - CPRINTS("New charger p%d", port); - - switch (port) { - case CHARGE_PORT_TYPEC0: - /* This is connected to TP on board version 2.2+ thus no-op */ - gpio_set_level(GPIO_USB_C0_CHARGE_L, 0); - gpio_set_level(GPIO_AC_JACK_CHARGE_L, 1); - gpio_enable_interrupt(GPIO_ADP_IN_L); - break; - case CHARGE_PORT_BARRELJACK: - /* Make sure BJ adapter is sourcing power */ - if (gpio_get_level(GPIO_ADP_IN_L)) - return EC_ERROR_INVAL; - /* This will cause brown out when switching from type-c on - * board version 2.2+ thus the rest of the code is no-op. */ - gpio_set_level(GPIO_AC_JACK_CHARGE_L, 0); - /* If type-c voltage > BJ voltage, we'll brown out due to the - * reverse current protection of PU3 but it's intended. */ - gpio_set_level(GPIO_USB_C0_CHARGE_L, 1); - gpio_disable_interrupt(GPIO_ADP_IN_L); - break; - default: - return EC_ERROR_INVAL; - } - return EC_SUCCESS; } diff --git a/board/karma/gpio.inc b/board/karma/gpio.inc index efeedbce61..828c2042e6 100644 --- a/board/karma/gpio.inc +++ b/board/karma/gpio.inc @@ -13,16 +13,10 @@ GPIO_INT(AC_PRESENT, PIN(C, 1), GPIO_INT_BOTH, extpower_interrupt) GPIO_INT(POWER_BUTTON_L, PIN(0, 4), GPIO_INT_BOTH | GPIO_PULL_UP, power_button_interrupt) /* MECH_PWR_BTN_ODL */ GPIO_INT(PCH_SLP_S0_L, PIN(7, 5), GPIO_INT_BOTH, power_signal_interrupt) -/* Use VW signals instead of GPIOs */ -#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_SIGNALS -GPIO_INT(PCH_SLP_S3_L, PIN(7, 3), GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(PCH_SLP_S4_L, PIN(8, 6), GPIO_INT_BOTH, power_signal_interrupt) -#endif GPIO_INT(PCH_SLP_SUS_L, PIN(6, 2), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(RSMRST_L_PGOOD, PIN(B, 0), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(PMIC_DPWROK, PIN(C, 7), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(WP_L, PIN(9, 3), GPIO_INT_BOTH, switch_interrupt) -GPIO_INT(ADP_IN_L, PIN(C, 5), GPIO_INT_BOTH | GPIO_PULL_UP, adp_in) /* Low: BJ detected */ GPIO_INT(USB_C0_VBUS_WAKE_L, PIN(9, 7), GPIO_INT_BOTH | GPIO_PULL_UP, vbus0_evt) GPIO_INT(RECOVERY_L, PIN(8, 2), GPIO_INT_BOTH, button_interrupt) /* Recovery button */ GPIO(PCH_RTCRST, PIN(E, 7), GPIO_OUT_LOW) /* RTCRST# to SOC */ @@ -40,12 +34,9 @@ GPIO(CCD_MODE_ODL, PIN(6, 3), GPIO_INPUT) /* Case Closed Debug Mode */ GPIO(EC_HAVEN_RESET_ODL, PIN(0, 2), GPIO_ODR_HIGH) /* H1 Reset */ GPIO(ENTERING_RW, PIN(7, 6), GPIO_OUTPUT) /* EC Entering RW */ GPIO(PMIC_INT_L, PIN(6, 0), GPIO_INPUT) /* PMIC interrupt */ -GPIO(TYPE_C_60W, PIN(3, 3), GPIO_OUTPUT | GPIO_PULL_DOWN) -GPIO(TYPE_C_65W, PIN(3, 4), GPIO_OUTPUT | GPIO_PULL_DOWN) -GPIO(TYPE_C_87W, PIN(4, 4), GPIO_OUTPUT | GPIO_PULL_DOWN) +GPIO(U22_90W, PIN(3, 4), GPIO_OUTPUT | GPIO_PULL_DOWN) GPIO(POWER_RATE, PIN(7, 1), GPIO_INPUT) /* High: i3/5/7. Low: Celeron */ -/* Fizz specific pins */ GPIO(LAN_PWR_EN, PIN(8, 3), GPIO_OUT_HIGH) /* Ethernet power enabled */ GPIO(PP5000_DX_NFC, PIN(1, 5), GPIO_OUTPUT) @@ -72,7 +63,6 @@ GPIO(I2C3_SDA, PIN(D, 0), GPIO_INPUT) /* EC_THEM_SDA */ /* 5V enables: INPUT=1.5A, OUT_LOW=OFF, OUT_HIGH=3A */ GPIO(USB_C0_5V_EN, PIN(4, 2), GPIO_OUT_LOW | GPIO_PULL_UP) /* C0 5V Enable */ GPIO(USB_C0_CHARGE_L, PIN(C, 0), GPIO_OUT_LOW) /* C0 Charge enable */ -GPIO(AC_JACK_CHARGE_L, PIN(C, 3), GPIO_OUT_LOW) /* AC jack charge enable */ GPIO(USB_C0_PD_RST_ODL, PIN(0, 3), GPIO_OUT_LOW) /* C0 PD Reset */ GPIO(USB_C0_DP_HPD, PIN(9, 4), GPIO_INPUT) /* C0 DP Hotplug Detect */ GPIO(USB_C0_TCPC_PWR, PIN(8, 4), GPIO_OUT_LOW) /* Enable C0 TCPC Power */ -- cgit v1.2.1