mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-30 18:41:11 +00:00
This adds the initial support for Slippy's battery. The data I have is unclear and incomplete, so this is NOT the final form. It seems to work right now, and hasn't caught fire or anything, but it will need futher tweaks. BUG=chrome-os-partner:19976 BRANCH=none TEST=manual (and watch it!) Connect the EC console and watch what happens. You should see the battery charging, discharging, etc. Keep an eye on it, though, and never leave it unattended when on AC - we don't have the full data sheets available yet. Change-Id: Id9bf93dc04a1399a9cdbc2156b3fac74be62038f Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/57814 Reviewed-by: Randall Spangler <rspangler@chromium.org>
50 lines
1.4 KiB
C
50 lines
1.4 KiB
C
/* Copyright (c) 2012 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.
|
|
*
|
|
* Common API for battery pack vendor provided charging profile
|
|
*/
|
|
#ifndef __CROS_EC_BATTERY_PACK_H
|
|
#define __CROS_EC_BATTERY_PACK_H
|
|
|
|
#define CELSIUS_TO_DECI_KELVIN(temp_c) ((temp_c) * 10 + 2731)
|
|
|
|
/* Battery parameters */
|
|
struct batt_params {
|
|
int temperature; /* Temperature in 0.1 K */
|
|
int state_of_charge; /* State of charge (percent, 0-100) */
|
|
int voltage; /* Battery voltage (mV) */
|
|
int current; /* Battery current (mA) */
|
|
int desired_voltage; /* Charging voltage desired by battery (mV) */
|
|
int desired_current; /* Charging current desired by battery (mA) */
|
|
};
|
|
|
|
/* Battery constants */
|
|
struct battery_info {
|
|
/* Design voltage in mV */
|
|
int voltage_max;
|
|
int voltage_normal;
|
|
int voltage_min;
|
|
/* Working temperature range in 0.1 K increments */
|
|
int temp_charge_min;
|
|
int temp_charge_max;
|
|
int temp_discharge_min;
|
|
int temp_discharge_max;
|
|
/* Pre-charge current in mA */
|
|
int precharge_current;
|
|
};
|
|
|
|
/**
|
|
* Return vendor-provided battery constants.
|
|
*/
|
|
const struct battery_info *battery_get_info(void);
|
|
|
|
/**
|
|
* Modify battery parameters to match vendor charging profile.
|
|
*
|
|
* @param batt Battery parameters to modify
|
|
*/
|
|
void battery_vendor_params(struct batt_params *batt);
|
|
|
|
#endif
|