summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2016-09-09 10:11:18 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-09-13 22:21:23 -0700
commit94f2bc074087b72bbddf2fcbffa0f53e7aeb3aa0 (patch)
treebbb048a2e50592415d5f9acc21b54164afefdc82 /board
parentd8166a8d65bc776ad2484ac49cd4d7a218b48d7c (diff)
downloadchrome-ec-94f2bc074087b72bbddf2fcbffa0f53e7aeb3aa0.tar.gz
charge_manager: Pass uncapped / max current to current limit callback
charge_manager may request a charge current limit less than the capability of the supply in certain cases (eg. during PD voltage transition, to make an effort to comply with reduced load spec). Depending on the battery / system state, setting a reduced charge current limit may result in brownout. Pass the uncapped / max negotiated current to board_set_charge_limit() so that boards may use it instead of the requested limit in such circumstances. BUG=chrome-os-partner:56139 BRANCH=gru TEST=Manual on kevin with subsequent commit, boot system with zinger + low-charge battery, verify devices powers up to OS without brownout. Change-Id: I2b8e0d44edcf57ffe4ee0fdec1a1ed35c6becbbd Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/383732 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/amenia/board.c2
-rw-r--r--board/chell/board.c2
-rw-r--r--board/elm/board.c2
-rw-r--r--board/glados/board.c2
-rw-r--r--board/kevin/board.c2
-rw-r--r--board/lucid/board.c2
-rw-r--r--board/oak/board.c2
-rw-r--r--board/reef/board.c2
-rw-r--r--board/ryu/board.c2
-rw-r--r--board/ryu/board.h3
-rw-r--r--board/samus_pd/board.c2
-rw-r--r--board/strago/board.c2
-rw-r--r--board/wheatley/board.c2
13 files changed, 12 insertions, 15 deletions
diff --git a/board/amenia/board.c b/board/amenia/board.c
index d6e13b0264..ab3dc2ecff 100644
--- a/board/amenia/board.c
+++ b/board/amenia/board.c
@@ -347,7 +347,7 @@ int board_set_active_charge_port(int charge_port)
* @param supplier Charge supplier type.
* @param charge_ma Desired charge limit (mA).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma)
{
/* Enable charging trigger by BC1.2 detection */
int bc12_enable = (supplier == CHARGE_SUPPLIER_BC12_CDP ||
diff --git a/board/chell/board.c b/board/chell/board.c
index 73096c4826..e16801b546 100644
--- a/board/chell/board.c
+++ b/board/chell/board.c
@@ -342,7 +342,7 @@ int board_set_active_charge_port(int charge_port)
* @param supplier Charge supplier type.
* @param charge_ma Desired charge limit (mA).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma)
{
charge_set_input_current_limit(MAX(charge_ma,
CONFIG_CHARGER_INPUT_CURRENT));
diff --git a/board/elm/board.c b/board/elm/board.c
index ce9a0154bc..9548bb71fc 100644
--- a/board/elm/board.c
+++ b/board/elm/board.c
@@ -327,7 +327,7 @@ int board_set_active_charge_port(int charge_port)
* @param supplier Charge supplier type.
* @param charge_ma Desired charge limit (mA).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma)
{
/* Limit input current 95% ratio on elm board for safety */
charge_ma = (charge_ma * 95) / 100;
diff --git a/board/glados/board.c b/board/glados/board.c
index 83e5520535..3689276fe5 100644
--- a/board/glados/board.c
+++ b/board/glados/board.c
@@ -313,7 +313,7 @@ int board_set_active_charge_port(int charge_port)
* @param supplier Charge supplier type.
* @param charge_ma Desired charge limit (mA).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma)
{
charge_set_input_current_limit(MAX(charge_ma,
CONFIG_CHARGER_INPUT_CURRENT));
diff --git a/board/kevin/board.c b/board/kevin/board.c
index f425141c20..37e6f646a8 100644
--- a/board/kevin/board.c
+++ b/board/kevin/board.c
@@ -236,7 +236,7 @@ int board_set_active_charge_port(int charge_port)
return bd99955_select_input_port(bd99955_port);
}
-void board_set_charge_limit(int port, int supplier, int charge_ma)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma)
{
charge_set_input_current_limit(MAX(charge_ma,
CONFIG_CHARGER_INPUT_CURRENT));
diff --git a/board/lucid/board.c b/board/lucid/board.c
index ed552cf065..51eb4ec06c 100644
--- a/board/lucid/board.c
+++ b/board/lucid/board.c
@@ -171,7 +171,7 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma)
{
int rv;
diff --git a/board/oak/board.c b/board/oak/board.c
index bdacb78567..2621d98f91 100644
--- a/board/oak/board.c
+++ b/board/oak/board.c
@@ -311,7 +311,7 @@ int board_set_active_charge_port(int charge_port)
* @param supplier Charge supplier type.
* @param charge_ma Desired charge limit (mA).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma)
{
charge_set_input_current_limit(MAX(charge_ma,
CONFIG_CHARGER_INPUT_CURRENT));
diff --git a/board/reef/board.c b/board/reef/board.c
index 0f3e33055c..88e2472bd0 100644
--- a/board/reef/board.c
+++ b/board/reef/board.c
@@ -519,7 +519,7 @@ int board_set_active_charge_port(int charge_port)
* @param supplier Charge supplier type.
* @param charge_ma Desired charge limit (mA).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma)
{
/* Enable charging trigger by BC1.2 detection */
int bc12_enable = (supplier == CHARGE_SUPPLIER_BC12_CDP ||
diff --git a/board/ryu/board.c b/board/ryu/board.c
index f860ba057b..d01bdfcfe4 100644
--- a/board/ryu/board.c
+++ b/board/ryu/board.c
@@ -550,7 +550,7 @@ int board_set_active_charge_port(int charge_port)
* @param supplier Charge supplier type.
* @param charge_ma Desired charge limit (mA).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma)
{
int rv;
diff --git a/board/ryu/board.h b/board/ryu/board.h
index dea35aecc4..1e8be353dc 100644
--- a/board/ryu/board.h
+++ b/board/ryu/board.h
@@ -276,9 +276,6 @@ enum usb_strings {
/* The lower the input voltage, the higher the power efficiency. */
#define PD_PREFER_LOW_VOLTAGE
-/* Set the charge current limit. */
-void board_set_charge_limit(int port, int supplier, int charge_ma);
-
/* PP1800 transition GPIO interrupt handler */
void pp1800_on_off_evt(enum gpio_signal signal);
diff --git a/board/samus_pd/board.c b/board/samus_pd/board.c
index e535881c53..1431c50d32 100644
--- a/board/samus_pd/board.c
+++ b/board/samus_pd/board.c
@@ -499,7 +499,7 @@ static int board_update_charge_limit(int charge_ma)
* @param supplier Charge supplier type.
* @param charge_ma Desired charge limit (mA).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma)
{
/* Update current limit and notify EC if it changed */
if (board_update_charge_limit(charge_ma))
diff --git a/board/strago/board.c b/board/strago/board.c
index ecef093e41..528b658b93 100644
--- a/board/strago/board.c
+++ b/board/strago/board.c
@@ -336,7 +336,7 @@ int board_set_active_charge_port(int charge_port)
* @param supplier Charge supplier type.
* @param charge_ma Desired charge limit (mA).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma)
{
charge_set_input_current_limit(MAX(charge_ma,
CONFIG_CHARGER_INPUT_CURRENT));
diff --git a/board/wheatley/board.c b/board/wheatley/board.c
index fa39533de5..2ab07ccd58 100644
--- a/board/wheatley/board.c
+++ b/board/wheatley/board.c
@@ -301,7 +301,7 @@ int board_set_active_charge_port(int charge_port)
* @param supplier Charge supplier type.
* @param charge_ma Desired charge limit (mA).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma)
{
charge_set_input_current_limit(MAX(charge_ma,
CONFIG_CHARGER_INPUT_CURRENT));