MLK-18531 usb: typec: don't do vbus source disable for dead battery
authorLi Jun <jun.li@nxp.com>
Wed, 9 Jan 2019 10:01:47 +0000 (15:31 +0530)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
In PTN5110 design, DisableSourceVBUS command also disables the sink
enable signal because the EN_SNK can be used to source higher voltage,
and, there is only one TCPC command to disable sourcing voltage without
telling whether to disable 5V or the high voltage, and to keep the
design simple they designed the PTN5110 to disable both. with this
fact, we use the flag drive_vbus to check if the source vbus enable was
issued, if yes we then do vbus source disable, in dead battery case,
we never did vbus source enable, so will not issue vbus source disable
command.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
drivers/usb/typec/tcpci.c

index 5567a93..40b8f3b 100644 (file)
@@ -403,9 +403,8 @@ static int tcpci_set_vbus(struct tcpc_dev *tcpc, bool source, bool sink)
        struct tcpci *tcpci = tcpc_to_tcpci(tcpc);
        int ret;
 
-       /* Disable both source and sink first before enabling anything */
-
-       if (!source) {
+       /* Only disable source if it was enabled */
+       if (!source && tcpci->drive_vbus) {
                ret = regmap_write(tcpci->regmap, TCPC_COMMAND,
                                   TCPC_CMD_DISABLE_SRC_VBUS);
                if (ret < 0)