summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2015-04-09 16:15:45 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-04-11 00:35:59 +0000
commit68f65494c7f1d379b6b1a02a026f56a24753444f (patch)
treefe883ab620c5c49c783c0d04a816704fc88b442b
parent15391709fd964e23d91deaf3db832a9d83da1ea5 (diff)
downloadchrome-ec-68f65494c7f1d379b6b1a02a026f56a24753444f.tar.gz
ryu: rework the workaround for the EN_PP3300 issue
When shutting down the MAX77620 PMIC by asserting its SHDN pin, the EN_PP3300 output of the PMIC (GPIO3) is not driving low keeping the PP3300 rail up. Workaround that issue by removing the pull-up on EN_PP3300 when we assert SHDN. Revert the previous CL 263958 aka "ryu: workaround MAX77620 shutdown issue", in order to use a better workaround which ensures that the power rails sequencing at startup Detect the PP1800 rail going up and down by reading the HPD_IN gpio state (which has a pull-up tied to PP1800), then enable/disable EN_PP3300 in sequence. The code using an interrupt on HPD_IN is enabled only on P5, and as a downside, it is killing the base charging on those boards. Indeed HPD_IN(C1) is hijacking the EXTINT1 which used to be connected to the LID_OPEN (E1) GPIO used for the base detection. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:38689 TEST=on both P4 and P5 boards, do various power cycling sequences of the AP using the "apshutdown" and "powerbtn" commands. Change-Id: Icad6e9ae6a08d76cbfd19f97dd7c129bf43037d8 Reviewed-on: https://chromium-review.googlesource.com/265186 Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r--board/ryu/board.c20
-rw-r--r--board/ryu/board.h3
-rw-r--r--board/ryu/gpio.inc12
-rw-r--r--power/tegra.c10
4 files changed, 33 insertions, 12 deletions
diff --git a/board/ryu/board.c b/board/ryu/board.c
index f6da9c2653..976c546de2 100644
--- a/board/ryu/board.c
+++ b/board/ryu/board.c
@@ -307,6 +307,16 @@ static void board_init(void)
/* Enable interrupts on VBUS transitions. */
gpio_enable_interrupt(GPIO_CHGR_ACOK);
+
+ /*
+ * TODO(crosbug.com/p/38689) Workaround for PMIC issue on P5.
+ * remove when P5 are de-commissioned.
+ * We are re-using EXTINT1 for the new power sequencing workaround
+ * this is killing the base closing detection on P5
+ * we won't charge it.
+ */
+ if (board_get_version() == 5)
+ gpio_enable_interrupt(GPIO_HPD_IN);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -317,6 +327,16 @@ const struct power_signal_info power_signal_list[] = {
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
+/*
+ * TODO(crosbug.com/p/38689) Workaround for MAX77620 PMIC EN_PP3300 issue.
+ * remove when P5 are de-commissioned.
+ */
+void pp1800_on_off_evt(enum gpio_signal signal)
+{
+ int level = gpio_get_level(signal);
+ gpio_set_level(GPIO_EN_PP3300_RSVD, level);
+}
+
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Vbus sensing. Converted to mV, /10 voltage divider. */
diff --git a/board/ryu/board.h b/board/ryu/board.h
index 285c598cc1..fa5f6eb888 100644
--- a/board/ryu/board.h
+++ b/board/ryu/board.h
@@ -193,6 +193,9 @@ int board_discharge_on_ac(int enable);
/* Set the charge current limit. */
void board_set_charge_limit(int charge_ma);
+/* PP1800 transition GPIO interrupt handler */
+void pp1800_on_off_evt(enum gpio_signal signal);
+
#endif /* !__ASSEMBLER__ */
#endif /* __BOARD_H */
diff --git a/board/ryu/gpio.inc b/board/ryu/gpio.inc
index 816e9e3e68..890c64390d 100644
--- a/board/ryu/gpio.inc
+++ b/board/ryu/gpio.inc
@@ -13,6 +13,13 @@ GPIO_INT(LID_OPEN, E, 1, GPIO_INT_BOTH | GPIO_PULL_UP, lid_inter
GPIO_INT(CHARGE_DONE, E, 6, GPIO_INT_BOTH, inductive_charging_interrupt)
GPIO_INT(AP_IN_SUSPEND, F, 9, GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(AP_HOLD, E, 3, GPIO_INT_BOTH, power_signal_interrupt)
+/*
+ * TODO(crosbug.com/p/38689) Workaround for MAX77620 PMIC PP3300 issue
+ * Put back as GPIO_ODR_HIGH for P6+
+ */
+GPIO_INT(HPD_IN, C, 1, GPIO_INT_BOTH, pp1800_on_off_evt)
+
+/* Interrupt lines not used yet */
GPIO(BC_TEMP_ALERT_L, C, 5, GPIO_INT_FALLING)
GPIO(LB_INT_L, E, 7, GPIO_INT_FALLING | GPIO_PULL_UP)
GPIO(LIGHTBAR_EN_L, E, 8, GPIO_INT_FALLING | GPIO_PULL_UP)
@@ -40,10 +47,11 @@ GPIO(PMIC_PWRON_L, D, 14, GPIO_ODR_HIGH)
GPIO(PMIC_WARM_RESET_L, E, 4, GPIO_ODR_HIGH)
GPIO(EN_PP5000, A, 14, GPIO_OUT_LOW) /* Proto 5+ */
/*
- * We are missing an external pull-up for EN_PP3300. Pull it up here.
+ * We are missing an external pull-up for EN_PP3300.
+ * This GPIO is used to pull it up through an external 100kOhm.
* EN_PP3300 is still controlled by PMIC though.
*/
-GPIO(EN_PP3300_RSVD, E, 13, GPIO_INPUT | GPIO_PULL_UP)
+GPIO(EN_PP3300_RSVD, E, 13, GPIO_OUT_LOW)
/* sensor temp output and PMIC reset input */
GPIO(P5_PMIC_THERM_L, B, 8, GPIO_ODR_HIGH)
/* TODO(crosbug.com/p/38333) remove P4_PMIC_THERM_L */
diff --git a/power/tegra.c b/power/tegra.c
index 2bdba8b5f9..5efd41e61d 100644
--- a/power/tegra.c
+++ b/power/tegra.c
@@ -144,11 +144,6 @@ static void set_ap_reset(int asserted)
*/
static void set_pmic_pwron(int asserted)
{
-#ifdef BOARD_RYU
- /* TODO(crosbug.com/p/38689) Workaround for MAX77620 PMIC issue */
- if (asserted)
- gpio_set_flags(GPIO_EN_PP3300_RSVD, GPIO_INPUT | GPIO_PULL_UP);
-#endif /* BOARD_RYU */
/* Signal is active-low */
gpio_set_level(GPIO_PMIC_PWRON_L, asserted ? 0 : 1);
}
@@ -163,11 +158,6 @@ static void set_pmic_therm(int asserted)
{
/* Signal is active-low */
gpio_set_level(GPIO_PMIC_THERM_L, asserted ? 0 : 1);
-#ifdef BOARD_RYU
- /* TODO(crosbug.com/p/38689) Workaround for MAX77620 PMIC issue */
- if (asserted)
- gpio_set_flags(GPIO_EN_PP3300_RSVD, GPIO_INPUT);
-#endif /* BOARD_RYU */
}
/**