summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-09-04 21:11:56 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-09-05 10:11:48 +0000
commitb0d559a918c8c83dcdb2d57c468b3c50268b2b5f (patch)
tree7cbaa8cabc5368b940ad996207df885283e87b8b
parentc4da0e4461a92a4193e8909aeb23b6f42090d0e8 (diff)
downloadchrome-ec-b0d559a918c8c83dcdb2d57c468b3c50268b2b5f.tar.gz
Enable charging on Kirby
Now that we have battery and charger drivers, let's enable charging. BUG=chrome-os-partner:22055 TEST=Test charging/discharging on Kirby TEST=Unplug battery and see 'error' state TEST=Plug battery and doesn't see error anymore BRANCH=None Change-Id: Idff513b38c9f5bb90700877750f3d2e2154d4b23 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/168007
-rw-r--r--board/kirby/board.c13
-rw-r--r--board/kirby/board.h6
-rw-r--r--board/kirby/ec.tasklist2
-rw-r--r--common/battery_kirby.c39
-rw-r--r--common/build.mk2
-rw-r--r--common/charger_bq24192.c6
6 files changed, 46 insertions, 22 deletions
diff --git a/board/kirby/board.c b/board/kirby/board.c
index 87b3586877..579d371c40 100644
--- a/board/kirby/board.c
+++ b/board/kirby/board.c
@@ -2,10 +2,9 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-/* Pit board-specific configuration */
+/* Kirby board-specific configuration */
#include "adc.h"
-#include "battery_pack.h"
#include "common.h"
#include "extpower.h"
#include "gaia_power.h"
@@ -106,16 +105,6 @@ const struct gpio_alt_func gpio_alt_funcs[] = {
};
const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs);
-/* Battery temperature ranges in degrees C */
-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 = 60,
- .discharging_min_c = 0,
- .discharging_max_c = 100,
-};
-
/* PWM channels */
const struct pwm_t pwm_channels[] = {
[PWM_CH_CHG_Y] = {STM32_TIM(3), STM32_TIM_CH(1), PWM_CONFIG_ACTIVE_LOW,
diff --git a/board/kirby/board.h b/board/kirby/board.h
index 24d14d6459..ba0d6a41c8 100644
--- a/board/kirby/board.h
+++ b/board/kirby/board.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* Pit board configuration */
+/* Kirby board configuration */
#ifndef __BOARD_H
#define __BOARD_H
@@ -12,6 +12,8 @@
#define CONFIG_BATTERY_BQ27541
#define CONFIG_CHARGER
#define CONFIG_CHARGER_BQ24192
+#define CONFIG_CHARGER_EN_GPIO
+#define CONFIG_CHARGER_EN_ACTIVE_LOW
#define CONFIG_ADC
#define CONFIG_ADC_CLOCK
#define CONFIG_CHIPSET_GAIA
@@ -109,7 +111,7 @@ enum gpio_signal {
/* Other inputs */
GPIO_WP_L,
/* Outputs */
- GPIO_CHARGER_EN,
+ GPIO_CHARGER_EN_L,
GPIO_EC_INT,
GPIO_EC_INT2,
GPIO_ID_MUX,
diff --git a/board/kirby/ec.tasklist b/board/kirby/ec.tasklist
index 9b044dca8c..7f1f1de257 100644
--- a/board/kirby/ec.tasklist
+++ b/board/kirby/ec.tasklist
@@ -17,7 +17,7 @@
#define CONFIG_TASK_LIST \
TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, TASK_STACK_SIZE) \
- /* TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) */ \
+ TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \
TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) \
TASK_NOTEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \
diff --git a/common/battery_kirby.c b/common/battery_kirby.c
new file mode 100644
index 0000000000..38caf37a5b
--- /dev/null
+++ b/common/battery_kirby.c
@@ -0,0 +1,39 @@
+/* Copyright (c) 2013 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 info for Kirby
+ */
+
+#include "battery_pack.h"
+
+/* Battery temperature ranges in degrees C */
+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 = 60,
+ .discharging_min_c = 0,
+ .discharging_max_c = 100,
+};
+
+static const struct battery_info info = {
+ /*
+ * TODO(victoryang): What are the correct values?
+ * Design voltage
+ * max = 4.4V
+ * normal = 3.8V
+ * min = 3.0V
+ */
+ .voltage_max = 4400,
+ .voltage_normal = 3800,
+ .voltage_min = 3000,
+
+ /* Pre-charge current: I <= 0.01C */
+ .precharge_current = 128, /* mA */
+};
+
+const struct battery_info *battery_get_info(void)
+{
+ return &info;
+}
diff --git a/common/build.mk b/common/build.mk
index fa3ad7b24e..a97d9fdf2e 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -13,7 +13,7 @@ common-y+=gpio_common.o version.o printf.o queue.o getset.o
common-$(BOARD_bolt)+=battery_link.o
common-$(BOARD_daisy)+=extpower_snow.o
common-$(BOARD_falco)+=battery_falco.o led_falco.o
-common-$(BOARD_kirby)+=led_kirby.o
+common-$(BOARD_kirby)+=battery_kirby.o led_kirby.o
common-$(BOARD_link)+=battery_link.o
common-$(BOARD_peppy)+=battery_peppy.o led_common.o led_peppy.o
common-$(BOARD_slippy)+=battery_slippy.o led_slippy.o
diff --git a/common/charger_bq24192.c b/common/charger_bq24192.c
index 6debffa347..b9d840d8c3 100644
--- a/common/charger_bq24192.c
+++ b/common/charger_bq24192.c
@@ -160,12 +160,6 @@ int charger_get_current(int *current)
return EC_SUCCESS;
}
-/* TODO(victoryang): remove this after enabling charger task on Kirby */
-int charger_closest_current(int current)
-{
- return current;
-}
-
int charger_set_current(int current)
{
int rv, val;