summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2021-12-23 15:32:16 +0800
committerCommit Bot <commit-bot@chromium.org>2021-12-23 11:27:58 +0000
commit80ff7fbe29f93b85a48336ff05aa27a10f7a5a5f (patch)
treed5ad29b66dc1462f17c0024f2befe87caa9c829e
parentd68d233fb3ec937678e77f27c5eca28ffb0f0d42 (diff)
downloadchrome-ec-80ff7fbe29f93b85a48336ff05aa27a10f7a5a5f.tar.gz
mt6360: enable high impedance mode to save power
MTK suggests enable HZ when VBUS ready. See issue link for detail. BUG=b:209549587 TEST=manually measure power consumption BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I01b44d9be78d4e670d28d96a5e6696ffe5009161 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3354410 Tested-by: Ting Shen <phoenixshen@chromium.org> Auto-Submit: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org> Commit-Queue: Rong Chang <rongchang@chromium.org>
-rw-r--r--driver/bc12/mt6360.c10
-rw-r--r--driver/bc12/mt6360.h3
2 files changed, 12 insertions, 1 deletions
diff --git a/driver/bc12/mt6360.c b/driver/bc12/mt6360.c
index e9fc769d5e..78d955fc9e 100644
--- a/driver/bc12/mt6360.c
+++ b/driver/bc12/mt6360.c
@@ -166,10 +166,18 @@ static void mt6360_usb_charger_task(const int port)
/* vbus change, start bc12 detection */
if (evt & USB_CHG_EVENT_VBUS) {
+ bool is_sink = pd_get_power_role(port) == PD_ROLE_SINK;
bool is_non_pd_sink = !pd_capable(port) &&
- pd_get_power_role(port) == PD_ROLE_SINK &&
+ 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
diff --git a/driver/bc12/mt6360.h b/driver/bc12/mt6360.h
index e23a2623ed..781bed2f57 100644
--- a/driver/bc12/mt6360.h
+++ b/driver/bc12/mt6360.h
@@ -9,6 +9,9 @@
#define MT6360_IRQ_MASK 0x0C
+#define MT6360_REG_CHG_CTRL1 0x11
+#define MT6360_MASK_HZ BIT(2)
+
#define MT6360_REG_DEVICE_TYPE 0x22
#define MT6360_MASK_USBCHGEN BIT(7)