summaryrefslogtreecommitdiff
path: root/driver/temp_sensor
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-0531-4384/+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>
* zephyr: drivers: thermistors are device tree nodesAaron Massey2021-09-241-3/+4
| | | | | | | | | | | | | | | | | | | Thermistor drivers now query the device tree for configuration. Thermistor tests have been updated to be parameterized on all thermistors enabled in the device tree. BRANCH=none BUG=b:184374937 TEST= 1) zmake testall 2) make runhosttests Cq-Depend: chromium:3161332 Signed-off-by: Aaron Massey <aaronmassey@chromium.org> Change-Id: Ic5330cd5c33e79e192428ca857651de9a225856e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133812 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Aaron Massey <aaronmassey@google.com> Commit-Queue: Aaron Massey <aaronmassey@google.com>
* tmp112: Support reading TMP112 in millikelvinRob Barnes2021-08-252-13/+35
| | | | | | | | | | | | | | | TMP112 supports .0625 degrees of resolution. Retain this resolution and support reading the temp in degrees millikelvin. BUG=b:176994331 TEST=Build and run on guybrush BRANCH=None Change-Id: I2802016b1edb08678953238e7f01acdd320c37cf Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3001391 Commit-Queue: Diana Z <dzigterman@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* TMP112: Make init externally availableDiana Z2021-06-072-1/+8
| | | | | | | | | | | | | | Since not all boards will power the TMP112 in all power states, allow boards to trigger init themselves when they power up the chip. BRANCH=None BUG=b:188539950 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Id24f559d745e86cdcf2f39a10111decc0797bf28 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2940574 Reviewed-by: Rob Barnes <robbarnes@google.com>
* TMP112: Handle unpowered i2c portsDiana Z2021-06-071-3/+23
| | | | | | | | | | | | | | Some boards may not power their temperature i2c port at all times. If this is the case, don't bother to attempt reading the device. BRANCH=None BUG=b:188539950 TEST=on guybrush version 1, ensure there's no unwedge spam in G3 when the sensor rail is off Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I01516f82a847fba0a5840c507851551f28f59197 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2938047
* TMP112: Support multiple sensorsDiana Z2021-06-072-14/+39
| | | | | | | | | | | | | | | | A board may have more than one TMP112, in which case we need an array to know which address to use for each sensor and for retrieving that sensor's last read temperature. BRANCH=None BUG=b:188539950 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: If3ad286010698683f25825872bd8bfd53b8795e6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2938044 Reviewed-by: Rob Barnes <robbarnes@google.com> Commit-Queue: Rob Barnes <robbarnes@google.com>
* TMP112: Add more I2C addressesDiana Z2021-06-042-3/+6
| | | | | | | | | | | | | | This sensor may support up to 4 addresses, so add all possible options. BRANCH=None BUG=b:188539950 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I6132df521ab57448a8b501c0e4c0ebcdc9eb0bfb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2938043 Reviewed-by: Rob Barnes <robbarnes@google.com> Commit-Queue: Rob Barnes <robbarnes@google.com>
* thermistor: update Steinhart-Hart equationsTomasz Michalec2021-05-201-37/+37
| | | | | | | | | | | | | | | | | | | Fix data table for: - 3v3 51.1K pull-up resistor divider with the 47K thermistor - 3v3 13.7K pull-up resistor divider with the 47K thermistor - 3v0 22.6K pull-up resistor divider with the 47K thermistor Now they are using table based on manufacturer resistance table instead of constant B parameter Steinhart-Hart equation. BRANCH=none BUG=b:184857072 TEST=makeall Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Ib1998c5e528731e4c2f00e0eb76a568eb4acba6e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2886887 Reviewed-by: Jett Rink <jettrink@chromium.org>
* drivers/temp_sensor: add thermistor resistance table docJett Rink2021-05-192-1/+110
| | | | | | | | | | | | | | Add the resistance table we used in the lookup table calculation in the thermistor.c file. BRANCH=none BUG=none TEST=none Change-Id: If9d2e11b5e1b40bf67698187d99849220ff97ea6 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2904831 Reviewed-by: Tomasz Michalec <tm@semihalf.com>
* thermisor: move header to include dirDawid Niedzwiecki2021-04-225-154/+4
| | | | | | | | | | | | | | | | Move the "thermistor.h" header to the include/driver/temp_sensor directory. It is used by the Zephyr shim, so the change is useful to include the header. BUG=b:180403276 BRANCH=none TEST=make buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I0e83df97e50a3b324440b65ddb900ddf135f2439 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2843323 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* COIL: Rename comments in SB-TSI driverDiana Z2021-01-272-2/+2
| | | | | | | | | | | | | | | Rename i2c comments in SBI-TSI temperature driver to match current naming. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ib1c281964105624a733057ed896efcd9b1e357ea Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2649351 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* amd_r19me4070: Set GPU temp to 0 when read failedPuthikorn Voravootivat2020-11-241-1/+6
| | | | | | | | | | | | | | | This avoids returning bogus temperature that caused thermal shutdown. BRANCH=none BUG=b:171325612 TEST=no more thermal shutdown when suspend Change-Id: Ie72d7798431636f23ae528ec9fbf8c9125ea32cc Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2544571 Reviewed-by: Shelley Chen <shchen@chromium.org> Reviewed-by: Dominik Behr <dbehr@chromium.org>
* mushu: Bring up F75303 temp sensorPuthikorn Voravootivat2020-06-161-0/+4
| | | | | | | | | | | | | | | | | | | | BRANCH=None BUG=b:158676970 TEST=Force fan off/run heavy workload Use temps command in ec console, see temp > temps CHARGER : 318 K = 45 C 64% 5V : 316 K = 43 C 61% GPU : 343 K = 70 C 100% F75303_Local : 331 K = 58 C F75303_GPU : 340 K = 67 C F75303_GPU_Power : 332 K = 59 C Change-Id: I0af47849cc606eb03eee652bb261fce11896e2ab Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2240512 Reviewed-by: Bob Moragues <moragues@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* driver/temp_sensor: fix tmp432 compile issueZick Wei2020-05-281-0/+4
| | | | | | | | | | | | | | temp sensor tmp432 will compiler fail when board define CONFIG_TEMP_SENSOR_POWER_GPIO. BUG=b:154189125 BRANCH=none TEST=make buildall Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: I3037a6a114b39568a42bbe2bf1f4da99a30d2044 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2214448 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* Driver : Read GPU temperature in S0.loganliao2020-05-201-1/+7
| | | | | | | | | | | | | | | | | | The GPU is enabled in S0, EC should read GPU temperature in this state. BUG=none BRANCH=none TEST=make BOARD=mushu, Test on Mushu and have not see the init GPU fail log in console when state in S5 or G3. Change-Id: I4a7d53e7bdad12ffd23e187bb0f8120e56467138 Signed-off-by: loganliao <Logan_Liao@compal.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2208337 Reviewed-by: Logan Liao <logan_liao@compal.corp-partner.google.com> Reviewed-by: Bob Moragues <moragues@chromium.org> Tested-by: Logan Liao <logan_liao@compal.corp-partner.google.com> Commit-Queue: Bob Moragues <moragues@chromium.org>
* Mushu : Modify GPU slave address and Cmd protocol.loganliao2020-04-241-18/+21
| | | | | | | | | | | | | | | | | | | The proto address config and protocol that can't read GPU temperature. This patch correct the GPU address and Cmd protocol. Make the EC read GPU with I2C successfully. BUG=b:148968367 BRANCH=none TEST=read temperature success in Mushu Pre-build machine. Change-Id: I39b8c3f55d0b4fea06736545ff76bf8e44abfece Signed-off-by: loganliao <Logan_Liao@compal.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2142846 Reviewed-by: Logan Liao <logan_liao@compal.corp-partner.google.com> Reviewed-by: Bob Moragues <moragues@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org> Tested-by: Logan Liao <logan_liao@compal.corp-partner.google.com> Commit-Queue: Logan Liao <logan_liao@compal.corp-partner.google.com>
* thermal: rename AMD AP I2C port nameZick Wei2020-04-171-1/+1
| | | | | | | | | | | | | | | This patch rename AMD AP I2C port name for zork and grunt family. BUG=b:154189125 BRANCH=none TEST=make buildall and verify EC can get AP temperature through temps command in EC console on morphius board. Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: I846bf671983c9788ad1f42986bfbefda09d5c9b7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2152032 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* Mushu : Add GPU temperature sensor driverloganliao2020-03-132-0/+96
| | | | | | | | | | | | | | | | | Add GPU temperature sensor driver in driver/temp_sensor for temperature read . BUG=b:148968367 BRANCH=none TEST=make BOARD=mushu Change-Id: Ide1613597dbb3712637649c098a7b804370f5e02 Signed-off-by: loganliao <Logan_Liao@compal.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2062117 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Logan Liao <logan_liao@compal.corp-partner.google.com> Commit-Queue: Logan Liao <logan_liao@compal.corp-partner.google.com> Tested-by: Logan Liao <logan_liao@compal.corp-partner.google.com>
* driver/temp_sensor: add support OTI502 temperature sensorDevin Lu2020-01-222-0/+94
| | | | | | | | | | | | | | | This patch adds OTI502 IR temperature sensor driver. OT502 has two temperture information which is ambient and object temperature. ambient is chip temperature and object is IR temperature. BUG=b:140817732 BRANCH=none TEST=none Change-Id: Ia49e0c7962eaa446f788a9104204c6dbe18ee97c Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1925795 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* driver: g753: add driver supportLu Zhang2019-10-252-0/+245
| | | | | | | | | | | | | | | | g753 is used on akemi board. It's a temperature sensor, analog-to-digital converter, and digital over-temperature detector with SMBus interface. BUG=b:138426009, b:143046086 BRANCH=none TEST=use Akemi board, add g753 as temp sensor, boot the board and make sure temperature can be read from g753 Change-Id: Iefa1039628171170cf0ca322b462a29b33eb0df5 Signed-off-by: Lu Zhang <lu.zhang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1857978 Reviewed-by: Philip Chen <philipchen@chromium.org>
* printf: Convert %b to %pbEvan Green2019-10-054-16/+20
| | | | | | | | | | | | | | | | | | | | | | | | In order to turn on compile-time printf format checking, non-standard specifiers like %b (binary) must be removed. Convert that into %pb, which takes a pointer to a structure containing the value to print, and how many bits to print. Use the convenience macro BINARY_VALUE() to package these values up into a struct whose pointer is passed to printf(). Technically this is slightly more limited functionality than we used to support given all the possible flags, field width, and precision. However every existing instance in our codebase was using %0NNb, where NN is some number. If more variants are needed, the parameters structure can be expanded in the future. BUG=chromium:984041 TEST=make -j buildall BRANCH=None Change-Id: I8ef995dcf97af688fbca98ab6ff59b84092b69e3 Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1733100 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* host_command: Change host command return value to enum ec_statusTom Hughes2019-10-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* thermistor: update Steinhart-Hart equationsPaul Fagerburg2019-08-122-1/+53
| | | | | | | | | | | | | | | Add support for 30.9K pull-up on resistor divider with the 47K thermistor. BRANCH=none BUG=b:124316213 TEST=Rebuild EC and flash Change-Id: I5bc72fa67549ab15c0e4e1b0291eb934990ee61b Signed-off-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1742914 Reviewed-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* Remove __7b, __8b and __7bfDenis Brockus2019-07-2019-48/+48
| | | | | | | | | | | | | | | | | | | The extentions were added to make the compiler perform most of the verification that the conversion was being done correctly to remove 8bit addressing as the standard I2C/SPI address type. Now that the compiler has verified the code, the extra extentions are being removed BUG=chromium:971296 BRANCH=none TEST=make buildall -j TEST=verify sensor functionality on arcada_ish Change-Id: I36894f8bb9daefb5b31b5e91577708f6f9af2a4f Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704792 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* Use 7bit I2C/SPI slave addresses in ECDenis Brockus2019-07-1919-40/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Opt for 7bit slave addresses in EC code. If 8bit is expected by a driver, make it local and show this in the naming. Use __7b, __7bf and __8b as name extensions for i2c/spi addresses used in the EC codebase. __7b indicates a 7bit address by itself. __7bf indicates a 7bit address with optional flags attached. __8b indicates a 8bit address by itself. Allow space for 10bit addresses, even though this is not currently being used by any of our attached devices. These extensions are for verification purposes only and will be removed in the last pass of this ticket. I want to make sure the variable names reflect the type to help eliminate future 7/8/7-flags confusion. BUG=chromium:971296 BRANCH=none TEST=make buildall -j Change-Id: I2fc3d1b52ce76184492b2aaff3060f486ca45f45 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1699893 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* ec: Remove extraneous new line as the end of CPRINTS stringsNicolas Boichat2019-06-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | CPRINTS already prints a new line, no need to add another one. Spotted during boot on kukui, and then realized there are many more instances: "" [3.689239 Module 7 is not supported for clock disable ] "" BRANCH=none BUG=none TEST=make buildall -j TEST=`git grep CPRINTS | grep "\\\\n\""` shows nothing of interest. Change-Id: I4d2bbbc65a91fa56c6e6115aa5c353bfd2b384a1 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1660519 Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* LICENSE: remove unnecessary (c) after CopyrightTom Hughes2019-06-1910-10/+10
| | | | | | | | | | | | | | | | 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>
* thermistor: Add STEINHART-HART lookup table for NCP15WB473F03RCVijay Hiremath2019-04-262-1/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The lookup table is based off of a resistor divider circuit on 3.0V with a 22.6K resistor in series with a thermistor with nominal value of 47K (at 25C) and a B (25/100) value of 4050. Calculation: 1. Get the thermistor resistance for a given temperature from the datasheet. 2. Calculate the ADC input voltage. Vout = (Vdd * Rt) / (Rt + Rs) Where: Vdd - Source voltage (Constant) Vout - ADC value read on STEINHART-HART voltage divider circuit Rt - Resistance of thermistor at given temperature Rs - Series resistance value (constant) 3. Form a STEINHART-HART lookup table for 0 to 100 deg C 4. Add a scaling factor so that the STEINHART-HART lookup table data is 1-byte per pair. BUG=b:131060744 BRANCH=none TEST=Manually tested on ICLRVP, able to read correct temperature Change-Id: Ib0e7b1ab6d6d4c5bcb14ff4ab0e830881e9864e6 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/1577741 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
* common: replace 1 << digits, with BIT(digits)Gwendal Grignou2019-03-268-90/+90
| | | | | | | | | | | | | | | | 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>
* thermistor: Consolidate thermistor_get_temperature() functionsVijay Hiremath2019-03-091-52/+32
| | | | | | | | | | | | | | BUG=none BRANCH=none TEST=make buildall -j Change-Id: I30064163b1af1090e75fbd4927ef25f77ddc043a Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/1510516 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* temp_sensor: Guard thermistor readings by their power rail enable gpioScott Collyer2019-02-121-6/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a temperature reading is taken using a thermistor circuit when the power rail for that circuit is not powered, then the resultiing reading will convert to a very high temperature which will then lead to a false thermal shutdown event. This CL utilizes an existing config option CONFIG_TEMP_SENSOR_POWER_GPIO to allow for the thermistor driver functions to know which gpio to check to see if a power rail is enabled or not. If the rail is not enabled, the function returns EC_ERROR_UNKNOWN so the reading will be ignored by the calling function. Since this change to the thermistor driver is dependent on the config option, it does not affect in existing boards, but can be used for boards that have this requirement. BRANCH=none BUG=b:123900860 TEST=Verified that the the EC console message 'thermal SHUTDOWN' no longer appears following an EC reboot as the ADC readings are now ignored if the GPIO controlling the power rail is not enabled. Change-Id: I92b010ab7e801f4897edb3a6d0325d9d7fc74f21 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1448816 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* temp_sensor: Add (basic) support for TI TMP468 Temperature SensorMoritz Fischer2018-09-132-0/+225
| | | | | | | | | | | | | | | Add (basic) support for TI TMP468 a 8 Remote + 1 Local channel temperature sensor. BUG=none BRANCH=master TEST=Hook up EVM to I2C port of a STM32F072, read temperatures Change-Id: I6d6644825af04391841847c060f8ffaeff620094 Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com> Reviewed-on: https://chromium-review.googlesource.com/1213554 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* bip: Add charger temp sensorJustin TerAvest2018-07-302-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The voltage used for the charger thermistor is 6.0V, which requires new tables to be created for that configuration. Additionally, the voltage rail used for measuring temperature comes from the charger LDO, which is only powered when AC is present. This was tested as below: > temps Battery : 299 K = 26 C Ambient : 300 K = 27 C Charger : 302 K = 29 C [Removed AC power] > temps Battery : 299 K = 26 C Ambient : 300 K = 27 C Charger : Not powered Not Powered BRANCH=None TEST=built, ran "temps" BUG=b:80145756,b:79932676 Change-Id: I391d2b6eaddc0f6a99f7b7ce565c245838f608f9 Signed-off-by: Justin TerAvest <teravest@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1150416 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* F75303: Set fake temperatureTino Liu2018-07-261-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add new console command `f75303` to set fake temperature for F75303. Usage: f75303 <index> <value>|off <index> 0: F75303_Local 1: F75303_Remote1 2: F75303_Remote2 <value> integer from 0 to 100 (Celsius degree) "off" turn off fake temperature mode, back to normal BUG=none BRANCH=master TEST=fan target speed can follow fake temperature, make buildall pass Change-Id: I341434207af71cf6aa63350887eac3499508d2ff Signed-off-by: Tino Liu <tino.liu@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/1141746 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* f75303: Simplify f75303_get_val APIDaisuke Nojiri2018-07-232-30/+17
| | | | | | | | | | | | | | | | | | This patch simplifies the f75303_get_val API for better readability and preparation for the upcoming temperature control command. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=Verify temps command print expected values on Sona. Change-Id: I8c71a64c5a5f766f12cf2b3ab59ef6b7481d1b59 Reviewed-on: https://chromium-review.googlesource.com/1146903 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* f75303: Make get_temp return temperature in KelvinDaisuke Nojiri2018-07-191-6/+1
| | | | | | | | | | | | | | | | | | This patch makes get_temp of f75303 driver return the temperature in Kelvin. This makes code more readable and efficient. There should be no functionality change. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=Verify temps command print expected temperature on Sona. Change-Id: Id5c052b8b97822348ec1c1c6a2c62529ecac9463 Reviewed-on: https://chromium-review.googlesource.com/1142692 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* thermistor: move thermistor tables into common codeJett Rink2018-06-153-54/+187
| | | | | | | | | | | | | | | | | The exact same 2 lookup tables are in multiple board files. We seem to reuse the 2 thermistor circuit enough that we should single source them in a common location. BRANCH=none BUG=none TEST=yorp sensors still function properly Change-Id: Ic393c609c78c8a51c55a67b639c1fb9e6c387d8a Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1100943 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Justin TerAvest <teravest@chromium.org>
* Nami: Add remote temperture 2 reading functionElthan_Huang2018-02-272-4/+13
| | | | | | | | | | | | | | | | | | | 1. Add reading function for remote2 temperature (Fintek, F75303) 2. Modify the temp_sensors to read sensor remote1 and remote2 for nami. BUG=b:72974136 BRANCH=none TEST=Verify Nami can get thermal remote 2 data by command "ectool temps all" Change-Id: I5e4a58f20089ed5690e2a084e93e7021e80afcdc Signed-off-by: Elthan_Huang <elthan_huang@compal.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/910270 Commit-Ready: Raymond Chou <raymond_chou@compal.corp-partner.google.com> Tested-by: Raymond Chou <raymond_chou@compal.corp-partner.google.com> Reviewed-by: Raymond Chou <raymond_chou@compal.corp-partner.google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
* Nami: Update for ALS and temperture sensorElmo_Lan2018-01-282-0/+96
| | | | | | | | | | | | | | | | | Implement ALS code and add a new thermal sensor (Fintek, F75303) BUG=b:71839392 BRANCH=none TEST=Verify Nami can read ALS and thermal data via I2C by ec console. Change-Id: I0f8fd486f62508bbca30a57f435b9f26621cf34b Signed-off-by: Elmo_Lan <elmo_lan@compal.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/863350 Commit-Ready: Elmo Lan <elmo_lan@compal.corp-partner.google.com> Tested-by: Elmo Lan <elmo_lan@compal.corp-partner.google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Elmo Lan <elmo_lan@compal.corp-partner.google.com>
* Add SB-TSI temp sensor driverAlec Thilenius2018-01-032-0/+86
| | | | | | | | | | | | | | | | | | This adds the driver for the SB-TSI temp sensor. This is a sensor on the AMD AP SOC (Stoney Ridege FT2) that acts like an 8-pin temp sensor with an I2C interface. BUG=b:69379715 BRANCH=None TEST=Build Change-Id: Iaafe6c7beb3e02e4e341617e8f117c03c0a882a2 Signed-off-by: Alec Thilenius <athilenius@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/833346 Commit-Ready: Alec Thilenius <athilenius@google.com> Tested-by: Alec Thilenius <athilenius@google.com> Reviewed-by: Edward Hill <ecgh@chromium.org>
* ec_driver: Add ADT7481 and TMP411 I2C sensorsScott Worley2017-12-284-0/+996
| | | | | | | | | | | | | Added I2C sensors ADT7481 and TMP411 with config items and build rules. BRANCH=none BUG= TEST=Define CONFIG_TEMP_SENSOR_ADT7481 or _TMP411 and build board. Change-Id: I4d1eb55ee56ad3f42787538bb839193e683d0a60 Signed-off-by: Scott Worley <scott.worley@microchip.corp-partner.google.com>
* Fizz: Modify thermal tableRyan Zhang2017-11-062-8/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* driver: temp_sensor: Add support for TI TMP112 sensorMoritz Fischer2016-12-302-0/+111
| | | | | | | | | | | | | | | Add support for the Texas Instruments TMP112 I2C temperature sensor. The sensor provides a single temperature value. BUG=none BRANCH=none TEST=Ran 'temp' console command over and over. Verified values with digital thermometer. Change-Id: Ida4c082309d245c3f7c6282ecea74ce5af746e43 Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com> Reviewed-on: https://chromium-review.googlesource.com/418488 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fix various misspellings in commentsMartin Roth2016-11-151-1/+1
| | | | | | | | | | | | | No functional changes. BUG=none BRANCH=none TEST=make buildall passes Change-Id: Ie852feb8e3951975d99dce5a49c17f5f0e8bc791 Signed-off-by: Martin Roth <martinroth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/403417 Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
* cleanup: DECLARE_CONSOLE_COMMAND only needs 4 argsBill Richardson2016-08-243-6/+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>
* Correct interpolation algorithm of thermal values.Ravi Chandra Sadineni2016-08-172-19/+20
| | | | | | | | | | | | | | | Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org> BRANCH=none BUG=chrome-os-partner:56206 TEST=make buildall -j Change-Id: I22ac65f33b27b8ce8ad0687971f47b82395aa781 Reviewed-on: https://chromium-review.googlesource.com/370402 Commit-Ready: David Hendricks <dhendrix@chromium.org> Commit-Ready: Ravi Chandra Sadineni <ravisadineni@chromium.org> Tested-by: Ravi Chandra Sadineni <ravisadineni@chromium.org> Reviewed-by: David Hendricks <dhendrix@chromium.org>
* thermistor: Add generic linear interpolation algorithmDavid Hendricks2016-08-012-0/+89
| | | | | | | | | | | | | | | | | | | | | | | | | The existing algorithm makes several assumptions for a particular thermistor circuit. This patch introduces a more generic version that can be used for multiple thermistors on a single board. The idea is to approximate a curve produced by solving for voltage measued by an ADC using the Steinhart-Hart equation. For a straight line one only needs two data points. For a steady curve data points can be distributed evenly. For the most part, though, data points should be provided after a significant change in slope. More data points give more accuracy at the expense of memory, and we mostly only care about accuracy in the range between "warm" and "too hot" so only a few data points should be used. BUG=chrome-os-partner:54818 BRANCH=none TEST=added unit test, needs real testing Change-Id: I046e61dbfd1e8c26c2a533777f222f5413938556 Signed-off-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/344781 Reviewed-by: Shawn N <shawnn@chromium.org>
* COMMON: Add extend function for tmp432 ICRyan Zhang2016-05-182-0/+90
| | | | | | | | | | | | | | + create interface to set ALERT# pin as THERM mode and set high limit for a selected channel BUG=None BRANCH=master TEST=`make -j runtests` Change-Id: I7325eb9ddfcaca3ea873e1ee71da74258d7bec72 Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/344435 Reviewed-by: Shawn N <shawnn@chromium.org>
* temp sensor: add support for G782Kevin K Wong2016-04-034-286/+375
| | | | | | | | | | | | | | modify g781.c/.h to g78x.c/.h to suppor both G781/G782 temp sensor based on CONFIG_TEMP_SENSOR_G781 or CONFIG_TEMP_SENSOR_G782 BUG=none BRANCH=none TEST=make buildall; able to get temperature data on board with G782 Change-Id: Ia32c85e9964bfd7c0c5263f04368bc001a27fe10 Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-on: https://chromium-review.googlesource.com/334228 Reviewed-by: Shawn N <shawnn@chromium.org>
* driver/temp_sensor: Add support thermistor on EC's own ADCWonjoon Lee2015-09-112-0/+80
| | | | | | | | | | | | | | | | | Add support for ADC / thermistor reads on the EC's ADC This will support now only ncp15wb but we can expand it at future time. BUG=chrome-os-partner:44764 TEST=make buildall -j Manual on celes with subsequent commit. Boot to S0, run "temps". Verify that temperatures are. See temperature is changing BRANCH=None Change-Id: If26d24b803dcff00c4c24e4e1f71d3b0de8e6738 Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/296872 Reviewed-by: Shawn N <shawnn@chromium.org>