mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-28 02:35:28 +00:00
samus_pd: remove dead code around allowing PD negotiation
Remove code for preventing PD negotiation until the battery is at some minimum SOC. This was originally necessary because transitioning voltages would cause the source voltage to go briefly to 0V, which would kill power to the system unless the battery was at some minimum level of charge. But, that isn't true anymore. It is safe to transition up or down in voltage and the source voltage should never drop to 0V. BUG=chrome-os-partner:29499 BRANCH=none TEST=make -j buildall. No need to do any more testing because this code has been disabled for a while. Change-Id: I8a3dca117f01f0f9c7d04b5d489e4a8588a89be6 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/211021 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
e1557b0f42
commit
02d313201f
@@ -126,7 +126,3 @@ int pd_board_checks(void)
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
int pd_power_negotiation_allowed(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -123,11 +123,6 @@ int pd_board_checks(void)
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
int pd_power_negotiation_allowed(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ----------------- Vendor Defined Messages ------------------ */
|
||||
int pd_custom_vdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload)
|
||||
{
|
||||
|
||||
@@ -137,7 +137,3 @@ int pd_board_checks(void)
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
int pd_power_negotiation_allowed(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,3 @@ int pd_board_checks(void)
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
int pd_power_negotiation_allowed(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo);
|
||||
/* Cap on the max voltage requested as a sink (in millivolts) */
|
||||
static unsigned max_mv = -1; /* no cap */
|
||||
|
||||
/* Flag for battery status */
|
||||
static int battery_ok = 1;
|
||||
/* Battery state of charge percentage */
|
||||
static int batt_soc;
|
||||
|
||||
int pd_choose_voltage(int cnt, uint32_t *src_caps, uint32_t *rdo)
|
||||
{
|
||||
@@ -43,10 +43,6 @@ int pd_choose_voltage(int cnt, uint32_t *src_caps, uint32_t *rdo)
|
||||
int max_uw = 0;
|
||||
int max_i = -1;
|
||||
|
||||
/* Don't negotiate power until battery ok signal is given */
|
||||
if (!battery_ok)
|
||||
return -EC_ERROR_UNKNOWN;
|
||||
|
||||
/* Get max power */
|
||||
for (i = 0; i < cnt; i++) {
|
||||
int uw;
|
||||
@@ -142,25 +138,9 @@ static void pd_send_ec_int(void)
|
||||
|
||||
int pd_board_checks(void)
|
||||
{
|
||||
static uint64_t last_time;
|
||||
|
||||
/*
|
||||
* If battery is not yet ok, signal EC to send status. Avoid
|
||||
* sending requests too frequently.
|
||||
*/
|
||||
if (!battery_ok && (get_time().val - last_time >= SECOND)) {
|
||||
last_time = get_time().val;
|
||||
pd_send_ec_int();
|
||||
}
|
||||
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
int pd_power_negotiation_allowed(void)
|
||||
{
|
||||
return battery_ok;
|
||||
}
|
||||
|
||||
static void dual_role_on(void)
|
||||
{
|
||||
pd_set_dual_role(PD_DRP_TOGGLE_ON);
|
||||
@@ -232,17 +212,7 @@ static int ec_status_host_cmd(struct host_cmd_handler_args *args)
|
||||
const struct ec_params_pd_status *p = args->params;
|
||||
struct ec_response_pd_status *r = args->response;
|
||||
|
||||
if (p->batt_soc >= CONFIG_USB_PD_MIN_BATT_CHARGE) {
|
||||
/*
|
||||
* When battery is above minimum charge, we know
|
||||
* that we have enough power remaining for us to
|
||||
* negotiate power over PD.
|
||||
*/
|
||||
CPRINTS("Battery is ok, safe to negotiate power");
|
||||
battery_ok = 1;
|
||||
} else {
|
||||
battery_ok = 0;
|
||||
}
|
||||
batt_soc = p->batt_soc;
|
||||
|
||||
r->status = 0;
|
||||
|
||||
|
||||
@@ -279,11 +279,6 @@ int pd_board_checks(void)
|
||||
|
||||
}
|
||||
|
||||
int pd_power_negotiation_allowed(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void pd_adc_interrupt(void)
|
||||
{
|
||||
/* cut the power output */
|
||||
|
||||
@@ -28,10 +28,6 @@ static void pd_exchange_status(void)
|
||||
struct ec_response_pd_status pd_status;
|
||||
int rv = 0, tries = 0;
|
||||
|
||||
/*
|
||||
* TODO(crosbug.com/p/29499): Change sending state of charge to
|
||||
* remaining capacity for finer grained control.
|
||||
*/
|
||||
/* Send battery state of charge */
|
||||
if (charge_get_flags() & CHARGE_FLAG_BATT_RESPONSIVE)
|
||||
ec_status.batt_soc = charge_get_percent();
|
||||
|
||||
@@ -1066,8 +1066,7 @@ void pd_task(void)
|
||||
timeout = 10*MSEC;
|
||||
|
||||
/* Source connection monitoring */
|
||||
if (pd_snk_is_vbus_provided(port) &&
|
||||
pd_power_negotiation_allowed()) {
|
||||
if (pd_snk_is_vbus_provided(port)) {
|
||||
cc1_volt = pd_adc_read(port, 0);
|
||||
cc2_volt = pd_adc_read(port, 1);
|
||||
if ((cc1_volt >= PD_SNK_VA) ||
|
||||
|
||||
@@ -908,10 +908,6 @@
|
||||
/* USB PD MCU slave address for host commands */
|
||||
#define CONFIG_USB_PD_I2C_SLAVE_ADDR 0x3c
|
||||
|
||||
/* TODO(crosbug.com/p/29499): Determine threshold for power negotiation */
|
||||
/* USB PD minimum battery charge to negotiate for more power */
|
||||
#define CONFIG_USB_PD_MIN_BATT_CHARGE 1
|
||||
|
||||
/* Compile chip support for the USB device controller */
|
||||
#undef CONFIG_USB
|
||||
|
||||
|
||||
@@ -208,13 +208,6 @@ void pd_request_source_voltage(int port, int mv);
|
||||
*/
|
||||
int pd_board_checks(void);
|
||||
|
||||
/**
|
||||
* Query if power negotiation is allowed.
|
||||
*
|
||||
* @return true if negotation is allowed, false otherwise.
|
||||
*/
|
||||
int pd_power_negotiation_allowed(void);
|
||||
|
||||
/*
|
||||
* Handle Vendor Defined Message with our vendor ID.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user