mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 17:11:42 +00:00
eve: Add support for anx3429 tcpc low power mode
Added interrupt handler for CABLE_DET signal on both port 0/1. This allows us to define CONFIG_USB_PD_TCPC_LOW_POWER. BUG=chrome-os-partner:63067 BRANCH=none TEST=Connected USB mouse, keyboard and USB stick to both ports and verified the devices were recognized and attached properly. Verified that ports 0/1 always worked with blackcat typeC charger. Change-Id: I4d8a8bdba4f95e73333e2e01f11fe1d48453a2fe Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/444315 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@google.com> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
This commit is contained in:
@@ -85,6 +85,61 @@ void tablet_mode_interrupt(enum gpio_signal signal)
|
||||
hook_call_deferred(&enable_input_devices_data, LID_DEBOUNCE_US);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
|
||||
static void anx74xx_c0_cable_det_handler(void)
|
||||
{
|
||||
int level = gpio_get_level(GPIO_USB_C0_CABLE_DET);
|
||||
|
||||
/*
|
||||
* Setting the low power is handled by DRP status hence
|
||||
* handle only the attach event.
|
||||
*/
|
||||
if (level)
|
||||
anx74xx_handle_power_mode(I2C_PORT_TCPC0,
|
||||
ANX74XX_NORMAL_MODE);
|
||||
|
||||
/* confirm if cable_det is asserted */
|
||||
if (!level || gpio_get_level(GPIO_USB_C0_PD_RST_L))
|
||||
return;
|
||||
|
||||
task_set_event(TASK_ID_PD_C0, PD_EVENT_TCPC_RESET, 0);
|
||||
}
|
||||
DECLARE_DEFERRED(anx74xx_c0_cable_det_handler);
|
||||
DECLARE_HOOK(HOOK_CHIPSET_RESUME, anx74xx_c0_cable_det_handler, HOOK_PRIO_LAST);
|
||||
|
||||
static void anx74xx_c1_cable_det_handler(void)
|
||||
{
|
||||
int level = gpio_get_level(GPIO_USB_C1_CABLE_DET);
|
||||
|
||||
/*
|
||||
* Setting the low power is handled by DRP status hence
|
||||
* handle only the attach event.
|
||||
*/
|
||||
if (level)
|
||||
anx74xx_handle_power_mode(I2C_PORT_TCPC1,
|
||||
ANX74XX_NORMAL_MODE);
|
||||
|
||||
/* confirm if cable_det is asserted */
|
||||
if (!level || gpio_get_level(GPIO_USB_C1_PD_RST_L))
|
||||
return;
|
||||
|
||||
task_set_event(TASK_ID_PD_C1, PD_EVENT_TCPC_RESET, 0);
|
||||
}
|
||||
DECLARE_DEFERRED(anx74xx_c1_cable_det_handler);
|
||||
DECLARE_HOOK(HOOK_CHIPSET_RESUME, anx74xx_c1_cable_det_handler, HOOK_PRIO_LAST);
|
||||
|
||||
void anx74xx_cable_det_interrupt(enum gpio_signal signal)
|
||||
{
|
||||
/* Check if it is port 0 or 1, and debounce for 2 msec. */
|
||||
if (signal == GPIO_USB_C0_CABLE_DET)
|
||||
hook_call_deferred(&anx74xx_c0_cable_det_handler_data,
|
||||
(2 * MSEC));
|
||||
else
|
||||
hook_call_deferred(&anx74xx_c1_cable_det_handler_data,
|
||||
(2 * MSEC));
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "gpio_list.h"
|
||||
|
||||
/* power signal list. Must match order of enum power_signal. */
|
||||
@@ -221,6 +276,12 @@ void board_tcpc_init(void)
|
||||
gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
|
||||
gpio_enable_interrupt(GPIO_USB_C1_PD_INT_ODL);
|
||||
|
||||
#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
|
||||
/* Enable CABLE_DET interrupt for ANX3429 wake from standby */
|
||||
gpio_enable_interrupt(GPIO_USB_C0_CABLE_DET);
|
||||
gpio_enable_interrupt(GPIO_USB_C1_CABLE_DET);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize HPD to low; after sysjump SOC needs to see
|
||||
* HPD pulse to enable video path
|
||||
|
||||
@@ -151,6 +151,7 @@
|
||||
#define CONFIG_USB_PD_PORT_COUNT 2
|
||||
#define CONFIG_USB_PD_QUIRK_SLOW_CC_STATUS
|
||||
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
|
||||
#define CONFIG_USB_PD_TCPC_LOW_POWER
|
||||
#define CONFIG_USB_PD_TCPM_MUX
|
||||
#define CONFIG_USB_PD_TCPM_ANX74XX
|
||||
#define CONFIG_USB_PD_TCPM_TCPCI
|
||||
|
||||
@@ -23,6 +23,8 @@ GPIO_INT(VOLUME_UP_L, PIN(8, 2), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt
|
||||
GPIO_INT(WP_L, PIN(4, 0), GPIO_INT_BOTH, switch_interrupt)
|
||||
GPIO_INT(AC_PRESENT, PIN(C, 1), GPIO_INT_BOTH, extpower_interrupt)
|
||||
GPIO_INT(ACCELGYRO3_INT_L, PIN(9, 3), GPIO_INT_FALLING, bmi160_interrupt)
|
||||
GPIO_INT(USB_C0_CABLE_DET, PIN(D, 2), GPIO_INT_RISING, anx74xx_cable_det_interrupt)
|
||||
GPIO_INT(USB_C1_CABLE_DET, PIN(D, 3), GPIO_INT_RISING, anx74xx_cable_det_interrupt)
|
||||
|
||||
/* Lid KCJX9 accelerometer sensor interrupt */
|
||||
GPIO(ACCEL1_INT_L, PIN(C, 7), GPIO_INPUT | GPIO_PULL_UP)
|
||||
@@ -66,8 +68,6 @@ GPIO(DSP_WAKE_L, PIN(C, 6), GPIO_INPUT | GPIO_SEL_1P8V) /* INT# from DSP Mic *
|
||||
/* 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_C1_5V_EN, PIN(B, 1), GPIO_OUT_LOW | GPIO_PULL_UP) /* C1 5V Enable */
|
||||
GPIO(USB_C0_CABLE_DET, PIN(D, 2), GPIO_INPUT) /* C0 Cable Detect */
|
||||
GPIO(USB_C1_CABLE_DET, PIN(D, 3), GPIO_INPUT) /* C1 Cable Detect */
|
||||
GPIO(USB_C0_PD_RST_L, PIN(0, 3), GPIO_OUT_LOW) /* C0 PD Reset */
|
||||
GPIO(USB_C1_PD_RST_L, PIN(7, 4), GPIO_OUT_LOW) /* C1 PD Reset */
|
||||
GPIO(USB_C0_DP_HPD, PIN(9, 4), GPIO_INPUT) /* C0 DP Hotplug Detect */
|
||||
|
||||
Reference in New Issue
Block a user