[coreboot-gerrit] Patch set updated for coreboot: 129a566 i2c/ww_ring: decouple LED display from vboot

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Tue Apr 21 11:18:52 CEST 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9868

-gerrit

commit 129a5665c7ea9ccfe312b96fcd16e36af33a5aed
Author: Vadim Bendebury <vbendeb at chromium.org>
Date:   Tue Mar 17 15:37:54 2015 -0700

    i2c/ww_ring: decouple LED display from vboot
    
    The patterns displayed on the LED ring while under the coreboot
    control are not driven by the vboot, but by the board code instead,
    The four distinct states of the LED display are:
      - all off
      - recovery button push detected, waiting for it to be released
      - wipeout request pending - recovery button was pushed long enough
        to trigger this request
      - recovery request pending - recovery button was pushed long enough
        to trigger this request.
    
    BRANCH=storm
    BUG=chrome-os-partner:36059
    TEST=no functional changes
    
    Change-Id: I38d9a3028013b902a7a67ccd4eb1c5d533bf071c
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
    Original-Commit-Id: bdfff0e646283da6a2faaacf33e0179d2fea221c
    Original-Change-Id: Ie279151b6060a2888268a2e9a0d4dc22ecaba460
    Original-Signed-off-by: Vadim Bendebury <vbendeb at chromium.org>
    Original-Reviewed-on: https://chromium-review.googlesource.com/260649
    Original-Reviewed-by: Aaron Durbin <adurbin at chromium.org>
---
 src/drivers/i2c/ww_ring/Kconfig       |  1 -
 src/drivers/i2c/ww_ring/ww_ring.c     | 13 ++++++-------
 src/drivers/i2c/ww_ring/ww_ring.h     | 18 +++++++++++-------
 src/mainboard/google/storm/chromeos.c | 14 +++++++++++---
 4 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/src/drivers/i2c/ww_ring/Kconfig b/src/drivers/i2c/ww_ring/Kconfig
index 67a12eb..c671871 100644
--- a/src/drivers/i2c/ww_ring/Kconfig
+++ b/src/drivers/i2c/ww_ring/Kconfig
@@ -1,3 +1,2 @@
 config DRIVERS_I2C_WW_RING
 	bool
-	depends on CHROMEOS
diff --git a/src/drivers/i2c/ww_ring/ww_ring.c b/src/drivers/i2c/ww_ring/ww_ring.c
index e1f255a..243543a 100644
--- a/src/drivers/i2c/ww_ring/ww_ring.c
+++ b/src/drivers/i2c/ww_ring/ww_ring.c
@@ -114,7 +114,7 @@ typedef struct {
 
 /* A structure to bind controller programs to a vboot state. */
 typedef struct {
-	enum VbScreenType_t    vb_screen;
+	enum display_pattern   led_pattern;
 	const TiLp55231Program * programs[WW_RING_NUM_LED_CONTROLLERS];
 } WwRingStateProg;
 
@@ -143,8 +143,7 @@ static const WwRingStateProg state_programs[] = {
 	 * for test purposes the blank screen program is set to blinking, will
 	 * be changed soon.
 	 */
-	{VB_SCREEN_BLANK, {&led_blink_program, &led_blink_program} },
-	/* Other vboot state programs are coming. */
+	{WWR_ALL_OFF, {&led_blink_program, &led_blink_program} },
 };
 /*								*/
 /****************************************************************/
@@ -388,7 +387,7 @@ static int ledc_init_validate(TiLp55231 *ledc)
  * Find a program matching screen type, and run it on both controllers, if
  * found.
  */
-int ww_ring_display_pattern(unsigned i2c_bus, enum VbScreenType_t screen_type)
+int ww_ring_display_pattern(unsigned i2c_bus, enum display_pattern pattern)
 {
 	int i;
 	static int initted;
@@ -399,7 +398,7 @@ int ww_ring_display_pattern(unsigned i2c_bus, enum VbScreenType_t screen_type)
 	}
 
 	for (i = 0; i < ARRAY_SIZE(state_programs); i++)
-		if (state_programs[i].vb_screen == screen_type) {
+		if (state_programs[i].led_pattern == pattern) {
 			int j;
 
 			for (j = 0; j < WW_RING_NUM_LED_CONTROLLERS; j++) {
@@ -411,8 +410,8 @@ int ww_ring_display_pattern(unsigned i2c_bus, enum VbScreenType_t screen_type)
 			return 0;
 		}
 
-	printk(BIOS_WARNING, "%s: did not find program for screen %d\n",
-	       __func__, screen_type);
+	printk(BIOS_WARNING, "%s: did not find program for pattern %d\n",
+	       __func__, pattern);
 
 	return -1;
 }
diff --git a/src/drivers/i2c/ww_ring/ww_ring.h b/src/drivers/i2c/ww_ring/ww_ring.h
index 628cd6c..d2804ed 100644
--- a/src/drivers/i2c/ww_ring/ww_ring.h
+++ b/src/drivers/i2c/ww_ring/ww_ring.h
@@ -14,17 +14,21 @@
 #ifndef __SRC_DRIVERS_VIDEO_WW_RING__H__
 #define __SRC_DRIVERS_VIDEO_WW_RING__H__
 
-#if IS_ENABLED(CONFIG_CHROMEOS)
-#include <vboot_api.h>
-
+/*
+ * Different types of display patterns to be shown by the LED ring while
+ * contrlled by coreboot.
+ */
+enum display_pattern {
+	WWR_ALL_OFF,		/* Turn the LEDs off. */
+	WWR_RECOVERY_PUSHED,	/* Recovery button push detected on start up. */
+	WWR_WIPEOUT_REQUEST,	/* Held long enough for wipout request. */
+	WWR_RECOVERY_REQUEST,	/* Held long enough for recovery request. */
+};
 /*
  * ww_ring_display_pattern
  *
  * Display pattern on the ring LEDs.
  */
-int ww_ring_display_pattern(unsigned i2c_bus, enum VbScreenType_t screen_type);
+int ww_ring_display_pattern(unsigned i2c_bus, enum display_pattern pattern);
 
-#else
-static inline int ww_ring_display_pattern(unsigned i2c_bus, int screen_type) { return 0;}
-#endif
 #endif
diff --git a/src/mainboard/google/storm/chromeos.c b/src/mainboard/google/storm/chromeos.c
index d424f30..0448206 100644
--- a/src/mainboard/google/storm/chromeos.c
+++ b/src/mainboard/google/storm/chromeos.c
@@ -84,6 +84,12 @@ enum switch_state {
 	wipeout_req
 };
 
+static void display_pattern(int pattern)
+{
+	if (board_id() == BOARD_ID_WHIRLWIND_SP5)
+		ww_ring_display_pattern(GSBI_ID_7, pattern);
+}
+
 #define WIPEOUT_MODE_DELAY_MS (8 * 1000)
 #define RECOVERY_MODE_EXTRA_DELAY_MS (8 * 1000)
 
@@ -103,7 +109,9 @@ static enum switch_state get_switch_state(void)
 		return saved_state;
 	}
 
+	display_pattern(WWR_RECOVERY_PUSHED);
 	printk(BIOS_INFO, "recovery button pressed\n");
+
 	stopwatch_init_msecs_expire(&sw, WIPEOUT_MODE_DELAY_MS);
 
 	do {
@@ -113,9 +121,7 @@ static enum switch_state get_switch_state(void)
 	} while (!stopwatch_expired(&sw));
 
 	if (sampled_value) {
-		if (board_id() == BOARD_ID_WHIRLWIND_SP5)
-			ww_ring_display_pattern(GSBI_ID_7, 0);
-
+		display_pattern(WWR_WIPEOUT_REQUEST);
 		printk(BIOS_INFO, "wipeout requested, checking recovery\n");
 		stopwatch_init_msecs_expire(&sw, RECOVERY_MODE_EXTRA_DELAY_MS);
 		do {
@@ -126,12 +132,14 @@ static enum switch_state get_switch_state(void)
 
 		if (sampled_value) {
 			saved_state = recovery_req;
+			display_pattern(WWR_RECOVERY_REQUEST);
 			printk(BIOS_INFO, "recovery requested\n");
 		} else {
 			saved_state = wipeout_req;
 		}
 	} else {
 		saved_state = no_req;
+		display_pattern(WWR_ALL_OFF);
 	}
 
 	return saved_state;



More information about the coreboot-gerrit mailing list