summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-10-01 14:29:45 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-10-07 18:30:45 +0000
commit90a6676ad531fd8c53e6398050f8093a921245fc (patch)
treeaee8387c1b1416ce46c0bdc34b7a47ffc0f0acaa
parent57aaa0267ec042d8b36aacf5b3efba12df4e6ec2 (diff)
downloadchrome-ec-90a6676ad531fd8c53e6398050f8093a921245fc.tar.gz
cleanup: Move board-specific LED state machines to board dirs
The LED state machine ends up being very board-specific, as does the specific configuration of LEDs and whether they're PWM'd or just GPIOs. dparker has some clever ideas for how to move more of the functionality to common/led_common.c (used at present only by peppy); that will be done as a follow-on to this CL. There's a unit test for the spring LED implementation. To keep that compiling, just use a symlink to the spring-specific implementation. No code changes; just moving around files. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all boards; pass unit tests Change-Id: I5973e701a29a72575db9a161dc146855ab21cca6 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/171771 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--board/falco/build.mk2
-rw-r--r--board/falco/led.c (renamed from common/led_falco.c)0
-rw-r--r--board/kirby/build.mk2
-rw-r--r--board/kirby/led.c (renamed from common/led_kirby.c)0
-rw-r--r--board/peppy/board.h1
-rw-r--r--board/peppy/build.mk2
-rw-r--r--board/peppy/led.c (renamed from common/led_peppy.c)0
-rw-r--r--board/slippy/build.mk2
-rw-r--r--board/slippy/led.c (renamed from common/led_slippy.c)0
-rw-r--r--board/spring/build.mk2
-rw-r--r--board/spring/led.c (renamed from common/led_lp5562.c)0
-rw-r--r--common/build.mk7
-rw-r--r--include/config.h3
-rw-r--r--test/build.mk4
-rw-r--r--test/led_spring.c (renamed from test/led_lp5562.c)0
-rw-r--r--test/led_spring.tasklist (renamed from test/led_lp5562.tasklist)0
l---------test/led_spring_impl.c1
-rw-r--r--test/test_config.h2
18 files changed, 15 insertions, 13 deletions
diff --git a/board/falco/build.mk b/board/falco/build.mk
index 479e75aef2..e8bbc36cbd 100644
--- a/board/falco/build.mk
+++ b/board/falco/build.mk
@@ -9,4 +9,4 @@
# the IC is TI Stellaris LM4
CHIP:=lm4
-board-y=board.o battery.o panel.o
+board-y=board.o battery.o led.o panel.o
diff --git a/common/led_falco.c b/board/falco/led.c
index c0d7c5f3ef..c0d7c5f3ef 100644
--- a/common/led_falco.c
+++ b/board/falco/led.c
diff --git a/board/kirby/build.mk b/board/kirby/build.mk
index a02cbb0fee..315c86bdfe 100644
--- a/board/kirby/build.mk
+++ b/board/kirby/build.mk
@@ -10,4 +10,4 @@ CHIP:=stm32
CHIP_FAMILY:=stm32l
CHIP_VARIANT:=stm32l15x
-board-y=board.o battery.o
+board-y=board.o battery.o led.o
diff --git a/common/led_kirby.c b/board/kirby/led.c
index 53f11d10db..53f11d10db 100644
--- a/common/led_kirby.c
+++ b/board/kirby/led.c
diff --git a/board/peppy/board.h b/board/peppy/board.h
index ff4681aadc..160e6f1d2b 100644
--- a/board/peppy/board.h
+++ b/board/peppy/board.h
@@ -30,6 +30,7 @@
#define CONFIG_FAN_POWER_GOOD GPIO_PP5000_PGOOD
#define CONFIG_KEYBOARD_BOARD_CONFIG
#define CONFIG_KEYBOARD_PROTOCOL_8042
+#define CONFIG_LED_COMMON
#define CONFIG_POWER_BUTTON
#define CONFIG_POWER_BUTTON_X86
#define CONFIG_PWM
diff --git a/board/peppy/build.mk b/board/peppy/build.mk
index b82aa39df6..2eb0db0bc6 100644
--- a/board/peppy/build.mk
+++ b/board/peppy/build.mk
@@ -9,4 +9,4 @@
# the IC is TI Stellaris LM4
CHIP:=lm4
-board-y=board.o battery.o
+board-y=board.o battery.o led.o
diff --git a/common/led_peppy.c b/board/peppy/led.c
index ffdcdb8359..ffdcdb8359 100644
--- a/common/led_peppy.c
+++ b/board/peppy/led.c
diff --git a/board/slippy/build.mk b/board/slippy/build.mk
index b82aa39df6..2eb0db0bc6 100644
--- a/board/slippy/build.mk
+++ b/board/slippy/build.mk
@@ -9,4 +9,4 @@
# the IC is TI Stellaris LM4
CHIP:=lm4
-board-y=board.o battery.o
+board-y=board.o battery.o led.o
diff --git a/common/led_slippy.c b/board/slippy/led.c
index c23ce13c17..c23ce13c17 100644
--- a/common/led_slippy.c
+++ b/board/slippy/led.c
diff --git a/board/spring/build.mk b/board/spring/build.mk
index 6825668505..2d3d6770db 100644
--- a/board/spring/build.mk
+++ b/board/spring/build.mk
@@ -9,4 +9,4 @@ CHIP:=stm32
CHIP_FAMILY:=stm32f
CHIP_VARIANT:=stm32f100
-board-y=board.o battery.o
+board-y=board.o battery.o led.o
diff --git a/common/led_lp5562.c b/board/spring/led.c
index 3d6e316426..3d6e316426 100644
--- a/common/led_lp5562.c
+++ b/board/spring/led.c
diff --git a/common/build.mk b/common/build.mk
index 0ab2658c07..7452ffec8a 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -12,10 +12,6 @@ common-y+=gpio_common.o version.o printf.o queue.o
common-y+=throttle_ap.o
common-$(BOARD_daisy)+=extpower_snow.o
-common-$(BOARD_falco)+=led_falco.o
-common-$(BOARD_kirby)+=led_kirby.o
-common-$(BOARD_peppy)+=led_common.o led_peppy.o
-common-$(BOARD_slippy)+=led_slippy.o
common-$(BOARD_snow)+=extpower_snow.o
common-$(CONFIG_BACKLIGHT_LID)+=backlight_lid.o
@@ -48,8 +44,9 @@ common-$(CONFIG_I2C_ARBITRATION)+=i2c_arbitration.o
common-$(CONFIG_KEYBOARD_PROTOCOL_8042)+=keyboard_8042.o
common-$(CONFIG_KEYBOARD_PROTOCOL_MKBP)+=keyboard_mkbp.o
common-$(CONFIG_KEYBOARD_TEST)+=keyboard_test.o
+common-$(CONFIG_LED_COMMON)+=led_common.o
common-$(CONFIG_LED_DRIVER_DS2413)+=led_driver_ds2413.o
-common-$(CONFIG_LED_DRIVER_LP5562)+=led_driver_lp5562.o led_lp5562.o
+common-$(CONFIG_LED_DRIVER_LP5562)+=led_driver_lp5562.o
common-$(CONFIG_LID_SWITCH)+=lid_switch.o
common-$(CONFIG_LPC)+=port80.o
common-$(CONFIG_ONEWIRE)+=onewire.o
diff --git a/include/config.h b/include/config.h
index 4c69dd9577..7887c862e2 100644
--- a/include/config.h
+++ b/include/config.h
@@ -460,6 +460,9 @@
/*****************************************************************************/
+/* Compile support for common LED interface */
+#undef CONFIG_LED_COMMON
+
/* Compile support for LED driver chip(s) */
#undef CONFIG_LED_DRIVER_DS2413 /* Maxim DS2413, on one-wire interface */
#undef CONFIG_LED_DRIVER_LP5562 /* LP5562, on I2C interface */
diff --git a/test/build.mk b/test/build.mk
index e02abaae62..407d7cb540 100644
--- a/test/build.mk
+++ b/test/build.mk
@@ -30,7 +30,7 @@ test-list-$(BOARD_samus)=
# Emulator tests
test-list-host=mutex pingpong utils kb_scan kb_mkbp lid_sw power_button hooks
test-list-host+=thermal flash queue kb_8042 extpwr_gpio console_edit system
-test-list-host+=sbs_charging adapter host_command thermal_falco led_lp5562
+test-list-host+=sbs_charging adapter host_command thermal_falco led_spring
test-list-host+=bklight_lid bklight_passthru
adapter-y=adapter.o
@@ -44,7 +44,7 @@ host_command-y=host_command.o
kb_8042-y=kb_8042.o
kb_mkbp-y=kb_mkbp.o
kb_scan-y=kb_scan.o
-led_lp5562-y=led_lp5562.o
+led_spring-y=led_spring.o led_spring_impl.o
lid_sw-y=lid_sw.o
mutex-y=mutex.o
pingpong-y=pingpong.o
diff --git a/test/led_lp5562.c b/test/led_spring.c
index 79f01b297f..79f01b297f 100644
--- a/test/led_lp5562.c
+++ b/test/led_spring.c
diff --git a/test/led_lp5562.tasklist b/test/led_spring.tasklist
index 26cfc53453..26cfc53453 100644
--- a/test/led_lp5562.tasklist
+++ b/test/led_spring.tasklist
diff --git a/test/led_spring_impl.c b/test/led_spring_impl.c
new file mode 120000
index 0000000000..25fcf73a27
--- /dev/null
+++ b/test/led_spring_impl.c
@@ -0,0 +1 @@
+../board/spring/led.c \ No newline at end of file
diff --git a/test/test_config.h b/test/test_config.h
index 3c8f35b75d..9de2e0db8c 100644
--- a/test/test_config.h
+++ b/test/test_config.h
@@ -27,7 +27,7 @@
#define CONFIG_KEYBOARD_PROTOCOL_8042
#endif
-#ifdef TEST_led_lp5562
+#ifdef TEST_led_spring
#define CONFIG_BATTERY_MOCK
#define CONFIG_BATTERY_SMART
#define CONFIG_CHARGER_INPUT_CURRENT 4032