mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-16 18:11:22 +00:00
pd: samus: do not request voltage within boost bypass deadband
Do not request a voltage that is within the deadband where we aren't sure if the boost or the boost bypass is on. BUG=chrome-os-partner:34938 BRANCH=samus TEST=test on samus with zinger. change the deadband to [10V, 20V] and see that we only negotiate to 5V. change the deadband to [13V, 20V] and see that we negotiate to 12V. change the deadband to [10V, 13V] and see that we negotiate to 20V. Change-Id: Id761aef35eeadfa2ab7d2ca31a48d4324625ab32 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/241528 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
ChromeOS Commit Bot
parent
1382708858
commit
7fc407a934
@@ -45,6 +45,12 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
|
||||
return;
|
||||
}
|
||||
|
||||
int pd_is_valid_input_voltage(int mv)
|
||||
{
|
||||
/* Any voltage less than the max is allowed */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pd_check_requested_voltage(uint32_t rdo)
|
||||
{
|
||||
return EC_SUCCESS;
|
||||
|
||||
@@ -44,6 +44,12 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
|
||||
return;
|
||||
}
|
||||
|
||||
int pd_is_valid_input_voltage(int mv)
|
||||
{
|
||||
/* Any voltage less than the max is allowed */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pd_check_requested_voltage(uint32_t rdo)
|
||||
{
|
||||
/* Never acting as a source */
|
||||
|
||||
@@ -44,6 +44,12 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
|
||||
CPRINTS("Failed to set input current limit for PD");
|
||||
}
|
||||
|
||||
int pd_is_valid_input_voltage(int mv)
|
||||
{
|
||||
/* Any voltage less than the max is allowed */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pd_check_requested_voltage(uint32_t rdo)
|
||||
{
|
||||
int max_ma = rdo & 0x3FF;
|
||||
|
||||
@@ -45,6 +45,12 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
|
||||
return;
|
||||
}
|
||||
|
||||
int pd_is_valid_input_voltage(int mv)
|
||||
{
|
||||
/* Any voltage less than the max is allowed */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pd_check_requested_voltage(uint32_t rdo)
|
||||
{
|
||||
return EC_SUCCESS;
|
||||
|
||||
@@ -25,6 +25,12 @@ const uint32_t pd_snk_pdo[] = {
|
||||
};
|
||||
const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo);
|
||||
|
||||
int pd_is_valid_input_voltage(int mv)
|
||||
{
|
||||
/* Any voltage less than the max is allowed */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pd_check_requested_voltage(uint32_t rdo)
|
||||
{
|
||||
int max_ma = rdo & 0x3FF;
|
||||
|
||||
@@ -63,6 +63,12 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
|
||||
return;
|
||||
}
|
||||
|
||||
int pd_is_valid_input_voltage(int mv)
|
||||
{
|
||||
/* Any voltage less than the max is allowed */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pd_check_requested_voltage(uint32_t rdo)
|
||||
{
|
||||
int max_ma = rdo & 0x3FF;
|
||||
|
||||
@@ -50,6 +50,12 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
|
||||
charge_manager_update(CHARGE_SUPPLIER_TYPEC, port, &charge);
|
||||
}
|
||||
|
||||
int pd_is_valid_input_voltage(int mv)
|
||||
{
|
||||
/* Any voltage less than the max is allowed */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pd_check_requested_voltage(uint32_t rdo)
|
||||
{
|
||||
int max_ma = rdo & 0x3FF;
|
||||
|
||||
@@ -42,6 +42,12 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
|
||||
CPRINTS("Failed to set input current limit for PD");
|
||||
}
|
||||
|
||||
int pd_is_valid_input_voltage(int mv)
|
||||
{
|
||||
/* Any voltage less than the max is allowed */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pd_check_requested_voltage(uint32_t rdo)
|
||||
{
|
||||
int max_ma = rdo & 0x3FF;
|
||||
|
||||
@@ -26,6 +26,13 @@
|
||||
#define MAX_POWER_MW 60000
|
||||
#define MAX_CURRENT_MA 3000
|
||||
|
||||
/*
|
||||
* Do not request any voltage within this deadband region, where
|
||||
* we're not sure whether or not the boost or the bypass will be on.
|
||||
*/
|
||||
#define INPUT_VOLTAGE_DEADBAND_MIN 9700
|
||||
#define INPUT_VOLTAGE_DEADBAND_MAX 11999
|
||||
|
||||
#define PDO_FIXED_FLAGS (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP)
|
||||
|
||||
const uint32_t pd_src_pdo[] = {
|
||||
@@ -40,6 +47,13 @@ const uint32_t pd_snk_pdo[] = {
|
||||
};
|
||||
const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo);
|
||||
|
||||
int pd_is_valid_input_voltage(int mv)
|
||||
{
|
||||
/* Allow any voltage not in the boost bypass deadband */
|
||||
return (mv < INPUT_VOLTAGE_DEADBAND_MIN) ||
|
||||
(mv > INPUT_VOLTAGE_DEADBAND_MAX);
|
||||
}
|
||||
|
||||
int pd_check_requested_voltage(uint32_t rdo)
|
||||
{
|
||||
int max_ma = rdo & 0x3FF;
|
||||
|
||||
@@ -44,6 +44,12 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
|
||||
gpio_set_level(GPIO_LED_B_L, !blue);
|
||||
}
|
||||
|
||||
int pd_is_valid_input_voltage(int mv)
|
||||
{
|
||||
/* Any voltage less than the max is allowed */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pd_check_requested_voltage(uint32_t rdo)
|
||||
{
|
||||
int max_ma = rdo & 0x3FF;
|
||||
|
||||
@@ -61,6 +61,10 @@ static int pd_find_pdo_index(int cnt, uint32_t *src_caps, int max_mv)
|
||||
/* Get max power that is under our max voltage input */
|
||||
for (i = 0; i < cnt; i++) {
|
||||
mv = ((src_caps[i] >> 10) & 0x3FF) * 50;
|
||||
/* Skip any voltage not supported by this board */
|
||||
if (!pd_is_valid_input_voltage(mv))
|
||||
continue;
|
||||
|
||||
if ((src_caps[i] & PDO_TYPE_MASK) == PDO_TYPE_BATTERY) {
|
||||
uw = 250000 * (src_caps[i] & 0x3FF);
|
||||
} else {
|
||||
|
||||
@@ -767,6 +767,14 @@ void pd_set_max_voltage(unsigned mv);
|
||||
*/
|
||||
unsigned pd_get_max_voltage(void);
|
||||
|
||||
/**
|
||||
* Check if this board supports the given input voltage.
|
||||
*
|
||||
* @mv input voltage
|
||||
* @return 1 if voltage supported, 0 if not
|
||||
*/
|
||||
int pd_is_valid_input_voltage(int mv);
|
||||
|
||||
/**
|
||||
* Request a new operating voltage.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user