rambi: Enable battery charging

Using best-guess numbers for input current limit.  Battery voltage and
temperature limits are set from actual battery spec.

BUG=chrome-os-partner:23597
BRANCH=none
TEST=battery and charger commands print reasonable info
     battery charges when system plugged in

Change-Id: I812276cbe46c8463a855c7ba3e0bfec4852e6f97
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174766
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
Randall Spangler
2013-10-25 11:18:45 -07:00
committed by chrome-internal-fetch
parent 685c45ef46
commit 02a770d5a5
4 changed files with 41 additions and 14 deletions

32
board/rambi/battery.c Normal file
View File

@@ -0,0 +1,32 @@
/* 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.
*
* Battery pack vendor provided charging profile
*/
#include "battery.h"
#include "gpio.h"
const struct battery_temperature_ranges bat_temp_ranges = {
.start_charging_min_c = 0,
.start_charging_max_c = 45,
.charging_min_c = 0,
.charging_max_c = 45,
.discharging_min_c = 0,
.discharging_max_c = 60,
};
static const struct battery_info info = {
.voltage_max = 8400, /* mV */
.voltage_normal = 7400,
.voltage_min = 6000,
.precharge_current = 256, /* mA */
};
const struct battery_info *battery_get_info(void)
{
return &info;
}
/* TODO(crosbug.com/p/23597): Battery cutoff command; need vendor info */

View File

@@ -10,7 +10,14 @@
/* Optional features */
#define CONFIG_BACKLIGHT_LID
#define CONFIG_BATTERY_SMART
#define CONFIG_BOARD_VERSION
#define CONFIG_CHARGER
#define CONFIG_CHARGER_BQ24715
/* TODO(crosbug.com/p/23597): Real number for input current limit */
#define CONFIG_CHARGER_INPUT_CURRENT 4032
#define CONFIG_CHARGER_SENSE_RESISTOR 10 /* Charge sense resistor, mOhm */
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 /* Input senso resistor, mOhm */
#define CONFIG_CHIPSET_BAYTRAIL
#define CONFIG_CHIPSET_CAN_THROTTLE
#define CONFIG_CHIPSET_X86
@@ -29,18 +36,6 @@
#define CONFIG_USB_PORT_POWER_SMART
#define CONFIG_WIRELESS
/* TODO(rspangler): port these to Rambi, or remove if not needed */
#if 0
#define CONFIG_BATTERY_CHECK_CONNECTED
#define CONFIG_BATTERY_SMART
#define CONFIG_CHARGER
#define CONFIG_CHARGER_BQ24707A
#define CONFIG_CHARGER_DISCHARGE_ON_AC
#define CONFIG_CHARGER_INPUT_CURRENT 4032 /* mA, about half max */
#define CONFIG_CHARGER_SENSE_RESISTOR 10 /* Charge sense resistor, mOhm */
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 /* Input sensor resistor, mOhm */
#endif
#ifndef __ASSEMBLER__
/* I2C ports */

View File

@@ -9,4 +9,4 @@
# the IC is TI Stellaris LM4
CHIP:=lm4
board-y=board.o led.o
board-y=battery.o board.o led.o

View File

@@ -21,7 +21,7 @@
#define CONFIG_TASK_LIST \
TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, LARGER_TASK_STACK_SIZE) \
/* TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) */ \
TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \
TASK_NOTEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \