Skip to contentSkip to conversation

usb: typec: tcpci: Enable bleed discharge when auto discharge is enabled

PATCH In review Badhri Jagan Sridharan 3 participants 3 messages Dec 11, 2020

Subsystems (3)
lore
Share & tools
lore

Badhri Jagan Sridharan

author maintainer
#0 lore raw

PATCH 1/1 usb: typec: tcpci: Enable bleed discharge when auto discharge is enabled

Auto discharge circuits kick in only when vbus decays and reaches VBUS_SINK_DISCONNECT_THRESHOLD threshold. Enable bleed discharge to discharge vbus to VBUS_SINK_DISCONNECT_THRESHOLD upon disconnect.

---
 drivers/usb/typec/tcpm/tcpci.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/typec/tcpm/tcpci.c +2 -0
index af5524338a63..f676abab044b 100644
@@ -725,6 +725,8 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data)
 		tcpci->tcpc.enable_auto_vbus_discharge = tcpci_enable_auto_vbus_discharge;
 		tcpci->tcpc.set_auto_vbus_discharge_threshold =
 			tcpci_set_auto_vbus_discharge_threshold;
+		regmap_update_bits(tcpci->regmap, TCPC_POWER_CTRL, TCPC_POWER_CTRL_BLEED_DISCHARGE,
+				   TCPC_POWER_CTRL_BLEED_DISCHARGE);
 	}
 
 	if (tcpci->data->vbus_vsafe0v)
Signature · 1 line
2.29.2.576.ga3fc446d84-goog
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Badhri Jagan Sridharan

Auto discharge circuits kick in only when vbus decays and reaches VBUS_SINK_DISCONNECT_THRESHOLD threshold. Enable bleed discharge to discharge vbus to VBUS_SINK_DISCONNECT_THRESHOLD upon disconnect.

Quoted 19 lines
---
 drivers/usb/typec/tcpm/tcpci.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/typec/tcpm/tcpci.c +2 -0
index af5524338a63..f676abab044b 100644
@@ -725,6 +725,8 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data)
 		tcpci->tcpc.enable_auto_vbus_discharge = tcpci_enable_auto_vbus_discharge;
 		tcpci->tcpc.set_auto_vbus_discharge_threshold =
 			tcpci_set_auto_vbus_discharge_threshold;
+		regmap_update_bits(tcpci->regmap, TCPC_POWER_CTRL, TCPC_POWER_CTRL_BLEED_DISCHARGE,
+				   TCPC_POWER_CTRL_BLEED_DISCHARGE);
 	}
 
 	if (tcpci->data->vbus_vsafe0v)
Signature · 1 line
2.29.2.576.ga3fc446d84-goog
Signature · 1 line
heikki
Reviewed-by on v1 1/1
#2 lore raw
In reply to Badhri Jagan Sridharan
Quoted 5 lines · Badhri Jagan Sridharan

Auto discharge circuits kick in only when vbus decays and reaches VBUS_SINK_DISCONNECT_THRESHOLD threshold. Enable bleed discharge to discharge vbus to VBUS_SINK_DISCONNECT_THRESHOLD upon disconnect.

Quoted 18 lines
---
 drivers/usb/typec/tcpm/tcpci.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/typec/tcpm/tcpci.c +2 -0
index af5524338a63..f676abab044b 100644
@@ -725,6 +725,8 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data)
 		tcpci->tcpc.enable_auto_vbus_discharge = tcpci_enable_auto_vbus_discharge;
 		tcpci->tcpc.set_auto_vbus_discharge_threshold =
 			tcpci_set_auto_vbus_discharge_threshold;
+		regmap_update_bits(tcpci->regmap, TCPC_POWER_CTRL, TCPC_POWER_CTRL_BLEED_DISCHARGE,
+				   TCPC_POWER_CTRL_BLEED_DISCHARGE);
 	}
 
 	if (tcpci->data->vbus_vsafe0v)