Commit Graph

3 Commits

Author SHA1 Message Date
Vincent Palatin
b61bfc8feb Add more build conditions on x86-only code.
ACPI and thermal throttling are used only by x86 platforms.
Modify the conditional build to avoid building them where they are not
used.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=none
TEST=make buildall
check the flash size on Ryu and see we are saving about 200 bytes with
this changes.

Change-Id: Ie5e1603fb3bea95eaa5cb1e6cb19f4ddb0e235e8
Reviewed-on: https://chromium-review.googlesource.com/210056
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-08-10 18:39:24 +00:00
Randall Spangler
251a80add3 throttle_ap.c should only be compiled if there's a chipset/power task
It doesn't need to be compiled if there would be nothing for it to talk to.

BUG=chrome-os-partner:20739
BRANCH=none
TEST=build all platforms, pass unit tests
     comment out chipset task in Rambi ec.tasklist; code still compiles

Change-Id: I004364b8c1fdf02c420162b5ad2843068a26b452
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174302
2013-10-23 23:53:23 +00:00
Bill Richardson
793b52f327 Handle multiple independent sources and types of CPU throttling
Depending on the system, the AP can be throttled in at least two different
ways - politely, where it's just asked to slow down a bit, and forcefully
using a hardware signal (like PROCHOT). In addition, the request for
throttling can come from multiple tasks.

This CL provides a single interface, specifying both the type of throttling
desired and the source of the throttling request.

For each type, any source can can start throttling, but all sources must
agree before it stops. The changes are protected by a mutex, so that
requests from multiple tasks don't interfere with each other.

BUG=chrome-os-partner:20739,chromium:287985,chromium:287983
BRANCH=ToT
TEST=manual

Build-time test:

  cd src/platform/ec
  make BOARD=falco runtests

Run-time test: Lower the temp thresholds, turn the fan off, and watch the
throttling turn off and on as things heat up. For example, on the EC
console:

  > temps
    PECI                : 339 K = 66 C
    ECInternal          : 324 K = 51 C
    G781Internal        : 328 K = 55 C
    G781External        : 327 K = 54 C
  > thermalset 0 341 343
  sensor  warn  high  halt   fan_off fan_max   name
    0      341   343    383    333     363     PECI
    1        0     0      0      0       0     ECInternal
    2        0     0      0      0       0     G781Internal
    3        0     0      0      0       0     G781External
  >
  > temps
    PECI                : 339 K = 66 C
    ECInternal          : 324 K = 51 C
    G781Internal        : 328 K = 55 C
    G781External        : 327 K = 54 C
  >
  > fanduty 0
  Setting fan duty cycle to 0%
  >
  > apthrottle
  AP throttling type 0 is off (0x00000000)
  AP throttling type 1 is off (0x00000000)
  >
  [430.152000 thermal WARN]
  [430.152233 event set 0x00020000]
  [430.152497 event clear 0x00020000]
  [430.152714 ACPI query = 18]
  [430.152444 sci 0x00020000]
  [430.153051 set AP throttling type 0 to on (0x00000001)]
  > gpioget CPU_PROCHOT
    0  CPU_PROCHOT
  >
  [436.153742 thermal HIGH]
  [436.153979 set AP throttling type 1 to on (0x00000001)]
  > gpioget CPU_PROCHOT
    1* CPU_PROCHOT
  > [441.155319 thermal no longer high]
  [441.155587 set AP throttling type 1 to off (0x00000000)]
  [442.155604 thermal HIGH]
  [442.155841 set AP throttling type 1 to on (0x00000001)]
  [446.156623 thermal no longer high]
  [446.156890 set AP throttling type 1 to off (0x00000000)]
  temps
    PECI                : 343 K = 70 C
    ECInternal          : 324 K = 51 C
    G781Internal        : 328 K = 55 C
    G781External        : 327 K = 54 C
  >
  [447.156827 thermal HIGH]
  [447.157064 set AP throttling type 1 to on (0x00000001)]
  apthrottle
  AP throttling type 0 is on (0x00000001)
  AP throttling type 1 is on (0x00000001)
  > gpioget CPU_PROCHOT
    1  CPU_PROCHOT
  >

Now turn the fan back on:

  > fanauto
  >
  [456.159306 thermal no longer high]
  [456.159574 set AP throttling type 1 to off (0x00000000)]
  > apthrottle
  AP throttling type 0 is on (0x00000001)
  AP throttling type 1 is off (0x00000000)
  > temps
    PECI                : 341 K = 68 C
    ECInternal          : 324 K = 51 C
    G781Internal        : 328 K = 55 C
    G781External        : 327 K = 54 C
  >
  [473.163905 thermal no longer warn]
  [473.164168 event set 0x00040000]
  [473.164453 event clear 0x00040000]
  [473.164670 ACPI query = 19]
  [473.164379 sci 0x00040000]
  [473.164987 set AP throttling type 0 to off (0x00000000)]
  temps
    PECI                : 340 K = 67 C
    ECInternal          : 324 K = 51 C
    G781Internal        : 328 K = 55 C
    G781External        : 327 K = 54 C
  >
  > apthrottle
  AP throttling type 0 is off (0x00000000)
  AP throttling type 1 is off (0x00000000)
  >

Change-Id: I9ee1491a637d7766395c71e57483fbd9177ea554
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/168802
2013-09-11 01:49:48 +00:00