Zephyr API Documentation
3.7.0
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 |
Typedefs | |
typedef int(* | tcpc_vconn_control_cb_t) (const struct device *dev, enum tc_cc_polarity pol, bool enable) |
typedef int(* | tcpc_vconn_discharge_cb_t) (const struct device *dev, enum tc_cc_polarity pol, bool enable) |
typedef void(* | tcpc_alert_handler_cb_t) (const struct device *dev, void *data, enum tcpc_alert alert) |
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) |
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) |
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, int32_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 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.