Re: [PATCH 05/14 v5] usb: typec: tcpci: Add set_vbus tcpci callback

2020-08-28 Thread Greg Kroah-Hartman
On Mon, Aug 24, 2020 at 09:22:01PM -0700, Badhri Jagan Sridharan wrote:
> 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 
> ---
>  drivers/usb/typec/tcpm/tcpci.c | 7 +++
>  drivers/usb/typec/tcpm/tcpci.h | 1 +
>  2 files changed, 8 insertions(+)

Why is this patch "v5" and the others "v1" in this series?

That's totally confusing, please just version the whole series, not
individual patches, as you are not providing version information about
what changed in this patch, right?

Make it easy for reviewers please...

thanks,

greg k-h


[PATCH 05/14 v5] usb: typec: tcpci: Add set_vbus tcpci callback

2020-08-24 Thread Badhri Jagan Sridharan
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 
---
 drivers/usb/typec/tcpm/tcpci.c | 7 +++
 drivers/usb/typec/tcpm/tcpci.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
index 7b7991c8ac87..89d28e3fbee8 100644
--- a/drivers/usb/typec/tcpm/tcpci.c
+++ b/drivers/usb/typec/tcpm/tcpci.c
@@ -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) {
diff --git a/drivers/usb/typec/tcpm/tcpci.h b/drivers/usb/typec/tcpm/tcpci.h
index 04c49a0b0368..4d441bdf24d5 100644
--- a/drivers/usb/typec/tcpm/tcpci.h
+++ b/drivers/usb/typec/tcpm/tcpci.h
@@ -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);
-- 
2.28.0.297.g1956fa8f8d-goog