]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: typec: tcpci: Only touch target bit when enable vconn
authorLi Jun <jun.li@nxp.com>
Tue, 26 Jun 2018 23:45:31 +0000 (07:45 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Jun 2018 10:49:48 +0000 (19:49 +0900)
We need regmap_update_bits to avoid touch any other bits when
enable or disable vconn.

Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/typec/tcpci.c

index 11c2d37622deb555d2acc26f78c7bb27228842f8..ac6b418b15f1f1d1baeb3448ee0d02a0a851e073 100644 (file)
@@ -218,12 +218,9 @@ static int tcpci_set_vconn(struct tcpc_dev *tcpc, bool enable)
                        return ret;
        }
 
-       ret = regmap_write(tcpci->regmap, TCPC_POWER_CTRL,
-                          enable ? TCPC_POWER_CTRL_VCONN_ENABLE : 0);
-       if (ret < 0)
-               return ret;
-
-       return 0;
+       return regmap_update_bits(tcpci->regmap, TCPC_POWER_CTRL,
+                               TCPC_POWER_CTRL_VCONN_ENABLE,
+                               enable ? TCPC_POWER_CTRL_VCONN_ENABLE : 0);
 }
 
 static int tcpci_set_roles(struct tcpc_dev *tcpc, bool attached,