summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-08-04 17:52:53 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-08-09 00:20:06 +0000
commit0815df9cbf1104a2c7fabdd4197358d54cdc8922 (patch)
treec0f1d79fd3e24eb6b4d10741e34565879baff3f1 /driver
parent566de98ca6b0d6a579a2dae84ecaac40c703abf7 (diff)
downloadchrome-ec-0815df9cbf1104a2c7fabdd4197358d54cdc8922.tar.gz
samus: ryu: set input current limit based on PD negotiation
Set input current limit based on the max current from the PD negotiation. For samus, this information is passed to the EC as a host command. For ryu, the max current is set directly following a negotiation. CONFIG_CHARGER_INPUT_CURRENT is now just the default limit, but after a successful PD negotiation, the limit can be raised. Note, for now the input current limit for samus is set to 2/3 of the value negotiated for. This is due to hardware problems measuring input current on p2b boards. BUG=chrome-os-partner:28532, chrome-os-partner:24461 BRANCH=none TEST=tested on a samus. Verified input current limit using "charger" console command from EC. Input current limit after a reboot is 512. When zinger is plugged in, it jumps to the appropriate value (currently 1280mA), and when the negotiation is changed using the "pd 0 dev 5" command on the PD console, the input current limit is adjusted to match (2000mA). Change-Id: Iab9186a0f9814655e3240217a9baf4a38f15f84d Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/211023 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/battery/samus.c26
1 files changed, 0 insertions, 26 deletions
diff --git a/driver/battery/samus.c b/driver/battery/samus.c
index 4c4f3480c4..951130867e 100644
--- a/driver/battery/samus.c
+++ b/driver/battery/samus.c
@@ -46,17 +46,6 @@ const struct battery_info *battery_get_info(void)
#ifdef CONFIG_CHARGER_PROFILE_OVERRIDE
-/*
- * For Samus, we'd like to set the CONFIG_CHARGER_INPUT_CURRENT to a higher
- * value, but the AC adapters freak out if we do. So instead we set it to a
- * low value, and it gets reset to that point every time AC is applied. Then we
- * bump it up a little bit every time through the loop until it's where we
- * wanted it in the first place.
- */
-/* FIXME(crosbug.com/p/24461): determine correct values for this */
-#define MAX_INPUT_CURRENT 2048
-#define INPUT_CURRENT_INCR 64
-
static int fast_charging_allowed;
/*
@@ -69,25 +58,10 @@ static int fast_charging_allowed;
*/
int charger_profile_override(struct charge_state_data *curr)
{
- int rv;
-
/* We only want to override how we charge, nothing else. */
if (curr->state != ST_CHARGE)
return 0;
- /* Bump the input current up a little at a time if needed. */
- if (curr->chg.input_current < MAX_INPUT_CURRENT) {
- rv = charger_set_input_current(curr->chg.input_current +
- INPUT_CURRENT_INCR);
- /*
- * If we can't set the input current, indicate the error
- * (negative, since positive changes the poll period) and
- * don't override the default behavior.
- */
- if (rv)
- return -rv;
- }
-
/* Do we want to mess with the charge profile too? */
if (!fast_charging_allowed)
return 0;