mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
Lars: remove compile-time checks related to second PD port
BUG=chrome-os-partner:47385 BRANCH=lars TEST=`make buildall -j` Change-Id: I4d786e59ffb85911bf1d923a1a37167fea4658fd Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/311510 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
@@ -64,23 +64,11 @@ void vbus0_evt(enum gpio_signal signal)
|
||||
task_wake(TASK_ID_PD_C0);
|
||||
}
|
||||
|
||||
void vbus1_evt(enum gpio_signal signal)
|
||||
{
|
||||
/* VBUS present GPIO is inverted */
|
||||
usb_charger_vbus_change(1, !gpio_get_level(signal));
|
||||
task_wake(TASK_ID_PD_C1);
|
||||
}
|
||||
|
||||
void usb0_evt(enum gpio_signal signal)
|
||||
{
|
||||
task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_BC12, 0);
|
||||
}
|
||||
|
||||
void usb1_evt(enum gpio_signal signal)
|
||||
{
|
||||
task_set_event(TASK_ID_USB_CHG_P1, USB_CHG_EVENT_BC12, 0);
|
||||
}
|
||||
|
||||
#include "gpio_list.h"
|
||||
|
||||
/* power signal list. Must match order of enum power_signal. */
|
||||
@@ -118,9 +106,6 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
|
||||
|
||||
const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
|
||||
{I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR},
|
||||
#if CONFIG_USB_PD_PORT_COUNT >= 2
|
||||
{I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR + 2},
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Physical fans. These are logically separate from pwm_channels. */
|
||||
@@ -167,12 +152,6 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
|
||||
.port_addr = 0xa8,
|
||||
.driver = &pi3usb30532_usb_mux_driver,
|
||||
}
|
||||
#if CONFIG_USB_PD_PORT_COUNT >= 2
|
||||
, {
|
||||
.port_addr = 0xaa,
|
||||
.driver = &pi3usb30532_usb_mux_driver,
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -424,14 +403,12 @@ static void board_init(void)
|
||||
{
|
||||
/* Enable PD MCU interrupt */
|
||||
gpio_enable_interrupt(GPIO_PD_MCU_INT);
|
||||
|
||||
/* Enable VBUS interrupt */
|
||||
gpio_enable_interrupt(GPIO_USB_C0_VBUS_WAKE_L);
|
||||
#if CONFIG_USB_PD_PORT_COUNT >= 2
|
||||
gpio_enable_interrupt(GPIO_USB_C1_VBUS_WAKE_L);
|
||||
#endif
|
||||
|
||||
/* Enable pericom BC1.2 interrupts */
|
||||
gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_L);
|
||||
/* gpio_enable_interrupt(GPIO_USB_C1_BC12_INT_L);*/
|
||||
|
||||
/* Provide AC status to the PCH */
|
||||
gpio_set_level(GPIO_PCH_ACOK, extpower_is_present());
|
||||
@@ -457,19 +434,11 @@ DECLARE_HOOK(HOOK_AC_CHANGE, board_extpower, HOOK_PRIO_DEFAULT);
|
||||
*/
|
||||
int board_set_active_charge_port(int charge_port)
|
||||
{
|
||||
/* charge port is a realy physical port */
|
||||
int is_real_port = (charge_port >= 0 &&
|
||||
charge_port < CONFIG_USB_PD_PORT_COUNT);
|
||||
|
||||
#if CONFIG_USB_PD_PORT_COUNT >= 2
|
||||
/* check if we are source vbus on that port */
|
||||
int source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN :
|
||||
GPIO_USB_C1_5V_EN);
|
||||
#else
|
||||
int source = gpio_get_level(GPIO_USB_C0_5V_EN);
|
||||
#endif
|
||||
|
||||
if (is_real_port && source) {
|
||||
/* charge port is a realy physical port */
|
||||
if ((charge_port == 0) && source) {
|
||||
CPRINTS("Skip enable p%d", charge_port);
|
||||
return EC_ERROR_INVAL;
|
||||
}
|
||||
@@ -477,16 +446,13 @@ int board_set_active_charge_port(int charge_port)
|
||||
CPRINTS("New chg p%d", charge_port);
|
||||
|
||||
if (charge_port == CHARGE_PORT_NONE) {
|
||||
/* Disable both ports */
|
||||
/* Disable charge ports */
|
||||
gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 1);
|
||||
gpio_set_level(GPIO_USB_C1_CHARGE_EN_L, 1);
|
||||
} else {
|
||||
/* Make sure non-charging port is disabled */
|
||||
gpio_set_level(charge_port ? GPIO_USB_C0_CHARGE_EN_L :
|
||||
GPIO_USB_C1_CHARGE_EN_L, 1);
|
||||
/* We have only one port, no need to
|
||||
make sure non-charging port is disabled */
|
||||
/* Enable charging port */
|
||||
gpio_set_level(charge_port ? GPIO_USB_C1_CHARGE_EN_L :
|
||||
GPIO_USB_C0_CHARGE_EN_L, 0);
|
||||
gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 0);
|
||||
}
|
||||
|
||||
return EC_SUCCESS;
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#define CONFIG_TASK_LIST \
|
||||
TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(USB_CHG_P0, usb_charger_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(USB_CHG_P1, usb_charger_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CHARGER, charger_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \
|
||||
@@ -29,5 +28,4 @@
|
||||
TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(POWERBTN, power_button_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(PD_C1, pd_task, NULL, LARGER_TASK_STACK_SIZE)
|
||||
TASK_ALWAYS(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE)
|
||||
|
||||
@@ -86,7 +86,7 @@ GPIO(PLATFORM_EC_PROCHOT, PIN(151), GPIO_INPUT) /* Empty */
|
||||
GPIO(USB_C0_5V_EN, PIN(154), GPIO_OUT_LOW)
|
||||
GPIO(CHARGE_LED1, PIN(155), GPIO_OUT_HIGH)
|
||||
GPIO(CHARGE_LED2, PIN(156), GPIO_OUT_HIGH)
|
||||
GPIO(USB_C1_CHARGE_EN_L, PIN(157), GPIO_OUT_LOW)
|
||||
GPIO(A5_EN_C0, PIN(157), GPIO_OUT_LOW) /* Empty */
|
||||
GPIO(FAN_PWR_DIS_L, PIN(160), GPIO_OUT_HIGH) /* Empty */
|
||||
GPIO(NC_161, PIN(161), GPIO_INPUT | GPIO_PULL_UP)
|
||||
GPIO(PCH_RTCRST_L, PIN(163), GPIO_ODR_HIGH) /* Empty */
|
||||
|
||||
@@ -49,30 +49,23 @@ void pd_transition_voltage(int idx)
|
||||
|
||||
int pd_set_power_supply_ready(int port)
|
||||
{
|
||||
/* Disable charging */
|
||||
gpio_set_level(port ? GPIO_USB_C1_CHARGE_EN_L :
|
||||
GPIO_USB_C0_CHARGE_EN_L, 1);
|
||||
/* only one port can be selected */
|
||||
if (port >= CONFIG_USB_PD_PORT_COUNT)
|
||||
return EC_ERROR_PARAM1;
|
||||
|
||||
/* Disable charging */
|
||||
gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 1);
|
||||
|
||||
#if CONFIG_USB_PD_PORT_COUNT >= 2
|
||||
/* Provide VBUS */
|
||||
gpio_set_level(port ? GPIO_USB_C1_5V_EN :
|
||||
GPIO_USB_C0_5V_EN, 1);
|
||||
#else
|
||||
gpio_set_level(GPIO_USB_C0_5V_EN, 1);
|
||||
#endif
|
||||
|
||||
return EC_SUCCESS; /* we are ready */
|
||||
}
|
||||
|
||||
void pd_power_supply_reset(int port)
|
||||
{
|
||||
#if CONFIG_USB_PD_PORT_COUNT >= 2
|
||||
/* Disable VBUS */
|
||||
gpio_set_level(port ? GPIO_USB_C1_5V_EN :
|
||||
GPIO_USB_C0_5V_EN, 0);
|
||||
#else
|
||||
gpio_set_level(GPIO_USB_C0_5V_EN, 1);
|
||||
#endif
|
||||
|
||||
/* notify host of power info change */
|
||||
pd_send_host_event(PD_EVENT_POWER_CHANGE);
|
||||
@@ -107,12 +100,7 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
|
||||
|
||||
int pd_snk_is_vbus_provided(int port)
|
||||
{
|
||||
#if CONFIG_USB_PD_PORT_COUNT >= 2
|
||||
return !gpio_get_level(port ? GPIO_USB_C1_VBUS_WAKE_L :
|
||||
GPIO_USB_C0_VBUS_WAKE_L);
|
||||
#else
|
||||
return !gpio_get_level(GPIO_USB_C0_VBUS_WAKE_L);
|
||||
#endif
|
||||
}
|
||||
|
||||
int pd_board_checks(void)
|
||||
|
||||
Reference in New Issue
Block a user