mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 01:50:53 +00:00
Add host command to set charge port override. BUG=chrome-os-partner:32003 BRANCH=Samus TEST=Manual on Samus. Insert PD charger in port1 and BC1.2 charger in port0. ./ectool --name=cros_pd chargeoverride 0 --> Charges from port 0 ./ectool --name=cros_pd chargeoverride off --> Charges from port 1 ./ectool --name=cros_pd chargeoverride dontcharge --> No charge port ./ectool --name=cros_pd chargeoverride 1 --> Charges from port 1 ./ectool --name=cros_pd chargeoverride 2 --> Correctly returns error Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ib35f797a4a24e96fd2e3c008ace3fd6291b89d25 Reviewed-on: https://chromium-review.googlesource.com/230910 Reviewed-by: Alec Berg <alecaberg@chromium.org>
41 lines
1.2 KiB
C
41 lines
1.2 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
|
|
|
|
#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);
|
|
|
|
/* 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 */
|
|
void 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);
|
|
|
|
#endif /* __CHARGE_MANAGER_H */
|