Skip to contentSkip to conversation

staging: typec: tcpci: Only touch target bit when enable vconn

PATCH Superseded Jun Li 1 participant 1 message Mar 13, 2018

Subsystems (2)

v3 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Jun Li

author
#0 lore raw

PATCH v3 11/12 staging: typec: tcpci: Only touch target bit when enable vconn

We need regmap_update_bits to avoid touch any other bits when enable or disable vconn.

---
 drivers/staging/typec/tcpci.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/staging/typec/tcpci.c +3 -6
index 6fdb179..46c4cff 100644
@@ -219,12 +219,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,