summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/throttle_ap.c12
-rw-r--r--include/throttle_ap.h2
-rw-r--r--zephyr/Kconfig29
-rw-r--r--zephyr/Kconfig.powerseq14
-rw-r--r--zephyr/shim/include/config_chip.h10
5 files changed, 53 insertions, 14 deletions
diff --git a/common/throttle_ap.c b/common/throttle_ap.c
index 39223f9829..9319bf89b4 100644
--- a/common/throttle_ap.c
+++ b/common/throttle_ap.c
@@ -86,6 +86,10 @@ void throttle_ap(enum throttle_level level, enum throttle_type type,
void throttle_ap_config_prochot(const struct prochot_cfg *cfg)
{
prochot_cfg = cfg;
+
+ if (IS_ENABLED(CONFIG_THROTTLE_AP_SINGLE_PIN)) {
+ gpio_set_flags(prochot_cfg->gpio_prochot_in, GPIO_INPUT);
+ }
}
__maybe_unused static bool prochot_is_gated_by_c10(int prochot_in)
@@ -142,16 +146,20 @@ static void prochot_input_deferred(void)
if (debounced_prochot_in) {
CPRINTS("External PROCHOT assertion detected");
-#ifdef CONFIG_FANS
+#if defined(CONFIG_FANS) && !defined(CONFIG_THROTTLE_AP_NO_FAN)
dptf_set_fan_duty_target(100);
#endif
} else {
CPRINTS("External PROCHOT condition cleared");
-#ifdef CONFIG_FANS
+#if defined(CONFIG_FANS) && !defined(CONFIG_THROTTLE_AP_NO_FAN)
/* Revert to automatic control of the fan */
dptf_set_fan_duty_target(-1);
#endif
}
+
+ if (prochot_cfg->callback)
+ prochot_cfg->callback(debounced_prochot_in,
+ prochot_cfg->callback_data);
}
DECLARE_DEFERRED(prochot_input_deferred);
diff --git a/include/throttle_ap.h b/include/throttle_ap.h
index 43a5f48e2c..7198078ce2 100644
--- a/include/throttle_ap.h
+++ b/include/throttle_ap.h
@@ -42,6 +42,8 @@ enum throttle_sources {
*/
struct prochot_cfg {
enum gpio_signal gpio_prochot_in;
+ void (*callback)(bool asserted, void *data);
+ void *callback_data;
#ifdef CONFIG_CPU_PROCHOT_GATE_ON_C10
enum gpio_signal gpio_c10_in;
bool c10_active_high;
diff --git a/zephyr/Kconfig b/zephyr/Kconfig
index 4943a73676..c674548753 100644
--- a/zephyr/Kconfig
+++ b/zephyr/Kconfig
@@ -666,12 +666,31 @@ config PLATFORM_EC_SYSTEM_UNLOCKED
config PLATFORM_EC_THROTTLE_AP
bool "CPU throttling"
- depends on PLATFORM_EC_TEMP_SENSOR
help
- Enable throttling the CPU based on the temperature sensors. When they
- detect that the CPU is getting too hot, the CPU is throttled to
- a lower speed. This reduce the CPU's power output and eventually
- results in a lower temperature.
+ Enable throttling the CPU. When triggered this reduces the CPU's
+ power output and eventually results in a lower temperature.
+
+if PLATFORM_EC_THROTTLE_AP
+
+config PLATFORM_EC_THROTTLE_AP_SINGLE_PIN
+ bool "CPU throttling and interrupt detection on a single pin"
+ help
+ Enable detection of throttling interrupts on the same pin used to
+ trigger throttling. The GPIO should be configured as an output by
+ default. throttle_ap_config_prochot will configure the GPIO as
+ an interrupt. Chipset specific functions are responsible for
+ handling any subsequent changes.
+
+config PLATFORM_EC_THROTTLE_AP_NO_FAN
+ bool "No automatic fan control for AP throttling"
+ help
+ Disable automatic fan control when an AP throttling interrupt occurs
+
+config PLATFORM_EC_CONSOLE_CMD_APTHROTTLE
+ bool "Enable apthrottle command to disable throttling state"
+ default n
+
+endif #PLATFORM_EC_THROTTLE_AP
menuconfig PLATFORM_EC_TIMER
bool "Timer module"
diff --git a/zephyr/Kconfig.powerseq b/zephyr/Kconfig.powerseq
index e7c0891ab4..4b438f0bce 100644
--- a/zephyr/Kconfig.powerseq
+++ b/zephyr/Kconfig.powerseq
@@ -24,6 +24,13 @@ config PLATFORM_EC_POWERSEQ_S0IX
option, Intel's low-power idle sleep state, also known as
"modern sleep".
+config PLATFORM_EC_POWERSEQ_CPU_PROCHOT_ACTIVE_LOW
+ bool "The CPU_PROCHOT signal is an active low signal"
+ default y
+ help
+ If CPU_PROCHOT should be treated as active-low, enable this
+ configuration option.
+
config PLATFORM_EC_POWERSEQ_HOST_SLEEP
bool "Track host sleep states"
help
@@ -106,13 +113,6 @@ menuconfig PLATFORM_EC_POWERSEQ_INTEL
if PLATFORM_EC_POWERSEQ_INTEL
-config PLATFORM_EC_POWERSEQ_CPU_PROCHOT_ACTIVE_LOW
- bool "The CPU_PROCHOT signal is an active low signal"
- default y
- help
- If CPU_PROCHOT should be treated as active-low, enable this
- configuration option.
-
config PLATFORM_EC_POWERSEQ_CPU_PROCHOT_GATE_ON_C10
bool "Gate PROCHOT detection based on the AP C10 state"
default y if PLATFORM_EC_POWERSEQ_CPU_PROCHOT_ACTIVE_LOW
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 1fb4fdaf85..5ab7fb05d7 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -137,6 +137,16 @@
#define CONFIG_THROTTLE_AP
#endif
+#undef CONFIG_THROTTLE_AP_SINGLE_PIN
+#ifdef CONFIG_PLATFORM_EC_THROTTLE_AP_SINGLE_PIN
+#define CONFIG_THROTTLE_AP_SINGLE_PIN
+#endif
+
+#undef CONFIG_THROTTLE_AP_NO_FAN
+#ifdef CONFIG_PLATFORM_EC_THROTTLE_AP_NO_FAN
+#define CONFIG_THROTTLE_AP_NO_FAN
+#endif
+
#undef CONFIG_CHIPSET_CAN_THROTTLE
#ifdef CONFIG_PLATFORM_EC_CHIPSET_CAN_THROTTLE
#define CONFIG_CHIPSET_CAN_THROTTLE