Skip to content

Commit b9358a0

Browse files
Badhri Jagan Sridharangregkh
authored andcommitted
usb: typec: tcpci: Add set_vbus tcpci callback
set_vbus callback allows TCPC which are TCPCI based, however, does not support turning on sink and source mode through Command.SinkVbus and Command.SourceVbusDefaultVoltage. Signed-off-by: Badhri Jagan Sridharan <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 58ea326 commit b9358a0

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

drivers/usb/typec/tcpm/tcpci.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,13 @@ static int tcpci_set_vbus(struct tcpc_dev *tcpc, bool source, bool sink)
328328
struct tcpci *tcpci = tcpc_to_tcpci(tcpc);
329329
int ret;
330330

331+
if (tcpci->data->set_vbus) {
332+
ret = tcpci->data->set_vbus(tcpci, tcpci->data, source, sink);
333+
/* Bypass when ret > 0 */
334+
if (ret != 0)
335+
return ret < 0 ? ret : 0;
336+
}
337+
331338
/* Disable both source and sink first before enabling anything */
332339

333340
if (!source) {

drivers/usb/typec/tcpm/tcpci.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ struct tcpci_data {
144144
bool enable);
145145
int (*start_drp_toggling)(struct tcpci *tcpci, struct tcpci_data *data,
146146
enum typec_cc_status cc);
147+
int (*set_vbus)(struct tcpci *tcpci, struct tcpci_data *data, bool source, bool sink);
147148
};
148149

149150
struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data);

0 commit comments

Comments
 (0)