diff options
-rw-r--r-- | zephyr/program/rex/rex.dtsi | 15 | ||||
-rw-r--r-- | zephyr/program/rex/src/usbc_config.c | 11 |
2 files changed, 19 insertions, 7 deletions
diff --git a/zephyr/program/rex/rex.dtsi b/zephyr/program/rex/rex.dtsi index 640459f9a9..7985f5ab76 100644 --- a/zephyr/program/rex/rex.dtsi +++ b/zephyr/program/rex/rex.dtsi @@ -43,6 +43,21 @@ ec-i2c-c0-rt-sda { gpios = <&gpiod 0 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; }; + + /* + * The pinmap utility does not currently support ACTIVE_LOW + * flag. So it is set here. + */ + /delete-node/ usb_c0_tcpc_int_odl; + /delete-node/ usb_c1_tcpc_int_odl; + gpio_usb_c0_tcpc_int_odl: usb_c0_tcpc_int_odl { + gpios = <&gpioe 0 (GPIO_INPUT | GPIO_ACTIVE_LOW)>; + enum-name = "GPIO_USB_C0_TCPC_INT_ODL"; + }; + gpio_usb_c1_tcpc_int_odl: usb_c1_tcpc_int_odl { + gpios = <&gpio3 4 (GPIO_INPUT | GPIO_ACTIVE_LOW)>; + enum-name = "GPIO_USB_C1_TCPC_INT_ODL"; + }; }; usba-port-enable-list { diff --git a/zephyr/program/rex/src/usbc_config.c b/zephyr/program/rex/src/usbc_config.c index fceb6e0197..e12991d820 100644 --- a/zephyr/program/rex/src/usbc_config.c +++ b/zephyr/program/rex/src/usbc_config.c @@ -123,25 +123,22 @@ uint16_t tcpc_get_alert_status(void) { uint16_t status = 0; const struct gpio_dt_spec *tcpc_c0_rst_l; - const struct gpio_dt_spec *tcpc_c0_int_l; const struct gpio_dt_spec *tcpc_c1_rst_l; - const struct gpio_dt_spec *tcpc_c1_int_l; tcpc_c0_rst_l = GPIO_DT_FROM_NODELABEL(gpio_usb_c0_tcpc_rst_odl); - tcpc_c0_int_l = GPIO_DT_FROM_NODELABEL(gpio_usb_c0_tcpc_int_odl); - tcpc_c1_rst_l = GPIO_DT_FROM_NODELABEL(gpio_usb_c1_rt_rst_r_odl); - tcpc_c1_int_l = GPIO_DT_FROM_NODELABEL(gpio_usb_c1_tcpc_int_odl); /* * Check which port has the ALERT line set and ignore if that TCPC has * its reset line active. */ - if (!gpio_pin_get_dt(tcpc_c0_int_l) && gpio_pin_get_dt(tcpc_c0_rst_l)) { + if (gpio_pin_get_dt(&tcpc_config[0].irq_gpio) && + gpio_pin_get_dt(tcpc_c0_rst_l)) { status |= PD_STATUS_TCPC_ALERT_0; } - if (!gpio_pin_get_dt(tcpc_c1_int_l) && gpio_pin_get_dt(tcpc_c1_rst_l)) { + if (gpio_pin_get_dt(&tcpc_config[1].irq_gpio) && + gpio_pin_get_dt(tcpc_c1_rst_l)) { status |= PD_STATUS_TCPC_ALERT_1; } |