remove unused USB PD function definitions
This commit is contained in:
parent
24ee293a9b
commit
83432a483e
1747
usb_pd/usb_pd.h
1747
usb_pd/usb_pd.h
File diff suppressed because it is too large
Load Diff
|
@ -8,9 +8,6 @@
|
|||
#ifndef __CROS_EC_USB_PD_TCPM_H
|
||||
#define __CROS_EC_USB_PD_TCPM_H
|
||||
|
||||
#include "ec_commands.h"
|
||||
#include "i2c.h"
|
||||
|
||||
/* Default retry count for transmitting */
|
||||
#define PD_RETRY_COUNT 3
|
||||
|
||||
|
@ -80,8 +77,7 @@ enum tcpc_cc_polarity {
|
|||
static inline enum tcpc_cc_polarity polarity_rm_dts(
|
||||
enum tcpc_cc_polarity polarity)
|
||||
{
|
||||
BUILD_ASSERT(POLARITY_COUNT == 4);
|
||||
return polarity & BIT(0);
|
||||
return polarity & (1 << 0);
|
||||
}
|
||||
|
||||
enum tcpm_transmit_type {
|
||||
|
@ -168,343 +164,4 @@ static inline int cc_is_only_one_rd(enum tcpc_cc_voltage_status cc1,
|
|||
return cc_is_at_least_one_rd(cc1, cc2) && cc1 != cc2;
|
||||
}
|
||||
|
||||
struct tcpm_drv {
|
||||
/**
|
||||
* Initialize TCPM driver and wait for TCPC readiness.
|
||||
*
|
||||
* @param port Type-C port number
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int (*init)(int port);
|
||||
|
||||
/**
|
||||
* Release the TCPM hardware and disconnect the driver.
|
||||
* Only .init() can be called after .release().
|
||||
*
|
||||
* @param port Type-C port number
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int (*release)(int port);
|
||||
|
||||
/**
|
||||
* Read the CC line status.
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @param cc1 pointer to CC status for CC1
|
||||
* @param cc2 pointer to CC status for CC2
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int (*get_cc)(int port, enum tcpc_cc_voltage_status *cc1,
|
||||
enum tcpc_cc_voltage_status *cc2);
|
||||
|
||||
/**
|
||||
* Read VBUS
|
||||
*
|
||||
* @param port Type-C port number
|
||||
*
|
||||
* @return 0 => VBUS not detected, 1 => VBUS detected
|
||||
*/
|
||||
int (*get_vbus_level)(int port);
|
||||
|
||||
/**
|
||||
* Set the value of the CC pull-up used when we are a source.
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @param rp One of enum tcpc_rp_value
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int (*select_rp_value)(int port, int rp);
|
||||
|
||||
/**
|
||||
* Set the CC pull resistor. This sets our role as either source or sink.
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @param pull One of enum tcpc_cc_pull
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int (*set_cc)(int port, int pull);
|
||||
|
||||
/**
|
||||
* Set polarity
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @param polarity port polarity
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int (*set_polarity)(int port, enum tcpc_cc_polarity polarity);
|
||||
|
||||
/**
|
||||
* Set Vconn.
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @param enable Enable/Disable Vconn
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int (*set_vconn)(int port, int enable);
|
||||
|
||||
/**
|
||||
* Set PD message header to use for goodCRC
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @param power_role Power role to use in header
|
||||
* @param data_role Data role to use in header
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int (*set_msg_header)(int port, int power_role, int data_role);
|
||||
|
||||
/**
|
||||
* Set RX enable flag
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @enable true for enable, false for disable
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int (*set_rx_enable)(int port, int enable);
|
||||
|
||||
/**
|
||||
* Read received PD message from the TCPC
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @param payload Pointer to location to copy payload of message
|
||||
* @param header of message
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int (*get_message_raw)(int port, uint32_t *payload, int *head);
|
||||
|
||||
/**
|
||||
* Transmit PD message
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @param type Transmit type
|
||||
* @param header Packet header
|
||||
* @param cnt Number of bytes in payload
|
||||
* @param data Payload
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int (*transmit)(int port, enum tcpm_transmit_type type, uint16_t header,
|
||||
const uint32_t *data);
|
||||
|
||||
/**
|
||||
* TCPC is asserting alert
|
||||
*
|
||||
* @param port Type-C port number
|
||||
*/
|
||||
void (*tcpc_alert)(int port);
|
||||
|
||||
/**
|
||||
* Discharge PD VBUS on src/sink disconnect & power role swap
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @param enable Discharge enable or disable
|
||||
*/
|
||||
void (*tcpc_discharge_vbus)(int port, int enable);
|
||||
|
||||
/**
|
||||
* Auto Discharge Disconnect
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @param enable Auto Discharge enable or disable
|
||||
*/
|
||||
void (*tcpc_enable_auto_discharge_disconnect)(int port,
|
||||
int enable);
|
||||
|
||||
/**
|
||||
* Set new connection
|
||||
* There is a new connection. May have to handle differently
|
||||
* if we were performing auto-toggle. Allow a driver to do
|
||||
* any work required to leave the unattached auto-toggle mode
|
||||
* as well as setting the CC lines. If auto-toggle is not
|
||||
* being used or was not the cause of the new connection
|
||||
* detection then set both CC lines to the passed pull.
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @param pull enum tcpc_cc_pull of CC lines
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int (*set_new_connection)(int port,
|
||||
enum tcpc_cc_pull pull);
|
||||
|
||||
#ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
|
||||
/**
|
||||
* Enable TCPC auto DRP toggling.
|
||||
*
|
||||
* @param port Type-C port number
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int (*drp_toggle)(int port);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get firmware version.
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @param live Fetch live chip info or hard-coded + cached info
|
||||
* @param info Pointer to pointer to PD chip info
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int (*get_chip_info)(int port, int live,
|
||||
struct ec_response_pd_chip_info_v1 **info);
|
||||
|
||||
#ifdef CONFIG_USBC_PPC
|
||||
/**
|
||||
* Send SinkVBUS or DisableSinkVBUS command
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @enable true for enable, false for disable
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int (*set_snk_ctrl)(int port, int enable);
|
||||
|
||||
/**
|
||||
* Send SourceVBUS or DisableSourceVBUS command
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @enable true for enable, false for disable
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int (*set_src_ctrl)(int port, int enable);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
|
||||
/**
|
||||
* Instructs the TCPC to enter into low power mode.
|
||||
*
|
||||
* NOTE: Do no use tcpc_(read|write) style helper methods in this
|
||||
* function. You must use i2c_(read|write) directly.
|
||||
*
|
||||
* @param port Type-C port number
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int (*enter_low_power_mode)(int port);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Enable/Disable TCPC FRS detection
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @param enable FRS enable (true) disable (false)
|
||||
*/
|
||||
void (*set_frs_enable)(int port, int enable);
|
||||
};
|
||||
|
||||
/*
|
||||
* Macros for tcpc_config_t flags field.
|
||||
*
|
||||
* Bit 0 --> Polarity for TCPC alert. Set to 1 if alert is active high.
|
||||
* Bit 1 --> Set to 1 if TCPC alert line is open-drain instead of push-pull.
|
||||
* Bit 2 --> Polarity for TCPC reset. Set to 1 if reset line is active high.
|
||||
* Bit 3 --> Set to 1 if TCPC is using TCPCI Revision 2.0
|
||||
*/
|
||||
#define TCPC_FLAGS_ALERT_ACTIVE_HIGH BIT(0)
|
||||
#define TCPC_FLAGS_ALERT_OD BIT(1)
|
||||
#define TCPC_FLAGS_RESET_ACTIVE_HIGH BIT(2)
|
||||
#define TCPC_FLAGS_TCPCI_REV2_0 BIT(3)
|
||||
|
||||
struct tcpc_config_t {
|
||||
enum ec_bus_type bus_type; /* enum ec_bus_type */
|
||||
union {
|
||||
struct i2c_info_t i2c_info;
|
||||
};
|
||||
const struct tcpm_drv *drv;
|
||||
/* See TCPC_FLAGS_* above */
|
||||
uint32_t flags;
|
||||
#ifdef CONFIG_INTEL_VIRTUAL_MUX
|
||||
/*
|
||||
* 0-3: Corresponding USB2 port number (1 ~ 15)
|
||||
* 4-7: Corresponding USB3 port number (1 ~ 15)
|
||||
*/
|
||||
uint8_t usb23;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef CONFIG_USB_PD_TCPC_RUNTIME_CONFIG
|
||||
extern const struct tcpc_config_t tcpc_config[];
|
||||
#else
|
||||
extern struct tcpc_config_t tcpc_config[];
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the PD_STATUS_TCPC_ALERT_* mask corresponding to the TCPC ports
|
||||
* that are currently asserting ALERT.
|
||||
*
|
||||
* @return PD_STATUS_TCPC_ALERT_* mask.
|
||||
*/
|
||||
uint16_t tcpc_get_alert_status(void);
|
||||
|
||||
/**
|
||||
* Optional, set the TCPC power mode.
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @param mode 0: off/sleep, 1: on/awake
|
||||
*/
|
||||
void board_set_tcpc_power_mode(int port, int mode) __attribute__((weak));
|
||||
|
||||
/**
|
||||
* Initialize TCPC.
|
||||
*
|
||||
* @param port Type-C port number
|
||||
*/
|
||||
void tcpc_init(int port);
|
||||
|
||||
/**
|
||||
* TCPC is asserting alert
|
||||
*
|
||||
* @param port Type-C port number
|
||||
*/
|
||||
void tcpc_alert_clear(int port);
|
||||
|
||||
/**
|
||||
* Run TCPC task once. This checks for incoming messages, processes
|
||||
* any outgoing messages, and reads CC lines.
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @param evt Event type that woke up this task
|
||||
*/
|
||||
int tcpc_run(int port, int evt);
|
||||
|
||||
/**
|
||||
* Initialize board specific TCPC functions post TCPC initialization.
|
||||
*
|
||||
* @param port Type-C port number
|
||||
*
|
||||
* @return EC_SUCCESS or error
|
||||
*/
|
||||
int board_tcpc_post_init(int port) __attribute__((weak));
|
||||
|
||||
/**
|
||||
* Turn on/off VCONN power switch in board specific code.
|
||||
*
|
||||
* @param port Type-C port number
|
||||
* @param cc_pin 0:CC pin 0, 1: CC pin 1
|
||||
* @param enabled 1: Enable VCONN, 0: Disable VCONN
|
||||
*
|
||||
*/
|
||||
void board_pd_vconn_ctrl(int port, enum usbpd_cc_pin cc_pin, int enabled);
|
||||
|
||||
/**
|
||||
* Get the VBUS voltage from TCPC
|
||||
*
|
||||
* @param port Type-C port number
|
||||
*
|
||||
* @return VBUS voltage in mV.
|
||||
*/
|
||||
int tcpc_get_vbus_voltage(int port);
|
||||
|
||||
#endif /* __CROS_EC_USB_PD_TCPM_H */
|
||||
|
|
Loading…
Reference in New Issue