summaryrefslogtreecommitdiff
path: root/common/charge_ramp.c
blob: d9c42d831e1e25ccca80a46664ccfff07926072c (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
/* 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.
 */

/* Charge input current limit ramp module for Chrome EC */

#include "common.h"
#include "system.h"
#include "usb_charge.h"

test_mockable int chg_ramp_allowed(int supplier)
{
	/* Don't allow ramping in RO when write protected. */
	if (!system_is_in_rw() && system_is_locked())
		return 0;

	/* Othewise ask the BC1.2 detect module */
	return usb_charger_ramp_allowed(supplier);
}

test_mockable int chg_ramp_max(int supplier, int sup_curr)
{
	/* Ask the BC1.2 detect module */
	return usb_charger_ramp_max(supplier, sup_curr);
}