peppy: Enable power limiting for thermal control

Limit power to 12W at 73C and remove limit at 68C.

To have the CPU consume maximum power it is necessary to stress
both the CPU and the GPU.  Bastion (chrome.supergiantgames.com)
and/or webglsamples.googlecode.com can be useful for this.

Testing this properly requires a script to report the running
average power readings.  The watch_power.sh script is attached
to this issue in the partner tracker.

1) Run watch_power.sh continuously:
localhost ~ # watch -n 0 bash -e /tmp/watch_power.sh
2) Start Bastion (or other stress apps).  The power draw should
be close to 15W if under enough load.
3) Watch until temperature climbs above 73C and is caught by
the thermal zone 10 second poll, this can be sped up by blocking
or removing the fan.
4) The ACPI thermal zone states should change to reflect that
active[2] is now enabled and power consumption should drop to 12W.
5) Stop the stress apps and wait until the CPU cools off again,
enable the fan again if it was removed.
6) The ACPI thermal zone state should switch back to active[3].

Change-Id: Ie6714a8543d4f06edf8513086fc9c968273bdb23
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60545
Reviewed-on: http://review.coreboot.org/4335
Tested-by: build bot (Jenkins)
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
This commit is contained in:
Duncan Laurie 2013-06-28 15:59:19 -07:00 committed by Alexandru Gagniuc
parent 10a070b447
commit ddf68901f7
3 changed files with 21 additions and 17 deletions

View File

@ -126,12 +126,18 @@ Scope (\_TZ)
} }
Method (_ON) { Method (_ON) {
Store (0, \FLVL) Store (0, \FLVL)
\_SB.PCI0.MCHC.STND ()
/* Enable Power Limit */
\_SB.PCI0.MCHC.CTLE (\F0PW)
Notify (\_TZ.THRM, 0x81) Notify (\_TZ.THRM, 0x81)
} }
Method (_OFF) { Method (_OFF) {
Store (1, \FLVL) Store (1, \FLVL)
\_SB.PCI0.MCHC.STDN ()
/* Disable Power Limit */
\_SB.PCI0.MCHC.CTLD ()
Notify (\_TZ.THRM, 0x81) Notify (\_TZ.THRM, 0x81)
} }
} }

View File

@ -44,13 +44,16 @@ unsigned long acpi_create_slic(unsigned long current);
static void acpi_update_thermal_table(global_nvs_t *gnvs) static void acpi_update_thermal_table(global_nvs_t *gnvs)
{ {
gnvs->tmps = CTDP_SENSOR_ID; gnvs->tmps = CTL_TDP_SENSOR_ID;
gnvs->f1of = CTDP_NOMINAL_THRESHOLD_OFF; /* Normal TDP */
gnvs->f1on = CTDP_NOMINAL_THRESHOLD_ON; gnvs->f1of = 0;
gnvs->f1on = 0;
gnvs->f0of = CTDP_DOWN_THRESHOLD_OFF; /* Limited TDP */
gnvs->f0on = CTDP_DOWN_THRESHOLD_ON; gnvs->f0of = CTL_TDP_THRESHOLD_OFF;
gnvs->f0on = CTL_TDP_THRESHOLD_ON;
gnvs->f0pw = CTL_TDP_POWER_LIMIT;
gnvs->tcrt = CRITICAL_TEMPERATURE; gnvs->tcrt = CRITICAL_TEMPERATURE;
gnvs->tpsv = PASSIVE_TEMPERATURE; gnvs->tpsv = PASSIVE_TEMPERATURE;

View File

@ -20,16 +20,11 @@
#ifndef THERMAL_H #ifndef THERMAL_H
#define THERMAL_H #define THERMAL_H
/* Config TDP Sensor ID */ /* Control TDP Settings */
#define CTDP_SENSOR_ID 1 /* PECI */ #define CTL_TDP_SENSOR_ID 1 /* PECI */
#define CTL_TDP_POWER_LIMIT 12 /* 12W */
/* Config TDP Nominal */ #define CTL_TDP_THRESHOLD_OFF 68 /* Normal at 68C */
#define CTDP_NOMINAL_THRESHOLD_OFF 0 #define CTL_TDP_THRESHOLD_ON 73 /* Limited at 73C */
#define CTDP_NOMINAL_THRESHOLD_ON 0
/* Config TDP Down */
#define CTDP_DOWN_THRESHOLD_OFF 80
#define CTDP_DOWN_THRESHOLD_ON 90
/* Temperature which OS will shutdown at */ /* Temperature which OS will shutdown at */
#define CRITICAL_TEMPERATURE 104 #define CRITICAL_TEMPERATURE 104