mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 17:41:54 +00:00
samus: turn on PP5000 when AC is attached in G3
Turn on PP5000 when AC is plugged in in G3 so that the PD MCU can accurately measure the CC voltage. BUG=chrome-os-partner:33909 BRANCH=samus TEST=test with various type-C chargers. verify that in G3 the pp5000 rail is on when AC is plugged in, but off when AC is unplugged used reported battery current to estimate that turning on PP5000 rail in G3 consumes an extra 30mW of power, but that shouldn't matter much when AC is connected. Change-Id: I3cdd2aaf3e7688d69a65e5d11e38e5b9cf16e703 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/233734 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
5ec4f320f4
commit
a94a5561dc
@@ -31,12 +31,18 @@ static void extpower_deferred(void)
|
||||
|
||||
if (extpower && !extpower_prev) {
|
||||
charger_discharge_on_ac(0);
|
||||
/* If in G3, enable PP5000 for accurate sensing of CC */
|
||||
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
|
||||
gpio_set_level(GPIO_PP5000_EN, 1);
|
||||
} else if (extpower && extpower_prev) {
|
||||
/* glitch on AC_PRESENT, attempt to recover from backboost */
|
||||
charger_discharge_on_ac(1);
|
||||
charger_discharge_on_ac(0);
|
||||
} else {
|
||||
charger_discharge_on_ac(1);
|
||||
/* If in G3, make sure PP5000 is off when no AC */
|
||||
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
|
||||
gpio_set_level(GPIO_PP5000_EN, 0);
|
||||
}
|
||||
extpower_prev = extpower;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "chipset.h"
|
||||
#include "common.h"
|
||||
#include "console.h"
|
||||
#include "extpower.h"
|
||||
#include "gpio.h"
|
||||
#include "hooks.h"
|
||||
#include "host_command.h"
|
||||
@@ -85,7 +86,12 @@ static void chipset_force_g3(void)
|
||||
gpio_set_level(GPIO_PP1800_EN, 0);
|
||||
gpio_set_level(GPIO_PP3300_DSW_GATED_EN, 0);
|
||||
gpio_set_level(GPIO_PP5000_USB_EN, 0);
|
||||
gpio_set_level(GPIO_PP5000_EN, 0);
|
||||
/*
|
||||
* Don't disable PP5000 if AC is attached because we need
|
||||
* it for accurate CC line voltage measurement on PD MCU.
|
||||
*/
|
||||
if (!extpower_is_present())
|
||||
gpio_set_level(GPIO_PP5000_EN, 0);
|
||||
gpio_set_level(GPIO_PCH_RSMRST_L, 0);
|
||||
gpio_set_level(GPIO_PCH_DPWROK, 0);
|
||||
gpio_set_level(GPIO_PP3300_DSW_EN, 0);
|
||||
@@ -468,7 +474,13 @@ enum power_state power_handle_state(enum power_state state)
|
||||
|
||||
/* Turn off power rails enabled in S5 */
|
||||
gpio_set_level(GPIO_PP1050_EN, 0);
|
||||
gpio_set_level(GPIO_PP5000_EN, 0);
|
||||
|
||||
/*
|
||||
* Don't disable PP5000 if AC is attached because we need
|
||||
* it for accurate CC line voltage measurement on PD MCU.
|
||||
*/
|
||||
if (!extpower_is_present())
|
||||
gpio_set_level(GPIO_PP5000_EN, 0);
|
||||
|
||||
/* Disable 3.3V DSW */
|
||||
gpio_set_level(GPIO_PP3300_DSW_EN, 0);
|
||||
@@ -490,6 +502,13 @@ int lb_power(int enabled)
|
||||
if (!chipset_in_state(CHIPSET_STATE_ANY_OFF))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Don't disable PP5000 if AC is attached because we need it for
|
||||
* accurate CC line voltage measurement on PD MCU.
|
||||
*/
|
||||
if (!enabled && extpower_is_present())
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* If the AP is off, we can still turn the lightbar on briefly.
|
||||
* When turning on, we have to wait for the rails to come up fully
|
||||
|
||||
@@ -1972,6 +1972,15 @@ void pd_task(void)
|
||||
#ifdef CONFIG_CHARGE_MANAGER
|
||||
timeout = PD_T_SINK_ADJ - PD_T_DEBOUNCE;
|
||||
|
||||
/*
|
||||
* If we didn't come from disconnected, must have
|
||||
* come from some path that did not set typec
|
||||
* current limit. So, set to 0 so that we guarantee
|
||||
* this is revised below.
|
||||
*/
|
||||
if (pd[port].last_state != PD_STATE_SNK_DISCONNECTED)
|
||||
typec_curr = 0;
|
||||
|
||||
/* Check if CC pull-up has changed */
|
||||
cc1_volt = pd_adc_read(port, pd[port].polarity);
|
||||
if (typec_curr != get_typec_current_limit(cc1_volt)) {
|
||||
|
||||
Reference in New Issue
Block a user