|
Zephyr API Documentation 4.3.0-rc1
A Scalable Open Source RTOS
|
Helper functions to use by the TCPCI-compliant drivers. More...
Go to the source code of this file.
Data Structures | |
| struct | tcpci_reg_dump_map |
| Structure used to bind the register address to name in registers dump. More... | |
Macros | |
| #define | TCPCI_STD_REGS_SIZE 38 |
| Size of the array containing the standard registers used by tcpci dump command. | |
| #define | PD_INT_REV10 0x10 /* Revision 1.0 */ |
| Type-C Port Controller Interface Specification Revision. | |
| #define | PD_INT_REV20 0x20 /* Revision 2.0 */ |
Functions | |
| int | tcpci_read_reg8 (const struct i2c_dt_spec *bus, uint8_t reg, uint8_t *value) |
| Function to read the 8-bit register of TCPCI device. | |
| int | tcpci_write_reg8 (const struct i2c_dt_spec *bus, uint8_t reg, uint8_t value) |
| Function to write a value to the 8-bit register of TCPCI device. | |
| int | tcpci_update_reg8 (const struct i2c_dt_spec *bus, uint8_t reg, uint8_t mask, uint8_t value) |
| Function to read and update part of the 8-bit register of TCPCI device The function is NOT performing this operation atomically. | |
| int | tcpci_read_reg16 (const struct i2c_dt_spec *bus, uint8_t reg, uint16_t *value) |
| Function to read the 16-bit register of TCPCI device. | |
| int | tcpci_write_reg16 (const struct i2c_dt_spec *bus, uint8_t reg, uint16_t value) |
| Function to write a value to the 16-bit register of TCPCI device. | |
| enum tcpc_alert | tcpci_alert_reg_to_enum (uint16_t reg) |
| Function that converts the TCPCI alert register to the tcpc_alert enum The hard reset value takes priority, where the rest are returned in the bit order from least significant to most significant. | |
| int | tcpci_tcpm_get_cc (const struct i2c_dt_spec *bus, enum tc_cc_voltage_state *cc1, enum tc_cc_voltage_state *cc2) |
| Function that reads the CC status registers and converts read values to enums representing voltages state and partner detection status. | |
| int | tcpci_tcpm_get_chip_info (const struct i2c_dt_spec *bus, struct tcpc_chip_info *chip_info) |
| Function to retrieve information about the TCPCI chip. | |
| int | tcpci_tcpm_dump_std_reg (const struct i2c_dt_spec *bus) |
| Function to dump the standard TCPCI registers. | |
| int | tcpci_tcpm_set_bist_test_mode (const struct i2c_dt_spec *bus, bool enable) |
| Function to enable or disable the BIST (Built-In Self-Test) mode. | |
| int | tcpci_tcpm_transmit_data (const struct i2c_dt_spec *bus, struct pd_msg *msg, const uint8_t retries) |
| Function to transmit a PD (Power Delivery) message. | |
| int | tcpci_tcpm_select_rp_value (const struct i2c_dt_spec *bus, enum tc_rp_value rp) |
| Function to select the Rp (Pull-up Resistor) value. | |
| int | tcpci_tcpm_get_rp_value (const struct i2c_dt_spec *bus, enum tc_rp_value *rp) |
| Function to get the currently selected Rp value. | |
| int | tcpci_tcpm_set_cc (const struct i2c_dt_spec *bus, enum tc_cc_pull pull) |
| Function to set the CC pull resistor and set the role as either Source or Sink. | |
| int | tcpci_tcpm_set_drp_toggle (const struct i2c_dt_spec *bus, uint8_t pd_int_rev, bool enable) |
| Function to enable or disable TCPC auto dual role toggle. | |
| int | tcpci_tcpm_set_roles (const struct i2c_dt_spec *bus, enum pd_rev_type pd_rev, enum tc_power_role power_role, enum tc_data_role data_role) |
| Function to set the power and data role of the PD message header. | |
| int | tcpci_tcpm_set_rx_type (const struct i2c_dt_spec *bus, uint8_t type) |
| Function to set the RX type. | |
| int | tcpci_tcpm_set_cc_polarity (const struct i2c_dt_spec *bus, enum tc_cc_polarity polarity) |
| Function to set the polarity of the CC lines. | |
| int | tcpci_tcpm_set_vconn (const struct i2c_dt_spec *bus, bool enable) |
| Function to enable or disable VCONN. | |
| int | tcpci_tcpm_get_status_register (const struct i2c_dt_spec *bus, enum tcpc_status_reg reg, uint16_t *status) |
| Function to get the status of a specific TCPCI status register. | |
| int | tcpci_tcpm_clear_status_register (const struct i2c_dt_spec *bus, enum tcpc_status_reg reg, uint16_t mask) |
| Function to clear specific bits in a TCPCI status register. | |
| int | tcpci_tcpm_mask_status_register (const struct i2c_dt_spec *bus, enum tcpc_status_reg reg, uint16_t mask) |
| Function to set the mask of a TCPCI status register. | |
| int | tcpci_tcpm_get_snk_ctrl (const struct i2c_dt_spec *bus, bool *sinking) |
| Queries the current sinking state of the TCPCI. | |
| int | tcpci_tcpm_get_src_ctrl (const struct i2c_dt_spec *bus, bool *sourcing) |
| Queries the current sourcing state of the TCPCI. | |
| int | tcpci_tcpm_set_snk_ctrl (const struct i2c_dt_spec *bus, bool enable) |
| Function to enable or disable sinking power over VBUS. | |
| int | tcpci_tcpm_set_src_ctrl (const struct i2c_dt_spec *bus, bool enable) |
| Function to enable or disable sourcing power over VBUS. | |
| int | tcpci_tcpm_set_debug_accessory (const struct i2c_dt_spec *bus, bool enable) |
| Function to enable or disable the debug accessory mode. | |
| int | tcpci_tcpm_set_low_power_mode (const struct i2c_dt_spec *bus, bool enable) |
| Function to enable or disable the low power mode. | |
Variables | |
| const struct tcpci_reg_dump_map | tcpci_std_regs [38] |
| Array containing the standard TCPCI registers list. | |
Helper functions to use by the TCPCI-compliant drivers.
This file contains generic TCPCI functions that may be used by the drivers to TCPCI-compliant devices that want to implement vendor-specific functionality without the need to reimplement the TCPCI generic functionality and register operations.
| #define PD_INT_REV10 0x10 /* Revision 1.0 */ |
Type-C Port Controller Interface Specification Revision.
| #define PD_INT_REV20 0x20 /* Revision 2.0 */ |
| #define TCPCI_STD_REGS_SIZE 38 |
Size of the array containing the standard registers used by tcpci dump command.
| enum tcpc_alert tcpci_alert_reg_to_enum | ( | uint16_t | reg | ) |
Function that converts the TCPCI alert register to the tcpc_alert enum The hard reset value takes priority, where the rest are returned in the bit order from least significant to most significant.
| reg | Value of the TCPCI alert register. This parameter must have value other than zero. |
| int tcpci_read_reg16 | ( | const struct i2c_dt_spec * | bus, |
| uint8_t | reg, | ||
| uint16_t * | value ) |
Function to read the 16-bit register of TCPCI device.
| bus | I2C bus |
| reg | Address of TCPCI register |
| value | Pointer to variable that will store the register value |
| int tcpci_read_reg8 | ( | const struct i2c_dt_spec * | bus, |
| uint8_t | reg, | ||
| uint8_t * | value ) |
Function to read the 8-bit register of TCPCI device.
| bus | I2C bus |
| reg | Address of TCPCI register |
| value | Pointer to variable that will store the register value |
| int tcpci_tcpm_clear_status_register | ( | const struct i2c_dt_spec * | bus, |
| enum tcpc_status_reg | reg, | ||
| uint16_t | mask ) |
Function to clear specific bits in a TCPCI status register.
| bus | I2C bus |
| reg | Enum representing the status register to be cleared |
| mask | Bitmask specifying which bits to clear |
| int tcpci_tcpm_dump_std_reg | ( | const struct i2c_dt_spec * | bus | ) |
Function to dump the standard TCPCI registers.
| bus | I2C bus |
| int tcpci_tcpm_get_cc | ( | const struct i2c_dt_spec * | bus, |
| enum tc_cc_voltage_state * | cc1, | ||
| enum tc_cc_voltage_state * | cc2 ) |
Function that reads the CC status registers and converts read values to enums representing voltages state and partner detection status.
| bus | I2C bus |
| cc1 | Pointer to variable where detected CC1 voltage state will be stored |
| cc2 | Pointer to variable where detected CC2 voltage state will be stored |
| int tcpci_tcpm_get_chip_info | ( | const struct i2c_dt_spec * | bus, |
| struct tcpc_chip_info * | chip_info ) |
Function to retrieve information about the TCPCI chip.
| bus | I2C bus |
| chip_info | Pointer to the structure where the chip information will be stored |
| int tcpci_tcpm_get_rp_value | ( | const struct i2c_dt_spec * | bus, |
| enum tc_rp_value * | rp ) |
Function to get the currently selected Rp value.
| bus | I2C bus |
| rp | Pointer to the variable where the Rp value will be stored |
| int tcpci_tcpm_get_snk_ctrl | ( | const struct i2c_dt_spec * | bus, |
| bool * | sinking ) |
Queries the current sinking state of the TCPCI.
This function checks if the device is sinking VBUS to the system load.
| bus | I2C bus |
| sinking | Pointer to variable where sinking state will be stored |
| int tcpci_tcpm_get_src_ctrl | ( | const struct i2c_dt_spec * | bus, |
| bool * | sourcing ) |
Queries the current sourcing state of the TCPCI.
This function checks if the device is sourcing VBUS.
| bus | I2C bus |
| sourcing | Pointer to variable where sourcing state will be stored |
| int tcpci_tcpm_get_status_register | ( | const struct i2c_dt_spec * | bus, |
| enum tcpc_status_reg | reg, | ||
| uint16_t * | status ) |
Function to get the status of a specific TCPCI status register.
| bus | I2C bus |
| reg | Enum representing the status register to be read |
| status | Pointer to the variable where the status will be stored |
| int tcpci_tcpm_mask_status_register | ( | const struct i2c_dt_spec * | bus, |
| enum tcpc_status_reg | reg, | ||
| uint16_t | mask ) |
Function to set the mask of a TCPCI status register.
| bus | I2C bus |
| reg | Enum representing the status register to be masked |
| mask | Bitmask specifying which bits to mask |
| int tcpci_tcpm_select_rp_value | ( | const struct i2c_dt_spec * | bus, |
| enum tc_rp_value | rp ) |
Function to select the Rp (Pull-up Resistor) value.
| bus | I2C bus |
| rp | Enum representing the Rp value to be set |
| int tcpci_tcpm_set_bist_test_mode | ( | const struct i2c_dt_spec * | bus, |
| bool | enable ) |
Function to enable or disable the BIST (Built-In Self-Test) mode.
| bus | I2C bus |
| enable | Boolean flag to enable (true) or disable (false) BIST mode |
| int tcpci_tcpm_set_cc | ( | const struct i2c_dt_spec * | bus, |
| enum tc_cc_pull | pull ) |
Function to set the CC pull resistor and set the role as either Source or Sink.
| bus | I2C bus |
| pull | Enum representing the CC pull resistor to be set |
| int tcpci_tcpm_set_cc_polarity | ( | const struct i2c_dt_spec * | bus, |
| enum tc_cc_polarity | polarity ) |
Function to set the polarity of the CC lines.
| bus | I2C bus |
| polarity | Enum representing the CC polarity to be set |
| int tcpci_tcpm_set_debug_accessory | ( | const struct i2c_dt_spec * | bus, |
| bool | enable ) |
Function to enable or disable the debug accessory mode.
| bus | I2C bus |
| enable | Boolean flag to enable (true) or disable (false) debug accessory mode |
| int tcpci_tcpm_set_drp_toggle | ( | const struct i2c_dt_spec * | bus, |
| uint8_t | pd_int_rev, | ||
| bool | enable ) |
Function to enable or disable TCPC auto dual role toggle.
| bus | I2C bus |
| pd_int_rev | Value of the TCPC_REG_PD_INT_REV bits [15..8] |
| enable | Boolean flag to enable (true) or disable (false) DRP toggle mode |
| int tcpci_tcpm_set_low_power_mode | ( | const struct i2c_dt_spec * | bus, |
| bool | enable ) |
Function to enable or disable the low power mode.
| bus | I2C bus |
| enable | Boolean flag to enable (true) or disable (false) low power mode |
| int tcpci_tcpm_set_roles | ( | const struct i2c_dt_spec * | bus, |
| enum pd_rev_type | pd_rev, | ||
| enum tc_power_role | power_role, | ||
| enum tc_data_role | data_role ) |
Function to set the power and data role of the PD message header.
| bus | I2C bus |
| pd_rev | Enum representing the USB−PD Specification Revision to be set |
| power_role | Enum representing the power role to be set |
| data_role | Enum representing the data role to be set |
| int tcpci_tcpm_set_rx_type | ( | const struct i2c_dt_spec * | bus, |
| uint8_t | type ) |
Function to set the RX type.
| bus | I2C bus |
| type | Value representing the RX type to be set |
| int tcpci_tcpm_set_snk_ctrl | ( | const struct i2c_dt_spec * | bus, |
| bool | enable ) |
Function to enable or disable sinking power over VBUS.
| bus | I2C bus |
| enable | Boolean flag to enable (true) or disable (false) sinking power |
| int tcpci_tcpm_set_src_ctrl | ( | const struct i2c_dt_spec * | bus, |
| bool | enable ) |
Function to enable or disable sourcing power over VBUS.
| bus | I2C bus |
| enable | Boolean flag to enable (true) or disable (false) sourcing power |
| int tcpci_tcpm_set_vconn | ( | const struct i2c_dt_spec * | bus, |
| bool | enable ) |
Function to enable or disable VCONN.
| bus | I2C bus |
| enable | Boolean flag to enable (true) or disable (false) VCONN |
| int tcpci_tcpm_transmit_data | ( | const struct i2c_dt_spec * | bus, |
| struct pd_msg * | msg, | ||
| const uint8_t | retries ) |
Function to transmit a PD (Power Delivery) message.
The message is transmitted with a specified number of retries in case of failure.
| bus | I2C bus |
| msg | Pointer to the PD message structure to be transmitted |
| retries | Number of retries in case of transmission failure |
| int tcpci_update_reg8 | ( | const struct i2c_dt_spec * | bus, |
| uint8_t | reg, | ||
| uint8_t | mask, | ||
| uint8_t | value ) |
Function to read and update part of the 8-bit register of TCPCI device The function is NOT performing this operation atomically.
| bus | I2C bus |
| reg | Address of TCPCI register |
| mask | Bitmask specifying which bits of the device register will be modified |
| value | Value that will be written to the device register after being ANDed with mask |
| int tcpci_write_reg16 | ( | const struct i2c_dt_spec * | bus, |
| uint8_t | reg, | ||
| uint16_t | value ) |
Function to write a value to the 16-bit register of TCPCI device.
| bus | I2C bus |
| reg | Address of TCPCI register |
| value | Value that will be written to the device register |
| int tcpci_write_reg8 | ( | const struct i2c_dt_spec * | bus, |
| uint8_t | reg, | ||
| uint8_t | value ) |
Function to write a value to the 8-bit register of TCPCI device.
| bus | I2C bus |
| reg | Address of TCPCI register |
| value | Value that will be written to the device register |
|
extern |
Array containing the standard TCPCI registers list.
If the TCPC driver contain any vendor-specific registers, it may override the TCPCI dump_std_reg function tp dump them and should also dump the standard registers using this array.