Files
OpenCellular/include/charge_manager.h
Shawn Nematbakhsh 2eb6cba5bd charge_manager: Move supplier list and priority hierarchy to board
Allow the list of charge suppliers and port selection priority to be
specified at the board level.

BUG=chrome-os-partner:32650
TEST=Manual on samus_pd. Plug + unplug PD and BC1.2 chargers, verify
that PD is always preferred and higher power port / supplier is always
selected.
BRANCH=Samus

Change-Id: Ic867a40120c809111bf76bf290ed6f204eab1168
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/225292
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-10-26 23:47:14 +00:00

31 lines
840 B
C

/* Copyright (c) 2014 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.
*/
#ifndef __CHARGE_MANAGER_H
#define __CHARGE_MANAGER_H
/* Charge port that indicates no active port */
#define CHARGE_SUPPLIER_NONE -1
#define CHARGE_PORT_NONE -1
/* Initial charge state */
#define CHARGE_CURRENT_UNINITIALIZED -1
#define CHARGE_VOLTAGE_UNINITIALIZED -1
#define POWER(charge_port) ((charge_port.current) * (charge_port.voltage))
/* Charge tasks report available current and voltage */
struct charge_port_info {
int current;
int voltage;
};
/* Called by charging tasks to update their available charge */
void charge_manager_update(int supplier,
int charge_port,
struct charge_port_info *charge);
#endif /* __CHARGE_MANAGER_H */