summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2013-10-31 11:49:12 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-11-01 16:16:42 +0000
commitfa13ac76b10847e133d654654f0a9418f87d11fb (patch)
tree24350ab2e8630f1c3742cb651381eddeb80482d0
parent6aa0a79f283b03df20af11d3776a10da67b112d6 (diff)
downloadchrome-ec-fa13ac76b10847e133d654654f0a9418f87d11fb.tar.gz
samus: Changes for Proto1b
- disable PP1800_PGOOD internal pullup - add PP3300_DSW_EN control on PF6, turned on in S5 and off in G3 - change PCH_WAKE_L and PCH_PWRBTN_L to open drain signals - add PCH_BL_EN interrupt on PM3 for rising edge to put backlight controller into PWM mode, remove 1 second hook - add samus-specific extpower handler for AC_PRESENT to buffer the AC_PRESENT input to the new PCH_ACOK output on PM6. this is driven high in S5/S3/S0 when AC_PRESENT is high, otherwise driven low. BUG=chrome-os-partner:23752 BRANCH=samus TEST=emerge-samus chromeos-ec Change-Id: Ie8ab538610e41914212ee1f3a6287b63474fb85b Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/175281 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--board/samus/board.c10
-rw-r--r--board/samus/board.h6
-rw-r--r--board/samus/build.mk2
-rw-r--r--board/samus/extpower.c64
-rw-r--r--board/samus/panel.c25
-rw-r--r--board/samus/power_sequence.c8
6 files changed, 90 insertions, 25 deletions
diff --git a/board/samus/board.c b/board/samus/board.c
index 9e6b039715..a2e1e14b30 100644
--- a/board/samus/board.c
+++ b/board/samus/board.c
@@ -52,7 +52,7 @@ const struct gpio_info gpio_list[] = {
x86_interrupt},
{"PP1200_PGOOD", LM4_GPIO_H, (1<<6), GPIO_INT_BOTH,
x86_interrupt},
- {"PP1800_PGOOD", LM4_GPIO_L, (1<<7), GPIO_PULL_UP|GPIO_INT_BOTH,
+ {"PP1800_PGOOD", LM4_GPIO_L, (1<<7), GPIO_INT_BOTH,
x86_interrupt},
{"VCORE_PGOOD", LM4_GPIO_C, (1<<6), GPIO_INT_BOTH,
x86_interrupt},
@@ -60,6 +60,8 @@ const struct gpio_info gpio_list[] = {
switch_interrupt},
{"WP_L", LM4_GPIO_A, (1<<4), GPIO_INT_BOTH,
switch_interrupt},
+ {"PCH_BL_EN", LM4_GPIO_M, (1<<3), GPIO_INT_RISING,
+ backlight_interrupt},
/* Other inputs */
{"BOARD_VERSION1", LM4_GPIO_Q, (1<<5), GPIO_INPUT, NULL},
@@ -78,6 +80,7 @@ const struct gpio_info gpio_list[] = {
/* Outputs; all unasserted by default except for reset signals */
{"CPU_PROCHOT", LM4_GPIO_B, (1<<1), GPIO_OUT_LOW, NULL},
{"PP1200_EN", LM4_GPIO_H, (1<<5), GPIO_OUT_LOW, NULL},
+ {"PP3300_DSW_EN", LM4_GPIO_F, (1<<6), GPIO_OUT_LOW, NULL},
{"PP3300_DSW_GATED_EN", LM4_GPIO_J, (1<<3), GPIO_OUT_LOW, NULL},
{"PP3300_LTE_EN", LM4_GPIO_D, (1<<2), GPIO_OUT_LOW, NULL},
{"PP3300_WLAN_EN", LM4_GPIO_J, (1<<0), GPIO_OUT_LOW, NULL},
@@ -98,14 +101,15 @@ const struct gpio_info gpio_list[] = {
* input until we drive it high. So can't use open-drain (HI_Z).
*/
{"PCH_HDA_SDO", LM4_GPIO_G, (1<<1), GPIO_INPUT, NULL},
- {"PCH_WAKE_L", LM4_GPIO_F, (1<<0), GPIO_OUT_HIGH, NULL},
+ {"PCH_WAKE_L", LM4_GPIO_F, (1<<0), GPIO_ODR_HIGH, NULL},
{"PCH_NMI_L", LM4_GPIO_F, (1<<2), GPIO_ODR_HIGH, NULL},
- {"PCH_PWRBTN_L", LM4_GPIO_H, (1<<0), GPIO_OUT_HIGH, NULL},
+ {"PCH_PWRBTN_L", LM4_GPIO_H, (1<<0), GPIO_ODR_HIGH, NULL},
{"PCH_PWROK", LM4_GPIO_F, (1<<5), GPIO_OUT_LOW, NULL},
{"PCH_RCIN_L", LM4_GPIO_F, (1<<3), GPIO_ODR_HIGH, NULL},
{"PCH_SYS_RST_L", LM4_GPIO_F, (1<<1), GPIO_ODR_HIGH, NULL},
{"PCH_SMI_L", LM4_GPIO_F, (1<<4), GPIO_ODR_HIGH, NULL},
{"TOUCHSCREEN_RESET_L", LM4_GPIO_N, (1<<7), GPIO_OUT_LOW, NULL},
+ {"PCH_ACOK", LM4_GPIO_M, (1<<6), GPIO_OUT_LOW, NULL},
#ifndef HEY_USE_BUILTIN_CLKRUN
{"LPC_CLKRUN_L", LM4_GPIO_M, (1<<2), GPIO_ODR_HIGH, NULL},
#endif
diff --git a/board/samus/board.h b/board/samus/board.h
index ba2d7c7555..c8c9dfda1a 100644
--- a/board/samus/board.h
+++ b/board/samus/board.h
@@ -18,7 +18,6 @@
#define CONFIG_BOARD_VERSION
#define CONFIG_CHIPSET_X86
#define CONFIG_CHIPSET_CAN_THROTTLE
-#define CONFIG_EXTPOWER_GPIO
#define CONFIG_KEYBOARD_BOARD_CONFIG
#define CONFIG_KEYBOARD_PROTOCOL_8042
#define CONFIG_LED_DRIVER_DS2413
@@ -87,6 +86,7 @@ enum gpio_signal {
GPIO_VCORE_PGOOD, /* Power good on core VR */
GPIO_RECOVERY_L, /* Recovery signal from servo */
GPIO_WP_L, /* Write protect input */
+ GPIO_PCH_BL_EN, /* PCH backlight input */
/* Other inputs */
GPIO_BOARD_VERSION1, /* Board version stuffing resistor 1 */
@@ -104,7 +104,8 @@ enum gpio_signal {
/* Outputs */
GPIO_CPU_PROCHOT, /* Force CPU to think it's overheated */
GPIO_PP1200_EN, /* Enable 1.20V supply */
- GPIO_PP3300_DSW_GATED_EN, /* Enable DSW rails */
+ GPIO_PP3300_DSW_EN, /* Enable 3.3V DSW rail */
+ GPIO_PP3300_DSW_GATED_EN, /* Enable 3.3V Gated DSW and core VDD */
GPIO_PP3300_LTE_EN, /* Enable LTE radio */
GPIO_PP3300_WLAN_EN, /* Enable WiFi power */
GPIO_PP1050_EN, /* Enable 1.05V regulator */
@@ -130,6 +131,7 @@ enum gpio_signal {
GPIO_PCH_SYS_RST_L, /* Reset PCH resume power plane logic */
GPIO_PCH_SMI_L, /* System management interrupt to PCH */
GPIO_TOUCHSCREEN_RESET_L, /* Reset touch screen */
+ GPIO_PCH_ACOK, /* AC present signal buffered to PCH */
#ifndef HEY_USE_BUILTIN_CLKRUN
GPIO_LPC_CLKRUN_L, /* Dunno. Probably important, though. */
#endif
diff --git a/board/samus/build.mk b/board/samus/build.mk
index 9f1237d90c..153a280b76 100644
--- a/board/samus/build.mk
+++ b/board/samus/build.mk
@@ -9,4 +9,4 @@
# the IC is TI Stellaris LM4
CHIP:=lm4
-board-y=board.o power_sequence.o panel.o
+board-y=board.o power_sequence.o panel.o extpower.o
diff --git a/board/samus/extpower.c b/board/samus/extpower.c
new file mode 100644
index 0000000000..6100a83127
--- /dev/null
+++ b/board/samus/extpower.c
@@ -0,0 +1,64 @@
+/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/*
+ * Pure GPIO-based external power detection, buffered to PCH.
+ * Drive high in S5-S0 when AC_PRESENT is high, otherwise drive low.
+ */
+
+#include "chipset.h"
+#include "common.h"
+#include "extpower.h"
+#include "gpio.h"
+#include "hooks.h"
+#include "host_command.h"
+
+int extpower_is_present(void)
+{
+ return gpio_get_level(GPIO_AC_PRESENT);
+}
+
+/**
+ * Deferred function to handle external power change
+ */
+static void extpower_deferred(void)
+{
+ hook_notify(HOOK_AC_CHANGE);
+
+ /* Forward notification to host */
+ if (extpower_is_present())
+ host_set_single_event(EC_HOST_EVENT_AC_CONNECTED);
+ else
+ host_set_single_event(EC_HOST_EVENT_AC_DISCONNECTED);
+}
+DECLARE_DEFERRED(extpower_deferred);
+
+static void extpower_buffer_to_pch(void)
+{
+ if (chipset_in_state(CHIPSET_STATE_HARD_OFF)) {
+ /* Drive low in G3 state */
+ gpio_set_level(GPIO_PCH_ACOK, 0);
+ } else {
+ /* Buffer from extpower in S5+ (where 3.3DSW enabled) */
+ gpio_set_level(GPIO_PCH_ACOK, extpower_is_present());
+ }
+}
+
+void extpower_interrupt(enum gpio_signal signal)
+{
+ extpower_buffer_to_pch();
+
+ /* Trigger deferred notification of external power change */
+ hook_call_deferred(extpower_deferred, 0);
+}
+
+static void extpower_init(void)
+{
+ extpower_buffer_to_pch();
+
+ /* Enable interrupts, now that we've initialized */
+ gpio_enable_interrupt(GPIO_AC_PRESENT);
+}
+DECLARE_HOOK(HOOK_INIT, extpower_init, HOOK_PRIO_DEFAULT);
diff --git a/board/samus/panel.c b/board/samus/panel.c
index 5704179d5d..9b62f0e2c9 100644
--- a/board/samus/panel.c
+++ b/board/samus/panel.c
@@ -61,26 +61,14 @@ DECLARE_HOST_COMMAND(EC_CMD_SWITCH_ENABLE_BKLIGHT,
switch_command_enable_backlight,
EC_VER_MASK(0));
-/**
- * Hook to turn backlight PWM mode on if it turns off.
- */
-static void backlight_pwm_mode_hook(void)
+void backlight_interrupt(enum gpio_signal signal)
{
- int reg;
-
- /* Only check if the system is powered. */
- if (!chipset_in_state(CHIPSET_STATE_ON))
- return;
-
- /* Read current command reg to see if it is on. */
- i2c_read8(I2C_PORT_BACKLIGHT, I2C_ADDR_BACKLIGHT,
- LP8555_REG_COMMAND, &reg);
-
- /* Turn it on if needed. */
- if (!(reg & LP8555_REG_COMMAND_ON))
- lp8555_enable_pwm_mode();
+ /*
+ * PCH indicates it is turning on backlight so we should
+ * attempt to put the backlight controller into PWM mode.
+ */
+ lp8555_enable_pwm_mode();
}
-DECLARE_HOOK(HOOK_SECOND, backlight_pwm_mode_hook, HOOK_PRIO_LAST);
/**
* Update backlight state.
@@ -100,6 +88,7 @@ DECLARE_HOOK(HOOK_LID_CHANGE, update_backlight, HOOK_PRIO_DEFAULT);
*/
static void backlight_init(void)
{
+ gpio_enable_interrupt(GPIO_PCH_BL_EN);
update_backlight();
}
DECLARE_HOOK(HOOK_INIT, backlight_init, HOOK_PRIO_DEFAULT);
diff --git a/board/samus/power_sequence.c b/board/samus/power_sequence.c
index 2dd2ab50da..f6774f2fdd 100644
--- a/board/samus/power_sequence.c
+++ b/board/samus/power_sequence.c
@@ -138,6 +138,7 @@ enum x86_state x86_chipset_init(void)
gpio_set_level(GPIO_PP5000_USB_EN, 0);
gpio_set_level(GPIO_PP5000_EN, 0);
gpio_set_level(GPIO_PCH_DPWROK, 0);
+ gpio_set_level(GPIO_PP3300_DSW_EN, 0);
wireless_enable(0);
}
}
@@ -191,6 +192,9 @@ enum x86_state x86_handle_state(enum x86_state state)
break;
case X86_G3S5:
+ /* Enable 3.3V DSW */
+ gpio_set_level(GPIO_PP3300_DSW_EN, 1);
+
/*
* Wait 10ms after +3VALW good, since that powers VccDSW and
* VccSUS.
@@ -211,7 +215,7 @@ enum x86_state x86_handle_state(enum x86_state state)
}
}
- /* Turn on 3.3V DSW rail. */
+ /* Turn on 3.3V DSW gated rail for core regulator */
gpio_set_level(GPIO_PP3300_DSW_GATED_EN, 1);
/* Assert DPWROK */
@@ -361,6 +365,8 @@ enum x86_state x86_handle_state(enum x86_state state)
gpio_set_level(GPIO_PP1050_EN, 0);
gpio_set_level(GPIO_PP3300_DSW_GATED_EN, 0);
gpio_set_level(GPIO_PP5000_EN, 0);
+ /* Disable 3.3V DSW */
+ gpio_set_level(GPIO_PP3300_DSW_EN, 0);
return X86_G3;
}