|
Zephyr API Documentation 4.4.0-rc1
A Scalable Open Source RTOS
|
USBC Type-C Port Controller device APIs. More...
#include <zephyr/types.h>#include <zephyr/device.h>#include <errno.h>#include "usbc_tc.h"#include "usbc_pd.h"Go to the source code of this file.
Data Structures | |
| struct | tcpc_chip_info |
| TCPC Chip Information. More... | |
| struct | tcpc_driver_api |
| Driver Operations USB Type-C Port Controller driver operations More... | |
Typedefs | |
| typedef int(* | tcpc_vconn_control_cb_t) (const struct device *tcpc_dev, const struct device *usbc_dev, enum tc_cc_polarity pol, bool enable) |
| Callback type for VCONN control. | |
| typedef int(* | tcpc_vconn_discharge_cb_t) (const struct device *tcpc_dev, const struct device *usbc_dev, enum tc_cc_polarity pol, bool enable) |
| Callback type for discharging VCONN. | |
| typedef void(* | tcpc_alert_handler_cb_t) (const struct device *dev, void *data, enum tcpc_alert alert) |
| Callback type for handling TCPC alert events. | |
| typedef int(* | tcpc_api_init_t) (const struct device *dev) |
| Callback API to initialize the TCPC. | |
| typedef int(* | tcpc_api_get_cc_t) (const struct device *dev, enum tc_cc_voltage_state *cc1, enum tc_cc_voltage_state *cc2) |
| Callback API to read CC line status. | |
| typedef int(* | tcpc_api_select_rp_value_t) (const struct device *dev, enum tc_rp_value rp) |
| Callback API to set source Rp value. | |
| typedef int(* | tcpc_api_get_rp_value_t) (const struct device *dev, enum tc_rp_value *rp) |
| Callback API to get source Rp value. | |
| typedef int(* | tcpc_api_set_cc_t) (const struct device *dev, enum tc_cc_pull pull) |
| Callback API to set CC pull and role. | |
| typedef void(* | tcpc_api_set_vconn_discharge_cb_t) (const struct device *dev, tcpc_vconn_discharge_cb_t cb, const struct device *usbc_dev) |
| Callback API to register the VCONN discharge application callback. | |
| typedef void(* | tcpc_api_set_vconn_cb_t) (const struct device *dev, tcpc_vconn_control_cb_t vconn_cb, const struct device *usbc_dev) |
| Callback API to register the VCONN control application callback. | |
| typedef int(* | tcpc_api_vconn_discharge_t) (const struct device *dev, bool enable) |
| Callback API to enable or disable VCONN discharge. | |
| typedef int(* | tcpc_api_set_vconn_t) (const struct device *dev, bool enable) |
| Callback API to enable or disable VCONN. | |
| typedef int(* | tcpc_api_set_roles_t) (const struct device *dev, enum tc_power_role power_role, enum tc_data_role data_role) |
| Callback API to set power and data roles for PD message header. | |
| typedef int(* | tcpc_api_get_rx_pending_msg_t) (const struct device *dev, struct pd_msg *msg) |
| Callback API to get a pending RX message or query RX status. | |
| typedef int(* | tcpc_api_set_rx_enable_t) (const struct device *dev, bool enable) |
| Callback API to enable or disable SOP* RX. | |
| typedef int(* | tcpc_api_set_cc_polarity_t) (const struct device *dev, enum tc_cc_polarity polarity) |
| Callback API to set CC polarity. | |
| typedef int(* | tcpc_api_transmit_data_t) (const struct device *dev, struct pd_msg *msg) |
| Callback API to transmit a PD message. | |
| typedef int(* | tcpc_api_dump_std_reg_t) (const struct device *dev) |
| Callback API to dump standard TCPC registers. | |
| typedef int(* | tcpc_api_get_status_register_t) (const struct device *dev, enum tcpc_status_reg reg, uint32_t *status) |
| Callback API to get a status register. | |
| typedef int(* | tcpc_api_clear_status_register_t) (const struct device *dev, enum tcpc_status_reg reg, uint32_t mask) |
| Callback API to clear bits in a status register. | |
| typedef int(* | tcpc_api_mask_status_register_t) (const struct device *dev, enum tcpc_status_reg reg, uint32_t mask) |
| Callback API to mask or unmask status register bits. | |
| typedef int(* | tcpc_api_set_debug_accessory_t) (const struct device *dev, bool enable) |
| Callback API to enable or disable debug accessory control. | |
| typedef int(* | tcpc_api_set_debug_detach_t) (const struct device *dev) |
| Callback API to detach from a debug connection. | |
| typedef int(* | tcpc_api_set_drp_toggle_t) (const struct device *dev, bool enable) |
| Callback API to enable or disable DRP toggle. | |
| typedef int(* | tcpc_api_get_snk_ctrl_t) (const struct device *dev) |
| Callback API to query VBUS sink control state. | |
| typedef int(* | tcpc_api_set_snk_ctrl_t) (const struct device *dev, bool enable) |
| Callback API to enable or disable VBUS sinking. | |
| typedef int(* | tcpc_api_get_src_ctrl_t) (const struct device *dev) |
| Callback API to query VBUS source control state. | |
| typedef int(* | tcpc_api_set_src_ctrl_t) (const struct device *dev, bool enable) |
| Callback API to enable or disable VBUS sourcing. | |
| typedef int(* | tcpc_api_get_chip_info_t) (const struct device *dev, struct tcpc_chip_info *chip_info) |
| Callback API to read TCPC chip information. | |
| typedef int(* | tcpc_api_set_low_power_mode_t) (const struct device *dev, bool enable) |
| Callback API to enter or exit low power mode. | |
| typedef int(* | tcpc_api_sop_prime_enable_t) (const struct device *dev, bool enable) |
| Callback API to enable or disable SOP' / SOP'' reception. | |
| typedef int(* | tcpc_api_set_bist_test_mode_t) (const struct device *dev, bool enable) |
| Callback API to enable or disable BIST test mode. | |
| typedef int(* | tcpc_api_set_alert_handler_cb_t) (const struct device *dev, tcpc_alert_handler_cb_t handler, void *data) |
| Callback API to register the alert application callback. | |
Functions | |
| static int | tcpc_is_cc_rp (enum tc_cc_voltage_state cc) |
| Returns whether the sink has detected a Rp resistor on the other side. | |
| static int | tcpc_is_cc_open (enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2) |
| Returns true if both CC lines are completely open. | |
| static int | tcpc_is_cc_snk_dbg_acc (enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2) |
| Returns true if we detect the port partner is a snk debug accessory. | |
| static int | tcpc_is_cc_src_dbg_acc (enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2) |
| Returns true if we detect the port partner is a src debug accessory. | |
| static int | tcpc_is_cc_audio_acc (enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2) |
| Returns true if the port partner is an audio accessory. | |
| static int | tcpc_is_cc_at_least_one_rd (enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2) |
| Returns true if the port partner is presenting at least one Rd. | |
| static int | tcpc_is_cc_only_one_rd (enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2) |
| Returns true if the port partner is presenting Rd on only one CC line. | |
| static int | tcpc_init (const struct device *dev) |
| Initializes the TCPC. | |
| static int | tcpc_get_cc (const struct device *dev, enum tc_cc_voltage_state *cc1, enum tc_cc_voltage_state *cc2) |
| Reads the status of the CC lines. | |
| static int | tcpc_select_rp_value (const struct device *dev, enum tc_rp_value rp) |
| Sets the value of CC pull up resistor used when operating as a Source. | |
| static int | tcpc_get_rp_value (const struct device *dev, enum tc_rp_value *rp) |
| Gets the value of the CC pull up resistor used when operating as a Source. | |
| static int | tcpc_set_cc (const struct device *dev, enum tc_cc_pull pull) |
| Sets the CC pull resistor and sets the role as either Source or Sink. | |
| static void | tcpc_set_vconn_cb (const struct device *dev, tcpc_vconn_control_cb_t vconn_cb, const struct device *usbc_dev) |
| Sets a callback that can enable or disable VCONN if the TCPC is unable to or the system is configured in a way that does not use the VCONN control capabilities of the TCPC. | |
| static void | tcpc_set_vconn_discharge_cb (const struct device *dev, tcpc_vconn_discharge_cb_t cb, const struct device *usbc_dev) |
| Sets a callback that can enable or discharge VCONN if the TCPC is unable to or the system is configured in a way that does not use the VCONN control capabilities of the TCPC. | |
| static int | tcpc_vconn_discharge (const struct device *dev, bool enable) |
| Discharges VCONN. | |
| static int | tcpc_set_vconn (const struct device *dev, bool enable) |
| Enables or disables VCONN. | |
| static int | tcpc_set_roles (const struct device *dev, enum tc_power_role power_role, enum tc_data_role data_role) |
| Sets the Power and Data Role of the PD message header. | |
| static int | tcpc_get_rx_pending_msg (const struct device *dev, struct pd_msg *buf) |
| Retrieves the Power Delivery message from the TCPC. | |
| static int | tcpc_set_rx_enable (const struct device *dev, bool enable) |
| Enables the reception of SOP* message types. | |
| static int | tcpc_set_cc_polarity (const struct device *dev, enum tc_cc_polarity polarity) |
| Sets the polarity of the CC lines. | |
| static int | tcpc_transmit_data (const struct device *dev, struct pd_msg *msg) |
| Transmits a Power Delivery message. | |
| static int | tcpc_dump_std_reg (const struct device *dev) |
| Dump a set of TCPC registers. | |
| static int | tcpc_set_alert_handler_cb (const struct device *dev, tcpc_alert_handler_cb_t handler, void *data) |
| Sets the alert function that's called when an interrupt is triggered due to an alert bit. | |
| static int | tcpc_get_status_register (const struct device *dev, enum tcpc_status_reg reg, uint32_t *status) |
| Gets a status register. | |
| static int | tcpc_clear_status_register (const struct device *dev, enum tcpc_status_reg reg, uint32_t mask) |
| Clears a TCPC status register. | |
| static int | tcpc_mask_status_register (const struct device *dev, enum tcpc_status_reg reg, uint32_t mask) |
| Sets the mask of a TCPC status register. | |
| static int | tcpc_set_debug_accessory (const struct device *dev, bool enable) |
| Manual control of TCPC DebugAccessory control. | |
| static int | tcpc_set_debug_detach (const struct device *dev) |
| Detach from a debug connection. | |
| static int | tcpc_set_drp_toggle (const struct device *dev, bool enable) |
| Enable TCPC auto dual role toggle. | |
| static int | tcpc_get_snk_ctrl (const struct device *dev) |
| Queries the current sinking state of the TCPC. | |
| static int | tcpc_set_snk_ctrl (const struct device *dev, bool enable) |
| Set the VBUS sinking state of the TCPC. | |
| static int | tcpc_get_src_ctrl (const struct device *dev) |
| Queries the current sourcing state of the TCPC. | |
| static int | tcpc_set_src_ctrl (const struct device *dev, bool enable) |
| Set the VBUS sourcing state of the TCPC. | |
| static int | tcpc_set_bist_test_mode (const struct device *dev, bool enable) |
| Controls the BIST Mode of the TCPC. | |
| static int | tcpc_get_chip_info (const struct device *dev, struct tcpc_chip_info *chip_info) |
| Gets the TCPC firmware version. | |
| static int | tcpc_set_low_power_mode (const struct device *dev, bool enable) |
| Instructs the TCPC to enter or exit low power mode. | |
| static int | tcpc_sop_prime_enable (const struct device *dev, bool enable) |
| Enables the reception of SOP Prime and optionally SOP Double Prime messages. | |
USBC Type-C Port Controller device APIs.
This file contains the USB Type-C Port Controller device APIs. All Type-C Port Controller device drivers should implement the APIs described in this file.