summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbe Levkoy <alevkoy@chromium.org>2022-06-03 11:23:24 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-08 15:09:06 +0000
commit3739d05673b6b242f0d3a9989eec8de76bb2f3c9 (patch)
treedf414e76a55f710d930ab29cab24cbc7fe23b81d
parent068e479a7adaaae214bb2915df1acf6be1247994 (diff)
downloadchrome-ec-3739d05673b6b242f0d3a9989eec8de76bb2f3c9.tar.gz
zephyr test: Format ppc_syv682c.c
Run clang-format on this test. BUG=b:234886404 TEST=zmake testall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Id111469a400bf60a48b8e0492db9c373ced97d11 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3689797 Reviewed-by: Yuval Peress <peress@google.com>
-rw-r--r--zephyr/test/drivers/src/ppc_syv682c.c293
1 files changed, 148 insertions, 145 deletions
diff --git a/zephyr/test/drivers/src/ppc_syv682c.c b/zephyr/test/drivers/src/ppc_syv682c.c
index 9707f374ac..5a4a72ab4f 100644
--- a/zephyr/test/drivers/src/ppc_syv682c.c
+++ b/zephyr/test/drivers/src/ppc_syv682c.c
@@ -39,7 +39,7 @@ static void syv682x_test_after(void *data)
ARG_UNUSED(data);
syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
/* Clear the mock read/write functions */
i2c_common_emul_set_read_func(emul, NULL, NULL);
@@ -66,14 +66,14 @@ static void check_control_1_default_init(uint8_t control_1)
int ilim;
zassert_true(control_1 & SYV682X_CONTROL_1_PWR_ENB,
- "Default init, but power path enabled");
+ "Default init, but power path enabled");
ilim = (control_1 & SYV682X_HV_ILIM_MASK) >> SYV682X_HV_ILIM_BIT_SHIFT;
zassert_equal(ilim, CONFIG_PLATFORM_EC_USBC_PPC_SYV682X_HV_ILIM,
- "Default init, but HV current limit set to %d", ilim);
+ "Default init, but HV current limit set to %d", ilim);
zassert_false(control_1 & SYV682X_CONTROL_1_HV_DR,
- "Default init, but source mode selected");
+ "Default init, but source mode selected");
zassert_true(control_1 & SYV682X_CONTROL_1_CH_SEL,
- "Default init, but 5V power path selected");
+ "Default init, but 5V power path selected");
}
ZTEST(ppc_syv682c, test_syv682x_init)
@@ -89,38 +89,41 @@ ZTEST(ppc_syv682c, test_syv682x_init)
* driver should keep that going..
*/
zassert_ok(syv682x_emul_set_reg(emul, SYV682X_CONTROL_1_REG,
- SYV682X_CONTROL_1_CH_SEL), NULL);
+ SYV682X_CONTROL_1_CH_SEL),
+ NULL);
syv682x_emul_set_condition(emul, SYV682X_STATUS_VSAFE_5V,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
zassert_ok(ppc_init(syv682x_port), "PPC init failed");
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_1_REG, &reg),
- NULL);
+ NULL);
zassert_true(reg & SYV682X_CONTROL_1_CH_SEL,
- "Dead battery init, but CH_SEL set to 5V power path");
- zassert_false(reg &
- (SYV682X_CONTROL_1_PWR_ENB | SYV682X_CONTROL_1_HV_DR),
- "Dead battery init, but CONTROL_1 is 0x%x", reg);
+ "Dead battery init, but CH_SEL set to 5V power path");
+ zassert_false(reg & (SYV682X_CONTROL_1_PWR_ENB |
+ SYV682X_CONTROL_1_HV_DR),
+ "Dead battery init, but CONTROL_1 is 0x%x", reg);
zassert_false(ppc_is_sourcing_vbus(syv682x_port),
- "Dead battery init, but VBUS source enabled");
+ "Dead battery init, but VBUS source enabled");
/* With VBUS at vSafe0V, init should set the default configuration. */
zassert_ok(syv682x_emul_set_reg(emul, SYV682X_CONTROL_1_REG,
- SYV682X_CONTROL_1_PWR_ENB), NULL);
+ SYV682X_CONTROL_1_PWR_ENB),
+ NULL);
syv682x_emul_set_condition(emul, SYV682X_STATUS_VSAFE_0V,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
zassert_ok(ppc_init(syv682x_port), "PPC init failed");
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_1_REG, &reg),
- NULL);
+ NULL);
check_control_1_default_init(reg);
/* With sink disabled, init should do the same thing. */
zassert_ok(syv682x_emul_set_reg(emul, SYV682X_CONTROL_1_REG,
- SYV682X_CONTROL_1_CH_SEL), NULL);
+ SYV682X_CONTROL_1_CH_SEL),
+ NULL);
syv682x_emul_set_condition(emul, SYV682X_STATUS_VSAFE_0V,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
zassert_ok(ppc_init(syv682x_port), "PPC init failed");
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_1_REG, &reg),
- NULL);
+ NULL);
check_control_1_default_init(reg);
/*
@@ -129,33 +132,36 @@ ZTEST(ppc_syv682c, test_syv682x_init)
* voltage, and discharge parameters appropriately, and enable CC lines.
*/
zassert_equal(gpio_emul_output_get(gpio_dev, GPIO_USB_C1_FRS_EN_PORT),
- 0, "FRS enabled, but FRS GPIO not asserted");
+ 0, "FRS enabled, but FRS GPIO not asserted");
ilim = (reg & SYV682X_5V_ILIM_MASK) >> SYV682X_5V_ILIM_BIT_SHIFT;
zassert_equal(ilim, CONFIG_PLATFORM_EC_USB_PD_PULLUP,
- "Default init, but 5V current limit set to %d", ilim);
+ "Default init, but 5V current limit set to %d", ilim);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_2_REG, &reg),
- NULL);
- zassert_equal(reg, (SYV682X_OC_DELAY_10MS << SYV682X_OC_DELAY_SHIFT) |
- (SYV682X_DSG_RON_200_OHM << SYV682X_DSG_RON_SHIFT) |
- (SYV682X_DSG_TIME_50MS << SYV682X_DSG_TIME_SHIFT),
- "Default init, but CONTROL_2 is 0x%x", reg);
+ NULL);
+ zassert_equal(reg,
+ (SYV682X_OC_DELAY_10MS << SYV682X_OC_DELAY_SHIFT) |
+ (SYV682X_DSG_RON_200_OHM
+ << SYV682X_DSG_RON_SHIFT) |
+ (SYV682X_DSG_TIME_50MS << SYV682X_DSG_TIME_SHIFT),
+ "Default init, but CONTROL_2 is 0x%x", reg);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_3_REG, &reg),
- NULL);
- zassert_equal(reg, (SYV682X_OVP_23_7 << SYV682X_OVP_BIT_SHIFT) |
- SYV682X_RVS_MASK,
- "Default init, but CONTROL_3 is 0x%x", reg);
+ NULL);
+ zassert_equal(reg,
+ (SYV682X_OVP_23_7 << SYV682X_OVP_BIT_SHIFT) |
+ SYV682X_RVS_MASK,
+ "Default init, but CONTROL_3 is 0x%x", reg);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_4_REG, &reg),
- NULL);
+ NULL);
zassert_equal(reg & ~SYV682X_CONTROL_4_INT_MASK,
- SYV682X_CONTROL_4_CC1_BPS | SYV682X_CONTROL_4_CC2_BPS,
- "Default init, but CONTROL_4 is 0x%x", reg);
+ SYV682X_CONTROL_4_CC1_BPS | SYV682X_CONTROL_4_CC2_BPS,
+ "Default init, but CONTROL_4 is 0x%x", reg);
/* Disable the power path again. */
zassert_ok(syv682x_emul_set_reg(emul, SYV682X_CONTROL_1_REG,
- SYV682X_CONTROL_1_PWR_ENB), NULL);
+ SYV682X_CONTROL_1_PWR_ENB),
+ NULL);
syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
- SYV682X_CONTROL_4_NONE);
-
+ SYV682X_CONTROL_4_NONE);
}
ZTEST(ppc_syv682c, test_syv682x_vbus_enable)
@@ -164,20 +170,20 @@ ZTEST(ppc_syv682c, test_syv682x_vbus_enable)
uint8_t reg;
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_1_REG, &reg),
- "Reading CONTROL_1 failed");
+ "Reading CONTROL_1 failed");
zassert_not_equal(reg & SYV682X_CONTROL_1_PWR_ENB,
SYV682X_CONTROL_1_PWR_ENB, "VBUS sourcing disabled");
zassert_false(ppc_is_sourcing_vbus(syv682x_port),
- "PPC sourcing VBUS at beginning of test");
+ "PPC sourcing VBUS at beginning of test");
zassert_ok(ppc_vbus_source_enable(syv682x_port, true),
- "VBUS enable failed");
+ "VBUS enable failed");
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_1_REG, &reg),
- "Reading CONTROL_1 failed");
+ "Reading CONTROL_1 failed");
zassert_equal(reg & SYV682X_CONTROL_1_PWR_ENB, 0,
- "VBUS sourcing disabled");
+ "VBUS sourcing disabled");
zassert_true(ppc_is_sourcing_vbus(syv682x_port),
- "PPC is not sourcing VBUS after VBUS enabled");
+ "PPC is not sourcing VBUS after VBUS enabled");
}
ZTEST(ppc_syv682c, test_syv682x_interrupt)
@@ -189,17 +195,17 @@ ZTEST(ppc_syv682c, test_syv682x_interrupt)
"VBUS enable failed");
/* An OC event less than 100 ms should not cause VBUS to turn off. */
syv682x_emul_set_condition(emul, SYV682X_STATUS_OC_5V,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
msleep(50);
zassert_true(ppc_is_sourcing_vbus(syv682x_port),
- "PPC is not sourcing VBUS after 50 ms OC");
+ "PPC is not sourcing VBUS after 50 ms OC");
/* But one greater than 100 ms should. */
msleep(60);
zassert_false(ppc_is_sourcing_vbus(syv682x_port),
- "PPC is sourcing VBUS after 100 ms OC");
+ "PPC is sourcing VBUS after 100 ms OC");
syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
- SYV682X_CONTROL_4_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
@@ -214,25 +220,25 @@ ZTEST(ppc_syv682c, test_syv682x_interrupt)
* the sink path is not part of the driver's API.
*/
zassert_ok(ppc_vbus_source_enable(syv682x_port, true),
- "Source enable failed");
+ "Source enable failed");
syv682x_emul_set_condition(emul, SYV682X_STATUS_TSD,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
msleep(1);
zassert_false(ppc_is_sourcing_vbus(syv682x_port),
- "PPC is sourcing power after TSD");
+ "PPC is sourcing power after TSD");
syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
- SYV682X_CONTROL_4_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");
+ "Source enable failed");
syv682x_emul_set_condition(emul, SYV682X_STATUS_OVP,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
msleep(1);
zassert_false(ppc_is_sourcing_vbus(syv682x_port),
- "PPC is sourcing power after OVP");
+ "PPC is sourcing power after OVP");
syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
/*
* A high-voltage OC while sinking should cause the driver to try to
@@ -240,33 +246,33 @@ ZTEST(ppc_syv682c, test_syv682x_interrupt)
* point the driver should leave it disabled.
*/
zassert_ok(ppc_vbus_sink_enable(syv682x_port, true),
- "Sink enable failed");
+ "Sink enable failed");
syv682x_emul_set_condition(emul, SYV682X_STATUS_OC_HV,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
msleep(1);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_1_REG, &reg),
- "Reading CONTROL_1 failed");
+ "Reading CONTROL_1 failed");
zassert_equal(reg & SYV682X_CONTROL_1_PWR_ENB, 0,
- "Power path disabled after HV_OC handled");
+ "Power path disabled after HV_OC handled");
syv682x_emul_set_condition(emul, SYV682X_STATUS_OC_HV,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
/* Alert GPIO doesn't change so wait for delayed syv682x interrupt */
msleep(15);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_1_REG, &reg),
- "Reading CONTROL_1 failed");
+ "Reading CONTROL_1 failed");
zassert_equal(reg & SYV682X_CONTROL_1_PWR_ENB, 0,
- "Power path disabled after HV_OC handled");
+ "Power path disabled after HV_OC handled");
syv682x_emul_set_condition(emul, SYV682X_STATUS_OC_HV,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
/* Alert GPIO doesn't change so wait for delayed syv682x interrupt */
msleep(15);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_1_REG, &reg),
- "Reading CONTROL_1 failed");
+ "Reading CONTROL_1 failed");
zassert_equal(reg & SYV682X_CONTROL_1_PWR_ENB,
- SYV682X_CONTROL_1_PWR_ENB,
- "Power path enabled after HV_OC handled 3 times");
+ SYV682X_CONTROL_1_PWR_ENB,
+ "Power path enabled after HV_OC handled 3 times");
syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
/*
* A VCONN OC event less than 100 ms should not cause the driver to turn
@@ -274,31 +280,31 @@ ZTEST(ppc_syv682c, test_syv682x_interrupt)
*/
ppc_set_vconn(syv682x_port, true);
syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
- SYV682X_CONTROL_4_VCONN_OCP);
+ SYV682X_CONTROL_4_VCONN_OCP);
msleep(1);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_4_REG, &reg),
- "Reading CONTROL_4 failed");
- zassert_true(reg &
- (SYV682X_CONTROL_4_VCONN1 | SYV682X_CONTROL_4_VCONN2),
- "VCONN disabled after initial VCONN OC");
+ "Reading CONTROL_4 failed");
+ zassert_true(reg & (SYV682X_CONTROL_4_VCONN1 |
+ SYV682X_CONTROL_4_VCONN2),
+ "VCONN disabled after initial VCONN OC");
msleep(50);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_4_REG, &reg),
- "Reading CONTROL_4 failed");
- zassert_true(reg &
- (SYV682X_CONTROL_4_VCONN1 | SYV682X_CONTROL_4_VCONN2),
- "VCONN disabled after short VCONN OC");
+ "Reading CONTROL_4 failed");
+ zassert_true(reg & (SYV682X_CONTROL_4_VCONN1 |
+ SYV682X_CONTROL_4_VCONN2),
+ "VCONN disabled after short VCONN OC");
/*
* But if the event keeps going for over 100 ms continuously, the driver
* should turn VCONN off.
*/
msleep(60);
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");
+ "Reading CONTROL_4 failed");
+ zassert_false(reg & (SYV682X_CONTROL_4_VCONN1 |
+ SYV682X_CONTROL_4_VCONN2),
+ "VCONN enabled after long VCONN OC");
syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
/*
* A VCONN over-voltage (VBAT_OVP) event will cause the device to
@@ -308,24 +314,24 @@ ZTEST(ppc_syv682c, test_syv682x_interrupt)
*/
ppc_set_vconn(syv682x_port, true);
syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
- SYV682X_CONTROL_4_VBAT_OVP);
+ SYV682X_CONTROL_4_VBAT_OVP);
msleep(1);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_4_REG, &reg),
- "Reading CONTROL_4 failed");
+ "Reading CONTROL_4 failed");
zassert_true(reg & SYV682X_CONTROL_4_CC1_BPS,
- "CC1 disabled after handling VBAT_OVP");
+ "CC1 disabled after handling VBAT_OVP");
zassert_true(reg & SYV682X_CONTROL_4_CC2_BPS,
- "CC2 disabled after handling VBAT_OVP");
- zassert_false(reg &
- (SYV682X_CONTROL_4_VCONN1 | SYV682X_CONTROL_4_VCONN2),
- "VCONN enabled after handling VBAT_OVP");
+ "CC2 disabled after handling VBAT_OVP");
+ zassert_false(reg & (SYV682X_CONTROL_4_VCONN1 |
+ SYV682X_CONTROL_4_VCONN2),
+ "VCONN enabled after handling VBAT_OVP");
/*
* TODO(b/190519131): The PD stack should generate a Reset in response
* to a CC over-voltage event. There is currently no easy way to test
* that a Hard Reset occurred.
*/
syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
}
ZTEST(ppc_syv682c, test_syv682x_frs)
@@ -341,50 +347,47 @@ ZTEST(ppc_syv682c, test_syv682x_frs)
*/
ppc_vbus_sink_enable(syv682x_port, true);
zassert_false(ppc_is_sourcing_vbus(syv682x_port),
- "PPC is sourcing VBUS after sink enabled");
+ "PPC is sourcing VBUS after sink enabled");
ppc_set_polarity(syv682x_port, 0 /* CC1 */);
ppc_set_frs_enable(syv682x_port, true);
zassert_equal(gpio_emul_output_get(gpio_dev, GPIO_USB_C1_FRS_EN_PORT),
- 1, "FRS enabled, but FRS GPIO not asserted");
+ 1, "FRS enabled, but FRS GPIO not asserted");
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_4_REG, &reg),
- "Reading CONTROL_4 failed");
- zassert_equal(reg &
- (SYV682X_CONTROL_4_CC1_BPS | SYV682X_CONTROL_4_CC2_BPS),
- SYV682X_CONTROL_4_CC1_BPS,
- "FRS enabled with CC1 polarity, but CONTROL_4 is 0x%x",
- reg);
+ "Reading CONTROL_4 failed");
+ zassert_equal(
+ reg & (SYV682X_CONTROL_4_CC1_BPS | SYV682X_CONTROL_4_CC2_BPS),
+ SYV682X_CONTROL_4_CC1_BPS,
+ "FRS enabled with CC1 polarity, but CONTROL_4 is 0x%x", reg);
ppc_set_frs_enable(syv682x_port, false);
zassert_equal(gpio_emul_output_get(gpio_dev, GPIO_USB_C1_FRS_EN_PORT),
- 0, "FRS disabled, but FRS GPIO not deasserted");
+ 0, "FRS disabled, but FRS GPIO not deasserted");
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_4_REG, &reg),
- "Reading CONTROL_4 failed");
- zassert_equal(reg &
- (SYV682X_CONTROL_4_CC1_BPS | SYV682X_CONTROL_4_CC2_BPS),
- SYV682X_CONTROL_4_CC1_BPS | SYV682X_CONTROL_4_CC2_BPS,
- "FRS enabled with CC1 polarity, but CONTROL_4 is 0x%x",
- reg);
+ "Reading CONTROL_4 failed");
+ zassert_equal(
+ reg & (SYV682X_CONTROL_4_CC1_BPS | SYV682X_CONTROL_4_CC2_BPS),
+ SYV682X_CONTROL_4_CC1_BPS | SYV682X_CONTROL_4_CC2_BPS,
+ "FRS enabled with CC1 polarity, but CONTROL_4 is 0x%x", reg);
ppc_set_polarity(syv682x_port, 1 /* CC2 */);
ppc_set_frs_enable(syv682x_port, true);
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_4_REG, &reg),
- "Reading CONTROL_4 failed");
- zassert_equal(reg &
- (SYV682X_CONTROL_4_CC1_BPS | SYV682X_CONTROL_4_CC2_BPS),
- SYV682X_CONTROL_4_CC2_BPS,
- "FRS enabled with CC2 polarity, but CONTROL_4 is 0x%x",
- reg);
+ "Reading CONTROL_4 failed");
+ zassert_equal(
+ reg & (SYV682X_CONTROL_4_CC1_BPS | SYV682X_CONTROL_4_CC2_BPS),
+ SYV682X_CONTROL_4_CC2_BPS,
+ "FRS enabled with CC2 polarity, but CONTROL_4 is 0x%x", reg);
/*
* An FRS event when the PPC is Sink should cause the PPC to switch from
* Sink to Source.
*/
syv682x_emul_set_condition(emul, SYV682X_STATUS_FRS,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
msleep(1);
zassert_true(ppc_is_sourcing_vbus(syv682x_port),
- "PPC is not sourcing VBUS after FRS signal handled");
+ "PPC is not sourcing VBUS after FRS signal handled");
syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
}
ZTEST(ppc_syv682c, test_syv682x_source_current_limit)
@@ -394,31 +397,31 @@ ZTEST(ppc_syv682c, test_syv682x_source_current_limit)
int ilim_val;
zassert_ok(ppc_set_vbus_source_current_limit(syv682x_port,
- TYPEC_RP_USB),
- "Could not set source current limit");
+ TYPEC_RP_USB),
+ "Could not set source current limit");
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_1_REG, &reg),
- "Reading CONTROL_1 failed");
+ "Reading CONTROL_1 failed");
ilim_val = (reg & SYV682X_5V_ILIM_MASK) >> SYV682X_5V_ILIM_BIT_SHIFT;
zassert_equal(reg & SYV682X_5V_ILIM_MASK, SYV682X_5V_ILIM_1_25,
- "Set USB Rp value, but 5V_ILIM is %d", ilim_val);
+ "Set USB Rp value, but 5V_ILIM is %d", ilim_val);
zassert_ok(ppc_set_vbus_source_current_limit(syv682x_port,
- TYPEC_RP_1A5),
- "Could not set source current limit");
+ TYPEC_RP_1A5),
+ "Could not set source current limit");
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_1_REG, &reg),
- "Reading CONTROL_1 failed");
+ "Reading CONTROL_1 failed");
ilim_val = (reg & SYV682X_5V_ILIM_MASK) >> SYV682X_5V_ILIM_BIT_SHIFT;
zassert_equal(ilim_val, SYV682X_5V_ILIM_1_75,
- "Set 1.5A Rp value, but 5V_ILIM is %d", ilim_val);
+ "Set 1.5A Rp value, but 5V_ILIM is %d", ilim_val);
zassert_ok(ppc_set_vbus_source_current_limit(syv682x_port,
- TYPEC_RP_3A0),
- "Could not set source current limit");
+ TYPEC_RP_3A0),
+ "Could not set source current limit");
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_1_REG, &reg),
- "Reading CONTROL_1 failed");
+ "Reading CONTROL_1 failed");
ilim_val = (reg & SYV682X_5V_ILIM_MASK) >> SYV682X_5V_ILIM_BIT_SHIFT;
zassert_equal(ilim_val, SYV682X_5V_ILIM_3_30,
- "Set 3.0A Rp value, but 5V_ILIM is %d", ilim_val);
+ "Set 3.0A Rp value, but 5V_ILIM is %d", ilim_val);
}
ZTEST(ppc_syv682c, test_syv682x_write_busy)
@@ -434,10 +437,10 @@ ZTEST(ppc_syv682c, test_syv682x_write_busy)
*/
syv682x_emul_set_busy_reads(emul, 1000);
zassert_equal(ppc_set_vbus_source_current_limit(syv682x_port,
- TYPEC_RP_USB),
- EC_ERROR_TIMEOUT, "SYV682 busy, but write completed");
+ TYPEC_RP_USB),
+ EC_ERROR_TIMEOUT, "SYV682 busy, but write completed");
zassert_ok(ppc_set_frs_enable(syv682x_port, false),
- "Could not set CONTROL_4 while busy on SYV682C");
+ "Could not set CONTROL_4 while busy on SYV682C");
/*
* If the busy bit clears before the driver reaches its timeout, the
@@ -445,8 +448,8 @@ ZTEST(ppc_syv682c, test_syv682x_write_busy)
*/
syv682x_emul_set_busy_reads(emul, 1);
zassert_equal(ppc_set_vbus_source_current_limit(syv682x_port,
- TYPEC_RP_USB), 0,
- "SYV682 not busy, but write failed");
+ TYPEC_RP_USB),
+ 0, "SYV682 not busy, but write failed");
syv682x_emul_set_busy_reads(emul, 0);
}
@@ -457,21 +460,21 @@ ZTEST(ppc_syv682c, test_syv682x_dev_is_connected)
uint8_t reg;
zassert_ok(ppc_dev_is_connected(syv682x_port, PPC_DEV_SRC),
- "Could not connect device as source");
+ "Could not connect device as source");
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_2_REG, &reg),
- "Reading CONTROL_2 failed");
+ "Reading CONTROL_2 failed");
zassert_false(reg & SYV682X_CONTROL_2_FDSG,
- "Connected as source, but force discharge enabled");
+ "Connected as source, but force discharge enabled");
zassert_ok(ppc_dev_is_connected(syv682x_port, PPC_DEV_DISCONNECTED),
- "Could not disconnect device");
+ "Could not disconnect device");
zassert_ok(syv682x_emul_get_reg(emul, SYV682X_CONTROL_2_REG, &reg),
- "Reading CONTROL_2 failed");
+ "Reading CONTROL_2 failed");
zassert_true(reg & SYV682X_CONTROL_2_FDSG,
- "Disconnected, but force discharge disabled");
+ "Disconnected, but force discharge disabled");
zassert_ok(ppc_dev_is_connected(syv682x_port, PPC_DEV_SNK),
- "Could not connect device as source");
+ "Could not connect device as source");
}
ZTEST(ppc_syv682c, test_syv682x_vbus_sink_enable)
@@ -522,7 +525,7 @@ ZTEST(ppc_syv682c, test_syv682x_vbus_sink_oc_limit)
struct i2c_emul *emul = syv682x_emul_get(SYV682X_ORD);
zassert_ok(ppc_vbus_sink_enable(syv682x_port, true),
- "Sink enable failed");
+ "Sink enable failed");
/* Generate 4 consecutive sink over-current interrupts. After reaching
* this count, the driver should prevent sink enable until the count is
@@ -530,21 +533,21 @@ ZTEST(ppc_syv682c, test_syv682x_vbus_sink_oc_limit)
*/
for (int i = 0; i < 4; ++i) {
syv682x_emul_set_condition(emul, SYV682X_STATUS_OC_HV,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
msleep(15);
}
syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
- SYV682X_CONTROL_4_NONE);
+ SYV682X_CONTROL_4_NONE);
zassert_not_equal(ppc_vbus_sink_enable(syv682x_port, true), EC_SUCCESS,
- "VBUS sink enable succeeded after 4 OC events");
+ "VBUS sink enable succeeded after 4 OC events");
zassert_ok(ppc_vbus_sink_enable(syv682x_port, false),
- "Sink disable failed");
+ "Sink disable failed");
zassert_ok(ppc_vbus_sink_enable(syv682x_port, true),
- "Sink enable failed");
+ "Sink enable failed");
zassert_ok(ppc_vbus_sink_enable(syv682x_port, false),
- "Sink disable failed");
+ "Sink disable failed");
}
ZTEST(ppc_syv682c, test_syv682x_set_vconn)
@@ -552,9 +555,9 @@ ZTEST(ppc_syv682c, test_syv682x_set_vconn)
struct i2c_emul *emul = syv682x_emul_get(SYV682X_ORD);
syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
- SYV682X_CONTROL_4_VBAT_OVP);
+ SYV682X_CONTROL_4_VBAT_OVP);
zassert_not_equal(ppc_set_vconn(syv682x_port, true), EC_SUCCESS,
- "VBAT OVP, but ppc_set_vconn succeeded");
+ "VBAT OVP, but ppc_set_vconn succeeded");
}
ZTEST(ppc_syv682c, test_syv682x_ppc_dump)