Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
tcpci_priv.h
Go to the documentation of this file.
1/*
2 * Copyright 2024 Google LLC
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
15#ifndef ZEPHYR_INCLUDE_DRIVERS_USBC_TCPCI_PRIV_H_
16#define ZEPHYR_INCLUDE_DRIVERS_USBC_TCPCI_PRIV_H_
17
18#include <stdint.h>
19#include <zephyr/drivers/i2c.h>
20#include <zephyr/usb_c/usbc.h>
21
33
35#define TCPCI_STD_REGS_SIZE 38
43
52int tcpci_read_reg8(const struct i2c_dt_spec *bus, uint8_t reg, uint8_t *value);
53
62int tcpci_write_reg8(const struct i2c_dt_spec *bus, uint8_t reg, uint8_t value);
63
74int tcpci_update_reg8(const struct i2c_dt_spec *bus, uint8_t reg, uint8_t mask, uint8_t value);
75
84int tcpci_read_reg16(const struct i2c_dt_spec *bus, uint8_t reg, uint16_t *value);
85
94int tcpci_write_reg16(const struct i2c_dt_spec *bus, uint8_t reg, uint16_t value);
95
105
116int tcpci_tcpm_get_cc(const struct i2c_dt_spec *bus, enum tc_cc_voltage_state *cc1,
117 enum tc_cc_voltage_state *cc2);
118
126int tcpci_tcpm_get_chip_info(const struct i2c_dt_spec *bus, struct tcpc_chip_info *chip_info);
127
135
143int tcpci_tcpm_set_bist_test_mode(const struct i2c_dt_spec *bus, bool enable);
144
154int tcpci_tcpm_transmit_data(const struct i2c_dt_spec *bus, struct pd_msg *msg,
155 const uint8_t retries);
156
164int tcpci_tcpm_select_rp_value(const struct i2c_dt_spec *bus, enum tc_rp_value rp);
165
173int tcpci_tcpm_get_rp_value(const struct i2c_dt_spec *bus, enum tc_rp_value *rp);
174
182int tcpci_tcpm_set_cc(const struct i2c_dt_spec *bus, enum tc_cc_pull pull);
183
191int tcpci_tcpm_set_drp_toggle(const struct i2c_dt_spec *bus, bool enable);
192
202int tcpci_tcpm_set_roles(const struct i2c_dt_spec *bus, enum pd_rev_type pd_rev,
203 enum tc_power_role power_role, enum tc_data_role data_role);
204
212int tcpci_tcpm_set_rx_type(const struct i2c_dt_spec *bus, uint8_t type);
213
221int tcpci_tcpm_set_cc_polarity(const struct i2c_dt_spec *bus, enum tc_cc_polarity polarity);
222
230int tcpci_tcpm_set_vconn(const struct i2c_dt_spec *bus, bool enable);
231
241 uint16_t *status);
242
252 uint16_t mask);
253
263 uint16_t mask);
264
265#endif /* ZEPHYR_INCLUDE_DRIVERS_USBC_TCPCI_PRIV_H_ */
Public APIs for the I2C drivers.
pd_rev_type
Protocol revision.
Definition usbc_pd.h:859
tcpc_alert
TCPC Alert bits.
Definition usbc_tcpc.h:41
tcpc_status_reg
TCPC Status register.
Definition usbc_tcpc.h:85
tc_cc_pull
CC pull resistors.
Definition usbc_tc.h:352
tc_rp_value
Pull-Up resistor values.
Definition usbc_tc.h:338
tc_cc_voltage_state
CC Voltage status.
Definition usbc_tc.h:308
tc_data_role
Power Delivery Data Role.
Definition usbc_tc.h:389
tc_power_role
Power Delivery Power Role.
Definition usbc_tc.h:379
tc_cc_polarity
Polarity of the CC lines.
Definition usbc_tc.h:401
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Complete I2C DT information.
Definition i2c.h:77
Power Delivery message.
Definition usbc_pd.h:1040
TCPC Chip Information.
Definition usbc_tcpc.h:105
Structure used to bind the register address to name in registers dump.
Definition tcpci_priv.h:25
const char * name
Human readable name of register.
Definition tcpci_priv.h:29
uint8_t size
Size in bytes of the register.
Definition tcpci_priv.h:31
uint8_t addr
Address of I2C device register.
Definition tcpci_priv.h:27
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_tcpm_dump_std_reg(const struct i2c_dt_spec *bus)
Function to dump the standard TCPCI registers.
int tcpci_tcpm_set_rx_type(const struct i2c_dt_spec *bus, uint8_t type)
Function to set the RX type.
#define TCPCI_STD_REGS_SIZE
Size of the array containing the standard registers used by tcpci dump command.
Definition tcpci_priv.h:35
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_get_rp_value(const struct i2c_dt_spec *bus, enum tc_rp_value *rp)
Function to get the currently selected Rp value.
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...
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_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_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_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.
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_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_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_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.
const struct tcpci_reg_dump_map tcpci_std_regs[38]
Array containing the standard TCPCI registers list.
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 pri...
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_tcpm_set_vconn(const struct i2c_dt_spec *bus, bool enable)
Function to enable or disable VCONN.
int tcpci_tcpm_set_drp_toggle(const struct i2c_dt_spec *bus, bool enable)
Function to enable or disable TCPC auto dual role toggle.
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_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 s...
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_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.
USB-C Device APIs.