summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbe Levkoy <alevkoy@chromium.org>2021-11-21 12:32:19 -0700
committerCommit Bot <commit-bot@chromium.org>2021-11-22 19:59:14 +0000
commit62fb2d16161f66d1d2a3bd6cf394af9d0e2d0eb0 (patch)
tree47b045ac1fce066c273f2c5d8ff89b5087a76887
parent0b293e2fd74ea5aeccafcd310c077791e68af5e2 (diff)
downloadchrome-ec-62fb2d16161f66d1d2a3bd6cf394af9d0e2d0eb0.tar.gz
zephyr test: Use interrupt GPIO for SYV682x
Set and clear the ALERT_L signal in the SYV682x emulator based on the state of underlying conditions. Test the driver by just setting the underlying conditions instead of calling the ISR from within the test. Define the interrupt signal in the device tree and enable interrupts from it in the test. BUG=b:190519131 TEST=zmake configure --test zephyr/test/drivers BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Idc8b957fe53ce78bd8236e4af6b005636498ada2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3288914 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
-rw-r--r--zephyr/dts/bindings/emul/zephyr,syv682x.yaml4
-rw-r--r--zephyr/emul/emul_syv682x.c67
-rw-r--r--zephyr/include/emul/emul_syv682x.h45
-rw-r--r--zephyr/test/drivers/include/gpio_map.h3
-rw-r--r--zephyr/test/drivers/overlay.dts8
-rw-r--r--zephyr/test/drivers/src/ppc.c63
-rw-r--r--zephyr/test/drivers/src/stubs.c14
7 files changed, 117 insertions, 87 deletions
diff --git a/zephyr/dts/bindings/emul/zephyr,syv682x.yaml b/zephyr/dts/bindings/emul/zephyr,syv682x.yaml
index e1ce84e85d..8652b42b82 100644
--- a/zephyr/dts/bindings/emul/zephyr,syv682x.yaml
+++ b/zephyr/dts/bindings/emul/zephyr,syv682x.yaml
@@ -13,3 +13,7 @@ properties:
type: phandle
description: The GPIO that controls FRS enable on this device
required: true
+ alert_gpio:
+ type: phandle
+ description: The GPIO that receives the alert signal from this device
+ required: true
diff --git a/zephyr/emul/emul_syv682x.c b/zephyr/emul/emul_syv682x.c
index b9d2dc57c7..4527609270 100644
--- a/zephyr/emul/emul_syv682x.c
+++ b/zephyr/emul/emul_syv682x.c
@@ -29,6 +29,8 @@ struct syv682x_emul_data {
const struct device *i2c;
const struct device *frs_en_gpio_port;
gpio_pin_t frs_en_gpio_pin;
+ const struct device *alert_gpio_port;
+ gpio_pin_t alert_gpio_pin;
/** Configuration information */
const struct syv682x_emul_cfg *cfg;
/** Current state of all emulated SYV682x registers */
@@ -51,6 +53,15 @@ struct syv682x_emul_cfg {
struct syv682x_emul_data *data;
};
+/* Asserts or deasserts the interrupt signal to the EC. */
+static void syv682x_emul_set_alert(struct syv682x_emul_data *data, bool alert)
+{
+ int res = gpio_emul_input_set(data->alert_gpio_port,
+ /* The signal is inverted. */
+ data->alert_gpio_pin, !alert);
+ __ASSERT_NO_MSG(res == 0);
+}
+
int syv682x_emul_set_reg(struct i2c_emul *emul, int reg, uint8_t val)
{
struct syv682x_emul_data *data;
@@ -64,48 +75,36 @@ int syv682x_emul_set_reg(struct i2c_emul *emul, int reg, uint8_t val)
return 0;
}
-void syv682x_emul_set_status(struct i2c_emul *emul, uint8_t val)
+void syv682x_emul_set_condition(struct i2c_emul *emul, uint8_t status,
+ uint8_t control_4)
{
+ uint8_t control_4_interrupt = control_4 & SYV682X_CONTROL_4_INT_MASK;
struct syv682x_emul_data *data =
CONTAINER_OF(emul, struct syv682x_emul_data, emul);
int frs_en_gpio = gpio_emul_output_get(data->frs_en_gpio_port,
data->frs_en_gpio_pin);
- /* Only assert FRS status if FRS is enabled. */
__ASSERT_NO_MSG(frs_en_gpio >= 0);
+
+ /* Only assert FRS status if FRS is enabled. */
if (!frs_en_gpio)
- val &= ~SYV682X_STATUS_FRS;
+ status &= ~SYV682X_STATUS_FRS;
- data->status_cond = val;
- data->reg[SYV682X_STATUS_REG] |= val;
+ data->status_cond = status;
+ data->reg[SYV682X_STATUS_REG] |= status;
- if (val & (SYV682X_STATUS_TSD | SYV682X_STATUS_OVP |
+ data->control_4_cond = control_4_interrupt;
+ /* Only update the interrupting bits of CONTROL_4. */
+ data->reg[SYV682X_CONTROL_4_REG] &= ~SYV682X_CONTROL_4_INT_MASK;
+ data->reg[SYV682X_CONTROL_4_REG] |= control_4_interrupt;
+
+ /* These conditions disable the power path. */
+ if (status & (SYV682X_STATUS_TSD | SYV682X_STATUS_OVP |
SYV682X_STATUS_OC_HV)) {
data->reg[SYV682X_CONTROL_1_REG] |= SYV682X_CONTROL_1_PWR_ENB;
}
/*
- * TODO(b/190519131): Make this emulator trigger GPIO-based interrupts
- * by itself based on the status. In real life, the device should turn
- * the power path off when either of these conditions occurs, and they
- * should quickly dissipate. If they somehow stay set, the device should
- * interrupt continuously. Relatedly, the emulator should only generate
- * an interrupt based on FRS status if the FRS enable pin was asserted.
- */
-}
-
-void syv682x_emul_set_control_4(struct i2c_emul *emul, uint8_t val)
-{
- struct syv682x_emul_data *data;
- uint8_t val_interrupt = val & SYV682X_CONTROL_4_INT_MASK;
-
- data = CONTAINER_OF(emul, struct syv682x_emul_data, emul);
- data->control_4_cond = val_interrupt;
- /* Only update the interrupting bits. */
- data->reg[SYV682X_CONTROL_4_REG] &= ~SYV682X_CONTROL_4_INT_MASK;
- data->reg[SYV682X_CONTROL_4_REG] |= val_interrupt;
-
- /*
* Note: The description of CONTROL_4 suggests that setting VCONN_OC
* will turn off the VCONN channel. The "VCONN Channel Over Current
* Response" plot shows that VCONN the device will merely throttle VCONN
@@ -114,12 +113,14 @@ void syv682x_emul_set_control_4(struct i2c_emul *emul, uint8_t val)
*/
/* VBAT_OVP disconnects CC and VCONN. */
- if (val_interrupt & SYV682X_CONTROL_4_VBAT_OVP) {
+ if (control_4_interrupt & SYV682X_CONTROL_4_VBAT_OVP) {
data->reg[SYV682X_CONTROL_4_REG] &= ~(SYV682X_CONTROL_4_CC1_BPS
| SYV682X_CONTROL_4_CC2_BPS
| SYV682X_CONTROL_4_VCONN1
| SYV682X_CONTROL_4_VCONN2);
}
+
+ syv682x_emul_set_alert(data, status | control_4_interrupt);
}
int syv682x_emul_get_reg(struct i2c_emul *emul, int reg, uint8_t *val)
@@ -248,7 +249,7 @@ static struct i2c_emul_api syv682x_emul_api = {
* @param emul Emulation information
* @param parent Device to emulate
*
- * @return 0 indicating success (always)
+ * @return 0 on success or an error code on failure
*/
static int syv682x_emul_init(const struct emul *emul,
const struct device *parent)
@@ -264,6 +265,10 @@ static int syv682x_emul_init(const struct emul *emul,
memset(data->reg, 0, sizeof(data->reg));
ret = i2c_emul_register(parent, emul->dev_label, &data->emul);
+ if (ret)
+ return ret;
+
+ syv682x_emul_set_alert(data, false);
return ret;
}
@@ -274,6 +279,10 @@ static int syv682x_emul_init(const struct emul *emul,
DT_INST_PROP(n, frs_en_gpio), gpios)), \
.frs_en_gpio_pin = DT_GPIO_PIN( \
DT_INST_PROP(n, frs_en_gpio), gpios), \
+ .alert_gpio_port = DEVICE_DT_GET(DT_GPIO_CTLR( \
+ DT_INST_PROP(n, alert_gpio), gpios)), \
+ .alert_gpio_pin = DT_GPIO_PIN( \
+ DT_INST_PROP(n, alert_gpio), gpios), \
}; \
static const struct syv682x_emul_cfg syv682x_emul_cfg_##n = { \
.i2c_label = DT_INST_BUS_LABEL(n), \
diff --git a/zephyr/include/emul/emul_syv682x.h b/zephyr/include/emul/emul_syv682x.h
index 46580e8257..ebfa094d77 100644
--- a/zephyr/include/emul/emul_syv682x.h
+++ b/zephyr/include/emul/emul_syv682x.h
@@ -24,15 +24,16 @@
#define SYV682X_CONTROL_4_REG 0x04
/* Status Register */
-#define SYV682X_STATUS_OC_HV BIT(7)
-#define SYV682X_STATUS_RVS BIT(6)
-#define SYV682X_STATUS_OC_5V BIT(5)
-#define SYV682X_STATUS_OVP BIT(4)
-#define SYV682X_STATUS_FRS BIT(3)
-#define SYV682X_STATUS_TSD BIT(2)
-#define SYV682X_STATUS_VSAFE_5V BIT(1)
-#define SYV682X_STATUS_VSAFE_0V BIT(0)
-#define SYV682X_STATUS_INT_MASK 0xfc
+#define SYV682X_STATUS_OC_HV BIT(7)
+#define SYV682X_STATUS_RVS BIT(6)
+#define SYV682X_STATUS_OC_5V BIT(5)
+#define SYV682X_STATUS_OVP BIT(4)
+#define SYV682X_STATUS_FRS BIT(3)
+#define SYV682X_STATUS_TSD BIT(2)
+#define SYV682X_STATUS_VSAFE_5V BIT(1)
+#define SYV682X_STATUS_VSAFE_0V BIT(0)
+#define SYV682X_STATUS_INT_MASK 0xfc
+#define SYV682X_STATUS_NONE 0
/* Control Register 1 */
#define SYV682X_CONTROL_1_CH_SEL BIT(1)
@@ -99,6 +100,7 @@
#define SYV682X_CONTROL_4_VCONN_OCP BIT(2)
#define SYV682X_CONTROL_4_CC_FRS BIT(1)
#define SYV682X_CONTROL_4_INT_MASK 0x0c
+#define SYV682X_CONTROL_4_NONE 0
/**
* @brief Get pointer to SYV682x emulator using device tree order number.
@@ -110,24 +112,17 @@
struct i2c_emul *syv682x_emul_get(int ord);
/**
- * @brief Set the underlying interrupt conditions affecting the status register
+ * @brief Set the underlying interrupt conditions affecting the SYV682x
*
- * @param emul SYV682x emulator
- * @param val A status register value corresponding to the underlying
- * conditions
- */
-void syv682x_emul_set_status(struct i2c_emul *emul, uint8_t val);
-
-/**
- * @brief Set the underlying interrupt conditions affecting the control 4
- * register
- *
- * @param emul SYV682x emulator
- * @param val A control 4 register value corresponding to the underlying
- * conditions; only the bits in SYV682X_CONTROL_4_INT_MASK have an
- * effect.
+ * @param emul SYV682x emulator
+ * @param status A status register value corresponding to the underlying
+ * conditions
+ * @param control_4 A control 4 register value corresponding to the underlying
+ * conditions; only the bits in SYV682X_CONTROL_4_INT_MASK have
+ * an effect.
*/
-void syv682x_emul_set_control_4(struct i2c_emul *emul, uint8_t val);
+void syv682x_emul_set_condition(struct i2c_emul *emul, uint8_t status,
+ uint8_t control_4);
/**
* @brief Set value of a register of SYV682x
diff --git a/zephyr/test/drivers/include/gpio_map.h b/zephyr/test/drivers/include/gpio_map.h
index 5253b0155a..35a31119ed 100644
--- a/zephyr/test/drivers/include/gpio_map.h
+++ b/zephyr/test/drivers/include/gpio_map.h
@@ -24,6 +24,7 @@
GPIO_INT(GPIO_USB_C0_TCPC_INT_ODL, GPIO_INT_EDGE_FALLING, \
tcpc_alert_event) \
GPIO_INT(GPIO_USB_C1_TCPC_INT_ODL, GPIO_INT_EDGE_FALLING, \
- tcpc_alert_event)
+ tcpc_alert_event) \
+ GPIO_INT(GPIO_USB_C1_PPC_INT_ODL, GPIO_INT_EDGE_FALLING, ppc_alert)
#endif /* __ZEPHYR_GPIO_MAP_H */
diff --git a/zephyr/test/drivers/overlay.dts b/zephyr/test/drivers/overlay.dts
index fc0ddc0a6e..569dedae78 100644
--- a/zephyr/test/drivers/overlay.dts
+++ b/zephyr/test/drivers/overlay.dts
@@ -84,6 +84,11 @@
enum-name = "GPIO_USB_C1_TCPC_RST_L";
label = "USB_C1_TCPC_RST_L";
};
+ gpio_usb_c1_ppc_int: usb_c1_ppc_int {
+ gpios = <&gpio0 13 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C1_PPC_INT_ODL";
+ label = "GPIO_USB_C1_PPC_INT_ODL";
+ };
};
named-i2c-ports {
compatible = "named-i2c-ports";
@@ -500,6 +505,7 @@
reg = <0x41>;
label = "SYV682X_EMUL";
frs_en_gpio = <&gpio_usb_c1_frs_en>;
+ alert_gpio = <&gpio_usb_c1_ppc_int>;
};
usb_c1_bb_retimer_emul: bbretimer@42 {
@@ -539,7 +545,7 @@
};
&gpio0 {
- ngpios = <13>;
+ ngpios = <14>;
};
&i2c0 {
diff --git a/zephyr/test/drivers/src/ppc.c b/zephyr/test/drivers/src/ppc.c
index 740c7a0aea..cc07402a9d 100644
--- a/zephyr/test/drivers/src/ppc.c
+++ b/zephyr/test/drivers/src/ppc.c
@@ -51,21 +51,20 @@ static void test_ppc_syv682x_interrupt(void)
uint8_t reg;
/* An OC event less than 100 ms should not cause VBUS to turn off. */
- syv682x_emul_set_status(emul, SYV682X_STATUS_OC_5V);
- syv682x_interrupt(syv682x_port);
+ syv682x_emul_set_condition(emul, SYV682X_STATUS_OC_5V,
+ SYV682X_CONTROL_4_NONE);
/* TODO(b/201420132): Simulate passage of time instead of sleeping. */
msleep(50);
- syv682x_interrupt(syv682x_port);
zassert_true(ppc_is_sourcing_vbus(syv682x_port),
"PPC is not sourcing VBUS after 50 ms OC");
/* But one greater than 100 ms should. */
/* TODO(b/201420132): Simulate passage of time instead of sleeping. */
msleep(60);
- syv682x_interrupt(syv682x_port);
zassert_false(ppc_is_sourcing_vbus(syv682x_port),
"PPC is sourcing VBUS after 100 ms OC");
- syv682x_emul_set_status(emul, 0x0);
+ syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
+ SYV682X_CONTROL_4_NONE);
/*
* TODO(b/190519131): Organize the tests to be more hermetic and avoid
* the following issue: The driver triggers overcurrent protection. If
@@ -81,24 +80,26 @@ static void test_ppc_syv682x_interrupt(void)
*/
zassert_ok(ppc_vbus_source_enable(syv682x_port, true),
"Source enable failed");
- syv682x_emul_set_status(emul, SYV682X_STATUS_TSD);
- syv682x_interrupt(syv682x_port);
+ syv682x_emul_set_condition(emul, SYV682X_STATUS_TSD,
+ SYV682X_CONTROL_4_NONE);
/* TODO(b/201420132): Simulate passage of time instead of sleeping. */
msleep(1);
zassert_false(ppc_is_sourcing_vbus(syv682x_port),
"PPC is sourcing power after TSD");
- syv682x_emul_set_status(emul, 0);
+ syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
+ SYV682X_CONTROL_4_NONE);
/* An OVP event should cause the driver to disable the source path. */
zassert_ok(ppc_vbus_source_enable(syv682x_port, true),
"Source enable failed");
- syv682x_emul_set_status(emul, SYV682X_STATUS_OVP);
- syv682x_interrupt(syv682x_port);
+ syv682x_emul_set_condition(emul, SYV682X_STATUS_OVP,
+ SYV682X_CONTROL_4_NONE);
/* TODO(b/201420132): Simulate passage of time instead of sleeping. */
msleep(1);
zassert_false(ppc_is_sourcing_vbus(syv682x_port),
"PPC is sourcing power after OVP");
- syv682x_emul_set_status(emul, 0);
+ syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
+ SYV682X_CONTROL_4_NONE);
/*
* A high-voltage OC while sinking should cause the driver to try to
@@ -107,24 +108,24 @@ static void test_ppc_syv682x_interrupt(void)
*/
zassert_ok(ppc_vbus_sink_enable(syv682x_port, true),
"Sink enable failed");
- syv682x_emul_set_status(emul, SYV682X_STATUS_OC_HV);
- syv682x_interrupt(syv682x_port);
+ syv682x_emul_set_condition(emul, SYV682X_STATUS_OC_HV,
+ SYV682X_CONTROL_4_NONE);
/* TODO(b/201420132): Simulate passage of time instead of sleeping. */
msleep(1);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_1_REG, &reg),
"Reading CONTROL_1 failed");
zassert_equal(reg & SYV682X_CONTROL_1_PWR_ENB, 0,
"Power path disabled after HV_OC handled");
- syv682x_emul_set_status(emul, SYV682X_STATUS_OC_HV);
- syv682x_interrupt(syv682x_port);
+ syv682x_emul_set_condition(emul, SYV682X_STATUS_OC_HV,
+ SYV682X_CONTROL_4_NONE);
/* TODO(b/201420132): Simulate passage of time instead of sleeping. */
msleep(1);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_1_REG, &reg),
"Reading CONTROL_1 failed");
zassert_equal(reg & SYV682X_CONTROL_1_PWR_ENB, 0,
"Power path disabled after HV_OC handled");
- syv682x_emul_set_status(emul, SYV682X_STATUS_OC_HV);
- syv682x_interrupt(syv682x_port);
+ syv682x_emul_set_condition(emul, SYV682X_STATUS_OC_HV,
+ SYV682X_CONTROL_4_NONE);
/* TODO(b/201420132): Simulate passage of time instead of sleeping. */
msleep(1);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_1_REG, &reg),
@@ -132,15 +133,16 @@ static void test_ppc_syv682x_interrupt(void)
zassert_equal(reg & SYV682X_CONTROL_1_PWR_ENB,
SYV682X_CONTROL_1_PWR_ENB,
"Power path enabled after HV_OC handled 3 times");
- syv682x_emul_set_status(emul, 0);
+ syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
+ SYV682X_CONTROL_4_NONE);
/*
* A VCONN OC event less than 100 ms should not cause the driver to turn
* VCONN off.
*/
ppc_set_vconn(syv682x_port, true);
- syv682x_emul_set_control_4(emul, SYV682X_CONTROL_4_VCONN_OCP);
- syv682x_interrupt(syv682x_port);
+ syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
+ SYV682X_CONTROL_4_VCONN_OCP);
/* TODO(b/201420132): Simulate passage of time instead of sleeping. */
msleep(1);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_4_REG, &reg),
@@ -150,9 +152,7 @@ static void test_ppc_syv682x_interrupt(void)
"VCONN disabled after initial VCONN OC");
/* TODO(b/201420132): Simulate passage of time instead of sleeping. */
msleep(50);
- syv682x_interrupt(syv682x_port);
/* TODO(b/201420132): Simulate passage of time instead of sleeping. */
- msleep(1);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_4_REG, &reg),
"Reading CONTROL_4 failed");
zassert_true(reg &
@@ -164,15 +164,14 @@ static void test_ppc_syv682x_interrupt(void)
*/
/* TODO(b/201420132): Simulate passage of time instead of sleeping. */
msleep(60);
- syv682x_interrupt(syv682x_port);
/* TODO(b/201420132): Simulate passage of time instead of sleeping. */
- msleep(1);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_4_REG, &reg),
"Reading CONTROL_4 failed");
zassert_false(reg &
(SYV682X_CONTROL_4_VCONN1 | SYV682X_CONTROL_4_VCONN2),
"VCONN enabled after long VCONN OC");
- syv682x_emul_set_control_4(emul, 0);
+ syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
+ SYV682X_CONTROL_4_NONE);
/*
* A VCONN over-voltage (VBAT_OVP) event will cause the device to
@@ -181,8 +180,8 @@ static void test_ppc_syv682x_interrupt(void)
* driver should then run generic CC over-voltage handling.
*/
ppc_set_vconn(syv682x_port, true);
- syv682x_emul_set_control_4(emul, SYV682X_CONTROL_4_VBAT_OVP);
- syv682x_interrupt(syv682x_port);
+ syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
+ SYV682X_CONTROL_4_VBAT_OVP);
/* TODO(b/201420132): Simulate passage of time instead of sleeping. */
msleep(1);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_4_REG, &reg),
@@ -199,7 +198,8 @@ static void test_ppc_syv682x_interrupt(void)
* to a CC over-voltage event. There is currently no easy way to test
* that a Hard Reset occurred.
*/
- syv682x_emul_set_control_4(emul, 0);
+ syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
+ SYV682X_CONTROL_4_NONE);
}
static void test_ppc_syv682x_frs(void)
@@ -252,13 +252,14 @@ static void test_ppc_syv682x_frs(void)
* An FRS event when the PPC is Sink should cause the PPC to switch from
* Sink to Source.
*/
- syv682x_emul_set_status(emul, SYV682X_STATUS_FRS);
- syv682x_interrupt(syv682x_port);
+ syv682x_emul_set_condition(emul, SYV682X_STATUS_FRS,
+ SYV682X_CONTROL_4_NONE);
/* TODO(b/201420132): Simulate passage of time instead of sleeping. */
msleep(1);
zassert_true(ppc_is_sourcing_vbus(syv682x_port),
"PPC is not sourcing VBUS after FRS signal handled");
- syv682x_emul_set_status(emul, 0);
+ syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
+ SYV682X_CONTROL_4_NONE);
}
diff --git a/zephyr/test/drivers/src/stubs.c b/zephyr/test/drivers/src/stubs.c
index 68aab8ba12..00c7322b42 100644
--- a/zephyr/test/drivers/src/stubs.c
+++ b/zephyr/test/drivers/src/stubs.c
@@ -307,6 +307,17 @@ void tcpc_alert_event(enum gpio_signal signal)
schedule_deferred_pd_interrupt(port);
}
+void ppc_alert(enum gpio_signal signal)
+{
+ switch (signal) {
+ case GPIO_USB_C1_PPC_INT_ODL:
+ syv682x_interrupt(USBC_PORT_C1);
+ break;
+ default:
+ return;
+ }
+}
+
/* TODO: This code should really be generic, and run based on something in
* the dts.
*/
@@ -328,5 +339,8 @@ static void usbc_interrupt_init(void)
gpio_set_level(GPIO_USB_C1_TCPC_RST_L, 0);
msleep(PS8XXX_RESET_DELAY_MS);
gpio_set_level(GPIO_USB_C1_TCPC_RST_L, 1);
+
+ /* Enable PPC interrupts. */
+ gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL);
}
DECLARE_HOOK(HOOK_INIT, usbc_interrupt_init, HOOK_PRIO_INIT_I2C + 1);