Skip to content

Commit

Permalink
usb: typec: tcpci: Add set_vbus tcpci callback
Browse files Browse the repository at this point in the history
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 <badhri@google.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20201008061556.1402293-3-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Badhri Jagan Sridharan authored and Greg Kroah-Hartman committed Oct 8, 2020
1 parent 58ea326 commit b9358a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/usb/typec/tcpm/tcpci.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,13 @@ static int tcpci_set_vbus(struct tcpc_dev *tcpc, bool source, bool sink)
struct tcpci *tcpci = tcpc_to_tcpci(tcpc);
int ret;

if (tcpci->data->set_vbus) {
ret = tcpci->data->set_vbus(tcpci, tcpci->data, source, sink);
/* Bypass when ret > 0 */
if (ret != 0)
return ret < 0 ? ret : 0;
}

/* Disable both source and sink first before enabling anything */

if (!source) {
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/typec/tcpm/tcpci.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ struct tcpci_data {
bool enable);
int (*start_drp_toggling)(struct tcpci *tcpci, struct tcpci_data *data,
enum typec_cc_status cc);
int (*set_vbus)(struct tcpci *tcpci, struct tcpci_data *data, bool source, bool sink);
};

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

0 comments on commit b9358a0

Please sign in to comment.