summaryrefslogtreecommitdiff
path: root/common/fan.c
Commit message (Collapse)AuthorAgeFilesLines
* ish: Trim down the release branchstabilize-wristpin-14469.59.B-ishstabilize-voshyr-14637.B-ishstabilize-quickfix-14695.187.B-ishstabilize-quickfix-14695.124.B-ishstabilize-quickfix-14526.91.B-ishstabilize-14695.85.B-ishstabilize-14695.107.B-ishstabilize-14682.B-ishstabilize-14633.B-ishstabilize-14616.B-ishstabilize-14589.B-ishstabilize-14588.98.B-ishstabilize-14588.14.B-ishstabilize-14588.123.B-ishstabilize-14536.B-ishstabilize-14532.B-ishstabilize-14528.B-ishstabilize-14526.89.B-ishstabilize-14526.84.B-ishstabilize-14526.73.B-ishstabilize-14526.67.B-ishstabilize-14526.57.B-ishstabilize-14498.B-ishstabilize-14496.B-ishstabilize-14477.B-ishstabilize-14469.9.B-ishstabilize-14469.8.B-ishstabilize-14469.58.B-ishstabilize-14469.41.B-ishstabilize-14442.B-ishstabilize-14438.B-ishstabilize-14411.B-ishstabilize-14396.B-ishstabilize-14395.B-ishstabilize-14388.62.B-ishstabilize-14388.61.B-ishstabilize-14388.52.B-ishstabilize-14385.B-ishstabilize-14345.B-ishstabilize-14336.B-ishstabilize-14333.B-ishrelease-R99-14469.B-ishrelease-R98-14388.B-ishrelease-R102-14695.B-ishrelease-R101-14588.B-ishrelease-R100-14526.B-ishfirmware-cherry-14454.B-ishfirmware-brya-14505.B-ishfirmware-brya-14505.71.B-ishfactory-kukui-14374.B-ishfactory-guybrush-14600.B-ishfactory-cherry-14455.B-ishfactory-brya-14517.B-ishJack Rosenthal2021-11-051-622/+0
| | | | | | | | | | | | | | | | | | | | | | In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* fan: fix fanset console commandCaveh Jalali2021-02-221-8/+12
| | | | | | | | | | | | | | | | | | | This fixes how the fanset console command parses its arguments. The original parsing would use the fan number as the RPM/duty cycle percentage when two arguments were given on a single fan system. Two arguments are now always treated as (fan number, RPM/duty cycle). On a single fan system, the fan number may be omitted. Additional arguments are rejected. BRANCH=none BUG=none TEST=verified fanset console command controls fan Change-Id: Ia6094354cbbc99c8bfcdb9dd9f227f75dc34507a Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2689498 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* fan: fix fanduty console commandCaveh Jalali2021-02-221-8/+12
| | | | | | | | | | | | | | | | | | This fixes how the fanduty console command parses its arguments. The original parsing would use the fan number as the duty cycle percentage when two arguments were given on a single fan system. Two arguments are now always treated as (fan number, duty cycle). On a single fan system, the fan number may be omitted. Additional arguments are rejected. BRANCH=none BUG=none TEST=verified fanduty console command controls fan Change-Id: Ib7f0141e698d80957a6ac7b770602dcf049aafbc Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2689497 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* fan: Leave state.rpm = 0 in pwm_fan_init()Edward Hill2020-05-211-3/+0
| | | | | | | | | | | | | | | | | | | With no previous state saved, FAN_STATE_FLAG_ENABLED was 0 but state.rpm was CONFIG_FAN_INIT_SPEED. This caused fan_set_rpm_target() to enable the fan which caused "Fan 0 stalled!" warnings. Instead just leave state.rpm at 0. This matches what pwm_fan_stop() does on shutdown. BUG=b:154938623 BRANCH=none TEST=reboot ap-off, no "stalled" warning Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: Ic5dbc9985c1c1b7453dcca4980585ddaf7e4f4d6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2210831 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* ec fan: Ensure AP is on before starting fan.Andrew McRae2020-02-051-1/+6
| | | | | | | | | | | | | | | | The HOOK_CHIPSET_RESET hook is called both on AP shutdown and startup, so do not start fan unless the AP is being turned on. BRANCH=none BUG=b:146583266 TEST=Verified on puff Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: I2c5ae87245e260718c3fa9a979d0a1c3a0c0dd00 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1977066 Tested-by: Andrew McRae <amcrae@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Andrew McRae <amcrae@chromium.org>
* jinlon: add dual fan control by ecDevin Lu2020-01-311-4/+9
| | | | | | | | | | | | | | | | 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>
* host_command: Change host command return value to enum ec_statusTom Hughes2019-10-021-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the host command handler callback function returns an int, it's easy to accidentally mix up the enum ec_error_list and enum ec_status types. The host commands always expect an enum ec_status type, so we change the return value to be of that explicit type. Compilation will then fail if you accidentally try to return an enum ec_error_list value. Ran the following commands and then manually fixed up a few remaining instances that were not caught: git grep --name-only 'static int .*(struct host_cmd_handler_args \*args)' |\ xargs sed -i 's#static int \(.*\)(struct host_cmd_handler_args \*args)#\ static enum ec_status \1(struct host_cmd_handler_args \*args)##' git grep --name-only 'int .*(struct host_cmd_handler_args \*args)' |\ xargs sed -i 's#int \(.*\)(struct host_cmd_handler_args \*args)#\ enum ec_status \1(struct host_cmd_handler_args \*args)##' BRANCH=none BUG=chromium:1004831 TEST=make buildall -j Cq-Depend: chrome-internal:1872675 Change-Id: Id93df9387ac53d016a1594dba86c6642babbfd1e Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1816865 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* fan: Enable fan on chipset resumeVijay Hiremath2019-08-311-42/+34
| | | | | | | | | | | | | | | Always enable the fan on chipset resume. If the DPTF is enabled, AP will disable/throttle the fan upon booting to S0. BUG=b:139882986 BRANCH=none TEST=Manually tested on intelrvp. fan is able to run in auto mode on chipset resume. Change-Id: I986c983fde550f797b3aaa3e06c6b958535b2769 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1768917 Reviewed-by: Daisuke Nojiri <dnojiri@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>
* hatch: Add support for fan and temperature sensorsScott Collyer2019-01-301-1/+1
| | | | | | | | | | | | | BRANCH=none BUG=b:122251649 TEST=make buildall Change-Id: Ib831eecb7e6df270a266f723e2fc5040b741e72f Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1387592 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Fan: Allow fan count to be set dynamicallyDaisuke Nojiri2018-11-191-25/+67
| | | | | | | | | | | | | | | | | | 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>
* Fan: Fix memory access error in pwm_fan_initDaisuke Nojiri2018-10-191-2/+3
| | | | | | | | | | | | | | | | | This patch fixes memory access error introduced by CL:1169910. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:112293333 BRANCH=none TEST=Verified EC boots on Sona. Change-Id: I81ab6b9235f51f5e101e286d266d28e41bea4b11 Reviewed-on: https://chromium-review.googlesource.com/1285290 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Tino Liu <tino.liu@quanta.corp-partner.google.com>
* Fan: Restore thermal control after sysjumpDaisuke Nojiri2018-08-101-16/+27
| | | | | | | | | | | | | | | | | | | Currently, the fan thermal control is always disabled after sysjump. This patch makes the EC save the previous thermal control state before sysjump and restore it after sysjump. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:112293333 BRANCH=none TEST=Verify fan spins before sysjump, after sysjump, in OS on Akali. Change-Id: I2ffc2444e5995def0f0a9206a6863a4b55ba8bc1 Reviewed-on: https://chromium-review.googlesource.com/1169910 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* fan: Enable fan control on AP startup not on shutdown/suspendDaisuke Nojiri2018-07-171-12/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no need to cool CPU in S3 or S5. We currently don't have fans for a charging system (i.e. a battery or a charger chip). Battery management systems control charge current based on its own temperature readings. Thus, we do not need to keep fans running in S3/S5. Even with a fan for a charging system, it's questionable to run a fan in S3/S5. Under a heated condition, spinning a fan would create more heat as a fan draws current from a battery and the ambient air is hot. With this patch, EC disables fan control when entering S3/S5 (though fan control would be already disabled if DPTF is used). It also makes EC enables fan control when AP starts (for BIOS and OS if DPTF isn't used). Signee-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=Verify fan spins in S0 and stops in S3/S5. Fan is controled by EC in BIOS and by DPTF in OS after warm and cold reboot. Run make run-fan. Change-Id: Idb4610303e65f7fd4d6b24a0dfe511cd629bf6a7 Reviewed-on: https://chromium-review.googlesource.com/1138822 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* fan: Don't enable or disable thermal control on resumeDaisuke Nojiri2018-07-061-5/+4
| | | | | | | | | | | | | | | | | | | We don't need to enable or disable thermal control on the resume path. It should be already enabled by pwm_fan_init on cold boot or by pwm_fan_S3_S5 on warm reboot. If it needs to be disabled, DPTF and host command will do so Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=Verify fan spins as expected on Nami and Fizz. Change-Id: If6e4ecdf328b24cc5ba86dbc3bc2824610fcd340 Reviewed-on: https://chromium-review.googlesource.com/1110485 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* Nami: Set fan speed to CONFIG_FAN_INIT_SPEED on resumeDaisuke Nojiri2018-06-221-1/+3
| | | | | | | | | | | | | | | | | | This patch sets the target RPM to CONFIG_FAN_INIT_SPEED on chipset resume. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:80152440 BRANCH=none TEST=Verify target RPM is set to the value derived from CONFIG_FAN_INIT_SPEED in recovery mode on Akali. Change-Id: Ide0d6b8a0c895479af8afff0ba40a7b502bbbbbf Reviewed-on: https://chromium-review.googlesource.com/1110349 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* fan: Allow board to configure fans at run timeDaisuke Nojiri2018-03-061-43/+43
| | | | | | | | | | | | | | | 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>
* Fizz: Modify thermal tableRyan Zhang2017-11-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Modify thermal table for Fizz reference patches: 627542, 288256, 329359 on off RPM step0 0 step1 16 2 2800 step2 27 18 3200 step3 35 29 3400 step4 43 37 4200 step5 54 45 4800 step6 64 56 5200 step7 97 83 5600 Prochot degree: active when t >= 88C release when t <= 85C Shutdown degree: when t >= 90C BUG=b:67487721, b:64439568 BRANCH=master TEST=fan target speed follows table, make -j buildall pass Change-Id: I3378668a560b8ddc568fe9cbf2703613fad8e4b6 Signed-off-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/729606 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Fizz: enable fanGaggery Tsai2017-10-171-1/+4
| | | | | | | | | | | | | | | | | | | | This patch is to enable fan through PWM4 output and TACH feedback from TA2 GPIOA6, and move EC_PLATFORM_RST to GPIO45. BUG=b:64915426 BRANCH=None TEST=emerge-fizz chromeos-ec and use fanduty and faninfo from EC console to control and check fan status. Probed oscilloscope on PWM output and checked the duty as expected. Made sure the fan was stopped when DUT entered S3 and was running when DUT resumed from S3. Change-Id: I09f3ac43d2e4170b2aff3830f832bc5fd46a15c0 Signed-off-by: Gaggery Tsai <gaggery.tsai@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/627542 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* [fan] Add CONFIG_FAN_SPEED option to override EC fan speedChris Ching2017-10-131-2/+4
| | | | | | | | | | | | | | | | Fans will be initialed at the given RPM, and not the max speed. Changed kahlee to use new method and set speed to ~50%, down from 75% BUG=b:67055475 TEST=run on kahlee board BRANCH=none Change-Id: Iad40a58b531f46ac80572b47aef9378b47222be1 Signed-off-by: Chris Ching <chingcodes@google.com> Reviewed-on: https://chromium-review.googlesource.com/714386 Commit-Ready: Chris Ching <chingcodes@chromium.org> Tested-by: Chris Ching <chingcodes@chromium.org> Reviewed-by: Chris Ching <chingcodes@chromium.org>
* cleanup: DECLARE_CONSOLE_COMMAND only needs 4 argsBill Richardson2016-08-241-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since pretty much always, we've declared console commands to take a "longhelp" argument with detailed explanations of what the command does. But since almost as long, we've never actually used that argument for anything - we just silently throw it away in the macro. There's only one command (usbchargemode) that even thinks it defines that argument. We're never going to use this, let's just get rid of it. BUG=none BRANCH=none CQ-DEPEND=CL:*279060 CQ-DEPEND=CL:*279158 CQ-DEPEND=CL:*279037 TEST=make buildall; tested on Cr50 hardware Everything builds. Since we never used this arg anyway, there had better not be any difference in the result. Change-Id: Id3f71a53d02e3dc625cfcc12aa71ecb50e35eb9f Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/374163 Reviewed-by: Myles Watson <mylesgw@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fan: enable fan after system resumeKeith Tzeng2016-03-301-1/+1
| | | | | | | | | | | | | | | | | | Fan will disable when S3 and S5 by pwm_fan_s3_s5, which call set_enabled(fan, 0) to disable it. But the pwn_fan_resume called fan_set_enabled() which not setting GPIO_FAN_PWR_DIF_L to 1, we should use set_enabled() instead. BUG=chrome-os-partner:50372 BRANCH=master TEST=check fan enable after system resume Signed-off-by: Keith Tzeng <Keith.Tzeng@quantatw.com> Change-Id: Id0bd4dd0afc7e02bcfa6e20401d6e9dfe8a81423 Reviewed-on: https://chromium-review.googlesource.com/335693 Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com> Tested-by: Keith Tzeng <keith.tzeng@quantatw.com> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* pwm: Add common initialization for PWM pinsShawn Nematbakhsh2015-12-041-2/+0
| | | | | | | | | | | | | | | | | | | Rather than having various PWM module groups initialized from various HOOK_INIT functions, group them all into a single module and initialize them all from a common function in pwm.c. BUG=chromium:563708 TEST=Manual on samus / samus_pd (with CONFIG_ADC enabled). Verify that samus fan + KB backlight control is functional and samus_pd correctly sets PWM output. BRANCH=None Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I9f9b09bfa544cd9bc6b7a867e77757dff0505941 Reviewed-on: https://chromium-review.googlesource.com/314882 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* fan: Disable fan when duty / RPM is set to zeroKyoung Kim2015-11-191-9/+9
| | | | | | | | | | | | | | | BRANCH=master BUG=none TEST=Check GPIO(fan_t.enable_gpio) if it is low when S3 or S0ix or 0% duty or 0 RPM on kunimitsu. Change-Id: I6aecae269fa8bb41a811e75089757fe714576160 Signed-off-by: Kyoung Kim <kyoung.il.kim@intel.com> Reviewed-on: https://chromium-review.googlesource.com/310391 Commit-Ready: Kyoung Il Kim <kyoung.il.kim@intel.com> Tested-by: Kyoung Il Kim <kyoung.il.kim@intel.com> Reviewed-by: Kyoung Il Kim <kyoung.il.kim@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* acpi: Ensure continuity of memmap data with a read cacheShawn Nematbakhsh2015-07-281-3/+0
| | | | | | | | | | | | | | | | | | | | | For multi-byte ACPI memmap reads, we previously had a mutex to ensure data continuity. A better approach is to use a read cache. Since the kernel will enable burst mode before reading a multi-byte memmap variable and disable it afterward, we can populate the cache on the first read after enabling burst. This solution removes deadlock bugs, is contained entirely in acpi.c, and saves a deferred function. BUG=chromium:514283 TEST=Manual on Glados. Add prints in acpi_read, verify that multi-byte reads come from cache and non-burst reads continue to function as before. BRANCH=Cyan Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I74e4927bf2b433e31a9ff65d72820fa087c51722 Reviewed-on: https://chromium-review.googlesource.com/288871 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ACPI: Support accessing memmap data over ACPI CMD / DATA portsstabilize-6915.BShawn Nematbakhsh2015-03-251-2/+8
| | | | | | | | | | | | | | | | | | | | | | | Some platforms are unable to access the 900h-9ffh region over LPC and must instead access memmap data through the ACPI CMD / DATA ports. To avoid racing with data updates, disallow changes to multi-byte memmap data while in burst mode. Linux currently enables burst mode when accessing multi-byte data and disables it immediately afterward, though the ACPI spec defines burst mode in a more general way. BUG=chrome-os-partner:38224 TEST=Manual on Samus. Undefine LPC_MEMMAP and modify asl to move memmap data to ERAM at offset 0x20. Verify system boots cleanly and battery status is updated immediately on plug / unplug. BRANCH=None Change-Id: Ib848bdb491fdfece96ad0cee7a44ba85b4a1a50b Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/262072 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* samus: Only update fan speeds every N secondsBill Richardson2015-02-181-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | This adds CONFIG_FAN_UPDATE_PERIOD to limit the frequency at which the fan speeds are updated. Short version: the CPU core temp fluctuates rapidly, causing the fans turn off and on annoyingly often (assuming you have good hearing and are in a quiet room). With this CL, we limit the speed changes to only once every N seconds. N should be long enough to be less annoying, yet short enough that the CPU doesn't overheat while we're not looking. BUG=chrome-os-partner:34789 BRANCH=ToT,samus TEST=manual Let it sit quietly, then visit a busy webpage, then let it sit a while. The fan speed should only change every 10 seconds or so, not every second. Change-Id: Id985350394f24d56dc4a1e51af09487ac643285b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/250501 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* Remove frequent fan-change updates from EC consoleBill Richardson2014-11-141-10/+0
| | | | | | | | | | | | | | | | | | An earlier commit posted fan-change info to the console. Turns out it's a little too annoying, and disabling it with the "chan" command would also hide messages related to thermal shutdown. This just removes those updates completely. BUG=chrome-os-partner:33775 BRANCH=ToT,samus TEST=make buildall -j Watch the EC console. The messages no longer appear. Change-Id: Ie8c48d7ce493a25bf0afbd26d280a87dda882c1a Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/229623 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Samus: Handle fan startup in the EC, not the fan controllerBill Richardson2014-11-061-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* ectool: hostcmd support to set fans auto control individuallyMohammed Habibulla2014-10-071-4/+14
| | | | | | | | | | | | | ectool autofanctrl 1 - set auto fan control for fan 1 BUG=chrome-os-partner:23803 TEST=Tested the above EC command on Auron BRANCH=none Change-Id: Idcd3690ad98d7965420f26f7cc445207fe73704d Signed-off-by: Mohammed Habibulla <moch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221816 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* ectool: Add hostcmd support to set fan duty cycle for each fan separatelyMohammed Habibulla2014-10-071-5/+15
| | | | | | | | | | | | | | ectool fanduty <percent> - set all fans to <percent> duty cycle ectool fanduty <fan> <percent> - set <fan> to <percent> duty cycle BUG=chrome-os-partner:23803 TEST=Tested the above EC commands on Auron BRANCH=none Change-Id: I06ca1552bd8f3412f6e90245da302c9f86ab6103 Signed-off-by: Mohammed Habibulla <moch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221505 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* ectool: Add host command support to set fan RPM for each fan separatelyMohammed Habibulla2014-10-031-9/+24
| | | | | | | | | | | | | | | | | First case is for legacy support ectool pwmsetfanrpm <targetrpm> - set all fans to <targetrpm> ectool pwmsetfanrpm <fan> <targetrpm> - set <fan> to <targetrpm> BUG=chrome-os-partner:23803 TEST=Tested the above EC commands on Auron BRANCH=none CQ-DEPEND=CL:220960 Change-Id: I8f447f53289abaa9c5cc1285f9f0921328fbf32c Signed-off-by: Mohammed Habibulla <moch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221291 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* auron/peppy: fix setting fan max speed by rpm instead of duty cycleMohammed Habibulla2014-09-121-1/+1
| | | | | | | | | | | | | | | Setting initial max speed works by setting RPM but fails when setting with duty cycle BUG=chrome-os-partner:31801 TEST=booted on auron and peppy and confirmed that initial fan speed is set to maximum BRANCH=none Change-Id: I81172a414df13c2e0b2d0f4fe7ff1270fa5f60a3 Signed-off-by: Mohammed Habibulla <moch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/217790 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add cprints() and ccprints()Vic Yang2014-05-211-1/+1
| | | | | | | | | | | | | | | | | | | | | Our code base contains a lot of debug messages in this pattern: CPRINTF("[%T xxx]\n") or ccprintf("[%T xxx]\n") The strings are taking up spaces in the EC binaries, so let's refactor this by adding cprints() and ccprints(). cprints() is just like cprintf(), except that it adds the brackets and the timestamp. ccprints() is equivalent to cprints(CC_CONSOLE, ...) This saves us hundreds of bytes in EC binaries. BUG=chromium:374575 TEST=Build and check flash size BRANCH=None Change-Id: Ifafe8dc1b80e698b28ed42b70518c7917b49ee51 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200490 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Host command to set fan RPM enables fanRandall Spangler2014-02-211-0/+3
| | | | | | | | | | | | | | | | Previously, it would only set the fan RPM, but not actually enable the fan so it can spin at the requested speed. Compare with setting fan duty cycle, which always enabled the fan. BUG=chrome-os-partner:23803 BRANCH=samus TEST=with fans off, 'ectool pwmsetfanrpm 1000' should spin both fans, and the ec 'faninfo' command should show both fans enabled. Change-Id: I37d7fb05309944ab6f98333e2cf3b38ea2dd38e9 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/187386 Reviewed-by: Sameer Nanda <snanda@chromium.org>
* Fix bug in Samus DPTF fan controlBill Richardson2013-12-101-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It worked on Link because the fan number and the fan channel were both 0. Samus has two fans, connected to different GPIOs. In the EC's ACPI interface block, register 0x04 is used to get and set the fan's target duty cycle, as a percentage value. Writing a 0 to this register will set the target duty cycle to 0, writing a 100 (0x64) will set it to 100%. Writing any other value will return the fan control to the EC, rather than driving it manually from the host. Likewise, reading from this register returns the current fan target duty cycle, as a percentage. If the EC is controlling the fan automatically, the returned value will be 0xFF. BUG=chrome-os-partner:23972 BRANCH=samus TEST=manual You can monitor the fan state from the EC console with the "faninfo" command. From the host side, test this interface from a root shell. Read fan duty: iotools io_write8 0x66 0x80 iotools io_write8 0x62 4 iotools io_read8 0x62 Set fan duty to 100%: iotools io_write8 0x66 0x81 iotools io_write8 0x62 4 iotools io_write8 0x62 100 Set fan duty to 50%: iotools io_write8 0x66 0x81 iotools io_write8 0x62 4 iotools io_write8 0x62 50 Set fan duty to 0%: iotools io_write8 0x66 0x81 iotools io_write8 0x62 4 iotools io_write8 0x62 0 Set fan control back to automatic: iotools io_write8 0x66 0x81 iotools io_write8 0x62 4 iotools io_write8 0x62 -1 Change-Id: I3a133b0b16e2a5e1ce04b16cb2bf035a04a83daf Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/179373 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add DPTF interface for fan dutyBill Richardson2013-11-211-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds include/dptf.h to define the DPTF interface functions. As the first DPTF feature, it also adds a register to the EC's ACPI interface block. Register 0x04 is used to get and set the fan's target duty cycle, as a percentage value. Writing a 0 to this register will set the target duty cycle to 0, writing a 100 (0x64) will set it to 100%. Writing any other value will return the fan control to the EC, rather than driving it manually from the host. Likewise, reading from this register returns the current fan target duty cycle, as a percentage. If the EC is controlling the fan automatically, the returned value will be 0xFF. BUG=chrome-os-partner:23972 BRANCH=none TEST=manual You can monitor the fan state from the EC console with the "faninfo" command. From the host side, test this interface from a root shell. Read fan duty: iotools io_write8 0x66 0x80 iotools io_write8 0x62 4 iotools io_read8 0x62 Set fan duty to 100%: iotools io_write8 0x66 0x81 iotools io_write8 0x62 4 iotools io_write8 0x62 100 Set fan duty to 50%: iotools io_write8 0x66 0x81 iotools io_write8 0x62 4 iotools io_write8 0x62 50 Set fan duty to 0%: iotools io_write8 0x66 0x81 iotools io_write8 0x62 4 iotools io_write8 0x62 0 Set fan control back to automatic: iotools io_write8 0x66 0x81 iotools io_write8 0x62 4 iotools io_write8 0x62 -1 Change-Id: I91ec463095cfd17adf452f0967da3944b254d558 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/177423 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Pad jump tags to 4 bytes inside the system moduleRandall Spangler2013-11-051-1/+0
| | | | | | | | | | | | | | | | | | | | | | | That way all the users of jump tags don't need to know about the padding requirements. BUG=chrome-os-partner:23851 BRANCH=none TEST=enable CONFIG_CMD_JUMPTAGS, then 'jumptags'. Output should be something like this: 20007fbc: 0x5550 UP.1 2 20007fc4: 0x4b42 KB.2 3 20007fcc: 0x4c50 LP.1 12 20007fdc: 0x4d54 MT.1 8 All the addresses in the first column should be word-aligned. The sizes in the last column don't need to be a multiple of 4. Change-Id: I91f9c29701a007ef8a56b5b7e0ea09930dfbea31 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/175591 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Clean up hook priorties on LM4Randall Spangler2013-11-041-1/+1
| | | | | | | | | | | | | | | | | | | | Fan no longer needs a special priority to wait for the host memmap to become available, since LPC inits earlier. I2C and PECI don't need explicit ordering on freq change. Thermal now uses the explicit prio for temp sensors done. Commented hook test. BUG=chromium:314768 BRANCH=none TEST=boot link; enable/disable PLL; verify fanset and temps commands work afterwards. Change-Id: I71766614dff2950dd307acd0635405e6b59e330a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/175601 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Provide multiple fan support within the EC itselfBill Richardson2013-11-021-92/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-16/+28
| | | | | | | | | | | | | | | | 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
* Separate common fan behavior from implementationBill Richardson2013-10-301-0/+337
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