summaryrefslogtreecommitdiff
path: root/include/fan.h
Commit message (Collapse)AuthorAgeFilesLines
* jinlon: add dual fan control by ecDevin Lu2020-01-311-0/+2
| | | | | | | | | | | | | | | | This patch allows the ec to manage two fans. Currently common/thermal.c cannot monitor more than 1 fan at the same time. This CL implements a board-specific thermal policy with multiple fans. BUG=b:141259174 BRANCH=hatch TEST=thermal team verified thermal policy is expected. Change-Id: I6ababcb0795408e8062b7605bc749e23b8bde45a Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1936077 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* ec-fans: Make fans configuration const by default.Andrew McRae2019-11-021-0/+4
| | | | | | | | | | | | | | | | It was pointed out to me that the fans config list was non-const, but there is only 2 boards that require non-const configuration, so by default make it const, but allow an override. BRANCH=none BUG=None TEST=EC compiles, make tests, buildall Change-Id: I3ef8c72f6774e1a76584c47d89287f446199e0f2 Signed-off-by: Andrew McRae <amcrae@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1893025 Reviewed-by: Andrew McRae <amcrae@chromium.org> Tested-by: Andrew McRae <amcrae@chromium.org> Commit-Queue: Andrew McRae <amcrae@chromium.org>
* LICENSE: remove unnecessary (c) after CopyrightTom Hughes2019-06-191-1/+1
| | | | | | | | | | | | | | | | Ran the following command: git grep -l 'Copyright (c)' | \ xargs sed -i 's/Copyright (c)/Copyright/g' BRANCH=none BUG=none TEST=make buildall -j Change-Id: I6cc4a0f7e8b30d5b5f97d53c031c299f3e164ca7 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1663262 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* common: replace 1 << digits, with BIT(digits)Gwendal Grignou2019-03-261-2/+2
| | | | | | | | | | | | | | | | Requested for linux integration, use BIT instead of 1 << First step replace bit operation with operand containing only digits. Fix an error in motion_lid try to set bit 31 of a signed integer. BUG=None BRANCH=None TEST=compile Change-Id: Ie843611f2f68e241f0f40d4067f7ade726951d29 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518659 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Fan: Allow fan count to be set dynamicallyDaisuke Nojiri2018-11-191-0/+4
| | | | | | | | | | | | | | | | | | Currently, the fan count is statically set. This patch allows it to be set dynamically so that a single binary can support devices with a different number of fans (including fan-less). Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:116588924 BRANCH=none TEST=Boot Fizz with OEM=8. Verify fan spins with OEM=1. Change-Id: I77fc4e07ce2a1be2e288df145857a79c0003542f Reviewed-on: https://chromium-review.googlesource.com/1308257 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* NPCX/fan: Update rpm_actual in duty modeTino Liu2018-07-041-1/+17
| | | | | | | | | | | | | | | | | For npcx, this patch makes rpm_actual updated at every hook_tick when fan is in duty mode (in addition to rpm mode). It also sets fan_status to LOCKED if rpm_actual > 0. BUG=b:110451144 BRANCH=master TEST=After `fanduty <percent>`, `faninfo` can see actual rpm being updated. Verify that `fanduty` doesn't impact `fanset`. Change-Id: I3685ca2b8e51d5dd12974c83656c88fecae1932c Signed-off-by: Tino Liu <tino.liu@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/1111477 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Vincent Wang <vwang@chromium.org>
* fan: Allow board to configure fans at run timeDaisuke Nojiri2018-03-061-7/+17
| | | | | | | | | | | | | | | This patch splits struct fan_t into two parts: base configuration and RPM configuration. RPMs are expected to be different from model to model while a base configuration is most likely shared. BUG=b:73720175 BRANCH=none TEST=make buildall Change-Id: Iff17573f110e07e88d097dd848cf91ee98b83176 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/949382 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Samus: Handle fan startup in the EC, not the fan controllerBill Richardson2014-11-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The fans on samus have a recommended minimum duty cycle of 20% while running, but 30% in order to start. We've been using the EC's built-in fan controller for the start requirement, but it has a minimum fast-start duty cycle of 50%. It turns out that that speed is noticeably noisy. This change handles the startup with logic in the EC instead, so that the fan only tries to spin at 30% initially (or if it drops too much below the minimum turning speed). BUG=chrome-os-partner:33429 BRANCH=ToT,samus TEST=make buildall -j Boot the system, let it idle with the browser windows closed, the browse a bit, then idle. Listen for changes to the fans. Before, I could hear the fans kick in and out as the AP load changed. Now it's much quieter. Change-Id: Id35215520c064eb6843686ec8bb5f3618dac6cf6 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/227658 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* samus: change fan RPM values, enable fast-startBill Richardson2014-10-221-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Updating the fan speeds according to the manufacturer's specs. The fan vendor recommends that the minimum fan speed be a 20% duty cycle. Since the built-in fan controller has a tach-based feedback loop, I'm using the RPM value instead of the duty cycle (20% is 2286 RPM, according to the vendor). The vendor also wants a 30% duty cycle to start turning, but the built-in fan controller provides support for fast-start too. The controller's minimum fast-start duty cycle is 50%, but it also has a programmable number of revolutions that it will wait before backing off. Holding my ear down close to the fans while they start and stop, it seems that the minimum 2 revolution start period is sufficient and provides the least noise. Of course, since I've never had any problems starting the fans directly at 1000 RPM this noise is a little more noticeable than that. It's quite possible that the built-in controller is smart enough to make 1000 RPM work by bumping the duty cycle up until the fans turn even if the fans don't like it. BUG=chrome-os-partner:32892 BRANCH=ToT,samus TEST=manual Listen closely and run the EC console "faninfo" command to see the fans start and stop as the system boots and idles. Change-Id: I47c9e7cef3f9f4bd815a13032fe10234decd62ed Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/224830 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Provide multiple fan support within the EC itselfBill Richardson2013-11-021-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds explicit "int fan" args to the exported functions from common/fan.c: fan_set_percent_needed() and fan_percent_to_rpm(). Within that file, multiple fans are handled independently. This is not complete, though. Host commands and sysjump support still only handle a single fan, so at the moment multiple fans are treated identically in those cases. BUG=chrome-os-partner:23530 BRANCH=none TEST=manual All boards build, "make runtests" passes. On a multi-fan system, the EC command "faninfo" displays multiple results: > faninfo Fan 0 Actual: 0 rpm Fan 0 Target: 0 rpm Fan 0 Duty: 0% Fan 0 Status: 0 (not spinning) Fan 0 Mode: rpm Fan 0 Auto: yes Fan 0 Enable: yes Fan 1 Actual: 0 rpm Fan 1 Target: 0 rpm Fan 1 Duty: 0% Fan 1 Status: 0 (not spinning) Fan 1 Mode: rpm Fan 1 Auto: no Fan 1 Enable: no > and the "fanduty", "fanset", and "fanauto" all require the fan number as the first arg: > fanduty 0 30 Setting fan 0 duty cycle to 30% > fanset 1 2000 Setting fan 1 rpm target to 2000 > fanauto 0 > fanauto 1 On single-fan systems, there is no visible change. Change-Id: Idb8b818122e157960d56779b2a86e5ba433bee1b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/175368 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Separate fan_t from pwm_tBill Richardson2013-10-301-2/+22
| | | | | | | | | | | | | | | | There is a logical difference between PWM controls for things like backlights and fan controls for actual fans. This change separates them into two different data structures, for better abstraction. BUG=chrome-os-partner:23530 BRANCH=none TEST=manual make runtests, make all boards, test on Link and Falco. Change-Id: Ib63f2d1518fcc2ee367f81bf5d803360c1aa5c76 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/175151
* Add more descriptive comments to include/fan.hBill Richardson2013-10-301-1/+13
| | | | | | | | | | | | Just adding some comments. BUG=chrome-os-partner:23530 BRANCH=none TEST=none Change-Id: Ib3955e9d97ad8aa642e6fe298c17e34d2c66fb1c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/175139
* Separate common fan behavior from implementationBill Richardson2013-10-301-2/+30
| | | | | | | | | | | | | | | | | | This looks like a lot, but it's really just moving the non-board-specific stuff from chip/lm4/fan.c into common/fan.c, updating the appropriate headers, and renaming functions to better match the new location. This is entirely code refactoring and renaming. No new functionality. BUG=chrome-os-partner:23530 BRANCH=none TEST=manual make runtests, build all platforms, build and test on Link. Change-Id: I7dc03d6732bad83cf838a86600b42a7cff5aa7aa Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/175012
* cleanup: remove obsolete declaration from headerBill Richardson2013-10-231-5/+0
| | | | | | | | | | | | | | | | | When we cleaned up the alternate function GPIO initialization, we left a declaration for configure_fan_gpios() in fan.h. That function doesn't exist anywhere, so there's no point in declaring it. BUG=chrome-os-partner:18343 BRANCH=none TEST=manual Build everything. Nothing fails. Change-Id: I3d1fe1ff62e523aa7c87d57c5e838b01a0c6e899 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/174334 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Completely new thermal/fan implementationBill Richardson2013-08-231-0/+34
Problems with existing thermal control loop: * Not multi-board friendly. thermal.c only supports Link and needs refactoring. Temp thresholds and fan speeds are hard-coded. * Only the PECI temp is used to determine the fan speed. Other temp sensors are ignored. * Has confusing data structures. Values in the CPU temp thresholds array mix ACPI thresholds with fan step values. With this change, the thermal task monitors all temp sensors in order to perform two completely independent functions: Function one: Determine if the host needs to be throttled by or informed of any thermal events. For thermal events, each temp sensor will have three threshold levels. TEMP_HOST_WARN * When any sensor goes above this level, host_throttle_cpu(1) will be called to ask the CPU to slow itself down. * When all sensors drop below this level, host_throttle_cpu(0) will be called. * Exactly AT this level, nothing happens (this provides hysteresis). TEMP_HOST_HIGH * When any sensor goes above this level, chipset_throttle_cpu(1) will be called to slow the CPU down whether it wants to or not. * When all sensors drop below this level, chipset_throttle_cpu(0) will be called. * Exactly AT this level, nothing happens (this provides hysteresis). TEMP_HOST_SHUTDOWN * When any sensor is above this level, chipset_force_shutdown() will be called to halt the CPU. * Nothing turns the CPU back on again - the user just has to wait for things to cool off. Pressing the power button too soon will just trigger shutdown again as soon as the EC can read the host temp. Function two: Determine the amount of fan cooling needed For fan cooling, each temp sensor will have two levels. TEMP_FAN_OFF * At or below this temperature, no active cooling is needed. TEMP_FAN_MAX * At or above this temperature, active cooling should be running at maximum. The highest level of all temp sensors will be used to request the amount of active cooling needed. The function pwm_fan_percent_to_rpm() is invoked to convert the amount of cooling to the target fan RPM. The default pwm_fan_percent_to_rpm() function converts smoothly between the configured CONFIG_PWM_FAN_RPM_MIN and CONFIG_PWM_FAN_RPM_MAX for percentages between 1 and 100. 0% means "off". The default function probably provide the smoothest and quietest behavior, but individual boards can provide their own pwm_fan_percent_to_rpm() to implement whatever curves, hysteresis, feedback, or other hackery they wish. BUG=chrome-os-partner:20805 BRANCH=none TEST=manual Compile-time test with make BOARD=falco runtests On the EC console, the existing fan commands should work correctly: faninfo - display the fan state fanduty NUM - force the fan PWM to the specified percentage (0-100) fanset RPM - force the fan to the specified RPM fanset NUM% - force the fan to the specified percentage (0-100) between its configured minimum and maximum speeds from board.h (CONFIG_PWM_FAN_RPM_MIN and CONFIG_PWM_FAN_RPM_MAX) fanauto - let the EC control the fan automatically You can test the default pwm_fan_percent_to_rpm() with fanset 1% faninfo The fan should be turning at CONFIG_PWM_FAN_RPM_MIN. Let the EC control it automatically again with fanauto Also on the EC console, the thermal settings can be examined or changed: > temps PECI : 327 K = 54 C ECInternal : 320 K = 47 C G781Internal : 319 K = 46 C G781External : 318 K = 45 C > > thermalget sensor warn high shutdown fan_off fan_max name 0 373 387 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 > > help thermalset Usage: thermalset sensor warn [high [shutdown [fan_off [fan_max]]]] set thermal parameters (-1 to skip) > > thermalset 2 -1 -1 999 sensor warn high shutdown fan_off fan_max name 0 373 387 383 333 363 PECI 1 0 0 0 0 0 ECInternal 2 0 0 999 0 0 G781Internal 3 0 0 0 0 0 G781External > From the host, ectool can be used to get and set these parameters with nearly identical commands: ectool thermalget ectool thermalset 2 -1 -1 999 Change-Id: Idb27977278f766826045fb7d41929953ec6b1cca Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/66688 Reviewed-by: Randall Spangler <rspangler@chromium.org>