summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Massey <aaronmassey@google.com>2022-05-04 17:16:03 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-05-11 17:50:06 +0000
commite1e8002afea491d39fca3a138ad0ad9e01bd8de0 (patch)
tree5ac50892e90fa56651903cadd59f630d33a03715
parent200542008dca0aba2490e9993333be430b5fda6f (diff)
downloadchrome-ec-e1e8002afea491d39fca3a138ad0ad9e01bd8de0.tar.gz
emul: Partner data arg tcpci_snk_emul_init_data
The tcpci_partner_data will be accessed via the tcpci_snk_emul_data struct inside the tcpci emul sink partner hard reset handler. Add the tcpci_partner_data struct field to the tcpci_snk_emul_data struct and add it as a parameter to the tcpci_snk_emul_init_data function. BRANCH=none BUG=b:230656752 TEST=zmake test test-drivers Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: If7425474c8c301e1c075a45be1555568ffb92dad Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3626073 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_partner_drp.c2
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_partner_faulty_snk.c2
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_partner_snk.c7
-rw-r--r--zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h6
4 files changed, 11 insertions, 6 deletions
diff --git a/zephyr/emul/tcpc/emul_tcpci_partner_drp.c b/zephyr/emul/tcpc/emul_tcpci_partner_drp.c
index 659faad1fb..91d26a1a45 100644
--- a/zephyr/emul/tcpc/emul_tcpci_partner_drp.c
+++ b/zephyr/emul/tcpc/emul_tcpci_partner_drp.c
@@ -299,7 +299,7 @@ void tcpci_drp_emul_init_with_pd_role(struct tcpci_drp_emul *emul,
emul->data.sink = power_role == PD_ROLE_SINK;
emul->data.in_pwr_swap = false;
tcpci_src_emul_init_data(&emul->src_data, &emul->common_data);
- tcpci_snk_emul_init_data(&emul->snk_data);
+ tcpci_snk_emul_init_data(&emul->snk_data, &emul->common_data);
/* Add dual role bit to sink and source PDOs */
emul->src_data.pdo[0] |= PDO_FIXED_DUAL_ROLE;
diff --git a/zephyr/emul/tcpc/emul_tcpci_partner_faulty_snk.c b/zephyr/emul/tcpc/emul_tcpci_partner_faulty_snk.c
index 7e0c15e501..ce81965395 100644
--- a/zephyr/emul/tcpc/emul_tcpci_partner_faulty_snk.c
+++ b/zephyr/emul/tcpc/emul_tcpci_partner_faulty_snk.c
@@ -272,5 +272,5 @@ void tcpci_faulty_snk_emul_init(struct tcpci_faulty_snk_emul *emul)
emul->ops.disconnect = tcpci_faulty_snk_emul_disconnect_op;
tcpci_faulty_snk_emul_init_data(&emul->data);
- tcpci_snk_emul_init_data(&emul->snk_data);
+ tcpci_snk_emul_init_data(&emul->snk_data, &emul->common_data);
}
diff --git a/zephyr/emul/tcpc/emul_tcpci_partner_snk.c b/zephyr/emul/tcpc/emul_tcpci_partner_snk.c
index f9cab652c8..ee7728f15c 100644
--- a/zephyr/emul/tcpc/emul_tcpci_partner_snk.c
+++ b/zephyr/emul/tcpc/emul_tcpci_partner_snk.c
@@ -546,7 +546,8 @@ int tcpci_snk_emul_connect_to_tcpci(struct tcpci_snk_emul_data *data,
}
/** Check description in emul_tcpci_snk.h */
-void tcpci_snk_emul_init_data(struct tcpci_snk_emul_data *data)
+void tcpci_snk_emul_init_data(struct tcpci_snk_emul_data *data,
+ struct tcpci_partner_data *common_data)
{
/* By default there is only PDO 5v@500mA */
data->pdo[0] = PDO_FIXED(5000, 500, 0);
@@ -556,7 +557,7 @@ void tcpci_snk_emul_init_data(struct tcpci_snk_emul_data *data)
data->wait_for_ps_rdy = false;
data->pd_completed = false;
-
+ data->common_data = common_data;
}
/** Check description in emul_tcpci_partner_snk.h */
@@ -574,5 +575,5 @@ void tcpci_snk_emul_init(struct tcpci_snk_emul *emul, enum pd_rev_type rev)
emul->ops.control_change = NULL;
emul->ops.disconnect = tcpci_snk_emul_disconnect_op;
- tcpci_snk_emul_init_data(&emul->data);
+ tcpci_snk_emul_init_data(&emul->data, &emul->common_data);
}
diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h
index 35d9b4fda3..743cfb1573 100644
--- a/zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h
+++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h
@@ -29,6 +29,8 @@
/** Structure describing sink device emulator data */
struct tcpci_snk_emul_data {
+ /** Pointer to common TCPCI partner data */
+ struct tcpci_partner_data *common_data;
/** Power data objects returned in sink capabilities message */
uint32_t pdo[PDO_MAX_OBJECTS];
/** Emulator is waiting for PS RDY message */
@@ -65,8 +67,10 @@ void tcpci_snk_emul_init(struct tcpci_snk_emul *emul, enum pd_rev_type rev);
* created and all flags are cleared.
*
* @param data Pointer to USB-C sink device emulator data
+ * @param common_data Pointer to common TCPCI partner data
*/
-void tcpci_snk_emul_init_data(struct tcpci_snk_emul_data *data);
+void tcpci_snk_emul_init_data(struct tcpci_snk_emul_data *data,
+ struct tcpci_partner_data *common_data);
/**
* @brief Connect emulated device to TCPCI