From 5fcfece7568f55b205f095aaa310e4ea95054bad Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Wed, 31 Jul 2013 15:35:55 -0700 Subject: falco: Enable EC controlled throttling When the EC requests the host to throttle (for charging or thermal related reasons) the package power consumption will be limited. Right now this is set at 12W but that is somewhat arbitrary and may need tuning. 1) define the THRT method in \_TZ scope for EC to call 2) enable SCI events for throttle start and stop 3) define the power limit at 12W and set it in NVS 1) Enable CONFIG_ACPI_DEBUG=y in the kernel 2) Enable the Debug object event in acpi module acpi.debug_layer=0x7f acpi.debug_level=0x2f 3) Using EC console generate host event for throttle start > hostevent set 0x20000 4) Check dmesg for throttle start events ACPI: Execute Method [\_SB_.PCI0.LPCB.EC0_._Q12] (Node ffff8801002c5988) [ACPI Debug] String [0x12] "EC: THROTTLE START" [ACPI Debug] String [0x10] "Enable PL1 Limit" 5) Using EC console generate host event for throttle stop > hostevent set 0x40000 6) Check dmesg for throttle stop events ACPI: Execute Method [\_SB_.PCI0.LPCB.EC0_._Q13] (Node ffff8801002c59b0) [ACPI Debug] String [0x11] "EC: THROTTLE STOP" [ACPI Debug] String [0x11] "Disable PL1 Limit" Change-Id: I39b53a5e8abc2892846bcd214a333fe204c6da9b Signed-off-by: Duncan Laurie Reviewed-on: https://gerrit.chromium.org/gerrit/63989 Reviewed-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/4416 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/mainboard/google/falco/acpi/thermal.asl | 14 ++++++++++++++ src/mainboard/google/falco/acpi_tables.c | 1 + src/mainboard/google/falco/ec.h | 2 ++ src/mainboard/google/falco/thermal.h | 3 +++ 4 files changed, 20 insertions(+) (limited to 'src/mainboard') diff --git a/src/mainboard/google/falco/acpi/thermal.asl b/src/mainboard/google/falco/acpi/thermal.asl index adbc9ec4fb..f9173b78c0 100644 --- a/src/mainboard/google/falco/acpi/thermal.asl +++ b/src/mainboard/google/falco/acpi/thermal.asl @@ -21,6 +21,20 @@ Scope (\_TZ) { + // Handler for throttle requests on this platform + // 0 = Stop throttling + // 1 = Start throttling + Method (THRT, 1, Serialized) + { + If (LEqual (Arg0, 0)) { + /* Disable Power Limit */ + \_SB.PCI0.MCHC.CTLD () + } Else { + /* Enable Power Limit */ + \_SB.PCI0.MCHC.CTLE (\F0PW) + } + } + ThermalZone (THRM) { Name (_TC1, 0x02) diff --git a/src/mainboard/google/falco/acpi_tables.c b/src/mainboard/google/falco/acpi_tables.c index 34c4407628..ba084a11d9 100644 --- a/src/mainboard/google/falco/acpi_tables.c +++ b/src/mainboard/google/falco/acpi_tables.c @@ -48,6 +48,7 @@ static void acpi_update_thermal_table(global_nvs_t *gnvs) gnvs->tcrt = CRITICAL_TEMPERATURE; gnvs->tpsv = PASSIVE_TEMPERATURE; gnvs->tmax = MAX_TEMPERATURE; + gnvs->f0pw = EC_THROTTLE_POWER_LIMIT; gnvs->flvl = 1; } diff --git a/src/mainboard/google/falco/ec.h b/src/mainboard/google/falco/ec.h index 11d2453837..c61d3da233 100644 --- a/src/mainboard/google/falco/ec.h +++ b/src/mainboard/google/falco/ec.h @@ -35,6 +35,8 @@ EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY) |\ EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_THRESHOLD) |\ EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_OVERLOAD) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_THROTTLE_START) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_THROTTLE_STOP) |\ EC_HOST_EVENT_MASK(EC_HOST_EVENT_USB_CHARGER)) #define MAINBOARD_EC_SMI_EVENTS \ diff --git a/src/mainboard/google/falco/thermal.h b/src/mainboard/google/falco/thermal.h index cfda67d66c..9bd6ee64ce 100644 --- a/src/mainboard/google/falco/thermal.h +++ b/src/mainboard/google/falco/thermal.h @@ -22,6 +22,9 @@ #define TEMPERATURE_SENSOR_ID 0 /* PECI */ +/* Power level to set when EC requests throttle */ +#define EC_THROTTLE_POWER_LIMIT 12 /* 12W */ + /* Temperature which OS will shutdown at */ #define CRITICAL_TEMPERATURE 104 -- cgit v1.2.3