summaryrefslogtreecommitdiff
path: root/driver/bc12/mt6360.c
diff options
context:
space:
mode:
Diffstat (limited to 'driver/bc12/mt6360.c')
-rw-r--r--driver/bc12/mt6360.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/driver/bc12/mt6360.c b/driver/bc12/mt6360.c
index 50aa4d0e45..78d955fc9e 100644
--- a/driver/bc12/mt6360.c
+++ b/driver/bc12/mt6360.c
@@ -166,7 +166,19 @@ static void mt6360_usb_charger_task(const int port)
/* vbus change, start bc12 detection */
if (evt & USB_CHG_EVENT_VBUS) {
- if (pd_snk_is_vbus_provided(port))
+ bool is_sink = pd_get_power_role(port) == PD_ROLE_SINK;
+ bool is_non_pd_sink = !pd_capable(port) &&
+ is_sink &&
+ pd_snk_is_vbus_provided(port);
+
+ if (is_sink)
+ mt6360_clr_bit(MT6360_REG_CHG_CTRL1,
+ MT6360_MASK_HZ);
+ else
+ mt6360_set_bit(MT6360_REG_CHG_CTRL1,
+ MT6360_MASK_HZ);
+
+ if (is_non_pd_sink)
mt6360_enable_bc12_detection(1);
else
mt6360_update_charge_manager(