summaryrefslogtreecommitdiff
path: root/common/temp_sensor.c
Commit message (Collapse)AuthorAgeFilesLines
* host_command: Change host command return value to enum ec_statusTom Hughes2019-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* 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>
* cleanup: DECLARE_CONSOLE_COMMAND only needs 4 argsBill Richardson2016-08-241-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* separate dptf logic from existing thermal logic.Ravi Chandra Sadineni2016-07-301-0/+2
| | | | | | | | | | | | | | | | Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org> BRANCH=none BUG=chromium:631848 TEST=make buildall -j Change-Id: I718a29b067d37af477306f9bebfcb8e71d84d4ee Reviewed-on: https://chromium-review.googlesource.com/363008 Commit-Ready: David Hendricks <dhendrix@chromium.org> Tested-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@google.com>
* Show the fan-cooling percentage for each active temp sensorBill Richardson2015-01-141-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When displaying the temps, if the sensor has valid entries to control the target fan speed, show them. This lets us see which sensor is the main player in the cooling needed without doing a bunch of math. BUG=none BRANCH=none TEST=manual On the EC console: > thermalget sensor warn high halt fan_off fan_max name 0 368 370 372 316 358 PECI 1 0 0 0 0 0 ECInternal 2 0 0 0 314 328 I2C-Charger-Die 3 0 0 0 0 0 I2C-Charger-Object 4 0 0 0 308 322 I2C-CPU-Die 5 0 0 0 0 0 I2C-CPU-Object 6 0 0 0 301 317 I2C-Left C-Die 7 0 0 0 0 0 I2C-Left C-Object 8 0 0 0 302 316 I2C-Right C-Die 9 0 0 0 0 0 I2C-Right C-Object 10 0 0 0 303 317 I2C-Right D-Die 11 0 0 0 0 0 I2C-Right D-Object 12 0 0 0 316 327 I2C-Left D-Die 13 0 0 0 0 0 I2C-Left D-Object Then, before this CL: > temps PECI : 308 K = 35 C ECInternal : 309 K = 36 C I2C-Charger-Die : 307 K = 34 C I2C-Charger-Object : Not calibrated I2C-CPU-Die : 304 K = 31 C I2C-CPU-Object : Not calibrated I2C-Left C-Die : 302 K = 29 C I2C-Left C-Object : Not calibrated I2C-Right C-Die : 303 K = 30 C I2C-Right C-Object : Not calibrated I2C-Right D-Die : 303 K = 30 C I2C-Right D-Object : Not calibrated I2C-Left D-Die : 306 K = 33 C I2C-Left D-Object : Not calibrated After this CL: > temps PECI : 308 K = 35 C 0% ECInternal : 309 K = 36 C I2C-Charger-Die : 307 K = 34 C 0% I2C-Charger-Object : Not calibrated I2C-CPU-Die : 304 K = 31 C 0% I2C-CPU-Object : Not calibrated I2C-Left C-Die : 302 K = 29 C 6% I2C-Left C-Object : Not calibrated I2C-Right C-Die : 303 K = 30 C 7% I2C-Right C-Object : Not calibrated I2C-Right D-Die : 303 K = 30 C 0% I2C-Right D-Object : Not calibrated I2C-Left D-Die : 306 K = 33 C 0% I2C-Left D-Object : Not calibrated Change-Id: I12bca5826e8a5a3325710fa5d39cec88f1cc95b1 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/240517
* cleanup: Rename and move header filesRandall Spangler2013-10-231-11/+2
| | | | | | | | | | | | | | Device-specific headers belong in driver/ or chip/. The include/ directory should be for common interfaces. Code should not normally need to include driver-specific headers. If it does, it should use the full relative path from the EC project root (for example, drivers/charger/bq24715.h). Change-Id: Id23db37a431e2d802a74ec601db6f69b613352ba Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173746 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Also test temp sensor read delegation in thermal testVic Yang2013-09-041-1/+1
| | | | | | | | | | | | | | Temperature sensor read is delegated to functions defined in board.c. Let's mock that function instead of the one in temp_sensor module. BUG=chrome-os-partner:19236 TEST=Pass thermal test. BRANCH=None Change-Id: Ic0387bd6a49e3f032e593c11c6f80bd36f8474e7 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/167761 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Completely new thermal/fan implementationBill Richardson2013-08-231-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Use macros for C <-> K conversionsBill Richardson2013-08-071-1/+1
| | | | | | | | | | | | | | | This just replaces all the "X - 273", "Y + 273" stuff with a macro. BUG=none BRANCH=falco,peppy TEST=manual Run the EC console command "temps". It should print human-readable things. Change-Id: Icc4284c89fdbc0cd3b206a0faacf121973652a63 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/65005 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Revert "Revert "Add thermal engine test""Vic Yang2013-05-171-1/+1
| | | | | | | | | | | | | | | This reverts commit 89e688a3325e91d3c59ac639f04f2c91019c9b10. Time-scaling is added back. We can run this test now. BUG=chrome-os-partner:19236 TEST=Pass the test. BRANCH=None Change-Id: Id3dcec6fc12489f5f0602de91c6560a8dfbef9af Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/51551 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Revert "Add thermal engine test"Vic Yang2013-05-161-1/+1
| | | | | | | | | | | | | | | | Time-scale functionality is temporarily reverted and this test is now taking too long. Revert this test now. Will add it back when we solve the time-scale issue. This reverts commit d9cf88b35ad211d873f48b41fd985e22ff049b83 Change-Id: Id9ce1071eb2114dd6968d3df9f0bce395edaeef6 Reviewed-on: https://gerrit.chromium.org/gerrit/51482 Commit-Queue: Vic Yang <victoryang@chromium.org> Tested-by: Vic Yang <victoryang@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org> Tested-by: Stéphane Marchesin <marcheu@chromium.org>
* Add thermal engine testVic Yang2013-05-151-1/+1
| | | | | | | | | | | BUG=chrome-os-partner:19236 TEST=Pass the test. BRANCH=None Change-Id: I1c96437e1fb3492faa5352383f852dc1d2718ace Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/51248 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Switch temp sensor polling to use hooks instead of taskRandall Spangler2012-11-011-29/+5
| | | | | | | | | | | | | | This reduces memory / code size, and gets rid of ifdefs in temp_sensor.c. BUG=chrome-os-partner:15714 BRANCH=none TEST=boot system and run 'ectool temps all' every few seconds - ectool temps all The numbers should update over time. Change-Id: Idaac7e6e4cbc1d6689f5d3b607c623a5cc536a4f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36940
* Use SECOND and MSEC constantsRandall Spangler2012-10-291-1/+1
| | | | | | | | | | | | | | | | | | We'd defined them in a number of different files. This moves definitions to timer.h, and uses them everywhere we have large delays (since 10*SECOND is less typo-prone than 10000000). Also add msleep() and sleep() inline functions. No need for mdelay() or delay(), since any delays that long should use sleep funcs instead of spin-waiting. BUG=chrome-os-partner:15579 BRANCH=none TEST=boot system; taskinfo displays similar numbers to before Change-Id: I2a92a9f10f46b6b7b6571759b1f8ab4ecfbf8259 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36726
* Clean up thermal modulesRandall Spangler2012-10-261-10/+32
| | | | | | | | | | | | No functional changes. BUG=chrome-os-partner:15579 BRANCH=none TEST='temps' should print good temperatures Change-Id: I20bd2376b86f1e9d2f9a91016ed90bb933235021 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36611
* link: TMP006 S0 param is uncalibrated by defaultRandall Spangler2012-10-111-3/+14
| | | | | | | | | | | | | | | | | | | | S0 values are incorrect and may even need to be calibrated on a per-system basis. Set them to 0 by default so that the EC doesn't return inaccurate remote temperature readings before calibration data is sent. BUG=chrome-os-partner:15174 BRANCH=link TEST=manual - temps -> remote temps are all not calibrated - t6cal 1 s0 9301 - temps -> PCH D-Object temp now returns a temperature Change-Id: I43facc60cf947ebd9441a8a629a76f7ffc8f3959 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35302 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* link: Added sensor-not-calibrated error for TMP006Randall Spangler2012-10-111-0/+3
| | | | | | | | | | | | | | BUG=chrome-os-partner:15174 BRANCH=link TEST=manual, from root shell - ectool temps all -> prints all temps - ectool tmp006cal 1 0 0 0 0 - ectool temps all -> sensor 3 not calibrated Change-Id: I16ee818c948fe90ac7c18b230c5d9f9a0ec83ded Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35288 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* link: Temp sensors can return not-powered error codeRandall Spangler2012-10-111-22/+8
| | | | | | | | | | | | | | | | | | | | | | | This removes the need for a separate method to check sensor power, and gets rid of temp_sensor.c knowledge of what powers each sensor. BUG=chrome-os-partner:15174 BRANCH=link TEST=manual - reboot - within a second, type 'temps'; I2C sensors should return error 1 - type 'temps' again; all sensors should return data - power off system - type 'temps' again; I2C sensors and PECI should return error 8 - 'gpioset enable_vs 1' - type 'temps' again; I2C sensors should return valid data; PECI should still return error 8. Change-Id: I17c353b3c483bc320769307c7715008ec729089b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35287 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* link: Temp sensor read can return an error codeRandall Spangler2012-10-111-18/+12
| | | | | | | | | | | | | | | | | | | | | This will be used in a follow-up CL to return specific error codes (not powered, not calibrated, etc.) BUG=chrome-os-partner:15174 BRANCH=link TEST=manual Power on system. 'temps' should return all good temps. Power off system (into S5) Only ECInternal temp should work; others should return Error 1 'gpioset enable_vs 1' and wait a second Now all the I2C temps should display good data, but PECI will still be error 1. Change-Id: I925434e71653ad53ad76bad992a7a8fdeadb088c Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35286 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Initialize temperature reading buffer to sane valuesVic Yang2012-08-131-5/+23
| | | | | | | | | | | | | | This is to prevent temperature value being read before the first time we poll sensors causes unexpected error. BUG=chrome-os-partner:12614 TEST="sysjump RW" and then "temps" immediately. Check all temperature readings are near 300 K. Change-Id: I5c84d9696b4876fdfcf14c3a416cbc09c040d4ee Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/30138 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Support up to 24 thermal sensorsRandall Spangler2012-07-221-10/+25
| | | | | | | | | | | | | | | | | And tidy reporting fan/thermal via memmap. BUG=chrome-os-partner:11628 TEST=manual ectool pwmgetfanrpm -> should report fan speed ectool temps N -> should work for N=0-9 reports error for N=15-23 reports invalid sensor ID for N<0 or N>23 Change-Id: I484f81399f5e9dae9c759401091cc6f5acc733ff Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/28032 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Initialize memory mapped data and add data versionsRandall Spangler2012-07-121-0/+4
| | | | | | | | | | | | | | | | | | BUG=chrome-os-partner:11275 TEST=manual localhost ~ # io_read8 0x920 0x45 // 'E' localhost ~ # io_read8 0x921 0x43 // 'C' localhost ~ # io_read8 0x922 0x01 // version 1 localhost ~ # io_read8 0x9fe 0x00 // unused data initialized to 0 Change-Id: If8de85ddc0e5f99b7c4213214d4b2d30b1439da8 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/27196
* Add memory-mapped data support for I2C and SPI protocolsRandall Spangler2012-07-071-6/+5
| | | | | | | | | | | | | | | And fix returning memory-mapped string length on LPC as well. BUG=chrome-os-partner:11090 TEST=manual from EC, 'hostevent set 0x40000' from host, 'ectool eventget' --> should print 0x40000 Signed-off-by: Randall Spangler <rspangler@chromium.org> Change-Id: I9edbd0a1468b5d4160ce67c471332226e51fa868 Reviewed-on: https://gerrit.chromium.org/gerrit/26719 Reviewed-by: Simon Glass <sjg@chromium.org>
* Lower PECI baud rate and increase poll frequencyVic Yang2012-07-031-6/+16
| | | | | | | | | | | | | | | | | | | We see some intermittent failure on PECI read. This CL lower PECI baud rate from 150K to 100K. Also, we poll PECI temperature 4 times per second and average over last 4 values. We only report read error when last 4 read all fails. This CL also increases the external path delay, increases retry count, and also enable timing negotiation error bypass. BUG=chrome-os-partner:10382 TEST=Still able to read from all temperature sensors Change-Id: I38cefeabd9e3eff4bb8e4df4138c4ffd49cd84a2 Reviewed-on: https://gerrit.chromium.org/gerrit/26554 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Vic Yang <victoryang@chromium.org> Commit-Ready: Vic Yang <victoryang@chromium.org>
* Better help for console commandsRandall Spangler2012-05-251-1/+4
| | | | | | | | | | | | | | | | | | | | Additional help messages and usage are gated by CONFIG_CONSOLE_CMDHELP, so we can turn it on if there's space (adds about 3KB to image size) and turn it off when there isn't. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST=manual 1) help 2) help list 3) help gpioset 4) gpioset -> wrong number of params 5) gpioset fred 0 -> param1 bad 6) gpioset cpu_prochot fred -> param2 bad Change-Id: Ibe99f37212020f763ebe65a068e6aa83a809a370
* Even more debug command cleanup to save spaceRandall Spangler2012-05-211-10/+4
| | | | | | | | BUG=none TEST=(run the commands) Change-Id: Ibc414ffd594e06dbdce64c51859b6f247bb10d36 Signed-off-by: Randall Spangler <rspangler@chromium.org>
* de-LPCify the EC host interfaceVincent Palatin2012-05-151-4/+3
| | | | | | | | | | | | | Preparatory work to use common host command code between ARM and x86. Just rename constants, do not change the binary API. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=chrome-os-partner:9614 TEST=make BOARD=link Change-Id: I534d427c9b50103273835a6f32a0ddb622c762b3
* Use console output instead of uart output for console commandsRandall Spangler2012-04-241-5/+5
| | | | | | | | | | | | This completes console output cleanup. The remaining calls to uart_puts() and uart_printf() actually need to be that way. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:7464 TEST=manual Change-Id: Ib1d6d370d30429017b3d11994894fece75fab6ea
* Clean up initsRandall Spangler2012-04-191-7/+0
| | | | | | | | | | | | We can clear the reset cause in system pre-init now because of a previous change which preserves it across a sysjump. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST=if it boots, it works Change-Id: I1d8b99df5a0be0de9545d22ad1a6b7fb3140f813
* Change task messages to eventsRandall Spangler2012-04-061-2/+2
| | | | | | | | | | | | | Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:7461 TEST=manual make BOARD={bds,link,daisy} make tests flash link system and make sure it boots Change-Id: I1241a1895c083e387e38ddab01ac346ca4474eb9
* Temp sensor report 0xfd on sensor unpowered.Vic Yang2012-03-141-8/+34
| | | | | | | | | | | | | Make temp sensor report 0xfd when sensor is unpowered. Also refactor power specification of temp sensors from thermal.c to temp_sensor.c. Signed-off-by: Vic Yang <victoryang@google.com> BUG=chrome-os-partner:8279 TEST=none Change-Id: Ib13813bdbac2f048fbc3b98fae5bbf104ebf37d7
* Tidy output of temps commandRandall Spangler2012-03-131-3/+3
| | | | | | | | | Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST=temps - see, prettier! Change-Id: Ia11937e8b1be384f7b8386c97aea0eb3e2eef897
* Write temperature values to LPC mapped value space.Vic Yang2012-02-241-0/+19
| | | | | | | | | | | | Add a task to update temperature values in LPC mapped value space every second. Also modify ectool to read directly from LPC mapped space. Signed-off-by: Vic Yang <victoryang@chromium.org> BUG=chrome-os-partner:8065 TEST="ectool temps" gives same result as "temps" from ec console. Change-Id: Idcdef8d822724f9bd22d7e819c717cba5af5eb77
* Temperature polling and temporal correctionVic Yang2012-02-181-217/+19
| | | | | | | | | | | | | | | | A temperature polling task is added to achieve temporal correction and also reduce the latency of reading temperature. Factor out sensor specific part to keep code clean. Signed-off-by: Vic Yang <victoryang@chromium.org> BUG=chrome-os-partner:7801 TEST=On link, 'temps' shows all temperature readings. Cover each sensor with hand and see object temperature rise. Compilation succeeded on bds/adv/daisy/discovery. Change-Id: I3c44c8b2e3ab2aa9ce640d3fc25e7fba56534b86
* Add fixed-point temp calculation as backup option.Vic Yang2012-02-161-0/+46
| | | | | | | | | | | | | We prefer to use floating-point version but we might need fixed-point version in the future if we don't have FPU support. If CONFIG_FPU flag is not set, fixed-point object temperature calculation would be used. Signed-off-by: Vic Yang <victoryang@chromium.org> BUG=chrome-os-partner:7801 TEST=none Change-Id: I69364b10bedf1351206e52266d669b4c566bd6f6
* Change TMP006 temperature calculation to use FP.Vic Yang2012-02-151-40/+30
| | | | | | | | | | | | | | The temperature calculation currently uses fixed point operations. Change it to use floating point for better readability and maintenance. Also changes disable_fpu() to accept parameter which serves as optimization barrier to prevent floating point operations after disabling FPU. BUG=chrome-os-partner:7801 TEST=In console, tempremote "tempremote 29715 -105000 6390" gives 28506. Change-Id: Ib766904b8feb9a78eac9f7cd53afeca85091c5a5 Signed-off-by: Vic Yang <victoryang@chromium.org>
* Change temperature sensor debug command behaviourVic Yang2012-02-141-4/+5
| | | | | | | | | | | | | | | Currently, 'tempsinfo' command would abort when encountering problems reading temperature sensor info. Change this command to continue reading succeeding sensors. Also change 'temps' to show temperature in both 'K' and 'C' for better reading and easier debugging. BUG=chrome-os-partner:7527 TEST=none Change-Id: I41a4068fb58804cb000e6725c0894aabd0104119 Signed-off-by: Vic Yang <victoryang@chromium.org>
* Fix discovery and bds builds, which don't have temp sensor or peciRandall Spangler2012-02-131-2/+2
| | | | | | | | | | | | | Remove id field from temp_sensor_t struct, since it's only used by the console command (which already knows the id, because it's looping over it). Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST='temps' Change-Id: I0970850073d644509cd5501d7ac4421c7373143b
* Add tmp006 object temperature calculationVic Yang2012-02-081-1/+111
| | | | | | | | | | Implement TMP006 object temperature calculation. Also add a console command to calculate temperature with manually entered data. BUG=chrome-os-partner:7801 TEST=In console, "tempremote 29715 -105000 6390" gives 285.00K. Change-Id: I0f9193fb970fdc36566399e7083e73ab58965a85
* Refactor temperature sensor code and add support of Link I2C temp sensor.Vic Yang2012-02-041-0/+142
Refactor board/chip-specific code into corresponding directories. Add support of the four I2C temp sensor in Link. Use table lookup to handle different types of temperature sensors. BUG=chrome-os-partner:7527 TEST=Correctly read EC internal temperature on bds. Compile for link succeeded. Change-Id: I694cfa54e1545798d877fafdf18c5585ab5f03e2