summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-09-10 15:15:06 -0700
committerGerrit <chrome-bot@google.com>2012-09-11 09:46:16 -0700
commitb0891c30e0d5d0086b9d01e87ded99d79195d6ad (patch)
treedd3baec2161f88e5810b665675d866dcade64d73
parent774d047d5ee363c565cf58561c2d92c871eb87cf (diff)
downloadchrome-ec-b0891c30e0d5d0086b9d01e87ded99d79195d6ad.tar.gz
Cleanup: move lightbar command enum into ec_commands.h
Previously this was in lightbar.h. ec_commands.h should not require other header files. Also make brightness local variable static, so it won't leak outside lightbar module. This is simply code cleanup; values themselves have not changed. BUG=none TEST=if it builds, it's fine BRANCH=none (not required in link branch since it's just cleanup) Change-Id: I5722fb677fcec99e0826e3dfc0b22033781b576f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/32815 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
-rw-r--r--common/lightbar.c2
-rw-r--r--include/ec_commands.h23
-rw-r--r--include/lightbar.h15
3 files changed, 23 insertions, 17 deletions
diff --git a/common/lightbar.c b/common/lightbar.c
index eb9c0014a8..cfb292249d 100644
--- a/common/lightbar.c
+++ b/common/lightbar.c
@@ -113,7 +113,7 @@ static inline uint8_t scale_abs(int val, int max)
}
/* It will often be simpler to provide an overall brightness control. */
-int brightness = 0x80;
+static int brightness = 0x80;
/* So that we can make brightness changes happen instantly, we need to track
* the current values. The values in the controllers aren't very helpful. */
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 0fcb87ec47..4e3bd7082f 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -623,10 +623,12 @@ struct ec_params_pwm_set_fan_duty {
struct ec_params_lightbar_cmd {
union {
union {
- uint8_t cmd;
+ uint8_t cmd; /* Command (see enum lightbar_command) */
+
struct {
uint8_t cmd;
} dump, off, on, init, get_seq;
+
struct num {
uint8_t cmd;
uint8_t num;
@@ -636,11 +638,13 @@ struct ec_params_lightbar_cmd {
uint8_t cmd;
uint8_t ctrl, reg, value;
} reg;
+
struct rgb {
uint8_t cmd;
uint8_t led, red, green, blue;
} rgb;
} in;
+
union {
struct dump {
struct {
@@ -649,9 +653,11 @@ struct ec_params_lightbar_cmd {
uint8_t ic1;
} vals[23];
} dump;
+
struct get_seq {
uint8_t num;
} get_seq;
+
struct {
/* no return params */
} off, on, init, brightness, seq, reg, rgb, demo;
@@ -659,6 +665,21 @@ struct ec_params_lightbar_cmd {
};
} __packed;
+/* Lightbar commands */
+enum lightbar_command {
+ LIGHTBAR_CMD_DUMP = 0,
+ LIGHTBAR_CMD_OFF = 1,
+ LIGHTBAR_CMD_ON = 2,
+ LIGHTBAR_CMD_INIT = 3,
+ LIGHTBAR_CMD_BRIGHTNESS = 4,
+ LIGHTBAR_CMD_SEQ = 5,
+ LIGHTBAR_CMD_REG = 6,
+ LIGHTBAR_CMD_RGB = 7,
+ LIGHTBAR_CMD_GET_SEQ = 8,
+ LIGHTBAR_CMD_DEMO = 9,
+ LIGHTBAR_NUM_CMDS
+};
+
/*****************************************************************************/
/* Verified boot commands */
diff --git a/include/lightbar.h b/include/lightbar.h
index ea48314904..4f284a43b6 100644
--- a/include/lightbar.h
+++ b/include/lightbar.h
@@ -25,21 +25,6 @@ void lightbar_sequence(enum lightbar_sequence s);
/****************************************************************************/
/* External stuff */
-/* These are the commands available to the EC console or via LPC. */
-enum lightbar_command {
- LIGHTBAR_CMD_DUMP,
- LIGHTBAR_CMD_OFF,
- LIGHTBAR_CMD_ON,
- LIGHTBAR_CMD_INIT,
- LIGHTBAR_CMD_BRIGHTNESS,
- LIGHTBAR_CMD_SEQ,
- LIGHTBAR_CMD_REG,
- LIGHTBAR_CMD_RGB,
- LIGHTBAR_CMD_GET_SEQ,
- LIGHTBAR_CMD_DEMO,
- LIGHTBAR_NUM_CMDS
-};
-
/* These are used for demo purposes */
extern void demo_battery_level(int inc);
extern void demo_is_charging(int ischarge);