summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/pit/board.c2
-rw-r--r--board/pit/board.h3
-rw-r--r--common/pmu_tps65090_charger.c18
3 files changed, 21 insertions, 2 deletions
diff --git a/board/pit/board.c b/board/pit/board.c
index 8f5ed840e7..2d1984f2c8 100644
--- a/board/pit/board.c
+++ b/board/pit/board.c
@@ -70,7 +70,7 @@ const struct gpio_info gpio_list[] = {
{"I2C1_SDA", GPIO_B, (1<<7), GPIO_ODR_HIGH, NULL},
{"I2C2_SCL", GPIO_B, (1<<10), GPIO_ODR_HIGH, NULL},
{"I2C2_SDA", GPIO_B, (1<<11), GPIO_ODR_HIGH, NULL},
- {"LED_POWER_L", GPIO_A, (1<<2), GPIO_OUT_HIGH, NULL},
+ {"CHARGING_LED",GPIO_A, (1<<2), GPIO_OUT_LOW, NULL},
{"PMIC_PWRON", GPIO_A, (1<<12), GPIO_OUT_LOW, NULL},
{"PMIC_RESET", GPIO_A, (1<<15), GPIO_OUT_LOW, NULL},
{"KB_OUT00", GPIO_B, (1<<0), GPIO_KB_OUTPUT, NULL},
diff --git a/board/pit/board.h b/board/pit/board.h
index 52ef14ecaf..85f20b3895 100644
--- a/board/pit/board.h
+++ b/board/pit/board.h
@@ -22,6 +22,7 @@
#define CONFIG_PMU_HARD_RESET
#define CONFIG_PMU_POWERINFO
#define CONFIG_PMU_TPS65090
+#define CONFIG_PMU_TPS65090_CHARGING_LED
#define CONFIG_SPI
#define CONFIG_VBOOT_HASH
@@ -79,7 +80,7 @@ enum gpio_signal {
GPIO_I2C1_SDA,
GPIO_I2C2_SCL,
GPIO_I2C2_SDA,
- GPIO_LED_POWER_L,
+ GPIO_CHARGING_LED,
GPIO_PMIC_PWRON,
GPIO_PMIC_RESET,
GPIO_KB_OUT00,
diff --git a/common/pmu_tps65090_charger.c b/common/pmu_tps65090_charger.c
index a55edfc426..8a07653a80 100644
--- a/common/pmu_tps65090_charger.c
+++ b/common/pmu_tps65090_charger.c
@@ -52,6 +52,21 @@ static int has_pending_event;
static enum charging_state current_state = ST_IDLE0;
+#ifdef CONFIG_PMU_TPS65090_CHARGING_LED
+static void update_battery_led(void)
+{
+ int alarm;
+ int led_on = 0;
+ if(extpower_is_present()){
+ battery_status(&alarm);
+ if((alarm & ALARM_CHARGED) && !gpio_get_level(GPIO_CHARGER_EN))
+ led_on = 1;
+ }
+
+ gpio_set_level(GPIO_CHARGING_LED, led_on);
+}
+#endif
+
static void enable_charging(int enable)
{
enable = enable ? 1 : 0;
@@ -409,6 +424,9 @@ void charger_task(void)
extpower_charge_update(0);
#endif
+#ifdef CONFIG_PMU_TPS65090_CHARGING_LED
+ update_battery_led();
+#endif
/*
* When battery is extremely low, the internal voltage can not
* power on its gas guage IC. Charging loop will enable the