summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2023-04-25 11:04:22 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-04-25 21:41:39 +0000
commit0cb9ecca2df46d4f2205c8f0c03b5bdb621b4d73 (patch)
treedd525d79278bf68a52a9d63164c66f6ab3c79852
parent31fa7019c684ca60e57996eb1d4425704bd28208 (diff)
downloadchrome-ec-0cb9ecca2df46d4f2205c8f0c03b5bdb621b4d73.tar.gz
Nami: Set TCPC_AUX_SWITCH to 0xC on Port 1 on mux setfirmware-nami-10775.B
This CL replaces the fix for b:113266817 with the same fix as I2c8761f81252d87d7aca4878023fb4db3d73812a but on port 1, where Nami's CCD is connected. BUG=b:241161724,b:113266817 BRANCH=Nami TEST=None Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I0e27bca82eaa3878ed3e2173c675c00fb398bac7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4475137 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
-rw-r--r--board/nami/board.c40
-rw-r--r--board/nami/gpio.inc4
2 files changed, 19 insertions, 25 deletions
diff --git a/board/nami/board.c b/board/nami/board.c
index 09e9419273..3fd6ee4631 100644
--- a/board/nami/board.c
+++ b/board/nami/board.c
@@ -266,6 +266,21 @@ static int ps8751_tune_mux(const struct usb_mux *mux)
return EC_SUCCESS;
}
+static int board_anx7447_mux_set(int port, mux_state_t mux_state)
+{
+ int rv = EC_SUCCESS;
+
+ if (gpio_get_level(GPIO_CCD_MODE_ODL))
+ return rv;
+
+ CPRINTS("C%d: set AUX_SW_SEL=0x%x", port, 0xc);
+ rv = tcpc_write(port, ANX7447_REG_TCPC_AUX_SWITCH, 0xc);
+ if (rv)
+ CPRINTS("C%d: Setting AUX_SW_SEL failed", port);
+
+ return rv;
+}
+
struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
[USB_PD_PORT_PS8751] = {
.port_addr = USB_PD_PORT_PS8751,
@@ -275,6 +290,7 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
[USB_PD_PORT_ANX7447] = {
.port_addr = USB_PD_PORT_ANX7447,
.driver = &anx7447_usb_mux_driver,
+ .board_set = board_anx7447_mux_set,
.hpd_update = &anx7447_tcpc_update_hpd_status,
}
};
@@ -1075,26 +1091,6 @@ struct keyboard_scan_config keyscan_config = {
},
};
-static void anx7447_set_aux_switch(void)
-{
- const int port = USB_PD_PORT_ANX7447;
-
- /* Debounce */
- if (gpio_get_level(GPIO_CCD_MODE_ODL))
- return;
-
- CPRINTS("C%d: AUX_SW_SEL=0x%x", port, 0xc);
- if (tcpc_write(port, ANX7447_REG_TCPC_AUX_SWITCH, 0xc))
- CPRINTS("C%d: Setting AUX_SW_SEL failed", port);
-}
-DECLARE_DEFERRED(anx7447_set_aux_switch);
-
-void ccd_mode_isr(enum gpio_signal signal)
-{
- /* Wait 2 seconds until all mux setting is done by PD task */
- hook_call_deferred(&anx7447_set_aux_switch_data, 2 * SECOND);
-}
-
static void board_init(void)
{
int reg;
@@ -1127,10 +1123,6 @@ static void board_init(void)
gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_L);
gpio_enable_interrupt(GPIO_USB_C1_BC12_INT_L);
- /* Trigger once to set mux in case CCD cable is already connected. */
- ccd_mode_isr(GPIO_CCD_MODE_ODL);
- gpio_enable_interrupt(GPIO_CCD_MODE_ODL);
-
/* Enable Accel/Gyro interrupt for convertibles. */
if (sku & SKU_ID_MASK_CONVERTIBLE)
gpio_enable_interrupt(GPIO_ACCELGYRO3_INT_L);
diff --git a/board/nami/gpio.inc b/board/nami/gpio.inc
index 3db9b7340b..85ac8079e0 100644
--- a/board/nami/gpio.inc
+++ b/board/nami/gpio.inc
@@ -35,7 +35,6 @@ GPIO_INT(USB_C0_BC12_INT_L, PIN(D, 2), GPIO_INT_FALLING, usb0_evt)
GPIO_INT(USB_C1_BC12_INT_L, PIN(D, 3), GPIO_INT_FALLING, usb1_evt)
GPIO_INT(ACCELGYRO3_INT_L, PIN(3, 6), GPIO_INT_FALLING | GPIO_PULL_UP, motion_interrupt)
GPIO_INT(TABLET_MODE_L, PIN(7, 2), GPIO_INT_BOTH, tablet_mode_isr)
-GPIO_INT(CCD_MODE_ODL, PIN(6, 3), GPIO_INT_FALLING, ccd_mode_isr)
GPIO(ENABLE_BACKLIGHT_L, PIN(6, 7), GPIO_OUT_LOW) /* LCD backlight */
GPIO(PP3300_DX_WLAN, PIN(B, 1), GPIO_OUT_LOW) /* Enable WLAN 3.3V Power */
@@ -86,6 +85,9 @@ GPIO(USB_PP3300_USB_PD, PIN(8, 4), GPIO_INPUT) /* Reserved. Currently, has no
GPIO(USB2_ID, PIN(4, 2), GPIO_OUT_HIGH) /* USB OTG ID */
GPIO(USB3_POWER_DOWN_L, PIN(3, 2), GPIO_OUT_LOW) /* USB3 Redriver Power control. Only used by Sona. */
+/* CCD */
+GPIO(CCD_MODE_ODL, PIN(6, 3), GPIO_INPUT)
+
/* Sensors */
/* Trackpad */