summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kuo <tedkuo@ami.com.tw>2015-03-25 19:36:50 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-03-31 00:04:31 +0000
commite4fbf6f654bd00f26c94f1445ab04edf0cce10c7 (patch)
treec5de5b820cf279b2c5f59ab4ea636b0c45a8f952
parent7186e4dc8bc87a723e7794945a36cbc7e20d4c47 (diff)
downloadchrome-ec-e4fbf6f654bd00f26c94f1445ab04edf0cce10c7.tar.gz
Ninja, Sumo: remove unused functions
1. remove battery and charger 2. remove keyboard BUG=None TEST='emerge-ninja chromeos-ec', 'emerge-sumo chromeos-ec' BRANCH=None Signed-off-by: Ted Kuo <tedkuo@ami.com.tw> Change-Id: I87d030583e653535433f2efd9e9e62b570c000c8 Reviewed-on: https://chromium-review.googlesource.com/262352 Tested-by: Ted Kuo <tedkuo@ami.com.tw> Reviewed-by: Mohammed Habibulla <moch@google.com> Commit-Queue: Ted Kuo <tedkuo@ami.com.tw>
-rw-r--r--board/ninja/battery.c63
-rw-r--r--board/ninja/board.c22
-rw-r--r--board/ninja/board.h18
-rw-r--r--board/ninja/build.mk2
-rw-r--r--board/ninja/ec.tasklist4
-rw-r--r--board/ninja/led.c37
-rw-r--r--board/sumo/battery.c63
-rw-r--r--board/sumo/board.c24
-rw-r--r--board/sumo/board.h20
-rw-r--r--board/sumo/build.mk4
-rw-r--r--board/sumo/ec.tasklist6
-rw-r--r--board/sumo/led.c39
12 files changed, 9 insertions, 293 deletions
diff --git a/board/ninja/battery.c b/board/ninja/battery.c
deleted file mode 100644
index 89139e6ba2..0000000000
--- a/board/ninja/battery.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright (c) 2015 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 "battery_smart.h"
-#include "console.h"
-#include "gpio.h"
-#include "host_command.h"
-#include "util.h"
-
-/* Shutdown mode parameter to write to manufacturer access register */
-#define SB_SHUTDOWN_DATA 0x0010
-
-static const struct battery_info info = {
- .voltage_max = 8400, /* mV */
- .voltage_normal = 7400,
- .voltage_min = 6000,
- .precharge_current = 256, /* mA */
- .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,
-};
-
-const struct battery_info *battery_get_info(void)
-{
- return &info;
-}
-
-static int cutoff(void)
-{
- int rv;
-
- /* Ship mode command must be sent twice to take effect */
- rv = sb_write(SB_MANUFACTURER_ACCESS, SB_SHUTDOWN_DATA);
-
- if (rv != EC_SUCCESS)
- return rv;
-
- return sb_write(SB_MANUFACTURER_ACCESS, SB_SHUTDOWN_DATA);
-}
-
-static int battery_command_cut_off(struct host_cmd_handler_args *args)
-{
- return cutoff() ? EC_RES_ERROR : EC_RES_SUCCESS;
-}
-DECLARE_HOST_COMMAND(EC_CMD_BATTERY_CUT_OFF, battery_command_cut_off,
- EC_VER_MASK(0));
-
-static int command_battcutoff(int argc, char **argv)
-{
- return cutoff();
-}
-DECLARE_CONSOLE_COMMAND(battcutoff, command_battcutoff,
- NULL,
- "Enable battery cutoff (ship mode)",
- NULL);
diff --git a/board/ninja/board.c b/board/ninja/board.c
index ca290450eb..2d1ae31b99 100644
--- a/board/ninja/board.c
+++ b/board/ninja/board.c
@@ -117,8 +117,6 @@ BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
{GPIO_A, 0x03, 1, MODULE_UART}, /* UART0 */
- {GPIO_B, 0x04, 3, MODULE_I2C}, /* I2C0 SCL */
- {GPIO_B, 0x08, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C0 SDA */
{GPIO_B, 0x40, 3, MODULE_I2C}, /* I2C5 SCL */
{GPIO_B, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C5 SDA */
{GPIO_D, 0x0f, 2, MODULE_SPI}, /* SPI1 */
@@ -154,15 +152,6 @@ const struct adc_t adc_channels[] = {
*/
{"ECTemp", LM4_ADC_SEQ0, -225, ADC_READ_MAX, 420,
LM4_AIN_NONE, 0x0e /* TS0 | IE0 | END0 */, 0, 0},
-
- /* IOUT == ICMNT is on PE3/AIN0 */
- /* We have 0.01-ohm resistors, and IOUT is 40X the differential
- * voltage, so 1000mA ==> 400mV.
- * ADC returns 0x000-0xFFF, which maps to 0.0-3.3V (as configured).
- * mA = 1000 * ADC_VALUE / ADC_READ_MAX * 3300 / 400
- */
- {"ChargerCurrent", LM4_ADC_SEQ1, 33000, ADC_READ_MAX * 4, 0,
- LM4_AIN(0), 0x06 /* IE0 | END0 */, LM4_GPIO_E, (1<<3)},
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -176,7 +165,6 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"batt_chg", 0, 100},
{"thermal", 5, 100},
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -194,7 +182,6 @@ const struct temp_sensor_t temp_sensors[] = {
TMP432_IDX_REMOTE1, 4},
{"TMP432_CPU_bottom", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
TMP432_IDX_REMOTE2, 4},
- {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_temp_sensor_get_val, 0, 4},
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -206,14 +193,5 @@ struct ec_thermal_config thermal_params[] = {
{{0, 0, 0}, 0, 0},
{{0, 0, 0}, 0, 0},
{{0, 0, 0}, 0, 0},
- {{0, 0, 0}, 0, 0},
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
-
-/**
- * Discharge battery when on AC power for factory test.
- */
-int board_discharge_on_ac(int enable)
-{
- return charger_discharge_on_ac(enable);
-}
diff --git a/board/ninja/board.h b/board/ninja/board.h
index e4cc395444..cca6df42f1 100644
--- a/board/ninja/board.h
+++ b/board/ninja/board.h
@@ -11,14 +11,7 @@
/* Optional features */
#define CONFIG_AP_HANG_DETECT
#define CONFIG_BACKLIGHT_LID
-#define CONFIG_BATTERY_SMART
#define CONFIG_BOARD_VERSION
-#define CONFIG_CHARGER
-#define CONFIG_CHARGER_BQ24715
-#define CONFIG_CHARGER_DISCHARGE_ON_AC
-#define CONFIG_CHARGER_INPUT_CURRENT 1894 /* 90% of 40 W adapter @ 19 V */
-#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
@@ -50,8 +43,6 @@
#ifndef __ASSEMBLER__
/* I2C ports */
-#define I2C_PORT_BATTERY 0
-#define I2C_PORT_CHARGER 0
#define I2C_PORT_THERMAL 5
/* 13x8 keyboard scanner uses an entire GPIO bank for row inputs */
@@ -159,9 +150,6 @@ enum adc_channel {
/* EC internal die temperature in degrees K. */
ADC_CH_EC_TEMP = 0,
- /* Charger current in mA. */
- ADC_CH_CHARGER_CURRENT,
-
ADC_CH_COUNT
};
@@ -182,15 +170,9 @@ enum temp_sensor_id {
TEMP_SENSOR_I2C_TMP432_REMOTE1,
TEMP_SENSOR_I2C_TMP432_REMOTE2,
- /* Battery temperature sensor */
- TEMP_SENSOR_BATTERY,
-
TEMP_SENSOR_COUNT
};
-/* Discharge battery when on AC power for factory test. */
-int board_discharge_on_ac(int enable);
-
#endif /* !__ASSEMBLER__ */
#endif /* __BOARD_H */
diff --git a/board/ninja/build.mk b/board/ninja/build.mk
index d05ff6ff60..373ef42b86 100644
--- a/board/ninja/build.mk
+++ b/board/ninja/build.mk
@@ -9,4 +9,4 @@
# the IC is TI Stellaris LM4
CHIP:=lm4
-board-y=battery.o board.o led.o
+board-y=board.o led.o
diff --git a/board/ninja/ec.tasklist b/board/ninja/ec.tasklist
index 062500cef8..50c027b798 100644
--- a/board/ninja/ec.tasklist
+++ b/board/ninja/ec.tasklist
@@ -19,10 +19,8 @@
*/
#define CONFIG_TASK_LIST \
TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_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) \
TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(POWERBTN, power_button_task, NULL, TASK_STACK_SIZE) \
- TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE)
+ TASK_ALWAYS(POWERBTN, power_button_task, NULL, TASK_STACK_SIZE)
diff --git a/board/ninja/led.c b/board/ninja/led.c
index ddea38fc5a..079b9873e6 100644
--- a/board/ninja/led.c
+++ b/board/ninja/led.c
@@ -80,42 +80,5 @@ DECLARE_HOOK(HOOK_INIT, led_init, HOOK_PRIO_DEFAULT);
*/
static void led_tick(void)
{
- static unsigned ticks;
- int chstate = charge_get_state();
-
- ticks++;
-
- /* If we don't control the LED, nothing to do */
- if (!led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED))
- return;
-
- /* If charging error, blink orange, 25% duty cycle, 4 sec period */
- if (chstate == PWR_STATE_ERROR) {
- set_color((ticks % 16) < 4 ? LED_ORANGE : LED_OFF);
- return;
- }
-
- /* If charge-force-idle, blink green, 50% duty cycle, 2 sec period */
- if (chstate == PWR_STATE_IDLE &&
- (charge_get_flags() & CHARGE_FLAG_FORCE_IDLE)) {
- set_color((ticks & 0x4) ? LED_GREEN : LED_OFF);
- return;
- }
-
- /* If the system is charging, solid orange */
- if (chstate == PWR_STATE_CHARGE) {
- set_color(LED_ORANGE);
- return;
- }
-
- /* If AC connected and fully charged (or close to it), solid green */
- if (chstate == PWR_STATE_CHARGE_NEAR_FULL ||
- chstate == PWR_STATE_IDLE) {
- set_color(LED_GREEN);
- return;
- }
-
- /* Otherwise, system is off and AC not connected, LED off */
- set_color(LED_OFF);
}
DECLARE_HOOK(HOOK_TICK, led_tick, HOOK_PRIO_DEFAULT);
diff --git a/board/sumo/battery.c b/board/sumo/battery.c
deleted file mode 100644
index ce42fdb20d..0000000000
--- a/board/sumo/battery.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright 2015 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 "battery_smart.h"
-#include "console.h"
-#include "gpio.h"
-#include "host_command.h"
-#include "util.h"
-
-/* Shutdown mode parameter to write to manufacturer access register */
-#define SB_SHUTDOWN_DATA 0x0010
-
-static const struct battery_info info = {
- .voltage_max = 8400, /* mV */
- .voltage_normal = 7400,
- .voltage_min = 6000,
- .precharge_current = 256, /* mA */
- .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,
-};
-
-const struct battery_info *battery_get_info(void)
-{
- return &info;
-}
-
-static int cutoff(void)
-{
- int rv;
-
- /* Ship mode command must be sent twice to take effect */
- rv = sb_write(SB_MANUFACTURER_ACCESS, SB_SHUTDOWN_DATA);
-
- if (rv != EC_SUCCESS)
- return rv;
-
- return sb_write(SB_MANUFACTURER_ACCESS, SB_SHUTDOWN_DATA);
-}
-
-static int battery_command_cut_off(struct host_cmd_handler_args *args)
-{
- return cutoff() ? EC_RES_ERROR : EC_RES_SUCCESS;
-}
-DECLARE_HOST_COMMAND(EC_CMD_BATTERY_CUT_OFF, battery_command_cut_off,
- EC_VER_MASK(0));
-
-static int command_battcutoff(int argc, char **argv)
-{
- return cutoff();
-}
-DECLARE_CONSOLE_COMMAND(battcutoff, command_battcutoff,
- NULL,
- "Enable battery cutoff (ship mode)",
- NULL);
diff --git a/board/sumo/board.c b/board/sumo/board.c
index 23e44e6488..607934d5c5 100644
--- a/board/sumo/board.c
+++ b/board/sumo/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2015 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.
*/
@@ -117,8 +117,6 @@ BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
{GPIO_A, 0x03, 1, MODULE_UART}, /* UART0 */
- {GPIO_B, 0x04, 3, MODULE_I2C}, /* I2C0 SCL */
- {GPIO_B, 0x08, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C0 SDA */
{GPIO_B, 0x40, 3, MODULE_I2C}, /* I2C5 SCL */
{GPIO_B, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C5 SDA */
{GPIO_D, 0x0f, 2, MODULE_SPI}, /* SPI1 */
@@ -154,15 +152,6 @@ const struct adc_t adc_channels[] = {
*/
{"ECTemp", LM4_ADC_SEQ0, -225, ADC_READ_MAX, 420,
LM4_AIN_NONE, 0x0e /* TS0 | IE0 | END0 */, 0, 0},
-
- /* IOUT == ICMNT is on PE3/AIN0 */
- /* We have 0.01-ohm resistors, and IOUT is 40X the differential
- * voltage, so 1000mA ==> 400mV.
- * ADC returns 0x000-0xFFF, which maps to 0.0-3.3V (as configured).
- * mA = 1000 * ADC_VALUE / ADC_READ_MAX * 3300 / 400
- */
- {"ChargerCurrent", LM4_ADC_SEQ1, 33000, ADC_READ_MAX * 4, 0,
- LM4_AIN(0), 0x06 /* IE0 | END0 */, LM4_GPIO_E, (1<<3)},
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -176,7 +165,6 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"batt_chg", 0, 100},
{"thermal", 5, 100},
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -194,7 +182,6 @@ const struct temp_sensor_t temp_sensors[] = {
TMP432_IDX_REMOTE1, 4},
{"TMP432_CPU_bottom", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
TMP432_IDX_REMOTE2, 4},
- {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_temp_sensor_get_val, 0, 4},
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -206,14 +193,5 @@ struct ec_thermal_config thermal_params[] = {
{{0, 0, 0}, 0, 0},
{{0, 0, 0}, 0, 0},
{{0, 0, 0}, 0, 0},
- {{0, 0, 0}, 0, 0},
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
-
-/**
- * Discharge battery when on AC power for factory test.
- */
-int board_discharge_on_ac(int enable)
-{
- return charger_discharge_on_ac(enable);
-}
diff --git a/board/sumo/board.h b/board/sumo/board.h
index 2ea95e3b01..c103e4baf1 100644
--- a/board/sumo/board.h
+++ b/board/sumo/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2015 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.
*/
@@ -11,14 +11,7 @@
/* Optional features */
#define CONFIG_AP_HANG_DETECT
#define CONFIG_BACKLIGHT_LID
-#define CONFIG_BATTERY_SMART
#define CONFIG_BOARD_VERSION
-#define CONFIG_CHARGER
-#define CONFIG_CHARGER_BQ24715
-#define CONFIG_CHARGER_DISCHARGE_ON_AC
-#define CONFIG_CHARGER_INPUT_CURRENT 1894 /* 90% of 40 W adapter @ 19 V */
-#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
@@ -50,8 +43,6 @@
#ifndef __ASSEMBLER__
/* I2C ports */
-#define I2C_PORT_BATTERY 0
-#define I2C_PORT_CHARGER 0
#define I2C_PORT_THERMAL 5
/* 13x8 keyboard scanner uses an entire GPIO bank for row inputs */
@@ -159,9 +150,6 @@ enum adc_channel {
/* EC internal die temperature in degrees K. */
ADC_CH_EC_TEMP = 0,
- /* Charger current in mA. */
- ADC_CH_CHARGER_CURRENT,
-
ADC_CH_COUNT
};
@@ -182,15 +170,9 @@ enum temp_sensor_id {
TEMP_SENSOR_I2C_TMP432_REMOTE1,
TEMP_SENSOR_I2C_TMP432_REMOTE2,
- /* Battery temperature sensor */
- TEMP_SENSOR_BATTERY,
-
TEMP_SENSOR_COUNT
};
-/* Discharge battery when on AC power for factory test. */
-int board_discharge_on_ac(int enable);
-
#endif /* !__ASSEMBLER__ */
#endif /* __BOARD_H */
diff --git a/board/sumo/build.mk b/board/sumo/build.mk
index 2c03a698a6..373ef42b86 100644
--- a/board/sumo/build.mk
+++ b/board/sumo/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Copyright (c) 2015 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.
#
@@ -9,4 +9,4 @@
# the IC is TI Stellaris LM4
CHIP:=lm4
-board-y=battery.o board.o led.o
+board-y=board.o led.o
diff --git a/board/sumo/ec.tasklist b/board/sumo/ec.tasklist
index aa79450bea..50c027b798 100644
--- a/board/sumo/ec.tasklist
+++ b/board/sumo/ec.tasklist
@@ -1,5 +1,5 @@
/* -*- c -*- */
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2015 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.
*/
@@ -19,10 +19,8 @@
*/
#define CONFIG_TASK_LIST \
TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_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) \
TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(POWERBTN, power_button_task, NULL, TASK_STACK_SIZE) \
- TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE)
+ TASK_ALWAYS(POWERBTN, power_button_task, NULL, TASK_STACK_SIZE)
diff --git a/board/sumo/led.c b/board/sumo/led.c
index 7c7a1c2b05..dd1370413c 100644
--- a/board/sumo/led.c
+++ b/board/sumo/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2015 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.
*
@@ -80,42 +80,5 @@ DECLARE_HOOK(HOOK_INIT, led_init, HOOK_PRIO_DEFAULT);
*/
static void led_tick(void)
{
- static unsigned ticks;
- int chstate = charge_get_state();
-
- ticks++;
-
- /* If we don't control the LED, nothing to do */
- if (!led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED))
- return;
-
- /* If charging error, blink orange, 25% duty cycle, 4 sec period */
- if (chstate == PWR_STATE_ERROR) {
- set_color((ticks % 16) < 4 ? LED_ORANGE : LED_OFF);
- return;
- }
-
- /* If charge-force-idle, blink green, 50% duty cycle, 2 sec period */
- if (chstate == PWR_STATE_IDLE &&
- (charge_get_flags() & CHARGE_FLAG_FORCE_IDLE)) {
- set_color((ticks & 0x4) ? LED_GREEN : LED_OFF);
- return;
- }
-
- /* If the system is charging, solid orange */
- if (chstate == PWR_STATE_CHARGE) {
- set_color(LED_ORANGE);
- return;
- }
-
- /* If AC connected and fully charged (or close to it), solid green */
- if (chstate == PWR_STATE_CHARGE_NEAR_FULL ||
- chstate == PWR_STATE_IDLE) {
- set_color(LED_GREEN);
- return;
- }
-
- /* Otherwise, system is off and AC not connected, LED off */
- set_color(LED_OFF);
}
DECLARE_HOOK(HOOK_TICK, led_tick, HOOK_PRIO_DEFAULT);