summaryrefslogtreecommitdiff
path: root/board/kukui/board.c
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2019-09-05 01:20:19 +0800
committerCommit Bot <commit-bot@chromium.org>2019-09-05 11:09:00 +0000
commit5094437e865bb00c672288b5420b3a257c14d236 (patch)
tree45684833fab426f5436d599bbd23d81833cb20e8 /board/kukui/board.c
parent7c16f9c666f20daf9c360678f92fcc7145665315 (diff)
downloadchrome-ec-5094437e865bb00c672288b5420b3a257c14d236.tar.gz
krane: add it5205 driver
An it5205 is added in kukui/krane rev 5, and deprecated gpio pin USB_C0_DP_OE_L and USB_C0_DP_POLARITY. This CL is intended to make the fw works for both old and new boards: 1) the default usb_mux driver is updated to rev 5, and board_rev_init may change it back for old boards. 2) keep VARIANT_KUKUI_DP_MUX_GPIO in kukui/board.h, and add a customized function to set/clear these gpio pins. BUG=b:135079572 TEST=verify that type c display works on board rev 4/5 BRANCH=master Change-Id: Ibe28816eed026ccb8a9a5234a612f80b038884f1 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1785197 Reviewed-by: Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'board/kukui/board.c')
-rw-r--r--board/kukui/board.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/board/kukui/board.c b/board/kukui/board.c
index 3eb28bb4c7..a19b92d6cb 100644
--- a/board/kukui/board.c
+++ b/board/kukui/board.c
@@ -19,6 +19,7 @@
#include "driver/charger/rt946x.h"
#include "driver/sync.h"
#include "driver/tcpm/mt6370.h"
+#include "driver/usb_mux/it5205.h"
#include "extpower.h"
#include "gpio.h"
#include "hooks.h"
@@ -100,10 +101,30 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = {
},
};
+void board_set_dp_mux_control(int output_enable, int polarity)
+{
+ if (board_get_version() >= 5)
+ return;
+
+ gpio_set_level(GPIO_USB_C0_DP_OE_L, !output_enable);
+ if (output_enable)
+ gpio_set_level(GPIO_USB_C0_DP_POLARITY, polarity);
+}
+
+static void board_hpd_update(int port, int hpd_lvl, int hpd_irq)
+{
+ /*
+ * svdm_dp_attention() did most of the work, we only need to notify
+ * host here.
+ */
+ host_set_single_event(EC_HOST_EVENT_USB_MUX);
+}
+
struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
{
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .port_addr = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_update,
},
};
@@ -301,6 +322,13 @@ static void board_rev_init(void)
(PI3USB9201_USB_PATH_ON <<
PI3USB9201_REG_CTRL_1_MODE_SHIFT));
}
+
+ if (board_get_version() < 5) {
+ gpio_set_flags(GPIO_USB_C0_DP_OE_L, GPIO_OUT_HIGH);
+ gpio_set_flags(GPIO_USB_C0_DP_POLARITY, GPIO_OUT_LOW);
+ usb_muxes[0].driver = &virtual_usb_mux_driver;
+ usb_muxes[0].hpd_update = &virtual_hpd_update;
+ }
}
DECLARE_HOOK(HOOK_INIT, board_rev_init, HOOK_PRIO_INIT_ADC + 1);