summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Jun <jun.li@nxp.com>2018-06-06 16:30:03 +0800
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:32:09 +0800
commitf1d42505a68ddfbee2d4e80d1e22b6a0078b4c2d (patch)
tree8fad35f00f2774c7ae5b0a63bb927e1c22a499c0
parent0074b54ca40beee7744fdd9d558dc61593387d40 (diff)
MLK-18531 staging: typec: don't do vbus source disable for dead battery
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>
-rw-r--r--drivers/staging/typec/tcpci.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c
index 2d4fbb8aac5e..7352207224b5 100644
--- a/drivers/staging/typec/tcpci.c
+++ b/drivers/staging/typec/tcpci.c
@@ -381,9 +381,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)