summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2022-08-24 15:12:17 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-08-29 18:17:11 +0000
commit466ff0397b9b114833b9c3564b2508252f298a13 (patch)
tree90d7fa84b82baac2ae50e2b6452346ea9917ac00
parent84ce87820dfd04af120f3bca4f884e7b10f39831 (diff)
downloadchrome-ec-466ff0397b9b114833b9c3564b2508252f298a13.tar.gz
rex: Fix tcpc_get_alert_status function
There was an error in tcpc_get_alert_status where the pin level wasn't being read. This CL adds gpio_pin_get_dt() so the gpio pin level is going to be read and removes the macro that was being used and was only testing if the node existed. BRANCH=none BUG=b:243482165 TEST=zmake build rex Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: Ife8aa4ed08c2be43776e12eeb9e28a9a04036bfd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3855164 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com> Commit-Queue: Scott Collyer <scollyer@chromium.org> Reviewed-by: Madhu P <mparuchuri@google.com>
-rw-r--r--zephyr/projects/rex/src/usbc_config.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/zephyr/projects/rex/src/usbc_config.c b/zephyr/projects/rex/src/usbc_config.c
index 358beea385..1add443b50 100644
--- a/zephyr/projects/rex/src/usbc_config.c
+++ b/zephyr/projects/rex/src/usbc_config.c
@@ -31,10 +31,6 @@
/*******************************************************************/
/* USB-C Configuration Start */
-#define GPIO_USB_C0_TCPC_INT_NODE \
- GPIO_DT_FROM_NODELABEL(gpio_usb_c0_tcpc_int_odl)
-#define GPIO_USB_C0_TCPC_RST_NODE \
- GPIO_DT_FROM_NODELABEL(gpio_usb_c0_tcpc_rst_odl)
/* USB-C ports */
enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_COUNT };
@@ -124,12 +120,17 @@ void board_reset_pd_mcu(void)
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;
+
+ 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);
/*
* Check which port has the ALERT line set and ignore if that TCPC has
* its reset line active.
*/
- if (!GPIO_USB_C0_TCPC_INT_NODE && GPIO_USB_C0_TCPC_RST_NODE) {
+ if (!gpio_pin_get_dt(tcpc_c0_int_l) && gpio_pin_get_dt(tcpc_c0_rst_l)) {
status |= PD_STATUS_TCPC_ALERT_0;
}