MLK-16013-19 staging: typec: tcpci: Only touch target bit when enable vconn
authorLi Jun <jun.li@nxp.com>
Thu, 27 Jul 2017 13:13:19 +0000 (21:13 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:36:19 +0000 (15:36 -0500)
We need a read and then write back to avoid touch any other bits when
enable or disable vconn.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
drivers/staging/typec/tcpci.c

index dbab97b..cfd80a2 100644 (file)
@@ -263,12 +263,10 @@ static int tcpci_set_vconn(struct tcpc_dev *tcpc, bool enable)
        struct tcpci *tcpci = tcpc_to_tcpci(tcpc);
        int ret;
 
-       ret = regmap_write(tcpci->regmap, TCPC_POWER_CTRL,
-                          enable ? TCPC_POWER_CTRL_VCONN_ENABLE : 0);
-       if (ret < 0)
-               return ret;
-
-       return 0;
+       ret = regmap_update_bits(tcpci->regmap, TCPC_POWER_CTRL,
+                               TCPC_POWER_CTRL_VCONN_ENABLE,
+                               enable ? TCPC_POWER_CTRL_VCONN_ENABLE : 0);
+       return ret;
 }
 
 static int tcpci_set_roles(struct tcpc_dev *tcpc, bool attached,