mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 01:21:49 +00:00
poppy: Add ANX3429 cable detection handling
Enable CONFIG_USB_PD_TCPC_LOW_POWER, and add cable detection handling.
BRANCH=none
BUG=chrome-os-partner:62964
TEST=on poppy, connect USB-A keyboard to ANX port via A-C adapter:
keyboard works; charging works
Change-Id: I0751cc7b5fc8ba71388f08b7001c0daceda37bb6
Reviewed-on: https://chromium-review.googlesource.com/443747
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
887298ba50
commit
cb6e3ec3a0
@@ -93,6 +93,35 @@ void usb1_evt(enum gpio_signal signal)
|
||||
task_set_event(TASK_ID_USB_CHG_P1, USB_CHG_EVENT_BC12, 0);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
|
||||
static void anx74xx_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(NPCX_I2C_PORT0_0,
|
||||
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_cable_det_handler);
|
||||
DECLARE_HOOK(HOOK_CHIPSET_RESUME, anx74xx_cable_det_handler, HOOK_PRIO_LAST);
|
||||
|
||||
void anx74xx_cable_det_interrupt(enum gpio_signal signal)
|
||||
{
|
||||
/* debounce for 2ms */
|
||||
hook_call_deferred(&anx74xx_cable_det_handler_data, (2 * MSEC));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Base detection and debouncing
|
||||
*
|
||||
|
||||
@@ -124,6 +124,7 @@
|
||||
#define CONFIG_USB_PD_PORT_COUNT 2
|
||||
#define CONFIG_USB_PD_QUIRK_SLOW_CC_STATUS
|
||||
#define CONFIG_USB_PD_VBUS_DETECT_GPIO
|
||||
#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
|
||||
|
||||
@@ -31,6 +31,7 @@ GPIO_INT(USB_C0_BC12_INT_L, PIN(D, 3), GPIO_INT_FALLING, usb0_evt)
|
||||
GPIO_INT(USB_C1_BC12_INT_L, PIN(3, 3), GPIO_INT_FALLING, usb1_evt)
|
||||
GPIO_INT(ACCELGYRO3_INT_L, PIN(3, 0), GPIO_INT_FALLING, bmi160_interrupt)
|
||||
GPIO_INT(BASE_DET_A, PIN(4, 5), GPIO_INT_BOTH, base_detect_interrupt)
|
||||
GPIO_INT(USB_C0_CABLE_DET, PIN(D, 2), GPIO_INT_RISING, anx74xx_cable_det_interrupt)
|
||||
|
||||
GPIO(PCH_RTCRST, PIN(E, 7), GPIO_OUT_LOW) /* RTCRST# to SOC */
|
||||
GPIO(ENABLE_BACKLIGHT, PIN(2, 6), GPIO_OUT_LOW) /* Enable Backlight */
|
||||
@@ -89,7 +90,6 @@ GPIO(USB_C0_5V_EN, PIN(4, 2), GPIO_OUT_LOW) /* C0 5V Enable */
|
||||
GPIO(USB_C0_CHARGE_L, PIN(C, 0), GPIO_OUT_LOW) /* C0 Charge enable */
|
||||
GPIO(USB_C1_5V_EN, PIN(B, 1), GPIO_OUT_LOW) /* C1 5V Enable */
|
||||
GPIO(USB_C1_CHARGE_L, PIN(C, 3), GPIO_OUT_LOW) /* C1 Charge enable */
|
||||
GPIO(USB_C0_CABLE_DET, PIN(D, 2), GPIO_INPUT) /* C0 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