diff options
author | YH Lin <yueherngl@google.com> | 2022-11-30 21:44:08 +0000 |
---|---|---|
committer | YH Lin <yueherngl@google.com> | 2022-11-30 21:44:08 +0000 |
commit | af25602b15b22b9ef5821dcba9934311f2157c48 (patch) | |
tree | d0c89ae8814c2ba35c238c6c0644ec6b1602c63a /zephyr/include/emul | |
parent | 54462f034b635260dd09173b3d082e47fc960ef3 (diff) | |
parent | aa40b859b3a73e5a205bc561c1a29eff38485461 (diff) | |
download | chrome-ec-af25602b15b22b9ef5821dcba9934311f2157c48.tar.gz |
Merge remote-tracking branch cros/main into factory-brya-14517.B-main
Generated by: util/update_release_branch.py --baseboard brya --relevant_paths_file
baseboard/brya/relevant-paths.txt factory-brya-14517.B-main
Relevant changes:
git log --oneline 54462f034b..aa40b859b3 -- baseboard/brya board/agah
board/anahera board/banshee board/brya board/crota board/felwinter
board/gimble board/kano board/mithrax board/osiris board/primus
board/redrix board/taeko board/taniks board/vell board/volmar
driver/bc12/pi3usb9201_public.* driver/charger/bq25710.*
driver/ppc/nx20p348x.* driver/ppc/syv682x_public.*
driver/retimer/bb_retimer_public.* driver/tcpm/nct38xx.*
driver/tcpm/ps8xxx_public.* driver/tcpm/tcpci.* include/power/alderlake*
include/intel_x86.h power/alderlake* power/intel_x86.c
util/getversion.sh
e6da633c38 driver: Sort header files
234a87ae2d tcpci: Add FRS enable to driver structure
a56be59ccd tcpm_header: add test for tcpm_dump_registers
57b3256963 Rename CONFIG_CHARGER_INPUT_CURRENT to _CHARGER_DEFAULT_CURRENT_LIMIT
e420c8ff9a marasov: Modify TypeC and TypeA configuration.
43b53e0045 Add default implementation of board_set_charge_limit
b75dc90677 Add CONFIG_CHARGER_MIN_INPUT_CURRENT_LIMIT
f1b563c350 baseboard: Sort header files
7d01b1e58d driver/retimer/ps8818.h: Add I2C ADDR FLAGS 0x30, 0x58, 0x70
ec31407993 Add CONFIG_CHARGER_INPUT_CURRENT_DERATE_PCT
8f89f69a5b crota: disable lid angle sensor for clamshell
BRANCH=None
BUG=b:259002141 b:255184961 b:247100970 b:259354679 b:260630630
BUG=b:163093572 b:254328661
TEST=`emerge-brya chromeos-ec`
Force-Relevant-Builds: all
Change-Id: Ia85a701fbf6b8e67ec214b9e25e0e55e980a6f47
Signed-off-by: YH Lin <yueherngl@google.com>
Diffstat (limited to 'zephyr/include/emul')
-rw-r--r-- | zephyr/include/emul/emul_isl923x.h | 2 | ||||
-rw-r--r-- | zephyr/include/emul/emul_kb_raw.h | 2 | ||||
-rw-r--r-- | zephyr/include/emul/emul_ln9310.h | 4 | ||||
-rw-r--r-- | zephyr/include/emul/emul_pct2075.h | 32 | ||||
-rw-r--r-- | zephyr/include/emul/emul_power_signals.h | 49 | ||||
-rw-r--r-- | zephyr/include/emul/emul_smart_battery.h | 7 | ||||
-rw-r--r-- | zephyr/include/emul/emul_syv682x.h | 3 | ||||
-rw-r--r-- | zephyr/include/emul/tcpc/emul_tcpci.h | 5 | ||||
-rw-r--r-- | zephyr/include/emul/tcpc/emul_tcpci_partner_common.h | 21 | ||||
-rw-r--r-- | zephyr/include/emul/tcpc/emul_tcpci_partner_drp.h | 3 | ||||
-rw-r--r-- | zephyr/include/emul/tcpc/emul_tcpci_partner_faulty_ext.h | 3 | ||||
-rw-r--r-- | zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h | 5 | ||||
-rw-r--r-- | zephyr/include/emul/tcpc/emul_tcpci_partner_src.h | 5 | ||||
-rw-r--r-- | zephyr/include/emul/tcpc/emul_tcpci_partner_vpd.h | 49 |
14 files changed, 169 insertions, 21 deletions
diff --git a/zephyr/include/emul/emul_isl923x.h b/zephyr/include/emul/emul_isl923x.h index e41cf26f87..7d085658cf 100644 --- a/zephyr/include/emul/emul_isl923x.h +++ b/zephyr/include/emul/emul_isl923x.h @@ -7,8 +7,8 @@ #define ZEPHYR_INCLUDE_EMUL_EMUL_ISL923X_H_ #include <zephyr/device.h> -#include <zephyr/drivers/i2c_emul.h> #include <zephyr/drivers/emul.h> +#include <zephyr/drivers/i2c_emul.h> /** * @brief Get the emulator's parent bus device diff --git a/zephyr/include/emul/emul_kb_raw.h b/zephyr/include/emul/emul_kb_raw.h index 1660ccefd4..0598eda7ab 100644 --- a/zephyr/include/emul/emul_kb_raw.h +++ b/zephyr/include/emul/emul_kb_raw.h @@ -1,4 +1,4 @@ -/* Copyright 2022 The ChromiumOS Authors. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ diff --git a/zephyr/include/emul/emul_ln9310.h b/zephyr/include/emul/emul_ln9310.h index 0c0e61003e..5d0cab9c20 100644 --- a/zephyr/include/emul/emul_ln9310.h +++ b/zephyr/include/emul/emul_ln9310.h @@ -12,10 +12,12 @@ #ifndef ZEPHYR_INCLUDE_EMUL_EMUL_LN9310_H_ #define ZEPHYR_INCLUDE_EMUL_EMUL_LN9310_H_ -#include <zephyr/drivers/emul.h> #include "driver/ln9310.h" + #include <stdbool.h> +#include <zephyr/drivers/emul.h> + /** * @brief Select the current emulator to use. * diff --git a/zephyr/include/emul/emul_pct2075.h b/zephyr/include/emul/emul_pct2075.h new file mode 100644 index 0000000000..f9e1ef60b2 --- /dev/null +++ b/zephyr/include/emul/emul_pct2075.h @@ -0,0 +1,32 @@ +/* Copyright 2022 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef EMUL_PCT2075_H +#define EMUL_PCT2075_H + +#include "emul/emul_common_i2c.h" + +#include <zephyr/drivers/emul.h> + +#define PCT2075_REG_NUMBER 5 + +struct pct2075_data { + struct i2c_common_emul_data common; + uint16_t regs[PCT2075_REG_NUMBER]; +}; + +/** + * @brief Set the temperature measurement for the sensor. + * + * @param emul Pointer to emulator + * @param mk Temperature to set in mili-kalvin. The temperature + * should me in range of 328150 to 400150, with 150 resolution. + * + * @return 0 on success + * @return negative on error + */ +int pct2075_emul_set_temp(const struct emul *emul, int mk); + +#endif diff --git a/zephyr/include/emul/emul_power_signals.h b/zephyr/include/emul/emul_power_signals.h new file mode 100644 index 0000000000..7dea6079f0 --- /dev/null +++ b/zephyr/include/emul/emul_power_signals.h @@ -0,0 +1,49 @@ +/* Copyright 2022 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef EMUL_POWER_SIGNALS_H_ +#define EMUL_POWER_SIGNALS_H_ + +/** + * @brief Test platform definition, + * This structure contains all power signal nodes associated to one + * test. + */ +struct power_signal_emul_test_platform { + char *name_id; + int nodes_count; + struct power_signal_emul_node **nodes; +}; + +#define EMUL_POWER_SIGNAL_TEST_PLATFORM_DECL(inst) \ + extern const struct power_signal_emul_test_platform inst; + +#define EMUL_POWER_SIGNAL_TEST_PLATFORM(inst) (&DT_CAT(DT_N_S_, inst)) + +DT_FOREACH_STATUS_OKAY(intel_ap_pwr_test_platform, + EMUL_POWER_SIGNAL_TEST_PLATFORM_DECL) +/** + * @brief Load test platform. + * + * This initializes each of the test platform nodes. + * + * @param test_platform Pointer to test platform structure. + * + * @return 0 indicating success. + * @return -EINVAL `test_id` parameter is invalid. + * @return -EBUSY `test_id` One test platform is currently loaded. + */ +int power_signal_emul_load( + const struct power_signal_emul_test_platform *test_platform); + +/** + * @brief Unload test platform. + * + * @return 0 indicating success. + * @return -EINVAL no test platform has been loaded. + */ +int power_signal_emul_unload(void); + +#endif /* EMUL_POWER_SIGNALS_H_ */ diff --git a/zephyr/include/emul/emul_smart_battery.h b/zephyr/include/emul/emul_smart_battery.h index 826e817992..35018f37f7 100644 --- a/zephyr/include/emul/emul_smart_battery.h +++ b/zephyr/include/emul/emul_smart_battery.h @@ -12,12 +12,13 @@ #ifndef __EMUL_SMART_BATTERY_H #define __EMUL_SMART_BATTERY_H +#include "emul/emul_common_i2c.h" + +#include <stdint.h> + #include <zephyr/drivers/emul.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/i2c_emul.h> -#include <stdint.h> - -#include "emul/emul_common_i2c.h" /** * @brief Smart Battery emulator backend API diff --git a/zephyr/include/emul/emul_syv682x.h b/zephyr/include/emul/emul_syv682x.h index 78ee2406eb..3e4328323e 100644 --- a/zephyr/include/emul/emul_syv682x.h +++ b/zephyr/include/emul/emul_syv682x.h @@ -11,9 +11,10 @@ #ifndef __EMUL_SYV682X_H #define __EMUL_SYV682X_H -#include <zephyr/drivers/i2c_emul.h> #include <stdint.h> +#include <zephyr/drivers/i2c_emul.h> + /* Register info copied from syv682.h */ /* SYV682x register addresses */ diff --git a/zephyr/include/emul/tcpc/emul_tcpci.h b/zephyr/include/emul/tcpc/emul_tcpci.h index 8175b9ce96..8badf7dbc4 100644 --- a/zephyr/include/emul/tcpc/emul_tcpci.h +++ b/zephyr/include/emul/tcpc/emul_tcpci.h @@ -12,12 +12,13 @@ #ifndef __EMUL_TCPCI_H #define __EMUL_TCPCI_H +#include "emul/emul_common_i2c.h" + #include <zephyr/drivers/emul.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/i2c_emul.h> -#include <usb_pd_tcpm.h> -#include "emul/emul_common_i2c.h" +#include <usb_pd_tcpm.h> /** * Number of emulated register. This include vendor registers defined in TCPCI diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_common.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_common.h index f232724ece..dd8909c2ca 100644 --- a/zephyr/include/emul/tcpc/emul_tcpci_partner_common.h +++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_common.h @@ -12,16 +12,17 @@ #ifndef __EMUL_TCPCI_PARTNER_COMMON_H #define __EMUL_TCPCI_PARTNER_COMMON_H -#include <zephyr/drivers/emul.h> -#include <zephyr/kernel.h> -#include <zephyr/sys/atomic.h> -#include <stdbool.h> -#include <stdint.h> - #include "ec_commands.h" #include "emul/tcpc/emul_tcpci.h" #include "usb_pd.h" +#include <stdbool.h> +#include <stdint.h> + +#include <zephyr/drivers/emul.h> +#include <zephyr/kernel.h> +#include <zephyr/sys/atomic.h> + /** * @brief Common code used by TCPCI partner device emulators * @defgroup tcpci_partner Common code for TCPCI partner device emulators @@ -147,6 +148,9 @@ struct tcpci_partner_data { /* SVID of entered mode (0 if no mode is entered) */ uint16_t entered_svid; + enum tcpc_cc_voltage_status tcpm_cc1; + enum tcpc_cc_voltage_status tcpm_cc2; + /* VDMs with which the partner responds to discovery REQs. The VDM * buffers include the VDM header, and the VDO counts include 1 for the * VDM header. This structure has space for the mode response for a @@ -183,6 +187,8 @@ struct tcpci_partner_data { */ bool have_response[PD_BATT_MAX]; } battery_capabilities; + /* Used to control accept/reject for partner port of Enter_USB msg */ + bool enter_usb_accept; /* * Cable which is "plugged in" to this port partner @@ -311,6 +317,9 @@ struct tcpci_partner_extension_ops { void (*soft_reset)(struct tcpci_partner_extension *ext, struct tcpci_partner_data *common_data); + void (*control_change)(struct tcpci_partner_extension *ext, + struct tcpci_partner_data *common_data); + /** * @brief Function called when partner emulator is disconnected from * TCPM diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_drp.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_drp.h index e4f58fcd37..cacb4e6270 100644 --- a/zephyr/include/emul/tcpc/emul_tcpci_partner_drp.h +++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_drp.h @@ -12,13 +12,14 @@ #ifndef __EMUL_TCPCI_PARTNER_DRP_H #define __EMUL_TCPCI_PARTNER_DRP_H -#include <zephyr/drivers/emul.h> #include "emul/tcpc/emul_tcpci.h" #include "emul/tcpc/emul_tcpci_partner_common.h" #include "emul/tcpc/emul_tcpci_partner_snk.h" #include "emul/tcpc/emul_tcpci_partner_src.h" #include "usb_pd.h" +#include <zephyr/drivers/emul.h> + /** * @brief USB-C dual role device extension backend API * @defgroup tcpci_snk_emul USB-C dual role device extension diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_faulty_ext.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_faulty_ext.h index f0627c95bd..317e9817d4 100644 --- a/zephyr/include/emul/tcpc/emul_tcpci_partner_faulty_ext.h +++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_faulty_ext.h @@ -12,11 +12,12 @@ #ifndef __EMUL_TCPCI_PARTNER_FAULTY_EXT_H #define __EMUL_TCPCI_PARTNER_FAULTY_EXT_H -#include <zephyr/drivers/emul.h> #include "emul/tcpc/emul_tcpci.h" #include "emul/tcpc/emul_tcpci_partner_common.h" #include "usb_pd.h" +#include <zephyr/drivers/emul.h> + /** * @brief USB-C malfunctioning device extension backend API * @defgroup tcpci_faulty_ext USB-C malfunctioning device extension diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h index 584458942b..edf09d25eb 100644 --- a/zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h +++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h @@ -12,11 +12,12 @@ #ifndef __EMUL_TCPCI_PARTNER_SNK_H #define __EMUL_TCPCI_PARTNER_SNK_H -#include <zephyr/drivers/emul.h> -#include "emul/tcpc/emul_tcpci_partner_common.h" #include "emul/tcpc/emul_tcpci.h" +#include "emul/tcpc/emul_tcpci_partner_common.h" #include "usb_pd.h" +#include <zephyr/drivers/emul.h> + /** * @brief USB-C sink device extension backend API * @defgroup tcpci_snk_emul USB-C sink device extension diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_src.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_src.h index e72d0e4135..7ce14da82a 100644 --- a/zephyr/include/emul/tcpc/emul_tcpci_partner_src.h +++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_src.h @@ -12,11 +12,12 @@ #ifndef __EMUL_TCPCI_PARTNER_SRC_H #define __EMUL_TCPCI_PARTNER_SRC_H -#include <zephyr/drivers/emul.h> -#include "emul/tcpc/emul_tcpci_partner_common.h" #include "emul/tcpc/emul_tcpci.h" +#include "emul/tcpc/emul_tcpci_partner_common.h" #include "usb_pd.h" +#include <zephyr/drivers/emul.h> + /** * @brief USB-C source device extension backend API * @defgroup tcpci_src_emul USB-C source device extension diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_vpd.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_vpd.h new file mode 100644 index 0000000000..6de0452b05 --- /dev/null +++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_vpd.h @@ -0,0 +1,49 @@ +/* Copyright 2022 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * @file + * + * @brief Backend API for USB-C VCONN-powered device emulator + */ + +#ifndef __EMUL_TCPCI_PARTNER_VPD_H +#define __EMUL_TCPCI_PARTNER_VPD_H + +#include "emul/tcpc/emul_tcpci_partner_common.h" +#include "emul/tcpc/emul_tcpci_partner_faulty_ext.h" +#include "emul/tcpc/emul_tcpci_partner_snk.h" +#include "emul/tcpc/emul_tcpci_partner_src.h" + +#include <zephyr/drivers/emul.h> + +/** + * @brief USB-C VCONN-powered device extension backend API + * @defgroup tcpci_src_emul USB-C source device extension + * @{ + */ + +struct tcpci_vpd_emul_data { + /** Common extension structure */ + struct tcpci_partner_extension ext; + /** Pointer to common TCPCI partner data */ + struct tcpci_partner_data *common_data; + struct tcpci_faulty_ext_data fault_ext; + struct tcpci_faulty_ext_action fault_actions[1]; + struct tcpci_snk_emul_data snk_ext; + struct tcpci_src_emul_data src_ext; + bool charge_through_connected; +}; + +struct tcpci_partner_extension * +tcpci_vpd_emul_init(struct tcpci_vpd_emul_data *data, + struct tcpci_partner_data *common_data, + struct tcpci_partner_extension *ext); + +/** + * @} + */ + +#endif /* __EMUL_TCPCI_PARTNER_VPD_H */ |