Files
OpenCellular/include/charge_manager.h
Shawn Nematbakhsh 86835f7067 charge_manager: Allow board to reject a selected charge port
Modify board_set_active_charge_port to return status indicating whether
the selected charge port was rejected. If rejected, zero out its
available charge and attempt to select a different charge port.

Also, reduce the length of related console prints.

BUG=chrome-os-partner:34677
TEST=Manual on Samus. Plug C-to-Arec into port 1, verify that charge
manager does not select port 1 as active and charging icon is not seen
in OS.
BRANCH=Samus.

Change-Id: I56e3337f90c04b93ef7cc9873af6ee0f4b1ffc7d
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/236361
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-12-17 22:26:56 +00:00

53 lines
1.5 KiB
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
#define CHARGE_CEIL_NONE -1
/* Initial charge state */
#define CHARGE_CURRENT_UNINITIALIZED -1
#define CHARGE_VOLTAGE_UNINITIALIZED -1
/* 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);
/* Update charge ceiling for a given port */
void charge_manager_set_ceil(int port, int ceil);
/* Select an 'override port', which is always the preferred charge port */
int charge_manager_set_override(int port);
/* Returns the current active charge port, as determined by charge manager */
int charge_manager_get_active_charge_port(void);
/* Board-level callback functions */
/*
* Set the active charge port. Returns EC_SUCCESS if the charge port is
* accepted, returns ec_error_list status otherwise.
*/
int board_set_active_charge_port(int charge_port);
/* Set the charge current limit. */
void board_set_charge_limit(int charge_ma);
/* Called on delayed override timeout */
void board_charge_manager_override_timeout(void);
#endif /* __CHARGE_MANAGER_H */