From e881236a72fa6ce750cfc8db8eafcb6f9a81ba7c Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Tue, 3 Apr 2012 17:57:05 -0700 Subject: [PATCH] lightbar: add reset GPIO De-assert the lightbar reset GPIO to be able to access its registers. According to the HW guys, it will consume less power in standby than in reset due the pull-up on the reset line. Signed-off-by: Bill Richardson BUG=None TEST=manual On Link proto-1, type "lightbar test" in the EC console and see it blink. On BDS, just build it. Nothing actually changes for BDS. Change-Id: I9ec612c80f48d41ccf779f0962fc047966d4b7ba --- board/bds/board.c | 1 + board/bds/board.h | 1 + common/lightbar.c | 9 +++++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/board/bds/board.c b/board/bds/board.c index 6a76c03e03..e433b818d7 100644 --- a/board/bds/board.c +++ b/board/bds/board.c @@ -79,6 +79,7 @@ const struct gpio_info gpio_list[GPIO_COUNT] = { GPIO_SIGNAL_NOT_IMPLEMENTED("SHUNT_1_5V_DDR"), GPIO_SIGNAL_NOT_IMPLEMENTED("RECOVERYn"), GPIO_SIGNAL_NOT_IMPLEMENTED("WRITE_PROTECTn"), + GPIO_SIGNAL_NOT_IMPLEMENTED("LIGHTBAR_RESETn"), }; diff --git a/board/bds/board.h b/board/bds/board.h index 0b96e493c2..1aed0f314a 100644 --- a/board/bds/board.h +++ b/board/bds/board.h @@ -119,6 +119,7 @@ enum gpio_signal { * depending on stuffing. */ GPIO_RECOVERYn, /* Recovery signal from servo */ GPIO_WRITE_PROTECTn, /* Write protect input */ + GPIO_LIGHTBAR_RESETn, /* Reset lightbar controllers (Proto1+) */ /* Number of GPIOs; not an actual GPIO */ GPIO_COUNT diff --git a/common/lightbar.c b/common/lightbar.c index 6cc897d25a..743962e43f 100644 --- a/common/lightbar.c +++ b/common/lightbar.c @@ -7,6 +7,7 @@ #include "board.h" #include "console.h" +#include "gpio.h" #include "i2c.h" #include "timer.h" #include "uart.h" @@ -58,11 +59,11 @@ static const struct { /****************************************************************************/ /* External interface functions. */ -/* Shut down the driver chips, so everything is off. */ +/* We don't actually shut down the driver chips, because the reset pullup + * uses more power than leaving them enabled but inactive. */ void lightbar_off(void) { - /* FIXME: nRST is attached to a GPIO on link, so just assert it. For - * now we'll just put the drivers into standby, but won't reset. */ + gpio_set_level(GPIO_LIGHTBAR_RESETn, 1); i2c_write8(I2C_PORT_LIGHTBAR, DRIVER_FUN, 0x01, 0x00); i2c_write8(I2C_PORT_LIGHTBAR, DRIVER_SMART, 0x01, 0x00); } @@ -71,7 +72,7 @@ void lightbar_off(void) void lightbar_on(void) { int i; - /* FIXME: If nRST is asserted, deassert it. */ + gpio_set_level(GPIO_LIGHTBAR_RESETn, 1); for (i = 0; i < ARRAY_SIZE(ready_vals); i++) { i2c_write8(I2C_PORT_LIGHTBAR, DRIVER_FUN, ready_vals[i].reg, ready_vals[i].val);