summaryrefslogtreecommitdiff
path: root/chip/lm4/gpio.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-05-10 14:52:20 -0700
committerRandall Spangler <rspangler@chromium.org>2012-05-10 15:17:01 -0700
commitf28f2b2e518d50001b03aeffac747e2f17d2917f (patch)
treec5c542d4cfe2663d5b5d87eb1ae3d1c5c2f7f64d /chip/lm4/gpio.c
parent8d48971e917b22a98adab4e6c64fdca667b21e26 (diff)
downloadchrome-ec-f28f2b2e518d50001b03aeffac747e2f17d2917f.tar.gz
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 <rspangler@chromium.org> BUG=chrome-os-partner:9172 TEST=boot and shutdown system; still works. Change-Id: Ia4bf0703292a189c324ce283d1e79a33776ee40f
Diffstat (limited to 'chip/lm4/gpio.c')
-rw-r--r--chip/lm4/gpio.c8
1 files changed, 6 insertions, 2 deletions
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)