diff options
author | Kyle Tso <kyletso@google.com> | 2023-03-17 12:13:11 +0800 |
---|---|---|
committer | Kyle Tso <kyletso@google.com> | 2023-05-23 20:31:24 +0800 |
commit | cf9a34baaf81991a1a45f45ab52e5f1faee1131b (patch) | |
tree | 40e0f45637544fbc4f503237c9f06f1cb13ba29e | |
parent | bbf14cededa0b49da99d7c6eafebe4c5607d2b7e (diff) | |
download | tangorpro-cf9a34baaf81991a1a45f45ab52e5f1faee1131b.tar.gz |
pogo_transport: Disable POGO OVP only in some states
Bug: 259305712
Change-Id: Ie2e6d0634828b009057d588a8b6240fc492b63d1
Signed-off-by: Kyle Tso <kyletso@google.com>
(cherry picked from commit 361181a1412706586297e1782c10f84450cf26dd)
-rw-r--r-- | pogo/pogo_transport.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/pogo/pogo_transport.c b/pogo/pogo_transport.c index 36a0af3..46f9996 100644 --- a/pogo/pogo_transport.c +++ b/pogo/pogo_transport.c @@ -1481,6 +1481,7 @@ static void pogo_transport_enable_usb_data(struct pogo_transport *pogo_transport /* * Call this function to: + * - Disable POGO OVP * - Disable Accessory Detection IRQ * - Disable POGO Voltage Detection IRQ * - Enable POGO Vout by voting 1 to charger_mode_votable @@ -1494,6 +1495,14 @@ static void pogo_transport_skip_acc_detection(struct pogo_transport *pogo_transp logbuffer_log(pogo_transport->log, "%s: Skip enabling comparator logic, enable vout", __func__); + /* + * Disable OVP to prevent the voltage going through POGO_VIN. OVP will be re-enabled once + * we vote GBMS_POGO_VIN and GBMS gets the votable result. + */ + if (pogo_transport->pogo_ovp_en_gpio >= 0) + gpio_set_value_cansleep(pogo_transport->pogo_ovp_en_gpio, + !pogo_transport->pogo_ovp_en_active_state); + if (pogo_transport->acc_irq_enabled) { disable_irq(pogo_transport->pogo_acc_irq); pogo_transport->acc_irq_enabled = false; @@ -1525,11 +1534,6 @@ static void pogo_transport_hes_acc_detected(struct pogo_transport *pogo_transpor struct max77759_plat *chip = pogo_transport->chip; int ret; - /* Disable OVP to prevent the voltage going through POGO_VIN */ - if (pogo_transport->pogo_ovp_en_gpio >= 0) - gpio_set_value_cansleep(pogo_transport->pogo_ovp_en_gpio, - !pogo_transport->pogo_ovp_en_active_state); - if (pogo_transport->accessory_detection_enabled == ENABLED) { switch (pogo_transport->state) { case STANDBY: @@ -1538,6 +1542,14 @@ static void pogo_transport_hes_acc_detected(struct pogo_transport *pogo_transpor case AUDIO_DIRECT: case AUDIO_HUB: case HOST_DIRECT: + /* + * Disable OVP to prevent the voltage going through POGO_VIN. OVP will be + * re-enabled once we vote GBMS_POGO_VIN and GBMS gets the votable result. + */ + if (pogo_transport->pogo_ovp_en_gpio >= 0) + gpio_set_value_cansleep(pogo_transport->pogo_ovp_en_gpio, + !pogo_transport->pogo_ovp_en_active_state); + if (!pogo_transport->acc_irq_enabled) { enable_irq(pogo_transport->pogo_acc_irq); pogo_transport->acc_irq_enabled = true; |