summaryrefslogtreecommitdiff
path: root/board/kevin/charge_ramp.c
blob: 350c58924ba0260441e12d3de610fb3360773095 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* Copyright 2017 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/* Board-specific charge ramp callbacks. */

#include "common.h"

#include "bd9995x.h"
#include "charge_manager.h"
#include "charge_ramp.h"
#include "charge_state.h"
#include "system.h"

/**
 * Return true if VBUS is sagging too low
 */
int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
{
	return charger_get_vbus_voltage(port) < BD9995X_BC12_MIN_VOLTAGE;
}

/**
 * Return if board is consuming full amount of input current
 */
int board_is_consuming_full_charge(void)
{
	int chg_pct = charge_get_percent();

	return chg_pct > 2 && chg_pct < 95;
}