From f39c9fb0466ab5729aeba13ec4a52079d561f03b Mon Sep 17 00:00:00 2001 From: Aseda Aboagye Date: Thu, 7 Jun 2018 18:00:20 -0700 Subject: power: Add CONFIG_* option for PROCHOT polarity. The common x86 chipset code assumed that CPU_PROCHOT was active high, however on some boards it's actually active low. This commit simply adds a CONFIG_* option, CONFIG_CPU_PROCHOT_IS_ACTIVE_LOW, and inverts the places where the signal is used. BUG=b:109882953 BRANCH=poppy TEST=Enable on nocturne; flash, verify that CPU_PROCHOT is not asserted by default. Change-Id: I6d871e4979b79333cf4897d77c995eadbb34fd43 Signed-off-by: Aseda Aboagye Reviewed-on: https://chromium-review.googlesource.com/1092150 Commit-Ready: Aseda Aboagye Tested-by: Aseda Aboagye Reviewed-by: Edward Hill --- power/braswell.c | 7 +++++++ power/intel_x86.c | 7 +++++++ power/stoney.c | 3 +++ 3 files changed, 17 insertions(+) (limited to 'power') diff --git a/power/braswell.c b/power/braswell.c index 0b91040cbc..e04918c055 100644 --- a/power/braswell.c +++ b/power/braswell.c @@ -85,6 +85,9 @@ void chipset_reset(void) void chipset_throttle_cpu(int throttle) { +#ifdef CONFIG_CPU_PROCHOT_ACTIVE_LOW + throttle = !throttle; +#endif /* CONFIG_CPU_PROCHOT_ACTIVE_LOW */ if (chipset_in_state(CHIPSET_STATE_ON)) gpio_set_level(GPIO_CPU_PROCHOT, throttle); } @@ -204,7 +207,11 @@ enum power_state power_handle_state(enum power_state state) * Throttle CPU if necessary. This should only be asserted * when +VCCP is powered (it is by now). */ +#ifdef CONFIG_CPU_PROCHOT_ACTIVE_LOW + gpio_set_level(GPIO_CPU_PROCHOT, !throttle_cpu); +#else gpio_set_level(GPIO_CPU_PROCHOT, throttle_cpu); +#endif /* CONFIG_CPU_PROCHOT_ACTIVE_LOW */ /* Set SYS and CORE PWROK */ gpio_set_level(GPIO_PCH_SYS_PWROK, 1); diff --git a/power/intel_x86.c b/power/intel_x86.c index 7a2601c8ec..4617c91394 100644 --- a/power/intel_x86.c +++ b/power/intel_x86.c @@ -170,6 +170,9 @@ DECLARE_HOOK(HOOK_CHIPSET_RESET, handle_chipset_reset, HOOK_PRIO_FIRST); void chipset_throttle_cpu(int throttle) { +#ifdef CONFIG_CPU_PROCHOT_ACTIVE_LOW + throttle = !throttle; +#endif /* CONFIG_CPU_PROCHOT_ACTIVE_LOW */ if (chipset_in_state(CHIPSET_STATE_ON)) gpio_set_level(GPIO_CPU_PROCHOT, throttle); } @@ -368,7 +371,11 @@ enum power_state common_intel_x86_power_handle_state(enum power_state state) * Throttle CPU if necessary. This should only be asserted * when +VCCP is powered (it is by now). */ +#ifdef CONFIG_CPU_PROCHOT_ACTIVE_LOW + gpio_set_level(GPIO_CPU_PROCHOT, 1); +#else gpio_set_level(GPIO_CPU_PROCHOT, 0); +#endif /* CONFIG_CPU_PROCHOT_ACTIVE_LOW */ return POWER_S0; diff --git a/power/stoney.c b/power/stoney.c index 8ebf2f168b..e1b766ab2e 100644 --- a/power/stoney.c +++ b/power/stoney.c @@ -71,6 +71,9 @@ void chipset_reset(void) void chipset_throttle_cpu(int throttle) { CPRINTS("%s(%d)", __func__, throttle); +#ifdef CONFIG_CPU_PROCHOT_ACTIVE_LOW + throttle = !throttle; +#endif /* CONFIG_CPU_PROCHOT_ACTIVE_LOW */ if (chipset_in_state(CHIPSET_STATE_ON)) gpio_set_level(GPIO_CPU_PROCHOT, throttle); } -- cgit v1.2.1