@@ -54,6 +54,27 @@ enum tcpm_transmit_type {
5454 TCPC_TX_BIST_MODE_2 = 7
5555};
5656
57+ /**
58+ * struct tcpc_config - Port configuration
59+ * @src_pdo: PDO parameters sent to port partner as response to
60+ * PD_CTRL_GET_SOURCE_CAP message
61+ * @nr_src_pdo: Number of entries in @src_pdo
62+ * @snk_pdo: PDO parameters sent to partner as response to
63+ * PD_CTRL_GET_SINK_CAP message
64+ * @nr_snk_pdo: Number of entries in @snk_pdo
65+ * @max_snk_mv: Maximum acceptable sink voltage in mV
66+ * @max_snk_ma: Maximum sink current in mA
67+ * @max_snk_mw: Maximum required sink power in mW
68+ * @operating_snk_mw:
69+ * Required operating sink power in mW
70+ * @type: Port type (TYPEC_PORT_DFP, TYPEC_PORT_UFP, or
71+ * TYPEC_PORT_DRP)
72+ * @default_role:
73+ * Default port role (TYPEC_SINK or TYPEC_SOURCE).
74+ * Set to TYPEC_NO_PREFERRED_ROLE if no default role.
75+ * @try_role_hw:True if try.{Src,Snk} is implemented in hardware
76+ * @alt_modes: List of supported alternate modes
77+ */
5778struct tcpc_config {
5879 const u32 * src_pdo ;
5980 unsigned int nr_src_pdo ;
@@ -79,7 +100,6 @@ struct tcpc_config {
79100enum tcpc_usb_switch {
80101 TCPC_USB_SWITCH_CONNECT ,
81102 TCPC_USB_SWITCH_DISCONNECT ,
82- TCPC_USB_SWITCH_RESTORE , /* TODO FIXME */
83103};
84104
85105/* Mux state attributes */
@@ -104,17 +124,40 @@ struct tcpc_mux_dev {
104124 void * priv_data ;
105125};
106126
127+ /**
128+ * struct tcpc_dev - Port configuration and callback functions
129+ * @config: Pointer to port configuration
130+ * @get_vbus: Called to read current VBUS state
131+ * @get_current_limit:
132+ * Optional; called by the tcpm core when configured as a snk
133+ * and cc=Rp-def. This allows the tcpm to provide a fallback
134+ * current-limit detection method for the cc=Rp-def case.
135+ * For example, some tcpcs may include BC1.2 charger detection
136+ * and use that in this case.
137+ * @set_cc: Called to set value of CC pins
138+ * @get_cc: Called to read current CC pin values
139+ * @set_polarity:
140+ * Called to set polarity
141+ * @set_vconn: Called to enable or disable VCONN
142+ * @set_vbus: Called to enable or disable VBUS
143+ * @set_current_limit:
144+ * Optional; called to set current limit as negotiated
145+ * with partner.
146+ * @set_pd_rx: Called to enable or disable reception of PD messages
147+ * @set_roles: Called to set power and data roles
148+ * @start_drp_toggling:
149+ * Optional; if supported by hardware, called to start DRP
150+ * toggling. DRP toggling is stopped automatically if
151+ * a connection is established.
152+ * @try_role: Optional; called to set a preferred role
153+ * @pd_transmit:Called to transmit PD message
154+ * @mux: Pointer to multiplexer data
155+ */
107156struct tcpc_dev {
108157 const struct tcpc_config * config ;
109158
110159 int (* init )(struct tcpc_dev * dev );
111160 int (* get_vbus )(struct tcpc_dev * dev );
112- /*
113- * This optional callback gets called by the tcpm core when configured
114- * as a snk and cc=Rp-def. This allows the tcpm to provide a fallback
115- * current-limit detection method for the cc=Rp-def case. E.g. some
116- * tcpcs may include BC1.2 charger detection and use that in this case.
117- */
118161 int (* get_current_limit )(struct tcpc_dev * dev );
119162 int (* set_cc )(struct tcpc_dev * dev , enum typec_cc_status cc );
120163 int (* get_cc )(struct tcpc_dev * dev , enum typec_cc_status * cc1 ,
0 commit comments