From f28f2b2e518d50001b03aeffac747e2f17d2917f Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Thu, 10 May 2012 14:52:20 -0700 Subject: Use open drain reset signals, and clean up signals to 5VALW-powered devices Open drain cleanup minimizes leakage and signal glitching on shared reset/signal lines, and is tidier than explicitly switching the signals between inputs/outputs. Touchscreen and lightbar are powered by +5VALW so their signals need to be dropped when +5VALW is off to avoid leakage, and so they see a clean reset signal when they're powered up. Moved +5VALW power-on to S5-S3 transition, to minimize power draw in S5. This also ensures that 5VALW-powered devices get reset when the device bounces through S5. (No effect on proto1, where 5VALW is not under EC control.) Signed-off-by: Randall Spangler BUG=chrome-os-partner:9172 TEST=boot and shutdown system; still works. Change-Id: Ia4bf0703292a189c324ce283d1e79a33776ee40f --- chip/lm4/gpio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'chip/lm4/gpio.c') diff --git a/chip/lm4/gpio.c b/chip/lm4/gpio.c index 54ab546f00..cb08533413 100644 --- a/chip/lm4/gpio.c +++ b/chip/lm4/gpio.c @@ -184,14 +184,18 @@ int gpio_set_flags(enum gpio_signal signal, int flags) if (flags & GPIO_OUTPUT) { /* Output */ - LM4_GPIO_DIR(g->port) |= g->mask; - + /* Select open drain first, so that we don't glitch the signal + * when changing the line to an output. */ if (g->flags & GPIO_OPEN_DRAIN) LM4_GPIO_ODR(g->port) |= g->mask; else LM4_GPIO_ODR(g->port) &= ~g->mask; + + LM4_GPIO_DIR(g->port) |= g->mask; } else { /* Input */ + LM4_GPIO_DIR(g->port) &= ~g->mask; + if (g->flags & GPIO_PULL) { /* With pull up/down */ if (g->flags & GPIO_HIGH) -- cgit v1.2.1